I’m building a model in AnyLogic where the Depot agent receives orders from the Customer agent. The depot needs to send the orders to one of the 3 transshipments. Here’s my current process flow for processing the orders:current Processflow in the Depot.
Additionally, my vehicle statechart looks like this:Statechart for the Vehicle in the Depot.
Problem:
I have 100 customers who typically order only 1-2 products.Currently, each vehicle delivers every customer’s order separately. Instead, I want to collect up to 20 orders and send them collectively to the transshipment. Therefore I recreated my processflow, but it’s not currently working as expected.Here is the new Processflow: Processflow which batches the order.
Current Implementation Details:
Order Assignment to Transshipments:
Each customer is assigned to the nearest transshipment using this function in the Main agent:
for (Customer customer : customers) { customer.set_transshipment(customer.getNearestAgentByRoute(transshipments));
This ensures that the depot knows where to send each order.
To ensure that the depot continues to send the incoming orders to the transshipment closest to the customer, I have created a separate flow for each transshipment. Using the SelectOutput, I tried to assign the orders to the correct flow, but this did not work as expected. In the following process, all assigned orders should be collected in the batch and then forwarded. Unfortunately, nothing happens when the model is executed, so I’m not sure where the error lies.
My problem is that the depot does not sort the orders to the respective transshipment so that I can collect them in the batch.
Thank you in advance for your help!