I have two drivers and each driver has a set of about 15 locations where they need to drive to on a single day. Calculating the shortest route for both drivers is not the problem (using a matrix routing api).

The drivers can have the same location in their route. And if they are the same, then they both need to be there at the same time. So I need to make software that calculates the fastest route but sometimes the drivers need to be at the same location at the same time.

My question: How can I make this software, and are there any libraries I can use?

1 Answer 1


You can try jsprit.

If you determine the time windows where both drivers meet each other at a specified location a priori, then it is easy to model (just look at the 'Simple Example' in the wiki to figure out how you model and solve such a problem). Time windows are defined as follows:

Service.Builder.newInstance("service").setTimeWindow(TimeWindow.newInstance(10,20)) ...

If you do not want to set time windows in advance, you need to learn how to setup your own states and constraints. It is partly documented here and in a number of examples and the mailing list.

To consider your shortest routes from one location to another (from your matrix routing api), just use core.util.VehicleRoutingTransportCostMatrix (jsprit.examples.CostMatrixExample illustrates it) and assign the matrix to your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.