Meet two vehicles in the same point at same hour to interchange load


I am trying to solve a problem where vehicles have a max distance limitation, so they have to interchange load in some middle points to be able to actually deliver them.

To deliver a load L that is picked up in A and delivered in B, if the distance between A and B is greater than the max distance, then two vehicles have to meet in the middle (M) to interchange the load and be able to perform the deliver. The requirement is that they have to be there at the same time.

To solve this, I pre-calculated such middle points, and split the orders in two, so every order has two job: one that goes from A to the middle point, and other that is picked up in such middle point and delivered to B.

To make this work, I must make sure that the two vehicles meet at the same time, meaning that the second job must be picked-up only after the first one has been delivered in such middle point, and it should ideally be at the same exact moment or within a narrow time margin.

Is there a way to to this on the solver, rather than iteratively, without prefixing this time? I have some ideas but I don’t think they will work properly:

  1. I might need to use state managers, they are tricky.
  2. I could penalize solutions that do not meet such constraint, or even discard them, but doing that after getting each solution may not work properly.
  3. If I try to enforce at run time that the arrival times are similar, it may not be able to assign such orders, as Jsprit does cannot delay the departure (imagine that part is delivered at 12:00, therefore part 2 should be picked-up at 12:00, but there is no way that Jsprit handles to pickup the second part at 12:00, maybe it does it earlier or later, but as it cannot delay the departure, it will not find a solution)

Has anyone faced a similar problem? Thanks.

Powered by Discourse