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.
The decision which output port of the SelectOutput5 block the agent will choose is made not when the agent enters the SelectOutput5 block, but earlier, when the agent completes its operation in the preceding flowchart block. It is implemented this way because agents do not spend any time in the SelectOutput5 block and are instantly forwarded to the next flowchart block, so we need to make sure first that this block is able to accept the agent (e.g. it can be a closed Hold block or full Queue). That is why the availability of the further route within the flowchart is calculated in advance, before letting the agent exit the current block and enter the SelectOutput5 block.
The routing condition of the SelectOutput5 block is calculated when the agent completes the operation defined by the preceding flowchart block and is ready to exit this block, but before the On exit action of that block is executed. So if you want to affect the agent routing logic in the On exit action of the flowchart block preceding the SelectOutput5 block, it will not happen. For example, if you assign a new value to a custom agent attribute in the On exit action, and then use this attribute as the routing condition in the following SelectOutput5 block, it will not work and agents may be routed to the wrong output port (the routing condition will actually be checked before your change in the On exit action will apply).
To obtain the correct behavior:
- If the preceding flowchart block has On at exit action, move your logic from its On exit action there. The On at exit action is executed after the block’s operation is finished, but before the further routing decision is made. If this block does not have the On exit action, use its other action, for instance, On enter.
- If the above option is not suitable, place the Delay block with zero Delay time before your SelectOutput5 block.
- 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 - [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 - [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 - [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
- 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
- in
- The input port.
- out1, out2, out3, out4, out5
- The output ports.
-
How can we improve this article?
-