From 8d20fe12aaf91613db42506e873baa9d08a0b5ed Mon Sep 17 00:00:00 2001 From: oblonski Date: Tue, 6 Jan 2015 18:48:48 +0100 Subject: [PATCH] replace .setNuOfIterations with .setMaxIterations --- .../ExperimentalSchrimpfAcceptance.java | 2 +- .../BuildCVRPAlgoFromScratch_IT.java | 26 +- .../BuildPDVRPAlgoFromScratch_IT.java | 40 ++- ...dPDVRPWithShipmentsAlgoFromScratch_IT.java | 2 +- ...etManagerIdentifiesDistinctVehicle_IT.java | 2 +- .../core/algorithm/InitialRoutesTest.java | 4 +- .../MeetTimeWindowConstraint_IT.java | 24 +- .../algorithm/state/SolomonSkills_IT.java | 2 +- .../core/algorithm/state/Solomon_IT.java | 2 +- jsprit-examples/input/algorithmConfig.xml | 6 +- jsprit-examples/input/p11 | 260 ++++++++++++++++++ .../AdditionalDistanceConstraintExample.java | 2 +- .../jsprit/examples/BicycleMessenger.java | 5 +- .../java/jsprit/examples/CircleExample.java | 6 +- ...ithMultipleDepotsAndOpenRoutesExample.java | 2 +- ...ndSpecifiedVehicleEndLocationsExample.java | 2 +- ...ipleProductsWithLoadConstraintExample.java | 2 +- .../examples/SolomonWithSkillsExample.java | 2 +- .../java/jsprit/instance/reader/Taillard.java | 6 +- 19 files changed, 320 insertions(+), 77 deletions(-) create mode 100644 jsprit-examples/input/p11 diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java b/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java index 1c887fe5..0feb9ee9 100644 --- a/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java +++ b/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java @@ -120,7 +120,7 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati AlgorithmConfig algorithmConfig = new AlgorithmConfig(); new AlgorithmConfigXmlReader(algorithmConfig).read(resource); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(problem, algorithmConfig); - vra.setNuOfIterations(nOfRandomWalks); + vra.setMaxIterations(nOfRandomWalks); vra.getAlgorithmListeners().addListener(new IterationEndsListener() { @Override diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java index 9a175cb3..14d84603 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java @@ -58,16 +58,8 @@ public class BuildCVRPAlgoFromScratch_IT { vrp = builder.build(); final StateManager stateManager = new StateManager(vrp); - stateManager.updateLoadStates(); - stateManager.updateTimeWindowStates(); - stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager)); - - ConstraintManager cManager = new ConstraintManager(vrp, stateManager); - cManager.addLoadConstraint(); - cManager.addTimeWindowConstraint(); - - + VehicleFleetManager fleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager(); InsertionStrategy bestInsertion = new BestInsertionBuilder(vrp, fleetManager, stateManager, cManager).build(); @@ -94,19 +86,11 @@ public class BuildCVRPAlgoFromScratch_IT { SearchStrategy radialStrategy = new SearchStrategy("radial", new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator); RuinAndRecreateModule radialModule = new RuinAndRecreateModule("radialRuin_bestInsertion", bestInsertion, radial); radialStrategy.addModule(radialModule); - - SearchStrategyManager strategyManager = new SearchStrategyManager(); - strategyManager.addStrategy(radialStrategy, 0.5); - strategyManager.addStrategy(randomStrategy, 0.5); - - vra = new VehicleRoutingAlgorithm(vrp, strategyManager); - vra.addListener(stateManager); - vra.addListener(new RemoveEmptyVehicles(fleetManager)); - - VehicleRoutingProblemSolution iniSolution = new InsertionInitialSolutionFactory(bestInsertion, solutionCostCalculator).createSolution(vrp); - vra.addInitialSolution(iniSolution); - + vra = new PrettyAlgorithmBuilder(vrp,fleetManager,stateManager,cManager) + .withStrategy(randomStrategy,0.5).withStrategy(radialStrategy,0.5) + .addCoreStateAndConstraintStuff() + .constructInitialSolutionWith(bestInsertion,solutionCostCalculator).build(); vra.setMaxIterations(2000); } diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java index 0e7cdc9f..5b6220a1 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java @@ -37,6 +37,7 @@ import jsprit.core.problem.solution.route.VehicleRoute; import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory; import jsprit.core.problem.vehicle.VehicleFleetManager; import jsprit.core.util.Solutions; +import junit.framework.Assert; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.Before; @@ -63,15 +64,11 @@ public class BuildPDVRPAlgoFromScratch_IT { final StateManager stateManager = new StateManager(vrp); ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager); - constraintManager.addTimeWindowConstraint(); - constraintManager.addLoadConstraint(); - + VehicleFleetManager fleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager(); - - BestInsertionBuilder iBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager, constraintManager); -// iBuilder.setConstraintManager(constraintManger); - InsertionStrategy bestInsertion = iBuilder.build(); - + + InsertionStrategy bestInsertion = new BestInsertionBuilder(vrp, fleetManager, stateManager, constraintManager).build(); + RuinStrategy radial = new RadialRuinStrategyFactory( 0.15, new AvgServiceDistance(vrp.getTransportCosts())).createStrategy(vrp); RuinStrategy random = new RandomRuinStrategyFactory(0.25).createStrategy(vrp); @@ -96,27 +93,26 @@ public class BuildPDVRPAlgoFromScratch_IT { SearchStrategy radialStrategy = new SearchStrategy("radial", new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator); RuinAndRecreateModule radialModule = new RuinAndRecreateModule("radialRuin_bestInsertion", bestInsertion, radial); radialStrategy.addModule(radialModule); - - SearchStrategyManager strategyManager = new SearchStrategyManager(); - strategyManager.addStrategy(radialStrategy, 0.5); - strategyManager.addStrategy(randomStrategy, 0.5); - - vra = new VehicleRoutingAlgorithm(vrp, strategyManager); - vra.addListener(stateManager); - vra.addListener(new RemoveEmptyVehicles(fleetManager)); - - VehicleRoutingProblemSolution iniSolution = new InsertionInitialSolutionFactory(bestInsertion, solutionCostCalculator).createSolution(vrp); - vra.addInitialSolution(iniSolution); - vra.setNuOfIterations(1000); + vra = new PrettyAlgorithmBuilder(vrp,fleetManager,stateManager,constraintManager) + .addCoreStateAndConstraintStuff().constructInitialSolutionWith(bestInsertion,solutionCostCalculator) + .withStrategy(radialStrategy,0.5).withStrategy(randomStrategy,0.5).build(); + + vra.setMaxIterations(1000); vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100)); } @Test public void test(){ - Collection solutions = vra.searchSolutions(); - System.out.println(Solutions.bestOf(solutions).getCost()); + try { + Collection solutions = vra.searchSolutions(); + System.out.println(Solutions.bestOf(solutions).getCost()); + Assert.assertTrue(true); + } + catch (Exception e){ + Assert.assertTrue(false); + } } } diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java index 1692d0cc..509fc00b 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java @@ -102,7 +102,7 @@ public class BuildPDVRPWithShipmentsAlgoFromScratch_IT { VehicleRoutingProblemSolution iniSolution = new InsertionInitialSolutionFactory(bestInsertion, solutionCostCalculator).createSolution(vrp); vra.addInitialSolution(iniSolution); - vra.setNuOfIterations(3); + vra.setMaxIterations(3); Collection solutions = vra.searchSolutions(); assertTrue(!solutions.isEmpty()); } diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java index 0df84444..9a144334 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java @@ -43,7 +43,7 @@ public class FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(10); + vra.setMaxIterations(10); try{ @SuppressWarnings("unused") Collection solutions = vra.searchSolutions(); diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/InitialRoutesTest.java b/jsprit-core/src/test/java/jsprit/core/algorithm/InitialRoutesTest.java index cfeabc69..1dfb8609 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/InitialRoutesTest.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/InitialRoutesTest.java @@ -291,7 +291,7 @@ public class InitialRoutesTest { .setFleetSize(VehicleRoutingProblem.FleetSize.FINITE).addInitialVehicleRoute(iniRoute).build(); VehicleRoutingAlgorithm vra = new GreedySchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(10); + vra.setMaxIterations(10); Collection solutions = vra.searchSolutions(); @@ -304,7 +304,7 @@ public class InitialRoutesTest { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes_2.xml"); VehicleRoutingAlgorithm vra = new GreedySchrimpfFactory().createAlgorithm(vrpBuilder.build()); - vra.setNuOfIterations(10); + vra.setMaxIterations(10); Collection solutions = vra.searchSolutions(); diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java index 9df7853e..ac2d7827 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java @@ -48,7 +48,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -61,7 +61,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new JobInsertedListener() { @@ -93,7 +93,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new VehicleSwitchedListener() { @@ -132,7 +132,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -145,7 +145,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); // assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -159,7 +159,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); // assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -176,7 +176,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -189,7 +189,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new JobInsertedListener() { @@ -221,7 +221,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new VehicleSwitchedListener() { @@ -260,7 +260,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -273,7 +273,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); @@ -287,7 +287,7 @@ public class MeetTimeWindowConstraint_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setNuOfIterations(100); + vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/state/SolomonSkills_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/state/SolomonSkills_IT.java index 717d8373..7b717ab2 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/state/SolomonSkills_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/state/SolomonSkills_IT.java @@ -88,7 +88,7 @@ public class SolomonSkills_IT { constraintManager.addSkillsConstraint(); VehicleRoutingAlgorithm vra = vraBuilder.build(); - vra.setNuOfIterations(500); + vra.setMaxIterations(500); try { Collection solutions = vra.searchSolutions(); diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/state/Solomon_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/state/Solomon_IT.java index 4470371e..23918b3f 100644 --- a/jsprit-core/src/test/java/jsprit/core/algorithm/state/Solomon_IT.java +++ b/jsprit-core/src/test/java/jsprit/core/algorithm/state/Solomon_IT.java @@ -24,7 +24,7 @@ public class Solomon_IT { VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp,"src/test/resources/algorithmConfig.xml"); - vra.setNuOfIterations(500); + vra.setMaxIterations(500); Collection solutions = vra.searchSolutions(); assertEquals(828.94, Solutions.bestOf(solutions).getCost(),0.01); } diff --git a/jsprit-examples/input/algorithmConfig.xml b/jsprit-examples/input/algorithmConfig.xml index 4fff948f..80b86e3a 100755 --- a/jsprit-examples/input/algorithmConfig.xml +++ b/jsprit-examples/input/algorithmConfig.xml @@ -46,7 +46,7 @@ - 0.2 + 0.4 @@ -62,7 +62,7 @@ - 0.2 + 0.4 @@ -77,7 +77,7 @@ - 0.6 + 0.2 diff --git a/jsprit-examples/input/p11 b/jsprit-examples/input/p11 new file mode 100644 index 00000000..01f6c931 --- /dev/null +++ b/jsprit-examples/input/p11 @@ -0,0 +1,260 @@ +2 6 249 5 +310 500 +310 500 +310 500 +310 500 +310 500 + 1 -99 -97 0 6 1 5 1 2 4 8 16 + 2 -59 50 0 72 1 5 1 2 4 8 16 + 3 0 14 0 93 1 5 1 2 4 8 16 + 4 -17 -66 0 28 1 5 1 2 4 8 16 + 5 -69 -19 0 5 1 5 1 2 4 8 16 + 6 31 12 0 43 1 5 1 2 4 8 16 + 7 5 -41 0 1 1 5 1 2 4 8 16 + 8 -12 10 0 36 1 5 1 2 4 8 16 + 9 -64 70 0 53 1 5 1 2 4 8 16 + 10 -12 85 0 63 1 5 1 2 4 8 16 + 11 -18 64 0 25 1 5 1 2 4 8 16 + 12 -77 -16 0 50 1 5 1 2 4 8 16 + 13 -53 88 0 57 1 5 1 2 4 8 16 + 14 83 -24 0 1 1 5 1 2 4 8 16 + 15 24 41 0 66 1 5 1 2 4 8 16 + 16 17 21 0 37 1 5 1 2 4 8 16 + 17 42 96 0 51 1 5 1 2 4 8 16 + 18 -65 0 0 47 1 5 1 2 4 8 16 + 19 -47 -26 0 88 1 5 1 2 4 8 16 + 20 85 36 0 75 1 5 1 2 4 8 16 + 21 -35 -54 0 48 1 5 1 2 4 8 16 + 22 54 -21 0 40 1 5 1 2 4 8 16 + 23 64 -17 0 8 1 5 1 2 4 8 16 + 24 55 89 0 69 1 5 1 2 4 8 16 + 25 17 -25 0 93 1 5 1 2 4 8 16 + 26 -61 66 0 29 1 5 1 2 4 8 16 + 27 -61 26 0 5 1 5 1 2 4 8 16 + 28 17 -72 0 53 1 5 1 2 4 8 16 + 29 79 38 0 8 1 5 1 2 4 8 16 + 30 -62 -2 0 24 1 5 1 2 4 8 16 + 31 -90 -68 0 53 1 5 1 2 4 8 16 + 32 52 66 0 13 1 5 1 2 4 8 16 + 33 -54 -50 0 47 1 5 1 2 4 8 16 + 34 8 -84 0 57 1 5 1 2 4 8 16 + 35 37 -90 0 9 1 5 1 2 4 8 16 + 36 -83 49 0 74 1 5 1 2 4 8 16 + 37 35 -1 0 83 1 5 1 2 4 8 16 + 38 7 59 0 96 1 5 1 2 4 8 16 + 39 12 48 0 42 1 5 1 2 4 8 16 + 40 57 95 0 80 1 5 1 2 4 8 16 + 41 92 28 0 22 1 5 1 2 4 8 16 + 42 -3 97 0 56 1 5 1 2 4 8 16 + 43 -7 52 0 43 1 5 1 2 4 8 16 + 44 42 -15 0 12 1 5 1 2 4 8 16 + 45 77 -43 0 73 1 5 1 2 4 8 16 + 46 59 -49 0 32 1 5 1 2 4 8 16 + 47 25 91 0 8 1 5 1 2 4 8 16 + 48 69 -19 0 79 1 5 1 2 4 8 16 + 49 -82 -14 0 79 1 5 1 2 4 8 16 + 50 74 -70 0 4 1 5 1 2 4 8 16 + 51 69 59 0 14 1 5 1 2 4 8 16 + 52 29 33 0 17 1 5 1 2 4 8 16 + 53 -97 9 0 19 1 5 1 2 4 8 16 + 54 -58 9 0 44 1 5 1 2 4 8 16 + 55 28 93 0 5 1 5 1 2 4 8 16 + 56 7 73 0 37 1 5 1 2 4 8 16 + 57 -28 73 0 100 1 5 1 2 4 8 16 + 58 -76 55 0 62 1 5 1 2 4 8 16 + 59 41 42 0 90 1 5 1 2 4 8 16 + 60 92 40 0 57 1 5 1 2 4 8 16 + 61 -84 -29 0 44 1 5 1 2 4 8 16 + 62 -12 42 0 37 1 5 1 2 4 8 16 + 63 51 -45 0 80 1 5 1 2 4 8 16 + 64 -37 46 0 60 1 5 1 2 4 8 16 + 65 -97 35 0 95 1 5 1 2 4 8 16 + 66 14 89 0 56 1 5 1 2 4 8 16 + 67 60 58 0 56 1 5 1 2 4 8 16 + 68 -63 -75 0 9 1 5 1 2 4 8 16 + 69 -18 34 0 39 1 5 1 2 4 8 16 + 70 -46 -82 0 15 1 5 1 2 4 8 16 + 71 -86 -79 0 4 1 5 1 2 4 8 16 + 72 -43 -30 0 58 1 5 1 2 4 8 16 + 73 -44 7 0 73 1 5 1 2 4 8 16 + 74 -3 -20 0 5 1 5 1 2 4 8 16 + 75 36 41 0 12 1 5 1 2 4 8 16 + 76 -30 -94 0 3 1 5 1 2 4 8 16 + 77 79 -62 0 8 1 5 1 2 4 8 16 + 78 51 70 0 31 1 5 1 2 4 8 16 + 79 -61 -26 0 48 1 5 1 2 4 8 16 + 80 6 94 0 3 1 5 1 2 4 8 16 + 81 -19 -62 0 52 1 5 1 2 4 8 16 + 82 -20 51 0 99 1 5 1 2 4 8 16 + 83 -81 37 0 29 1 5 1 2 4 8 16 + 84 7 31 0 12 1 5 1 2 4 8 16 + 85 52 12 0 50 1 5 1 2 4 8 16 + 86 83 -91 0 98 1 5 1 2 4 8 16 + 87 -7 -92 0 4 1 5 1 2 4 8 16 + 88 82 -74 0 56 1 5 1 2 4 8 16 + 89 -70 85 0 24 1 5 1 2 4 8 16 + 90 -83 -30 0 33 1 5 1 2 4 8 16 + 91 71 -61 0 45 1 5 1 2 4 8 16 + 92 85 11 0 98 1 5 1 2 4 8 16 + 93 66 -48 0 4 1 5 1 2 4 8 16 + 94 78 -87 0 36 1 5 1 2 4 8 16 + 95 9 -79 0 72 1 5 1 2 4 8 16 + 96 -36 4 0 26 1 5 1 2 4 8 16 + 97 66 39 0 71 1 5 1 2 4 8 16 + 98 92 -17 0 84 1 5 1 2 4 8 16 + 99 -46 -79 0 21 1 5 1 2 4 8 16 +100 -30 -63 0 99 1 5 1 2 4 8 16 +101 -42 63 0 33 1 5 1 2 4 8 16 +102 20 42 0 84 1 5 1 2 4 8 16 +103 15 98 0 74 1 5 1 2 4 8 16 +104 1 -17 0 93 1 5 1 2 4 8 16 +105 64 20 0 25 1 5 1 2 4 8 16 +106 -96 85 0 39 1 5 1 2 4 8 16 +107 93 -29 0 42 1 5 1 2 4 8 16 +108 -40 -84 0 77 1 5 1 2 4 8 16 +109 86 35 0 68 1 5 1 2 4 8 16 +110 91 36 0 50 1 5 1 2 4 8 16 +111 62 -8 0 42 1 5 1 2 4 8 16 +112 -24 4 0 71 1 5 1 2 4 8 16 +113 11 96 0 85 1 5 1 2 4 8 16 +114 -53 62 0 78 1 5 1 2 4 8 16 +115 -28 -71 0 64 1 5 1 2 4 8 16 +116 7 -4 0 5 1 5 1 2 4 8 16 +117 95 -9 0 93 1 5 1 2 4 8 16 +118 -3 17 0 18 1 5 1 2 4 8 16 +119 53 -90 0 38 1 5 1 2 4 8 16 +120 58 -19 0 29 1 5 1 2 4 8 16 +121 -83 84 0 81 1 5 1 2 4 8 16 +122 -1 49 0 4 1 5 1 2 4 8 16 +123 -4 17 0 23 1 5 1 2 4 8 16 +124 -82 -3 0 11 1 5 1 2 4 8 16 +125 -43 47 0 86 1 5 1 2 4 8 16 +126 6 -6 0 2 1 5 1 2 4 8 16 +127 70 99 0 31 1 5 1 2 4 8 16 +128 68 -29 0 54 1 5 1 2 4 8 16 +129 -94 -30 0 87 1 5 1 2 4 8 16 +130 -94 -20 0 17 1 5 1 2 4 8 16 +131 -21 77 0 81 1 5 1 2 4 8 16 +132 64 37 0 72 1 5 1 2 4 8 16 +133 -70 -19 0 10 1 5 1 2 4 8 16 +134 88 65 0 50 1 5 1 2 4 8 16 +135 2 29 0 25 1 5 1 2 4 8 16 +136 33 57 0 71 1 5 1 2 4 8 16 +137 -70 6 0 85 1 5 1 2 4 8 16 +138 -38 -56 0 51 1 5 1 2 4 8 16 +139 -80 -95 0 29 1 5 1 2 4 8 16 +140 -5 -39 0 55 1 5 1 2 4 8 16 +141 8 -22 0 45 1 5 1 2 4 8 16 +142 -61 -76 0 100 1 5 1 2 4 8 16 +143 76 -22 0 38 1 5 1 2 4 8 16 +144 49 -71 0 11 1 5 1 2 4 8 16 +145 -30 -68 0 82 1 5 1 2 4 8 16 +146 1 34 0 50 1 5 1 2 4 8 16 +147 77 79 0 39 1 5 1 2 4 8 16 +148 -58 64 0 6 1 5 1 2 4 8 16 +149 82 -97 0 87 1 5 1 2 4 8 16 +150 -80 55 0 83 1 5 1 2 4 8 16 +151 81 -86 0 22 1 5 1 2 4 8 16 +152 39 -49 0 24 1 5 1 2 4 8 16 +153 -67 72 0 69 1 5 1 2 4 8 16 +154 -25 -89 0 97 1 5 1 2 4 8 16 +155 -44 -95 0 65 1 5 1 2 4 8 16 +156 32 -68 0 97 1 5 1 2 4 8 16 +157 -17 49 0 79 1 5 1 2 4 8 16 +158 93 49 0 79 1 5 1 2 4 8 16 +159 99 81 0 46 1 5 1 2 4 8 16 +160 10 -49 0 52 1 5 1 2 4 8 16 +161 63 -41 0 39 1 5 1 2 4 8 16 +162 38 39 0 94 1 5 1 2 4 8 16 +163 -28 39 0 97 1 5 1 2 4 8 16 +164 -2 -47 0 18 1 5 1 2 4 8 16 +165 38 8 0 3 1 5 1 2 4 8 16 +166 -42 -6 0 23 1 5 1 2 4 8 16 +167 -67 88 0 19 1 5 1 2 4 8 16 +168 19 93 0 40 1 5 1 2 4 8 16 +169 40 27 0 49 1 5 1 2 4 8 16 +170 -61 56 0 96 1 5 1 2 4 8 16 +171 43 33 0 58 1 5 1 2 4 8 16 +172 -18 -39 0 15 1 5 1 2 4 8 16 +173 -69 19 0 21 1 5 1 2 4 8 16 +174 75 -18 0 56 1 5 1 2 4 8 16 +175 31 85 0 67 1 5 1 2 4 8 16 +176 25 58 0 10 1 5 1 2 4 8 16 +177 -16 36 0 36 1 5 1 2 4 8 16 +178 91 15 0 84 1 5 1 2 4 8 16 +179 60 -39 0 59 1 5 1 2 4 8 16 +180 49 -47 0 85 1 5 1 2 4 8 16 +181 42 33 0 60 1 5 1 2 4 8 16 +182 16 -81 0 33 1 5 1 2 4 8 16 +183 -78 53 0 62 1 5 1 2 4 8 16 +184 53 -80 0 70 1 5 1 2 4 8 16 +185 -46 -26 0 79 1 5 1 2 4 8 16 +186 -25 -54 0 98 1 5 1 2 4 8 16 +187 69 -46 0 99 1 5 1 2 4 8 16 +188 0 -78 0 18 1 5 1 2 4 8 16 +189 -84 74 0 55 1 5 1 2 4 8 16 +190 -16 16 0 75 1 5 1 2 4 8 16 +191 -63 -14 0 94 1 5 1 2 4 8 16 +192 51 -77 0 89 1 5 1 2 4 8 16 +193 -39 61 0 13 1 5 1 2 4 8 16 +194 5 97 0 19 1 5 1 2 4 8 16 +195 -55 39 0 19 1 5 1 2 4 8 16 +196 70 -14 0 90 1 5 1 2 4 8 16 +197 0 95 0 35 1 5 1 2 4 8 16 +198 -45 7 0 76 1 5 1 2 4 8 16 +199 38 -24 0 3 1 5 1 2 4 8 16 +200 50 -37 0 11 1 5 1 2 4 8 16 +201 59 71 0 98 1 5 1 2 4 8 16 +202 -73 -96 0 92 1 5 1 2 4 8 16 +203 -29 72 0 1 1 5 1 2 4 8 16 +204 -47 12 0 2 1 5 1 2 4 8 16 +205 -88 -61 0 63 1 5 1 2 4 8 16 +206 -88 36 0 57 1 5 1 2 4 8 16 +207 -46 -3 0 50 1 5 1 2 4 8 16 +208 26 -37 0 19 1 5 1 2 4 8 16 +209 -39 -67 0 24 1 5 1 2 4 8 16 +210 92 27 0 14 1 5 1 2 4 8 16 +211 -80 -31 0 18 1 5 1 2 4 8 16 +212 93 -50 0 77 1 5 1 2 4 8 16 +213 -20 -5 0 28 1 5 1 2 4 8 16 +214 -22 73 0 72 1 5 1 2 4 8 16 +215 -4 -7 0 49 1 5 1 2 4 8 16 +216 54 -48 0 58 1 5 1 2 4 8 16 +217 -70 39 0 84 1 5 1 2 4 8 16 +218 54 -82 0 58 1 5 1 2 4 8 16 +219 29 41 0 41 1 5 1 2 4 8 16 +220 -87 51 0 98 1 5 1 2 4 8 16 +221 -96 -36 0 77 1 5 1 2 4 8 16 +222 49 8 0 57 1 5 1 2 4 8 16 +223 -5 54 0 39 1 5 1 2 4 8 16 +224 -26 43 0 99 1 5 1 2 4 8 16 +225 -11 60 0 83 1 5 1 2 4 8 16 +226 40 61 0 54 1 5 1 2 4 8 16 +227 82 35 0 86 1 5 1 2 4 8 16 +228 -92 12 0 2 1 5 1 2 4 8 16 +229 -93 -86 0 14 1 5 1 2 4 8 16 +230 -66 63 0 42 1 5 1 2 4 8 16 +231 -72 -87 0 14 1 5 1 2 4 8 16 +232 -57 -84 0 55 1 5 1 2 4 8 16 +233 23 52 0 2 1 5 1 2 4 8 16 +234 -56 -62 0 18 1 5 1 2 4 8 16 +235 -19 59 0 17 1 5 1 2 4 8 16 +236 63 -14 0 22 1 5 1 2 4 8 16 +237 -13 38 0 28 1 5 1 2 4 8 16 +238 -19 87 0 3 1 5 1 2 4 8 16 +239 44 -84 0 96 1 5 1 2 4 8 16 +240 98 -17 0 53 1 5 1 2 4 8 16 +241 -16 62 0 15 1 5 1 2 4 8 16 +242 3 66 0 36 1 5 1 2 4 8 16 +243 26 22 0 98 1 5 1 2 4 8 16 +244 -38 -81 0 78 1 5 1 2 4 8 16 +245 70 -80 0 92 1 5 1 2 4 8 16 +246 17 -35 0 65 1 5 1 2 4 8 16 +247 96 -83 0 64 1 5 1 2 4 8 16 +248 -77 80 0 43 1 5 1 2 4 8 16 +249 -14 44 0 50 1 5 1 2 4 8 16 +250 70 0 0 0 0 0 +251 40 80 0 0 0 0 +252 40 -80 0 0 0 0 +253 -60 20 0 0 0 0 +254 -60 -20 0 0 0 0 diff --git a/jsprit-examples/src/main/java/jsprit/examples/AdditionalDistanceConstraintExample.java b/jsprit-examples/src/main/java/jsprit/examples/AdditionalDistanceConstraintExample.java index 6571f30f..4b01fe30 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/AdditionalDistanceConstraintExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/AdditionalDistanceConstraintExample.java @@ -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 solutions = vra.searchSolutions(); diff --git a/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java b/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java index c6b61602..836b0ccc 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java +++ b/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java @@ -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); diff --git a/jsprit-examples/src/main/java/jsprit/examples/CircleExample.java b/jsprit-examples/src/main/java/jsprit/examples/CircleExample.java index 5bc9c21c..f053277e 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/CircleExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/CircleExample.java @@ -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 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++; } diff --git a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java index d76ac594..303b8380 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java @@ -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 */ diff --git a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java index b0dc3a03..8c5b9bbc 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java @@ -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 */ diff --git a/jsprit-examples/src/main/java/jsprit/examples/MultipleProductsWithLoadConstraintExample.java b/jsprit-examples/src/main/java/jsprit/examples/MultipleProductsWithLoadConstraintExample.java index 988cc1cd..9c44cbfb 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/MultipleProductsWithLoadConstraintExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/MultipleProductsWithLoadConstraintExample.java @@ -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 solutions = vra.searchSolutions(); diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java index 0c72e8a8..0551b25d 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java @@ -91,7 +91,7 @@ public class SolomonWithSkillsExample { constraintManager.addSkillsConstraint(); VehicleRoutingAlgorithm vra = vraBuilder.build(); -// vra.setNuOfIterations(500); +// vra.setMaxIterations(500); Collection solutions = vra.searchSolutions(); diff --git a/jsprit-instances/src/main/java/jsprit/instance/reader/Taillard.java b/jsprit-instances/src/main/java/jsprit/instance/reader/Taillard.java index 0367806a..56e3f07c 100644 --- a/jsprit-instances/src/main/java/jsprit/instance/reader/Taillard.java +++ b/jsprit-instances/src/main/java/jsprit/instance/reader/Taillard.java @@ -339,7 +339,7 @@ package jsprit.instance.reader; // bestInsertion); // postOpt.setFleetManager(vehicleFleetManager); // postOpt.setVehicleRouteFactory(new VehicleRouteFactoryImpl(depotId)); -// postOpt.setNuOfIterations(2000); +// postOpt.setMaxIterations(2000); // postOpt.setShareOfJobsToRuin(0.18); //// smallNeighborHoodSearch.addModule(postOpt); // @@ -350,7 +350,7 @@ package jsprit.instance.reader; //// bestInsertion); //// postOpt2.setFleetManager(vehicleFleetManager); //// postOpt2.setVehicleRouteFactory(new VehicleRouteFactoryImpl(depotId)); -//// postOpt2.setNuOfIterations(2000); +//// postOpt2.setMaxIterations(2000); //// postOpt2.setShareOfJobsToRuin(0.1); //// strat2.addModule(postOpt2); // @@ -370,7 +370,7 @@ package jsprit.instance.reader; //// strategyManager.addStrategy(strat2, 0.3); // // metaAlgorithm.setSearchStrategyManager(strategyManager); -// metaAlgorithm.setNuOfIterations(20); +// metaAlgorithm.setMaxIterations(20); // VehicleRoutingProblem.SOLUTION_MEMORY = 4; // //