Multiday single long distance deliveries without reload

I am analyzing JSPRIT functionalities with time window for a specific problem of a single trip but due to a large distances to deliver all packages from a factory it takes w few days for a truck. Two drivers exchanging when driving plus hotels needs to be taken. This is because there are large distances between delivery points. Every stop is opened from 8:00 till 16:00 (timewindow) so there are hard time windows. During the first day the truck delivers some packages up to 16:00 and no more deliveries the same day allowed. Then driver should go into another delivery point which is going to be open again the following day from 8:00 till 16:00, sleep somewhere in between or at another (next day delivery location) and procedure continues till all packages are being delivered and track can go back to its depot. Is it possible to implement such scenario within JSPRIT ?

You asked this on SO recently and I gave an answer but actually I seem to have misunderstood the issue here. @stefan how many time windows can be reasonably accommodated for a single job?

1 Like

Thank you for replaying to my question. I will replay here rather then in stack overflow. Not sure I properly understand your suggestion.
The problem of a real business scenario which I am trying to implement in jsprit is that trucks a packed with a multiple loads. These loads are to be delivered over large distances (few countries). The truck start in a factory and goes from point to point until all are delivered. The problem that businesses who are delivery destinations operates only during business hours 8am-4pm. So truck crew once delivered part of load during Monday and its around 4pm have a break till following day opening hours. Trucks should actually utilise the time (evening and night) to get close to the next delivery point and then take a break (sleep).
Therefore imposing 7:30am-4 pm constraints for a truck operating hours would probably not allow for driving between delivery points at night or evening. Any thoughts?

@roganjosh an arbitrary number of tws can be assigned - I would assume

Deleted last answer, I led myself down a rabbit hole trying to reason it out.

This shouldn’t be too difficult then. Provided that you can have an arbitrary number of time windows for each job, this should be relatively simple (I don’t know how 5 or 7 time windows will affect the number of iterations for convergence…):

  1. Define a time unit that spans the whole week e.g. in minutes you go from 1 on Sunday 00:01 to 10079 at 23:39 on Sat.
  2. Define each job once with multiple time windows that correspond to each 8am to 4pm on each day of the week.
  3. Run as normal.

Vehicles cannot do jobs that don’t have an open time window (time windows are considered hard constraints). You set it so that each vehicle runs for the whole week, no breaks. Once the 4pm time window closes, the algorithm will assume that the vehicle moves to its next job in the optimal route and just sits there until 8am when the new time window opens (provided that travel time is less than 16 hours; it will account for this). What your driver actually does in this period is an operational decision; (s)he might drive half way and then stop over, it doesn’t matter. Provided that they arrive at 8am for the next customer in the route, it’s valid.

1 Like

Thank you roganjosh, this solves the problem :slight_smile:

1 Like