'How to inject (source) 3 different types of agents into model based on probability in AnyLogic
I currently have 3 agent types that extend agent Patient. How can I inject these types into the model based on a probability i.e. type1: 60% type2: 30% type3: 10% OR perhaps use the split block (which I have explored but haven't been able to fit it to my problem) to split Patient into my different types?
Solution 1:[1]
In your source properties, in the Agent field, write the following:
randomTrue(0.6) ? new Type1() : randomTrue(0.75) ? new Type2() : new Type3()
Replace Type1, Type2 and Type3 with the agent type names you have.
Also, make sure under advanced, you have Agent as the agent type otherwise you would get errors.

And in case you're confused why I have 0.75 as the probability for the second condition, it's because 30% represents 75% of the remaining 40% if the first condition is false.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Emile Zankoul |

