javagraphhopperjsprit

Use time windows in jsprit with date


I'm doing a school project with VRP. The problem I'm trying to solve is generating routes with multiple points that must be executed in a time window each.

My problem is how to translate the dates (unix timestamp) to time windows in jsprit since the algorithm starts at 0 time. Do I just delta out the time intervals, or is there a best practice I'm missing.

Thanks for any help.


Solution

  • Edited.

    JSprit is unit agnostic. You choose the units that you wish to work with.

    I could choose that my week runs from Monday to Sunday, and I want to define units in terms of minutes. In which case, 9am on Monday morning is time 540 (9*60). Or I could define it in terms of seconds, in which case, that same time is 32400 (9*60*60). It doesn't matter as long as time units are consistent throughout.

    A unix timestamp is almost certainly superfluous to the problem. You run a solution at a set time; generally you're looking for a solution to a discrete problem, and you'll run the algorithm at set intervals. This always gives you a datum point in which to take the "abstract" output of jsprit (e.g. arrives at time 678) into a datetime that is relevant to the current problem.

    In this way, I could run the algorithm on 19th July for w/c 25th July but know that the solution of arrival time is based on 00:00 on 25th July being "0" and then just add the minutes.

    Bottom line: JSprit does not take the time of calling a solution as time 0. It takes time 0 as any point in which you choose to define it in an arbitrary system; midnight on a Sunday, the inauguration of Pope Francis, anything basically :)