0

I'm creating a model based on the product delivery example provided by AnyLogic. In my own model, I want a truck to deliver multiple orders in one trip instead of one. My process diagram is shown below. Here, an order enters via the enter block and several orders are accumulated in the batch block. Every order has a specified destination. How do I model the truck such that it combines two orders and move to the nearest delivery location first and then the second etc?

The main problem is that I don't know the code that accesses the parameter "Delivery location" in each order.

enter image description here enter image description here

Additional information:

  • The orders agents are generated and the delivery location is stored in a parameter called "client"
  • The batch block combines (lets say 2) orders into a batch of the type Order ( advanced settings set to population of agents)
  • The service block pulls a truck from the resource poule and send the batch of orders to the truck agent using send(batch.unit)
  • The truck agent stores the order/orders(?) in a variable called "order" Then, a moveTo function should deliver the order to the first destination

What would be the code to move to the first, second etc., destination?

Yope
  • 43
  • 6
  • 4
    I have removed your [[tag:batch-file]] tag. Each tag has a description which explains what they are used for. The [[tag:batch-file]] tag, is used for text based scripts which use a `.bat` or `.cmd` file extension and which are run on MS-DOS, OS/2, or Microsoft Windows. Feel free to add another tag should you feel it is necessary, but please consider whether it is essential to direct your question to the appropriate audiences. Using inappropriate tags, is not only unlikely to help you to get your solution, but may attract down or close votes. – Compo Aug 19 '21 at 10:14

1 Answers1

0

Here is the conceptual piece you are probably not aware of, and that should help you move in the right direction:

you can have "for loops" as part of your process flows. Below, you see an example where an agent keeps driving to places until it has no more parcels. enter image description here

Obviously, the details of the blocks depend on your model but in each, you can access the truck's orders if you have them in your Truck agent type (which is needed, obviously).

Benjamin
  • 10,603
  • 3
  • 16
  • 28