0

I have 2D array of distances between geo-locations . see the link Map box time to travel

How do I inject this to build the problem in jsprit .

Erwin Bolwidt
  • 30,799
  • 15
  • 56
  • 79

1 Answers1

1

you can try this :

VehicleRoutingTransportCostsMatrix.Builder vrtcMatrix;
VehicleRoutingTransportCostsMatrix costsMatrix;
vrtcMatrix.addTransportDistance(String.valueOf(fromId), String.valueOf(toId),
                                (double) distance.inMeters);
vrtcMatrix.addTransportTime(String.valueOf(fromId), String.valueOf(toId),
                                (double) duration.inSeconds);
costsMatrix = vrtcMatrix.build();

Then

VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder = vrpBuilder.setRoutingCost(costsMatrix);

You have to set it between all of your combinaison of points. Use a distance matrix calculator to get a good distance/time estimation.

Hope it helps.