Search code examples
anylogic

How to change probability in selectoutput block based on Agent parameter


I have agents parameter values from 1-5 with different probabilities. Agent Group 1 - 0.5 Agent Group 2- 0.3 ... ... Agent Group 5 0.1

When agent is passing through selectOutput block I want assign these probabilities. Is it possible to do in Anylogic?


Solution

  • Simply use this syntax:

    agent.parameter == 1 ? 0.5 : agent.parameter == 2 ? 0.3 : agent.parameter == 3 ? x : agent.parameter == 4 ? y : z 
    

    Replace x, y and z with the correct porbabilities.