Keep existing route as is… Let the vehicle return… Then dispatch it like: DEPOT > S11 > S12 > S14 > S15 > DEPOT…
How can I achieve this in Jsprit? I have tried using InitialRoutes but it doesn’t work for me (or perhaps I dont understand the concept completely)… If I set Jobs as [S1, S2, ..., S14, S15] and set an InitialRoute as [S1, S2, S3], Jsprit doesnt respect the initial route order and you CAN get a new route like [S1, S14, S8, S2, S4, S9, S3, …]… I have already served [S1, S2, S3] and my vehicle is already somewhere between [S3, S4]…
Finished jobs (S1, S2 and S3) should not appear in the initial route, like Stefan suggested in this post.
There is something you need to note regarding initial route: the jobs in the initial routes will not be ruined at all in the optimization process. Therefore, not only the job-vehicle assignment (in a multi-vehicle context) will not change, the sequence of them within the route will also not change. The new job(s) can still be inserted before/between/after them, though, like what you have already observed: [S1, S14, S8, S2, S4, S9, S3, …].
Moreover, if you model the jobs as services (or deliveries), it will not happen that the vehicle returns to the depot to pick up the new jobs. You should model the new jobs as shipments if you want that.
If you want only the job-vehicle assignment to be maintained and the sequence to be optimized, then you should not use the initial route in jsprit. Instead, you can use a hard constraint to force a job to be served by a specified vehicle, or, you can make use of the skills of the vehicles and the jobs.
Can you please point to a example snippet where to start with hard constraints?
And what do you mean by using the skills of the vehicles - when I define a required skill for the job and the same skill for a vehicle, it doesn’t mean that the job is definitely in the route, does it?
If the vehicle is the only one with that skill, then the job will at least not be in other routes.
If your concern is that the job might be unassigned, then unfortunately currently in jsprit there is no “hard” way to make sure a job is served (except initial route, but you do not want fixed sequence…) - there are “soft” ways, though, one of which is to assign priority to the jobs.
I have tried assigning priorities - 1 for the required service and 10 for all others - if the required service is very far, it still is not guaranteed to be in the route…
Would it work if I ran the optimization twice - first with only the required jobs, (and start+stop location), to get the best sequence of the required jobs, then create an initial route with the results order and then add all other and re-optimize?