In my Anylogic model I have 200 zones and I have these populations of agents:
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 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!
You can create a function that has the customer and terminal as arguments and then find you the least costly option and return it. Here is a quick example where 'allPossibleRoutes' is just a collection where all the possible route combinations are stored as a list.