-1

I'm fairly new to routing. I want to build a model that works like this.

I have two trucks A and B. Truck A will pick up items to be delivered from the depot. It needs to pick up items from a 2nd depot as well. Due to time windows it may well make two deliveries after the initial pick-up before the 2nd pick-up location time windows.

Truck B picks up from the 1st depot should just go about delivering the items.

Clearly I need to create a relationship between the pick-up at depot 2 and the resulting deliveries so that jsprit does not try to allocate some of the 2nd depot items to Truck B. I also need to make sure that the deliveries are made after the pick-up.

It result would look something like:

TruckA P1 D1a D1b P2 D1c D2a D2b D1d etc
TruckB P1 D1a D1b D1c D1d...

I've spent a few hours trawling with my friend Google but have not found a solution.

It seems like it is something that would fit the Stackoverflow_RelatedJobs_13_and_21_inSameRoute_21_first model.

The example given is quite basic and deals with two jobs and one route. I need to deal with multiple routes and pickups with multiple deliveries.

I understand it will involve soft constraints etc but I don't know what they should be or how to create them.

Has anyone done this already and could offer some help?

halfer
  • 19,824
  • 17
  • 99
  • 186
gmax
  • 39
  • 1
  • 5

1 Answers1

0

If I understand correctly, what you would like to achieve is that the items that are to be picked up at depot 2 should not go to truck B.

If so, you can use a route constraint to fulfill that. You can refer to the example provided in the Walkthrough Constraints document.

In the route constraint, if the new vehicle is truck B, and if the job to be inserted is one that are to be picked up at depot 2 or if the current route contains such a job, return false (if it is a hard route cosntraint) or return a penalty (if it is a soft route constraint).

He Huang
  • 136
  • 3
  • Hi Huang and thanks for responding. Its more about making sure that if a truck is going to make a delivery it should first pickup the item to be delivered. So an input of 1 pickup and 5 deliveries might result in an output of 2 pickups (one for each truck) and 5 deliveries split across the trucks. I am using the service model because the shipment model only allows for one delivery per pickup. – gmax Dec 06 '16 at 18:52