问题
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