Search code examples
anylogic

How to assign probabilities in SelectOutput5 based on agent type?


I have agents of 2 different types entering a SelectOutput5 block. How can I code it so if (agent instanceof FollowUp) then the probabilities of exit 1,2,3,4,5 are .70,.30,0,0,0 respectively. Then the same thing for if (agent instanceof NewConsult) with probabilities of the respective exits as .50,.50,0,0,0.


Solution

  • Simply write the following in the first probability field:

    agent instanceof Followup ? 0.70 : 0.50
    

    Repeat the same for each other one.

    Another possible idea (less efficient and not recommended) but which you might find interesting is to have a single selectOutput with the condition being:

    agent instanceof Followup
    

    After that block, add two selectOutput5 blocks, each with the desired set of probabilities.