1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

replace .setNuOfIterations with .setMaxIterations

This commit is contained in:
oblonski 2015-01-06 18:48:48 +01:00
parent 527ca56d04
commit 8d20fe12aa
19 changed files with 320 additions and 77 deletions

View file

@ -158,7 +158,7 @@ public class AdditionalDistanceConstraintExample {
vraBuilder.setStateAndConstraintManager(stateManager,constraintManager);
VehicleRoutingAlgorithm vra = vraBuilder.build();
// vra.setNuOfIterations(250); //v1.3.1
// vra.setMaxIterations(250); //v1.3.1
vra.setMaxIterations(250); //head of development - upcoming release (v1.4)
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

View file

@ -265,12 +265,13 @@ public class BicycleMessenger {
constraintManager.addConstraint(new IgnoreMessengerThatCanNeverMeetTimeRequirements(nearestMessengers, routingCosts));
//create your algorithm
VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(bicycleMessengerProblem,"input/algorithmConfig_open.xml");
VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(bicycleMessengerProblem,"input/algorithmConfig.xml");
// vraBuilder.setNuOfThreads(2);
vraBuilder.addDefaultCostCalculators();
vraBuilder.setStateAndConstraintManager(stateManager, constraintManager);
vraBuilder.setNuOfThreads(10);
VehicleRoutingAlgorithm algorithm = vraBuilder.build();
algorithm.setMaxIterations(5000);
algorithm.setMaxIterations(10000);
// VariationCoefficientTermination prematureAlgorithmTermination = new VariationCoefficientTermination(200, 0.001);
// algorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination);
// algorithm.addListener(prematureAlgorithmTermination);

View file

@ -23,6 +23,7 @@ import jsprit.analysis.toolbox.GraphStreamViewer;
import jsprit.analysis.toolbox.Plotter;
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
import jsprit.core.algorithm.box.GreedySchrimpfFactory;
import jsprit.core.problem.Location;
import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.job.Service;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@ -59,14 +60,15 @@ public class CircleExample {
}
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
VehicleImpl v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(0,0)).build();
VehicleImpl v = VehicleImpl.Builder.newInstance("v")
.setStartLocation(Location.Builder.newInstance().setCoordinate(Coordinate.newInstance(0, 0)).build()).build();
vrpBuilder.addVehicle(v);
double step = 2*Math.PI/50.;
Collection<Coordinate> circle = createCoordinates(0,0,20,step);
int id = 1;
for(Coordinate c : circle){
Service s = Service.Builder.newInstance(Integer.toString(id)).setCoord(c).build();
Service s = Service.Builder.newInstance(Integer.toString(id)).setLocation(Location.Builder.newInstance().setCoordinate(c).build()).build();
vrpBuilder.addJob(s);
id++;
}

View file

@ -124,7 +124,7 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample {
* get the algorithm out-of-the-box.
*/
VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig.xml");
// algorithm.setNuOfIterations(30000);
// algorithm.setMaxIterations(30000);
/*
* and search a solution
*/

View file

@ -171,7 +171,7 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstrain
VehicleRoutingAlgorithm algorithm = vraBuilder.build();
algorithm.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
// algorithm.setNuOfIterations(30000);
// algorithm.setMaxIterations(30000);
/*
* and search a solution
*/

View file

@ -197,7 +197,7 @@ public class MultipleProductsWithLoadConstraintExample {
vraBuilder.setStateAndConstraintManager(stateManager,constraintManager);
VehicleRoutingAlgorithm vra = vraBuilder.build();
// vra.setNuOfIterations(100); //1.3.2-SNAPSHOT
// vra.setMaxIterations(100); //1.3.2-SNAPSHOT
// vra.setMaxIterations(100);
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

View file

@ -91,7 +91,7 @@ public class SolomonWithSkillsExample {
constraintManager.addSkillsConstraint();
VehicleRoutingAlgorithm vra = vraBuilder.build();
// vra.setNuOfIterations(500);
// vra.setMaxIterations(500);
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();