diff --git a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ConcurrentBenchmarker.java b/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ConcurrentBenchmarker.java deleted file mode 100644 index f3020c7b..00000000 --- a/jsprit-analysis/src/main/java/com/graphhopper/jsprit/analysis/toolbox/ConcurrentBenchmarker.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.analysis.toolbox; - -import com.graphhopper.jsprit.analysis.util.BenchmarkWriter; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmFactory; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.util.BenchmarkInstance; -import com.graphhopper.jsprit.core.util.BenchmarkResult; -import com.graphhopper.jsprit.core.util.Solutions; -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.*; - - -public class ConcurrentBenchmarker { - - public static interface Cost { - public double getCost(VehicleRoutingProblemSolution sol); - } - - - private String algorithmConfig = null; - - private List benchmarkInstances = new ArrayList(); - - private int runs = 1; - - private Collection writers = new ArrayList(); - - private Collection results = new ArrayList(); - - private Cost cost = new Cost() { - - @Override - public double getCost(VehicleRoutingProblemSolution sol) { - return sol.getCost(); - } - - }; - - private VehicleRoutingAlgorithmFactory algorithmFactory; - - public void setCost(Cost cost) { - this.cost = cost; - } - - public ConcurrentBenchmarker(String algorithmConfig) { - super(); - this.algorithmConfig = algorithmConfig; -// LoggerFactory.getRootLogger().setLevel(Level.ERROR); - } - - public ConcurrentBenchmarker(VehicleRoutingAlgorithmFactory algorithmFactory) { - this.algorithmFactory = algorithmFactory; - } - - public void addBenchmarkWriter(BenchmarkWriter writer) { - writers.add(writer); - } - - public void addInstance(String name, VehicleRoutingProblem problem) { - benchmarkInstances.add(new BenchmarkInstance(name, problem, null, null)); - } - - public void addInstane(BenchmarkInstance instance) { - benchmarkInstances.add(instance); - } - - public void addAllInstances(Collection instances) { - benchmarkInstances.addAll(instances); - } - - public void addInstance(String name, VehicleRoutingProblem problem, Double bestKnownResult, Double bestKnownVehicles) { - benchmarkInstances.add(new BenchmarkInstance(name, problem, bestKnownResult, bestKnownVehicles)); - } - - /** - * Sets nuOfRuns with same algorithm on same instance. - *

Default is 1 - * - * @param runs - */ - public void setNuOfRuns(int runs) { - this.runs = runs; - } - - public void run() { - System.out.println("start benchmarking [nuOfInstances=" + benchmarkInstances.size() + "][runsPerInstance=" + runs + "]"); - double startTime = System.currentTimeMillis(); - ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1); - List> futures = new ArrayList>(); - for (final BenchmarkInstance p : benchmarkInstances) { - - Future futureResult = executor.submit(new Callable() { - - @Override - public BenchmarkResult call() throws Exception { - return runAlgoAndGetResult(p); - } - - }); - futures.add(futureResult); - - } - try { - int count = 1; - for (Future f : futures) { - BenchmarkResult r = f.get(); - print(r, count); - results.add(f.get()); - count++; - } - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - executor.shutdown(); - print(results); - System.out.println("done [time=" + (System.currentTimeMillis() - startTime) / 1000 + "sec]"); - } - - private BenchmarkResult runAlgoAndGetResult(BenchmarkInstance p) { - double[] vehicles = new double[runs]; - double[] results = new double[runs]; - double[] times = new double[runs]; - - for (int run = 0; run < runs; run++) { - VehicleRoutingAlgorithm vra = createAlgorithm(p); - StopWatch stopwatch = new StopWatch(); - vra.getAlgorithmListeners().addListener(stopwatch, Priority.HIGH); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution best = Solutions.bestOf(solutions); - vehicles[run] = best.getRoutes().size(); - results[run] = cost.getCost(best); - times[run] = stopwatch.getCompTimeInSeconds(); - } - - return new BenchmarkResult(p, runs, results, times, vehicles); - } - - private VehicleRoutingAlgorithm createAlgorithm(BenchmarkInstance p) { - if (algorithmConfig != null) { - return VehicleRoutingAlgorithms.readAndCreateAlgorithm(p.vrp, algorithmConfig); - } else { - return algorithmFactory.createAlgorithm(p.vrp); - } - - } - - private void print(Collection results) { - double sumTime = 0.0; - double sumResult = 0.0; - for (BenchmarkResult r : results) { - sumTime += r.getTimesStats().getMean(); - sumResult += r.getResultStats().getMean(); -// print(r); - } - System.out.println("[avgTime=" + round(sumTime / (double) results.size(), 2) + "][avgResult=" + round(sumResult / (double) results.size(), 2) + "]"); - for (BenchmarkWriter writer : writers) { - writer.write(results); - } - } - - private void print(BenchmarkResult r, int count) { - Double avgDelta = null; - Double bestDelta = null; - Double worstDelta = null; - if (r.instance.bestKnownResult != null) { - avgDelta = (r.getResultStats().getMean() / r.instance.bestKnownResult - 1) * 100; - bestDelta = (r.getResultStats().getMin() / r.instance.bestKnownResult - 1) * 100; - worstDelta = (r.getResultStats().getMax() / r.instance.bestKnownResult - 1) * 100; - } - System.out.println("(" + count + "/" + benchmarkInstances.size() + ")" + "\t[instance=" + r.instance.name + - "][avgTime=" + round(r.getTimesStats().getMean(), 2) + "]" + - "[Result=" + getString(r.getResultStats()) + "]" + - "[Vehicles=" + getString(r.getVehicleStats()) + "]" + - "[Delta[%]=" + getString(bestDelta, avgDelta, worstDelta) + "]"); - } - - private String getString(Double bestDelta, Double avgDelta, Double worstDelta) { - return "[best=" + round(bestDelta, 2) + "][avg=" + round(avgDelta, 2) + "][worst=" + round(worstDelta, 2) + "]"; - } - - private String getString(DescriptiveStatistics stats) { - return "[best=" + round(stats.getMin(), 2) + "][avg=" + round(stats.getMean(), 2) + "][worst=" + round(stats.getMax(), 2) + "][stdDev=" + round(stats.getStandardDeviation(), 2) + "]"; - } - - private Double round(Double value, int i) { - if (value == null) return null; - long roundedVal = Math.round(value * Math.pow(10, i)); - return (double) roundedVal / (double) (Math.pow(10, i)); - } - -} diff --git a/jsprit-core/pom.xml b/jsprit-core/pom.xml index 54096f97..b427f92e 100644 --- a/jsprit-core/pom.xml +++ b/jsprit-core/pom.xml @@ -55,60 +55,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - commons-configuration - commons-configuration - 1.9 - jar - compile - - - - xerces - xercesImpl - 2.11.0 - compile - - org.apache.commons commons-math3 3.4 + + org.slf4j + slf4j-api + ${logger.version} + + diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java deleted file mode 100644 index 80af621b..00000000 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/VehicleRoutingAlgorithmBuilder.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm; - -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfig; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfigXmlReader; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.algorithm.state.StateManager; -import com.graphhopper.jsprit.core.algorithm.state.UpdateEndLocationIfRouteIsOpen; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.solution.SolutionCostCalculator; - -/** - * Builder that builds a {@link VehicleRoutingAlgorithm}. - * - * @author schroeder - */ -public class VehicleRoutingAlgorithmBuilder { - - private String algorithmConfigFile; - - private AlgorithmConfig algorithmConfig; - - private final VehicleRoutingProblem vrp; - - private SolutionCostCalculator solutionCostCalculator; - - private StateManager stateManager; - - private boolean addCoreConstraints = false; - - private boolean addDefaultCostCalculators = false; - - private ConstraintManager constraintManager; - - private int nuOfThreads = 0; - - /** - * Constructs the builder with the problem and an algorithmConfigFile. Latter is to configure and specify the ruin-and-recreate meta-heuristic. - * - * @param problem to solve - * @param algorithmConfig config file of VehicleRoutingAlgorithm - */ - public VehicleRoutingAlgorithmBuilder(VehicleRoutingProblem problem, String algorithmConfig) { - this.vrp = problem; - this.algorithmConfigFile = algorithmConfig; - this.algorithmConfig = null; - } - - /** - * Constructs the builder with the problem and an algorithmConfig. Latter is to configure and specify the ruin-and-recreate meta-heuristic. - * - * @param problem to solve - * @param algorithmConfig config file of VehicleRoutingAlgorithm - */ - public VehicleRoutingAlgorithmBuilder(VehicleRoutingProblem problem, AlgorithmConfig algorithmConfig) { - this.vrp = problem; - this.algorithmConfigFile = null; - this.algorithmConfig = algorithmConfig; - } - - /** - * Sets custom objective function. - *

- *

If objective function is not set, a default function is applied (which basically minimizes - * fixed and variable transportation costs ({@link VariablePlusFixedSolutionCostCalculatorFactory}). - * - * @param objectiveFunction to be minimized - * @see VariablePlusFixedSolutionCostCalculatorFactory - */ - public void setObjectiveFunction(SolutionCostCalculator objectiveFunction) { - this.solutionCostCalculator = objectiveFunction; - } - - /** - * Sets stateManager to memorize states. - * - * @param stateManager that memorizes your states - * @see StateManager - */ - public void setStateManager(StateManager stateManager) { - this.stateManager = stateManager; - } - - /** - * Adds core constraints. - *

- *

Thus, it adds vehicle-capacity, time-window and skills constraints and their - * required stateUpdater. - */ - public void addCoreConstraints() { - addCoreConstraints = true; - } - - /** - * Adds default cost calculators used by the insertion heuristic, - * to calculate activity insertion costs. - * By default, marginal transportation costs are calculated. Thus when inserting - * act_k between act_i and act_j, marginal (additional) transportation costs - * are basically c(act_i,act_k)+c(act_k,act_j)-c(act_i,act_j). - *

- *

Do not use this method, if you plan to control the insertion heuristic - * entirely via hard- and soft-constraints. - */ - public void addDefaultCostCalculators() { - addDefaultCostCalculators = true; - } - - /** - * Sets state- and constraintManager. - * - * @param stateManager that memorizes your states - * @param constraintManager that manages your constraints - * @see StateManager - * @see ConstraintManager - */ - public void setStateAndConstraintManager(StateManager stateManager, ConstraintManager constraintManager) { - this.stateManager = stateManager; - this.constraintManager = constraintManager; - } - - /** - * Sets nuOfThreads. - * - * @param nuOfThreads to be operated - */ - public void setNuOfThreads(int nuOfThreads) { - this.nuOfThreads = nuOfThreads; - } - - /** - * Builds and returns the algorithm. - *

- *

If algorithmConfigFile is set, it reads the configuration. - * - * @return the algorithm - */ - public VehicleRoutingAlgorithm build() { - if (stateManager == null) stateManager = new StateManager(vrp); - if (constraintManager == null) constraintManager = new ConstraintManager(vrp, stateManager); - //add core updater - stateManager.addStateUpdater(new UpdateEndLocationIfRouteIsOpen()); -// stateManager.addStateUpdater(new OpenRouteStateVerifier()); - - if (addCoreConstraints) { - constraintManager.addLoadConstraint(); - constraintManager.addTimeWindowConstraint(); - constraintManager.addSkillsConstraint(); - stateManager.updateLoadStates(); - stateManager.updateTimeWindowStates(); - stateManager.updateSkillStates(); - } - if (algorithmConfig == null) { - algorithmConfig = new AlgorithmConfig(); - AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig); - xmlReader.read(algorithmConfigFile); - } - return VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, algorithmConfig, nuOfThreads, solutionCostCalculator, stateManager, constraintManager, addDefaultCostCalculators); - } - - -} diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java index 64ca65f5..d42ff4d2 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/ExperimentalSchrimpfAcceptance.java @@ -17,21 +17,18 @@ package com.graphhopper.jsprit.core.algorithm.acceptor; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfig; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfigXmlReader; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.GreedySchrimpfFactory; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.listener.AlgorithmStartsListener; import com.graphhopper.jsprit.core.algorithm.listener.IterationEndsListener; import com.graphhopper.jsprit.core.algorithm.listener.IterationStartsListener; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.util.Resource; import com.graphhopper.jsprit.core.util.Solutions; import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.URL; import java.util.Collection; @@ -114,10 +111,9 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati */ final double[] results = new double[nOfRandomWalks]; - URL resource = Resource.getAsURL("randomWalk.xml"); - AlgorithmConfig algorithmConfig = new AlgorithmConfig(); - new AlgorithmConfigXmlReader(algorithmConfig).read(resource); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(problem, algorithmConfig); + Jsprit.Builder builder = new GreedySchrimpfFactory().createGreedyAlgorithmBuilder(problem); + builder.setCustomAcceptor(new AcceptNewRemoveFirst(1)); + VehicleRoutingAlgorithm vra = builder.buildAlgorithm(); vra.setMaxIterations(nOfRandomWalks); vra.getAlgorithmListeners().addListener(new IterationEndsListener() { diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfInitialThresholdGenerator.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfInitialThresholdGenerator.java index 3905142c..09f90237 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfInitialThresholdGenerator.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/acceptor/SchrimpfInitialThresholdGenerator.java @@ -17,20 +17,17 @@ package com.graphhopper.jsprit.core.algorithm.acceptor; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfig; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfigXmlReader; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.GreedySchrimpfFactory; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.listener.AlgorithmStartsListener; import com.graphhopper.jsprit.core.algorithm.listener.IterationEndsListener; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.util.Resource; import com.graphhopper.jsprit.core.util.Solutions; import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.URL; import java.util.Collection; public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListener { @@ -57,10 +54,9 @@ public class SchrimpfInitialThresholdGenerator implements AlgorithmStartsListene */ final double[] results = new double[nOfRandomWalks]; - URL resource = Resource.getAsURL("randomWalk.xml"); - AlgorithmConfig algorithmConfig = new AlgorithmConfig(); - new AlgorithmConfigXmlReader(algorithmConfig).read(resource); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(problem, algorithmConfig); + Jsprit.Builder builder = new GreedySchrimpfFactory().createGreedyAlgorithmBuilder(problem); + builder.setCustomAcceptor(new AcceptNewRemoveFirst(1)); + VehicleRoutingAlgorithm vra = builder.buildAlgorithm(); vra.setMaxIterations(nOfRandomWalks); vra.getAlgorithmListeners().addListener(new IterationEndsListener() { diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java index 195fcdf9..bd8c05d8 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/GreedySchrimpfFactory.java @@ -17,13 +17,7 @@ package com.graphhopper.jsprit.core.algorithm.box; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfig; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfigXmlReader; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.util.Resource; - -import java.net.URL; /** @@ -53,11 +47,28 @@ public class GreedySchrimpfFactory { * @return algorithm */ public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { - AlgorithmConfig algorithmConfig = new AlgorithmConfig(); - URL resource = Resource.getAsURL("greedySchrimpf.xml"); - new AlgorithmConfigXmlReader(algorithmConfig).read(resource); - return VehicleRoutingAlgorithms.createAlgorithm(vrp, algorithmConfig); + return createGreedyAlgorithmBuilder(vrp).buildAlgorithm(); } + public Jsprit.Builder createGreedyAlgorithmBuilder(VehicleRoutingProblem vrp) { + int radialShare = (int) (vrp.getJobs().size() * 0.3); + int randomShare = (int) (vrp.getJobs().size() * 0.5); + + Jsprit.Builder builder = Jsprit.Builder.newInstance(vrp); + builder.setProperty(Jsprit.Parameter.THRESHOLD_ALPHA,"0.0"); + builder.setProperty(Jsprit.Strategy.RADIAL_BEST, "0.5"); + builder.setProperty(Jsprit.Strategy.RADIAL_REGRET, "0.0"); + builder.setProperty(Jsprit.Strategy.RANDOM_BEST, "0.5"); + builder.setProperty(Jsprit.Strategy.RANDOM_REGRET, "0.0"); + builder.setProperty(Jsprit.Strategy.WORST_BEST, "0.0"); + builder.setProperty(Jsprit.Strategy.WORST_REGRET, "0.0"); + builder.setProperty(Jsprit.Strategy.CLUSTER_BEST, "0.0"); + builder.setProperty(Jsprit.Strategy.CLUSTER_REGRET, "0.0"); + builder.setProperty(Jsprit.Parameter.RADIAL_MIN_SHARE, String.valueOf(radialShare)); + builder.setProperty(Jsprit.Parameter.RADIAL_MAX_SHARE, String.valueOf(radialShare)); + builder.setProperty(Jsprit.Parameter.RANDOM_BEST_MIN_SHARE, String.valueOf(randomShare)); + builder.setProperty(Jsprit.Parameter.RANDOM_BEST_MAX_SHARE, String.valueOf(randomShare)); + return builder; + } } diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java index 2f49d5c9..1e881fea 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/Jsprit.java @@ -4,6 +4,7 @@ import com.graphhopper.jsprit.core.algorithm.PrettyAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.SearchStrategy; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.acceptor.SchrimpfAcceptance; +import com.graphhopper.jsprit.core.algorithm.acceptor.SolutionAcceptor; import com.graphhopper.jsprit.core.algorithm.listener.AlgorithmEndsListener; import com.graphhopper.jsprit.core.algorithm.listener.IterationStartsListener; import com.graphhopper.jsprit.core.algorithm.module.RuinAndRecreateModule; @@ -140,6 +141,8 @@ public class Jsprit { private ActivityInsertionCostsCalculator activityInsertionCalculator; + private SolutionAcceptor solutionAcceptor; + public static Builder newInstance(VehicleRoutingProblem vrp) { return new Builder(vrp); } @@ -199,6 +202,11 @@ public class Jsprit { return this; } + public Builder setCustomAcceptor(SolutionAcceptor acceptor){ + this.solutionAcceptor = acceptor; + return this; + } + public Builder setRandom(Random random) { this.random = random; return this; @@ -300,6 +308,8 @@ public class Jsprit { private Random random; + private SolutionAcceptor acceptor; + private Jsprit(Builder builder) { this.stateManager = builder.stateManager; this.constraintManager = builder.constraintManager; @@ -310,6 +320,7 @@ public class Jsprit { this.objectiveFunction = builder.objectiveFunction; this.random = builder.random; this.activityInsertion = builder.activityInsertionCalculator; + this.acceptor = builder.solutionAcceptor; } private VehicleRoutingAlgorithm create(final VehicleRoutingProblem vrp) { @@ -500,40 +511,44 @@ public class Jsprit { } best.setRandom(random); - final SchrimpfAcceptance schrimpfAcceptance = new SchrimpfAcceptance(1, toDouble(getProperty(Parameter.THRESHOLD_ALPHA.toString()))); - IterationStartsListener schrimpfThreshold = new IterationStartsListener() { - @Override - public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection solutions) { - if (i == 1) { - double initialThreshold = Solutions.bestOf(solutions).getCost() * toDouble(getProperty(Parameter.THRESHOLD_INI.toString())); - schrimpfAcceptance.setInitialThreshold(initialThreshold); + IterationStartsListener schrimpfThreshold = null; + if(acceptor == null) { + final SchrimpfAcceptance schrimpfAcceptance = new SchrimpfAcceptance(1, toDouble(getProperty(Parameter.THRESHOLD_ALPHA.toString()))); + schrimpfThreshold = new IterationStartsListener() { + @Override + public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection solutions) { + if (i == 1) { + double initialThreshold = Solutions.bestOf(solutions).getCost() * toDouble(getProperty(Parameter.THRESHOLD_INI.toString())); + schrimpfAcceptance.setInitialThreshold(initialThreshold); + } } - } - }; + }; + acceptor = schrimpfAcceptance; + } SolutionCostCalculator objectiveFunction = getObjectiveFunction(vrp, maxCosts); - SearchStrategy radial_regret = new SearchStrategy(Strategy.RADIAL_REGRET.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + SearchStrategy radial_regret = new SearchStrategy(Strategy.RADIAL_REGRET.toString(), new SelectBest(), acceptor, objectiveFunction); radial_regret.addModule(new RuinAndRecreateModule(Strategy.RADIAL_REGRET.toString(), regret, radial)); - SearchStrategy radial_best = new SearchStrategy(Strategy.RADIAL_BEST.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + SearchStrategy radial_best = new SearchStrategy(Strategy.RADIAL_BEST.toString(), new SelectBest(), acceptor, objectiveFunction); radial_best.addModule(new RuinAndRecreateModule(Strategy.RADIAL_BEST.toString(), best, radial)); - SearchStrategy random_best = new SearchStrategy(Strategy.RANDOM_BEST.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + SearchStrategy random_best = new SearchStrategy(Strategy.RANDOM_BEST.toString(), new SelectBest(), acceptor, objectiveFunction); random_best.addModule(new RuinAndRecreateModule(Strategy.RANDOM_BEST.toString(), best, random_for_best)); - SearchStrategy random_regret = new SearchStrategy(Strategy.RANDOM_REGRET.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + SearchStrategy random_regret = new SearchStrategy(Strategy.RANDOM_REGRET.toString(), new SelectBest(), acceptor, objectiveFunction); random_regret.addModule(new RuinAndRecreateModule(Strategy.RANDOM_REGRET.toString(), regret, random_for_regret)); - SearchStrategy worst_regret = new SearchStrategy(Strategy.WORST_REGRET.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + SearchStrategy worst_regret = new SearchStrategy(Strategy.WORST_REGRET.toString(), new SelectBest(), acceptor, objectiveFunction); worst_regret.addModule(new RuinAndRecreateModule(Strategy.WORST_REGRET.toString(), regret, worst)); - SearchStrategy worst_best = new SearchStrategy(Strategy.WORST_BEST.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + SearchStrategy worst_best = new SearchStrategy(Strategy.WORST_BEST.toString(), new SelectBest(), acceptor, objectiveFunction); worst_best.addModule(new RuinAndRecreateModule(Strategy.WORST_BEST.toString(), best, worst)); - final SearchStrategy clusters_regret = new SearchStrategy(Strategy.CLUSTER_REGRET.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + final SearchStrategy clusters_regret = new SearchStrategy(Strategy.CLUSTER_REGRET.toString(), new SelectBest(), acceptor, objectiveFunction); clusters_regret.addModule(new RuinAndRecreateModule(Strategy.CLUSTER_REGRET.toString(), regret, clusters)); - final SearchStrategy clusters_best = new SearchStrategy(Strategy.CLUSTER_BEST.toString(), new SelectBest(), schrimpfAcceptance, objectiveFunction); + final SearchStrategy clusters_best = new SearchStrategy(Strategy.CLUSTER_BEST.toString(), new SelectBest(), acceptor, objectiveFunction); clusters_best.addModule(new RuinAndRecreateModule(Strategy.CLUSTER_BEST.toString(), best, clusters)); @@ -558,7 +573,9 @@ public class Jsprit { VehicleRoutingAlgorithm vra = prettyBuilder.build(); - vra.addListener(schrimpfThreshold); + if(schrimpfThreshold != null) { + vra.addListener(schrimpfThreshold); + } vra.addListener(noiseConfigurator); vra.addListener(noise); vra.addListener(clusters); diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java index 069af7b6..50eefb0d 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/SchrimpfFactory.java @@ -17,13 +17,7 @@ package com.graphhopper.jsprit.core.algorithm.box; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfig; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfigXmlReader; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.util.Resource; - -import java.net.URL; /** @@ -53,10 +47,25 @@ public class SchrimpfFactory { * @return algorithm */ public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { - AlgorithmConfig algorithmConfig = new AlgorithmConfig(); - URL resource = Resource.getAsURL("schrimpf.xml"); - new AlgorithmConfigXmlReader(algorithmConfig).read(resource); - return VehicleRoutingAlgorithms.createAlgorithm(vrp, algorithmConfig); + //TODO determine alpha threshold + + int radialShare = (int) (vrp.getJobs().size() * 0.3); + int randomShare = (int) (vrp.getJobs().size() * 0.5); + Jsprit.Builder builder = Jsprit.Builder.newInstance(vrp); + builder.setProperty(Jsprit.Parameter.THRESHOLD_ALPHA,"0.0"); + builder.setProperty(Jsprit.Strategy.RADIAL_BEST, "0.5"); + builder.setProperty(Jsprit.Strategy.RADIAL_REGRET, "0.0"); + builder.setProperty(Jsprit.Strategy.RANDOM_BEST, "0.5"); + builder.setProperty(Jsprit.Strategy.RANDOM_REGRET, "0.0"); + builder.setProperty(Jsprit.Strategy.WORST_BEST, "0.0"); + builder.setProperty(Jsprit.Strategy.WORST_REGRET, "0.0"); + builder.setProperty(Jsprit.Strategy.CLUSTER_BEST, "0.0"); + builder.setProperty(Jsprit.Strategy.CLUSTER_REGRET, "0.0"); + builder.setProperty(Jsprit.Parameter.RADIAL_MIN_SHARE, String.valueOf(radialShare)); + builder.setProperty(Jsprit.Parameter.RADIAL_MAX_SHARE, String.valueOf(radialShare)); + builder.setProperty(Jsprit.Parameter.RANDOM_BEST_MIN_SHARE, String.valueOf(randomShare)); + builder.setProperty(Jsprit.Parameter.RANDOM_BEST_MAX_SHARE, String.valueOf(randomShare)); + return builder.buildAlgorithm(); } diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java index 579166ff..bf110c35 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java @@ -30,12 +30,12 @@ import com.graphhopper.jsprit.core.algorithm.state.InternalStates; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.SolutionCostCalculator; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; import com.graphhopper.jsprit.core.problem.vehicle.InfiniteFleetManagerFactory; import com.graphhopper.jsprit.core.problem.vehicle.VehicleFleetManager; +import com.graphhopper.jsprit.core.util.ChristofidesReader; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Before; import org.junit.Test; @@ -55,7 +55,7 @@ public class BuildCVRPAlgoFromScratch_IT { @Before public void setup() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/vrpnc1-jsprit.xml"); + new ChristofidesReader(builder).read(getClass().getResourceAsStream("vrpnc1.txt")); vrp = builder.build(); final StateManager stateManager = new StateManager(vrp); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java deleted file mode 100644 index bc64e653..00000000 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildPDVRPAlgoFromScratch_IT.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm; - -import com.graphhopper.jsprit.core.IntegrationTest; -import com.graphhopper.jsprit.core.algorithm.acceptor.GreedyAcceptance; -import com.graphhopper.jsprit.core.algorithm.module.RuinAndRecreateModule; -import com.graphhopper.jsprit.core.algorithm.recreate.BestInsertionBuilder; -import com.graphhopper.jsprit.core.algorithm.recreate.InsertionStrategy; -import com.graphhopper.jsprit.core.algorithm.ruin.RadialRuinStrategyFactory; -import com.graphhopper.jsprit.core.algorithm.ruin.RandomRuinStrategyFactory; -import com.graphhopper.jsprit.core.algorithm.ruin.RuinStrategy; -import com.graphhopper.jsprit.core.algorithm.ruin.distance.AvgServiceDistance; -import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; -import com.graphhopper.jsprit.core.algorithm.state.InternalStates; -import com.graphhopper.jsprit.core.algorithm.state.StateManager; -import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprovementTermination; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; -import com.graphhopper.jsprit.core.problem.solution.SolutionCostCalculator; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; -import com.graphhopper.jsprit.core.problem.vehicle.InfiniteFleetManagerFactory; -import com.graphhopper.jsprit.core.problem.vehicle.VehicleFleetManager; -import junit.framework.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collection; - - -public class BuildPDVRPAlgoFromScratch_IT { - - VehicleRoutingProblem vrp; - - VehicleRoutingAlgorithm vra; - - static Logger log = LoggerFactory.getLogger(BuildPDVRPAlgoFromScratch_IT.class); - - @Before - public void setup() { - - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/pd_solomon_r101.xml"); - vrp = builder.build(); - - final StateManager stateManager = new StateManager(vrp); - - ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager); - - VehicleFleetManager fleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager(); - - 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); - - SolutionCostCalculator solutionCostCalculator = new SolutionCostCalculator() { - - @Override - public double getCosts(VehicleRoutingProblemSolution solution) { - double costs = 0.0; - for (VehicleRoute route : solution.getRoutes()) { - Double cost_of_route = stateManager.getRouteState(route, InternalStates.COSTS, Double.class); - if (cost_of_route == null) cost_of_route = 0.; - costs += cost_of_route; - } - return costs; - } - }; - - SearchStrategy randomStrategy = new SearchStrategy("random", new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator); - RuinAndRecreateModule randomModule = new RuinAndRecreateModule("randomRuin_bestInsertion", bestInsertion, random); - randomStrategy.addModule(randomModule); - - SearchStrategy radialStrategy = new SearchStrategy("radial", new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator); - RuinAndRecreateModule radialModule = new RuinAndRecreateModule("radialRuin_bestInsertion", bestInsertion, radial); - radialStrategy.addModule(radialModule); - - 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 - @Category(IntegrationTest.class) - public void test() { - try { - Collection solutions = vra.searchSolutions(); - Assert.assertTrue(true); - } catch (Exception e) { - Assert.assertTrue(false); - } - } - -} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java deleted file mode 100644 index c55b60e5..00000000 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/BuildPDVRPWithShipmentsAlgoFromScratch_IT.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm; - -import com.graphhopper.jsprit.core.IntegrationTest; -import com.graphhopper.jsprit.core.algorithm.acceptor.GreedyAcceptance; -import com.graphhopper.jsprit.core.algorithm.module.RuinAndRecreateModule; -import com.graphhopper.jsprit.core.algorithm.recreate.BestInsertionBuilder; -import com.graphhopper.jsprit.core.algorithm.recreate.InsertionStrategy; -import com.graphhopper.jsprit.core.algorithm.ruin.RadialRuinStrategyFactory; -import com.graphhopper.jsprit.core.algorithm.ruin.RandomRuinStrategyFactory; -import com.graphhopper.jsprit.core.algorithm.ruin.RuinStrategy; -import com.graphhopper.jsprit.core.algorithm.ruin.distance.AvgServiceAndShipmentDistance; -import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; -import com.graphhopper.jsprit.core.algorithm.state.InternalStates; -import com.graphhopper.jsprit.core.algorithm.state.StateManager; -import com.graphhopper.jsprit.core.algorithm.state.UpdateVariableCosts; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; -import com.graphhopper.jsprit.core.problem.solution.SolutionCostCalculator; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; -import com.graphhopper.jsprit.core.problem.vehicle.InfiniteFleetManagerFactory; -import com.graphhopper.jsprit.core.problem.vehicle.VehicleFleetManager; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.util.Collection; - -import static org.junit.Assert.assertTrue; - - -public class BuildPDVRPWithShipmentsAlgoFromScratch_IT { - - @Test - @Category(IntegrationTest.class) - public void test() { - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/pdp.xml"); - - VehicleRoutingProblem vrp = builder.build(); - - final StateManager stateManager = new StateManager(vrp); - stateManager.updateLoadStates(); -// stateManager.updateTimeWindowStates(); - stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager)); - - ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager); -// constraintManager.addTimeWindowConstraint(); - constraintManager.addLoadConstraint(); - - VehicleFleetManager fleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager(); - - BestInsertionBuilder bestIBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager, constraintManager); - InsertionStrategy bestInsertion = bestIBuilder.build(); - - - RuinStrategy radial = new RadialRuinStrategyFactory(0.3, new AvgServiceAndShipmentDistance(vrp.getTransportCosts())).createStrategy(vrp); - RuinStrategy random = new RandomRuinStrategyFactory(0.5).createStrategy(vrp); - - - SolutionCostCalculator solutionCostCalculator = new SolutionCostCalculator() { - - @Override - public double getCosts(VehicleRoutingProblemSolution solution) { - double costs = 0.0; - for (VehicleRoute route : solution.getRoutes()) { - costs += stateManager.getRouteState(route, InternalStates.COSTS, Double.class); - } - return costs; - } - }; - - SearchStrategy randomStrategy = new SearchStrategy("random", new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator); - RuinAndRecreateModule randomModule = new RuinAndRecreateModule("randomRuin_bestInsertion", bestInsertion, random); - randomStrategy.addModule(randomModule); - - 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); - - VehicleRoutingAlgorithm 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.setMaxIterations(3); - Collection solutions = vra.searchSolutions(); - assertTrue(!solutions.isEmpty()); - } - - -} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveriesAndDifferentInsertionStrategies_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveriesAndDifferentInsertionStrategies_IT.java deleted file mode 100644 index 2ea8caf3..00000000 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveriesAndDifferentInsertionStrategies_IT.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm; - -import com.graphhopper.jsprit.core.IntegrationTest; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import junit.framework.Assert; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.util.Collection; - -public class CVRPwithDeliveriesAndDifferentInsertionStrategies_IT { - - @Test - @Category(IntegrationTest.class) - public void whenWithTwoInsertionStrategiesWhereOnleOneIsInAlgo_itShouldWork() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig_greedyWithRegret.xml"); - vra.setMaxIterations(10); - try { - Collection solutions = vra.searchSolutions(); - Assert.assertTrue(true); - } catch (Exception e) { - Assert.assertTrue(false); - } - } - - @Test - @Category(IntegrationTest.class) - public void whenWithTwoInsertionStrategiesWhereBothAreInAlgo_itShouldWork() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig_greedyWithRegret_v2.xml"); - vra.setMaxIterations(10); - try { - Collection solutions = vra.searchSolutions(); - Assert.assertTrue(true); - } catch (Exception e) { - Assert.assertTrue(false); - } - } - -} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveries_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveries_IT.java index 11569adf..7695649e 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveries_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithDeliveries_IT.java @@ -18,10 +18,10 @@ package com.graphhopper.jsprit.core.algorithm; import com.graphhopper.jsprit.core.IntegrationTest; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.ChristofidesReader; +import com.graphhopper.jsprit.core.util.JobType; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -32,23 +32,11 @@ import static org.junit.Assert.assertEquals; public class CVRPwithDeliveries_IT { - @Test - @Category(IntegrationTest.class) - public void whenSolvingVRPNC1withDeliveries_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); - Collection solutions = vra.searchSolutions(); - assertEquals(530.0, Solutions.bestOf(solutions).getCost(), 50.0); - assertEquals(5, Solutions.bestOf(solutions).getRoutes().size()); - } - @Test @Category(IntegrationTest.class) public void whenSolvingVRPNC1withDeliveriesWithJsprit_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); + new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt")); VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithMatrix_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithMatrix_IT.java index 379bc3f5..8c597a09 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithMatrix_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithMatrix_IT.java @@ -17,20 +17,17 @@ package com.graphhopper.jsprit.core.algorithm; import com.graphhopper.jsprit.core.IntegrationTest; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.analysis.SolutionAnalyser; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.cost.TransportDistance; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.job.Job; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; -import com.graphhopper.jsprit.core.util.EuclideanDistanceCalculator; -import com.graphhopper.jsprit.core.util.FastVehicleRoutingTransportCostsMatrix; -import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.core.util.*; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -50,10 +47,10 @@ public class CVRPwithMatrix_IT { @Category(IntegrationTest.class) public void whenReturnToDepot_itShouldWorkWithMatrix() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); + new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt")); VehicleRoutingProblem vrp_ = vrpBuilder.build(); VehicleRoutingProblem vrp = createVrpWithLocationIndecesAndMatrix(vrp_, true); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); Collection solutions = vra.searchSolutions(); Assert.assertEquals(530.0, Solutions.bestOf(solutions).getCost(), 50.0); assertEquals(5, Solutions.bestOf(solutions).getRoutes().size()); @@ -63,10 +60,10 @@ public class CVRPwithMatrix_IT { @Category(IntegrationTest.class) public void whenNotReturnToDepot_itShouldWorkWithMatrix() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); + new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt")); VehicleRoutingProblem vrp_ = vrpBuilder.build(); VehicleRoutingProblem vrp = createVrpWithLocationIndecesAndMatrix(vrp_, false); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); try { Collection solutions = vra.searchSolutions(); assertTrue(true); @@ -79,10 +76,10 @@ public class CVRPwithMatrix_IT { @Category(IntegrationTest.class) public void whenCalcTimeWithSolutionAnalyser_itShouldWork() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml"); + new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt")); VehicleRoutingProblem vrp_ = vrpBuilder.build(); final VehicleRoutingProblem vrp = createVrpWithLocationIndecesAndMatrix(vrp_, false); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); Collection solutions = vra.searchSolutions(); SolutionAnalyser sa = new SolutionAnalyser(vrp, Solutions.bestOf(solutions), new TransportDistance() { @Override diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithPickups_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithPickups_IT.java index ccf2a7d9..9b02f7b8 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithPickups_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/CVRPwithPickups_IT.java @@ -18,10 +18,10 @@ package com.graphhopper.jsprit.core.algorithm; import com.graphhopper.jsprit.core.IntegrationTest; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.ChristofidesReader; +import com.graphhopper.jsprit.core.util.JobType; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -36,22 +36,9 @@ public class CVRPwithPickups_IT { @Category(IntegrationTest.class) public void whenSolvingVRPNC1WithPickups_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-pickups.xml"); + new ChristofidesReader(vrpBuilder).setJobType(JobType.PICKUP).read(getClass().getResourceAsStream("vrpnc1.txt")); VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); - Collection solutions = vra.searchSolutions(); - assertEquals(530.0, Solutions.bestOf(solutions).getCost(), 50.0); - assertEquals(5, Solutions.bestOf(solutions).getRoutes().size()); - } - - @Test - @Category(IntegrationTest.class) - public void whenSolvingVRPNC1WithPickupsWithJsprit_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-pickups.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(1000); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); Collection solutions = vra.searchSolutions(); assertEquals(530.0, Solutions.bestOf(solutions).getCost(), 50.0); assertEquals(5, Solutions.bestOf(solutions).getRoutes().size()); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/DeactivateTimeWindowsTest.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/DeactivateTimeWindowsTest.java index d3f631e5..d9e56d01 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/DeactivateTimeWindowsTest.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/DeactivateTimeWindowsTest.java @@ -18,6 +18,7 @@ package com.graphhopper.jsprit.core.algorithm; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; @@ -29,57 +30,27 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import java.util.Collection; public class DeactivateTimeWindowsTest { - @Test - public void activityTimesShouldIgnoreTimeWindows() { + VehicleRoutingProblem vrp; + + @Before + public void doBefore(){ Service service = Service.Builder.newInstance("s").setLocation(Location.newInstance(20, 0)) .setTimeWindow(TimeWindow.newInstance(40, 50)).build(); VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0, 0)).build(); - VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(service).addVehicle(vehicle).build(); - VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(vrp, "src/test/resources/algorithmConfig.xml"); - vraBuilder.addDefaultCostCalculators(); - VehicleRoutingAlgorithm vra = vraBuilder.build(); //this should ignore any constraints - vra.setMaxIterations(10); - Collection solutions = vra.searchSolutions(); + vrp = VehicleRoutingProblem.Builder.newInstance().addJob(service).addVehicle(vehicle).build(); - VehicleRoute route = Solutions.bestOf(solutions).getRoutes().iterator().next(); - Assert.assertEquals(20., route.getActivities().get(0).getEndTime(), 0.01); - } - - @Test - public void whenNotActivatingViaStateManager_activityTimesShouldConsiderTimeWindows() { - Service service = Service.Builder.newInstance("s").setLocation(Location.newInstance(20, 0)) - .setTimeWindow(TimeWindow.newInstance(40, 50)).build(); - VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0, 0)).build(); - VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(service).addVehicle(vehicle).build(); - VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(vrp, "src/test/resources/algorithmConfig.xml"); - vraBuilder.addDefaultCostCalculators(); - StateManager stateManager = new StateManager(vrp); - ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager); - vraBuilder.setStateAndConstraintManager(stateManager, constraintManager); - VehicleRoutingAlgorithm vra = vraBuilder.build(); //this should ignore any constraints - vra.setMaxIterations(10); - Collection solutions = vra.searchSolutions(); - - VehicleRoute route = Solutions.bestOf(solutions).getRoutes().iterator().next(); - Assert.assertEquals(20., route.getActivities().get(0).getEndTime(), 0.01); } @Test public void activityTimesShouldConsiderTimeWindows() { - Service service = Service.Builder.newInstance("s").setLocation(Location.newInstance(20, 0)) - .setTimeWindow(TimeWindow.newInstance(40, 50)).build(); - VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0, 0)).build(); - VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(service).addVehicle(vehicle).build(); - VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(vrp, "src/test/resources/algorithmConfig.xml"); - vraBuilder.addCoreConstraints(); - vraBuilder.addDefaultCostCalculators(); - VehicleRoutingAlgorithm vra = vraBuilder.build(); //this should ignore any constraints + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); //this should ignore any constraints vra.setMaxIterations(10); Collection solutions = vra.searchSolutions(); @@ -89,18 +60,13 @@ public class DeactivateTimeWindowsTest { @Test public void whenActivatingViaStateManager_activityTimesShouldConsiderTimeWindows() { - Service service = Service.Builder.newInstance("s").setLocation(Location.newInstance(20, 0)) - .setTimeWindow(TimeWindow.newInstance(40, 50)).build(); - VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0, 0)).build(); - VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(service).addVehicle(vehicle).build(); - VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(vrp, "src/test/resources/algorithmConfig.xml"); - vraBuilder.addDefaultCostCalculators(); StateManager stateManager = new StateManager(vrp); stateManager.updateTimeWindowStates(); ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager); constraintManager.addTimeWindowConstraint(); - vraBuilder.setStateAndConstraintManager(stateManager, constraintManager); - VehicleRoutingAlgorithm vra = vraBuilder.build(); //this should ignore any constraints + + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).addCoreStateAndConstraintStuff(true) + .setStateAndConstraintManager(stateManager,constraintManager).buildAlgorithm(); vra.setMaxIterations(10); Collection solutions = vra.searchSolutions(); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/ExternalInitialSolutionIsInValidTest.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/ExternalInitialSolutionIsInValidTest.java index 393517c3..a5b0f8c7 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/ExternalInitialSolutionIsInValidTest.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/ExternalInitialSolutionIsInValidTest.java @@ -1,6 +1,6 @@ package com.graphhopper.jsprit.core.algorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.job.Service; @@ -27,7 +27,7 @@ public class ExternalInitialSolutionIsInValidTest { VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(s1).addJob(s2).addVehicle(vehicle).build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithm_without_construction.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); /* create ini sol diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/InitialRoutesTest.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/InitialRoutesTest.java index 2c592271..1e864c91 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/InitialRoutesTest.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/InitialRoutesTest.java @@ -25,13 +25,11 @@ import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.algorithm.state.UpdateEndLocationIfRouteIsOpen; import com.graphhopper.jsprit.core.algorithm.state.UpdateVariableCosts; -import com.graphhopper.jsprit.core.problem.AbstractActivity; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; import com.graphhopper.jsprit.core.problem.constraint.ServiceLoadActivityLevelConstraint; import com.graphhopper.jsprit.core.problem.constraint.ServiceLoadRouteLevelConstraint; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.job.Job; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.job.Shipment; @@ -42,184 +40,56 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; -import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import org.junit.Before; import org.junit.Test; import java.util.Collection; -import java.util.List; import static org.junit.Assert.*; public class InitialRoutesTest { - @Test - public void whenReading_jobMapShouldOnlyContainJob2() { + private VehicleRoutingProblem vrp; - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); + private VehicleRoute initialRoute; - assertEquals(1, getNuServices(vrp)); - assertTrue(vrp.getJobs().containsKey("2")); + @Before + public void before(){ + VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); + VehicleImpl v = VehicleImpl.Builder.newInstance("veh1").setStartLocation(Location.newInstance(0,0)).setLatestArrival(48600).build(); + Service s1 = Service.Builder.newInstance("s1").setLocation(Location.newInstance(1000,0)).build(); + Service s2 = Service.Builder.newInstance("s2").setLocation(Location.newInstance(1000,1000)).build(); + builder.addVehicle(v).addJob(s1).addJob(s2); + initialRoute = VehicleRoute.Builder.newInstance(v).addService(s1).build(); + builder.addInitialVehicleRoute(initialRoute); + vrp = builder.build(); } - @Test - public void whenReadingProblem2_jobMapShouldContain_service2() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - assertEquals(1, getNuServices(vrp)); - assertTrue(vrp.getJobs().containsKey("2")); - } - - @Test - public void whenReading_jobMapShouldContain_shipment4() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - assertEquals(1, getNuShipments(vrp)); - assertTrue(vrp.getJobs().containsKey("4")); - } - - private int getNuShipments(VehicleRoutingProblem vrp) { - int nuShipments = 0; - for (Job job : vrp.getJobs().values()) { - if (job instanceof Shipment) nuShipments++; - } - return nuShipments; - } - - private int getNuServices(VehicleRoutingProblem vrp) { - int nuServices = 0; - for (Job job : vrp.getJobs().values()) { - if (job instanceof Service) nuServices++; - } - return nuServices; - } - - @Test - public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size()); - } - - @Test - public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2_v2() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size()); - } - - @Test - public void whenReading_thereShouldBeTwoActsAssociatedToShipment4() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - Job job = vrp.getJobs().get("4"); - List activities = vrp.getActivities(job); - - assertEquals(2, activities.size()); - } @Test public void whenSolving_nuJobsInSolutionShouldBe2() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); - assertEquals(2, solution.getRoutes().iterator().next().getTourActivities().getJobs().size()); } - @Test - public void whenSolvingProblem2_nuJobsInSolutionShouldBe4() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); - - int jobsInSolution = 0; - for (VehicleRoute r : solution.getRoutes()) { - jobsInSolution += r.getTourActivities().jobSize(); - } - assertEquals(4, jobsInSolution); - } - @Test public void whenSolving_nuActsShouldBe2() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); - assertEquals(2, solution.getRoutes().iterator().next().getActivities().size()); } - @Test - public void whenSolvingProblem2_nuActsShouldBe6() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - int nuActs = 0; - for (VehicleRoute r : solution.getRoutes()) { - nuActs += r.getActivities().size(); - } - assertEquals(6, nuActs); - } - @Test public void whenSolving_deliverService1_shouldBeInRoute() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); - - Job job = getInitialJob("1", vrp); + Job job = getInitialJob("s1", vrp); assertTrue(hasActivityIn(solution, "veh1", job)); } @@ -232,63 +102,6 @@ public class InitialRoutesTest { return null; } - @Test - public void whenSolvingWithJsprit_deliverService1_shouldBeInRoute() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes_3.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); - - Job job = getInitialJob("1", vrp); - assertTrue(hasActivityIn(solution, "veh1", job)); - } - - @Test - public void whenSolvingProblem2With_deliverServices_and_allShipmentActs_shouldBeInRoute() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - assertTrue(hasActivityIn(solution.getRoutes(), "1")); - assertTrue(hasActivityIn(solution.getRoutes(), "2")); - assertTrue(hasActivityIn(solution.getRoutes(), "3")); - assertTrue(hasActivityIn(solution.getRoutes(), "4")); - - assertTrue(hasActivityIn(solution, "veh1", getInitialJob("1", vrp))); - assertTrue(hasActivityIn(solution, "veh2", getInitialJob("3", vrp))); - } - - @Test - public void whenSolvingProblem2WithJsprit_deliverServices_and_allShipmentActs_shouldBeInRoute() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - - assertTrue(hasActivityIn(solution.getRoutes(), "1")); - assertTrue(hasActivityIn(solution.getRoutes(), "2")); - assertTrue(hasActivityIn(solution.getRoutes(), "3")); - assertTrue(hasActivityIn(solution.getRoutes(), "4")); - - assertTrue(hasActivityIn(solution, "veh1", getInitialJob("1", vrp))); - assertTrue(hasActivityIn(solution, "veh2", getInitialJob("3", vrp))); - } - private boolean hasActivityIn(Collection routes, String jobId) { boolean isInRoute = false; for (VehicleRoute route : routes) { @@ -326,16 +139,11 @@ public class InitialRoutesTest { @Test public void whenSolving_deliverService2_shouldBeInRoute() { - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - assertTrue(hasActivityIn(solution.getRoutes().iterator().next(), "2")); + assertTrue(hasActivityIn(solution.getRoutes().iterator().next(), "s2")); } @Test @@ -372,19 +180,6 @@ public class InitialRoutesTest { } - @Test - public void whenReadingProblemFromFile_maxCapacityShouldNotBeExceeded() { - 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.setMaxIterations(10); - - Collection solutions = vra.searchSolutions(); - - assertFalse(secondActIsPickup(solutions)); - - } - private boolean secondActIsPickup(Collection solutions) { VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); TourActivity secondAct = solution.getRoutes().iterator().next().getActivities().get(1); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java index 608aedde..5f1519fa 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/MeetTimeWindowConstraint_IT.java @@ -18,27 +18,30 @@ ******************************************************************************/ package com.graphhopper.jsprit.core.algorithm; -import com.graphhopper.jsprit.core.algorithm.box.GreedySchrimpfFactory; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; -import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.algorithm.recreate.listener.JobInsertedListener; import com.graphhopper.jsprit.core.algorithm.recreate.listener.VehicleSwitchedListener; +import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.job.Job; +import com.graphhopper.jsprit.core.problem.job.Service; +import com.graphhopper.jsprit.core.problem.job.Shipment; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; +import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.util.FastVehicleRoutingTransportCostsMatrix; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -48,26 +51,35 @@ import static org.junit.Assert.assertTrue; public class MeetTimeWindowConstraint_IT { + VehicleRoutingProblem vrp; + + @Before + public void doBefore(){ + VehicleType type1 = VehicleTypeImpl.Builder.newInstance("5").build(); + VehicleType type2 = VehicleTypeImpl.Builder.newInstance("3.5").build(); + VehicleImpl vehicle1 = VehicleImpl.Builder.newInstance("21").setStartLocation(Location.newInstance(0,0)) + .setEarliestStart(14400).setLatestArrival(46800).setType(type1).build(); + VehicleImpl vehicle2 = VehicleImpl.Builder.newInstance("19").setStartLocation(Location.newInstance(0,0)) + .setEarliestStart(39600).setLatestArrival(64800).setType(type2).build(); + Service service1 = Service.Builder.newInstance("2").setLocation(Location.newInstance(2000, 0)) + .setTimeWindow(TimeWindow.newInstance(54000,54000)).build(); + Service service2 = Service.Builder.newInstance("1").setLocation(Location.newInstance(1000, 1000)) + .setTimeWindow(TimeWindow.newInstance(19800,21600)).build(); + vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle1).addVehicle(vehicle2) + .addJob(service1).addJob(service2).setFleetSize(VehicleRoutingProblem.FleetSize.FINITE).build(); + } + @Test public void whenEmployingVehicleWithDifferentWorkingShifts_nRoutesShouldBeCorrect() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); - Assert.assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); } @Test public void whenEmployingVehicleWithDifferentWorkingShifts_certainJobsCanNeverBeAssignedToCertainVehicles() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new JobInsertedListener() { @@ -89,17 +101,12 @@ public class MeetTimeWindowConstraint_IT { }); @SuppressWarnings("unused") Collection solutions = vra.searchSolutions(); - assertTrue(testFailed.isEmpty()); } @Test public void whenEmployingVehicleWithDifferentWorkingShifts_certainVehiclesCanNeverBeAssignedToCertainRoutes() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new VehicleSwitchedListener() { @@ -133,11 +140,7 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_job2CanNeverBeInVehicle21() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); @@ -146,40 +149,24 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_job1ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); - -// assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); assertTrue(containsJob(vrp.getJobs().get("1"), getRoute("21", Solutions.bestOf(solutions)))); } @Test public void whenEmployingVehicleWithDifferentWorkingShifts_job2ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); - -// assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); assertTrue(containsJob(vrp.getJobs().get("2"), getRoute("19", Solutions.bestOf(solutions)))); } @Test public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_nRoutesShouldBeCorrect() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH,"false").buildAlgorithm(); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); @@ -188,11 +175,7 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_certainJobsCanNeverBeAssignedToCertainVehicles() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH,"false").buildAlgorithm(); vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new JobInsertedListener() { @@ -220,11 +203,7 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_certainVehiclesCanNeverBeAssignedToCertainRoutes() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH,"false").buildAlgorithm(); vra.setMaxIterations(100); final List testFailed = new ArrayList(); vra.addListener(new VehicleSwitchedListener() { @@ -258,11 +237,7 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_job2CanNeverBeInVehicle21() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH,"false").buildAlgorithm(); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); @@ -271,11 +246,7 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_job1ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH,"false").buildAlgorithm(); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); @@ -285,261 +256,7 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_job2ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml"); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - - assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); - assertTrue(containsJob(vrp.getJobs().get("2"), getRoute("19", Solutions.bestOf(solutions)))); - } - - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_nRoutesShouldBeCorrect() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - - assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_certainJobsCanNeverBeAssignedToCertainVehicles() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(100); - final List testFailed = new ArrayList(); - vra.addListener(new JobInsertedListener() { - - @Override - public void informJobInserted(Job job2insert, VehicleRoute inRoute, double additionalCosts, double additionalTime) { - if (job2insert.getId().equals("1")) { - if (inRoute.getVehicle().getId().equals("19")) { - testFailed.add(true); - } - } - if (job2insert.getId().equals("2")) { - if (inRoute.getVehicle().getId().equals("21")) { - testFailed.add(true); - } - } - } - - }); - @SuppressWarnings("unused") - Collection solutions = vra.searchSolutions(); - - assertTrue(testFailed.isEmpty()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_certainVehiclesCanNeverBeAssignedToCertainRoutes() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(100); - final List testFailed = new ArrayList(); - vra.addListener(new VehicleSwitchedListener() { - - @Override - public void vehicleSwitched(VehicleRoute vehicleRoute, Vehicle oldVehicle, Vehicle newVehicle) { - if (oldVehicle == null) return; - if (oldVehicle.getId().equals("21") && newVehicle.getId().equals("19")) { - for (Job j : vehicleRoute.getTourActivities().getJobs()) { - if (j.getId().equals("1")) { - testFailed.add(true); - } - } - } - if (oldVehicle.getId().equals("19") && newVehicle.getId().equals("21")) { - for (Job j : vehicleRoute.getTourActivities().getJobs()) { - if (j.getId().equals("2")) { - testFailed.add(true); - } - } - } - } - - }); - - - @SuppressWarnings("unused") - Collection solutions = vra.searchSolutions(); - assertTrue(testFailed.isEmpty()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_job2CanNeverBeInVehicle21() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - - assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_job1ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - -// assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); - assertTrue(containsJob(vrp.getJobs().get("1"), getRoute("21", Solutions.bestOf(solutions)))); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_job2ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - -// assertEquals(2,Solutions.bestOf(solutions).getRoutes().size()); - assertTrue(containsJob(vrp.getJobs().get("2"), getRoute("19", Solutions.bestOf(solutions)))); - } - - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_jsprit_and_vehicleSwitchIsNotAllowed_nRoutesShouldBeCorrect() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false").buildAlgorithm(); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - - assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_jsprit_certainJobsCanNeverBeAssignedToCertainVehicles() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false").buildAlgorithm(); - vra.setMaxIterations(100); - final List testFailed = new ArrayList(); - vra.addListener(new JobInsertedListener() { - - @Override - public void informJobInserted(Job job2insert, VehicleRoute inRoute, double additionalCosts, double additionalTime) { - if (job2insert.getId().equals("1")) { - if (inRoute.getVehicle().getId().equals("19")) { - testFailed.add(true); - } - } - if (job2insert.getId().equals("2")) { - if (inRoute.getVehicle().getId().equals("21")) { - testFailed.add(true); - } - } - } - - }); - @SuppressWarnings("unused") - Collection solutions = vra.searchSolutions(); - - assertTrue(testFailed.isEmpty()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_jsprit_certainVehiclesCanNeverBeAssignedToCertainRoutes() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false").buildAlgorithm(); - vra.setMaxIterations(100); - final List testFailed = new ArrayList(); - vra.addListener(new VehicleSwitchedListener() { - - @Override - public void vehicleSwitched(VehicleRoute vehicleRoute, Vehicle oldVehicle, Vehicle newVehicle) { - if (oldVehicle == null) return; - if (oldVehicle.getId().equals("21") && newVehicle.getId().equals("19")) { - for (Job j : vehicleRoute.getTourActivities().getJobs()) { - if (j.getId().equals("1")) { - testFailed.add(true); - } - } - } - if (oldVehicle.getId().equals("19") && newVehicle.getId().equals("21")) { - for (Job j : vehicleRoute.getTourActivities().getJobs()) { - if (j.getId().equals("2")) { - testFailed.add(true); - } - } - } - } - - }); - - - @SuppressWarnings("unused") - Collection solutions = vra.searchSolutions(); - assertTrue(testFailed.isEmpty()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_jsprit_job2CanNeverBeInVehicle21() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false").buildAlgorithm(); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - - assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_jsprit_job1ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false").buildAlgorithm(); - vra.setMaxIterations(100); - Collection solutions = vra.searchSolutions(); - - assertEquals(2, Solutions.bestOf(solutions).getRoutes().size()); - assertTrue(containsJob(vrp.getJobs().get("1"), getRoute("21", Solutions.bestOf(solutions)))); - } - - @Test - public void whenEmployingVehicleWithDifferentWorkingShifts_and_vehicleSwitchIsNotAllowed_jsprit_job2ShouldBeAssignedCorrectly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false").buildAlgorithm(); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.VEHICLE_SWITCH,"false").buildAlgorithm(); vra.setMaxIterations(100); Collection solutions = vra.searchSolutions(); @@ -549,12 +266,8 @@ public class MeetTimeWindowConstraint_IT { @Test public void whenUsingJsprit_driverTimesShouldBeMet() throws IOException { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/twbug.xml"); - final FastVehicleRoutingTransportCostsMatrix matrix = createMatrix(); - vrpBuilder.setRoutingCost(matrix); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm algorithm = Jsprit.Builder.newInstance(vrp).buildAlgorithm(); + VehicleRoutingProblem vrp = createTWBugProblem(); + VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(vrp); algorithm.setMaxIterations(1000); VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions()); for (VehicleRoute r : solution.getRoutes()) { @@ -563,41 +276,8 @@ public class MeetTimeWindowConstraint_IT { } } - @Test - public void whenUsingSchrimpf_driverTimesShouldBeMet() throws IOException { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/twbug.xml"); - final FastVehicleRoutingTransportCostsMatrix matrix = createMatrix(); - vrpBuilder.setRoutingCost(matrix); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm algorithm = new SchrimpfFactory().createAlgorithm(vrp); - algorithm.setMaxIterations(1000); - VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions()); - for (VehicleRoute r : solution.getRoutes()) { - assertTrue(r.getVehicle().getEarliestDeparture() <= r.getDepartureTime()); - assertTrue(r.getVehicle().getLatestArrival() >= r.getEnd().getArrTime()); - } - } - - @Test - public void whenUsingGreedySchrimpf_driverTimesShouldBeMet() throws IOException { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/twbug.xml"); - final FastVehicleRoutingTransportCostsMatrix matrix = createMatrix(); - vrpBuilder.setRoutingCost(matrix); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm algorithm = new GreedySchrimpfFactory().createAlgorithm(vrp); - algorithm.setMaxIterations(1000); - VehicleRoutingProblemSolution solution = Solutions.bestOf(algorithm.searchSolutions()); - for (VehicleRoute r : solution.getRoutes()) { - assertTrue(r.getVehicle().getEarliestDeparture() <= r.getDepartureTime()); - assertTrue(r.getVehicle().getLatestArrival() >= r.getEnd().getArrTime()); - } - } - - private FastVehicleRoutingTransportCostsMatrix createMatrix() throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/matrix.txt"))); + BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("matrix.txt"))); String line; FastVehicleRoutingTransportCostsMatrix.Builder builder = FastVehicleRoutingTransportCostsMatrix.Builder.newInstance(11, false); while ((line = reader.readLine()) != null) { @@ -628,4 +308,75 @@ public class MeetTimeWindowConstraint_IT { return null; } + private VehicleRoutingProblem createTWBugProblem() throws IOException { + VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0,20) + .setCostPerTransportTime(1.).setCostPerDistance(0).build(); + VehicleImpl v0 = VehicleImpl.Builder.newInstance("vehicle0").setStartLocation(Location.newInstance(0)) + .setEarliestStart(60).setLatestArrival(18060).setType(type).build(); + VehicleImpl v1 = VehicleImpl.Builder.newInstance("vehicle1").setStartLocation(Location.newInstance(0)) + .setEarliestStart(60).setLatestArrival(18060).setType(type).build(); + VehicleImpl v2 = VehicleImpl.Builder.newInstance("vehicle2").setStartLocation(Location.newInstance(0)) + .setEarliestStart(7200).setLatestArrival(36060).setType(type).build(); + VehicleImpl v3 = VehicleImpl.Builder.newInstance("vehicle3").setStartLocation(Location.newInstance(0)) + .setEarliestStart(36000).setLatestArrival(54060).setType(type).build(); + VehicleImpl v4 = VehicleImpl.Builder.newInstance("vehicle4").setStartLocation(Location.newInstance(0)) + .setEarliestStart(36000).setLatestArrival(54060).setType(type).build(); + + Service s1 = Service.Builder.newInstance("1").setLocation(Location.Builder.newInstance().setIndex(1).setId("js0").build()) + .setServiceTime(600).setTimeWindow(TimeWindow.newInstance(0,1800)).addSizeDimension(0,1).build(); + Service s2 = Service.Builder.newInstance("2").setLocation(Location.Builder.newInstance().setIndex(2).setId("js2").build()) + .setServiceTime(600).setTimeWindow(TimeWindow.newInstance(5400, 7200)).addSizeDimension(0, 2).build(); + Service s3 = Service.Builder.newInstance("3").setLocation(Location.Builder.newInstance().setIndex(3).setId("js5").build()) + .setServiceTime(1800).setTimeWindow(TimeWindow.newInstance(17100, 18000)).addSizeDimension(0, 10).build(); + Service s4 = Service.Builder.newInstance("4").setLocation(Location.Builder.newInstance().setIndex(4).setId("js4").build()) + .setServiceTime(900).addSizeDimension(0, 2).build(); + Service s5 = Service.Builder.newInstance("5").setLocation(Location.Builder.newInstance().setIndex(5).setId("js8").build()) + .setServiceTime(600).addSizeDimension(0, 4).build(); + Service s6 = Service.Builder.newInstance("6").setLocation(Location.Builder.newInstance().setIndex(6).setId("js10").build()) + .setServiceTime(1500).setTimeWindow(TimeWindow.newInstance(29700,32400)).addSizeDimension(0, 10).build(); + Service s7 = Service.Builder.newInstance("7").setLocation(Location.Builder.newInstance().setIndex(7).setId("jsp3").build()) + .setServiceTime(5594).build(); + + Shipment shipment1 = Shipment.Builder.newInstance("shipment1") + .setPickupServiceTime(900) + .setPickupLocation(Location.Builder.newInstance().setId("jsp1").setIndex(1).build()) + .setDeliveryLocation(Location.Builder.newInstance().setId("jsd1").setIndex(8).build()) + .setDeliveryServiceTime(900).build(); + + Shipment shipment2 = Shipment.Builder.newInstance("shipment2") + .setPickupLocation(Location.Builder.newInstance().setId("jsp4").setIndex(9).build()) + .setPickupServiceTime(1200) + .addPickupTimeWindow(21600,23400) + .setDeliveryLocation(Location.Builder.newInstance().setId("jsd4").setIndex(8).build()) + .setDeliveryServiceTime(900) + .addDeliveryTimeWindow(25200,27000) + .build(); + + Shipment shipment3 = Shipment.Builder.newInstance("shipment3") + .setPickupLocation(Location.Builder.newInstance().setId("jsp7").setIndex(9).build()) + .setPickupServiceTime(1200) + .addPickupTimeWindow(37800,41400) + .setDeliveryLocation(Location.Builder.newInstance().setId("jsd7").setIndex(8).build()) + .setDeliveryServiceTime(1800) + .addDeliveryTimeWindow(43200,45900) + .build(); + + Shipment shipment4 = Shipment.Builder.newInstance("shipment4") + .setPickupLocation(Location.Builder.newInstance().setId("jsp9").setIndex(10).build()) + .setPickupServiceTime(300) + .addPickupTimeWindow(45000,48600) + .setDeliveryLocation(Location.Builder.newInstance().setId("jsd9").setIndex(8).build()) + .setDeliveryServiceTime(300) + .addDeliveryTimeWindow(50400,52200) + .build(); + + FastVehicleRoutingTransportCostsMatrix matrix = createMatrix(); + return VehicleRoutingProblem.Builder.newInstance().setFleetSize(VehicleRoutingProblem.FleetSize.FINITE) + .addJob(s1).addJob(s2).addJob(s3).addJob(s4).addJob(s5).addJob(s6).addJob(s7) + .addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4) + .addVehicle(v0).addVehicle(v1).addVehicle(v2).addVehicle(v3).addVehicle(v4) + .setRoutingCost(matrix).build(); + + } + } diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/PickupsAndDeliveries_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/PickupsAndDeliveries_IT.java index e8fe1c65..7de4d17f 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/PickupsAndDeliveries_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/PickupsAndDeliveries_IT.java @@ -20,10 +20,9 @@ package com.graphhopper.jsprit.core.algorithm; import com.graphhopper.jsprit.core.IntegrationTest; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.LiLimReader; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -38,22 +37,9 @@ public class PickupsAndDeliveries_IT { @Category(IntegrationTest.class) public void whenSolvingLR101InstanceOfLiLim_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/lilim_lr101.xml"); + new LiLimReader(vrpBuilder).read(getClass().getResourceAsStream("lr101.txt")); VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/lilim_algorithmConfig.xml"); - Collection solutions = vra.searchSolutions(); - assertEquals(1650.8, Solutions.bestOf(solutions).getCost(), 80.); - assertEquals(19, Solutions.bestOf(solutions).getRoutes().size(), 1); - } - - @Test - @Category(IntegrationTest.class) - public void whenSolvingLR101InstanceOfLiLim_withJsprit_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/lilim_lr101.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); - vra.setMaxIterations(1000); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); Collection solutions = vra.searchSolutions(); assertEquals(1650.8, Solutions.bestOf(solutions).getCost(), 80.); assertEquals(19, Solutions.bestOf(solutions).getRoutes().size(), 1); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT.java index 4421f674..686de826 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT.java @@ -31,7 +31,10 @@ import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix; import org.junit.Test; import org.junit.experimental.categories.Category; -import java.io.*; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.Collection; import static org.junit.Assert.assertEquals; @@ -39,65 +42,6 @@ import static org.junit.Assert.assertEquals; public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT { - static class RelationKey { - - static RelationKey newKey(String from, String to) { - int fromInt = Integer.parseInt(from); - int toInt = Integer.parseInt(to); - if (fromInt < toInt) { - return new RelationKey(from, to); - } else { - return new RelationKey(to, from); - } - } - - final String from; - final String to; - - public RelationKey(String from, String to) { - super(); - this.from = from; - this.to = to; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((from == null) ? 0 : from.hashCode()); - result = prime * result + ((to == null) ? 0 : to.hashCode()); - return result; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RelationKey other = (RelationKey) obj; - if (from == null) { - if (other.from != null) - return false; - } else if (!from.equals(other.from)) - return false; - if (to == null) { - if (other.to != null) - return false; - } else if (!to.equals(other.to)) - return false; - return true; - } - } - @Test @Category(IntegrationTest.class) public void testAlgo() { @@ -152,8 +96,8 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT { } - private static void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws FileNotFoundException, IOException { - BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/refuseCollectionExample_Quantities"))); + private void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("refuseCollectionExample_Quantities"))); String line = null; boolean firstLine = true; while ((line = reader.readLine()) != null) { @@ -176,8 +120,8 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT { } - private static void readDistances(VehicleRoutingTransportCostsMatrix.Builder matrixBuilder) throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/refuseCollectionExample_Distances"))); + private void readDistances(VehicleRoutingTransportCostsMatrix.Builder matrixBuilder) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("refuseCollectionExample_Distances"))); String line = null; boolean firstLine = true; while ((line = reader.readLine()) != null) { diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndDistanceCosts_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndDistanceCosts_IT.java index 4fe337f2..c634e86c 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndDistanceCosts_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndDistanceCosts_IT.java @@ -33,7 +33,10 @@ import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix; import org.junit.Test; import org.junit.experimental.categories.Category; -import java.io.*; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.Collection; import static org.junit.Assert.assertEquals; @@ -41,65 +44,6 @@ import static org.junit.Assert.assertEquals; public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndDistanceCosts_IT { - static class RelationKey { - - static RelationKey newKey(String from, String to) { - int fromInt = Integer.parseInt(from); - int toInt = Integer.parseInt(to); - if (fromInt < toInt) { - return new RelationKey(from, to); - } else { - return new RelationKey(to, from); - } - } - - final String from; - final String to; - - public RelationKey(String from, String to) { - super(); - this.from = from; - this.to = to; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((from == null) ? 0 : from.hashCode()); - result = prime * result + ((to == null) ? 0 : to.hashCode()); - return result; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RelationKey other = (RelationKey) obj; - if (from == null) { - if (other.from != null) - return false; - } else if (!from.equals(other.from)) - return false; - if (to == null) { - if (other.to != null) - return false; - } else if (!to.equals(other.to)) - return false; - return true; - } - } - @Test @Category(IntegrationTest.class) public void testAlgo() { @@ -154,8 +98,8 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndD } - private static void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws FileNotFoundException, IOException { - BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/refuseCollectionExample_Quantities"))); + private void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("refuseCollectionExample_Quantities"))); String line = null; boolean firstLine = true; while ((line = reader.readLine()) != null) { @@ -178,8 +122,8 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndD } - private static void readDistances(VehicleRoutingTransportCostsMatrix.Builder matrixBuilder) throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/refuseCollectionExample_Distances"))); + private void readDistances(VehicleRoutingTransportCostsMatrix.Builder matrixBuilder) throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("refuseCollectionExample_Distances"))); String line = null; boolean firstLine = true; while ((line = reader.readLine()) != null) { diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollection_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollection_IT.java index 44ebe782..c6881044 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollection_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/RefuseCollection_IT.java @@ -35,7 +35,10 @@ import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; import java.util.Collection; @@ -223,8 +226,8 @@ public class RefuseCollection_IT { } - private static void readDemandQuantitiesAsServices(VehicleRoutingProblem.Builder vrpBuilder) { - BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Quantities"); + private void readDemandQuantitiesAsServices(VehicleRoutingProblem.Builder vrpBuilder) { + BufferedReader reader = getBufferedReader("refuseCollectionExample_Quantities"); String line; boolean firstLine = true; while ((line = readLine(reader)) != null) { @@ -246,18 +249,12 @@ public class RefuseCollection_IT { close(reader); } - private static BufferedReader getBufferedReader(String s) { - BufferedReader reader = null; - try { - reader = new BufferedReader(new FileReader(new File(s))); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return reader; + private BufferedReader getBufferedReader(String s) { + return new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(s))); } - private static void readDemandQuantitiesAsPickups(VehicleRoutingProblem.Builder vrpBuilder) { - BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Quantities"); + private void readDemandQuantitiesAsPickups(VehicleRoutingProblem.Builder vrpBuilder) { + BufferedReader reader = getBufferedReader("refuseCollectionExample_Quantities"); String line; boolean firstLine = true; while ((line = readLine(reader)) != null) { @@ -279,8 +276,8 @@ public class RefuseCollection_IT { close(reader); } - private static void readDemandQuantitiesAsDeliveries(VehicleRoutingProblem.Builder vrpBuilder) { - BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Quantities"); + private void readDemandQuantitiesAsDeliveries(VehicleRoutingProblem.Builder vrpBuilder) { + BufferedReader reader = getBufferedReader("refuseCollectionExample_Quantities"); String line; boolean firstLine = true; while ((line = readLine(reader)) != null) { @@ -321,8 +318,8 @@ public class RefuseCollection_IT { } - private static void readDistances(VehicleRoutingTransportCostsMatrix.Builder matrixBuilder) { - BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Distances"); + private void readDistances(VehicleRoutingTransportCostsMatrix.Builder matrixBuilder) { + BufferedReader reader = getBufferedReader("refuseCollectionExample_Distances"); String line; boolean firstLine = true; while ((line = readLine(reader)) != null) { diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SelectRandomlyTest.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SelectRandomlyTest.java deleted file mode 100644 index 63281794..00000000 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SelectRandomlyTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.graphhopper.jsprit.core.algorithm; - -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; -import org.junit.Test; - -import static org.junit.Assert.fail; - -public class SelectRandomlyTest { - - @Test - public void loadAnAlgorithmWithSelectRandomly() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - try { - VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig_selectRandomly.xml"); - } catch (Exception e) { - e.printStackTrace(); - fail("Should be able to load an algorithm that uses : " + e.getMessage()); - } - } -} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SolomonSkills_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SolomonSkills_IT.java index 5c914f31..e2fad632 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SolomonSkills_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/SolomonSkills_IT.java @@ -18,12 +18,9 @@ package com.graphhopper.jsprit.core.algorithm; import com.graphhopper.jsprit.core.IntegrationTest; -import com.graphhopper.jsprit.core.algorithm.recreate.NoSolutionFoundException; -import com.graphhopper.jsprit.core.algorithm.state.StateManager; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Skills; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.job.Job; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -31,6 +28,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; +import com.graphhopper.jsprit.core.util.SolomonReader; import com.graphhopper.jsprit.core.util.Solutions; import com.graphhopper.jsprit.core.util.TestUtils; import org.junit.Test; @@ -49,7 +47,7 @@ public class SolomonSkills_IT { @Category(IntegrationTest.class) public void itShouldMakeCorrectAssignmentAccordingToSkills() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/solomon_c101.xml"); + new SolomonReader(vrpBuilder).read(getClass().getResourceAsStream("C101.txt")); VehicleRoutingProblem vrp = vrpBuilder.build(); //y >= 50 skill1 otherwise skill2 @@ -80,36 +78,21 @@ public class SolomonSkills_IT { skillProblemBuilder.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE); VehicleRoutingProblem skillProblem = skillProblemBuilder.build(); - VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(skillProblem, "src/test/resources/algorithmConfig.xml"); - vraBuilder.addCoreConstraints(); - vraBuilder.addDefaultCostCalculators(); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(skillProblem).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); - StateManager stateManager = new StateManager(skillProblem); - stateManager.updateSkillStates(); - - ConstraintManager constraintManager = new ConstraintManager(skillProblem, stateManager); - constraintManager.addSkillsConstraint(); - - VehicleRoutingAlgorithm vra = vraBuilder.build(); - vra.setMaxIterations(2000); - - try { - Collection solutions = vra.searchSolutions(); - VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); - assertEquals(828.94, solution.getCost(), 0.01); - for (VehicleRoute route : solution.getRoutes()) { - Skills vehicleSkill = route.getVehicle().getSkills(); - for (Job job : route.getTourActivities().getJobs()) { - for (String skill : job.getRequiredSkills().values()) { - if (!vehicleSkill.containsSkill(skill)) { - assertFalse(true); - } + Collection solutions = vra.searchSolutions(); + VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); + assertEquals(828.94, solution.getCost(), 0.01); + for (VehicleRoute route : solution.getRoutes()) { + Skills vehicleSkill = route.getVehicle().getSkills(); + for (Job job : route.getTourActivities().getJobs()) { + for (String skill : job.getRequiredSkills().values()) { + if (!vehicleSkill.containsSkill(skill)) { + assertFalse(true); } } } - assertTrue(true); - } catch (NoSolutionFoundException e) { - assertFalse(true); } + assertTrue(true); } } diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/Solomon_IT.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/Solomon_IT.java index 5a211f7e..205ba807 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/Solomon_IT.java +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/Solomon_IT.java @@ -3,8 +3,8 @@ package com.graphhopper.jsprit.core.algorithm; import com.graphhopper.jsprit.core.IntegrationTest; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import com.graphhopper.jsprit.core.util.SolomonReader; import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Assert; import org.junit.Test; @@ -21,14 +21,10 @@ public class Solomon_IT { @Category(IntegrationTest.class) public void itShouldFindTheBestKnownSolution() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/solomon_c101.xml"); + new SolomonReader(vrpBuilder).read(getClass().getResourceAsStream("C101.txt")); VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp) -// .setProperty(Jsprit.Parameter.THREADS,"3") -// .setProperty(Jsprit.Parameter.FAST_REGRET,"true") - .buildAlgorithm(); -// VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); + VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp).setProperty(Jsprit.Parameter.FAST_REGRET,"true").buildAlgorithm(); vra.setMaxIterations(2000); Collection solutions = vra.searchSolutions(); Assert.assertEquals(828.94, Solutions.bestOf(solutions).getCost(), 0.01); diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/recreate/CalcWithTimeSchedulingTest.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/recreate/CalcWithTimeSchedulingTest.java deleted file mode 100644 index a6cd8141..00000000 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/recreate/CalcWithTimeSchedulingTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.recreate; - -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.problem.Location; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import com.graphhopper.jsprit.core.problem.cost.VehicleRoutingTransportCosts; -import com.graphhopper.jsprit.core.problem.driver.Driver; -import com.graphhopper.jsprit.core.problem.job.Service; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; -import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; -import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; -import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; -import com.graphhopper.jsprit.core.util.Coordinate; -import com.graphhopper.jsprit.core.util.CrowFlyCosts; -import com.graphhopper.jsprit.core.util.Solutions; -import com.graphhopper.jsprit.core.util.TestUtils; - -import java.util.Collection; - -import static org.junit.Assert.assertEquals; - - -public class CalcWithTimeSchedulingTest { - - - public void timeScheduler() { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - VehicleImpl vehicle = VehicleImpl.Builder.newInstance("myVehicle").setEarliestStart(0.0).setLatestArrival(100.0). - setStartLocation(TestUtils.loc("0,0", Coordinate.newInstance(0, 0))) - .setType(VehicleTypeImpl.Builder.newInstance("myType").addCapacityDimension(0, 20).setCostPerDistance(1.0).build()).build(); - vrpBuilder.addVehicle(vehicle); - vrpBuilder.addJob(Service.Builder.newInstance("myService").addSizeDimension(0, 2) - .setLocation(TestUtils.loc("0,20", Coordinate.newInstance(0, 20))).build()); - vrpBuilder.setFleetSize(FleetSize.INFINITE); - vrpBuilder.setRoutingCost(getTpCosts(new CrowFlyCosts(vrpBuilder.getLocations()))); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/testConfig.xml"); - Collection solutions = vra.searchSolutions(); - - VehicleRoutingProblemSolution sol = Solutions.bestOf(solutions); - assertEquals(40.0, sol.getCost(), 0.01); - assertEquals(1, sol.getRoutes().size()); - VehicleRoute route = sol.getRoutes().iterator().next(); - assertEquals(50.0, route.getStart().getEndTime(), 0.01); - } - - private VehicleRoutingTransportCosts getTpCosts(final VehicleRoutingTransportCosts baseCosts) { - return new VehicleRoutingTransportCosts() { - - @Override - public double getBackwardTransportCost(Location from, Location to, double arrivalTime, Driver driver, Vehicle vehicle) { - return getTransportCost(from, to, arrivalTime, driver, vehicle); - } - - @Override - public double getTransportCost(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) { - if (departureTime < 50) { - return baseCosts.getTransportCost(from, to, departureTime, driver, vehicle) * 2.0; - } - return baseCosts.getTransportCost(from, to, departureTime, driver, vehicle); - } - - @Override - public double getBackwardTransportTime(Location from, Location to, double arrivalTime, Driver driver, Vehicle vehicle) { - return getTransportTime(from, to, arrivalTime, driver, vehicle); - } - - @Override - public double getTransportTime(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) { - return getTransportCost(from, to, departureTime, driver, vehicle); - } - }; - } - -} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/recreate/TestDepartureTimeOpt.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/recreate/TestDepartureTimeOpt.java deleted file mode 100644 index 388b77f3..00000000 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/recreate/TestDepartureTimeOpt.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.recreate; - -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.problem.Location; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.cost.VehicleRoutingActivityCosts; -import com.graphhopper.jsprit.core.problem.driver.Driver; -import com.graphhopper.jsprit.core.problem.job.Service; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow; -import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; -import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; -import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; -import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; -import com.graphhopper.jsprit.core.util.Coordinate; -import com.graphhopper.jsprit.core.util.Solutions; -import com.graphhopper.jsprit.core.util.TestUtils; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.Collection; - -@Ignore -public class TestDepartureTimeOpt { - - @Test - public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_totalCostsShouldBe50() { - TimeWindow timeWindow = TimeWindow.newInstance(40, 45); - Service service = Service.Builder.newInstance("s").setLocation(TestUtils.loc("servLoc", Coordinate.newInstance(0, 10))).setTimeWindow(timeWindow).build(); - Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(TestUtils.loc("vehLoc", Coordinate.newInstance(0, 0))) - .setType(VehicleTypeImpl.Builder.newInstance("vType").build()).build(); - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - vrpBuilder.setActivityCosts(new VehicleRoutingActivityCosts() { - - @Override - public double getActivityCost(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - double waiting = Math.max(0, tourAct.getTheoreticalEarliestOperationStartTime() - arrivalTime) * 1; - double late = Math.max(0, arrivalTime - tourAct.getTheoreticalLatestOperationStartTime()) * 100; - return waiting + late; - } - - @Override - public double getActivityDuration(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - return tourAct.getOperationTime(); - } - - }); - VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); - Collection solutions = vra.searchSolutions(); - - Assert.assertEquals(20.0 + 30.0, Solutions.bestOf(solutions).getCost(), 0.1); - - } - - @Test - public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_depTimeShouldBe0() { - TimeWindow timeWindow = TimeWindow.newInstance(40, 45); - Service service = Service.Builder.newInstance("s") - .setLocation(TestUtils.loc("servLoc", Coordinate.newInstance(0, 10))).setTimeWindow(timeWindow).build(); - Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.Builder.newInstance().setId("vehLoc").setCoordinate(Coordinate.newInstance(0, 0)).build()) - .setType(VehicleTypeImpl.Builder.newInstance("vType").build()).build(); - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - vrpBuilder.setActivityCosts(new VehicleRoutingActivityCosts() { - - @Override - public double getActivityCost(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - double waiting = Math.max(0, tourAct.getTheoreticalEarliestOperationStartTime() - arrivalTime) * 1; - double late = Math.max(0, arrivalTime - tourAct.getTheoreticalLatestOperationStartTime()) * 100; - return waiting + late; - } - - @Override - public double getActivityDuration(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - return tourAct.getOperationTime(); - } - - }); - VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build(); - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml"); - Collection solutions = vra.searchSolutions(); - - Assert.assertEquals(0.0, Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(), 0.1); - - } - - @Test - public void whenSettingOneCustWithTWAndDepTimeChoice_totalCostsShouldBe50() { - TimeWindow timeWindow = TimeWindow.newInstance(40, 45); - Service service = Service.Builder.newInstance("s").setLocation(TestUtils.loc("servLoc", Coordinate.newInstance(0, 10))).setTimeWindow(timeWindow).build(); - Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(TestUtils.loc("vehLoc", Coordinate.newInstance(0, 0))) - .setType(VehicleTypeImpl.Builder.newInstance("vType").build()).build(); - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - vrpBuilder.setActivityCosts(new VehicleRoutingActivityCosts() { - - @Override - public double getActivityCost(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - double waiting = Math.max(0, tourAct.getTheoreticalEarliestOperationStartTime() - arrivalTime) * 1; - double late = Math.max(0, arrivalTime - tourAct.getTheoreticalLatestOperationStartTime()) * 100; - return waiting + late; - } - - @Override - public double getActivityDuration(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - return tourAct.getOperationTime(); - } - - }); - VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build(); - - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml"); - Collection solutions = vra.searchSolutions(); - - Assert.assertEquals(20.0, Solutions.bestOf(solutions).getCost(), 0.1); - - } - - @Test - public void whenSettingOneCustWithTWAndDepTimeChoice_depTimeShouldBe0() { - TimeWindow timeWindow = TimeWindow.newInstance(40, 45); - Service service = Service.Builder.newInstance("s").setLocation(TestUtils.loc("servLoc", Coordinate.newInstance(0, 10))).setTimeWindow(timeWindow).build(); - Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(TestUtils.loc("vehLoc", Coordinate.newInstance(0, 0))) - .setType(VehicleTypeImpl.Builder.newInstance("vType").build()).build(); - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - vrpBuilder.setActivityCosts(new VehicleRoutingActivityCosts() { - - @Override - public double getActivityCost(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - double waiting = Math.max(0, tourAct.getTheoreticalEarliestOperationStartTime() - arrivalTime) * 1; - double late = Math.max(0, arrivalTime - tourAct.getTheoreticalLatestOperationStartTime()) * 100; - return waiting + late; - } - - @Override - public double getActivityDuration(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - return tourAct.getOperationTime(); - } - - }); - VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build(); - - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml"); - Collection solutions = vra.searchSolutions(); - - Assert.assertEquals(30.0, Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(), 0.1); - - } - - @Test - public void whenSettingTwoCustWithTWAndDepTimeChoice_totalCostsShouldBe50() { - TimeWindow timeWindow = TimeWindow.newInstance(40, 45); - Service service = Service.Builder.newInstance("s").setLocation(TestUtils.loc("servLoc", Coordinate.newInstance(0, 10))).setTimeWindow(timeWindow).build(); - - Service service2 = Service.Builder.newInstance("s2").setLocation(TestUtils.loc("servLoc2", Coordinate.newInstance(0, 20))). - setTimeWindow(TimeWindow.newInstance(30, 40)).build(); - - Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(TestUtils.loc("vehLoc", Coordinate.newInstance(0, 0))) - .setType(VehicleTypeImpl.Builder.newInstance("vType").build()).build(); - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - vrpBuilder.setActivityCosts(new VehicleRoutingActivityCosts() { - - @Override - public double getActivityCost(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - double waiting = Math.max(0, tourAct.getTheoreticalEarliestOperationStartTime() - arrivalTime) * 1; - double late = Math.max(0, arrivalTime - tourAct.getTheoreticalLatestOperationStartTime()) * 100; - return waiting + late; - } - - @Override - public double getActivityDuration(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - return tourAct.getOperationTime(); - } - - }); - VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addJob(service2).addVehicle(vehicle).build(); - - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml"); - Collection solutions = vra.searchSolutions(); - - Assert.assertEquals(40.0, Solutions.bestOf(solutions).getCost(), 0.1); - - } - - @Test - public void whenSettingTwoCustWithTWAndDepTimeChoice_depTimeShouldBe10() { - TimeWindow timeWindow = TimeWindow.newInstance(40, 45); - Service service = Service.Builder.newInstance("s").setLocation(TestUtils.loc("servLoc", Coordinate.newInstance(0, 10))).setTimeWindow(timeWindow).build(); - - Service service2 = Service.Builder.newInstance("s2").setLocation(TestUtils.loc("servLoc2", Coordinate.newInstance(0, 20))). - setTimeWindow(TimeWindow.newInstance(30, 40)).build(); - - Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocation(TestUtils.loc("vehLoc", Coordinate.newInstance(0, 0))) - .setType(VehicleTypeImpl.Builder.newInstance("vType").build()).build(); - - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - vrpBuilder.setActivityCosts(new VehicleRoutingActivityCosts() { - - @Override - public double getActivityCost(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - double waiting = Math.max(0, tourAct.getTheoreticalEarliestOperationStartTime() - arrivalTime) * 1; - double late = Math.max(0, arrivalTime - tourAct.getTheoreticalLatestOperationStartTime()) * 100; - return waiting + late; - } - - @Override - public double getActivityDuration(TourActivity tourAct, double arrivalTime, Driver driver, Vehicle vehicle) { - return tourAct.getOperationTime(); - } - - }); - VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addJob(service2).addVehicle(vehicle).build(); - - - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml"); - Collection solutions = vra.searchSolutions(); - - Assert.assertEquals(10.0, Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(), 0.1); - - } - -} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/ChristofidesReader.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/ChristofidesReader.java new file mode 100644 index 00000000..7451f9ef --- /dev/null +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/ChristofidesReader.java @@ -0,0 +1,149 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + ******************************************************************************/ +package com.graphhopper.jsprit.core.util; + + +import com.graphhopper.jsprit.core.problem.Location; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; +import com.graphhopper.jsprit.core.problem.job.Delivery; +import com.graphhopper.jsprit.core.problem.job.Pickup; +import com.graphhopper.jsprit.core.problem.job.Service; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + + +/** + * Reader that reads Christophides, Mingozzi and Toth instances. + *

+ *

Files and file-description can be found here. + * + * @author stefan schroeder + */ +public class ChristofidesReader { + + private static Logger logger = LoggerFactory.getLogger(ChristofidesReader.class); + + private final VehicleRoutingProblem.Builder vrpBuilder; + + private double coordProjectionFactor = 1; + + private JobType jobType = JobType.SERVICE; + + /** + * Constructs the reader. + * + * @param vrpBuilder the builder + */ + public ChristofidesReader(VehicleRoutingProblem.Builder vrpBuilder) { + super(); + this.vrpBuilder = vrpBuilder; + } + + /** + * Reads instance-file and memorizes vehicles, customers and so forth in + * {@link com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.Builder}. + * + * @param inputStream + */ + public void read(InputStream inputStream) { + vrpBuilder.setFleetSize(FleetSize.INFINITE); + BufferedReader reader = getReader(inputStream); + int vehicleCapacity = 0; + double serviceTime = 0.0; + double endTime = Double.MAX_VALUE; + int counter = 0; + String line; + while ((line = readLine(reader)) != null) { + line = line.replace("\r", ""); + line = line.trim(); + String[] tokens = line.split(" "); + if (counter == 0) { + vehicleCapacity = Integer.parseInt(tokens[1].trim()); + endTime = Double.parseDouble(tokens[2].trim()); + serviceTime = Double.parseDouble(tokens[3].trim()); + } else if (counter == 1) { + Coordinate depotCoord = makeCoord(tokens[0].trim(), tokens[1].trim()); + VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance("christophidesType").addCapacityDimension(0, vehicleCapacity). + setCostPerDistance(1.0).build(); + VehicleImpl vehicle = VehicleImpl.Builder.newInstance("christophidesVehicle").setLatestArrival(endTime).setStartLocation(Location.newInstance(depotCoord.getX(), depotCoord.getY())). + setType(vehicleType).build(); + vrpBuilder.addVehicle(vehicle); + } else { + Coordinate customerCoord = makeCoord(tokens[0].trim(), tokens[1].trim()); + int demand = Integer.parseInt(tokens[2].trim()); + String customer = Integer.valueOf(counter - 1).toString(); + if(jobType.equals(JobType.SERVICE)) { + Service service = Service.Builder.newInstance(customer).addSizeDimension(0, demand).setServiceTime(serviceTime).setLocation(Location.newInstance(customerCoord.getX(), customerCoord.getY())).build(); + vrpBuilder.addJob(service); + } + else if(jobType.equals(JobType.DELIVERY)){ + Delivery service = Delivery.Builder.newInstance(customer).addSizeDimension(0, demand).setServiceTime(serviceTime).setLocation(Location.newInstance(customerCoord.getX(), customerCoord.getY())).build(); + vrpBuilder.addJob(service); + } + else if(jobType.equals(JobType.PICKUP)){ + Pickup service = Pickup.Builder.newInstance(customer).addSizeDimension(0, demand).setServiceTime(serviceTime).setLocation(Location.newInstance(customerCoord.getX(), customerCoord.getY())).build(); + vrpBuilder.addJob(service); + } + } + counter++; + } + close(reader); + } + + public void setCoordProjectionFactor(double coordProjectionFactor) { + this.coordProjectionFactor = coordProjectionFactor; + } + + private void close(BufferedReader reader) { + try { + reader.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private String readLine(BufferedReader reader) { + try { + return reader.readLine(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private Coordinate makeCoord(String xString, String yString) { + double x = Double.parseDouble(xString); + double y = Double.parseDouble(yString); + return new Coordinate(x * coordProjectionFactor, y * coordProjectionFactor); + } + + private BufferedReader getReader(InputStream inputStream) { + return new BufferedReader(new InputStreamReader(inputStream)); + } + + public ChristofidesReader setJobType(JobType jobType) { + this.jobType = jobType; + return this; + } +} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/JobType.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/JobType.java new file mode 100644 index 00000000..2302dd5b --- /dev/null +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/JobType.java @@ -0,0 +1,9 @@ +package com.graphhopper.jsprit.core.util; + +/** + * Created by schroeder on 27/07/16. + */ +public enum JobType { + + SERVICE, PICKUP, DELIVERY +} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/LiLimReader.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/LiLimReader.java new file mode 100644 index 00000000..8fc5bd77 --- /dev/null +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/LiLimReader.java @@ -0,0 +1,197 @@ +/******************************************************************************* + * Copyright (C) 2013 Stefan Schroeder + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + ******************************************************************************/ +package com.graphhopper.jsprit.core.util; + + +import com.graphhopper.jsprit.core.problem.Location; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.Builder; +import com.graphhopper.jsprit.core.problem.job.Shipment; +import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + + +/** + * test instances for the capacitated vrp with pickup and deliveries and time windows. + * instances are from li and lim and can be found at: + * http://www.top.sintef.no/vrp/benchmarks.html + * + * @author stefan schroeder + */ + + +public class LiLimReader { + + static class CustomerData { + public Coordinate coord; + public double start; + public double end; + public double serviceTime; + + public CustomerData(Coordinate coord, double start, double end, double serviceTime) { + super(); + this.coord = coord; + this.start = start; + this.end = end; + this.serviceTime = serviceTime; + } + } + + static class Relation { + public String from; + public String to; + public int demand; + + public Relation(String from, String to, int demand) { + super(); + this.from = from; + this.to = to; + this.demand = demand; + } + + } + + private static Logger logger = LoggerFactory.getLogger(LiLimReader.class); + + private Builder vrpBuilder; + + private int vehicleCapacity; + + private String depotId; + + private Map customers; + + private Collection relations; + + private double depotOpeningTime; + + private double depotClosingTime; + + private int fixCosts = 0; + + public LiLimReader(Builder vrpBuilder) { + customers = new HashMap(); + relations = new ArrayList(); + this.vrpBuilder = vrpBuilder; + } + + public LiLimReader(Builder builder, int fixCosts) { + customers = new HashMap(); + relations = new ArrayList(); + this.vrpBuilder = builder; + this.fixCosts = fixCosts; + } + + public void read(InputStream inputStream) { + readShipments(inputStream); + buildShipments(); + VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0, vehicleCapacity) + .setCostPerDistance(1.0).setFixedCost(fixCosts).build(); + VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle") + .setEarliestStart(depotOpeningTime).setLatestArrival(depotClosingTime) + .setStartLocation(Location.Builder.newInstance().setCoordinate(customers.get(depotId).coord).build()).setType(type).build(); + vrpBuilder.addVehicle(vehicle); + } + + private void buildShipments() { + Integer counter = 0; + for (Relation rel : relations) { + counter++; + String from = rel.from; + String to = rel.to; + int demand = rel.demand; + Shipment s = Shipment.Builder.newInstance(counter.toString()).addSizeDimension(0, demand) + .setPickupLocation(Location.Builder.newInstance().setCoordinate(customers.get(from).coord).build()).setPickupServiceTime(customers.get(from).serviceTime) + .setPickupTimeWindow(TimeWindow.newInstance(customers.get(from).start, customers.get(from).end)) + .setDeliveryLocation(Location.Builder.newInstance().setCoordinate(customers.get(to).coord).build()).setDeliveryServiceTime(customers.get(to).serviceTime) + .setDeliveryTimeWindow(TimeWindow.newInstance(customers.get(to).start, customers.get(to).end)).build(); + vrpBuilder.addJob(s); + } + + } + + private BufferedReader getReader(InputStream inputStream) { + return new BufferedReader(new InputStreamReader(inputStream)); + } + + private void readShipments(InputStream inputStream) { + BufferedReader reader = getReader(inputStream); + String line = null; + boolean firstLine = true; + try { + while ((line = reader.readLine()) != null) { + line = line.replace("\r", ""); + line = line.trim(); + String[] tokens = line.split("\t"); + if (firstLine) { + int vehicleCapacity = getInt(tokens[1]); + this.vehicleCapacity = vehicleCapacity; + firstLine = false; + continue; + } else { + String customerId = tokens[0]; + Coordinate coord = makeCoord(tokens[1], tokens[2]); + int demand = getInt(tokens[3]); + double startTimeWindow = getDouble(tokens[4]); + double endTimeWindow = getDouble(tokens[5]); + double serviceTime = getDouble(tokens[6]); +// vrpBuilder.addLocation(customerId, coord); + customers.put(customerId, new CustomerData(coord, startTimeWindow, endTimeWindow, serviceTime)); + if (customerId.equals("0")) { + depotId = customerId; + depotOpeningTime = startTimeWindow; + depotClosingTime = endTimeWindow; + } + if (demand > 0) { + relations.add(new Relation(customerId, tokens[8], demand)); + } + } + } + reader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + private Coordinate makeCoord(String xString, String yString) { + double x = Double.parseDouble(xString); + double y = Double.parseDouble(yString); + return new Coordinate(x, y); + } + + private double getDouble(String string) { + return Double.parseDouble(string); + } + + private int getInt(String string) { + return Integer.parseInt(string); + } + + +} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/SolomonReader.java b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/SolomonReader.java new file mode 100644 index 00000000..eea72007 --- /dev/null +++ b/jsprit-core/src/test/java/com/graphhopper/jsprit/core/util/SolomonReader.java @@ -0,0 +1,155 @@ +/******************************************************************************* + * Copyright (C) 2014 Stefan Schroeder + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + ******************************************************************************/ +package com.graphhopper.jsprit.core.util; + + +import com.graphhopper.jsprit.core.problem.Location; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; +import com.graphhopper.jsprit.core.problem.job.Service; +import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; +import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + + +/** + * Reader that reads the well-known solomon-instances. + *

+ *

See: neo.org + * + * @author stefan + */ + +public class SolomonReader { + + /** + * @param costProjectionFactor the costProjectionFactor to set + */ + public void setVariableCostProjectionFactor(double costProjectionFactor) { + this.variableCostProjectionFactor = costProjectionFactor; + } + + private static Logger logger = LoggerFactory.getLogger(SolomonReader.class); + + private final VehicleRoutingProblem.Builder vrpBuilder; + + private double coordProjectionFactor = 1; + + private double timeProjectionFactor = 1; + + private double variableCostProjectionFactor = 1; + + private double fixedCostPerVehicle = 0.0; + + public SolomonReader(VehicleRoutingProblem.Builder vrpBuilder) { + super(); + this.vrpBuilder = vrpBuilder; + } + + public SolomonReader(VehicleRoutingProblem.Builder vrpBuilder, double fixedCostPerVehicle) { + super(); + this.vrpBuilder = vrpBuilder; + this.fixedCostPerVehicle = fixedCostPerVehicle; + } + + public void read(InputStream inputStream) { + vrpBuilder.setFleetSize(FleetSize.INFINITE); + BufferedReader reader = getReader(inputStream); + int vehicleCapacity = 0; + + int counter = 0; + String line; + while ((line = readLine(reader)) != null) { + line = line.replace("\r", ""); + line = line.trim(); + String[] tokens = line.split(" +"); + counter++; + if (counter == 5) { + vehicleCapacity = Integer.parseInt(tokens[1]); + continue; + } + if (counter > 9) { + if (tokens.length < 7) continue; + Coordinate coord = makeCoord(tokens[1], tokens[2]); + String customerId = tokens[0]; + int demand = Integer.parseInt(tokens[3]); + double start = Double.parseDouble(tokens[4]) * timeProjectionFactor; + double end = Double.parseDouble(tokens[5]) * timeProjectionFactor; + double serviceTime = Double.parseDouble(tokens[6]) * timeProjectionFactor; + if (counter == 10) { + VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance("solomonType").addCapacityDimension(0, vehicleCapacity); + typeBuilder.setCostPerDistance(1.0 * variableCostProjectionFactor).setFixedCost(fixedCostPerVehicle); + VehicleTypeImpl vehicleType = typeBuilder.build(); + + VehicleImpl vehicle = VehicleImpl.Builder.newInstance("solomonVehicle").setEarliestStart(start).setLatestArrival(end) + .setStartLocation(Location.Builder.newInstance().setId(customerId) + .setCoordinate(coord).build()).setType(vehicleType).build(); + vrpBuilder.addVehicle(vehicle); + + } else { + Service service = Service.Builder.newInstance(customerId).addSizeDimension(0, demand) + .setLocation(Location.Builder.newInstance().setCoordinate(coord).setId(customerId).build()).setServiceTime(serviceTime) + .setTimeWindow(TimeWindow.newInstance(start, end)).build(); + vrpBuilder.addJob(service); + } + } + } + close(reader); + } + + public void setCoordProjectionFactor(double coordProjectionFactor) { + this.coordProjectionFactor = coordProjectionFactor; + } + + private void close(BufferedReader reader) { + try { + reader.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private String readLine(BufferedReader reader) { + try { + return reader.readLine(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private Coordinate makeCoord(String xString, String yString) { + double x = Double.parseDouble(xString); + double y = Double.parseDouble(yString); + return new Coordinate(x * coordProjectionFactor, y * coordProjectionFactor); + } + + private BufferedReader getReader(InputStream inputStream) { + return new BufferedReader(new InputStreamReader(inputStream)); + } + + public void setTimeProjectionFactor(double timeProjection) { + this.timeProjectionFactor = timeProjection; + + } +} diff --git a/jsprit-core/src/test/resources/C101_solomon_pd.xml b/jsprit-core/src/test/resources/C101_solomon_pd.xml deleted file mode 100644 index 72f3baa0..00000000 --- a/jsprit-core/src/test/resources/C101_solomon_pd.xml +++ /dev/null @@ -1,2536 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - solomonVehicle - solomonType - - 0 - - - - 0.0 - 1236.0 - - - - - - solomonType - 200 - - 0.0 - 1.0 - - - - - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=35.0] - - 90.0 - - - 283.0 - 344.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=45.0] - - 90.0 - - - 665.0 - 716.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=40.0] - - 90.0 - - - 87.0 - 158.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=45.0] - - 90.0 - - - 751.0 - 816.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=0.0][y=45.0] - - 90.0 - - - 567.0 - 624.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=2.0][y=40.0] - - 90.0 - - - 383.0 - 434.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=0.0][y=40.0] - - 90.0 - - - 479.0 - 522.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=33.0][y=35.0] - - 90.0 - - - 16.0 - 80.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=33.0][y=32.0] - - 90.0 - - - 68.0 - 149.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=32.0] - - 90.0 - - - 166.0 - 235.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=30.0] - - 90.0 - - - 264.0 - 321.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=52.0] - - 90.0 - - - 812.0 - 883.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=55.0] - - 90.0 - - - 732.0 - 777.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=50.0] - - 90.0 - - - 65.0 - 144.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=52.0] - - 90.0 - - - 169.0 - 224.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=55.0] - - 90.0 - - - 622.0 - 701.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=23.0][y=52.0] - - 90.0 - - - 261.0 - 316.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=23.0][y=55.0] - - 90.0 - - - 546.0 - 593.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=50.0] - - 90.0 - - - 358.0 - 405.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=66.0] - - 90.0 - - - 65.0 - 146.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=70.0] - - 90.0 - - - 825.0 - 870.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=68.0] - - 90.0 - - - 912.0 - 967.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=55.0] - - 90.0 - - - 449.0 - 504.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=66.0] - - 90.0 - - - 170.0 - 225.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=69.0] - - 90.0 - - - 621.0 - 702.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=65.0] - - 90.0 - - - 15.0 - 67.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=40.0] - - 90.0 - - - 31.0 - 100.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=68.0] - - 90.0 - - - 727.0 - 782.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=35.0] - - 90.0 - - - 200.0 - 237.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=70.0] - - 90.0 - - - 534.0 - 605.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=68.0] - - 90.0 - - - 255.0 - 324.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=80.0] - - 90.0 - - - 278.0 - 345.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=18.0][y=75.0] - - 90.0 - - - 99.0 - 148.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=75.0] - - 90.0 - - - 179.0 - 254.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=80.0] - - 90.0 - - - 384.0 - 429.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=85.0] - - 90.0 - - - 475.0 - 528.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=22.0][y=75.0] - - 90.0 - - - 30.0 - 92.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=22.0][y=85.0] - - 90.0 - - - 567.0 - 620.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=69.0] - - 90.0 - - - 448.0 - 505.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=85.0] - - 90.0 - - - 652.0 - 721.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=52.0] - - 90.0 - - - 914.0 - 965.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=50.0] - - 90.0 - - - 10.0 - 73.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=80.0] - - 90.0 - - - 743.0 - 820.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=85.0] - - 90.0 - - - 647.0 - 726.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=75.0] - - 90.0 - - - 30.0 - 84.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=85.0] - - 90.0 - - - 561.0 - 622.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=80.0] - - 90.0 - - - 95.0 - 156.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=80.0] - - 90.0 - - - 196.0 - 239.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=82.0] - - 90.0 - - - 285.0 - 336.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=85.0] - - 90.0 - - - 475.0 - 518.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=67.0][y=85.0] - - 90.0 - - - 368.0 - 441.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=60.0] - - 90.0 - - - 836.0 - 889.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=55.0] - - 90.0 - - - 20.0 - 84.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=66.0] - - 90.0 - - - 357.0 - 410.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=60.0] - - 90.0 - - - 645.0 - 708.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=58.0] - - 90.0 - - - 737.0 - 802.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=87.0][y=30.0] - - 90.0 - - - 668.0 - 731.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=88.0][y=35.0] - - 90.0 - - - 109.0 - 170.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=88.0][y=30.0] - - 90.0 - - - 574.0 - 643.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=75.0][y=55.0] - - 90.0 - - - 369.0 - 420.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=72.0][y=55.0] - - 90.0 - - - 265.0 - 338.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=85.0][y=25.0] - - 90.0 - - - 769.0 - 820.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=85.0][y=35.0] - - 90.0 - - - 47.0 - 124.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=66.0][y=55.0] - - 90.0 - - - 173.0 - 238.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=55.0] - - 90.0 - - - 85.0 - 144.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=70.0][y=58.0] - - 90.0 - - - 458.0 - 523.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=68.0][y=60.0] - - 90.0 - - - 555.0 - 612.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=47.0][y=40.0] - - 90.0 - - - 12.0 - 77.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=47.0][y=35.0] - - 90.0 - - - 826.0 - 875.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=35.0] - - 90.0 - - - 916.0 - 969.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=30.0] - - 90.0 - - - 734.0 - 777.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=95.0][y=30.0] - - 90.0 - - - 387.0 - 456.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=95.0][y=35.0] - - 90.0 - - - 293.0 - 360.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=30.0] - - 90.0 - - - 450.0 - 505.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=92.0][y=30.0] - - 90.0 - - - 478.0 - 551.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=35.0] - - 90.0 - - - 353.0 - 412.0 - - - - 50 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=65.0] - - 90.0 - - - 997.0 - 1068.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=90.0][y=35.0] - - 90.0 - - - 203.0 - 260.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=15.0] - - 90.0 - - - 651.0 - 740.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=5.0] - - 90.0 - - - 471.0 - 534.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=15.0] - - 90.0 - - - 35.0 - 87.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=5.0] - - 90.0 - - - 385.0 - 436.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=15.0] - - 90.0 - - - 95.0 - 158.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=30.0] - - 90.0 - - - 632.0 - 693.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=40.0] - - 90.0 - - - 76.0 - 129.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=35.0] - - 90.0 - - - 262.0 - 317.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=40.0] - - 90.0 - - - 171.0 - 218.0 - - - - 50 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=5.0] - - 90.0 - - - 562.0 - 629.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=30.0] - - 90.0 - - - 531.0 - 610.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=35.0] - - 90.0 - - - 1001.0 - 1066.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=30.0] - - 90.0 - - - 632.0 - 693.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=30.0] - - 90.0 - - - 541.0 - 600.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=30.0] - - 90.0 - - - 359.0 - 412.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=35.0] - - 90.0 - - - 1054.0 - 1127.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=32.0] - - 90.0 - - - 448.0 - 509.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=30.0] - - 90.0 - - - 725.0 - 786.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=35.0] - - 90.0 - - - 912.0 - 969.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=44.0][y=5.0] - - 90.0 - - - 286.0 - 347.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=10.0] - - 90.0 - - - 186.0 - 257.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=26.0][y=32.0] - - 90.0 - - - 815.0 - 880.0 - - - - 10 - - - diff --git a/jsprit-core/src/test/resources/algorithmConfigWithDepartureTimeChoice.xml b/jsprit-core/src/test/resources/algorithmConfigWithDepartureTimeChoice.xml deleted file mode 100755 index 52321845..00000000 --- a/jsprit-core/src/test/resources/algorithmConfigWithDepartureTimeChoice.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - 2000 - - - - - - - 1 - - - - - - - - 0.5 - - - - - - 0.4 - - - - - - - - - 0.3 - - - - - - 0.4 - - - - - - - - - 0.1 - - - - - - - - 0.2 - - - - - - diff --git a/jsprit-core/src/test/resources/algorithmConfig_greedyWithRegret.xml b/jsprit-core/src/test/resources/algorithmConfig_greedyWithRegret.xml deleted file mode 100755 index 01433171..00000000 --- a/jsprit-core/src/test/resources/algorithmConfig_greedyWithRegret.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - 2000 - - - - - - - - - 1 - - - - - - - - - 0.5 - - - - - 0.5 - - - - - - - - - 0.3 - - - - - 0.5 - - - - - - diff --git a/jsprit-core/src/test/resources/algorithmConfig_greedyWithRegret_v2.xml b/jsprit-core/src/test/resources/algorithmConfig_greedyWithRegret_v2.xml deleted file mode 100755 index 43566fac..00000000 --- a/jsprit-core/src/test/resources/algorithmConfig_greedyWithRegret_v2.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - 2000 - - - - - - - - - 1 - - - - - - - - - 0.5 - - - - - 0.5 - - - - - - - - - 0.3 - - - - - 0.5 - - - - - - diff --git a/jsprit-core/src/test/resources/algorithmConfig_selectRandomly.xml b/jsprit-core/src/test/resources/algorithmConfig_selectRandomly.xml deleted file mode 100755 index a0747716..00000000 --- a/jsprit-core/src/test/resources/algorithmConfig_selectRandomly.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 2000 - - - - - - - - 1 - - - - - - - - - 0.5 - - - - - 1 - - - - - - diff --git a/jsprit-core/src/test/resources/algorithm_without_construction.xml b/jsprit-core/src/test/resources/algorithm_without_construction.xml deleted file mode 100755 index 6f431864..00000000 --- a/jsprit-core/src/test/resources/algorithm_without_construction.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - 2000 - - - 1 - - - - - - - - 0.5 - - - - - - 0.5 - - - - - - - - - 0.3 - - - - - - 0.5 - - - - - - diff --git a/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/C101.txt b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/C101.txt new file mode 100644 index 00000000..ed6b1d7f --- /dev/null +++ b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/C101.txt @@ -0,0 +1,110 @@ +C101 + +VEHICLE +NUMBER CAPACITY + 25 200 + +CUSTOMER +CUST NO. XCOORD. YCOORD. DEMAND READY TIME DUE DATE SERVICE TIME + + 0 40 50 0 0 1236 0 + 1 45 68 10 912 967 90 + 2 45 70 30 825 870 90 + 3 42 66 10 65 146 90 + 4 42 68 10 727 782 90 + 5 42 65 10 15 67 90 + 6 40 69 20 621 702 90 + 7 40 66 20 170 225 90 + 8 38 68 20 255 324 90 + 9 38 70 10 534 605 90 + 10 35 66 10 357 410 90 + 11 35 69 10 448 505 90 + 12 25 85 20 652 721 90 + 13 22 75 30 30 92 90 + 14 22 85 10 567 620 90 + 15 20 80 40 384 429 90 + 16 20 85 40 475 528 90 + 17 18 75 20 99 148 90 + 18 15 75 20 179 254 90 + 19 15 80 10 278 345 90 + 20 30 50 10 10 73 90 + 21 30 52 20 914 965 90 + 22 28 52 20 812 883 90 + 23 28 55 10 732 777 90 + 24 25 50 10 65 144 90 + 25 25 52 40 169 224 90 + 26 25 55 10 622 701 90 + 27 23 52 10 261 316 90 + 28 23 55 20 546 593 90 + 29 20 50 10 358 405 90 + 30 20 55 10 449 504 90 + 31 10 35 20 200 237 90 + 32 10 40 30 31 100 90 + 33 8 40 40 87 158 90 + 34 8 45 20 751 816 90 + 35 5 35 10 283 344 90 + 36 5 45 10 665 716 90 + 37 2 40 20 383 434 90 + 38 0 40 30 479 522 90 + 39 0 45 20 567 624 90 + 40 35 30 10 264 321 90 + 41 35 32 10 166 235 90 + 42 33 32 20 68 149 90 + 43 33 35 10 16 80 90 + 44 32 30 10 359 412 90 + 45 30 30 10 541 600 90 + 46 30 32 30 448 509 90 + 47 30 35 10 1054 1127 90 + 48 28 30 10 632 693 90 + 49 28 35 10 1001 1066 90 + 50 26 32 10 815 880 90 + 51 25 30 10 725 786 90 + 52 25 35 10 912 969 90 + 53 44 5 20 286 347 90 + 54 42 10 40 186 257 90 + 55 42 15 10 95 158 90 + 56 40 5 30 385 436 90 + 57 40 15 40 35 87 90 + 58 38 5 30 471 534 90 + 59 38 15 10 651 740 90 + 60 35 5 20 562 629 90 + 61 50 30 10 531 610 90 + 62 50 35 20 262 317 90 + 63 50 40 50 171 218 90 + 64 48 30 10 632 693 90 + 65 48 40 10 76 129 90 + 66 47 35 10 826 875 90 + 67 47 40 10 12 77 90 + 68 45 30 10 734 777 90 + 69 45 35 10 916 969 90 + 70 95 30 30 387 456 90 + 71 95 35 20 293 360 90 + 72 53 30 10 450 505 90 + 73 92 30 10 478 551 90 + 74 53 35 50 353 412 90 + 75 45 65 20 997 1068 90 + 76 90 35 10 203 260 90 + 77 88 30 10 574 643 90 + 78 88 35 20 109 170 90 + 79 87 30 10 668 731 90 + 80 85 25 10 769 820 90 + 81 85 35 30 47 124 90 + 82 75 55 20 369 420 90 + 83 72 55 10 265 338 90 + 84 70 58 20 458 523 90 + 85 68 60 30 555 612 90 + 86 66 55 10 173 238 90 + 87 65 55 20 85 144 90 + 88 65 60 30 645 708 90 + 89 63 58 10 737 802 90 + 90 60 55 10 20 84 90 + 91 60 60 10 836 889 90 + 92 67 85 20 368 441 90 + 93 65 85 40 475 518 90 + 94 65 82 10 285 336 90 + 95 62 80 30 196 239 90 + 96 60 80 10 95 156 90 + 97 60 85 30 561 622 90 + 98 58 75 20 30 84 90 + 99 55 80 10 743 820 90 + 100 55 85 20 647 726 90 diff --git a/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/lr101.txt b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/lr101.txt new file mode 100644 index 00000000..3966ae37 --- /dev/null +++ b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/lr101.txt @@ -0,0 +1,108 @@ +25 200 1 +0 35 35 0 0 230 0 0 0 +1 41 49 -25 161 171 10 66 0 +2 35 17 7 50 60 10 0 73 +3 55 45 -6 116 126 10 69 0 +4 55 20 -6 149 159 10 56 0 +5 15 30 26 34 44 10 0 85 +6 25 30 -9 99 109 10 52 0 +7 20 50 -9 81 91 10 88 0 +8 10 43 9 95 105 10 0 17 +9 55 60 -21 97 107 10 30 0 +10 30 60 -27 124 134 10 31 0 +11 20 65 12 67 77 10 0 20 +12 50 35 -16 63 73 10 28 0 +13 30 25 -7 159 169 10 43 0 +14 15 10 20 32 42 10 0 38 +15 30 5 8 61 71 10 0 97 +16 10 20 19 75 85 10 0 91 +17 5 30 -9 157 167 10 8 0 +18 20 40 12 87 97 10 0 89 +19 15 60 -5 76 86 10 36 0 +20 45 65 -12 126 136 10 11 0 +21 45 20 11 62 72 10 0 41 +22 45 10 -18 97 107 10 75 0 +23 55 5 29 68 78 0 0 104 +24 65 35 3 153 163 10 0 80 +25 65 20 -2 172 182 10 55 0 +26 45 30 -9 132 142 10 40 0 +27 35 40 16 37 47 10 0 79 +28 41 37 16 39 49 10 0 12 +29 64 42 9 63 73 10 0 78 +30 40 60 21 71 81 10 0 9 +31 31 52 27 50 60 10 0 10 +32 35 69 -3 141 151 10 90 0 +33 53 52 11 37 47 10 0 34 +34 65 55 -11 117 127 10 33 0 +35 63 65 8 143 153 10 0 77 +36 2 60 5 41 51 10 0 19 +37 20 20 -11 134 144 10 83 0 +38 5 5 -20 83 93 10 14 0 +39 60 12 31 44 54 10 0 67 +40 40 25 9 85 95 10 0 26 +41 42 7 -11 97 107 10 21 0 +42 24 12 5 31 41 10 0 87 +43 23 3 7 132 142 10 0 13 +44 11 14 18 69 79 0 0 105 +45 6 38 16 32 42 10 0 84 +46 2 48 -27 117 127 10 47 0 +47 8 56 27 51 61 10 0 46 +48 13 52 -9 165 175 10 64 0 +49 6 68 -10 108 118 10 63 0 +50 47 47 -15 124 134 10 71 0 +51 49 58 10 88 98 0 0 101 +52 27 43 9 52 62 10 0 6 +53 37 31 14 95 105 0 0 106 +54 57 29 -13 140 150 10 76 0 +55 63 23 2 136 146 10 0 25 +56 53 12 6 130 140 10 0 4 +57 32 12 -2 101 111 10 92 0 +58 36 26 -25 200 210 10 72 0 +59 21 24 28 18 28 10 0 96 +60 17 34 -16 162 172 10 82 0 +61 12 24 13 76 86 10 0 93 +62 24 58 19 58 68 10 0 70 +63 27 69 10 34 44 10 0 49 +64 15 77 9 73 83 10 0 48 +65 62 77 20 51 61 10 0 81 +66 49 73 25 127 137 10 0 1 +67 67 5 -31 83 93 10 39 0 +68 56 39 36 142 152 0 0 103 +69 37 47 6 50 60 10 0 3 +70 37 56 -19 182 192 10 62 0 +71 57 68 15 77 87 10 0 50 +72 47 16 25 35 45 10 0 58 +73 44 17 -7 78 88 10 2 0 +74 46 13 8 149 159 0 0 102 +75 49 11 18 69 79 10 0 22 +76 49 42 13 73 83 10 0 54 +77 53 43 -8 179 189 10 35 0 +78 61 52 -9 96 106 10 29 0 +79 57 48 -16 92 102 10 27 0 +80 56 37 -3 182 192 10 24 0 +81 55 54 -20 94 104 10 65 0 +82 15 47 16 55 65 10 0 60 +83 14 37 11 44 54 10 0 37 +84 11 31 -16 101 111 10 45 0 +85 16 22 -26 91 101 10 5 0 +86 4 18 -10 94 104 10 98 0 +87 28 18 -5 93 103 10 42 0 +88 26 52 9 74 84 10 0 7 +89 26 35 -12 176 186 10 18 0 +90 31 67 3 95 105 10 0 32 +91 15 19 -19 160 170 10 16 0 +92 22 22 2 18 28 10 0 57 +93 18 24 -13 188 198 10 61 0 +94 26 27 -9 100 110 10 99 0 +95 25 24 20 39 49 10 0 100 +96 22 27 -28 135 145 10 59 0 +97 25 21 -8 133 143 10 15 0 +98 19 21 10 58 68 10 0 86 +99 20 26 9 83 93 10 0 94 +100 18 18 -20 185 195 10 95 0 +101 49 58 -10 88 98 10 51 0 +102 46 13 -8 149 159 10 74 0 +103 56 39 -36 142 152 10 68 0 +104 55 5 -29 68 78 10 23 0 +105 11 14 -18 69 79 10 44 0 +106 37 31 -14 95 105 10 53 0 diff --git a/jsprit-core/src/test/resources/matrix.txt b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/matrix.txt similarity index 100% rename from jsprit-core/src/test/resources/matrix.txt rename to jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/matrix.txt diff --git a/jsprit-core/src/test/resources/refuseCollectionExample_Distances b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/refuseCollectionExample_Distances similarity index 100% rename from jsprit-core/src/test/resources/refuseCollectionExample_Distances rename to jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/refuseCollectionExample_Distances diff --git a/jsprit-core/src/test/resources/refuseCollectionExample_Quantities b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/refuseCollectionExample_Quantities similarity index 100% rename from jsprit-core/src/test/resources/refuseCollectionExample_Quantities rename to jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/refuseCollectionExample_Quantities diff --git a/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/vrpnc1.txt b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/vrpnc1.txt new file mode 100644 index 00000000..92297dc3 --- /dev/null +++ b/jsprit-core/src/test/resources/com/graphhopper/jsprit/core/algorithm/vrpnc1.txt @@ -0,0 +1,52 @@ + 50 160 999999 0 + 30 40 + 37 52 7 + 49 49 30 + 52 64 16 + 20 26 9 + 40 30 21 + 21 47 15 + 17 63 19 + 31 62 23 + 52 33 11 + 51 21 5 + 42 41 19 + 31 32 29 + 5 25 23 + 12 42 21 + 36 16 10 + 52 41 15 + 27 23 3 + 17 33 41 + 13 13 9 + 57 58 28 + 62 42 8 + 42 57 8 + 16 57 16 + 8 52 10 + 7 38 28 + 27 68 7 + 30 48 15 + 43 67 14 + 58 48 6 + 58 27 19 + 37 69 11 + 38 46 12 + 46 10 23 + 61 33 26 + 62 63 17 + 63 69 6 + 32 22 9 + 45 35 15 + 59 15 14 + 5 6 7 + 10 17 27 + 21 10 13 + 5 64 11 + 30 15 16 + 39 10 10 + 32 39 5 + 25 32 25 + 25 55 17 + 48 28 18 + 56 37 10 diff --git a/jsprit-core/src/test/resources/configWithRegretInsertion.xml b/jsprit-core/src/test/resources/configWithRegretInsertion.xml deleted file mode 100755 index 67b98c11..00000000 --- a/jsprit-core/src/test/resources/configWithRegretInsertion.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - 10 - - - - - - - - 1 - - - - - - - - 0.5 - - - - - 0.4 - - - - - - - - - 0.1 - - - - - 0.4 - - - - - - - - - 0.3 - - - - - 0.2 - - - - - - - - - - - - - - - - - diff --git a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml b/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml deleted file mode 100644 index a5ed56bf..00000000 --- a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml +++ /dev/null @@ -1,261 +0,0 @@ - - - - FINITE - - - - v1 - vehType - - depotLoc2 - - - - depotLoc2 - - - - 0.0 - 1000.0 - - true - - - v2 - vehType2 - - depotLoc - - - - depotLoc - - - - 0.0 - 1000.0 - - false - - - v3 - vehType2 - - startLoc - - - - endLoc - - - - 0.0 - 1000.0 - - true - - - v4 - vehType2 - - startLoc - - - - endLoc - - - - 0.0 - 1000.0 - - true - - - v5 - vehType3 - - startLoc - - - - endLoc - - - - 0.0 - 1000.0 - - true - - - - - vehType - - 20 - - - 0.0 - 0.0 - - 0.0 - 0.0 - - - - vehType2 - - 200 - - - 0.0 - 0.0 - - 0.0 - 0.0 - - - - vehType3 - - 100 - 1000 - 10000 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 100000 - - - 0.0 - 0.0 - - 0.0 - 0.0 - - - - - - - j(1,5) - - - - 1 - - 10.0 - - - 0.0 - 4000.0 - - - - - - i(3,9) - - - - 1 - - 0.0 - - - 0.0 - 4000.0 - - - - - - - - - i(3,9) - - - 10.0 - - - 1000.0 - 4000.0 - - - - - - i(9,9) - - - 100.0 - - - 6000.0 - 10000.0 - - - - - 10 - - - - - - [x=10.0][y=10.0] - - - 0.0 - - - 1000.0 - 4000.0 - - - - - - [x=10.0][y=0.0] - - - 100.0 - - - 6000.0 - 10000.0 - - - - - 10 - - - - - - noDriver - v1 - 10.0 - - 4 - 0.0 - 0.0 - - - 4 - 0.0 - 0.0 - - 0.0 - - - diff --git a/jsprit-core/src/test/resources/finiteVrpWithSolutionForReaderTest.xml b/jsprit-core/src/test/resources/finiteVrpWithSolutionForReaderTest.xml deleted file mode 100644 index ccb99096..00000000 --- a/jsprit-core/src/test/resources/finiteVrpWithSolutionForReaderTest.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - - - FINITE - HETEROGENEOUS - - - - - v1 - - depotLoc2 - - - vehType - - 0.0 - 1000.0 - - - - v2 - - depotLoc - - - false - vehType2 - - 0.0 - 1000.0 - - - - v3 - - startLoc - - - - endLoc - - - vehType2 - - 0.0 - 1000.0 - - - - v4 - - startLoc - - - - endLoc - - - vehType2 - - 0.0 - 1000.0 - - - - v5 - - startLoc - - - - endLoc - - - vehType3 - - 0.0 - 1000.0 - - - - - - vehType - - 20 - - - 0.0 - 0.0 - - - - - vehType2 - 200 - - 0.0 - 0.0 - - - - - vehType3 - - 100 - 1000 - 10000 - 100000 - - - 0.0 - 0.0 - - - - - - - - j(1,5) - - - 1 - - 10.0 - - - 0.0 - 4000.0 - - - - - - i(3,9) - - 1 - 0.0 - - - 0.0 - 4000.0 - - - - - - - - - - i(3,9) - - 10.0 - - - 1000.0 - 4000.0 - - - - - i(9,9) - - 100.0 - - - 6000.0 - 10000.0 - - - - 10 - - - - - - - - 1000.0 - 4000.0 - - - - - - 100.0 - - - 6000.0 - 10000.0 - - - - - 10 - - - - - diff --git a/jsprit-core/src/test/resources/infiniteWriterV2Test.xml b/jsprit-core/src/test/resources/infiniteWriterV2Test.xml deleted file mode 100644 index b34bf776..00000000 --- a/jsprit-core/src/test/resources/infiniteWriterV2Test.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - FINITE - - - - v1 - vehType - - loc - - - loc - - - 0.0 - 1.7976931348623157E308 - - true - - - v2 - vehType2 - - loc - - - loc - - - 0.0 - 1.7976931348623157E308 - - true - - - - - vehType - - 20 - - - 0.0 - 1.0 - - 0.0 - 0.0 - - - - vehType2 - - 200 - - - 0.0 - 1.0 - - 0.0 - 0.0 - - - - diff --git a/jsprit-core/src/test/resources/lilim_algorithmConfig.xml b/jsprit-core/src/test/resources/lilim_algorithmConfig.xml deleted file mode 100644 index 1fb6ba15..00000000 --- a/jsprit-core/src/test/resources/lilim_algorithmConfig.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - 2000 - - - - - - - - 1 - - - - - 0.1 - 20 - - - - - 0.4 - - - - - - 0.5 - - - - - - - - - - 0.3 - - - - - - .5 - - - - - - - diff --git a/jsprit-core/src/test/resources/lilim_lr101.xml b/jsprit-core/src/test/resources/lilim_lr101.xml deleted file mode 100644 index f389a4d4..00000000 --- a/jsprit-core/src/test/resources/lilim_lr101.xml +++ /dev/null @@ -1,1474 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - vehicle - type - - [x=35.0][y=35.0] - - - - [x=35.0][y=35.0] - - - - 0.0 - 230.0 - - true - - - - - type - - 200 - - - 0.0 - 1.0 - - - - - - - - [x=27.0][y=69.0] - - 10.0 - - - 34.0 - 44.0 - - - - - [x=6.0][y=68.0] - - 10.0 - - - 108.0 - 118.0 - - - - - 10 - - - - - [x=15.0][y=77.0] - - 10.0 - - - 73.0 - 83.0 - - - - - [x=13.0][y=52.0] - - 10.0 - - - 165.0 - 175.0 - - - - - 9 - - - - - [x=12.0][y=24.0] - - 10.0 - - - 76.0 - 86.0 - - - - - [x=18.0][y=24.0] - - 10.0 - - - 188.0 - 198.0 - - - - - 13 - - - - - [x=24.0][y=58.0] - - 10.0 - - - 58.0 - 68.0 - - - - - [x=37.0][y=56.0] - - 10.0 - - - 182.0 - 192.0 - - - - - 19 - - - - - [x=56.0][y=39.0] - - 0.0 - - - 142.0 - 152.0 - - - - - [x=56.0][y=39.0] - - 10.0 - - - 142.0 - 152.0 - - - - - 36 - - - - - [x=62.0][y=77.0] - - 10.0 - - - 51.0 - 61.0 - - - - - [x=55.0][y=54.0] - - 10.0 - - - 94.0 - 104.0 - - - - - 20 - - - - - [x=49.0][y=73.0] - - 10.0 - - - 127.0 - 137.0 - - - - - [x=41.0][y=49.0] - - 10.0 - - - 161.0 - 171.0 - - - - - 25 - - - - - [x=46.0][y=13.0] - - 0.0 - - - 149.0 - 159.0 - - - - - [x=46.0][y=13.0] - - 10.0 - - - 149.0 - 159.0 - - - - - 8 - - - - - [x=47.0][y=16.0] - - 10.0 - - - 35.0 - 45.0 - - - - - [x=36.0][y=26.0] - - 10.0 - - - 200.0 - 210.0 - - - - - 25 - - - - - [x=57.0][y=68.0] - - 10.0 - - - 77.0 - 87.0 - - - - - [x=47.0][y=47.0] - - 10.0 - - - 124.0 - 134.0 - - - - - 15 - - - - - [x=37.0][y=47.0] - - 10.0 - - - 50.0 - 60.0 - - - - - [x=55.0][y=45.0] - - 10.0 - - - 116.0 - 126.0 - - - - - 6 - - - - - [x=24.0][y=12.0] - - 10.0 - - - 31.0 - 41.0 - - - - - [x=28.0][y=18.0] - - 10.0 - - - 93.0 - 103.0 - - - - - 5 - - - - - [x=23.0][y=3.0] - - 10.0 - - - 132.0 - 142.0 - - - - - [x=30.0][y=25.0] - - 10.0 - - - 159.0 - 169.0 - - - - - 7 - - - - - [x=11.0][y=14.0] - - 0.0 - - - 69.0 - 79.0 - - - - - [x=11.0][y=14.0] - - 10.0 - - - 69.0 - 79.0 - - - - - 18 - - - - - [x=6.0][y=38.0] - - 10.0 - - - 32.0 - 42.0 - - - - - [x=11.0][y=31.0] - - 10.0 - - - 101.0 - 111.0 - - - - - 16 - - - - - [x=8.0][y=56.0] - - 10.0 - - - 51.0 - 61.0 - - - - - [x=2.0][y=48.0] - - 10.0 - - - 117.0 - 127.0 - - - - - 27 - - - - - [x=49.0][y=58.0] - - 0.0 - - - 88.0 - 98.0 - - - - - [x=49.0][y=58.0] - - 10.0 - - - 88.0 - 98.0 - - - - - 10 - - - - - [x=27.0][y=43.0] - - 10.0 - - - 52.0 - 62.0 - - - - - [x=25.0][y=30.0] - - 10.0 - - - 99.0 - 109.0 - - - - - 9 - - - - - [x=37.0][y=31.0] - - 0.0 - - - 95.0 - 105.0 - - - - - [x=37.0][y=31.0] - - 10.0 - - - 95.0 - 105.0 - - - - - 14 - - - - - [x=10.0][y=43.0] - - 10.0 - - - 95.0 - 105.0 - - - - - [x=5.0][y=30.0] - - 10.0 - - - 157.0 - 167.0 - - - - - 9 - - - - - [x=15.0][y=30.0] - - 10.0 - - - 34.0 - 44.0 - - - - - [x=16.0][y=22.0] - - 10.0 - - - 91.0 - 101.0 - - - - - 26 - - - - - [x=35.0][y=17.0] - - 10.0 - - - 50.0 - 60.0 - - - - - [x=44.0][y=17.0] - - 10.0 - - - 78.0 - 88.0 - - - - - 7 - - - - - [x=63.0][y=23.0] - - 10.0 - - - 136.0 - 146.0 - - - - - [x=65.0][y=20.0] - - 10.0 - - - 172.0 - 182.0 - - - - - 2 - - - - - [x=10.0][y=20.0] - - 10.0 - - - 75.0 - 85.0 - - - - - [x=15.0][y=19.0] - - 10.0 - - - 160.0 - 170.0 - - - - - 19 - - - - - [x=30.0][y=5.0] - - 10.0 - - - 61.0 - 71.0 - - - - - [x=25.0][y=21.0] - - 10.0 - - - 133.0 - 143.0 - - - - - 8 - - - - - [x=15.0][y=10.0] - - 10.0 - - - 32.0 - 42.0 - - - - - [x=5.0][y=5.0] - - 10.0 - - - 83.0 - 93.0 - - - - - 20 - - - - - [x=21.0][y=24.0] - - 10.0 - - - 18.0 - 28.0 - - - - - [x=22.0][y=27.0] - - 10.0 - - - 135.0 - 145.0 - - - - - 28 - - - - - [x=20.0][y=65.0] - - 10.0 - - - 67.0 - 77.0 - - - - - [x=45.0][y=65.0] - - 10.0 - - - 126.0 - 136.0 - - - - - 12 - - - - - [x=53.0][y=12.0] - - 10.0 - - - 130.0 - 140.0 - - - - - [x=55.0][y=20.0] - - 10.0 - - - 149.0 - 159.0 - - - - - 6 - - - - - [x=45.0][y=20.0] - - 10.0 - - - 62.0 - 72.0 - - - - - [x=42.0][y=7.0] - - 10.0 - - - 97.0 - 107.0 - - - - - 11 - - - - - [x=20.0][y=40.0] - - 10.0 - - - 87.0 - 97.0 - - - - - [x=26.0][y=35.0] - - 10.0 - - - 176.0 - 186.0 - - - - - 12 - - - - - [x=2.0][y=60.0] - - 10.0 - - - 41.0 - 51.0 - - - - - [x=15.0][y=60.0] - - 10.0 - - - 76.0 - 86.0 - - - - - 5 - - - - - [x=53.0][y=52.0] - - 10.0 - - - 37.0 - 47.0 - - - - - [x=65.0][y=55.0] - - 10.0 - - - 117.0 - 127.0 - - - - - 11 - - - - - [x=63.0][y=65.0] - - 10.0 - - - 143.0 - 153.0 - - - - - [x=53.0][y=43.0] - - 10.0 - - - 179.0 - 189.0 - - - - - 8 - - - - - [x=40.0][y=60.0] - - 10.0 - - - 71.0 - 81.0 - - - - - [x=55.0][y=60.0] - - 10.0 - - - 97.0 - 107.0 - - - - - 21 - - - - - [x=31.0][y=52.0] - - 10.0 - - - 50.0 - 60.0 - - - - - [x=30.0][y=60.0] - - 10.0 - - - 124.0 - 134.0 - - - - - 27 - - - - - [x=41.0][y=37.0] - - 10.0 - - - 39.0 - 49.0 - - - - - [x=50.0][y=35.0] - - 10.0 - - - 63.0 - 73.0 - - - - - 16 - - - - - [x=64.0][y=42.0] - - 10.0 - - - 63.0 - 73.0 - - - - - [x=61.0][y=52.0] - - 10.0 - - - 96.0 - 106.0 - - - - - 9 - - - - - [x=65.0][y=35.0] - - 10.0 - - - 153.0 - 163.0 - - - - - [x=56.0][y=37.0] - - 10.0 - - - 182.0 - 192.0 - - - - - 3 - - - - - [x=35.0][y=40.0] - - 10.0 - - - 37.0 - 47.0 - - - - - [x=57.0][y=48.0] - - 10.0 - - - 92.0 - 102.0 - - - - - 16 - - - - - [x=40.0][y=25.0] - - 10.0 - - - 85.0 - 95.0 - - - - - [x=45.0][y=30.0] - - 10.0 - - - 132.0 - 142.0 - - - - - 9 - - - - - [x=60.0][y=12.0] - - 10.0 - - - 44.0 - 54.0 - - - - - [x=67.0][y=5.0] - - 10.0 - - - 83.0 - 93.0 - - - - - 31 - - - - - [x=31.0][y=67.0] - - 10.0 - - - 95.0 - 105.0 - - - - - [x=35.0][y=69.0] - - 10.0 - - - 141.0 - 151.0 - - - - - 3 - - - - - [x=26.0][y=52.0] - - 10.0 - - - 74.0 - 84.0 - - - - - [x=20.0][y=50.0] - - 10.0 - - - 81.0 - 91.0 - - - - - 9 - - - - - [x=49.0][y=42.0] - - 10.0 - - - 73.0 - 83.0 - - - - - [x=57.0][y=29.0] - - 10.0 - - - 140.0 - 150.0 - - - - - 13 - - - - - [x=49.0][y=11.0] - - 10.0 - - - 69.0 - 79.0 - - - - - [x=45.0][y=10.0] - - 10.0 - - - 97.0 - 107.0 - - - - - 18 - - - - - [x=14.0][y=37.0] - - 10.0 - - - 44.0 - 54.0 - - - - - [x=20.0][y=20.0] - - 10.0 - - - 134.0 - 144.0 - - - - - 11 - - - - - [x=15.0][y=47.0] - - 10.0 - - - 55.0 - 65.0 - - - - - [x=17.0][y=34.0] - - 10.0 - - - 162.0 - 172.0 - - - - - 16 - - - - - [x=55.0][y=5.0] - - 0.0 - - - 68.0 - 78.0 - - - - - [x=55.0][y=5.0] - - 10.0 - - - 68.0 - 78.0 - - - - - 29 - - - - - [x=25.0][y=24.0] - - 10.0 - - - 39.0 - 49.0 - - - - - [x=18.0][y=18.0] - - 10.0 - - - 185.0 - 195.0 - - - - - 20 - - - - - [x=19.0][y=21.0] - - 10.0 - - - 58.0 - 68.0 - - - - - [x=4.0][y=18.0] - - 10.0 - - - 94.0 - 104.0 - - - - - 10 - - - - - [x=20.0][y=26.0] - - 10.0 - - - 83.0 - 93.0 - - - - - [x=26.0][y=27.0] - - 10.0 - - - 100.0 - 110.0 - - - - - 9 - - - - - [x=22.0][y=22.0] - - 10.0 - - - 18.0 - 28.0 - - - - - [x=32.0][y=12.0] - - 10.0 - - - 101.0 - 111.0 - - - - - 2 - - - - diff --git a/jsprit-core/src/test/resources/pdVRP_vrpnc1_jsprit.xml b/jsprit-core/src/test/resources/pdVRP_vrpnc1_jsprit.xml deleted file mode 100644 index 1f2cb0aa..00000000 --- a/jsprit-core/src/test/resources/pdVRP_vrpnc1_jsprit.xml +++ /dev/null @@ -1,636 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - christophidesVehicle - christophidesType - - [x=30.0][y=40.0] - - - - 0.0 - 999999.0 - - - - - - christophidesType - 50 - - 0.0 - 1.0 - - - - - - - [x=62.0][y=63.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=69.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=46.0][y=10.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=61.0][y=33.0] - - 26 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=59.0][y=15.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=22.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=35.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=64.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=10.0] - - 13 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=17.0] - - 27 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=6.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=57.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=16.0][y=57.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=52.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=7.0][y=38.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=68.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=48.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=43.0][y=67.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=48.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=64.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=49.0] - - 30 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=52.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=63.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=27.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=47.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=30.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=46.0] - - 12 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=26.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=69.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=33.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=62.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=13.0][y=13.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=23.0] - - 3 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=33.0] - - 41 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=36.0][y=16.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=41.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=25.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=12.0][y=42.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=41.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=32.0] - - 29 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=42.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=58.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=28.0] - - 18 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=55.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=39.0][y=10.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=15.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=32.0] - - 25 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=39.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=51.0][y=21.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=37.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - diff --git a/jsprit-core/src/test/resources/pd_solomon_c101_sol.xml b/jsprit-core/src/test/resources/pd_solomon_c101_sol.xml deleted file mode 100644 index 0548472e..00000000 --- a/jsprit-core/src/test/resources/pd_solomon_c101_sol.xml +++ /dev/null @@ -1,3613 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - solomonVehicle - solomonType - - 0 - - - - 0.0 - 1236.0 - - - - - - solomonType - 200 - - 0.0 - 1.0 - - - - - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=35.0] - - 0.0 - - - 283.0 - 344.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=45.0] - - 0.0 - - - 665.0 - 716.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=40.0] - - 0.0 - - - 87.0 - 158.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=45.0] - - 0.0 - - - 751.0 - 816.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=0.0][y=45.0] - - 0.0 - - - 567.0 - 624.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=2.0][y=40.0] - - 0.0 - - - 383.0 - 434.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=0.0][y=40.0] - - 0.0 - - - 479.0 - 522.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=33.0][y=35.0] - - 0.0 - - - 16.0 - 80.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=33.0][y=32.0] - - 0.0 - - - 68.0 - 149.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=32.0] - - 0.0 - - - 166.0 - 235.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=30.0] - - 0.0 - - - 264.0 - 321.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=52.0] - - 0.0 - - - 812.0 - 883.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=55.0] - - 0.0 - - - 732.0 - 777.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=50.0] - - 0.0 - - - 65.0 - 144.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=52.0] - - 0.0 - - - 169.0 - 224.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=55.0] - - 0.0 - - - 622.0 - 701.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=23.0][y=52.0] - - 0.0 - - - 261.0 - 316.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=23.0][y=55.0] - - 0.0 - - - 546.0 - 593.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=50.0] - - 0.0 - - - 358.0 - 405.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=66.0] - - 0.0 - - - 65.0 - 146.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=70.0] - - 0.0 - - - 825.0 - 870.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=68.0] - - 0.0 - - - 912.0 - 967.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=55.0] - - 0.0 - - - 449.0 - 504.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=66.0] - - 0.0 - - - 170.0 - 225.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=69.0] - - 0.0 - - - 621.0 - 702.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=40.0] - - 0.0 - - - 31.0 - 100.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=65.0] - - 0.0 - - - 15.0 - 67.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=35.0] - - 0.0 - - - 200.0 - 237.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=68.0] - - 0.0 - - - 727.0 - 782.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=70.0] - - 0.0 - - - 534.0 - 605.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=68.0] - - 0.0 - - - 255.0 - 324.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=80.0] - - 0.0 - - - 278.0 - 345.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=18.0][y=75.0] - - 0.0 - - - 99.0 - 148.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=75.0] - - 0.0 - - - 179.0 - 254.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=80.0] - - 0.0 - - - 384.0 - 429.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=85.0] - - 0.0 - - - 475.0 - 528.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=22.0][y=75.0] - - 0.0 - - - 30.0 - 92.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=22.0][y=85.0] - - 0.0 - - - 567.0 - 620.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=69.0] - - 0.0 - - - 448.0 - 505.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=85.0] - - 0.0 - - - 652.0 - 721.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=52.0] - - 0.0 - - - 914.0 - 965.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=50.0] - - 0.0 - - - 10.0 - 73.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=80.0] - - 0.0 - - - 743.0 - 820.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=85.0] - - 0.0 - - - 647.0 - 726.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=75.0] - - 0.0 - - - 30.0 - 84.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=85.0] - - 0.0 - - - 561.0 - 622.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=80.0] - - 0.0 - - - 95.0 - 156.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=80.0] - - 0.0 - - - 196.0 - 239.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=82.0] - - 0.0 - - - 285.0 - 336.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=85.0] - - 0.0 - - - 475.0 - 518.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=67.0][y=85.0] - - 0.0 - - - 368.0 - 441.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=60.0] - - 0.0 - - - 836.0 - 889.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=55.0] - - 0.0 - - - 20.0 - 84.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=66.0] - - 0.0 - - - 357.0 - 410.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=60.0] - - 0.0 - - - 645.0 - 708.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=58.0] - - 0.0 - - - 737.0 - 802.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=87.0][y=30.0] - - 0.0 - - - 668.0 - 731.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=88.0][y=35.0] - - 0.0 - - - 109.0 - 170.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=88.0][y=30.0] - - 0.0 - - - 574.0 - 643.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=75.0][y=55.0] - - 0.0 - - - 369.0 - 420.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=72.0][y=55.0] - - 0.0 - - - 265.0 - 338.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=85.0][y=25.0] - - 0.0 - - - 769.0 - 820.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=85.0][y=35.0] - - 0.0 - - - 47.0 - 124.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=66.0][y=55.0] - - 0.0 - - - 173.0 - 238.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=55.0] - - 0.0 - - - 85.0 - 144.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=70.0][y=58.0] - - 0.0 - - - 458.0 - 523.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=68.0][y=60.0] - - 0.0 - - - 555.0 - 612.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=47.0][y=40.0] - - 0.0 - - - 12.0 - 77.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=47.0][y=35.0] - - 0.0 - - - 826.0 - 875.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=35.0] - - 0.0 - - - 916.0 - 969.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=30.0] - - 0.0 - - - 734.0 - 777.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=95.0][y=30.0] - - 0.0 - - - 387.0 - 456.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=95.0][y=35.0] - - 0.0 - - - 293.0 - 360.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=30.0] - - 0.0 - - - 450.0 - 505.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=92.0][y=30.0] - - 0.0 - - - 478.0 - 551.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=35.0] - - 0.0 - - - 353.0 - 412.0 - - - - 50 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=65.0] - - 0.0 - - - 997.0 - 1068.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=90.0][y=35.0] - - 0.0 - - - 203.0 - 260.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=15.0] - - 0.0 - - - 651.0 - 740.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=5.0] - - 0.0 - - - 471.0 - 534.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=15.0] - - 0.0 - - - 35.0 - 87.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=5.0] - - 0.0 - - - 385.0 - 436.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=15.0] - - 0.0 - - - 95.0 - 158.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=30.0] - - 0.0 - - - 632.0 - 693.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=40.0] - - 0.0 - - - 76.0 - 129.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=35.0] - - 0.0 - - - 262.0 - 317.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=40.0] - - 0.0 - - - 171.0 - 218.0 - - - - 50 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=5.0] - - 0.0 - - - 562.0 - 629.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=30.0] - - 0.0 - - - 531.0 - 610.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=35.0] - - 0.0 - - - 1001.0 - 1066.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=30.0] - - 0.0 - - - 632.0 - 693.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=30.0] - - 0.0 - - - 541.0 - 600.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=30.0] - - 0.0 - - - 359.0 - 412.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=35.0] - - 0.0 - - - 1054.0 - 1127.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=32.0] - - 0.0 - - - 448.0 - 509.0 - - - - 30 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=30.0] - - 0.0 - - - 725.0 - 786.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=35.0] - - 0.0 - - - 912.0 - 969.0 - - - - 10 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=44.0][y=5.0] - - 0.0 - - - 286.0 - 347.0 - - - - 20 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=10.0] - - 0.0 - - - 186.0 - 257.0 - - - - 40 - - - - [x=40.0][y=50.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=26.0][y=32.0] - - 0.0 - - - 815.0 - 880.0 - - - - 10 - - - - - 931.4150471075089 - - - 84.4406775617744 - noDriver - solomonVehicle - 0.0 - - 29 - 0.0 - 0.0 - - - 20 - 0.0 - 0.0 - - - 30 - 0.0 - 0.0 - - - 32 - 0.0 - 0.0 - - - 26 - 0.0 - 0.0 - - - 28 - 0.0 - 0.0 - - - 24 - 0.0 - 0.0 - - - 23 - 0.0 - 0.0 - - - 33 - 0.0 - 0.0 - - - 31 - 0.0 - 0.0 - - - 20 - 10.0 - 10.0 - - - 24 - 15.0 - 65.0 - - - 32 - 83.02775637731995 - 83.02775637731995 - - - 33 - 85.02775637731995 - 87.0 - - - 31 - 92.3851648071345 - 200.0 - - - 29 - 218.02775637731995 - 358.0 - - - 30 - 363.0 - 449.0 - - - 28 - 452.0 - 546.0 - - - 26 - 548.0 - 622.0 - - - 23 - 625.0 - 732.0 - - 745.0 - - - 95.88470913081827 - noDriver - solomonVehicle - 0.0 - - 15 - 0.0 - 0.0 - - - 12 - 0.0 - 0.0 - - - 18 - 0.0 - 0.0 - - - 14 - 0.0 - 0.0 - - - 13 - 0.0 - 0.0 - - - 16 - 0.0 - 0.0 - - - 19 - 0.0 - 0.0 - - - 17 - 0.0 - 0.0 - - - 13 - 30.805843601498726 - 30.805843601498726 - - - 17 - 34.80584360149872 - 99.0 - - - 18 - 102.0 - 179.0 - - - 19 - 184.0 - 278.0 - - - 15 - 283.0 - 384.0 - - - 16 - 389.0 - 475.0 - - - 14 - 477.0 - 567.0 - - - 12 - 570.0 - 652.0 - - 690.0788655293195 - - - 111.98098283607547 - noDriver - solomonVehicle - 0.0 - - 98 - 0.0 - 0.0 - - - 84 - 0.0 - 0.0 - - - 83 - 0.0 - 0.0 - - - 95 - 0.0 - 0.0 - - - 88 - 0.0 - 0.0 - - - 86 - 0.0 - 0.0 - - - 91 - 0.0 - 0.0 - - - 89 - 0.0 - 0.0 - - - 85 - 0.0 - 0.0 - - - 82 - 0.0 - 0.0 - - - 98 - 30.805843601498726 - 30.805843601498726 - - - 95 - 37.20896783893157 - 196.0 - - - 86 - 221.31797780234433 - 221.31797780234433 - - - 83 - 227.31797780234433 - 265.0 - - - 82 - 268.0 - 369.0 - - - 84 - 374.8309518948453 - 458.0 - - - 85 - 460.8284271247462 - 555.0 - - - 88 - 558.0 - 645.0 - - - 89 - 647.8284271247462 - 737.0 - - - 91 - 740.605551275464 - 836.0 - - 858.360679774998 - - - 56.11696343016839 - noDriver - solomonVehicle - 0.0 - - 74 - 0.0 - 0.0 - - - 65 - 0.0 - 0.0 - - - 63 - 0.0 - 0.0 - - - 66 - 0.0 - 0.0 - - - 67 - 0.0 - 0.0 - - - 64 - 0.0 - 0.0 - - - 62 - 0.0 - 0.0 - - - 69 - 0.0 - 0.0 - - - 72 - 0.0 - 0.0 - - - 61 - 0.0 - 0.0 - - - 67 - 12.206555615733702 - 12.206555615733702 - - - 65 - 13.206555615733702 - 76.0 - - - 63 - 78.0 - 171.0 - - - 62 - 176.0 - 262.0 - - - 74 - 265.0 - 353.0 - - - 72 - 358.0 - 450.0 - - - 61 - 453.0 - 531.0 - - - 64 - 533.0 - 632.0 - - - 66 - 637.0990195135928 - 826.0 - - - 69 - 828.0 - 916.0 - - 931.8113883008419 - - - 102.37910960851471 - noDriver - solomonVehicle - 0.0 - - 54 - 0.0 - 0.0 - - - 58 - 0.0 - 0.0 - - - 68 - 0.0 - 0.0 - - - 60 - 0.0 - 0.0 - - - 53 - 0.0 - 0.0 - - - 59 - 0.0 - 0.0 - - - 57 - 0.0 - 0.0 - - - 56 - 0.0 - 0.0 - - - 57 - 35.0 - 35.0 - - - 54 - 40.3851648071345 - 186.0 - - - 53 - 191.38516480713452 - 286.0 - - - 56 - 290.0 - 385.0 - - - 58 - 387.0 - 471.0 - - - 60 - 474.0 - 562.0 - - - 59 - 572.4403065089106 - 651.0 - - - 68 - 667.5529453572468 - 734.0 - - 754.6155281280883 - - - 53.31190824207452 - noDriver - solomonVehicle - 0.0 - - 8 - 0.0 - 0.0 - - - 9 - 0.0 - 0.0 - - - 10 - 0.0 - 0.0 - - - 3 - 0.0 - 0.0 - - - 7 - 0.0 - 0.0 - - - 5 - 0.0 - 0.0 - - - 11 - 0.0 - 0.0 - - - 6 - 0.0 - 0.0 - - - 4 - 0.0 - 0.0 - - - 5 - 15.132745950421556 - 15.132745950421556 - - - 3 - 16.13274595042156 - 65.0 - - - 7 - 67.0 - 170.0 - - - 8 - 172.82842712474618 - 255.0 - - - 10 - 258.605551275464 - 357.0 - - - 11 - 360.0 - 448.0 - - - 9 - 451.1622776601684 - 534.0 - - - 6 - 536.2360679774998 - 621.0 - - - 4 - 623.2360679774998 - 727.0 - - 745.1107702762748 - - - 100.42763486950274 - noDriver - solomonVehicle - 0.0 - - 55 - 0.0 - 0.0 - - - 46 - 0.0 - 0.0 - - - 44 - 0.0 - 0.0 - - - 51 - 0.0 - 0.0 - - - 40 - 0.0 - 0.0 - - - 49 - 0.0 - 0.0 - - - 48 - 0.0 - 0.0 - - - 45 - 0.0 - 0.0 - - - 42 - 0.0 - 0.0 - - - 43 - 0.0 - 0.0 - - - 47 - 0.0 - 0.0 - - - 52 - 0.0 - 0.0 - - - 41 - 0.0 - 0.0 - - - 50 - 0.0 - 0.0 - - - 43 - 16.55294535724685 - 16.55294535724685 - - - 42 - 19.55294535724685 - 68.0 - - - 55 - 87.23538406167134 - 95.0 - - - 41 - 113.38477631085024 - 166.0 - - - 40 - 168.0 - 264.0 - - - 44 - 267.0 - 359.0 - - - 46 - 361.8284271247462 - 448.0 - - - 45 - 450.0 - 541.0 - - - 48 - 543.0 - 632.0 - - - 51 - 635.0 - 725.0 - - - 50 - 727.2360679774998 - 815.0 - - - 52 - 818.1622776601683 - 912.0 - - - 49 - 915.0 - 1001.0 - - - 47 - 1003.0 - 1054.0 - - 1072.02775637732 - - - 133.7631148876197 - noDriver - solomonVehicle - 0.0 - - 87 - 0.0 - 0.0 - - - 79 - 0.0 - 0.0 - - - 77 - 0.0 - 0.0 - - - 81 - 0.0 - 0.0 - - - 76 - 0.0 - 0.0 - - - 90 - 0.0 - 0.0 - - - 78 - 0.0 - 0.0 - - - 80 - 0.0 - 0.0 - - - 73 - 0.0 - 0.0 - - - 71 - 0.0 - 0.0 - - - 70 - 0.0 - 0.0 - - - 90 - 20.615528128088304 - 20.615528128088304 - - - 87 - 25.615528128088304 - 85.0 - - - 81 - 113.2842712474619 - 113.2842712474619 - - - 78 - 116.2842712474619 - 116.2842712474619 - - - 76 - 118.2842712474619 - 203.0 - - - 71 - 208.0 - 293.0 - - - 70 - 298.0 - 387.0 - - - 73 - 390.0 - 478.0 - - - 77 - 482.0 - 574.0 - - - 79 - 575.0 - 668.0 - - - 80 - 673.3851648071345 - 769.0 - - 820.478150704935 - - - 96.99975276181122 - noDriver - solomonVehicle - 0.0 - - 75 - 0.0 - 0.0 - - - 96 - 0.0 - 0.0 - - - 93 - 0.0 - 0.0 - - - 94 - 0.0 - 0.0 - - - 1 - 0.0 - 0.0 - - - 99 - 0.0 - 0.0 - - - 100 - 0.0 - 0.0 - - - 97 - 0.0 - 0.0 - - - 2 - 0.0 - 0.0 - - - 92 - 0.0 - 0.0 - - - 96 - 36.05551275463989 - 95.0 - - - 94 - 100.3851648071345 - 285.0 - - - 92 - 288.605551275464 - 368.0 - - - 93 - 370.0 - 475.0 - - - 97 - 480.0 - 561.0 - - - 100 - 566.0 - 647.0 - - - 99 - 652.0 - 743.0 - - - 2 - 757.142135623731 - 825.0 - - - 1 - 827.0 - 912.0 - - - 75 - 915.0 - 997.0 - - 1012.8113883008419 - - - 96.11019377914941 - noDriver - solomonVehicle - 0.0 - - 36 - 0.0 - 0.0 - - - 35 - 0.0 - 0.0 - - - 25 - 0.0 - 0.0 - - - 34 - 0.0 - 0.0 - - - 37 - 0.0 - 0.0 - - - 27 - 0.0 - 0.0 - - - 21 - 0.0 - 0.0 - - - 22 - 0.0 - 0.0 - - - 39 - 0.0 - 0.0 - - - 38 - 0.0 - 0.0 - - - 25 - 15.132745950421556 - 169.0 - - - 27 - 171.0 - 261.0 - - - 35 - 285.7588368062799 - 285.7588368062799 - - - 37 - 291.5897887011252 - 383.0 - - - 38 - 385.0 - 479.0 - - - 39 - 484.0 - 567.0 - - - 36 - 572.0 - 665.0 - - - 34 - 668.0 - 751.0 - - - 22 - 772.1896201004171 - 812.0 - - - 21 - 814.0 - 914.0 - - 924.1980390271856 - - - - - diff --git a/jsprit-core/src/test/resources/pd_solomon_r101.xml b/jsprit-core/src/test/resources/pd_solomon_r101.xml deleted file mode 100644 index e6c08797..00000000 --- a/jsprit-core/src/test/resources/pd_solomon_r101.xml +++ /dev/null @@ -1,1236 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - solomonVehicle - solomonType - - 0 - - - - 0.0 - 230.0 - - - - - - solomonType - 200 - - 0.0 - 1.0 - - - - - - - [x=63.0][y=65.0] - - 8 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=2.0][y=60.0] - - 5 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=52.0] - - 11 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=55.0] - - 14 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=60.0][y=12.0] - - 31 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=20.0] - - 8 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=5.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=23.0][y=3.0] - - 7 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=24.0][y=12.0] - - 5 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=7.0] - - 5 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=25.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=10.0] - - 18 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=5.0] - - 29 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=35.0] - - 3 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=65.0][y=20.0] - - 6 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=30.0] - - 17 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=40.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=41.0][y=37.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=64.0][y=42.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=45.0] - - 13 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=17.0] - - 7 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=41.0][y=49.0] - - 10 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=60.0] - - 21 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=50.0] - - 5 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=30.0] - - 3 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=30.0] - - 26 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=35.0][y=69.0] - - 23 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=20.0] - - 19 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=52.0] - - 27 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=60.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=43.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=60.0] - - 17 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=30.0] - - 2 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=40.0] - - 12 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=5.0] - - 8 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=20.0] - - 19 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=25.0] - - 23 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=10.0] - - 20 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=65.0] - - 12 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=50.0][y=35.0] - - 19 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=20.0] - - 11 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=65.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=26.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=18.0][y=18.0] - - 17 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=19.0][y=21.0] - - 10 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=21.0] - - 12 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=22.0][y=27.0] - - 11 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=24.0] - - 20 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=26.0][y=27.0] - - 27 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=18.0][y=24.0] - - 22 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=22.0][y=22.0] - - 2 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=19.0] - - 1 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=67.0] - - 3 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=60.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=26.0][y=52.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=26.0][y=35.0] - - 15 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=48.0] - - 23 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=61.0][y=52.0] - - 3 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=43.0] - - 14 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=47.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=14.0][y=37.0] - - 11 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=37.0] - - 6 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=55.0][y=54.0] - - 26 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=4.0][y=18.0] - - 35 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=28.0][y=18.0] - - 26 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=11.0][y=31.0] - - 7 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=16.0][y=22.0] - - 41 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=67.0][y=5.0] - - 25 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=73.0] - - 25 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=47.0] - - 6 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=39.0] - - 36 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=56.0] - - 5 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=68.0] - - 15 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=47.0][y=16.0] - - 25 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=44.0][y=17.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=46.0][y=13.0] - - 8 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=11.0] - - 18 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=42.0] - - 13 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=24.0] - - 28 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=36.0][y=26.0] - - 18 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=12.0] - - 7 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=53.0][y=12.0] - - 6 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=23.0] - - 2 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=15.0][y=77.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=77.0] - - 20 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=24.0][y=58.0] - - 19 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=69.0] - - 10 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=34.0] - - 3 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=12.0][y=24.0] - - 13 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=6.0][y=68.0] - - 30 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=13.0][y=52.0] - - 36 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=6.0][y=38.0] - - 16 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=11.0][y=14.0] - - 18 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=56.0] - - 27 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=2.0][y=48.0] - - 1 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=58.0] - - 10 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=43.0] - - 9 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=31.0] - - 14 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=29.0] - - 18 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=47.0][y=47.0] - - 13 - 10.0 - - - 0.0 - 1.7976931348623157E308 - - - - - diff --git a/jsprit-core/src/test/resources/pdp.xml b/jsprit-core/src/test/resources/pdp.xml deleted file mode 100644 index dd4dc4ec..00000000 --- a/jsprit-core/src/test/resources/pdp.xml +++ /dev/null @@ -1,512 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - v - t - - [x=10.0][y=10.0] - - - - 0.0 - 500.0 - - - - - - t - 5 - - 0.0 - 1.0 - - - - - - - - [x=77.0][y=23.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=39.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=67.0][y=1.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=41.0][y=7.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=57.0][y=96.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=36.0][y=97.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=28.0][y=84.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=93.0][y=44.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=3.0][y=36.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=77.0][y=6.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=45.0][y=11.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=80.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=4.0][y=84.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=93.0][y=23.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=80.0][y=9.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=19.0][y=76.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=8.0][y=23.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=84.0][y=33.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=26.0][y=89.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=55.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=78.0][y=43.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=66.0][y=44.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=73.0][y=38.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=89.0][y=40.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=22.0][y=62.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=6.0][y=60.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=56.0][y=17.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=84.0][y=71.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=26.0][y=60.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=25.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=96.0][y=35.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=93.0][y=20.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=1.0][y=18.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=33.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=93.0][y=44.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=90.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - [x=31.0][y=63.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=12.0][y=56.0] - - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - 1 - - - - diff --git a/jsprit-core/src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml b/jsprit-core/src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml deleted file mode 100644 index c8b8fe83..00000000 --- a/jsprit-core/src/test/resources/schrimpf_vehicleSwitchNotAllowed.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - 2000 - - - - false - - - - - 1 - - - - - 0.1 - 20 - - - - - 0.3 - - - - - - 0.5 - - - - - - - - - - 0.1 - - - - - - .5 - - - - - - - diff --git a/jsprit-core/src/test/resources/simpleProblem.xml b/jsprit-core/src/test/resources/simpleProblem.xml deleted file mode 100644 index 03134d1b..00000000 --- a/jsprit-core/src/test/resources/simpleProblem.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - FINITE - HOMOGENEOUS - - - - 21 - 5 - - [x=0.0][y=0.0] - - - - [x=0.0][y=0.0] - - - - 14400.0 - 46800.0 - - true - - - 19 - 3.5 - - [x=0.0][y=0.0] - - - - [x=0.0][y=0.0] - - - - 39600.0 - 64800.0 - - true - - - - - 5 - - 0 - - - 0.0 - 1.0 - - - - - 3.5 - - 0 - - - 0.0 - 1.0 - - - - - - - [x=2000.0][y=0.0] - - - 0 - - 0.0 - - - 54000.0 - 64800.0 - - - - - [x=1000.0][y=1000.0] - - - 0 - - 0.0 - - - 19800.0 - 21600.0 - - - - - diff --git a/jsprit-core/src/test/resources/solomon_c101.xml b/jsprit-core/src/test/resources/solomon_c101.xml deleted file mode 100644 index 53f89b67..00000000 --- a/jsprit-core/src/test/resources/solomon_c101.xml +++ /dev/null @@ -1,1442 +0,0 @@ - - - - INFINITE - - - - solomonVehicle - solomonType - - 0 - - - - 0 - - - - 0.0 - 1236.0 - - true - - - - - solomonType - - 200 - - - 0.0 - 1.0 - - - - - - - 35 - - - 10 - - 90.0 - - - 283.0 - 344.0 - - - - - 36 - - - 10 - - 90.0 - - - 665.0 - 716.0 - - - - - 33 - - - 40 - - 90.0 - - - 87.0 - 158.0 - - - - - 34 - - - 20 - - 90.0 - - - 751.0 - 816.0 - - - - - 39 - - - 20 - - 90.0 - - - 567.0 - 624.0 - - - - - 37 - - - 20 - - 90.0 - - - 383.0 - 434.0 - - - - - 38 - - - 30 - - 90.0 - - - 479.0 - 522.0 - - - - - 43 - - - 10 - - 90.0 - - - 16.0 - 80.0 - - - - - 42 - - - 20 - - 90.0 - - - 68.0 - 149.0 - - - - - 41 - - - 10 - - 90.0 - - - 166.0 - 235.0 - - - - - 40 - - - 10 - - 90.0 - - - 264.0 - 321.0 - - - - - 22 - - - 20 - - 90.0 - - - 812.0 - 883.0 - - - - - 23 - - - 10 - - 90.0 - - - 732.0 - 777.0 - - - - - 24 - - - 10 - - 90.0 - - - 65.0 - 144.0 - - - - - 25 - - - 40 - - 90.0 - - - 169.0 - 224.0 - - - - - 26 - - - 10 - - 90.0 - - - 622.0 - 701.0 - - - - - 27 - - - 10 - - 90.0 - - - 261.0 - 316.0 - - - - - 28 - - - 20 - - 90.0 - - - 546.0 - 593.0 - - - - - 29 - - - 10 - - 90.0 - - - 358.0 - 405.0 - - - - - 3 - - - 10 - - 90.0 - - - 65.0 - 146.0 - - - - - 2 - - - 30 - - 90.0 - - - 825.0 - 870.0 - - - - - 1 - - - 10 - - 90.0 - - - 912.0 - 967.0 - - - - - 30 - - - 10 - - 90.0 - - - 449.0 - 504.0 - - - - - 7 - - - 20 - - 90.0 - - - 170.0 - 225.0 - - - - - 6 - - - 20 - - 90.0 - - - 621.0 - 702.0 - - - - - 5 - - - 10 - - 90.0 - - - 15.0 - 67.0 - - - - - 32 - - - 30 - - 90.0 - - - 31.0 - 100.0 - - - - - 4 - - - 10 - - 90.0 - - - 727.0 - 782.0 - - - - - 31 - - - 20 - - 90.0 - - - 200.0 - 237.0 - - - - - 9 - - - 10 - - 90.0 - - - 534.0 - 605.0 - - - - - 8 - - - 20 - - 90.0 - - - 255.0 - 324.0 - - - - - 19 - - - 10 - - 90.0 - - - 278.0 - 345.0 - - - - - 17 - - - 20 - - 90.0 - - - 99.0 - 148.0 - - - - - 18 - - - 20 - - 90.0 - - - 179.0 - 254.0 - - - - - 15 - - - 40 - - 90.0 - - - 384.0 - 429.0 - - - - - 16 - - - 40 - - 90.0 - - - 475.0 - 528.0 - - - - - 13 - - - 30 - - 90.0 - - - 30.0 - 92.0 - - - - - 14 - - - 10 - - 90.0 - - - 567.0 - 620.0 - - - - - 11 - - - 10 - - 90.0 - - - 448.0 - 505.0 - - - - - 12 - - - 20 - - 90.0 - - - 652.0 - 721.0 - - - - - 21 - - - 20 - - 90.0 - - - 914.0 - 965.0 - - - - - 20 - - - 10 - - 90.0 - - - 10.0 - 73.0 - - - - - 99 - - - 10 - - 90.0 - - - 743.0 - 820.0 - - - - - 100 - - - 20 - - 90.0 - - - 647.0 - 726.0 - - - - - 98 - - - 20 - - 90.0 - - - 30.0 - 84.0 - - - - - 97 - - - 30 - - 90.0 - - - 561.0 - 622.0 - - - - - 96 - - - 10 - - 90.0 - - - 95.0 - 156.0 - - - - - 95 - - - 30 - - 90.0 - - - 196.0 - 239.0 - - - - - 94 - - - 10 - - 90.0 - - - 285.0 - 336.0 - - - - - 93 - - - 40 - - 90.0 - - - 475.0 - 518.0 - - - - - 92 - - - 20 - - 90.0 - - - 368.0 - 441.0 - - - - - 91 - - - 10 - - 90.0 - - - 836.0 - 889.0 - - - - - 90 - - - 10 - - 90.0 - - - 20.0 - 84.0 - - - - - 10 - - - 10 - - 90.0 - - - 357.0 - 410.0 - - - - - 88 - - - 30 - - 90.0 - - - 645.0 - 708.0 - - - - - 89 - - - 10 - - 90.0 - - - 737.0 - 802.0 - - - - - 79 - - - 10 - - 90.0 - - - 668.0 - 731.0 - - - - - 78 - - - 20 - - 90.0 - - - 109.0 - 170.0 - - - - - 77 - - - 10 - - 90.0 - - - 574.0 - 643.0 - - - - - 82 - - - 20 - - 90.0 - - - 369.0 - 420.0 - - - - - 83 - - - 10 - - 90.0 - - - 265.0 - 338.0 - - - - - 80 - - - 10 - - 90.0 - - - 769.0 - 820.0 - - - - - 81 - - - 30 - - 90.0 - - - 47.0 - 124.0 - - - - - 86 - - - 10 - - 90.0 - - - 173.0 - 238.0 - - - - - 87 - - - 20 - - 90.0 - - - 85.0 - 144.0 - - - - - 84 - - - 20 - - 90.0 - - - 458.0 - 523.0 - - - - - 85 - - - 30 - - 90.0 - - - 555.0 - 612.0 - - - - - 67 - - - 10 - - 90.0 - - - 12.0 - 77.0 - - - - - 66 - - - 10 - - 90.0 - - - 826.0 - 875.0 - - - - - 69 - - - 10 - - 90.0 - - - 916.0 - 969.0 - - - - - 68 - - - 10 - - 90.0 - - - 734.0 - 777.0 - - - - - 70 - - - 30 - - 90.0 - - - 387.0 - 456.0 - - - - - 71 - - - 20 - - 90.0 - - - 293.0 - 360.0 - - - - - 72 - - - 10 - - 90.0 - - - 450.0 - 505.0 - - - - - 73 - - - 10 - - 90.0 - - - 478.0 - 551.0 - - - - - 74 - - - 50 - - 90.0 - - - 353.0 - 412.0 - - - - - 75 - - - 20 - - 90.0 - - - 997.0 - 1068.0 - - - - - 76 - - - 10 - - 90.0 - - - 203.0 - 260.0 - - - - - 59 - - - 10 - - 90.0 - - - 651.0 - 740.0 - - - - - 58 - - - 30 - - 90.0 - - - 471.0 - 534.0 - - - - - 57 - - - 40 - - 90.0 - - - 35.0 - 87.0 - - - - - 56 - - - 30 - - 90.0 - - - 385.0 - 436.0 - - - - - 55 - - - 10 - - 90.0 - - - 95.0 - 158.0 - - - - - 64 - - - 10 - - 90.0 - - - 632.0 - 693.0 - - - - - 65 - - - 10 - - 90.0 - - - 76.0 - 129.0 - - - - - 62 - - - 20 - - 90.0 - - - 262.0 - 317.0 - - - - - 63 - - - 50 - - 90.0 - - - 171.0 - 218.0 - - - - - 60 - - - 20 - - 90.0 - - - 562.0 - 629.0 - - - - - 61 - - - 10 - - 90.0 - - - 531.0 - 610.0 - - - - - 49 - - - 10 - - 90.0 - - - 1001.0 - 1066.0 - - - - - 48 - - - 10 - - 90.0 - - - 632.0 - 693.0 - - - - - 45 - - - 10 - - 90.0 - - - 541.0 - 600.0 - - - - - 44 - - - 10 - - 90.0 - - - 359.0 - 412.0 - - - - - 47 - - - 10 - - 90.0 - - - 1054.0 - 1127.0 - - - - - 46 - - - 30 - - 90.0 - - - 448.0 - 509.0 - - - - - 51 - - - 10 - - 90.0 - - - 725.0 - 786.0 - - - - - 52 - - - 10 - - 90.0 - - - 912.0 - 969.0 - - - - - 53 - - - 20 - - 90.0 - - - 286.0 - 347.0 - - - - - 54 - - - 40 - - 90.0 - - - 186.0 - 257.0 - - - - - 50 - - - 10 - - 90.0 - - - 815.0 - 880.0 - - - - - diff --git a/jsprit-core/src/test/resources/testConfig2.xml b/jsprit-core/src/test/resources/testConfig2.xml deleted file mode 100755 index ced4b0b9..00000000 --- a/jsprit-core/src/test/resources/testConfig2.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - 10 - - - - - - - 1 - - - - - - - 0.5 - - - - - 0.4 - - - - - - - - 0.1 - - - - 0.4 - - - - - - - - 0.3 - euclid - - - - 0.2 - - - - - - - - - - - - - - - - - diff --git a/jsprit-core/src/test/resources/twbug.xml b/jsprit-core/src/test/resources/twbug.xml deleted file mode 100644 index 83c9ef42..00000000 --- a/jsprit-core/src/test/resources/twbug.xml +++ /dev/null @@ -1,407 +0,0 @@ - - - - FINITE - - - - vehicle0 - vehicle_type_0 - - v0_start - 0 - - - v0_start - 0 - - - 60.0 - 18060.0 - - true - primemover - - - vehicle1 - vehicle_type_1 - - v1_start - 0 - - - v1_start - 0 - - - 60.0 - 18060.0 - - true - primemover - - - vehicle2 - vehicle_type_2 - - v2_start - 0 - - - v2_start - 0 - - - 7200.0 - 36060.0 - - true - primemover - - - vehicle3 - vehicle_type_3 - - v3_start - 0 - - - v3_start - 0 - - - 36000.0 - 54060.0 - - true - primemover - - - vehicle4 - vehicle_type_4 - - v4_start - 0 - - - v4_start - 0 - - - 36000.0 - 54060.0 - - true - primemover - - - - - vehicle_type_0 - - 20 - - - 0.0 - 0.0 - - - - - vehicle_type_1 - - 20 - - - 0.0 - 0.0 - - - - - vehicle_type_2 - - 20 - - - 0.0 - 0.0 - - - - - vehicle_type_3 - - 20 - - - 0.0 - 0.0 - - - - - vehicle_type_4 - - 20 - - - 0.0 - 0.0 - - - - - - - - js0 - 1 - - - 1 - - 600.0 - - - 0.0 - 1800.0 - - - Test - - - - js2 - 2 - - - 2 - - 600.0 - - - 5400.0 - 7200.0 - - - Test - - - - js5 - 3 - - - 10 - - 1800.0 - - - 17100.0 - 18000.0 - - - Test - - - - js6 - 4 - - - 2 - - 900.0 - - - 0.0 - 1.7976931348623157E308 - - - Test - - - - js8 - 5 - - - 4 - - 600.0 - - - 0.0 - 1.7976931348623157E308 - - - Test - - - - js10 - 6 - - - 10 - - 1500.0 - - - 29700.0 - 32400.0 - - - Test - - - - jsp3 - 7 - - - 0 - - 5594.0 - - - 0.0 - 1.7976931348623157E308 - - - Test - - - - - - - jsp1 - 1 - - 900.0 - - - 0.0 - 1.7976931348623157E308 - - - - - - jsd1 - 8 - - 900.0 - - - 0.0 - 1.7976931348623157E308 - - - - - 0 - - Test - - - - - jsp4 - 9 - - 1200.0 - - - 21600.0 - 23400.0 - - - - - - jsd4 - 8 - - 900.0 - - - 25200.0 - 27000.0 - - - - - 0 - - Test - - - - - jsp7 - 9 - - 1200.0 - - - 37800.0 - 41400.0 - - - - - - jsd7 - 8 - - 1800.0 - - - 43200.0 - 45900.0 - - - - - 0 - - Test - - - - - jsp9 - 10 - - 300.0 - - - 45000.0 - 48600.0 - - - - - - jsd9 - 8 - - 300.0 - - - 50400.0 - 52200.0 - - - - - 0 - - Test - - - diff --git a/jsprit-core/src/test/resources/vrp-solution.json b/jsprit-core/src/test/resources/vrp-solution.json deleted file mode 100644 index f3440cbe..00000000 --- a/jsprit-core/src/test/resources/vrp-solution.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "solution": { - "costs": 84.7213595499958, - "fixed_costs": 0.0, - "variable_costs": 84.7213595499958, - "distance": 84.7213595499958, - "time": 84.7213595499958, - "no_routes": 1, - "no_unassigned_jobs": 0, - "routes": [ - { - "fixed_costs": 0.0, - "variable_costs": 84.7213595499958, - "no_activities": 1, - "start_time": 0.0, - "act": { - "type": "service", - "job_id": "s", - "arr_time": 44.721359549995796, - "end_time": 44.721359549995796 - }, - "end_time": 84.7213595499958 - } - ], - "unassigned_jobs": [] - } -} diff --git a/jsprit-core/src/test/resources/vrp.json b/jsprit-core/src/test/resources/vrp.json deleted file mode 100644 index 58d8119a..00000000 --- a/jsprit-core/src/test/resources/vrp.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "meta-info": { - "distance-unit": "m", - "time-unit": "sec" - }, - "vrp": { - "fleet_size": "FINITE", - "vehicles": [ - { - "id": "v1", - "start_address": { - "id": "startLoc", - "lon": 0.0, - "lat": 0.0 - }, - "return_to_depot": true, - "end_address": { - "id": "endLoc", - "lon": 12.0, - "lat": 13.0 - }, - "earliest_start": 0.0, - "latest_end": 1000.0, - "type_id": "small", - "skills": ["screw-driver"] - }, - { - "id": "v2", - "start_address": { - "id": "startLoc", - "lon": 0.0, - "lat": 0.0 - }, - "return_to_depot": false, - "earliest_start": 0.0, - "latest_end": 1.7976931348623157E308, - "type_id": "medium", - "skills": ["joo"] - } - ], - "vehicle_types": [ - { - "id": "medium", - "capacity": [ - 1000, - 4000 - ], - "fixed_costs": 1000.0, - "distance_dependent_costs": 1.0, - "time_dependent_costs": 200.0 - }, - { - "id": "small", - "capacity": [ - 100, - 400 - ], - "fixed_costs": 0.0, - "distance_dependent_costs": 1.0, - "time_dependent_costs": 20.0 - } - ], - "services": [ - { - "id": "s1", - "type": "service", - "name": "no-name", - "address": { - "id": "s1_loc", - "lon": 40.0, - "lat": 10.0 - }, - "service_duration": 1.0, - "time_window": { - "start": 0.0, - "end": 1.7976931348623157E308 - }, - "size": [ - 20, - 40 - ], - "required_skills": ["joo-foo"] - }, - { - "id": "pickup2", - "type": "pickup", - "name": "no-name", - "address": { - "id": "s2_loc", - "lon": 40.0, - "lat": 10.0 - }, - "service_duration": 2.0, - "time_window": { - "start": 10.0, - "end": 200.0 - }, - "size": [ - 10, - 30 - ], - "required_skills": ["screw-driver"] - } - ] - } -} diff --git a/jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml b/jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml deleted file mode 100644 index 9e7433f0..00000000 --- a/jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml +++ /dev/null @@ -1,653 +0,0 @@ - - - - - - INFINITE - HOMOGENEOUS - - - - christophidesVehicle - christophidesType - - [x=30.0][y=40.0] - - - - 0.0 - 999999.0 - - - - - - christophidesType - 160 - - 0.0 - 1.0 - - - - - - - [x=62.0][y=63.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=69.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=46.0][y=10.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=61.0][y=33.0] - - 26 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=59.0][y=15.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=22.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=35.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=64.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=10.0] - - 13 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=17.0] - - 27 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=6.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=57.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=16.0][y=57.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=52.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=7.0][y=38.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=68.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=48.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=43.0][y=67.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=48.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=64.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=49.0] - - 30 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=52.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=63.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=27.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=47.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=30.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=46.0] - - 12 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=26.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=69.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=33.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=62.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=13.0][y=13.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=23.0] - - 3 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=33.0] - - 41 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=36.0][y=16.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=41.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=25.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=12.0][y=42.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=41.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=32.0] - - 29 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=42.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=58.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=28.0] - - 18 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=55.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=39.0][y=10.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=15.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=32.0] - - 25 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=39.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=51.0][y=21.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=37.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - diff --git a/jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml b/jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml deleted file mode 100644 index b972dfcc..00000000 --- a/jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml +++ /dev/null @@ -1,653 +0,0 @@ - - - - - - INFINITE - HOMOGENEOUS - - - - christophidesVehicle - christophidesType - - [x=30.0][y=40.0] - - - - 0.0 - 999999.0 - - - - - - christophidesType - 160 - - 0.0 - 1.0 - - - - - - - [x=62.0][y=63.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=69.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=46.0][y=10.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=61.0][y=33.0] - - 26 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=59.0][y=15.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=22.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=35.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=64.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=10.0] - - 13 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=17.0] - - 27 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=6.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=57.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=16.0][y=57.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=52.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=7.0][y=38.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=68.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=48.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=43.0][y=67.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=48.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=64.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=49.0] - - 30 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=52.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=63.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=27.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=47.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=30.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=46.0] - - 12 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=26.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=69.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=33.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=62.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=13.0][y=13.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=23.0] - - 3 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=33.0] - - 41 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=36.0][y=16.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=41.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=25.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=12.0][y=42.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=41.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=32.0] - - 29 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=42.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=58.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=28.0] - - 18 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=55.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=39.0][y=10.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=15.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=32.0] - - 25 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=39.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=51.0][y=21.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=37.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - diff --git a/jsprit-core/src/test/resources/vrpnc1-jsprit.xml b/jsprit-core/src/test/resources/vrpnc1-jsprit.xml deleted file mode 100644 index 19c20222..00000000 --- a/jsprit-core/src/test/resources/vrpnc1-jsprit.xml +++ /dev/null @@ -1,636 +0,0 @@ - - - - INFINITE - HOMOGENEOUS - - - - christophidesVehicle - christophidesType - - [x=30.0][y=40.0] - - - - 0.0 - 999999.0 - - - - - - christophidesType - 160 - - 0.0 - 1.0 - - - - - - - [x=62.0][y=63.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=63.0][y=69.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=46.0][y=10.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=61.0][y=33.0] - - 26 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=59.0][y=15.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=22.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=45.0][y=35.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=64.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=10.0] - - 13 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=10.0][y=17.0] - - 27 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=6.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=57.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=16.0][y=57.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=8.0][y=52.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=7.0][y=38.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=68.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=48.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=43.0][y=67.0] - - 14 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=48.0] - - 6 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=64.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=49.0][y=49.0] - - 30 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=52.0] - - 7 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=63.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=58.0][y=27.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=21.0][y=47.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=40.0][y=30.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=38.0][y=46.0] - - 12 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=20.0][y=26.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=37.0][y=69.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=33.0] - - 11 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=62.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=13.0][y=13.0] - - 9 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=27.0][y=23.0] - - 3 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=17.0][y=33.0] - - 41 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=36.0][y=16.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=52.0][y=41.0] - - 15 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=5.0][y=25.0] - - 23 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=12.0][y=42.0] - - 21 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=42.0][y=41.0] - - 19 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=31.0][y=32.0] - - 29 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=62.0][y=42.0] - - 8 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=57.0][y=58.0] - - 28 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=48.0][y=28.0] - - 18 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=55.0] - - 17 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=39.0][y=10.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=30.0][y=15.0] - - 16 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=25.0][y=32.0] - - 25 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=32.0][y=39.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=51.0][y=21.0] - - 5 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - [x=56.0][y=37.0] - - 10 - 0.0 - - - 0.0 - 1.7976931348623157E308 - - - - - diff --git a/jsprit-examples/pom.xml b/jsprit-examples/pom.xml index c0f7f942..9b2fcece 100644 --- a/jsprit-examples/pom.xml +++ b/jsprit-examples/pom.xml @@ -57,6 +57,12 @@ ${project.version} + + ${project.groupId} + jsprit-io + ${project.version} + + org.apache.logging.log4j log4j-slf4j-impl diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/AdditionalDistanceConstraintExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/AdditionalDistanceConstraintExample.java index 4e051262..a423d737 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/AdditionalDistanceConstraintExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/AdditionalDistanceConstraintExample.java @@ -20,14 +20,12 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateId; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.algorithm.state.StateUpdater; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; import com.graphhopper.jsprit.core.problem.constraint.HardActivityConstraint; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.misc.JobInsertionContext; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; @@ -38,6 +36,8 @@ import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.EuclideanDistanceCalculator; import com.graphhopper.jsprit.core.util.Solutions; import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java index e7028860..89a9cdc3 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/BicycleMessenger.java @@ -21,7 +21,6 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateId; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.algorithm.state.StateUpdater; @@ -51,6 +50,7 @@ import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.CrowFlyCosts; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.util.Examples; import java.io.BufferedReader; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java index 79526d18..7af34de9 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java @@ -18,11 +18,8 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.AlgorithmConfig; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -31,6 +28,9 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.AlgorithmConfig; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import org.apache.commons.configuration.XMLConfiguration; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java index c82e098e..c808f0e9 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java @@ -20,11 +20,10 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Shipment; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -34,6 +33,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Arrays; @@ -123,7 +123,7 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample { /* * get the algorithm out-of-the-box. */ - VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig.xml"); + VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(problem); // algorithm.setMaxIterations(30000); /* * and search a solution diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java index 5c17a1e5..442c1108 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/HVRPExample.java @@ -18,7 +18,7 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; @@ -117,7 +117,7 @@ public class HVRPExample { //build problem VehicleRoutingProblem vrp = vrpBuilder.build(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); VehicleRoutingProblemSolution best = Solutions.bestOf(solutions); diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java index f92a5587..b99e7e1a 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/JobAndActivityDependenciesExample.java @@ -20,7 +20,6 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateId; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.algorithm.state.StateUpdater; @@ -38,6 +37,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotExample.java index d0681381..292e6551 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotExample.java @@ -26,13 +26,13 @@ import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmLis import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Arrays; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotWithInitialRoutesExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotWithInitialRoutesExample.java index 8c03b9e2..3cc3919c 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotWithInitialRoutesExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/MultipleDepotWithInitialRoutesExample.java @@ -19,10 +19,9 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.analysis.toolbox.Plotter.Label; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.Builder; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.job.Job; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -30,6 +29,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; @@ -79,7 +79,7 @@ public class MultipleDepotWithInitialRoutesExample { // VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance(vrp) // .setProperty(Jsprit.Parameter.ITERATIONS,"10000").buildAlgorithm(); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_noVehicleSwitch.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); Collection solutions = vra.searchSolutions(); SolutionPrinter.print(Solutions.bestOf(solutions)); diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample.java index 5c0287f1..1da6a0b9 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample.java @@ -20,16 +20,16 @@ import com.graphhopper.jsprit.analysis.toolbox.AlgorithmSearchProgressChartListe import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.analysis.toolbox.Plotter.Label; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.analysis.SolutionAnalyser; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.cost.TransportDistance; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; @@ -71,7 +71,7 @@ public class PickupAndDeliveryExample { * The algorithm can be defined and configured in an xml-file. */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); /* * Solve the problem. diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample2.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample2.java index 3a9bb8e7..2d3a1caf 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample2.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryExample2.java @@ -21,12 +21,12 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.analysis.toolbox.Plotter.Label; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; @@ -67,8 +67,8 @@ public class PickupAndDeliveryExample2 { * * The algorithm can be defined and configured in an xml-file. */ -// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml"); + + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); /* * Solve the problem. diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryOpenExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryOpenExample.java index 63cd54d4..22c67938 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryOpenExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/PickupAndDeliveryOpenExample.java @@ -20,12 +20,12 @@ import com.graphhopper.jsprit.analysis.toolbox.AlgorithmSearchProgressChartListe import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.analysis.toolbox.Plotter.Label; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; @@ -65,8 +65,8 @@ public class PickupAndDeliveryOpenExample { * * The algorithm can be defined and configured in an xml-file. */ -// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_open.xml"); + + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); /* * Solve the problem. diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionExample.java index 8e2ca098..0eeb262c 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionExample.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprove import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -31,6 +30,7 @@ import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix; import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.io.BufferedReader; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionWithFastMatrixExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionWithFastMatrixExample.java index 8a52a1b4..a8672568 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionWithFastMatrixExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/RefuseCollectionWithFastMatrixExample.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprove import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -30,6 +29,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.FastVehicleRoutingTransportCostsMatrix; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.io.BufferedReader; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java index 08ee3900..be4ae125 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java @@ -20,10 +20,9 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -32,6 +31,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Arrays; @@ -100,7 +100,7 @@ public class ServicePickupsWithMultipleDepotsExample { /* * get the algorithm out-of-the-box. */ - VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig.xml"); + VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(problem); algorithm.setMaxIterations(10); /* diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java index e6622113..40159d36 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Delivery; import com.graphhopper.jsprit.core.problem.job.Pickup; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -32,6 +31,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java index 1d73f293..b56ab45a 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Shipment; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -32,6 +31,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Arrays; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java index b03c0c6e..69da66b1 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Shipment; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -32,6 +31,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java index 20a0a6ae..1d1506df 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java @@ -18,13 +18,11 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; import com.graphhopper.jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Delivery; import com.graphhopper.jsprit.core.problem.job.Shipment; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -35,6 +33,8 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExample.java index adeeef29..a84e244f 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExample.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -31,6 +30,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import java.io.File; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleOpenRoutes.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleOpenRoutes.java index 96f0ee7c..c44b15cd 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleOpenRoutes.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleOpenRoutes.java @@ -18,10 +18,9 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -30,6 +29,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; @@ -79,7 +79,7 @@ public class SimpleExampleOpenRoutes { /* * get the algorithm out-of-the-box. */ - VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig_fix.xml"); + VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(problem); /* * and search a solution diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithPriorities.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithPriorities.java index 04368a63..305da7fb 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithPriorities.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithPriorities.java @@ -22,7 +22,6 @@ import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -31,6 +30,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import java.io.File; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithSkills.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithSkills.java index 950c2587..ecc4b679 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithSkills.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExampleWithSkills.java @@ -19,12 +19,10 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; @@ -33,6 +31,8 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import java.io.File; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleVRPWithBackhaulsExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleVRPWithBackhaulsExample.java index 623ee36b..73b05e67 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleVRPWithBackhaulsExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleVRPWithBackhaulsExample.java @@ -19,13 +19,11 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.analysis.toolbox.Plotter.Label; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; import com.graphhopper.jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Delivery; import com.graphhopper.jsprit.core.problem.job.Pickup; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -35,6 +33,8 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java index ea8fd9cd..a84b97aa 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java @@ -21,12 +21,12 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import java.io.File; import java.util.Collection; @@ -72,7 +72,7 @@ public class SolomonExampleWithSpecifiedVehicleEndLocations { * The algorithm can be defined and configured in an xml-file. */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(20000); // vra.setPrematureBreak(100); vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java index f5d63632..3e9c4a91 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java @@ -20,12 +20,12 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import java.io.File; import java.util.Collection; @@ -72,7 +72,7 @@ public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs { * The algorithm can be defined and configured in an xml-file. */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(20000); // vra.setPrematureBreak(100); // vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java index d4321115..9b5fcfd6 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonOpenExample.java @@ -22,9 +22,9 @@ import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonR101Example.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonR101Example.java index cd621582..2cb753bf 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonR101Example.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonR101Example.java @@ -19,12 +19,12 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; +import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; @@ -64,7 +64,7 @@ public class SolomonR101Example { * The algorithm can be defined and configured in an xml-file. */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml"); + VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); vra.setMaxIterations(20000); // vra.setPrematureBreak(100); vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithRegretInsertionExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithRegretInsertionExample.java deleted file mode 100644 index e327b62c..00000000 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithRegretInsertionExample.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2014 Stefan Schroeder - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - ******************************************************************************/ -package com.graphhopper.jsprit.examples; - -import com.graphhopper.jsprit.analysis.toolbox.AlgorithmEventsRecorder; -import com.graphhopper.jsprit.analysis.toolbox.AlgorithmEventsViewer; -import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; -import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; -import com.graphhopper.jsprit.analysis.toolbox.Plotter; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms; -import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; -import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import com.graphhopper.jsprit.core.reporting.SolutionPrinter; -import com.graphhopper.jsprit.instance.reader.SolomonReader; -import com.graphhopper.jsprit.util.Examples; - -import java.util.Collection; - - -public class SolomonWithRegretInsertionExample { - - public static void main(String[] args) { - /* - * some preparation - create output folder - */ - Examples.createOutputFolder(); - - /* - * Build the problem. - * - * But define a problem-builder first. - */ - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - - /* - * A solomonReader reads solomon-instance files, and stores the required information in the builder. - */ - new SolomonReader(vrpBuilder).read("input/C101_solomon.txt"); - - - /* - * Finally, the problem can be built. By default, transportCosts are crowFlyDistances (as usually used for vrp-instances). - */ - VehicleRoutingProblem vrp = vrpBuilder.build(); - - new Plotter(vrp).plot("output/solomon_C101.png", "C101"); - - /* - * Define the required vehicle-routing algorithms to solve the above problem. - * - * The algorithm can be defined and configured in an xml-file. - */ - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_greedyWithRegret.xml"); - vra.setMaxIterations(2); - - AlgorithmEventsRecorder eventsRecorder = new AlgorithmEventsRecorder(vrp, "output/events.dgs.gz"); - eventsRecorder.setRecordingRange(0, 50); - vra.addListener(eventsRecorder); - - /* - * Solve the problem. - * - * - */ - Collection solutions = vra.searchSolutions(); - - /* - * Retrieve best solution. - */ - VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions); - - - /* - * print solution - */ - SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); - - /* - * Plot solution. - */ - Plotter plotter = new Plotter(vrp, solution); -// plotter.setBoundingBox(30, 0, 50, 20); - plotter.plot("output/solomon_C101_solution.png", "C101"); - - new GraphStreamViewer(vrp, solution).labelWith(Label.ID).setRenderDelay(100).display(); - - AlgorithmEventsViewer viewer = new AlgorithmEventsViewer(); - viewer.setRuinDelay(16); - viewer.setRecreationDelay(8); - viewer.display("output/events.dgs.gz"); - - } - -} diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithSkillsExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithSkillsExample.java index af8f8dc1..98f08290 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithSkillsExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SolomonWithSkillsExample.java @@ -20,13 +20,11 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Job; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -36,6 +34,8 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleType; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Solutions; import com.graphhopper.jsprit.instance.reader.SolomonReader; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; +import com.graphhopper.jsprit.io.problem.VrpXMLWriter; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/TransportOfDisabledPeople.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/TransportOfDisabledPeople.java index ce61744d..b812ba9e 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/TransportOfDisabledPeople.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/TransportOfDisabledPeople.java @@ -20,7 +20,6 @@ import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer.Label; import com.graphhopper.jsprit.analysis.toolbox.Plotter; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprovementTermination; import com.graphhopper.jsprit.core.problem.Location; @@ -38,6 +37,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample.java index d1708ebb..fcf3eadd 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample.java @@ -19,15 +19,15 @@ package com.graphhopper.jsprit.examples; import com.graphhopper.jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import com.graphhopper.jsprit.analysis.toolbox.GraphStreamViewer; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; -import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.algorithm.state.StateManager; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; import com.graphhopper.jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithmBuilder; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample2.java b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample2.java index 413bfc2f..bddd6490 100644 --- a/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample2.java +++ b/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/VRPWithBackhaulsExample2.java @@ -29,12 +29,12 @@ import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager; import com.graphhopper.jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import com.graphhopper.jsprit.core.problem.cost.TransportDistance; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; import com.graphhopper.jsprit.core.problem.vehicle.Vehicle; import com.graphhopper.jsprit.core.reporting.SolutionPrinter; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import com.graphhopper.jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java index a255fd7a..c092672a 100644 --- a/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java +++ b/jsprit-instances/src/main/java/com/graphhopper/jsprit/instance/reader/VrphGoldenReader.java @@ -21,7 +21,6 @@ import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.Builder; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import com.graphhopper.jsprit.core.problem.io.VrpXMLWriter; import com.graphhopper.jsprit.core.problem.job.Service; import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; @@ -162,12 +161,6 @@ public class VrphGoldenReader { } } - public static void main(String[] args) { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - VrphGoldenReader goldenReader = new VrphGoldenReader(vrpBuilder, VrphType.FSMD); - goldenReader.read("instances/vrph/orig/cn_13mix.txt"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - new VrpXMLWriter(vrp).write("instances/vrph/cn_13mix_VRPH_INFINITE.xml"); - } + } diff --git a/jsprit-io/.gitignore b/jsprit-io/.gitignore new file mode 100644 index 00000000..30b951da --- /dev/null +++ b/jsprit-io/.gitignore @@ -0,0 +1,18 @@ +/bin +/target +/output +.DS_Store + +# IntelliJ +*.ipr +*.iws +*.iml +.idea + +# Eclipse +.project +.classpath +.settings + + + diff --git a/jsprit-io/pom.xml b/jsprit-io/pom.xml new file mode 100644 index 00000000..2bd9884b --- /dev/null +++ b/jsprit-io/pom.xml @@ -0,0 +1,40 @@ + + + + jsprit + jsprit + 1.6.3-SNAPSHOT + + 4.0.0 + + jsprit-io + + + + ${project.groupId} + jsprit-core + ${project.version} + jar + provided + + + + commons-configuration + commons-configuration + 1.9 + jar + compile + + + + xerces + xercesImpl + 2.11.0 + compile + + + + + diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/AlgorithmConfig.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/AlgorithmConfig.java similarity index 95% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/AlgorithmConfig.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/AlgorithmConfig.java index f227c403..14127a2e 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/AlgorithmConfig.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/AlgorithmConfig.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.io; +package com.graphhopper.jsprit.io.algorithm; import org.apache.commons.configuration.XMLConfiguration; diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/AlgorithmConfigXmlReader.java similarity index 98% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/AlgorithmConfigXmlReader.java index d0b5c06f..59842f5f 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/AlgorithmConfigXmlReader.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.io; +package com.graphhopper.jsprit.io.algorithm; import com.graphhopper.jsprit.core.util.Resource; import org.apache.commons.configuration.ConfigurationException; diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/InsertionFactory.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/InsertionFactory.java similarity index 99% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/InsertionFactory.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/InsertionFactory.java index ed390c1d..de7dc87a 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/InsertionFactory.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/InsertionFactory.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.io; +package com.graphhopper.jsprit.io.algorithm; import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners; import com.graphhopper.jsprit.core.algorithm.recreate.InsertionBuilder; diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/VehicleRoutingAlgorithms.java similarity index 99% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/VehicleRoutingAlgorithms.java index f6d0430d..bb499f90 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/algorithm/VehicleRoutingAlgorithms.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.io; +package com.graphhopper.jsprit.io.algorithm; import com.graphhopper.jsprit.core.algorithm.*; import com.graphhopper.jsprit.core.algorithm.acceptor.*; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.*; import com.graphhopper.jsprit.core.algorithm.listener.AlgorithmEndsListener; import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.PrioritizedVRAListener; import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority; @@ -51,6 +50,7 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.ReverseActivi import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity; import com.graphhopper.jsprit.core.problem.vehicle.*; import com.graphhopper.jsprit.core.util.ActivityTimeTracker; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms.TypedMap.*; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.commons.configuration.XMLConfiguration; import org.slf4j.Logger; diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/Schema.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/Schema.java similarity index 97% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/Schema.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/Schema.java index 8492eff5..8e9ba0ca 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/Schema.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/Schema.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.problem.io; +package com.graphhopper.jsprit.io.problem; final class Schema { diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/VrpXMLReader.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/VrpXMLReader.java similarity index 99% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/VrpXMLReader.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/VrpXMLReader.java index fb602a76..028bcd9c 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/VrpXMLReader.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/VrpXMLReader.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.problem.io; +package com.graphhopper.jsprit.io.problem; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/VrpXMLWriter.java b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/VrpXMLWriter.java similarity index 99% rename from jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/VrpXMLWriter.java rename to jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/VrpXMLWriter.java index 4bbce211..dcd7242d 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/io/VrpXMLWriter.java +++ b/jsprit-io/src/main/java/com/graphhopper/jsprit/io/problem/VrpXMLWriter.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.problem.io; +package com.graphhopper.jsprit.io.problem; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.Skills; diff --git a/jsprit-core/src/main/resources/algorithm_schema.xsd b/jsprit-io/src/main/resources/algorithm_schema.xsd similarity index 100% rename from jsprit-core/src/main/resources/algorithm_schema.xsd rename to jsprit-io/src/main/resources/algorithm_schema.xsd diff --git a/jsprit-core/src/main/resources/config.xml b/jsprit-io/src/main/resources/config.xml similarity index 100% rename from jsprit-core/src/main/resources/config.xml rename to jsprit-io/src/main/resources/config.xml diff --git a/jsprit-core/src/main/resources/greedySchrimpf.xml b/jsprit-io/src/main/resources/greedySchrimpf.xml similarity index 100% rename from jsprit-core/src/main/resources/greedySchrimpf.xml rename to jsprit-io/src/main/resources/greedySchrimpf.xml diff --git a/jsprit-core/src/main/resources/randomWalk.xml b/jsprit-io/src/main/resources/randomWalk.xml similarity index 100% rename from jsprit-core/src/main/resources/randomWalk.xml rename to jsprit-io/src/main/resources/randomWalk.xml diff --git a/jsprit-core/src/main/resources/schrimpf.xml b/jsprit-io/src/main/resources/schrimpf.xml similarity index 100% rename from jsprit-core/src/main/resources/schrimpf.xml rename to jsprit-io/src/main/resources/schrimpf.xml diff --git a/jsprit-core/src/main/resources/vrp_xml_schema.xsd b/jsprit-io/src/main/resources/vrp_xml_schema.xsd similarity index 100% rename from jsprit-core/src/main/resources/vrp_xml_schema.xsd rename to jsprit-io/src/main/resources/vrp_xml_schema.xsd diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/io/TestAlgorithmReader.java b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/algorithm/TestAlgorithmReader.java similarity index 88% rename from jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/io/TestAlgorithmReader.java rename to jsprit-io/src/test/java/com/graphhopper/jsprit/io/algorithm/TestAlgorithmReader.java index dfabbb62..f9676b3d 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/io/TestAlgorithmReader.java +++ b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/algorithm/TestAlgorithmReader.java @@ -14,18 +14,13 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm.io; +package com.graphhopper.jsprit.io.algorithm; import com.graphhopper.jsprit.core.algorithm.SearchStrategy; import com.graphhopper.jsprit.core.algorithm.SearchStrategyModule; import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.acceptor.GreedyAcceptance; import com.graphhopper.jsprit.core.algorithm.acceptor.SolutionAcceptor; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms.ModKey; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.AcceptorKey; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.RuinStrategyKey; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.SelectorKey; -import com.graphhopper.jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.StrategyModuleKey; import com.graphhopper.jsprit.core.algorithm.listener.IterationEndsListener; import com.graphhopper.jsprit.core.algorithm.listener.SearchStrategyModuleListener; import com.graphhopper.jsprit.core.algorithm.ruin.RuinStrategy; @@ -33,10 +28,15 @@ import com.graphhopper.jsprit.core.algorithm.ruin.listener.RuinListener; import com.graphhopper.jsprit.core.algorithm.selector.SelectBest; import com.graphhopper.jsprit.core.algorithm.selector.SolutionSelector; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.job.Job; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms.ModKey; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms.TypedMap.AcceptorKey; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms.TypedMap.RuinStrategyKey; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms.TypedMap.SelectorKey; +import com.graphhopper.jsprit.io.algorithm.VehicleRoutingAlgorithms.TypedMap.StrategyModuleKey; +import com.graphhopper.jsprit.io.problem.VrpXMLReader; import junit.framework.Assert; import org.apache.commons.configuration.ConfigurationException; import org.junit.Before; @@ -60,16 +60,16 @@ public class TestAlgorithmReader { @Before public void doBefore() throws ConfigurationException { config = new AlgorithmConfig(); - new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read("src/test/resources/testConfig.xml"); + new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read(getClass().getResource("testConfig.xml")); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); solutions = new ArrayList(); - new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrp.xml"); + new VrpXMLReader(vrpBuilder, solutions).read(getClass().getResourceAsStream("finiteVrp.xml")); vrp = vrpBuilder.build(); } @Test public void itShouldReadMaxIterations() { - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest.xml"); + VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, getClass().getResource("algorithmConfigForReaderTest.xml")); Assert.assertEquals(2000, vra.getMaxIterations()); } @@ -86,7 +86,7 @@ public class TestAlgorithmReader { @Test public void whenSettingPrematureBreak_itShouldReadTermination() { - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest2.xml"); + VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, getClass().getResource("algorithmConfigForReaderTest2.xml")); IterationCounter iCounter = new IterationCounter(); vra.addListener(iCounter); vra.searchSolutions(); @@ -95,7 +95,7 @@ public class TestAlgorithmReader { @Test public void itShouldReadTermination() { - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest.xml"); + VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, getClass().getResource("algorithmConfigForReaderTest.xml")); IterationCounter iCounter = new IterationCounter(); vra.addListener(iCounter); vra.searchSolutions(); @@ -271,14 +271,14 @@ public class TestAlgorithmReader { @Test public void readerTest_whenReadingAlgoWithSchemaValidation_itReadsCorrectly() { AlgorithmConfig algoConfig = new AlgorithmConfig(); - new AlgorithmConfigXmlReader(algoConfig).read("src/test/resources/algorithmConfig.xml"); + new AlgorithmConfigXmlReader(algoConfig).read(getClass().getResource("algorithmConfig.xml")); } @Test public void readerTest_whenReadingAlgoWithSchemaValidationWithoutIterations_itReadsCorrectly() { AlgorithmConfig algoConfig = new AlgorithmConfig(); - new AlgorithmConfigXmlReader(algoConfig).read("src/test/resources/algorithmConfig_withoutIterations.xml"); + new AlgorithmConfigXmlReader(algoConfig).read(getClass().getResource("algorithmConfig_withoutIterations.xml")); } diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java similarity index 63% rename from jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java rename to jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java index f53ab988..70121cd5 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/algorithm/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java +++ b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT.java @@ -16,17 +16,14 @@ * Contributors: * Stefan Schroeder - initial API and implementation ******************************************************************************/ -package com.graphhopper.jsprit.core.algorithm; +package com.graphhopper.jsprit.io.problem; -import com.graphhopper.jsprit.core.IntegrationTest; +import com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm; import com.graphhopper.jsprit.core.algorithm.box.Jsprit; -import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory; import com.graphhopper.jsprit.core.algorithm.recreate.NoSolutionFoundException; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; -import com.graphhopper.jsprit.core.problem.io.VrpXMLReader; import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution; import org.junit.Test; -import org.junit.experimental.categories.Category; import java.util.ArrayList; import java.util.Collection; @@ -36,33 +33,12 @@ import static org.junit.Assert.assertTrue; public class FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT { - @Test - @Category(IntegrationTest.class) - public void whenEmployingVehicleWhereOnlyOneDistinctVehicleCanServeAParticularJob_algorithmShouldFoundDistinctSolution() { - final List testFailed = new ArrayList(); - for (int i = 0; i < 10; i++) { - VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/biggerProblem.xml"); - VehicleRoutingProblem vrp = vrpBuilder.build(); - - VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - vra.setMaxIterations(10); - try { - @SuppressWarnings("unused") - Collection solutions = vra.searchSolutions(); - } catch (NoSolutionFoundException e) { - testFailed.add(true); - } - } - assertTrue(testFailed.isEmpty()); - } - @Test public void whenEmployingVehicleWhereOnlyOneDistinctVehicleCanServeAParticularJobWith_jspritAlgorithmShouldFoundDistinctSolution() { final List testFailed = new ArrayList(); for (int i = 0; i < 10; i++) { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(vrpBuilder).read("src/test/resources/biggerProblem.xml"); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("biggerProblem.xml")); VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp); diff --git a/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/InitialRoutesTest.java b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/InitialRoutesTest.java new file mode 100644 index 00000000..fd1f0d6e --- /dev/null +++ b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/InitialRoutesTest.java @@ -0,0 +1,119 @@ +/******************************************************************************* + * Copyright (C) 2014 Stefan Schroeder + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + ******************************************************************************/ + +package com.graphhopper.jsprit.io.problem; + + +import com.graphhopper.jsprit.core.problem.AbstractActivity; +import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; +import com.graphhopper.jsprit.core.problem.job.Job; +import com.graphhopper.jsprit.core.problem.job.Service; +import com.graphhopper.jsprit.core.problem.job.Shipment; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class InitialRoutesTest { + + + @Test + public void whenReading_jobMapShouldOnlyContainJob2() { + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_iniRoutes.xml")); + VehicleRoutingProblem vrp = vrpBuilder.build(); + + assertEquals(1, getNuServices(vrp)); + assertTrue(vrp.getJobs().containsKey("2")); + } + + @Test + public void whenReadingProblem2_jobMapShouldContain_service2() { + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml")); + VehicleRoutingProblem vrp = vrpBuilder.build(); + + assertEquals(1, getNuServices(vrp)); + assertTrue(vrp.getJobs().containsKey("2")); + } + + @Test + public void whenReading_jobMapShouldContain_shipment4() { + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml")); + VehicleRoutingProblem vrp = vrpBuilder.build(); + + assertEquals(1, getNuShipments(vrp)); + assertTrue(vrp.getJobs().containsKey("4")); + } + + private int getNuShipments(VehicleRoutingProblem vrp) { + int nuShipments = 0; + for (Job job : vrp.getJobs().values()) { + if (job instanceof Shipment) nuShipments++; + } + return nuShipments; + } + + private int getNuServices(VehicleRoutingProblem vrp) { + int nuServices = 0; + for (Job job : vrp.getJobs().values()) { + if (job instanceof Service) nuServices++; + } + return nuServices; + } + + @Test + public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2() { + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_iniRoutes.xml")); + VehicleRoutingProblem vrp = vrpBuilder.build(); + + assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size()); + } + + @Test + public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2_v2() { + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml")); + VehicleRoutingProblem vrp = vrpBuilder.build(); + + assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size()); + } + + @Test + public void whenReading_thereShouldBeTwoActsAssociatedToShipment4() { + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml")); + VehicleRoutingProblem vrp = vrpBuilder.build(); + + Job job = vrp.getJobs().get("4"); + List activities = vrp.getActivities(job); + + assertEquals(2, activities.size()); + } + + +} diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/io/VrpXMLReaderTest.java b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/VrpXMLReaderTest.java similarity index 85% rename from jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/io/VrpXMLReaderTest.java rename to jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/VrpXMLReaderTest.java index 7595677a..b4b02795 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/io/VrpXMLReaderTest.java +++ b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/VrpXMLReaderTest.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.problem.io; +package com.graphhopper.jsprit.io.problem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize; @@ -31,6 +31,7 @@ import com.graphhopper.jsprit.core.util.Solutions; import org.junit.Before; import org.junit.Test; +import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -41,17 +42,17 @@ import static org.junit.Assert.*; public class VrpXMLReaderTest { - private String inFileName; + private InputStream inputStream; @Before public void doBefore() { - inFileName = "src/test/resources/finiteVrpForReaderTest.xml"; + inputStream = getClass().getResourceAsStream("finiteVrpForReaderTest.xml"); } @Test public void shouldReadNameOfService() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s = (Service) vrp.getJobs().get("1"); assertTrue(s.getName().equals("cleaning")); @@ -60,7 +61,7 @@ public class VrpXMLReaderTest { @Test public void shouldReadNameOfShipment() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertTrue(s.getName().equals("deliver-smth")); @@ -69,7 +70,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVrp_problemTypeIsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); assertEquals(FleetSize.FINITE, vrp.getFleetSize()); } @@ -77,7 +78,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVrp_vehiclesAreReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); assertEquals(5, vrp.getVehicles().size()); assertTrue(idsInCollection(Arrays.asList("v1", "v2"), vrp.getVehicles())); @@ -86,7 +87,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVrp_vehiclesAreReadCorrectly2() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v1 = getVehicle("v1", vrp.getVehicles()); assertEquals(20, v1.getType().getCapacityDimensions().get(0)); @@ -103,7 +104,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVehicles_skill1ShouldBeAssigned() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v1 = getVehicle("v1", vrp.getVehicles()); assertTrue(v1.getSkills().containsSkill("skill1")); @@ -112,7 +113,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVehicles_skill2ShouldBeAssigned() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v1 = getVehicle("v1", vrp.getVehicles()); assertTrue(v1.getSkills().containsSkill("skill2")); @@ -121,7 +122,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVehicles_nuSkillsShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v1 = getVehicle("v1", vrp.getVehicles()); assertEquals(2, v1.getSkills().values().size()); @@ -130,7 +131,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVehicles_nuSkillsOfV2ShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v2", vrp.getVehicles()); assertEquals(0, v.getSkills().values().size()); @@ -152,7 +153,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVrp_vehicleTypesAreReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); assertEquals(3, vrp.getTypes().size()); } @@ -160,7 +161,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingVrpWithInfiniteSize_itReadsCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); assertEquals(FleetSize.FINITE, vrp.getFleetSize()); } @@ -168,7 +169,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_nuOfJobsIsReadThemCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); assertEquals(4, vrp.getJobs().size()); } @@ -176,7 +177,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingServices_itReadsThemCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); int servCounter = 0; for (Job j : vrp.getJobs().values()) { @@ -188,7 +189,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingService1_skill1ShouldBeAssigned() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s = (Service) vrp.getJobs().get("1"); assertTrue(s.getRequiredSkills().containsSkill("skill1")); @@ -197,7 +198,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingService1_skill2ShouldBeAssigned() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s = (Service) vrp.getJobs().get("1"); assertTrue(s.getRequiredSkills().containsSkill("skill2")); @@ -206,7 +207,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingService1_nuSkillsShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s = (Service) vrp.getJobs().get("1"); assertEquals(2, s.getRequiredSkills().values().size()); @@ -215,7 +216,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingService2_nuSkillsOfV2ShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s = (Service) vrp.getJobs().get("2"); assertEquals(0, s.getRequiredSkills().values().size()); @@ -224,7 +225,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingShipments_itReadsThemCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); int shipCounter = 0; for (Job j : vrp.getJobs().values()) { @@ -236,7 +237,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingShipment3_skill1ShouldBeAssigned() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertTrue(s.getRequiredSkills().containsSkill("skill1")); @@ -245,7 +246,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingShipment3_skill2ShouldBeAssigned() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertTrue(s.getRequiredSkills().containsSkill("skill2")); @@ -254,7 +255,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingShipment3_nuSkillsShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(2, s.getRequiredSkills().values().size()); @@ -263,7 +264,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingShipment4_nuSkillsOfV2ShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("4"); assertEquals(0, s.getRequiredSkills().values().size()); @@ -272,7 +273,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingServices_capOfService1IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s1 = (Service) vrp.getJobs().get("1"); assertEquals(1, s1.getSize().get(0)); @@ -281,7 +282,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingServices_durationOfService1IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s1 = (Service) vrp.getJobs().get("1"); assertEquals(10.0, s1.getServiceDuration(), 0.01); @@ -290,7 +291,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingServices_twOfService1IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s1 = (Service) vrp.getJobs().get("1"); assertEquals(0.0, s1.getTimeWindow().getStart(), 0.01); @@ -300,7 +301,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingServices_typeOfService1IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Service s1 = (Service) vrp.getJobs().get("1"); assertEquals("service", s1.getType()); @@ -309,7 +310,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v2MustNotReturnToDepot() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v2", vrp.getVehicles()); assertFalse(v.isReturnToDepot()); @@ -318,7 +319,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v3HasTheCorrectStartLocation() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v3 = getVehicle("v3", vrp.getVehicles()); assertEquals("startLoc", v3.getStartLocation().getId()); @@ -329,7 +330,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v3HasTheCorrectEndLocation() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v3 = getVehicle("v3", vrp.getVehicles()); assertEquals("endLoc", v3.getEndLocation().getId()); @@ -338,7 +339,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v3HasTheCorrectEndLocationCoordinate() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v3 = getVehicle("v3", vrp.getVehicles()); assertEquals(1000.0, v3.getEndLocation().getCoordinate().getX(), 0.01); @@ -348,7 +349,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v3HasTheCorrectStartLocationCoordinate() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v3 = getVehicle("v3", vrp.getVehicles()); assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01); @@ -358,7 +359,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v3HasTheCorrectLocationCoordinate() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v3 = getVehicle("v3", vrp.getVehicles()); assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01); @@ -368,7 +369,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v3HasTheCorrectLocationId() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v3 = getVehicle("v3", vrp.getVehicles()); assertEquals("startLoc", v3.getStartLocation().getId()); @@ -377,7 +378,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v4HasTheCorrectStartLocation() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v4", vrp.getVehicles()); assertEquals("startLoc", v.getStartLocation().getId()); @@ -386,7 +387,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v4HasTheCorrectEndLocation() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v4", vrp.getVehicles()); assertEquals("endLoc", v.getEndLocation().getId()); @@ -395,7 +396,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v4HasTheCorrectEndLocationCoordinate() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v4", vrp.getVehicles()); assertEquals(1000.0, v.getEndLocation().getCoordinate().getX(), 0.01); @@ -405,7 +406,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v4HasTheCorrectStartLocationCoordinate() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v4", vrp.getVehicles()); assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01); @@ -415,7 +416,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v4HasTheCorrectLocationCoordinate() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v4", vrp.getVehicles()); assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01); @@ -425,7 +426,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v4HasTheCorrectLocationId() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v4", vrp.getVehicles()); assertEquals("startLoc", v.getStartLocation().getId()); @@ -434,7 +435,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_capOfShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(10, s.getSize().get(0)); @@ -443,7 +444,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_pickupServiceTimeOfShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(10.0, s.getPickupServiceTime(), 0.01); @@ -452,7 +453,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_pickupTimeWindowOfShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(1000.0, s.getPickupTimeWindow().getStart(), 0.01); @@ -462,7 +463,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_deliveryTimeWindowOfShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(6000.0, s.getDeliveryTimeWindow().getStart(), 0.01); @@ -472,7 +473,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_deliveryServiceTimeOfShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(100.0, s.getDeliveryServiceTime(), 0.01); @@ -481,7 +482,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_deliveryCoordShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(10.0, s.getDeliveryLocation().getCoordinate().getX(), 0.01); @@ -491,7 +492,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_pickupCoordShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals(10.0, s.getPickupLocation().getCoordinate().getX(), 0.01); @@ -501,7 +502,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_deliveryIdShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals("i(9,9)", s.getDeliveryLocation().getId()); @@ -510,7 +511,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_pickupIdShipment3IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("3"); assertEquals("i(3,9)", s.getPickupLocation().getId()); @@ -519,7 +520,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_pickupLocationIdShipment4IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("4"); assertEquals("[x=10.0][y=10.0]", s.getPickupLocation().getId()); @@ -528,7 +529,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_deliveryLocationIdShipment4IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("4"); assertEquals("[x=10.0][y=0.0]", s.getDeliveryLocation().getId()); @@ -537,7 +538,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_pickupServiceTimeOfShipment4IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("4"); assertEquals(0.0, s.getPickupServiceTime(), 0.01); @@ -546,7 +547,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingJobs_deliveryServiceTimeOfShipment4IsReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Shipment s = (Shipment) vrp.getJobs().get("4"); assertEquals(100.0, s.getDeliveryServiceTime(), 0.01); @@ -555,7 +556,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingFile_v5AndItsTypeHasTheCorrectCapacityDimensionValues() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read(inFileName); + new VrpXMLReader(builder, null).read(inputStream); VehicleRoutingProblem vrp = builder.build(); Vehicle v = getVehicle("v5", vrp.getVehicles()); assertEquals(100, v.getType().getCapacityDimensions().get(0)); @@ -569,7 +570,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingInitialRouteWithShipment4_thisShipmentShouldNotAppearInJobMap() { //since it is not part of the problem anymore VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); + new VrpXMLReader(builder).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml")); VehicleRoutingProblem vrp = builder.build(); assertFalse(vrp.getJobs().containsKey("4")); } @@ -577,7 +578,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingInitialRouteWithDepTime10_departureTimeOfRouteShouldBeReadCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); + new VrpXMLReader(builder).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml")); VehicleRoutingProblem vrp = builder.build(); assertEquals(10., vrp.getInitialVehicleRoutes().iterator().next().getDepartureTime(), 0.01); } @@ -585,7 +586,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingInitialRoute_nuInitialRoutesShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); + new VrpXMLReader(builder, null).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml")); VehicleRoutingProblem vrp = builder.build(); assertEquals(1, vrp.getInitialVehicleRoutes().size()); } @@ -593,7 +594,7 @@ public class VrpXMLReaderTest { @Test public void whenReadingInitialRoute_nuActivitiesShouldBeCorrect() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); + new VrpXMLReader(builder, null).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml")); VehicleRoutingProblem vrp = builder.build(); assertEquals(2, vrp.getInitialVehicleRoutes().iterator().next().getActivities().size()); } @@ -602,7 +603,7 @@ public class VrpXMLReaderTest { public void testRead_ifReaderIsCalled_itReadsSuccessfullyV2() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); ArrayList solutions = new ArrayList(); - new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpWithShipmentsAndSolution.xml"); + new VrpXMLReader(vrpBuilder, solutions).read(getClass().getResourceAsStream("finiteVrpWithShipmentsAndSolution.xml")); VehicleRoutingProblem vrp = vrpBuilder.build(); assertEquals(4, vrp.getJobs().size()); assertEquals(1, solutions.size()); @@ -618,7 +619,7 @@ public class VrpXMLReaderTest { @Test public void testRead_ifReaderIsCalled_itReadsSuccessfully() { - new VrpXMLReader(VehicleRoutingProblem.Builder.newInstance(), new ArrayList()).read("src/test/resources/lui-shen-solution.xml"); + new VrpXMLReader(VehicleRoutingProblem.Builder.newInstance(), new ArrayList()).read(getClass().getResourceAsStream("lui-shen-solution.xml")); assertTrue(true); } @@ -627,18 +628,12 @@ public class VrpXMLReaderTest { public void unassignedJobShouldBeRead() { VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); ArrayList solutions = new ArrayList(); - new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpWithShipmentsAndSolution.xml"); + new VrpXMLReader(vrpBuilder, solutions).read(getClass().getResourceAsStream("finiteVrpWithShipmentsAndSolution.xml")); VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); assertEquals(1, solution.getUnassignedJobs().size()); assertEquals("4", solution.getUnassignedJobs().iterator().next().getId()); } - -// @Test -// public void solutionListShouldBeEmpty(){ -// VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); -// ArrayList solutions = new ArrayList(); -// new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpforReaderTest.xml"); -// assertTrue(solutions.isEmpty()); -// } } + +// diff --git a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/io/VrpXMLWriterTest.java b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/VrpXMLWriterTest.java similarity index 93% rename from jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/io/VrpXMLWriterTest.java rename to jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/VrpXMLWriterTest.java index 13aad736..6819a469 100644 --- a/jsprit-core/src/test/java/com/graphhopper/jsprit/core/problem/io/VrpXMLWriterTest.java +++ b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/problem/VrpXMLWriterTest.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ -package com.graphhopper.jsprit.core.problem.io; +package com.graphhopper.jsprit.io.problem; import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem; @@ -28,7 +28,7 @@ import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl; import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl; import com.graphhopper.jsprit.core.util.Coordinate; import com.graphhopper.jsprit.core.util.Solutions; -import com.graphhopper.jsprit.core.util.TestUtils; +import com.graphhopper.jsprit.io.util.TestUtils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -895,68 +895,6 @@ public class VrpXMLWriterTest { return null; } - @Test - public void whenWritingAndReadingInitialRouteWithShipment4_thisShipmentShouldNotAppearInJobMap() { //since it is not part of the problem anymore - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); - VehicleRoutingProblem vrp = builder.build(); - - new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - - VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - VehicleRoutingProblem newVrp = newBuilder.build(); - - assertFalse(newVrp.getJobs().containsKey("4")); - } - - @Test - public void whenReadingInitialRouteWithDepTime10_departureTimeOfRouteShouldBeReadCorrectly() { - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); - VehicleRoutingProblem vrp = builder.build(); - - new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - - VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - VehicleRoutingProblem newVrp = newBuilder.build(); - - Assert.assertEquals(10., newVrp.getInitialVehicleRoutes().iterator().next().getDepartureTime(), 0.01); - } - - @Test - public void whenReadingInitialRoute_nuInitialRoutesShouldBeCorrect() { - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); - VehicleRoutingProblem vrp = builder.build(); - - new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - - VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - VehicleRoutingProblem newVrp = newBuilder.build(); - - - assertEquals(1, newVrp.getInitialVehicleRoutes().size()); - } - - @Test - public void whenReadingInitialRoute_nuActivitiesShouldBeCorrect() { - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); - VehicleRoutingProblem vrp = builder.build(); - - new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - - VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance(); - new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml"); - VehicleRoutingProblem newVrp = newBuilder.build(); - - - Assert.assertEquals(2, newVrp.getInitialVehicleRoutes().iterator().next().getActivities().size()); - } - @Test public void solutionWithoutUnassignedJobsShouldBeWrittenCorrectly() { VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); diff --git a/jsprit-io/src/test/java/com/graphhopper/jsprit/io/util/TestUtils.java b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/util/TestUtils.java new file mode 100644 index 00000000..d33dd711 --- /dev/null +++ b/jsprit-io/src/test/java/com/graphhopper/jsprit/io/util/TestUtils.java @@ -0,0 +1,22 @@ +package com.graphhopper.jsprit.io.util; + +import com.graphhopper.jsprit.core.problem.Location; +import com.graphhopper.jsprit.core.util.Coordinate; + +/** + * Created by schroeder on 19/12/14. + */ +public class TestUtils { + + public static Location loc(String id, Coordinate coordinate) { + return Location.Builder.newInstance().setId(id).setCoordinate(coordinate).build(); + } + + public static Location loc(String id) { + return Location.Builder.newInstance().setId(id).build(); + } + + public static Location loc(Coordinate coordinate) { + return Location.Builder.newInstance().setCoordinate(coordinate).build(); + } +} diff --git a/jsprit-core/src/test/resources/algorithmConfig.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfig.xml similarity index 100% rename from jsprit-core/src/test/resources/algorithmConfig.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfig.xml diff --git a/jsprit-core/src/test/resources/algorithmConfigForReaderTest.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfigForReaderTest.xml similarity index 100% rename from jsprit-core/src/test/resources/algorithmConfigForReaderTest.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfigForReaderTest.xml diff --git a/jsprit-core/src/test/resources/algorithmConfigForReaderTest2.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfigForReaderTest2.xml similarity index 100% rename from jsprit-core/src/test/resources/algorithmConfigForReaderTest2.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfigForReaderTest2.xml diff --git a/jsprit-core/src/test/resources/algorithmConfig_withoutIterations.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfig_withoutIterations.xml similarity index 100% rename from jsprit-core/src/test/resources/algorithmConfig_withoutIterations.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/algorithmConfig_withoutIterations.xml diff --git a/jsprit-core/src/test/resources/finiteVrp.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/finiteVrp.xml similarity index 100% rename from jsprit-core/src/test/resources/finiteVrp.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/finiteVrp.xml diff --git a/jsprit-core/src/test/resources/testConfig.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/testConfig.xml similarity index 100% rename from jsprit-core/src/test/resources/testConfig.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/algorithm/testConfig.xml diff --git a/jsprit-core/src/test/resources/biggerProblem.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/biggerProblem.xml similarity index 100% rename from jsprit-core/src/test/resources/biggerProblem.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/biggerProblem.xml diff --git a/jsprit-core/src/test/resources/finiteVrpForReaderTest.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/finiteVrpForReaderTest.xml similarity index 100% rename from jsprit-core/src/test/resources/finiteVrpForReaderTest.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/finiteVrpForReaderTest.xml diff --git a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/finiteVrpWithInitialSolutionForReaderTest.xml similarity index 100% rename from jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/finiteVrpWithInitialSolutionForReaderTest.xml diff --git a/jsprit-core/src/test/resources/finiteVrpWithShipmentsAndSolution.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/finiteVrpWithShipmentsAndSolution.xml similarity index 100% rename from jsprit-core/src/test/resources/finiteVrpWithShipmentsAndSolution.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/finiteVrpWithShipmentsAndSolution.xml diff --git a/jsprit-core/src/test/resources/lui-shen-solution.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/lui-shen-solution.xml similarity index 100% rename from jsprit-core/src/test/resources/lui-shen-solution.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/lui-shen-solution.xml diff --git a/jsprit-core/src/test/resources/simpleProblem_inclShipments_iniRoutes.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_inclShipments_iniRoutes.xml similarity index 100% rename from jsprit-core/src/test/resources/simpleProblem_inclShipments_iniRoutes.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_inclShipments_iniRoutes.xml diff --git a/jsprit-core/src/test/resources/simpleProblem_iniRoutes.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_iniRoutes.xml similarity index 100% rename from jsprit-core/src/test/resources/simpleProblem_iniRoutes.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_iniRoutes.xml diff --git a/jsprit-core/src/test/resources/simpleProblem_iniRoutes_2.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_iniRoutes_2.xml similarity index 100% rename from jsprit-core/src/test/resources/simpleProblem_iniRoutes_2.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_iniRoutes_2.xml diff --git a/jsprit-core/src/test/resources/simpleProblem_iniRoutes_3.xml b/jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_iniRoutes_3.xml similarity index 100% rename from jsprit-core/src/test/resources/simpleProblem_iniRoutes_3.xml rename to jsprit-io/src/test/resources/com/graphhopper/jsprit/io/problem/simpleProblem_iniRoutes_3.xml diff --git a/pom.xml b/pom.xml index e32a5622..2b2164fc 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ Stefan Schroeder - stefan.schroeder@jspr.it + stefan.schroeder@graphhopper.com @@ -77,6 +77,7 @@ jsprit-analysis jsprit-examples jsprit-instances + jsprit-io @@ -87,7 +88,7 @@ 1.3 1.7.21 false - + 3.0.4 @@ -272,16 +273,6 @@ test - - - - org.slf4j - slf4j-api - ${logger.version} - - - -