Search code examples
jsprit

What is the optimal number of iterations for jsprit solution for pickups_and_deliveries_solomon_c101.xml?


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?


Solution

  • 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));