Does the jsrpit check all the combination of path before giving optimal path?

Well, I can’t say I completely understand you, but I’ll do to make the best guess about the meaning of your example.

Do you mean you have a hard constraint which should ensure (force) the order of the jobs as 1->2->3->4 ?
And your problem is that the algorithm gives you an invalid job order?

If this is the case, there are several topics about the problem that the ruin strategy doesn’t honor hard constraints (only insert strategies takes them into account) which leads to broken constraints in solution. This is a problem many of us have already faced and at the moment there is no easy solution: you has to create your own ruin strategy.

What is the solution? Either to write ruin strategy to take the constraints into account, or if your intetion is to keep the order of these jobs and it is ok to force the algoritm to assign all the jobs to the same vehicle, you may give a try to the new, custom jobs. But be warned! This feature is already in incubation and will be available only in the new major version of Jsprit. Also there are not too much documentation on how to use it, yet.

If you decide to give it a try, here you find it: Jsprit job activity refactor branch. To start with, take a look at the class com.graphhopper.jsprit.core.problem.job.CustomJob.

Note, that this is stable, but incubating version, so it may change in the future.

1 Like