如何将概率分布与代理相关联-Anylogic [英] How to associate a probability distribution to Agents - Anylogic
问题描述
我正在Anylogic上模拟一个模型,在该模型中,代理从队列块流到服务块. 我需要用这样的概率分布来定义蚂蚁在服务中花费的时间:
I'm simulating a model on Anylogic, in which Agents flow from a Queue block to a Service block. I need to define the time spent by the angents in the service with a probability distribution like this:
-其中70%的人在服务中花费了15到30分钟的时间(应该是均匀分布,例如:Uniform(15,30))
-the 70% of them spent in the service a lapse of time between 15 and 30 minutes (it should be an uniform distribution like: uniform( 15, 30 ))
-其中20%在30至45分钟之间
-the 20% of them between 30 and 45 minutes
-其中45%至60分钟内的10%
-the 10% of them between 45 and 60 minutes
我已经将一个名为"timeInService"的参数与代理相关联,我想应该使用它,也许应该使用服务的Dalay时间,但是我不知道该怎么做.
I've already associated to the agents a parameter called "timeInService", I think I should work with it and maybe the Dalay time of the service but I dont'k know how.
非常感谢您!
推荐答案
在服务块延迟上,您可以输入以下代码:
on the delay of the service block you can put this code:
uniform()<0.7 ? uniform(15,30) : (uniform()<2/3 ? uniform(30,45) : uniform(45,60))
这将为您提供所需的内容.
另一种选择是在进入服务块之前先在该块上,然后在出口"上执行此操作:
This will give you what you want.
Another alternative is on the block before entering the service block you do this on the "on exit":
double rand=uniform();
if(rand<0.7)
agent.timeInService=uniform(15,30);
else if(rand<0.9)
agent.timeInService=uniform(30,45);
else
agent.timeInService=uniform(45,60);
在服务延迟中,您将agent.timeInService
这是两个可能的选择.
这篇关于如何将概率分布与代理相关联-Anylogic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!