Route suggestions

Hi, I’m new to jsprit and I’m not quite sure whether the problem I have is a feature or a bug. Here’s the explanation.
When I add a series of jobs and then search for the best solution, the best solution seems to change depending on the order of insertion of the jobs.
So if I insert a,b,c, and the optimal route is a->b->c sometimes the best suggestion is the optimal route. But when I change the order to something like say… b->a->c often it’s the case that the best solution doesn’t match the real-world optimal solution.

Any idea of why this is so?
Thank you

Just wondering, are you using a symmetric cost matrix?

I’m assuming not since I’m just running this sample code:

What are your jobs that you are using?

val delivery: Service =
Service.Builder.newInstance(item.deliveryId).addSizeDimension(WEIGHT_INDEX, 1)
.setLocation(Location.newInstance(, item.lon)).build()

Driver location was set to 0.0 0.0
and the jobs 1.0 0.0 ; 2.0 0.0 and 3.0 0.0

vrpBuilder.addJob(service2).addJob(service3).addJob(service1); = 1->2->3
vrpBuilder.addJob(service1).addJob(service2).addJob(service3); = 1->2->3
vrpBuilder.addJob(service3).addJob(service2).addJob(service1); = 1->2->3
vrpBuilder.addJob(service2).addJob(service1).addJob(service3); = 1->2->3


vehicleBuilder.setStartLocation(Location.newInstance(0, 0));
Service service1 = Service.Builder.newInstance("1").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(1, 0)).build();
Service service2 = Service.Builder.newInstance("2").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(2, 0)).build();
Service service3 = Service.Builder.newInstance("3").addSizeDimension(WEIGHT_INDEX, 1).setLocation(Location.newInstance(3, 0)).build();

This is what I get when running the simple example. Am I miss-understanding your issue?

Powered by Discourse