AnyLogic
Expand
Font size

SelectOutput5

This block routes the incoming agents to one of the five output ports depending on (probabilistic or deterministic) conditions.

It works in three modes:

  • Conditions — The user should provide 4 conditions. When an agent arrives, the conditions are evaluated sequentially, one by one. If condition 1 is true, the agent exits the exit 1, otherwise condition 2 is evaluated, etc. If all conditions are false, the agent exits via the last (default exit). The condition may depend on the agent as well as on any external factors.
  • Probabilities — The user should provide 5 probabilities for five exits (if their sum does not equal 1, they are normalized). The exit the agent takes is randomly defined according to the specified probabilities.
  • Exit number — The user should provide an expression that returns integer numbers in the range [1.. 5]. When the agent gets in the block, the expression is evaluated, and the resulting number means the number of the output port the agent should take to leave this block. The expression may depend on the agent as well as on any external factors.

The agents spend zero time in SelectOutput5.

This block be used to sort agents according to a certain criteria, to randomly split the agent flow, etc.

Sometimes it is needed to have more than five outputs. Using SelectOutputIn and SelectOutputOut blocks you can create one large quasi-block SelectOutput with the required number of exits.

Parameters

Use
Defines whether agents will be routed depending on the specified Conditions, randomly according to specified Probabilities, or the specified expression will be evaluated to get the number of the output port the agent should take to leave the block.
Get value: type
Valid values:
SelectOutput5.TYPE_PROBABILITIES
SelectOutput5.TYPE_CONDITIONS
SelectOutput5.TYPE_EXIT_NUMBERS
Probability 1 .. 5
[Visible when Use: Probabilities]
Expression used to evaluate the probability that the current agent will exit via out1 .. out5 ports. The probability value should lie in the [0..1] range.
Value type: double
Local variable: agent — the agent.
Default value: 0.2 — does not depend on the agent and simply splits the agent flow into five equal parts
Condition 1 .. 4
[Visible when Use: Conditions]
Condition evaluated for an incoming agent. If Condition N evaluates to true, the agent exits via outN port, otherwise the next condition (Condition N 1) is checked. If all conditions are false, the agent exits via the last (default exit). The condition may depend on the agent as well as on any external factors.
Value type: boolean
Local variable: agent — the agent
Exit number [1 .. 5]
[Visible when Use: Exit number]
Expression used to evaluate the index of the output port that the agent should take to leave this block. The expression may depend on the agent as well as on any external factors. The result should lie in the [1..5] range.
Value type: int
Local variable: agent — the agent.
Default value: uniform_discr( 1, 5 ) — does not depend on the agent and simply splits the agent flow into five equal parts

Actions

On enter
Code executed when the agent enters the block.
Local variable: agent — the agent
On exit 1, 2, .. , 5
Code executed when the agent exits the block via out1, out2, ... port.
Local variable: agent — the agent

Ports

in
The input port.
out1, out2, out3, out4, out5
The output ports.
How can we improve this article?