I am working on a delivery simulation model based on the airport example (Link ) from AnyLogic. My model includes four agent types: Hub, Truck (parameter: client), House, and Order (parameter: customer).
The process is as follows:
The House agent creates an Order when it switches from normalWork to waiting.
This Order contains a customer parameter (House).
The Order is processed using the Process Modeling Library blocks.
The seize block assigns the Truck to the Order by setting the Truck’s client parameter to the Order’s customer: ((Truck) unit).client = agent.customer.
Modeled Process
This works fine for one delivery. However, I want the truck to make multiple stops—2 to 3 deliveries—before returning to the hub. Additionally, it would be ideal if the truck could prioritize delivering to the nearest Order.
I attempted to simply loop back after the release block using a selectOutput.
Modeled Process with loop back
But I encountered the following error:
Exception during discrete event execution:
root.hub.seize:
Failed to automatically locate the Resource Task Start block for resource preparation tasks. Specify such block(s) in the "Define preparation tasks" property of Seize block. For more information refer to the Seize article in AnyLogic documentation.
Can anyone suggest how I can modify my model to handle multiple stops, and ideally prioritize the nearest delivery? What could be causing the above error, and how can I fix it?
Your approach is correct, the flow chart is not. Connect the connector back into the seize
block entry, NOT into the prep-flow moveToHouse
as you do now:
Always understand what the flow of your agents is and what a prep flow does as opposed to the main agent flow