座席状态时间统计 [英] Agent time-in-state statistics

查看:31
本文介绍了座席状态时间统计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想知道 AnyLogic 社区用于在状态统计中记录时间的不同方法.为了解释我的意思,我举个例子:

I'm interested to know the different methods the AnyLogic community uses to record time in state statistics. To explain what I mean, I'll give you an example:

假设我正在为一个拥有多个电影院的电影院建模.每个电影院都被建模为一个具有状态图的代理,其中电影院可以处于多种状态之一:

Say I am modelling a movie theatre with multiple cinemas. Each cinema is modelled as an agent with a state chart in which the cinema can be in one of a number of states:

  • 空闲(当前未使用电影院)
  • 人满为患(电影院开放,人满为患)
  • InSession(正在播放一部电影)
  • 清空(电影结束后观众开放,观众离开)
  • 弄脏了(电影院看完电影后空无一人,但尚未清理干净)
  • 清洁(清洁工正在做他们的事情)

假设我现在想记录和输出每个电影院所处状态的时间和计数的统计信息:

Suppose I now want to record and output statistics on the time and count of states that each cinema is in along the lines of:

电影院 1 状态:

+-----------+-------------+--------------+--------------+
| State     | Occurrences | Average Time | % Total Time |
+-----------+-------------+--------------+--------------+
| Idle      | 25          | 60           | 20%          |
+-----------+-------------+--------------+--------------+
| Filling   | 50          | 20           | 10%          |
+-----------+-------------+--------------+--------------+
| InSession | 50          | 90           | 40%          |
+-----------+-------------+--------------+--------------+
| Etc.      | ...         | ...          | ...          |
+-----------+-------------+--------------+--------------+

请分享您在 AnyLogic 中用于实现此目的的技术.

Please share the techniques that you use to achieve this in AnyLogic.

推荐答案

无论你做什么,你都需要创建一个收集信息的变量...

No matter what you do, you need to create a variable that collects the info...

发生次数:
您有一个名为occurrences 的变量,它从0 开始,每次代理进入该状态时递增1.您可以稍后计算所有代理的平均值 average(cinemas,c->c.occurrences)

平均时间:
您可以使用代理面板中的集合或数据集或分析中的统计数据.分别表示)您可以使用的功能.在状态空闲的情况下,您必须有一个变量 timeIdle 例如,每当状态空闲时,您都会增加每个时间单位

AverageTime:
you can use either a collection from the agents palette or data set or statistics from the analysis.. there are so many ways to do this that I won't list them here, but data sets a stastics objects have their own average (getYmean and mean respectively) functions that you can use. In the case of the state idle, You would have to have a variable timeIdle for instance that you increment every time unit whenever the state is idle

if(inState==idle) timeIdle+=timeUnit

当代理退出状态时,或者在模拟结束时,或者当你想测量值时你可以做 data.add(timeIdle) 如果你使用的是数据集,当你需要检索时如果是数据集对象,则可以执行 data.getYmean() 的平均时间,如果是统计对象,则可以执行 data.mean() 的平均时间

And when the agent exits the state, or at the end of the simulation, or when you want to measure the value you can do data.add(timeIdle) if you are using a data set, and when you need to retrieve the average time you can do data.getYmean() if it's a data set object, or data.mean() if it's a statistics object

总时间百分比:
同样的事情有一个名为 percTotalTime 的变量......每当您需要读取值时都执行 percTotalTime=timeIdle/time().

你必须为每个州做同样的事情.

这篇关于座席状态时间统计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆