GraphHopper.com | Forum | GitHub | Maps | Blog

Related shipments, but only one in solution


#1

Hi all,
as a fork of my previous topic:

I have some shipments (fuel delivery) that don’t have fixed pickup locations (depos).
They can be picked from any depo.
As in this topic from Stefan:
https://groups.google.com/d/msg/jsprit-mailing-list/MZfyUQG-E6I/8_kGuqxEyjwJ
I tried to fork jprit to support multiple pickup locations, but without success.
Someone has?

So the other option is to create siblings of the shipment (related by name, or by part of id) having as pickup location each of the depos.
Later add a constraint that allows only one of those related shipments to be in the solution.
I can find only Activity and Route level constrains and not Solution level constrains.
Does anyone know how to achieve this?

Thanks


#2

Hi @traveler,

Like I replied in your earlier topic, you need a state updater to memorize all the jobs that have been inserted (it would be a problem state and could be a set of job ids) and a hard route constraint to forbid any sibling job of a job that has already been inserted to be inserted, i.e., if newAct belongs to a job that has any sibling job, then, check whether any of the sibling jobs has been inserted using the aforementioned state updater, and, if yes, the hard route constraint returns false.

Best regards,
He


#3

Thank you @jie31best,
it worked, however i’m getting really bad results.
How is this better (if it is) than randomly choosing one pickup location for shipment and don’t split in siblings at all?