Anylogic:测量服务时间

时间:2018-11-13 13:08:24

标签: time anylogic utilization

在以下模型Image中,该图将服务块的利用率可视化。但是,此利用率代表正在处理的代理的平均数量。

我想找出服务块在模型的总运行时间内延迟代理的时间。这将为我提供容量利用率的更准确表示。这可能吗?

1 个答案:

答案 0 :(得分:0)

您可以使用数据集或统计元素(在分析面板中找到)甚至是集合,并添加如下值: Service delayed time

输入延迟时间:

#include <stdio.h>
#include <vector>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#include <math.h>

using namespace std;

vector<vector<int> >GRAPH(100);
inline void print_path(vector<int>path)
{
    cout<<"[ ";
    for(int i=0;i<path.size();++i)
    {
        cout<<path[i]<<" ";
    }
    cout<<"]"<<endl;
}
bool isadjacency_node_not_present_in_current_path(int node,vector<int>path)
{
    for(int i=0;i<path.size();++i)
    {
        if(path[i]==node)
        return false;
    }
    return true;
}
int findpaths(int source, int target, int n, int e)
{
    vector<int>path;
    path.push_back(source);
    queue<vector<int> >q;
    q.push(path);

    while(!q.empty())
    {
        path=q.front();
        q.pop();

        int last_nodeof_path=path[path.size()-1];
        if(last_nodeof_path==target)
        {
            cout<<"The Required path is:: ";
            print_path(path);
        }
        else
        {
            print_path(path);
        }

        for(int i=0;i<GRAPH[last_nodeof_path].size();++i)
        {
            if(isadjacency_node_not_present_in_current_path(GRAPH[last_nodeof_path][i],path))
            {

                vector<int>new_path(path.begin(),path.end());
                new_path.push_back(GRAPH[last_nodeof_path][i]);
                q.push(new_path);
            }
        }
    }
    return 1;
}
int main()
{
    int D,T,N,M,u,v,source,target;
    scanf("%d",&T); // type 1
    while(T--)
    {
        printf("Enter Total Nodes & Diameter \n");
        cin >> N >> D;

        M = N*floor((N+6*D-2)/(4*D))*2;

        int numberofxcycles = floor((N+6*D-2)/(4*D));
        int xcycles[numberofxcycles];
        int i;
        int e = N*numberofxcycles*2;

        for(i = 0; i < numberofxcycles; i++){
            xcycles[i] = floor((N-2)/(4*D)) + i;
        }

        int k, j, cycle, cycle2;
        int mat[e][2];
        for(k = 1; k <= N; k++){
            cycle = 0;
            cycle2 = 0;

            for(i = 0; i < numberofxcycles; i++){
                if(k+(xcycles[i]+1) > N){
                    cycle = N;
                }
                if(k-(xcycles[i]+1) < 1){
                    cycle2 = N;
                }
                for(j = 0; j<e/2; j=j+2){
                    mat[j][1] = k;
                    mat[j+1][1] = k;
                    mat[j][2] = k+(xcycles[i]+1)-cycle;
                    mat[j+1][2] = k-(xcycles[i]+1)+cycle2;
                }
            }
        }

        for(int i=0;i<M;++i)
        {
            u = mat[i][1];
            v = mat[i][2];
            GRAPH[u].push_back(v);
        }

        printf("(Source, target)\n");
        scanf("%d%d",&source,&target);
        findpaths(source,target,N,M);
        return 0;
    }
}

退出时(或退出时)

agent.enterTime=time();

当然,这需要您在代理中添加一个名为enterTime的变量。