The general idea is we assume the truck is filled to capacity leaving the depot, so until it delivers something there is no room to pick anything else up.
The main challenge is I have no data relating to the size of the shipments and so can’t use vehicle capacity limits.
The perfect solution would be a relation allowing me to specify “not_in_direct_sequence” and give it a value of [“start”, “P1”] but unfortunately that doesn’t exist.
The best solution I’ve come up with is to use time windows to specify pickup services it can’t be done in the first ~30 minutes of the route. Is there a better way of doing this?
My use case for this is when trucks leave the depot to do their route for the day it’s usually packed as full as it can get (Often enough that we have to assume it always is). This means there’s no capacity on the vehicle to pickup anything until something is delivered to make room on the truck.
An example would be if i have 5 stops to make 4 of which are deliveries and one of which is a pickup to bring back to the depot i.e. D1, D2, D3, D4, P1. This would have to be routed in a format of [START, D, D|P*, END] where the first stop after our start is a delivery, then all following stops can be deliveries or pickups until the end. A sample route would be [START, D1, D2, P1, D3, D4, END]
I recognise i’m bending the rules here as if i had the data the vehicle capacity limits would be able to solve my problem. The next idea i had is to take advantage of relations to say my pickups cannot occur directly after the start event whether that be individually specify each relation or using a group.
Then the engine takes care of the capacity restrictions on its own. Every service can also have a type (pickup/delivery) and this way the engine knows if the size will be added or should be removed from the truck.
There is no need for some extra relation rules.
For more complex situations without a single depot you can use shipments.
@karussell I hope you don’t mind if I add something.
I assume that he already uses size and capacity and yet he wants to make sure that the vehicle is empty before new stuff is loaded (Correct @phalaxion?). For example, the load of a pickup could simply get in the way and the driver can no longer unload the rest of the load (even if the capacity would theoretically be sufficient for this).
Or simply: The main challenge is I have no data relating to the size of the shipments and so can’t use vehicle capacity limits. I just read the original post again.
I have it: You can use groups. Just assign for example "group":"delivery" to every delivery and "group": "pickup" to every pickup and specify the following relation:
I considered using groups to solve this however i then ran into the problem where all deliveries must be completed before pickups. This is problematic because if i have a pickup that is due to be delivered on the same route it breaks.
From my testing the solution of setting the delivery window opening an hour after the run starts seems to reliably route things for my use case.