I’ve built my cost matrix from lat,longs - Now I need to setup services.
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocation(Location.newInstance("1")).build();
Adding a service, newInstance(“1”) is in relation to an ID?
This then correlates to costMatrixBuilder.addTransportDistance(“ **idFrom** ”, “ **idTo** ”, **distance** ); where the idFrom is “1” ?
So I only need to loop through all idFrom’s I used in the cost matrix and add a service?
Then when building the vrp, can I add all services?
In the examples it has; .addVehicle(vehicle).addJob(s1).addJob(s2).addJob(s3).build();
Instead I setup the jobs as a collection and pass it via .addVehicle(vehicle).addAllJobs().build();
I’m having issues with assigning the service to a distance;
The service is looping through an array, starting at 0.
setLocation is setting the coordinates.
Service service = Service.Builder.newInstance(String.valueOf(i)).addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(points.get(i), points.get(offset))).build();
costMatrixBuilder.addTransportDistance(String.valueOf(i-1), String.valueOf(j-1), distance);
Service first iteration is newInstance(0)
Adding distance first iteration is addTransportDistance(0, 0, distance)
second iteration is addTransportDistance(0, 1, distance)
Results in; distance value for relation from [x=-41.2212078987679][y=174.817758293497] to [x=-41.2210347264532][y=174.817871376896] does not exist
So I’m not getting a distance to the service ID when running. Unsure how to merge the 2.
How is the best way to output the matrix to see what is missing?