0

VehicleRoutingAlgorithm vra = vraBuilder.build(); vra.setMaxIterations(250);

We use the above code for number of iterations to be done to find vra solution. in the examples in jsprit I can see 250 as a hard coded value. My question is what is the optimal value for that. Is there any option to have solution in between the execution? I don't want to wait 250 number of iterations. Is that possible?

sutirtha
  • 375
  • 3
  • 21
  • "what is the optimal value for that?" is an impossible question to answer, it depends entirely on the complexity of your problem. You can change iteration number with `setMaxIterations`. You should also add a listener e.g. `AlgorithmSearchProgressChartListener` and see how many iterations it takes before the solution does not improve. Over time that will give you an idea of the "optimal" for problems of your scale. – roganjosh May 01 '16 at 17:01
  • Thanks @roganjosh. When I asked that question I was very new to this. Now I can understand that. – sutirtha Jun 09 '16 at 06:33

1 Answers1

0

It really depends on your problem size. My suggestion is to set a reasonable large maxIterations and define add termination criterion to the algorithm.

The configuration below terminates the algorithm prematurely based on iterations without any improvement.

VehicleRoutingAlgorithm vra = vraBuilder.build(); 
vra.setMaxIterations(250);
vra.addTerminationCriterion(new IterationWithoutImprovementTermination(500));
Stanley
  • 5,057
  • 4
  • 34
  • 44