How to associate a probability distribution to Agents - Anylogic

大憨熊 提交于 2019-12-11 16:42:34

问题


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:

-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 ))

-the 20% of them between 30 and 45 minutes

-the 10% of them between 45 and 60 minutes

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.

Thank you so much!


回答1:


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);

And in the service delay you put agent.timeInService

Those are two possible options.



来源:https://stackoverflow.com/questions/48951780/how-to-associate-a-probability-distribution-to-agents-anylogic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!