Find the Shortest Line, Randomize If All Equal
LegacyHow this worked in the previous version
When you are in a situation where you would like an entity to go-to the shortest queue available out of multiple routes/queues, and in case all queues are equal randomize what route the entity takes.

Where to Find the Model Object
Section titled “Where to Find the Model Object”The following model object can be found in the model objects directory:
- Routings - Find the Shortest Line, Randomize If All Equal
Difficulty Level
Section titled “Difficulty Level”- Ease of Use: Moderate
- Ease of Modification: Moderate
How to Use the Model Object
Section titled “How to Use the Model Object”-
Open Your Model: Open your model or create a new blank model.
-
Insert the Model Object into Your Model
-
Locate the model object Find the Shortest Line, Randomize If All Equal and select the insert button.
-
Move the cursor to the point of insertion and left mouse-click. The upper left corner of the model object will be inserted at the location of the mouse-click.
-
Connect to Your Model
-
**Connect **an arrival route or a percentage route from the part of your model where you would like the entities to take the shortest route to Select Line.

- **Connect **the routes exiting from Process, Process2, Process3, and **Process4 **to the rest of your model.

This gives you an example on how you can route entities to anywhere you like after they have been through the shortest line.
-
Update Objects
-
Change all the processing times for routes, Process, Process2, Process3, and Process4.

- **Change **the names of all the activities to match your organization.
- Completion: The model object is now integrated into your model, you should now be able to save and then simulate the model.
Controls Usage
Section titled “Controls Usage”Attributes:
Section titled “Attributes:”- a_Dir: Do not change. This attribute tells each entity which route to take.
Variables:
Section titled “Variables:”- v_Line_Count1-4: Do not change. This variable is used to know the amount of entities in queue for Process/2/3/4.
Advance Topics
Section titled “Advance Topics”How Do I Build This Model Object from Start?
Section titled “How Do I Build This Model Object from Start?”- Declare Attributes & Variables as suggested above, you will need to declare the variable v_Line_Countx multiple times, where x is the number of available routes an entity can take (as in this model object we have four available routes).
- Make the exit routes of the process that will decide where the entities are routed conditional and use the conditions so that every route represents a different Attribute number (ex: a_Dir = 1, a_Dir = 2 and so on).
- Increment the line counter on all routes, so that its known how many entities are pending at a process (ex: Inc v_Line_Count1).
- At the exit point from the alternate processes decrement the line counter so that the its known how many entities are pending in a process (ex: Dec v_Line_Count1).
- At the point in your model where you require an entity to route the shortest queue or randomize if all queues are equal you will need to write Action Logic, start with declaring an Attribute that will be used for direction as 0 (ex: a_Dir = 0), then use if and then statements as has been done in the model object’s Select Line and extent from it.

