We provide two blocks for routing agents to different flowchart branches: SelectOutput and SelectOutput5.
- SelectOutput has two output ports and can split the agent flow to two branches.
- SelectOutput5 has five output ports and can route agents to up to five exits.
Using SelectOutputIn and SelectOutputOut blocks, you can create a quasi-block SelectOutput with the required number of exits. You create it by adding a SelectOutputIn block and the required number of SelectOutputOut blocks. These blocks should not be connected together graphically.
To implement a custom routing to N flowchart branches
- Add a SelectOutputIn block from the Auxiliary section located at the bottom of the Process Modeling Library palette.
- Add the desired number of SelectOutputOut blocks.
- In each SelectOutputOut block, specify the name of the SelectOutputIn block that serves as the input.
-
Define the routing principle. There are two options:
- In the SelectOutputIn properties, select Select output: By explicit choice and specify the expression that returns the SelectOutputOut block in the property below.
- In the SelectOutputIn properties, select Select output: With probabilities in SelectOutputOut blocks, and specify probabilities for each SelectOutputOut block.
The following simple model shows how to implement both cases.
Demo model: SelectOutputN Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).- Select output
- Here you specify whether agents will be routed depending on the specified expression for output choice or randomly according to the probabilities defined in SelectOutputOut blocks.
By explicit choice — agents will be routed depending on the specified expression for output choice
With probabilities in SelectOutputOut blocks — agents will be routed according to the probabilities defined in SelectOutputOut blocks that refer to this SelectOutputInSyntax: boolean conditionIsProbabilistic
Default value: true - [Visible if Select output: By explicit choice]
Here you specify the expression that returns the SelectOutputOut block where the agent will be forwarded.Type of value: SelectOutputOut
Local variable: agent — the agent
- On enter
- Code executed when the agent enters the block.
Local variable: agent — the agent
- in
- The input port.
-
How can we improve this article?
-