AnyLogic
Expand
Font size

SelectOutput5

AnyLogic: The SelectOutput5 block

The SelectOutput5 block routes the incoming agents to one of the five output ports, depending on either probabilistic or deterministic conditions.

The block has three modes:

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

Agents spend zero time in SelectOutput5.

This block can be used to sort agents by some criteria, to randomly split the agent flow, and so on.

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

Parameters

Use
Specifies whether to route agents according to specified Conditions, randomly according to specified Probabilities, or to evaluate the specified expression to get the number of the exit port the agent should take to exit the block.
Get value: type
Valid values:
SelectOutput5.TYPE_PROBABILITIES
SelectOutput5.TYPE_CONDITIONS
SelectOutput5.TYPE_EXIT_NUMBERS
Probability 1 .. 5
[Visible when Use: Probabilities]
The expression used to evaluate the probability that the current agent will exit via out1 .. out5 ports. The probability value should be 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]
The condition evaluated for an incoming agent. If Condition N evaluates to true, the agent exits through the outN port, otherwise the next condition (Condition N+1) is checked. If all conditions are false, the agent exits through 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]
The 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 be 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 through the 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?