How to associate a probability distribution to Age

2019-08-17 04:25发布

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条回答
Evening l夕情丶
2楼-- · 2019-08-17 05:00

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.

查看更多
登录 后发表回答