In my Anylogic model I have 200 zones and I have these populations of agents:
- Customers (parameters: name, GIS latitude, GIS longitude), one in every zone (except terminal zones)
- Terminals (parameters: name, GIS latitude, GIS longitude), one in evert terminal zone (5)
- Orders (parameters: customer (type: Customer), terminal (type: Terminal))
- Trucks (receive an order (that is created by a customer) and then travel to that terminal and customer)
Now, since there are large waiting times at terminals during the day time, I want to add a hub that is open at night in between the terminals and customers and let the trucks decide if:
- They want to travel at day time directly from the terminal to the customer, or
- They want to travel at night time from the terminal to a hub, and then at day time from the hub to the customer
They should make this choice based on driving+waiting costs that differ per route(origin,destination) and per time of day (day/night). I have these costs in a database and I linked them to the routes by first adding a new Java class:
And then I added this function to assign the costs from my database:
Now my question is, how can I let the trucks, per order they receive, choose their departure times (day/night) and route (from terminal -> customer / from terminal -> hub -> customer) based on these costs?
I want to add something like this below (where Region102 is the hub) to choose the cheapest option per order (which was just to try but of course does not work like this..) and to let the trucks then choose their departure time and route?
Thank you for all the help!