mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
merge jsprit-io
This commit is contained in:
commit
fce6f602c1
135 changed files with 1445 additions and 17536 deletions
|
|
@ -55,60 +55,25 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<!--<plugin>-->
|
||||
<!--<artifactId>maven-surefire-plugin</artifactId>-->
|
||||
<!--<version>2.18.1</version>-->
|
||||
<!--<configuration>-->
|
||||
<!--<excludedGroups>IntegrationTest</excludedGroups>-->
|
||||
<!--</configuration>-->
|
||||
<!--</plugin>-->
|
||||
<!--<plugin>-->
|
||||
<!--<artifactId>maven-failsafe-plugin</artifactId>-->
|
||||
<!--<version>2.18.1</version>-->
|
||||
<!--<configuration>-->
|
||||
<!--<includes>-->
|
||||
<!--<include>**/*.java</include>-->
|
||||
<!--</includes>-->
|
||||
<!--<groups>IntegrationTest</groups>-->
|
||||
<!--</configuration>-->
|
||||
<!--<executions>-->
|
||||
<!--<execution>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>integration-test</goal>-->
|
||||
<!--<goal>verify</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--</execution>-->
|
||||
<!--</executions>-->
|
||||
<!--</plugin>-->
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-configuration</groupId>
|
||||
<artifactId>commons-configuration</artifactId>
|
||||
<version>1.9</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-math3</artifactId>
|
||||
<version>3.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${logger.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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.
|
||||
* <p>
|
||||
* <p>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.
|
||||
* <p>
|
||||
* <p>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).
|
||||
* <p>
|
||||
* <p>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.
|
||||
* <p>
|
||||
* <p>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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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() {
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.io;
|
||||
|
||||
import org.apache.commons.configuration.XMLConfiguration;
|
||||
|
||||
public class AlgorithmConfig {
|
||||
|
||||
private XMLConfiguration xmlConfig;
|
||||
|
||||
public AlgorithmConfig() {
|
||||
xmlConfig = new XMLConfiguration();
|
||||
|
||||
}
|
||||
|
||||
public XMLConfiguration getXMLConfiguration() {
|
||||
return xmlConfig;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,91 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.io;
|
||||
|
||||
import com.graphhopper.jsprit.core.util.Resource;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
|
||||
public class AlgorithmConfigXmlReader {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(AlgorithmConfigXmlReader.class.getName());
|
||||
|
||||
private AlgorithmConfig algorithmConfig;
|
||||
|
||||
private boolean schemaValidation = true;
|
||||
|
||||
/**
|
||||
* @param schemaValidation the schemaValidation to set
|
||||
*/
|
||||
public AlgorithmConfigXmlReader setSchemaValidation(boolean schemaValidation) {
|
||||
this.schemaValidation = schemaValidation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlgorithmConfigXmlReader(AlgorithmConfig algorithmConfig) {
|
||||
this.algorithmConfig = algorithmConfig;
|
||||
}
|
||||
|
||||
public void read(URL url) {
|
||||
log.debug("read algorithm: " + url);
|
||||
algorithmConfig.getXMLConfiguration().setURL(url);
|
||||
algorithmConfig.getXMLConfiguration().setAttributeSplittingDisabled(true);
|
||||
algorithmConfig.getXMLConfiguration().setDelimiterParsingDisabled(true);
|
||||
|
||||
if (schemaValidation) {
|
||||
final InputStream resource = Resource.getAsInputStream("algorithm_schema.xsd");
|
||||
if (resource != null) {
|
||||
EntityResolver resolver = new EntityResolver() {
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
|
||||
{
|
||||
InputSource is = new InputSource(resource);
|
||||
return is;
|
||||
}
|
||||
}
|
||||
};
|
||||
algorithmConfig.getXMLConfiguration().setEntityResolver(resolver);
|
||||
algorithmConfig.getXMLConfiguration().setSchemaValidation(true);
|
||||
} else {
|
||||
log.warn("cannot find schema-xsd file (algorithm_xml_schema.xsd). try to read xml without xml-file-validation.");
|
||||
}
|
||||
}
|
||||
try {
|
||||
algorithmConfig.getXMLConfiguration().load();
|
||||
} catch (ConfigurationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void read(String filename) {
|
||||
log.debug("read algorithm-config from file " + filename);
|
||||
URL url = Resource.getAsURL(filename);
|
||||
read(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,115 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.io;
|
||||
|
||||
import com.graphhopper.jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners;
|
||||
import com.graphhopper.jsprit.core.algorithm.recreate.InsertionBuilder;
|
||||
import com.graphhopper.jsprit.core.algorithm.recreate.InsertionStrategy;
|
||||
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.vehicle.VehicleFleetManager;
|
||||
import org.apache.commons.configuration.HierarchicalConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
|
||||
class InsertionFactory {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(InsertionFactory.class.getName());
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static InsertionStrategy createInsertion(VehicleRoutingProblem vrp, HierarchicalConfiguration config,
|
||||
VehicleFleetManager vehicleFleetManager, StateManager stateManager, List<VehicleRoutingAlgorithmListeners.PrioritizedVRAListener> algorithmListeners, ExecutorService executorService, int nuOfThreads, ConstraintManager constraintManager, boolean addDefaultCostCalculators) {
|
||||
|
||||
if (config.containsKey("[@name]")) {
|
||||
String insertionName = config.getString("[@name]");
|
||||
if (!insertionName.equals("bestInsertion") && !insertionName.equals("regretInsertion")) {
|
||||
throw new IllegalStateException(insertionName + " is not supported. use either \"bestInsertion\" or \"regretInsertion\"");
|
||||
}
|
||||
|
||||
|
||||
InsertionBuilder iBuilder = new InsertionBuilder(vrp, vehicleFleetManager, stateManager, constraintManager);
|
||||
|
||||
if (executorService != null) {
|
||||
iBuilder.setConcurrentMode(executorService, nuOfThreads);
|
||||
}
|
||||
|
||||
if (config.containsKey("level")) {
|
||||
String level = config.getString("level");
|
||||
if (level.equals("local")) {
|
||||
iBuilder.setLocalLevel(addDefaultCostCalculators);
|
||||
} else if (level.equals("route")) {
|
||||
int forwardLooking = 0;
|
||||
int memory = 1;
|
||||
String forward = config.getString("level[@forwardLooking]");
|
||||
String mem = config.getString("level[@memory]");
|
||||
if (forward != null) forwardLooking = Integer.parseInt(forward);
|
||||
else
|
||||
log.warn("parameter route[@forwardLooking] is missing. by default it is 0 which equals to local level");
|
||||
if (mem != null) memory = Integer.parseInt(mem);
|
||||
else log.warn("parameter route[@memory] is missing. by default it is 1");
|
||||
iBuilder.setRouteLevel(forwardLooking, memory, addDefaultCostCalculators);
|
||||
} else
|
||||
throw new IllegalStateException("level " + level + " is not known. currently it only knows \"local\" or \"route\"");
|
||||
} else iBuilder.setLocalLevel(addDefaultCostCalculators);
|
||||
|
||||
if (config.containsKey("considerFixedCosts") || config.containsKey("considerFixedCost")) {
|
||||
if (addDefaultCostCalculators) {
|
||||
String val = config.getString("considerFixedCosts");
|
||||
if (val == null) val = config.getString("considerFixedCost");
|
||||
if (val.equals("true")) {
|
||||
double fixedCostWeight = 0.5;
|
||||
String weight = config.getString("considerFixedCosts[@weight]");
|
||||
if (weight == null) weight = config.getString("considerFixedCost[@weight]");
|
||||
if (weight != null) fixedCostWeight = Double.parseDouble(weight);
|
||||
else
|
||||
throw new IllegalStateException("fixedCostsParameter 'weight' must be set, e.g. <considerFixedCosts weight=1.0>true</considerFixedCosts>.\n" +
|
||||
"this has to be changed in algorithm-config-xml-file.");
|
||||
iBuilder.considerFixedCosts(fixedCostWeight);
|
||||
} else if (val.equals("false")) {
|
||||
|
||||
} else
|
||||
throw new IllegalStateException("considerFixedCosts must either be true or false, i.e. <considerFixedCosts weight=1.0>true</considerFixedCosts> or \n<considerFixedCosts weight=1.0>false</considerFixedCosts>. " +
|
||||
"if latter, you can also omit the tag. this has to be changed in algorithm-config-xml-file");
|
||||
}
|
||||
}
|
||||
String allowVehicleSwitch = config.getString("allowVehicleSwitch");
|
||||
if (allowVehicleSwitch != null) {
|
||||
iBuilder.setAllowVehicleSwitch(Boolean.parseBoolean(allowVehicleSwitch));
|
||||
}
|
||||
|
||||
if (insertionName.equals("regretInsertion")) {
|
||||
iBuilder.setInsertionStrategy(InsertionBuilder.Strategy.REGRET);
|
||||
|
||||
String fastRegret = config.getString("fastRegret");
|
||||
if (fastRegret != null) {
|
||||
iBuilder.setFastRegret(Boolean.parseBoolean(fastRegret));
|
||||
}
|
||||
}
|
||||
return iBuilder.build();
|
||||
} else throw new IllegalStateException("cannot create insertionStrategy, since it has no name.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,907 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.io;
|
||||
|
||||
|
||||
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;
|
||||
import com.graphhopper.jsprit.core.algorithm.module.RuinAndRecreateModule;
|
||||
import com.graphhopper.jsprit.core.algorithm.recreate.InsertionStrategy;
|
||||
import com.graphhopper.jsprit.core.algorithm.recreate.listener.InsertionListener;
|
||||
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.ruin.distance.JobDistance;
|
||||
import com.graphhopper.jsprit.core.algorithm.selector.SelectBest;
|
||||
import com.graphhopper.jsprit.core.algorithm.selector.SelectRandomly;
|
||||
import com.graphhopper.jsprit.core.algorithm.selector.SolutionSelector;
|
||||
import com.graphhopper.jsprit.core.algorithm.state.*;
|
||||
import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||
import com.graphhopper.jsprit.core.algorithm.termination.PrematureAlgorithmTermination;
|
||||
import com.graphhopper.jsprit.core.algorithm.termination.TimeTermination;
|
||||
import com.graphhopper.jsprit.core.algorithm.termination.VariationCoefficientTermination;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager;
|
||||
import com.graphhopper.jsprit.core.problem.constraint.SwitchNotFeasible;
|
||||
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.solution.route.activity.End;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.ReverseActivityVisitor;
|
||||
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 org.apache.commons.configuration.HierarchicalConfiguration;
|
||||
import org.apache.commons.configuration.XMLConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class VehicleRoutingAlgorithms {
|
||||
|
||||
static class TypedMap {
|
||||
|
||||
static interface AbstractKey<K> {
|
||||
|
||||
Class<K> getType();
|
||||
}
|
||||
|
||||
static class AcceptorKey implements AbstractKey<SolutionAcceptor> {
|
||||
|
||||
private ModKey modKey;
|
||||
|
||||
public AcceptorKey(ModKey modKey) {
|
||||
super();
|
||||
this.modKey = modKey;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((modKey == null) ? 0 : modKey.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj instanceof AcceptorKey))
|
||||
return false;
|
||||
AcceptorKey other = (AcceptorKey) obj;
|
||||
if (modKey == null) {
|
||||
if (other.modKey != null)
|
||||
return false;
|
||||
} else if (!modKey.equals(other.modKey))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<SolutionAcceptor> getType() {
|
||||
return SolutionAcceptor.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class SelectorKey implements AbstractKey<SolutionSelector> {
|
||||
|
||||
private ModKey modKey;
|
||||
|
||||
public SelectorKey(ModKey modKey) {
|
||||
super();
|
||||
this.modKey = modKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((modKey == null) ? 0 : modKey.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SelectorKey other = (SelectorKey) obj;
|
||||
if (modKey == null) {
|
||||
if (other.modKey != null)
|
||||
return false;
|
||||
} else if (!modKey.equals(other.modKey))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<SolutionSelector> getType() {
|
||||
return SolutionSelector.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class StrategyModuleKey implements AbstractKey<SearchStrategyModule> {
|
||||
|
||||
private ModKey modKey;
|
||||
|
||||
public StrategyModuleKey(ModKey modKey) {
|
||||
super();
|
||||
this.modKey = modKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((modKey == null) ? 0 : modKey.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
StrategyModuleKey other = (StrategyModuleKey) obj;
|
||||
if (modKey == null) {
|
||||
if (other.modKey != null)
|
||||
return false;
|
||||
} else if (!modKey.equals(other.modKey))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<SearchStrategyModule> getType() {
|
||||
return SearchStrategyModule.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class RuinStrategyKey implements AbstractKey<RuinStrategy> {
|
||||
|
||||
private ModKey modKey;
|
||||
|
||||
public RuinStrategyKey(ModKey modKey) {
|
||||
super();
|
||||
this.modKey = modKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((modKey == null) ? 0 : modKey.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RuinStrategyKey other = (RuinStrategyKey) obj;
|
||||
if (modKey == null) {
|
||||
if (other.modKey != null)
|
||||
return false;
|
||||
} else if (!modKey.equals(other.modKey))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<RuinStrategy> getType() {
|
||||
return RuinStrategy.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class InsertionStrategyKey implements AbstractKey<InsertionStrategy> {
|
||||
|
||||
private ModKey modKey;
|
||||
|
||||
public InsertionStrategyKey(ModKey modKey) {
|
||||
super();
|
||||
this.modKey = modKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((modKey == null) ? 0 : modKey.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
InsertionStrategyKey other = (InsertionStrategyKey) obj;
|
||||
if (modKey == null) {
|
||||
if (other.modKey != null)
|
||||
return false;
|
||||
} else if (!modKey.equals(other.modKey))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<InsertionStrategy> getType() {
|
||||
return InsertionStrategy.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map<AbstractKey<?>, Object> map = new HashMap<AbstractKey<?>, Object>();
|
||||
|
||||
public <T> T get(AbstractKey<T> key) {
|
||||
if (map.get(key) == null) return null;
|
||||
return key.getType().cast(map.get(key));
|
||||
}
|
||||
|
||||
public <T> T put(AbstractKey<T> key, T value) {
|
||||
return key.getType().cast(map.put(key, key.getType().cast(value)));
|
||||
}
|
||||
|
||||
public Set<AbstractKey<?>> keySet() {
|
||||
return map.keySet();
|
||||
}
|
||||
}
|
||||
|
||||
static class ModKey {
|
||||
private String name;
|
||||
private String id;
|
||||
|
||||
public ModKey(String name, String id) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ModKey other = (ModKey) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(VehicleRoutingAlgorithms.class.getName());
|
||||
|
||||
private VehicleRoutingAlgorithms() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm} from a AlgorithConfig based on the input vrp.
|
||||
*
|
||||
* @param vrp the routing problem
|
||||
* @param algorithmConfig the algorithm config
|
||||
* @return {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm}
|
||||
*/
|
||||
public static VehicleRoutingAlgorithm createAlgorithm(final VehicleRoutingProblem vrp, final AlgorithmConfig algorithmConfig) {
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), 0, null);
|
||||
}
|
||||
|
||||
public static VehicleRoutingAlgorithm createAlgorithm(final VehicleRoutingProblem vrp, int nThreads, final AlgorithmConfig algorithmConfig) {
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), nThreads, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and creates a {@link VehicleRoutingAlgorithm} from an url.
|
||||
*
|
||||
* @param vrp the routing problem
|
||||
* @param configURL config url
|
||||
* @return {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm}
|
||||
*/
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final URL configURL) {
|
||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||
xmlReader.read(configURL);
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), 0, null);
|
||||
}
|
||||
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, int nThreads, final URL configURL) {
|
||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||
xmlReader.read(configURL);
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), nThreads, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and creates {@link com.graphhopper.jsprit.core.problem.VehicleRoutingProblem} from config-file.
|
||||
*
|
||||
* @param vrp the routing problem
|
||||
* @param configFileName the config filename (and location)
|
||||
* @return {@link com.graphhopper.jsprit.core.algorithm.VehicleRoutingAlgorithm}
|
||||
*/
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final String configFileName) {
|
||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||
xmlReader.read(configFileName);
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), 0, null);
|
||||
}
|
||||
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final String configFileName, StateManager stateManager) {
|
||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||
xmlReader.read(configFileName);
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), 0, stateManager);
|
||||
}
|
||||
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, int nThreads, final String configFileName, StateManager stateManager) {
|
||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||
xmlReader.read(configFileName);
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), nThreads, stateManager);
|
||||
}
|
||||
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(VehicleRoutingProblem vrp, int nThreads, String configFileName) {
|
||||
AlgorithmConfig algorithmConfig = new AlgorithmConfig();
|
||||
AlgorithmConfigXmlReader xmlReader = new AlgorithmConfigXmlReader(algorithmConfig);
|
||||
xmlReader.read(configFileName);
|
||||
return createAlgo(vrp, algorithmConfig.getXMLConfiguration(), nThreads, null);
|
||||
}
|
||||
|
||||
private static class OpenRouteStateVerifier implements StateUpdater, ReverseActivityVisitor {
|
||||
|
||||
private End end;
|
||||
|
||||
private boolean firstAct = true;
|
||||
|
||||
private Vehicle vehicle;
|
||||
|
||||
@Override
|
||||
public void begin(VehicleRoute route) {
|
||||
end = route.getEnd();
|
||||
vehicle = route.getVehicle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(TourActivity activity) {
|
||||
if (firstAct) {
|
||||
firstAct = false;
|
||||
if (!vehicle.isReturnToDepot()) {
|
||||
assert activity.getLocation().getId().equals(end.getLocation().getId()) : "route end and last activity are not equal even route is open. this should not be.";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
firstAct = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static VehicleRoutingAlgorithm createAlgo(final VehicleRoutingProblem vrp, XMLConfiguration config, int nuOfThreads, StateManager stateMan) {
|
||||
//create state-manager
|
||||
final StateManager stateManager;
|
||||
if (stateMan != null) {
|
||||
stateManager = stateMan;
|
||||
} else {
|
||||
stateManager = new StateManager(vrp);
|
||||
}
|
||||
stateManager.updateLoadStates();
|
||||
stateManager.updateTimeWindowStates();
|
||||
stateManager.updateSkillStates();
|
||||
stateManager.addStateUpdater(new UpdateEndLocationIfRouteIsOpen());
|
||||
stateManager.addStateUpdater(new OpenRouteStateVerifier());
|
||||
// stateManager.addStateUpdater(new UpdateActivityTimes(vrp.getTransportCosts()));
|
||||
// stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager));
|
||||
|
||||
/*
|
||||
* define constraints
|
||||
*/
|
||||
//constraint manager
|
||||
ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager);
|
||||
constraintManager.addTimeWindowConstraint();
|
||||
constraintManager.addLoadConstraint();
|
||||
constraintManager.addSkillsConstraint();
|
||||
constraintManager.addConstraint(new SwitchNotFeasible(stateManager));
|
||||
|
||||
return readAndCreateAlgorithm(vrp, config, nuOfThreads, null, stateManager, constraintManager, true);
|
||||
}
|
||||
|
||||
public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, AlgorithmConfig config,
|
||||
int nuOfThreads, SolutionCostCalculator solutionCostCalculator, final StateManager stateManager, ConstraintManager constraintManager, boolean addDefaultCostCalculators) {
|
||||
return readAndCreateAlgorithm(vrp, config.getXMLConfiguration(), nuOfThreads, solutionCostCalculator, stateManager, constraintManager, addDefaultCostCalculators);
|
||||
}
|
||||
|
||||
private static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, XMLConfiguration config,
|
||||
int nuOfThreads, final SolutionCostCalculator solutionCostCalculator, final StateManager stateManager, ConstraintManager constraintManager, boolean addDefaultCostCalculators) {
|
||||
// map to store constructed modules
|
||||
TypedMap definedClasses = new TypedMap();
|
||||
|
||||
// algorithm listeners
|
||||
Set<PrioritizedVRAListener> algorithmListeners = new HashSet<PrioritizedVRAListener>();
|
||||
|
||||
// insertion listeners
|
||||
List<InsertionListener> insertionListeners = new ArrayList<InsertionListener>();
|
||||
|
||||
|
||||
//threading
|
||||
final ExecutorService executorService;
|
||||
if (nuOfThreads > 0) {
|
||||
log.debug("setup executor-service with " + nuOfThreads + " threads");
|
||||
executorService = Executors.newFixedThreadPool(nuOfThreads);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, new AlgorithmEndsListener() {
|
||||
|
||||
@Override
|
||||
public void informAlgorithmEnds(VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
log.debug("shutdown executor-service");
|
||||
executorService.shutdown();
|
||||
}
|
||||
}));
|
||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread arg0, Throwable arg1) {
|
||||
System.err.println(arg1.toString());
|
||||
}
|
||||
});
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
if (!executorService.isShutdown()) {
|
||||
System.err.println("shutdowHook shuts down executorService");
|
||||
executorService.shutdown();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else executorService = null;
|
||||
|
||||
|
||||
//create fleetmanager
|
||||
final VehicleFleetManager vehicleFleetManager = createFleetManager(vrp);
|
||||
|
||||
String switchString = config.getString("construction.insertion.allowVehicleSwitch");
|
||||
final boolean switchAllowed;
|
||||
if (switchString != null) {
|
||||
switchAllowed = Boolean.parseBoolean(switchString);
|
||||
} else switchAllowed = true;
|
||||
ActivityTimeTracker.ActivityPolicy activityPolicy;
|
||||
if (stateManager.timeWindowUpdateIsActivated()) {
|
||||
UpdateVehicleDependentPracticalTimeWindows timeWindowUpdater = new UpdateVehicleDependentPracticalTimeWindows(stateManager, vrp.getTransportCosts(), vrp.getActivityCosts());
|
||||
timeWindowUpdater.setVehiclesToUpdate(new UpdateVehicleDependentPracticalTimeWindows.VehiclesToUpdate() {
|
||||
Map<VehicleTypeKey, Vehicle> uniqueTypes = new HashMap<VehicleTypeKey, Vehicle>();
|
||||
|
||||
@Override
|
||||
public Collection<Vehicle> get(VehicleRoute vehicleRoute) {
|
||||
if (uniqueTypes.isEmpty()) {
|
||||
for (Vehicle v : vrp.getVehicles()) {
|
||||
if (!uniqueTypes.containsKey(v.getVehicleTypeIdentifier())) {
|
||||
uniqueTypes.put(v.getVehicleTypeIdentifier(), v);
|
||||
}
|
||||
}
|
||||
}
|
||||
Collection<Vehicle> vehicles = new ArrayList<Vehicle>();
|
||||
vehicles.addAll(uniqueTypes.values());
|
||||
return vehicles;
|
||||
}
|
||||
});
|
||||
stateManager.addStateUpdater(timeWindowUpdater);
|
||||
activityPolicy = ActivityTimeTracker.ActivityPolicy.AS_SOON_AS_TIME_WINDOW_OPENS;
|
||||
} else {
|
||||
activityPolicy = ActivityTimeTracker.ActivityPolicy.AS_SOON_AS_ARRIVED;
|
||||
}
|
||||
stateManager.addStateUpdater(new UpdateActivityTimes(vrp.getTransportCosts(), activityPolicy, vrp.getActivityCosts()));
|
||||
stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager, activityPolicy));
|
||||
|
||||
final SolutionCostCalculator costCalculator;
|
||||
if (solutionCostCalculator == null) costCalculator = getDefaultCostCalculator(stateManager);
|
||||
else costCalculator = solutionCostCalculator;
|
||||
|
||||
PrettyAlgorithmBuilder prettyAlgorithmBuilder = PrettyAlgorithmBuilder.newInstance(vrp, vehicleFleetManager, stateManager, constraintManager);
|
||||
//construct initial solution creator
|
||||
final InsertionStrategy initialInsertionStrategy = createInitialSolution(config, vrp, vehicleFleetManager, stateManager, algorithmListeners, definedClasses, executorService, nuOfThreads, costCalculator, constraintManager, addDefaultCostCalculators);
|
||||
if (initialInsertionStrategy != null)
|
||||
prettyAlgorithmBuilder.constructInitialSolutionWith(initialInsertionStrategy, costCalculator);
|
||||
|
||||
//construct algorithm, i.e. search-strategies and its modules
|
||||
int solutionMemory = config.getInt("strategy.memory");
|
||||
List<HierarchicalConfiguration> strategyConfigs = config.configurationsAt("strategy.searchStrategies.searchStrategy");
|
||||
for (HierarchicalConfiguration strategyConfig : strategyConfigs) {
|
||||
String name = getName(strategyConfig);
|
||||
SolutionAcceptor acceptor = getAcceptor(strategyConfig, vrp, algorithmListeners, definedClasses, solutionMemory);
|
||||
SolutionSelector selector = getSelector(strategyConfig, vrp, algorithmListeners, definedClasses);
|
||||
|
||||
SearchStrategy strategy = new SearchStrategy(name, selector, acceptor, costCalculator);
|
||||
strategy.setName(name);
|
||||
List<HierarchicalConfiguration> modulesConfig = strategyConfig.configurationsAt("modules.module");
|
||||
for (HierarchicalConfiguration moduleConfig : modulesConfig) {
|
||||
SearchStrategyModule module = buildModule(moduleConfig, vrp, vehicleFleetManager, stateManager, algorithmListeners, definedClasses, executorService, nuOfThreads, constraintManager, addDefaultCostCalculators);
|
||||
strategy.addModule(module);
|
||||
}
|
||||
prettyAlgorithmBuilder.withStrategy(strategy, strategyConfig.getDouble("probability"));
|
||||
}
|
||||
|
||||
//construct algorithm
|
||||
VehicleRoutingAlgorithm metaAlgorithm = prettyAlgorithmBuilder.build();
|
||||
int maxIterations = getMaxIterations(config);
|
||||
if (maxIterations > -1) metaAlgorithm.setMaxIterations(maxIterations);
|
||||
|
||||
//define prematureBreak
|
||||
PrematureAlgorithmTermination prematureAlgorithmTermination = getPrematureTermination(config, algorithmListeners);
|
||||
if (prematureAlgorithmTermination != null)
|
||||
metaAlgorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination);
|
||||
else {
|
||||
List<HierarchicalConfiguration> terminationCriteria = config.configurationsAt("terminationCriteria.termination");
|
||||
for (HierarchicalConfiguration terminationConfig : terminationCriteria) {
|
||||
PrematureAlgorithmTermination termination = getTerminationCriterion(terminationConfig, algorithmListeners);
|
||||
if (termination != null) metaAlgorithm.addTerminationCriterion(termination);
|
||||
}
|
||||
}
|
||||
for (PrioritizedVRAListener l : algorithmListeners) {
|
||||
metaAlgorithm.getAlgorithmListeners().add(l);
|
||||
}
|
||||
return metaAlgorithm;
|
||||
}
|
||||
|
||||
private static int getMaxIterations(XMLConfiguration config) {
|
||||
String maxIterationsString = config.getString("iterations");
|
||||
if (maxIterationsString == null) maxIterationsString = config.getString("maxIterations");
|
||||
if (maxIterationsString != null) return (Integer.parseInt(maxIterationsString));
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static SolutionCostCalculator getDefaultCostCalculator(final StateManager stateManager) {
|
||||
return new VariablePlusFixedSolutionCostCalculatorFactory(stateManager).createCalculator();
|
||||
}
|
||||
|
||||
private static VehicleFleetManager createFleetManager(final VehicleRoutingProblem vrp) {
|
||||
if (vrp.getFleetSize().equals(FleetSize.INFINITE)) {
|
||||
return new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();
|
||||
|
||||
} else if (vrp.getFleetSize().equals(FleetSize.FINITE)) {
|
||||
return new FiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();
|
||||
}
|
||||
throw new IllegalStateException("fleet size can only be infinite or finite. " +
|
||||
"makes sure your config file contains one of these options");
|
||||
}
|
||||
|
||||
private static PrematureAlgorithmTermination getTerminationCriterion(HierarchicalConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) {
|
||||
String basedOn = config.getString("[@basedOn]");
|
||||
if (basedOn == null) {
|
||||
log.debug("set default prematureBreak, i.e. no premature break at all.");
|
||||
return null;
|
||||
}
|
||||
if (basedOn.equals("iterations")) {
|
||||
log.debug("set prematureBreak based on iterations");
|
||||
String iter = config.getString("iterations");
|
||||
if (iter == null) throw new IllegalStateException("iterations is missing");
|
||||
int iterations = Integer.valueOf(iter);
|
||||
return new IterationWithoutImprovementTermination(iterations);
|
||||
}
|
||||
if (basedOn.equals("time")) {
|
||||
log.debug("set prematureBreak based on time");
|
||||
String timeString = config.getString("time");
|
||||
if (timeString == null) throw new IllegalStateException("time is missing");
|
||||
long time = Long.parseLong(timeString);
|
||||
TimeTermination timeBreaker = new TimeTermination(time);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, timeBreaker));
|
||||
return timeBreaker;
|
||||
}
|
||||
if (basedOn.equals("variationCoefficient")) {
|
||||
log.debug("set prematureBreak based on variation coefficient");
|
||||
String thresholdString = config.getString("threshold");
|
||||
String iterationsString = config.getString("iterations");
|
||||
if (thresholdString == null) throw new IllegalStateException("threshold is missing");
|
||||
if (iterationsString == null) throw new IllegalStateException("iterations is missing");
|
||||
double threshold = Double.valueOf(thresholdString);
|
||||
int iterations = Integer.valueOf(iterationsString);
|
||||
VariationCoefficientTermination variationCoefficientBreaker = new VariationCoefficientTermination(iterations, threshold);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, variationCoefficientBreaker));
|
||||
return variationCoefficientBreaker;
|
||||
}
|
||||
throw new IllegalStateException("prematureBreak basedOn " + basedOn + " is not defined");
|
||||
}
|
||||
|
||||
private static PrematureAlgorithmTermination getPrematureTermination(XMLConfiguration config, Set<PrioritizedVRAListener> algorithmListeners) {
|
||||
String basedOn = config.getString("prematureBreak[@basedOn]");
|
||||
if (basedOn == null) {
|
||||
log.debug("set default prematureBreak, i.e. no premature break at all.");
|
||||
return null;
|
||||
}
|
||||
if (basedOn.equals("iterations")) {
|
||||
log.debug("set prematureBreak based on iterations");
|
||||
String iter = config.getString("prematureBreak.iterations");
|
||||
if (iter == null) throw new IllegalStateException("prematureBreak.iterations is missing");
|
||||
int iterations = Integer.valueOf(iter);
|
||||
return new IterationWithoutImprovementTermination(iterations);
|
||||
}
|
||||
if (basedOn.equals("time")) {
|
||||
log.debug("set prematureBreak based on time");
|
||||
String timeString = config.getString("prematureBreak.time");
|
||||
if (timeString == null) throw new IllegalStateException("prematureBreak.time is missing");
|
||||
long time = Long.parseLong(timeString);
|
||||
TimeTermination timeBreaker = new TimeTermination(time);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, timeBreaker));
|
||||
return timeBreaker;
|
||||
}
|
||||
if (basedOn.equals("variationCoefficient")) {
|
||||
log.debug("set prematureBreak based on variation coefficient");
|
||||
String thresholdString = config.getString("prematureBreak.threshold");
|
||||
String iterationsString = config.getString("prematureBreak.iterations");
|
||||
if (thresholdString == null) throw new IllegalStateException("prematureBreak.threshold is missing");
|
||||
if (iterationsString == null) throw new IllegalStateException("prematureBreak.iterations is missing");
|
||||
double threshold = Double.valueOf(thresholdString);
|
||||
int iterations = Integer.valueOf(iterationsString);
|
||||
VariationCoefficientTermination variationCoefficientBreaker = new VariationCoefficientTermination(iterations, threshold);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, variationCoefficientBreaker));
|
||||
return variationCoefficientBreaker;
|
||||
}
|
||||
throw new IllegalStateException("prematureBreak basedOn " + basedOn + " is not defined");
|
||||
}
|
||||
|
||||
private static String getName(HierarchicalConfiguration strategyConfig) {
|
||||
if (strategyConfig.containsKey("[@name]")) {
|
||||
return strategyConfig.getString("[@name]");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static InsertionStrategy createInitialSolution(XMLConfiguration config, final VehicleRoutingProblem vrp, VehicleFleetManager vehicleFleetManager, final StateManager routeStates, Set<PrioritizedVRAListener> algorithmListeners, TypedMap definedClasses, ExecutorService executorService, int nuOfThreads, final SolutionCostCalculator solutionCostCalculator, ConstraintManager constraintManager, boolean addDefaultCostCalculators) {
|
||||
List<HierarchicalConfiguration> modConfigs = config.configurationsAt("construction.insertion");
|
||||
if (modConfigs == null) return null;
|
||||
if (modConfigs.isEmpty()) return null;
|
||||
if (modConfigs.size() != 1) throw new IllegalStateException("#construction.modules != 1. 1 expected");
|
||||
HierarchicalConfiguration modConfig = modConfigs.get(0);
|
||||
String insertionName = modConfig.getString("[@name]");
|
||||
if (insertionName == null) throw new IllegalStateException("insertion[@name] is missing.");
|
||||
String insertionId = modConfig.getString("[@id]");
|
||||
if (insertionId == null) insertionId = "noId";
|
||||
ModKey modKey = makeKey(insertionName, insertionId);
|
||||
InsertionStrategyKey insertionStrategyKey = new InsertionStrategyKey(modKey);
|
||||
InsertionStrategy insertionStrategy = definedClasses.get(insertionStrategyKey);
|
||||
if (insertionStrategy == null) {
|
||||
List<PrioritizedVRAListener> prioListeners = new ArrayList<PrioritizedVRAListener>();
|
||||
insertionStrategy = createInsertionStrategy(modConfig, vrp, vehicleFleetManager, routeStates, prioListeners, executorService, nuOfThreads, constraintManager, addDefaultCostCalculators);
|
||||
algorithmListeners.addAll(prioListeners);
|
||||
definedClasses.put(insertionStrategyKey, insertionStrategy);
|
||||
}
|
||||
return insertionStrategy;
|
||||
}
|
||||
|
||||
private static SolutionSelector getSelector(HierarchicalConfiguration strategyConfig, VehicleRoutingProblem vrp, Set<PrioritizedVRAListener> algorithmListeners, TypedMap definedSelectors) {
|
||||
String selectorName = strategyConfig.getString("selector[@name]");
|
||||
if (selectorName == null)
|
||||
throw new IllegalStateException("no solutionSelector defined. define either \"selectRandomly\" or \"selectBest\"");
|
||||
String selectorId = strategyConfig.getString("selector[@id]");
|
||||
if (selectorId == null) selectorId = "noId";
|
||||
ModKey modKey = makeKey(selectorName, selectorId);
|
||||
SelectorKey selectorKey = new SelectorKey(modKey);
|
||||
SolutionSelector definedSelector = definedSelectors.get(selectorKey);
|
||||
if (definedSelector != null) {
|
||||
return definedSelector;
|
||||
}
|
||||
if (selectorName.equals("selectRandomly")) {
|
||||
SelectRandomly selector = SelectRandomly.getInstance();
|
||||
definedSelectors.put(selectorKey, selector);
|
||||
return selector;
|
||||
}
|
||||
if (selectorName.equals("selectBest")) {
|
||||
SelectBest selector = SelectBest.getInstance();
|
||||
definedSelectors.put(selectorKey, selector);
|
||||
return selector;
|
||||
}
|
||||
throw new IllegalStateException("solutionSelector is not know. Currently, it only knows \"selectRandomly\" and \"selectBest\"");
|
||||
}
|
||||
|
||||
private static ModKey makeKey(String name, String id) {
|
||||
return new ModKey(name, id);
|
||||
}
|
||||
|
||||
private static SolutionAcceptor getAcceptor(HierarchicalConfiguration strategyConfig, VehicleRoutingProblem vrp, Set<PrioritizedVRAListener> algorithmListeners, TypedMap typedMap, int solutionMemory) {
|
||||
String acceptorName = strategyConfig.getString("acceptor[@name]");
|
||||
if (acceptorName == null) throw new IllegalStateException("no solution acceptor is defined");
|
||||
String acceptorId = strategyConfig.getString("acceptor[@id]");
|
||||
if (acceptorId == null) acceptorId = "noId";
|
||||
AcceptorKey acceptorKey = new AcceptorKey(makeKey(acceptorName, acceptorId));
|
||||
SolutionAcceptor definedAcceptor = typedMap.get(acceptorKey);
|
||||
if (definedAcceptor != null) return definedAcceptor;
|
||||
if (acceptorName.equals("acceptNewRemoveWorst")) {
|
||||
GreedyAcceptance acceptor = new GreedyAcceptance(solutionMemory);
|
||||
typedMap.put(acceptorKey, acceptor);
|
||||
return acceptor;
|
||||
}
|
||||
if (acceptorName.equals("acceptNewRemoveFirst")) {
|
||||
AcceptNewRemoveFirst acceptor = new AcceptNewRemoveFirst(solutionMemory);
|
||||
typedMap.put(acceptorKey, acceptor);
|
||||
return acceptor;
|
||||
}
|
||||
if (acceptorName.equals("greedyAcceptance")) {
|
||||
GreedyAcceptance acceptor = new GreedyAcceptance(solutionMemory);
|
||||
typedMap.put(acceptorKey, acceptor);
|
||||
return acceptor;
|
||||
}
|
||||
if (acceptorName.equals("schrimpfAcceptance")) {
|
||||
String nuWarmupIterations = strategyConfig.getString("acceptor.warmup");
|
||||
double alpha = strategyConfig.getDouble("acceptor.alpha");
|
||||
SchrimpfAcceptance schrimpf = new SchrimpfAcceptance(solutionMemory, alpha);
|
||||
if (nuWarmupIterations != null) {
|
||||
SchrimpfInitialThresholdGenerator iniThresholdGenerator = new SchrimpfInitialThresholdGenerator(schrimpf, Integer.parseInt(nuWarmupIterations));
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, iniThresholdGenerator));
|
||||
} else {
|
||||
double threshold = strategyConfig.getDouble("acceptor.initialThreshold");
|
||||
schrimpf.setInitialThreshold(threshold);
|
||||
}
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, schrimpf));
|
||||
typedMap.put(acceptorKey, schrimpf);
|
||||
return schrimpf;
|
||||
}
|
||||
if (acceptorName.equals("experimentalSchrimpfAcceptance")) {
|
||||
int iterOfSchrimpf = strategyConfig.getInt("acceptor.warmup");
|
||||
double alpha = strategyConfig.getDouble("acceptor.alpha");
|
||||
ExperimentalSchrimpfAcceptance schrimpf = new ExperimentalSchrimpfAcceptance(solutionMemory, alpha, iterOfSchrimpf);
|
||||
algorithmListeners.add(new PrioritizedVRAListener(Priority.LOW, schrimpf));
|
||||
typedMap.put(acceptorKey, schrimpf);
|
||||
return schrimpf;
|
||||
} else {
|
||||
throw new IllegalStateException("solution acceptor " + acceptorName + " is not known");
|
||||
}
|
||||
}
|
||||
|
||||
private static SearchStrategyModule buildModule(HierarchicalConfiguration moduleConfig, final VehicleRoutingProblem vrp, VehicleFleetManager vehicleFleetManager,
|
||||
final StateManager routeStates, Set<PrioritizedVRAListener> algorithmListeners, TypedMap definedClasses, ExecutorService executorService, int nuOfThreads, ConstraintManager constraintManager, boolean addDefaultCostCalculators) {
|
||||
String moduleName = moduleConfig.getString("[@name]");
|
||||
if (moduleName == null) throw new IllegalStateException("module(-name) is missing.");
|
||||
String moduleId = moduleConfig.getString("[@id]");
|
||||
if (moduleId == null) moduleId = "noId";
|
||||
ModKey modKey = makeKey(moduleName, moduleId);
|
||||
StrategyModuleKey strategyModuleKey = new StrategyModuleKey(modKey);
|
||||
SearchStrategyModule definedModule = definedClasses.get(strategyModuleKey);
|
||||
if (definedModule != null) return definedModule;
|
||||
|
||||
if (moduleName.equals("ruin_and_recreate")) {
|
||||
String ruin_name = moduleConfig.getString("ruin[@name]");
|
||||
if (ruin_name == null) throw new IllegalStateException("module.ruin[@name] is missing.");
|
||||
String ruin_id = moduleConfig.getString("ruin[@id]");
|
||||
if (ruin_id == null) ruin_id = "noId";
|
||||
String shareToRuinString = moduleConfig.getString("ruin.share");
|
||||
if (shareToRuinString == null) throw new IllegalStateException("module.ruin.share is missing.");
|
||||
double shareToRuin = Double.valueOf(shareToRuinString);
|
||||
final RuinStrategy ruin;
|
||||
ModKey ruinKey = makeKey(ruin_name, ruin_id);
|
||||
if (ruin_name.equals("randomRuin")) {
|
||||
ruin = getRandomRuin(vrp, routeStates, definedClasses, ruinKey, shareToRuin);
|
||||
} else if (ruin_name.equals("radialRuin")) {
|
||||
JobDistance jobDistance = new AvgServiceAndShipmentDistance(vrp.getTransportCosts());
|
||||
ruin = getRadialRuin(vrp, routeStates, definedClasses, ruinKey, shareToRuin, jobDistance);
|
||||
} else
|
||||
throw new IllegalStateException("ruin[@name] " + ruin_name + " is not known. Use either randomRuin or radialRuin.");
|
||||
|
||||
String insertionName = moduleConfig.getString("insertion[@name]");
|
||||
if (insertionName == null)
|
||||
throw new IllegalStateException("module.insertion[@name] is missing. set it to \"regretInsertion\" or \"bestInsertion\"");
|
||||
String insertionId = moduleConfig.getString("insertion[@id]");
|
||||
if (insertionId == null) insertionId = "noId";
|
||||
ModKey insertionKey = makeKey(insertionName, insertionId);
|
||||
InsertionStrategyKey insertionStrategyKey = new InsertionStrategyKey(insertionKey);
|
||||
InsertionStrategy insertion = definedClasses.get(insertionStrategyKey);
|
||||
if (insertion == null) {
|
||||
List<HierarchicalConfiguration> insertionConfigs = moduleConfig.configurationsAt("insertion");
|
||||
if (insertionConfigs.size() != 1) throw new IllegalStateException("this should be 1");
|
||||
List<PrioritizedVRAListener> prioListeners = new ArrayList<PrioritizedVRAListener>();
|
||||
insertion = createInsertionStrategy(insertionConfigs.get(0), vrp, vehicleFleetManager, routeStates, prioListeners, executorService, nuOfThreads, constraintManager, addDefaultCostCalculators);
|
||||
algorithmListeners.addAll(prioListeners);
|
||||
}
|
||||
final InsertionStrategy final_insertion = insertion;
|
||||
|
||||
RuinAndRecreateModule rrModule = new RuinAndRecreateModule("ruin_and_recreate", final_insertion, ruin);
|
||||
return rrModule;
|
||||
}
|
||||
throw new NullPointerException("no module found with moduleName=" + moduleName +
|
||||
"\n\tcheck config whether the correct names are used" +
|
||||
"\n\tcurrently there are following modules available: " +
|
||||
"\n\tbestInsertion" +
|
||||
"\n\trandomRuin" +
|
||||
"\n\tradialRuin");
|
||||
}
|
||||
|
||||
private static RuinStrategy getRadialRuin(final VehicleRoutingProblem vrp, final StateManager routeStates, TypedMap definedClasses, ModKey modKey, double shareToRuin, JobDistance jobDistance) {
|
||||
RuinStrategyKey stratKey = new RuinStrategyKey(modKey);
|
||||
RuinStrategy ruin = definedClasses.get(stratKey);
|
||||
if (ruin == null) {
|
||||
ruin = new RadialRuinStrategyFactory(shareToRuin, jobDistance).createStrategy(vrp);
|
||||
definedClasses.put(stratKey, ruin);
|
||||
}
|
||||
return ruin;
|
||||
}
|
||||
|
||||
private static RuinStrategy getRandomRuin(final VehicleRoutingProblem vrp, final StateManager routeStates, TypedMap definedClasses, ModKey modKey, double shareToRuin) {
|
||||
RuinStrategyKey stratKey = new RuinStrategyKey(modKey);
|
||||
RuinStrategy ruin = definedClasses.get(stratKey);
|
||||
if (ruin == null) {
|
||||
ruin = new RandomRuinStrategyFactory(shareToRuin).createStrategy(vrp);
|
||||
definedClasses.put(stratKey, ruin);
|
||||
}
|
||||
return ruin;
|
||||
}
|
||||
|
||||
private static InsertionStrategy createInsertionStrategy(HierarchicalConfiguration moduleConfig, VehicleRoutingProblem vrp, VehicleFleetManager vehicleFleetManager, StateManager routeStates, List<PrioritizedVRAListener> algorithmListeners, ExecutorService executorService, int nuOfThreads, ConstraintManager constraintManager, boolean addDefaultCostCalculators) {
|
||||
return InsertionFactory.createInsertion(vrp, moduleConfig, vehicleFleetManager, routeStates, algorithmListeners, executorService, nuOfThreads, constraintManager, addDefaultCostCalculators);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,65 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.problem.io;
|
||||
|
||||
final class Schema {
|
||||
|
||||
public static final String PROBLEM = "problem";
|
||||
public static final String VEHICLE = "vehicle";
|
||||
public static final String TYPES = "vehicleTypes";
|
||||
public static final String VEHICLES = "vehicles";
|
||||
public static final String SHIPMENTS = "shipments";
|
||||
public static final String SHIPMENT = "shipment";
|
||||
public static final String SERVICETIME = "serviceTime";
|
||||
public static final String PICKUP = "pickup";
|
||||
public static final String TYPE = "type";
|
||||
|
||||
|
||||
public void dot() {
|
||||
|
||||
}
|
||||
|
||||
public static class PathBuilder {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
boolean justCreated = true;
|
||||
|
||||
|
||||
public PathBuilder dot(String string) {
|
||||
stringBuilder.append(".").append(string);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PathBuilder append(String string) {
|
||||
stringBuilder.append(string);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String build() {
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static PathBuilder builder() {
|
||||
return new PathBuilder();
|
||||
}
|
||||
|
||||
private Schema() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,721 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.problem.io;
|
||||
|
||||
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.driver.Driver;
|
||||
import com.graphhopper.jsprit.core.problem.driver.DriverImpl;
|
||||
import com.graphhopper.jsprit.core.problem.job.*;
|
||||
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.VehicleImpl.Builder;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleType;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
import com.graphhopper.jsprit.core.util.Coordinate;
|
||||
import com.graphhopper.jsprit.core.util.Resource;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.HierarchicalConfiguration;
|
||||
import org.apache.commons.configuration.XMLConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
public class VrpXMLReader {
|
||||
|
||||
public interface ServiceBuilderFactory {
|
||||
Service.Builder createBuilder(String serviceType, String id, Integer size);
|
||||
}
|
||||
|
||||
static class DefaultServiceBuilderFactory implements ServiceBuilderFactory {
|
||||
|
||||
@Override
|
||||
public Service.Builder createBuilder(String serviceType, String id, Integer size) {
|
||||
if (serviceType.equals("pickup")) {
|
||||
if (size != null) return Pickup.Builder.newInstance(id).addSizeDimension(0, size);
|
||||
else return Pickup.Builder.newInstance(id);
|
||||
} else if (serviceType.equals("delivery")) {
|
||||
if (size != null) return Delivery.Builder.newInstance(id).addSizeDimension(0, size);
|
||||
else return Delivery.Builder.newInstance(id);
|
||||
} else {
|
||||
if (size != null) return Service.Builder.newInstance(id).addSizeDimension(0, size);
|
||||
else return Service.Builder.newInstance(id);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(VrpXMLReader.class);
|
||||
|
||||
private VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
||||
private Map<String, Vehicle> vehicleMap;
|
||||
|
||||
private Map<String, Service> serviceMap;
|
||||
|
||||
private Map<String, Shipment> shipmentMap;
|
||||
|
||||
private Set<String> freezedJobIds = new HashSet<String>();
|
||||
|
||||
private boolean schemaValidation = true;
|
||||
|
||||
private Collection<VehicleRoutingProblemSolution> solutions;
|
||||
|
||||
private ServiceBuilderFactory serviceBuilderFactory = new DefaultServiceBuilderFactory();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param schemaValidation the schemaValidation to set
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void setSchemaValidation(boolean schemaValidation) {
|
||||
this.schemaValidation = schemaValidation;
|
||||
}
|
||||
|
||||
public VrpXMLReader(VehicleRoutingProblem.Builder vrpBuilder, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
this.vehicleMap = new LinkedHashMap<String, Vehicle>();
|
||||
this.serviceMap = new LinkedHashMap<String, Service>();
|
||||
this.shipmentMap = new LinkedHashMap<String, Shipment>();
|
||||
this.solutions = solutions;
|
||||
}
|
||||
|
||||
public VrpXMLReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
this.vehicleMap = new LinkedHashMap<String, Vehicle>();
|
||||
this.serviceMap = new LinkedHashMap<String, Service>();
|
||||
this.shipmentMap = new LinkedHashMap<String, Shipment>();
|
||||
this.solutions = null;
|
||||
}
|
||||
|
||||
public void read(String filename) {
|
||||
logger.debug("read vrp: {}", filename);
|
||||
XMLConfiguration xmlConfig = createXMLConfiguration();
|
||||
try {
|
||||
xmlConfig.load(filename);
|
||||
} catch (ConfigurationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
read(xmlConfig);
|
||||
}
|
||||
|
||||
public void read(InputStream fileContents) {
|
||||
XMLConfiguration xmlConfig = createXMLConfiguration();
|
||||
try {
|
||||
xmlConfig.load(fileContents);
|
||||
} catch (ConfigurationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
read(xmlConfig);
|
||||
}
|
||||
|
||||
private XMLConfiguration createXMLConfiguration() {
|
||||
XMLConfiguration xmlConfig = new XMLConfiguration();
|
||||
xmlConfig.setAttributeSplittingDisabled(true);
|
||||
xmlConfig.setDelimiterParsingDisabled(true);
|
||||
|
||||
if (schemaValidation) {
|
||||
final InputStream resource = Resource.getAsInputStream("vrp_xml_schema.xsd");
|
||||
if (resource != null) {
|
||||
EntityResolver resolver = new EntityResolver() {
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
|
||||
{
|
||||
InputSource is = new InputSource(resource);
|
||||
return is;
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlConfig.setEntityResolver(resolver);
|
||||
xmlConfig.setSchemaValidation(true);
|
||||
} else {
|
||||
logger.debug("cannot find schema-xsd file (vrp_xml_schema.xsd). try to read xml without xml-file-validation.");
|
||||
}
|
||||
}
|
||||
return xmlConfig;
|
||||
}
|
||||
|
||||
private void read(XMLConfiguration xmlConfig) {
|
||||
readProblemType(xmlConfig);
|
||||
readVehiclesAndTheirTypes(xmlConfig);
|
||||
|
||||
readShipments(xmlConfig);
|
||||
readServices(xmlConfig);
|
||||
|
||||
readInitialRoutes(xmlConfig);
|
||||
readSolutions(xmlConfig);
|
||||
|
||||
addJobsAndTheirLocationsToVrp();
|
||||
}
|
||||
|
||||
private void addJobsAndTheirLocationsToVrp() {
|
||||
for (Service service : serviceMap.values()) {
|
||||
if (!freezedJobIds.contains(service.getId())) {
|
||||
vrpBuilder.addJob(service);
|
||||
}
|
||||
}
|
||||
for (Shipment shipment : shipmentMap.values()) {
|
||||
if (!freezedJobIds.contains(shipment.getId())) {
|
||||
vrpBuilder.addJob(shipment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readInitialRoutes(XMLConfiguration xmlConfig) {
|
||||
List<HierarchicalConfiguration> initialRouteConfigs = xmlConfig.configurationsAt("initialRoutes.route");
|
||||
for (HierarchicalConfiguration routeConfig : initialRouteConfigs) {
|
||||
Driver driver = DriverImpl.noDriver();
|
||||
String vehicleId = routeConfig.getString("vehicleId");
|
||||
Vehicle vehicle = getVehicle(vehicleId);
|
||||
if (vehicle == null) throw new IllegalArgumentException("vehicle is missing.");
|
||||
String start = routeConfig.getString("start");
|
||||
if (start == null) throw new IllegalArgumentException("route start-time is missing.");
|
||||
double departureTime = Double.parseDouble(start);
|
||||
|
||||
VehicleRoute.Builder routeBuilder = VehicleRoute.Builder.newInstance(vehicle, driver);
|
||||
routeBuilder.setDepartureTime(departureTime);
|
||||
|
||||
List<HierarchicalConfiguration> actConfigs = routeConfig.configurationsAt("act");
|
||||
for (HierarchicalConfiguration actConfig : actConfigs) {
|
||||
String type = actConfig.getString("[@type]");
|
||||
if (type == null) throw new IllegalArgumentException("act[@type] is missing.");
|
||||
double arrTime = 0.;
|
||||
double endTime = 0.;
|
||||
String arrTimeS = actConfig.getString("arrTime");
|
||||
if (arrTimeS != null) arrTime = Double.parseDouble(arrTimeS);
|
||||
String endTimeS = actConfig.getString("endTime");
|
||||
if (endTimeS != null) endTime = Double.parseDouble(endTimeS);
|
||||
|
||||
String serviceId = actConfig.getString("serviceId");
|
||||
if(type.equals("break")) {
|
||||
Break currentbreak = getBreak(vehicleId);
|
||||
routeBuilder.addBreak(currentbreak);
|
||||
}
|
||||
else {
|
||||
if (serviceId != null) {
|
||||
Service service = getService(serviceId);
|
||||
if (service == null)
|
||||
throw new IllegalArgumentException("service to serviceId " + serviceId + " is missing (reference in one of your initial routes). make sure you define the service you refer to here in <services> </services>.");
|
||||
//!!!since job is part of initial route, it does not belong to jobs in problem, i.e. variable jobs that can be assigned/scheduled
|
||||
freezedJobIds.add(serviceId);
|
||||
routeBuilder.addService(service);
|
||||
} else {
|
||||
String shipmentId = actConfig.getString("shipmentId");
|
||||
if (shipmentId == null)
|
||||
throw new IllegalArgumentException("either serviceId or shipmentId is missing");
|
||||
Shipment shipment = getShipment(shipmentId);
|
||||
if (shipment == null)
|
||||
throw new IllegalArgumentException("shipment to shipmentId " + shipmentId + " is missing (reference in one of your initial routes). make sure you define the shipment you refer to here in <shipments> </shipments>.");
|
||||
freezedJobIds.add(shipmentId);
|
||||
if (type.equals("pickupShipment")) {
|
||||
routeBuilder.addPickup(shipment);
|
||||
} else if (type.equals("deliverShipment")) {
|
||||
routeBuilder.addDelivery(shipment);
|
||||
} else
|
||||
throw new IllegalArgumentException("type " + type + " is not supported. Use 'pickupShipment' or 'deliverShipment' here");
|
||||
}
|
||||
}
|
||||
}
|
||||
VehicleRoute route = routeBuilder.build();
|
||||
vrpBuilder.addInitialVehicleRoute(route);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void readSolutions(XMLConfiguration vrpProblem) {
|
||||
if (solutions == null) return;
|
||||
List<HierarchicalConfiguration> solutionConfigs = vrpProblem.configurationsAt("solutions.solution");
|
||||
for (HierarchicalConfiguration solutionConfig : solutionConfigs) {
|
||||
String totalCost = solutionConfig.getString("cost");
|
||||
double cost = -1;
|
||||
if (totalCost != null) cost = Double.parseDouble(totalCost);
|
||||
List<HierarchicalConfiguration> routeConfigs = solutionConfig.configurationsAt("routes.route");
|
||||
List<VehicleRoute> routes = new ArrayList<VehicleRoute>();
|
||||
for (HierarchicalConfiguration routeConfig : routeConfigs) {
|
||||
//! here, driverId is set to noDriver, no matter whats in driverId.
|
||||
Driver driver = DriverImpl.noDriver();
|
||||
String vehicleId = routeConfig.getString("vehicleId");
|
||||
Vehicle vehicle = getVehicle(vehicleId);
|
||||
if (vehicle == null) throw new IllegalArgumentException("vehicle is missing.");
|
||||
String start = routeConfig.getString("start");
|
||||
if (start == null) throw new IllegalArgumentException("route start-time is missing.");
|
||||
double departureTime = Double.parseDouble(start);
|
||||
|
||||
String end = routeConfig.getString("end");
|
||||
if (end == null) throw new IllegalArgumentException("route end-time is missing.");
|
||||
|
||||
VehicleRoute.Builder routeBuilder = VehicleRoute.Builder.newInstance(vehicle, driver);
|
||||
routeBuilder.setDepartureTime(departureTime);
|
||||
List<HierarchicalConfiguration> actConfigs = routeConfig.configurationsAt("act");
|
||||
for (HierarchicalConfiguration actConfig : actConfigs) {
|
||||
String type = actConfig.getString("[@type]");
|
||||
if (type == null) throw new IllegalArgumentException("act[@type] is missing.");
|
||||
double arrTime = 0.;
|
||||
double endTime = 0.;
|
||||
String arrTimeS = actConfig.getString("arrTime");
|
||||
if (arrTimeS != null) arrTime = Double.parseDouble(arrTimeS);
|
||||
String endTimeS = actConfig.getString("endTime");
|
||||
if (endTimeS != null) endTime = Double.parseDouble(endTimeS);
|
||||
if(type.equals("break")) {
|
||||
Break currentbreak = getBreak(vehicleId);
|
||||
routeBuilder.addBreak(currentbreak);
|
||||
}
|
||||
else {
|
||||
String serviceId = actConfig.getString("serviceId");
|
||||
if (serviceId != null) {
|
||||
Service service = getService(serviceId);
|
||||
routeBuilder.addService(service);
|
||||
} else {
|
||||
String shipmentId = actConfig.getString("shipmentId");
|
||||
if (shipmentId == null)
|
||||
throw new IllegalArgumentException("either serviceId or shipmentId is missing");
|
||||
Shipment shipment = getShipment(shipmentId);
|
||||
if (shipment == null)
|
||||
throw new IllegalArgumentException("shipment with id " + shipmentId + " does not exist.");
|
||||
if (type.equals("pickupShipment")) {
|
||||
routeBuilder.addPickup(shipment);
|
||||
} else if (type.equals("deliverShipment")) {
|
||||
routeBuilder.addDelivery(shipment);
|
||||
} else
|
||||
throw new IllegalArgumentException("type " + type + " is not supported. Use 'pickupShipment' or 'deliverShipment' here");
|
||||
}
|
||||
}
|
||||
}
|
||||
routes.add(routeBuilder.build());
|
||||
}
|
||||
VehicleRoutingProblemSolution solution = new VehicleRoutingProblemSolution(routes, cost);
|
||||
List<HierarchicalConfiguration> unassignedJobConfigs = solutionConfig.configurationsAt("unassignedJobs.job");
|
||||
for (HierarchicalConfiguration unassignedJobConfig : unassignedJobConfigs) {
|
||||
String jobId = unassignedJobConfig.getString("[@id]");
|
||||
Job job = getShipment(jobId);
|
||||
if (job == null) job = getService(jobId);
|
||||
if (job == null) throw new IllegalArgumentException("cannot find unassignedJob with id " + jobId);
|
||||
solution.getUnassignedJobs().add(job);
|
||||
}
|
||||
|
||||
solutions.add(solution);
|
||||
}
|
||||
}
|
||||
|
||||
private Shipment getShipment(String shipmentId) {
|
||||
return shipmentMap.get(shipmentId);
|
||||
}
|
||||
|
||||
private Service getService(String serviceId) {
|
||||
return serviceMap.get(serviceId);
|
||||
}
|
||||
|
||||
private Vehicle getVehicle(String vehicleId) {
|
||||
return vehicleMap.get(vehicleId);
|
||||
}
|
||||
|
||||
private Break getBreak(String vehicleId) {
|
||||
return vehicleMap.get(vehicleId).getBreak();
|
||||
}
|
||||
|
||||
private void readProblemType(XMLConfiguration vrpProblem) {
|
||||
String fleetSize = vrpProblem.getString("problemType.fleetSize");
|
||||
if (fleetSize == null) vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||
else if (fleetSize.toUpperCase().equals(FleetSize.INFINITE.toString()))
|
||||
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||
else vrpBuilder.setFleetSize(FleetSize.FINITE);
|
||||
}
|
||||
|
||||
private void readShipments(XMLConfiguration config) {
|
||||
List<HierarchicalConfiguration> shipmentConfigs = config.configurationsAt("shipments.shipment");
|
||||
for (HierarchicalConfiguration shipmentConfig : shipmentConfigs) {
|
||||
String id = shipmentConfig.getString("[@id]");
|
||||
if (id == null) throw new IllegalArgumentException("shipment[@id] is missing.");
|
||||
|
||||
String capacityString = shipmentConfig.getString("capacity-demand");
|
||||
boolean capacityDimensionsExist = shipmentConfig.containsKey("capacity-dimensions.dimension(0)");
|
||||
if (capacityString == null && !capacityDimensionsExist) {
|
||||
throw new IllegalArgumentException("capacity of shipment is not set. use 'capacity-dimensions'");
|
||||
}
|
||||
if (capacityString != null && capacityDimensionsExist) {
|
||||
throw new IllegalArgumentException("either use capacity or capacity-dimension, not both. prefer the use of 'capacity-dimensions' over 'capacity'.");
|
||||
}
|
||||
|
||||
Shipment.Builder builder;
|
||||
if (capacityString != null) {
|
||||
builder = Shipment.Builder.newInstance(id).addSizeDimension(0, Integer.parseInt(capacityString));
|
||||
} else {
|
||||
builder = Shipment.Builder.newInstance(id);
|
||||
List<HierarchicalConfiguration> dimensionConfigs = shipmentConfig.configurationsAt("capacity-dimensions.dimension");
|
||||
for (HierarchicalConfiguration dimension : dimensionConfigs) {
|
||||
Integer index = dimension.getInt("[@index]");
|
||||
Integer value = dimension.getInt("");
|
||||
builder.addSizeDimension(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
//name
|
||||
String name = shipmentConfig.getString("name");
|
||||
if (name != null) builder.setName(name);
|
||||
|
||||
//pickup location
|
||||
//pickup-locationId
|
||||
Location.Builder pickupLocationBuilder = Location.Builder.newInstance();
|
||||
String pickupLocationId = shipmentConfig.getString("pickup.locationId");
|
||||
if (pickupLocationId == null) pickupLocationId = shipmentConfig.getString("pickup.location.id");
|
||||
if (pickupLocationId != null) {
|
||||
pickupLocationBuilder.setId(pickupLocationId);
|
||||
}
|
||||
|
||||
//pickup-coord
|
||||
Coordinate pickupCoord = getCoord(shipmentConfig, "pickup.");
|
||||
if (pickupCoord == null) pickupCoord = getCoord(shipmentConfig, "pickup.location.");
|
||||
if (pickupCoord != null) {
|
||||
pickupLocationBuilder.setCoordinate(pickupCoord);
|
||||
}
|
||||
|
||||
//pickup.location.index
|
||||
String pickupLocationIndex = shipmentConfig.getString("pickup.location.index");
|
||||
if (pickupLocationIndex != null) pickupLocationBuilder.setIndex(Integer.parseInt(pickupLocationIndex));
|
||||
builder.setPickupLocation(pickupLocationBuilder.build());
|
||||
|
||||
//pickup-serviceTime
|
||||
String pickupServiceTime = shipmentConfig.getString("pickup.duration");
|
||||
if (pickupServiceTime != null) builder.setPickupServiceTime(Double.parseDouble(pickupServiceTime));
|
||||
|
||||
//pickup-tw
|
||||
List<HierarchicalConfiguration> pickupTWConfigs = shipmentConfig.configurationsAt("pickup.timeWindows.timeWindow");
|
||||
if (!pickupTWConfigs.isEmpty()) {
|
||||
for (HierarchicalConfiguration pu_twConfig : pickupTWConfigs) {
|
||||
builder.addPickupTimeWindow(TimeWindow.newInstance(pu_twConfig.getDouble("start"), pu_twConfig.getDouble("end")));
|
||||
}
|
||||
}
|
||||
|
||||
//delivery location
|
||||
//delivery-locationId
|
||||
Location.Builder deliveryLocationBuilder = Location.Builder.newInstance();
|
||||
String deliveryLocationId = shipmentConfig.getString("delivery.locationId");
|
||||
if (deliveryLocationId == null) deliveryLocationId = shipmentConfig.getString("delivery.location.id");
|
||||
if (deliveryLocationId != null) {
|
||||
deliveryLocationBuilder.setId(deliveryLocationId);
|
||||
// builder.setDeliveryLocationId(deliveryLocationId);
|
||||
}
|
||||
|
||||
//delivery-coord
|
||||
Coordinate deliveryCoord = getCoord(shipmentConfig, "delivery.");
|
||||
if (deliveryCoord == null) deliveryCoord = getCoord(shipmentConfig, "delivery.location.");
|
||||
if (deliveryCoord != null) {
|
||||
deliveryLocationBuilder.setCoordinate(deliveryCoord);
|
||||
}
|
||||
|
||||
String deliveryLocationIndex = shipmentConfig.getString("delivery.location.index");
|
||||
if (deliveryLocationIndex != null)
|
||||
deliveryLocationBuilder.setIndex(Integer.parseInt(deliveryLocationIndex));
|
||||
builder.setDeliveryLocation(deliveryLocationBuilder.build());
|
||||
|
||||
//delivery-serviceTime
|
||||
String deliveryServiceTime = shipmentConfig.getString("delivery.duration");
|
||||
if (deliveryServiceTime != null) builder.setDeliveryServiceTime(Double.parseDouble(deliveryServiceTime));
|
||||
|
||||
//delivery-tw
|
||||
List<HierarchicalConfiguration> deliveryTWConfigs = shipmentConfig.configurationsAt("delivery.timeWindows.timeWindow");
|
||||
if (!deliveryTWConfigs.isEmpty()) {
|
||||
for (HierarchicalConfiguration dl_twConfig : deliveryTWConfigs) {
|
||||
builder.addDeliveryTimeWindow(TimeWindow.newInstance(dl_twConfig.getDouble("start"), dl_twConfig.getDouble("end")));
|
||||
}
|
||||
}
|
||||
|
||||
//read skills
|
||||
String skillString = shipmentConfig.getString("requiredSkills");
|
||||
if (skillString != null) {
|
||||
String cleaned = skillString.replaceAll("\\s", "");
|
||||
String[] skillTokens = cleaned.split("[,;]");
|
||||
for (String skill : skillTokens) builder.addRequiredSkill(skill.toLowerCase());
|
||||
}
|
||||
|
||||
//build shipment
|
||||
Shipment shipment = builder.build();
|
||||
// vrpBuilder.addJob(shipment);
|
||||
shipmentMap.put(shipment.getId(), shipment);
|
||||
}
|
||||
}
|
||||
|
||||
private static Coordinate getCoord(HierarchicalConfiguration serviceConfig, String prefix) {
|
||||
Coordinate pickupCoord = null;
|
||||
if (serviceConfig.getString(prefix + "coord[@x]") != null && serviceConfig.getString(prefix + "coord[@y]") != null) {
|
||||
double x = Double.parseDouble(serviceConfig.getString(prefix + "coord[@x]"));
|
||||
double y = Double.parseDouble(serviceConfig.getString(prefix + "coord[@y]"));
|
||||
pickupCoord = Coordinate.newInstance(x, y);
|
||||
}
|
||||
return pickupCoord;
|
||||
}
|
||||
|
||||
private void readServices(XMLConfiguration vrpProblem) {
|
||||
List<HierarchicalConfiguration> serviceConfigs = vrpProblem.configurationsAt("services.service");
|
||||
for (HierarchicalConfiguration serviceConfig : serviceConfigs) {
|
||||
String id = serviceConfig.getString("[@id]");
|
||||
if (id == null) throw new IllegalArgumentException("service[@id] is missing.");
|
||||
String type = serviceConfig.getString("[@type]");
|
||||
if (type == null) type = "service";
|
||||
|
||||
String capacityString = serviceConfig.getString("capacity-demand");
|
||||
boolean capacityDimensionsExist = serviceConfig.containsKey("capacity-dimensions.dimension(0)");
|
||||
if (capacityString == null && !capacityDimensionsExist) {
|
||||
throw new IllegalArgumentException("capacity of service is not set. use 'capacity-dimensions'");
|
||||
}
|
||||
if (capacityString != null && capacityDimensionsExist) {
|
||||
throw new IllegalArgumentException("either use capacity or capacity-dimension, not both. prefer the use of 'capacity-dimensions' over 'capacity'.");
|
||||
}
|
||||
|
||||
Service.Builder builder;
|
||||
if (capacityString != null) {
|
||||
builder = serviceBuilderFactory.createBuilder(type, id, Integer.parseInt(capacityString));
|
||||
} else {
|
||||
builder = serviceBuilderFactory.createBuilder(type, id, null);
|
||||
List<HierarchicalConfiguration> dimensionConfigs = serviceConfig.configurationsAt("capacity-dimensions.dimension");
|
||||
for (HierarchicalConfiguration dimension : dimensionConfigs) {
|
||||
Integer index = dimension.getInt("[@index]");
|
||||
Integer value = dimension.getInt("");
|
||||
builder.addSizeDimension(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
//name
|
||||
String name = serviceConfig.getString("name");
|
||||
if (name != null) builder.setName(name);
|
||||
|
||||
//location
|
||||
Location.Builder locationBuilder = Location.Builder.newInstance();
|
||||
String serviceLocationId = serviceConfig.getString("locationId");
|
||||
if (serviceLocationId == null) {
|
||||
serviceLocationId = serviceConfig.getString("location.id");
|
||||
}
|
||||
if (serviceLocationId != null) locationBuilder.setId(serviceLocationId);
|
||||
|
||||
Coordinate serviceCoord = getCoord(serviceConfig, "");
|
||||
if (serviceCoord == null) serviceCoord = getCoord(serviceConfig, "location.");
|
||||
if (serviceCoord != null) {
|
||||
locationBuilder.setCoordinate(serviceCoord);
|
||||
}
|
||||
|
||||
String locationIndex = serviceConfig.getString("location.index");
|
||||
if (locationIndex != null) locationBuilder.setIndex(Integer.parseInt(locationIndex));
|
||||
builder.setLocation(locationBuilder.build());
|
||||
|
||||
if (serviceConfig.containsKey("duration")) {
|
||||
builder.setServiceTime(serviceConfig.getDouble("duration"));
|
||||
}
|
||||
List<HierarchicalConfiguration> deliveryTWConfigs = serviceConfig.configurationsAt("timeWindows.timeWindow");
|
||||
if (!deliveryTWConfigs.isEmpty()) {
|
||||
for (HierarchicalConfiguration twConfig : deliveryTWConfigs) {
|
||||
builder.addTimeWindow(TimeWindow.newInstance(twConfig.getDouble("start"), twConfig.getDouble("end")));
|
||||
}
|
||||
}
|
||||
|
||||
//read skills
|
||||
String skillString = serviceConfig.getString("requiredSkills");
|
||||
if (skillString != null) {
|
||||
String cleaned = skillString.replaceAll("\\s", "");
|
||||
String[] skillTokens = cleaned.split("[,;]");
|
||||
for (String skill : skillTokens) builder.addRequiredSkill(skill.toLowerCase());
|
||||
}
|
||||
|
||||
//build service
|
||||
Service service = builder.build();
|
||||
serviceMap.put(service.getId(), service);
|
||||
// vrpBuilder.addJob(service);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void readVehiclesAndTheirTypes(XMLConfiguration vrpProblem) {
|
||||
|
||||
//read vehicle-types
|
||||
Map<String, VehicleType> types = new HashMap<String, VehicleType>();
|
||||
List<HierarchicalConfiguration> typeConfigs = vrpProblem.configurationsAt("vehicleTypes.type");
|
||||
for (HierarchicalConfiguration typeConfig : typeConfigs) {
|
||||
String typeId = typeConfig.getString("id");
|
||||
if (typeId == null) throw new IllegalArgumentException("typeId is missing.");
|
||||
|
||||
String capacityString = typeConfig.getString("capacity");
|
||||
boolean capacityDimensionsExist = typeConfig.containsKey("capacity-dimensions.dimension(0)");
|
||||
if (capacityString == null && !capacityDimensionsExist) {
|
||||
throw new IllegalArgumentException("capacity of type is not set. use 'capacity-dimensions'");
|
||||
}
|
||||
if (capacityString != null && capacityDimensionsExist) {
|
||||
throw new IllegalArgumentException("either use capacity or capacity-dimension, not both. prefer the use of 'capacity-dimensions' over 'capacity'.");
|
||||
}
|
||||
|
||||
VehicleTypeImpl.Builder typeBuilder;
|
||||
if (capacityString != null) {
|
||||
typeBuilder = VehicleTypeImpl.Builder.newInstance(typeId).addCapacityDimension(0, Integer.parseInt(capacityString));
|
||||
} else {
|
||||
typeBuilder = VehicleTypeImpl.Builder.newInstance(typeId);
|
||||
List<HierarchicalConfiguration> dimensionConfigs = typeConfig.configurationsAt("capacity-dimensions.dimension");
|
||||
for (HierarchicalConfiguration dimension : dimensionConfigs) {
|
||||
Integer index = dimension.getInt("[@index]");
|
||||
Integer value = dimension.getInt("");
|
||||
typeBuilder.addCapacityDimension(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
Double fix = typeConfig.getDouble("costs.fixed");
|
||||
Double timeC = typeConfig.getDouble("costs.time");
|
||||
Double distC = typeConfig.getDouble("costs.distance");
|
||||
if(typeConfig.containsKey("costs.service")){
|
||||
Double serviceC = typeConfig.getDouble("costs.service");
|
||||
if (serviceC != null) typeBuilder.setCostPerServiceTime(serviceC);
|
||||
}
|
||||
|
||||
if(typeConfig.containsKey("costs.wait")){
|
||||
Double waitC = typeConfig.getDouble("costs.wait");
|
||||
if (waitC != null) typeBuilder.setCostPerWaitingTime(waitC);
|
||||
}
|
||||
|
||||
if (fix != null) typeBuilder.setFixedCost(fix);
|
||||
if (timeC != null) typeBuilder.setCostPerTransportTime(timeC);
|
||||
if (distC != null) typeBuilder.setCostPerDistance(distC);
|
||||
VehicleType type = typeBuilder.build();
|
||||
String id = type.getTypeId();
|
||||
types.put(id, type);
|
||||
}
|
||||
|
||||
//read vehicles
|
||||
List<HierarchicalConfiguration> vehicleConfigs = vrpProblem.configurationsAt("vehicles.vehicle");
|
||||
boolean doNotWarnAgain = false;
|
||||
for (HierarchicalConfiguration vehicleConfig : vehicleConfigs) {
|
||||
String vehicleId = vehicleConfig.getString("id");
|
||||
if (vehicleId == null) throw new IllegalArgumentException("vehicleId is missing.");
|
||||
Builder builder = VehicleImpl.Builder.newInstance(vehicleId);
|
||||
String typeId = vehicleConfig.getString("typeId");
|
||||
if (typeId == null) throw new IllegalArgumentException("typeId is missing.");
|
||||
String vType = vehicleConfig.getString("[@type]");
|
||||
if (vType != null) {
|
||||
if (vType.equals("penalty")) {
|
||||
typeId += "_penalty";
|
||||
}
|
||||
}
|
||||
VehicleType type = types.get(typeId);
|
||||
if (type == null) throw new IllegalArgumentException("vehicleType with typeId " + typeId + " is missing.");
|
||||
builder.setType(type);
|
||||
|
||||
//read startlocation
|
||||
Location.Builder startLocationBuilder = Location.Builder.newInstance();
|
||||
String locationId = vehicleConfig.getString("location.id");
|
||||
if (locationId == null) {
|
||||
locationId = vehicleConfig.getString("startLocation.id");
|
||||
}
|
||||
startLocationBuilder.setId(locationId);
|
||||
String coordX = vehicleConfig.getString("location.coord[@x]");
|
||||
String coordY = vehicleConfig.getString("location.coord[@y]");
|
||||
if (coordX == null || coordY == null) {
|
||||
coordX = vehicleConfig.getString("startLocation.coord[@x]");
|
||||
coordY = vehicleConfig.getString("startLocation.coord[@y]");
|
||||
}
|
||||
if (coordX == null || coordY == null) {
|
||||
if (!doNotWarnAgain) {
|
||||
logger.debug("location.coord is missing. will not warn you again.");
|
||||
doNotWarnAgain = true;
|
||||
}
|
||||
} else {
|
||||
Coordinate coordinate = Coordinate.newInstance(Double.parseDouble(coordX), Double.parseDouble(coordY));
|
||||
startLocationBuilder.setCoordinate(coordinate);
|
||||
}
|
||||
String index = vehicleConfig.getString("startLocation.index");
|
||||
if (index == null) index = vehicleConfig.getString("location.index");
|
||||
if (index != null) {
|
||||
startLocationBuilder.setIndex(Integer.parseInt(index));
|
||||
}
|
||||
builder.setStartLocation(startLocationBuilder.build());
|
||||
|
||||
//read endlocation
|
||||
Location.Builder endLocationBuilder = Location.Builder.newInstance();
|
||||
boolean hasEndLocation = false;
|
||||
String endLocationId = vehicleConfig.getString("endLocation.id");
|
||||
if (endLocationId != null) {
|
||||
hasEndLocation = true;
|
||||
endLocationBuilder.setId(endLocationId);
|
||||
}
|
||||
String endCoordX = vehicleConfig.getString("endLocation.coord[@x]");
|
||||
String endCoordY = vehicleConfig.getString("endLocation.coord[@y]");
|
||||
if (endCoordX == null || endCoordY == null) {
|
||||
if (!doNotWarnAgain) {
|
||||
logger.debug("endLocation.coord is missing. will not warn you again.");
|
||||
doNotWarnAgain = true;
|
||||
}
|
||||
} else {
|
||||
Coordinate coordinate = Coordinate.newInstance(Double.parseDouble(endCoordX), Double.parseDouble(endCoordY));
|
||||
hasEndLocation = true;
|
||||
endLocationBuilder.setCoordinate(coordinate);
|
||||
}
|
||||
String endLocationIndex = vehicleConfig.getString("endLocation.index");
|
||||
if (endLocationIndex != null) {
|
||||
hasEndLocation = true;
|
||||
endLocationBuilder.setIndex(Integer.parseInt(endLocationIndex));
|
||||
}
|
||||
if (hasEndLocation) builder.setEndLocation(endLocationBuilder.build());
|
||||
|
||||
//read timeSchedule
|
||||
String start = vehicleConfig.getString("timeSchedule.start");
|
||||
String end = vehicleConfig.getString("timeSchedule.end");
|
||||
if (start != null) builder.setEarliestStart(Double.parseDouble(start));
|
||||
if (end != null) builder.setLatestArrival(Double.parseDouble(end));
|
||||
|
||||
//read return2depot
|
||||
String returnToDepot = vehicleConfig.getString("returnToDepot");
|
||||
if (returnToDepot != null) {
|
||||
builder.setReturnToDepot(vehicleConfig.getBoolean("returnToDepot"));
|
||||
}
|
||||
|
||||
//read skills
|
||||
String skillString = vehicleConfig.getString("skills");
|
||||
if (skillString != null) {
|
||||
String cleaned = skillString.replaceAll("\\s", "");
|
||||
String[] skillTokens = cleaned.split("[,;]");
|
||||
for (String skill : skillTokens) builder.addSkill(skill.toLowerCase());
|
||||
}
|
||||
|
||||
// read break
|
||||
List<HierarchicalConfiguration> breakTWConfigs = vehicleConfig.configurationsAt("breaks.timeWindows.timeWindow");
|
||||
if (!breakTWConfigs.isEmpty()) {
|
||||
String breakDurationString = vehicleConfig.getString("breaks.duration");
|
||||
Break.Builder current_break = Break.Builder.newInstance(vehicleId);
|
||||
current_break.setServiceTime(Double.parseDouble(breakDurationString));
|
||||
for (HierarchicalConfiguration twConfig : breakTWConfigs) {
|
||||
current_break.addTimeWindow(TimeWindow.newInstance(twConfig.getDouble("start"), twConfig.getDouble("end")));
|
||||
}
|
||||
builder.setBreak(current_break.build());
|
||||
}
|
||||
|
||||
|
||||
//build vehicle
|
||||
VehicleImpl vehicle = builder.build();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
vehicleMap.put(vehicleId, vehicle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,435 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.problem.io;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.problem.Skills;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.job.Break;
|
||||
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.solution.route.activity.TourActivity;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleType;
|
||||
import com.graphhopper.jsprit.core.util.Solutions;
|
||||
import com.graphhopper.jsprit.core.util.VehicleIndexComparator;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.XMLConfiguration;
|
||||
import org.apache.xml.serialize.OutputFormat;
|
||||
import org.apache.xml.serialize.XMLSerializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class VrpXMLWriter {
|
||||
|
||||
static class XMLConf extends XMLConfiguration {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Document createDoc() throws ConfigurationException {
|
||||
return createDocument();
|
||||
}
|
||||
}
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(VrpXMLWriter.class);
|
||||
|
||||
private VehicleRoutingProblem vrp;
|
||||
|
||||
private Collection<VehicleRoutingProblemSolution> solutions;
|
||||
|
||||
private boolean onlyBestSolution = false;
|
||||
|
||||
public VrpXMLWriter(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions, boolean onlyBestSolution) {
|
||||
this.vrp = vrp;
|
||||
this.solutions = new ArrayList<VehicleRoutingProblemSolution>(solutions);
|
||||
this.onlyBestSolution = onlyBestSolution;
|
||||
}
|
||||
|
||||
public VrpXMLWriter(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
this.vrp = vrp;
|
||||
this.solutions = solutions;
|
||||
}
|
||||
|
||||
public VrpXMLWriter(VehicleRoutingProblem vrp) {
|
||||
this.vrp = vrp;
|
||||
this.solutions = null;
|
||||
}
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(VrpXMLWriter.class);
|
||||
|
||||
public void write(String filename) {
|
||||
if (!filename.endsWith(".xml")) filename += ".xml";
|
||||
log.info("write vrp: " + filename);
|
||||
XMLConf xmlConfig = new XMLConf();
|
||||
xmlConfig.setFileName(filename);
|
||||
xmlConfig.setRootElementName("problem");
|
||||
xmlConfig.setAttributeSplittingDisabled(true);
|
||||
xmlConfig.setDelimiterParsingDisabled(true);
|
||||
|
||||
writeProblemType(xmlConfig);
|
||||
writeVehiclesAndTheirTypes(xmlConfig);
|
||||
|
||||
//might be sorted?
|
||||
List<Job> jobs = new ArrayList<Job>();
|
||||
jobs.addAll(vrp.getJobs().values());
|
||||
for (VehicleRoute r : vrp.getInitialVehicleRoutes()) {
|
||||
jobs.addAll(r.getTourActivities().getJobs());
|
||||
}
|
||||
|
||||
writeServices(xmlConfig, jobs);
|
||||
writeShipments(xmlConfig, jobs);
|
||||
|
||||
writeInitialRoutes(xmlConfig);
|
||||
if(onlyBestSolution && solutions != null) {
|
||||
VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
|
||||
solutions.clear();
|
||||
solutions.add(solution);
|
||||
}
|
||||
|
||||
writeSolutions(xmlConfig);
|
||||
|
||||
|
||||
OutputFormat format = new OutputFormat();
|
||||
format.setIndenting(true);
|
||||
format.setIndent(5);
|
||||
|
||||
try {
|
||||
Document document = xmlConfig.createDoc();
|
||||
|
||||
Element element = document.getDocumentElement();
|
||||
element.setAttribute("xmlns", "http://www.w3schools.com");
|
||||
element.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||
element.setAttribute("xsi:schemaLocation", "http://www.w3schools.com vrp_xml_schema.xsd");
|
||||
|
||||
} catch (ConfigurationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
try {
|
||||
Writer out = new FileWriter(filename);
|
||||
XMLSerializer serializer = new XMLSerializer(out, format);
|
||||
serializer.serialize(xmlConfig.getDocument());
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void writeInitialRoutes(XMLConf xmlConfig) {
|
||||
if (vrp.getInitialVehicleRoutes().isEmpty()) return;
|
||||
String path = "initialRoutes.route";
|
||||
int routeCounter = 0;
|
||||
for (VehicleRoute route : vrp.getInitialVehicleRoutes()) {
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").driverId", route.getDriver().getId());
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").vehicleId", route.getVehicle().getId());
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").start", route.getStart().getEndTime());
|
||||
int actCounter = 0;
|
||||
for (TourActivity act : route.getTourActivities().getActivities()) {
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ")[@type]", act.getName());
|
||||
if (act instanceof TourActivity.JobActivity) {
|
||||
Job job = ((TourActivity.JobActivity) act).getJob();
|
||||
if (job instanceof Service) {
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ").serviceId", job.getId());
|
||||
} else if (job instanceof Shipment) {
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ").shipmentId", job.getId());
|
||||
} else if (job instanceof Break) {
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ").breakId", job.getId());
|
||||
} else {
|
||||
throw new IllegalStateException("cannot write solution correctly since job-type is not know. make sure you use either service or shipment, or another writer");
|
||||
}
|
||||
}
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ").arrTime", act.getArrTime());
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ").endTime", act.getEndTime());
|
||||
actCounter++;
|
||||
}
|
||||
xmlConfig.setProperty(path + "(" + routeCounter + ").end", route.getEnd().getArrTime());
|
||||
routeCounter++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void writeSolutions(XMLConf xmlConfig) {
|
||||
if (solutions == null) return;
|
||||
String solutionPath = "solutions.solution";
|
||||
int counter = 0;
|
||||
for (VehicleRoutingProblemSolution solution : solutions) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").cost", solution.getCost());
|
||||
int routeCounter = 0;
|
||||
List<VehicleRoute> list = new ArrayList<VehicleRoute>(solution.getRoutes());
|
||||
Collections.sort(list , new VehicleIndexComparator());
|
||||
for (VehicleRoute route : list) {
|
||||
// xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").cost", route.getCost());
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").driverId", route.getDriver().getId());
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").vehicleId", route.getVehicle().getId());
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").start", route.getStart().getEndTime());
|
||||
int actCounter = 0;
|
||||
for (TourActivity act : route.getTourActivities().getActivities()) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ")[@type]", act.getName());
|
||||
if (act instanceof TourActivity.JobActivity) {
|
||||
Job job = ((TourActivity.JobActivity) act).getJob();
|
||||
if (job instanceof Service) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").serviceId", job.getId());
|
||||
} else if (job instanceof Shipment) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").shipmentId", job.getId());
|
||||
} else if (job instanceof Break) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").breakId", job.getId());
|
||||
} else {
|
||||
throw new IllegalStateException("cannot write solution correctly since job-type is not know. make sure you use either service or shipment, or another writer");
|
||||
}
|
||||
}
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").arrTime", act.getArrTime());
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").endTime", act.getEndTime());
|
||||
actCounter++;
|
||||
}
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").end", route.getEnd().getArrTime());
|
||||
routeCounter++;
|
||||
}
|
||||
int unassignedJobCounter = 0;
|
||||
for (Job unassignedJob : solution.getUnassignedJobs()) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").unassignedJobs.job(" + unassignedJobCounter + ")[@id]", unassignedJob.getId());
|
||||
unassignedJobCounter++;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeServices(XMLConf xmlConfig, List<Job> jobs) {
|
||||
String shipmentPathString = "services.service";
|
||||
int counter = 0;
|
||||
for (Job j : jobs) {
|
||||
if (!(j instanceof Service)) continue;
|
||||
Service service = (Service) j;
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@id]", service.getId());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@type]", service.getType());
|
||||
if (service.getLocation().getId() != null)
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").location.id", service.getLocation().getId());
|
||||
if (service.getLocation().getCoordinate() != null) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").location.coord[@x]", service.getLocation().getCoordinate().getX());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").location.coord[@y]", service.getLocation().getCoordinate().getY());
|
||||
}
|
||||
if (service.getLocation().getIndex() != Location.NO_INDEX) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").location.index", service.getLocation().getIndex());
|
||||
}
|
||||
for (int i = 0; i < service.getSize().getNuOfDimensions(); i++) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").capacity-dimensions.dimension(" + i + ")[@index]", i);
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").capacity-dimensions.dimension(" + i + ")", service.getSize().get(i));
|
||||
}
|
||||
|
||||
Collection<TimeWindow> tws = service.getTimeWindows();
|
||||
int index = 0;
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").duration", service.getServiceDuration());
|
||||
for(TimeWindow tw : tws) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").timeWindows.timeWindow(" + index + ").start", tw.getStart());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").timeWindows.timeWindow(" + index + ").end", tw.getEnd());
|
||||
++index;
|
||||
}
|
||||
|
||||
//skills
|
||||
String skillString = getSkillString(service);
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").requiredSkills", skillString);
|
||||
|
||||
//name
|
||||
if (service.getName() != null) {
|
||||
if (!service.getName().equals("no-name")) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").name", service.getName());
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeShipments(XMLConf xmlConfig, List<Job> jobs) {
|
||||
String shipmentPathString = "shipments.shipment";
|
||||
int counter = 0;
|
||||
for (Job j : jobs) {
|
||||
if (!(j instanceof Shipment)) continue;
|
||||
Shipment shipment = (Shipment) j;
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@id]", shipment.getId());
|
||||
// xmlConfig.setProperty(shipmentPathString + "("+counter+")[@type]", service.getType());
|
||||
if (shipment.getPickupLocation().getId() != null)
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.location.id", shipment.getPickupLocation().getId());
|
||||
if (shipment.getPickupLocation().getCoordinate() != null) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.location.coord[@x]", shipment.getPickupLocation().getCoordinate().getX());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.location.coord[@y]", shipment.getPickupLocation().getCoordinate().getY());
|
||||
}
|
||||
if (shipment.getPickupLocation().getIndex() != Location.NO_INDEX) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.location.index", shipment.getPickupLocation().getIndex());
|
||||
}
|
||||
|
||||
Collection<TimeWindow> pu_tws = shipment.getPickupTimeWindows();
|
||||
int index = 0;
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.duration", shipment.getPickupServiceTime());
|
||||
for(TimeWindow tw : pu_tws) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.timeWindows.timeWindow(" + index + ").start", tw.getStart());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").pickup.timeWindows.timeWindow(" + index + ").end", tw.getEnd());
|
||||
++index;
|
||||
}
|
||||
|
||||
if (shipment.getDeliveryLocation().getId() != null)
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.location.id", shipment.getDeliveryLocation().getId());
|
||||
if (shipment.getDeliveryLocation().getCoordinate() != null) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.location.coord[@x]", shipment.getDeliveryLocation().getCoordinate().getX());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.location.coord[@y]", shipment.getDeliveryLocation().getCoordinate().getY());
|
||||
}
|
||||
if (shipment.getDeliveryLocation().getIndex() != Location.NO_INDEX) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.location.index", shipment.getDeliveryLocation().getIndex());
|
||||
}
|
||||
|
||||
Collection<TimeWindow> del_tws = shipment.getDeliveryTimeWindows();
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.duration", shipment.getDeliveryServiceTime());
|
||||
index = 0;
|
||||
for(TimeWindow tw : del_tws) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.timeWindows.timeWindow(" + index + ").start", tw.getStart());
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").delivery.timeWindows.timeWindow(" + index + ").end", tw.getEnd());
|
||||
++index;
|
||||
}
|
||||
|
||||
for (int i = 0; i < shipment.getSize().getNuOfDimensions(); i++) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").capacity-dimensions.dimension(" + i + ")[@index]", i);
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").capacity-dimensions.dimension(" + i + ")", shipment.getSize().get(i));
|
||||
}
|
||||
|
||||
//skills
|
||||
String skillString = getSkillString(shipment);
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").requiredSkills", skillString);
|
||||
|
||||
//name
|
||||
if (shipment.getName() != null) {
|
||||
if (!shipment.getName().equals("no-name")) {
|
||||
xmlConfig.setProperty(shipmentPathString + "(" + counter + ").name", shipment.getName());
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeProblemType(XMLConfiguration xmlConfig) {
|
||||
xmlConfig.setProperty("problemType.fleetSize", vrp.getFleetSize());
|
||||
}
|
||||
|
||||
private void writeVehiclesAndTheirTypes(XMLConfiguration xmlConfig) {
|
||||
|
||||
//vehicles
|
||||
String vehiclePathString = Schema.VEHICLES + "." + Schema.VEHICLE;
|
||||
int counter = 0;
|
||||
for (Vehicle vehicle : vrp.getVehicles()) {
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").id", vehicle.getId());
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").typeId", vehicle.getType().getTypeId());
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").startLocation.id", vehicle.getStartLocation().getId());
|
||||
if (vehicle.getStartLocation().getCoordinate() != null) {
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").startLocation.coord[@x]", vehicle.getStartLocation().getCoordinate().getX());
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").startLocation.coord[@y]", vehicle.getStartLocation().getCoordinate().getY());
|
||||
}
|
||||
if (vehicle.getStartLocation().getIndex() != Location.NO_INDEX) {
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").startLocation.index", vehicle.getStartLocation().getIndex());
|
||||
}
|
||||
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").endLocation.id", vehicle.getEndLocation().getId());
|
||||
if (vehicle.getEndLocation().getCoordinate() != null) {
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").endLocation.coord[@x]", vehicle.getEndLocation().getCoordinate().getX());
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").endLocation.coord[@y]", vehicle.getEndLocation().getCoordinate().getY());
|
||||
}
|
||||
if (vehicle.getEndLocation().getIndex() != Location.NO_INDEX) {
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").endLocation.index", vehicle.getEndLocation().getId());
|
||||
}
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").timeSchedule.start", vehicle.getEarliestDeparture());
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").timeSchedule.end", vehicle.getLatestArrival());
|
||||
|
||||
if (vehicle.getBreak() != null) {
|
||||
Collection<TimeWindow> tws = vehicle.getBreak().getTimeWindows();
|
||||
int index = 0;
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").breaks.duration", vehicle.getBreak().getServiceDuration());
|
||||
for(TimeWindow tw : tws) {
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").breaks.timeWindows.timeWindow(" + index + ").start", tw.getStart());
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").breaks.timeWindows.timeWindow(" + index + ").end", tw.getEnd());
|
||||
++index;
|
||||
}
|
||||
}
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").returnToDepot", vehicle.isReturnToDepot());
|
||||
|
||||
//write skills
|
||||
String skillString = getSkillString(vehicle);
|
||||
xmlConfig.setProperty(vehiclePathString + "(" + counter + ").skills", skillString);
|
||||
|
||||
counter++;
|
||||
}
|
||||
|
||||
//types
|
||||
String typePathString = Schema.builder().append(Schema.TYPES).dot(Schema.TYPE).build();
|
||||
int typeCounter = 0;
|
||||
for (VehicleType type : vrp.getTypes()) {
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").id", type.getTypeId());
|
||||
|
||||
for (int i = 0; i < type.getCapacityDimensions().getNuOfDimensions(); i++) {
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").capacity-dimensions.dimension(" + i + ")[@index]", i);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").capacity-dimensions.dimension(" + i + ")", type.getCapacityDimensions().get(i));
|
||||
}
|
||||
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.fixed", type.getVehicleCostParams().fix);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.distance", type.getVehicleCostParams().perDistanceUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.time", type.getVehicleCostParams().perTransportTimeUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.service", type.getVehicleCostParams().perServiceTimeUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.wait", type.getVehicleCostParams().perWaitingTimeUnit);
|
||||
typeCounter++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private String getSkillString(Vehicle vehicle) {
|
||||
return createSkillString(vehicle.getSkills());
|
||||
}
|
||||
|
||||
private String getSkillString(Job job) {
|
||||
return createSkillString(job.getRequiredSkills());
|
||||
}
|
||||
|
||||
private String createSkillString(Skills skills) {
|
||||
if (skills.values().size() == 0) return null;
|
||||
String skillString = null;
|
||||
for (String skill : skills.values()) {
|
||||
if (skillString == null) skillString = skill;
|
||||
else skillString += ", " + skill;
|
||||
}
|
||||
return skillString;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,276 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com"
|
||||
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
|
||||
|
||||
<xs:element name="algorithm">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice>
|
||||
<xs:element name="iterations" type="xs:integer" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="maxIterations" type="xs:integer" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:choice>
|
||||
|
||||
<xs:choice>
|
||||
<xs:element name="prematureBreak" type="prematureBreakType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="terminationCriteria">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="termination" type="prematureBreakType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
|
||||
|
||||
<xs:element name="construction" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="insertion" type="insertionType" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="strategy">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="memory" type="xs:integer" minOccurs="0" maxOccurs="1" default="1"/>
|
||||
<xs:element name="searchStrategies" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="searchStrategy" type="searchStrategyType" minOccurs="1"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:complexType name="searchStrategyType">
|
||||
<xs:sequence>
|
||||
<xs:element name="selector" type="selectorType"/>
|
||||
<xs:element name="acceptor" type="acceptorType"/>
|
||||
<xs:element name="modules" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="module" type="moduleType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="probability">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:double">
|
||||
<xs:minInclusive value="0.0"/>
|
||||
<xs:maxInclusive value="1.0"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="selectorType">
|
||||
<xs:attribute name="name">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="selectBest"/>
|
||||
<xs:enumeration value="selectRandomly"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="acceptorType">
|
||||
<xs:sequence>
|
||||
<xs:element name="alpha" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:choice>
|
||||
<xs:element name="warmup" type="xs:int" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="initialThreshold" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:choice>
|
||||
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="acceptNewRemoveWorst"/>
|
||||
<xs:enumeration value="schrimpfAcceptance"/>
|
||||
<xs:enumeration value="experimentalSchrimpfAcceptance"/>
|
||||
<xs:enumeration value="acceptNewRemoveFirst"/>
|
||||
<xs:enumeration value="greedyAcceptance"/>
|
||||
<xs:enumeration value="greedyAcceptance_minVehFirst"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="prematureBreakType">
|
||||
<xs:choice>
|
||||
<xs:group ref="pBreak_iteration_group"/>
|
||||
<xs:group ref="pBreak_time_group"/>
|
||||
<xs:group ref="pBreak_variationCoefficient_group"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="basedOn">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="time"/>
|
||||
<xs:enumeration value="iterations"/>
|
||||
<xs:enumeration value="variationCoefficient"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:group name="pBreak_iteration_group">
|
||||
<xs:sequence>
|
||||
<xs:element name="iterations" type="xs:integer" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:group name="pBreak_time_group">
|
||||
<xs:sequence>
|
||||
<xs:element name="time" type="xs:long" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:group name="pBreak_variationCoefficient_group">
|
||||
<xs:sequence>
|
||||
<xs:element name="threshold" type="xs:double" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="iterations" type="xs:integer" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:complexType name="moduleType">
|
||||
<xs:choice>
|
||||
<xs:group ref="ruin_and_recreate_group"/>
|
||||
<xs:group ref="gendreau_group"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="name">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="ruin_and_recreate"/>
|
||||
<xs:enumeration value="gendreau"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:group name="ruin_and_recreate_group">
|
||||
<xs:sequence>
|
||||
<xs:element name="ruin" type="ruinType"/>
|
||||
<xs:element name="insertion" type="insertionType"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:group name="gendreau_group">
|
||||
<xs:sequence>
|
||||
<xs:element name="iterations" type="xs:integer"/>
|
||||
<xs:element name="share" type="xs:double"/>
|
||||
<xs:element name="ruin" type="ruinType"/>
|
||||
<xs:element name="insertion" type="insertionType"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:complexType name="ruinType">
|
||||
<xs:sequence>
|
||||
<xs:element name="share" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:double">
|
||||
<xs:minInclusive value="0.0"/>
|
||||
<xs:maxInclusive value="1.0"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="distance" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="euclidean"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" use="required">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="randomRuin"/>
|
||||
<xs:enumeration value="radialRuin"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="id" type="xs:string"/>
|
||||
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<xs:complexType name="insertionType">
|
||||
<xs:all>
|
||||
<xs:element name="level" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="forwardLooking" type="xs:string"/>
|
||||
<xs:attribute name="memory" type="xs:string"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="considerFixedCosts" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="weight" type="xs:double"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="allowVehicleSwitch" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="fastRegret" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="experimental" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:any minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="timeSlice" type="xs:string"/>
|
||||
<xs:attribute name="neighboringSlices" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
|
||||
</xs:element>
|
||||
|
||||
</xs:all>
|
||||
<xs:attribute name="name" use="required">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="bestInsertion"/>
|
||||
<xs:enumeration value="regretInsertion"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="id" type="xs:string"/>
|
||||
|
||||
</xs:complexType>
|
||||
|
||||
</xs:schema>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<config>
|
||||
|
||||
<controler>
|
||||
<iterations>2000</iterations>
|
||||
</controler>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>3</memory>
|
||||
<searchStrategies>
|
||||
|
||||
<searchStrategy id="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<!-- <acceptor id="1" name="schrimpfAcceptance">
|
||||
<alpha>0.1</alpha>
|
||||
<iterations>10</iterations>
|
||||
</acceptor> -->
|
||||
<modules>
|
||||
<module name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</module>
|
||||
<module name="bestInsertion"></module>
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy id="radialRuinAndRecreate">
|
||||
<selector id="1" name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<!-- <acceptor id="1" name="schrimpfAcceptance">
|
||||
<alpha>0.1</alpha>
|
||||
<iterations>10</iterations>
|
||||
</acceptor> -->
|
||||
<modules>
|
||||
<module name="radialRuin">
|
||||
<share>0.3</share>
|
||||
<distanceMeasure>euclid</distanceMeasure>
|
||||
</module>
|
||||
<module name="bestInsertion"></module>
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<!-- <searchStrategy id="gendreauPostOpt"> -->
|
||||
<!-- <modules> -->
|
||||
<!-- <module name="gendreauPostOpt"> -->
|
||||
<!-- <iterations>200</iterations> -->
|
||||
<!-- <share>0.2</share> -->
|
||||
<!-- </module> -->
|
||||
<!-- </modules> -->
|
||||
<!-- <probability>0.1</probability> -->
|
||||
<!-- </searchStrategy> --> -->
|
||||
</searchStrategies>
|
||||
|
||||
<before></before>
|
||||
|
||||
<after></after>
|
||||
|
||||
</strategy>
|
||||
|
||||
|
||||
</config>
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveFirst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveFirst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="schrimpfAcceptance">
|
||||
<alpha>0.4</alpha>
|
||||
<warmup>100</warmup>
|
||||
</acceptor>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="schrimpfAcceptance"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,405 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com"
|
||||
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
|
||||
|
||||
<xs:element name="problem">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="problemType" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="fleetSize">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="INFINITE"/>
|
||||
<xs:enumeration value="FINITE"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="fleetComposition" minOccurs="0" maxOccurs="1">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="HOMOGENEOUS"/>
|
||||
<xs:enumeration value="HETEROGENEOUS"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="vehicles" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="vehicle" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="location" type="locationType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="startLocation" type="locationType" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="endLocation" type="locationType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="typeId" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="timeSchedule" type="timeWindowType"/>
|
||||
<xs:element name="returnToDepot" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="skills" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="breaks" type="breaksType" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:all>
|
||||
<xs:attribute name="type" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="vehicleTypes" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="type" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="capacity" type="xs:integer" minOccurs="0" maxOccurs="1"
|
||||
default="0"/>
|
||||
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="dimension" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:integer">
|
||||
<xs:attribute name="index" type="xs:integer"
|
||||
use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="costs">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="fixed" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="distance" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="time" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="service" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="wait" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="type" type="xs:string" use="optional"/>
|
||||
<xs:attribute name="penaltyFactor" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="services" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="service" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="location" type="locationType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="locationId" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="coord" type="coordType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="capacity-demand" type="xs:integer" minOccurs="0" maxOccurs="1"
|
||||
default="0"/>
|
||||
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="dimension" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:integer">
|
||||
<xs:attribute name="index" type="xs:integer"
|
||||
use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="duration" type="xs:decimal" minOccurs="0" maxOccurs="1"
|
||||
default="0.0"/>
|
||||
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="timeWindow" type="timeWindowType" minOccurs="1"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="requiredSkills" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:all>
|
||||
<xs:attribute name="id" type="xs:string" use="required"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="shipments" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="shipment" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="pickup" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="location" type="locationType" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="locationId" type="xs:string" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="coord" type="coordType" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="duration" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="timeWindow" type="timeWindowType"
|
||||
minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="delivery" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="location" type="locationType" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="locationId" type="xs:string" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="coord" type="coordType" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="duration" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="timeWindow" type="timeWindowType"
|
||||
minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="capacity-demand" type="xs:integer" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="dimension" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:integer">
|
||||
<xs:attribute name="index" type="xs:integer"
|
||||
use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="requiredSkills" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:all>
|
||||
<xs:attribute name="id" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="initialRoutes" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="route" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="driverId" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="vehicleId" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="start" type="xs:double" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="act" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:choice>
|
||||
<xs:group ref="serviceActGroup"/>
|
||||
<xs:group ref="shipmentActGroup"/>
|
||||
<xs:group ref="breakActGroup"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="type" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="end" type="xs:anySimpleType" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="solutions" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="solution" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="cost" type="xs:decimal"/>
|
||||
<xs:element name="routes" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="route" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="cost" type="xs:double" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="driverId" type="xs:string"
|
||||
minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="vehicleId" type="xs:string"
|
||||
minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="start" type="xs:double" minOccurs="1"
|
||||
maxOccurs="1"/>
|
||||
<xs:element name="act" minOccurs="0"
|
||||
maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:choice>
|
||||
<xs:group ref="serviceActGroup"/>
|
||||
<xs:group ref="shipmentActGroup"/>
|
||||
<xs:group ref="breakActGroup"/>
|
||||
|
||||
</xs:choice>
|
||||
<xs:attribute name="type" type="xs:string"
|
||||
use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="end" type="xs:double" minOccurs="1"
|
||||
maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="unassignedJobs" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="job" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
||||
</xs:complexType>
|
||||
|
||||
</xs:element>
|
||||
|
||||
</xs:sequence>
|
||||
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:group name="serviceActGroup">
|
||||
<xs:sequence>
|
||||
<xs:element name="serviceId" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="arrTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="endTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:group name="shipmentActGroup">
|
||||
<xs:sequence>
|
||||
<xs:element name="shipmentId" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="arrTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="endTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:group name="breakActGroup">
|
||||
<xs:sequence>
|
||||
<xs:element name="breakId" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element name="arrTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="endTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:group>
|
||||
|
||||
<xs:complexType name="timeWindowType">
|
||||
<xs:sequence>
|
||||
<xs:element name="start" type="xs:double"/>
|
||||
<xs:element name="end" type="xs:double"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="locationType">
|
||||
<xs:all>
|
||||
<xs:element name="id" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="coord" type="coordType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="index" type="xs:int" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="breaksType">
|
||||
<xs:sequence>
|
||||
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="timeWindow" type="timeWindowType" minOccurs="1"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="duration" type="xs:double" minOccurs="1" maxOccurs="1" default="0.0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="coordType">
|
||||
<xs:attribute name="x" type="xs:double" use="required"/>
|
||||
<xs:attribute name="y" type="xs:double" use="required"/>
|
||||
</xs:complexType>
|
||||
|
||||
</xs:schema>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
Assert.assertTrue(true);
|
||||
} catch (Exception e) {
|
||||
Assert.assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
assertTrue(!solutions.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
Assert.assertTrue(true);
|
||||
} catch (Exception e) {
|
||||
Assert.assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
SolutionAnalyser sa = new SolutionAnalyser(vrp, Solutions.bestOf(solutions), new TransportDistance() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
assertEquals(530.0, Solutions.bestOf(solutions).getCost(), 50.0);
|
||||
assertEquals(5, Solutions.bestOf(solutions).getRoutes().size());
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,80 +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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Contributors:
|
||||
* Stefan Schroeder - initial API and implementation
|
||||
******************************************************************************/
|
||||
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.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;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class FiniteVehicleFleetManagerIdentifiesDistinctVehicle_IT {
|
||||
|
||||
@Test
|
||||
@Category(IntegrationTest.class)
|
||||
public void whenEmployingVehicleWhereOnlyOneDistinctVehicleCanServeAParticularJob_algorithmShouldFoundDistinctSolution() {
|
||||
final List<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
} catch (NoSolutionFoundException e) {
|
||||
testFailed.add(true);
|
||||
}
|
||||
}
|
||||
assertTrue(testFailed.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenEmployingVehicleWhereOnlyOneDistinctVehicleCanServeAParticularJobWith_jspritAlgorithmShouldFoundDistinctSolution() {
|
||||
final List<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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 = Jsprit.createAlgorithm(vrp);
|
||||
vra.setMaxIterations(10);
|
||||
try {
|
||||
@SuppressWarnings("unused")
|
||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
} catch (NoSolutionFoundException e) {
|
||||
testFailed.add(true);
|
||||
}
|
||||
}
|
||||
assertTrue(testFailed.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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<AbstractActivity> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoute> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
assertFalse(secondActIsPickup(solutions));
|
||||
|
||||
}
|
||||
|
||||
private boolean secondActIsPickup(Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
|
||||
TourActivity secondAct = solution.getRoutes().iterator().next().getActivities().get(1);
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
vra.addListener(new JobInsertedListener() {
|
||||
|
|
@ -89,17 +101,12 @@ public class MeetTimeWindowConstraint_IT {
|
|||
});
|
||||
@SuppressWarnings("unused")
|
||||
Collection<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> 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<Boolean> testFailed = new ArrayList<Boolean>();
|
||||
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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
assertEquals(1650.8, Solutions.bestOf(solutions).getCost(), 80.);
|
||||
assertEquals(19, Solutions.bestOf(solutions).getRoutes().size(), 1);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 <selector name=\"selectRandomly\"/>: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
Assert.assertEquals(828.94, Solutions.bestOf(solutions).getCost(), 0.01);
|
||||
|
|
|
|||
|
|
@ -1,285 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.io;
|
||||
|
||||
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;
|
||||
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 junit.framework.Assert;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
public class TestAlgorithmReader {
|
||||
|
||||
AlgorithmConfig config;
|
||||
|
||||
VehicleRoutingProblem vrp;
|
||||
|
||||
Collection<VehicleRoutingProblemSolution> solutions;
|
||||
|
||||
@Before
|
||||
public void doBefore() throws ConfigurationException {
|
||||
config = new AlgorithmConfig();
|
||||
new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read("src/test/resources/testConfig.xml");
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
solutions = new ArrayList<VehicleRoutingProblemSolution>();
|
||||
new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrp.xml");
|
||||
vrp = vrpBuilder.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReadMaxIterations() {
|
||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest.xml");
|
||||
Assert.assertEquals(2000, vra.getMaxIterations());
|
||||
}
|
||||
|
||||
static class IterationCounter implements IterationEndsListener {
|
||||
|
||||
int iterations = 0;
|
||||
|
||||
@Override
|
||||
public void informIterationEnds(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||
iterations = i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSettingPrematureBreak_itShouldReadTermination() {
|
||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest2.xml");
|
||||
IterationCounter iCounter = new IterationCounter();
|
||||
vra.addListener(iCounter);
|
||||
vra.searchSolutions();
|
||||
Assert.assertEquals(100, iCounter.iterations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReadTermination() {
|
||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest.xml");
|
||||
IterationCounter iCounter = new IterationCounter();
|
||||
vra.addListener(iCounter);
|
||||
vra.searchSolutions();
|
||||
Assert.assertEquals(25, iCounter.iterations);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTypedMap() {
|
||||
VehicleRoutingAlgorithms.TypedMap typedMap = new VehicleRoutingAlgorithms.TypedMap();
|
||||
|
||||
String acceptorName = "acceptor";
|
||||
String acceptorId = "acceptorId";
|
||||
|
||||
ModKey key = new ModKey(acceptorName, acceptorId);
|
||||
AcceptorKey accKey = new AcceptorKey(key);
|
||||
|
||||
SolutionAcceptor acceptor = new GreedyAcceptance(1);
|
||||
|
||||
typedMap.put(accKey, acceptor);
|
||||
|
||||
assertEquals(acceptor, typedMap.get(accKey));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedMap2() {
|
||||
VehicleRoutingAlgorithms.TypedMap typedMap = new VehicleRoutingAlgorithms.TypedMap();
|
||||
|
||||
String acceptorName = "acceptor";
|
||||
String acceptorId = "acceptorId";
|
||||
|
||||
String selectorName = "selector";
|
||||
String selectorId = "selectorId";
|
||||
|
||||
ModKey key = new ModKey(acceptorName, acceptorId);
|
||||
AcceptorKey accKey = new AcceptorKey(key);
|
||||
SolutionAcceptor acceptor = new GreedyAcceptance(1);
|
||||
|
||||
SelectorKey selKey = new SelectorKey(new ModKey(selectorName, selectorId));
|
||||
SolutionSelector selector = new SelectBest();
|
||||
|
||||
typedMap.put(accKey, acceptor);
|
||||
typedMap.put(selKey, selector);
|
||||
|
||||
assertEquals(acceptor, typedMap.get(accKey));
|
||||
assertEquals(selector, typedMap.get(selKey));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedMap3() {
|
||||
VehicleRoutingAlgorithms.TypedMap typedMap = new VehicleRoutingAlgorithms.TypedMap();
|
||||
|
||||
String acceptorName = "acceptor";
|
||||
String acceptorId = "acceptorId";
|
||||
|
||||
String acceptorName2 = "acceptor2";
|
||||
String acceptorId2 = "acceptorId2";
|
||||
|
||||
String selectorName = "selector";
|
||||
String selectorId = "selectorId";
|
||||
|
||||
ModKey key = new ModKey(acceptorName, acceptorId);
|
||||
AcceptorKey accKey = new AcceptorKey(key);
|
||||
SolutionAcceptor acceptor = new GreedyAcceptance(1);
|
||||
|
||||
SelectorKey selKey = new SelectorKey(new ModKey(selectorName, selectorId));
|
||||
SolutionSelector selector = new SelectBest();
|
||||
|
||||
AcceptorKey accKey2 = new AcceptorKey(new ModKey(acceptorName2, acceptorId2));
|
||||
SolutionAcceptor acceptor2 = new GreedyAcceptance(1);
|
||||
|
||||
typedMap.put(accKey, acceptor);
|
||||
typedMap.put(selKey, selector);
|
||||
typedMap.put(accKey2, acceptor2);
|
||||
|
||||
assertEquals(acceptor, typedMap.get(accKey));
|
||||
assertEquals(selector, typedMap.get(selKey));
|
||||
assertEquals(acceptor2, typedMap.get(accKey2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedMap4() {
|
||||
VehicleRoutingAlgorithms.TypedMap typedMap = new VehicleRoutingAlgorithms.TypedMap();
|
||||
|
||||
String acceptorName = "acceptor";
|
||||
String acceptorId = "acceptorId";
|
||||
|
||||
ModKey key = new ModKey(acceptorName, acceptorId);
|
||||
RuinStrategyKey accKey = new RuinStrategyKey(key);
|
||||
RuinStrategy acceptor = new RuinStrategy() {
|
||||
|
||||
@Override
|
||||
public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addListener(RuinListener ruinListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(RuinListener ruinListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<RuinListener> getListeners() {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
StrategyModuleKey moduleKey = new StrategyModuleKey(key);
|
||||
SearchStrategyModule stratModule = new SearchStrategyModule() {
|
||||
|
||||
@Override
|
||||
public VehicleRoutingProblemSolution runAndGetSolution(VehicleRoutingProblemSolution vrpSolution) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModuleListener(
|
||||
SearchStrategyModuleListener moduleListener) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
typedMap.put(accKey, acceptor);
|
||||
typedMap.put(moduleKey, stratModule);
|
||||
typedMap.put(moduleKey, stratModule);
|
||||
|
||||
assertEquals(acceptor, typedMap.get(accKey));
|
||||
assertEquals(stratModule, typedMap.get(moduleKey));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initialiseConstructionAlgoCorrectly() {
|
||||
VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreatingAlgorithm_nOfStrategiesIsCorrect() {
|
||||
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
|
||||
assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreatingAlgorithm_nOfIterationsIsReadCorrectly() {
|
||||
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
|
||||
assertEquals(10, algo.getMaxIterations());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreatingAlgorithm_nOfStrategyModulesIsCorrect() {
|
||||
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
|
||||
int nOfModules = 0;
|
||||
for (SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()) {
|
||||
nOfModules += strat.getSearchStrategyModules().size();
|
||||
}
|
||||
assertEquals(3, nOfModules);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readerTest_whenReadingAlgoWithSchemaValidation_itReadsCorrectly() {
|
||||
AlgorithmConfig algoConfig = new AlgorithmConfig();
|
||||
new AlgorithmConfigXmlReader(algoConfig).read("src/test/resources/algorithmConfig.xml");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readerTest_whenReadingAlgoWithSchemaValidationWithoutIterations_itReadsCorrectly() {
|
||||
AlgorithmConfig algoConfig = new AlgorithmConfig();
|
||||
new AlgorithmConfigXmlReader(algoConfig).read("src/test/resources/algorithmConfig_withoutIterations.xml");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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<VehicleRoutingProblemSolution> 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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> 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<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
Assert.assertEquals(10.0, Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(), 0.1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,644 +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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.problem.io;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
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.activity.DeliverShipment;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.PickupService;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.PickupShipment;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||
import com.graphhopper.jsprit.core.util.Solutions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class VrpXMLReaderTest {
|
||||
|
||||
private String inFileName;
|
||||
|
||||
@Before
|
||||
public void doBefore() {
|
||||
inFileName = "src/test/resources/finiteVrpForReaderTest.xml";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReadNameOfService() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s = (Service) vrp.getJobs().get("1");
|
||||
assertTrue(s.getName().equals("cleaning"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReadNameOfShipment() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertTrue(s.getName().equals("deliver-smth"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVrp_problemTypeIsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(FleetSize.FINITE, vrp.getFleetSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVrp_vehiclesAreReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(5, vrp.getVehicles().size());
|
||||
assertTrue(idsInCollection(Arrays.asList("v1", "v2"), vrp.getVehicles()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVrp_vehiclesAreReadCorrectly2() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v1 = getVehicle("v1", vrp.getVehicles());
|
||||
assertEquals(20, v1.getType().getCapacityDimensions().get(0));
|
||||
assertEquals(100.0, v1.getStartLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(0.0, v1.getEarliestDeparture(), 0.01);
|
||||
assertEquals("depotLoc2", v1.getStartLocation().getId());
|
||||
assertNotNull(v1.getType());
|
||||
assertEquals("vehType", v1.getType().getTypeId());
|
||||
assertNotNull(v1.getStartLocation());
|
||||
assertEquals(1, v1.getStartLocation().getIndex());
|
||||
assertEquals(1000.0, v1.getLatestArrival(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVehicles_skill1ShouldBeAssigned() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v1 = getVehicle("v1", vrp.getVehicles());
|
||||
assertTrue(v1.getSkills().containsSkill("skill1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVehicles_skill2ShouldBeAssigned() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v1 = getVehicle("v1", vrp.getVehicles());
|
||||
assertTrue(v1.getSkills().containsSkill("skill2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVehicles_nuSkillsShouldBeCorrect() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v1 = getVehicle("v1", vrp.getVehicles());
|
||||
assertEquals(2, v1.getSkills().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVehicles_nuSkillsOfV2ShouldBeCorrect() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v2", vrp.getVehicles());
|
||||
assertEquals(0, v.getSkills().values().size());
|
||||
}
|
||||
|
||||
private Vehicle getVehicle(String string, Collection<Vehicle> vehicles) {
|
||||
for (Vehicle v : vehicles) if (string.equals(v.getId())) return v;
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean idsInCollection(List<String> asList, Collection<Vehicle> vehicles) {
|
||||
List<String> ids = new ArrayList<String>(asList);
|
||||
for (Vehicle v : vehicles) {
|
||||
if (ids.contains(v.getId())) ids.remove(v.getId());
|
||||
}
|
||||
return ids.isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVrp_vehicleTypesAreReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(3, vrp.getTypes().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingVrpWithInfiniteSize_itReadsCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(FleetSize.FINITE, vrp.getFleetSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_nuOfJobsIsReadThemCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(4, vrp.getJobs().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingServices_itReadsThemCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
int servCounter = 0;
|
||||
for (Job j : vrp.getJobs().values()) {
|
||||
if (j instanceof Service) servCounter++;
|
||||
}
|
||||
assertEquals(2, servCounter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingService1_skill1ShouldBeAssigned() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s = (Service) vrp.getJobs().get("1");
|
||||
assertTrue(s.getRequiredSkills().containsSkill("skill1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingService1_skill2ShouldBeAssigned() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s = (Service) vrp.getJobs().get("1");
|
||||
assertTrue(s.getRequiredSkills().containsSkill("skill2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingService1_nuSkillsShouldBeCorrect() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s = (Service) vrp.getJobs().get("1");
|
||||
assertEquals(2, s.getRequiredSkills().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingService2_nuSkillsOfV2ShouldBeCorrect() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s = (Service) vrp.getJobs().get("2");
|
||||
assertEquals(0, s.getRequiredSkills().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingShipments_itReadsThemCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
int shipCounter = 0;
|
||||
for (Job j : vrp.getJobs().values()) {
|
||||
if (j instanceof Shipment) shipCounter++;
|
||||
}
|
||||
assertEquals(2, shipCounter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingShipment3_skill1ShouldBeAssigned() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertTrue(s.getRequiredSkills().containsSkill("skill1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingShipment3_skill2ShouldBeAssigned() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertTrue(s.getRequiredSkills().containsSkill("skill2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingShipment3_nuSkillsShouldBeCorrect() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(2, s.getRequiredSkills().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingShipment4_nuSkillsOfV2ShouldBeCorrect() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||
assertEquals(0, s.getRequiredSkills().values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingServices_capOfService1IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s1 = (Service) vrp.getJobs().get("1");
|
||||
assertEquals(1, s1.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingServices_durationOfService1IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s1 = (Service) vrp.getJobs().get("1");
|
||||
assertEquals(10.0, s1.getServiceDuration(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingServices_twOfService1IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s1 = (Service) vrp.getJobs().get("1");
|
||||
assertEquals(0.0, s1.getTimeWindow().getStart(), 0.01);
|
||||
assertEquals(4000.0, s1.getTimeWindow().getEnd(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingServices_typeOfService1IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Service s1 = (Service) vrp.getJobs().get("1");
|
||||
assertEquals("service", s1.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v2MustNotReturnToDepot() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v2", vrp.getVehicles());
|
||||
assertFalse(v.isReturnToDepot());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v3HasTheCorrectStartLocation() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v3 = getVehicle("v3", vrp.getVehicles());
|
||||
assertEquals("startLoc", v3.getStartLocation().getId());
|
||||
assertNotNull(v3.getEndLocation());
|
||||
assertEquals(4, v3.getEndLocation().getIndex());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v3HasTheCorrectEndLocation() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v3 = getVehicle("v3", vrp.getVehicles());
|
||||
assertEquals("endLoc", v3.getEndLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v3HasTheCorrectEndLocationCoordinate() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v3 = getVehicle("v3", vrp.getVehicles());
|
||||
assertEquals(1000.0, v3.getEndLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(2000.0, v3.getEndLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v3HasTheCorrectStartLocationCoordinate() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v3 = getVehicle("v3", vrp.getVehicles());
|
||||
assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(100.0, v3.getStartLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v3HasTheCorrectLocationCoordinate() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v3 = getVehicle("v3", vrp.getVehicles());
|
||||
assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(100.0, v3.getStartLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v3HasTheCorrectLocationId() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v3 = getVehicle("v3", vrp.getVehicles());
|
||||
assertEquals("startLoc", v3.getStartLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v4HasTheCorrectStartLocation() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v4", vrp.getVehicles());
|
||||
assertEquals("startLoc", v.getStartLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v4HasTheCorrectEndLocation() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v4", vrp.getVehicles());
|
||||
assertEquals("endLoc", v.getEndLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v4HasTheCorrectEndLocationCoordinate() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v4", vrp.getVehicles());
|
||||
assertEquals(1000.0, v.getEndLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(2000.0, v.getEndLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v4HasTheCorrectStartLocationCoordinate() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v4", vrp.getVehicles());
|
||||
assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(100.0, v.getStartLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v4HasTheCorrectLocationCoordinate() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v4", vrp.getVehicles());
|
||||
assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(100.0, v.getStartLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v4HasTheCorrectLocationId() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v4", vrp.getVehicles());
|
||||
assertEquals("startLoc", v.getStartLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_capOfShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(10, s.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_pickupServiceTimeOfShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(10.0, s.getPickupServiceTime(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_pickupTimeWindowOfShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(1000.0, s.getPickupTimeWindow().getStart(), 0.01);
|
||||
assertEquals(4000.0, s.getPickupTimeWindow().getEnd(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_deliveryTimeWindowOfShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(6000.0, s.getDeliveryTimeWindow().getStart(), 0.01);
|
||||
assertEquals(10000.0, s.getDeliveryTimeWindow().getEnd(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_deliveryServiceTimeOfShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(100.0, s.getDeliveryServiceTime(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_deliveryCoordShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(10.0, s.getDeliveryLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(0.0, s.getDeliveryLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_pickupCoordShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals(10.0, s.getPickupLocation().getCoordinate().getX(), 0.01);
|
||||
assertEquals(10.0, s.getPickupLocation().getCoordinate().getY(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_deliveryIdShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals("i(9,9)", s.getDeliveryLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_pickupIdShipment3IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||
assertEquals("i(3,9)", s.getPickupLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_pickupLocationIdShipment4IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||
assertEquals("[x=10.0][y=10.0]", s.getPickupLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_deliveryLocationIdShipment4IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||
assertEquals("[x=10.0][y=0.0]", s.getDeliveryLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_pickupServiceTimeOfShipment4IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||
assertEquals(0.0, s.getPickupServiceTime(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingJobs_deliveryServiceTimeOfShipment4IsReadCorrectly() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||
assertEquals(100.0, s.getDeliveryServiceTime(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenReadingFile_v5AndItsTypeHasTheCorrectCapacityDimensionValues() {
|
||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v5", vrp.getVehicles());
|
||||
assertEquals(100, v.getType().getCapacityDimensions().get(0));
|
||||
assertEquals(1000, v.getType().getCapacityDimensions().get(1));
|
||||
assertEquals(10000, v.getType().getCapacityDimensions().get(2));
|
||||
assertEquals(0, v.getType().getCapacityDimensions().get(3));
|
||||
assertEquals(0, v.getType().getCapacityDimensions().get(5));
|
||||
assertEquals(100000, v.getType().getCapacityDimensions().get(10));
|
||||
}
|
||||
|
||||
@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");
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertFalse(vrp.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();
|
||||
assertEquals(10., vrp.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();
|
||||
assertEquals(1, vrp.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();
|
||||
assertEquals(2, vrp.getInitialVehicleRoutes().iterator().next().getActivities().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_ifReaderIsCalled_itReadsSuccessfullyV2() {
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
|
||||
new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpWithShipmentsAndSolution.xml");
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
assertEquals(4, vrp.getJobs().size());
|
||||
assertEquals(1, solutions.size());
|
||||
|
||||
assertEquals(1, solutions.get(0).getRoutes().size());
|
||||
List<TourActivity> activities = solutions.get(0).getRoutes().iterator().next().getTourActivities().getActivities();
|
||||
assertEquals(4, activities.size());
|
||||
assertTrue(activities.get(0) instanceof PickupService);
|
||||
assertTrue(activities.get(1) instanceof PickupService);
|
||||
assertTrue(activities.get(2) instanceof PickupShipment);
|
||||
assertTrue(activities.get(3) instanceof DeliverShipment);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_ifReaderIsCalled_itReadsSuccessfully() {
|
||||
new VrpXMLReader(VehicleRoutingProblem.Builder.newInstance(), new ArrayList<VehicleRoutingProblemSolution>()).read("src/test/resources/lui-shen-solution.xml");
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void unassignedJobShouldBeRead() {
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
|
||||
new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/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<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
|
||||
// new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpforReaderTest.xml");
|
||||
// assertTrue(solutions.isEmpty());
|
||||
// }
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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.
|
||||
* <p>
|
||||
* <p>Files and file-description can be found <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-instances/">here</a>.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.graphhopper.jsprit.core.util;
|
||||
|
||||
/**
|
||||
* Created by schroeder on 27/07/16.
|
||||
*/
|
||||
public enum JobType {
|
||||
|
||||
SERVICE, PICKUP, DELIVERY
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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<String, CustomerData> customers;
|
||||
|
||||
private Collection<Relation> relations;
|
||||
|
||||
private double depotOpeningTime;
|
||||
|
||||
private double depotClosingTime;
|
||||
|
||||
private int fixCosts = 0;
|
||||
|
||||
public LiLimReader(Builder vrpBuilder) {
|
||||
customers = new HashMap<String, CustomerData>();
|
||||
relations = new ArrayList<Relation>();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
public LiLimReader(Builder builder, int fixCosts) {
|
||||
customers = new HashMap<String, CustomerData>();
|
||||
relations = new ArrayList<Relation>();
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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.
|
||||
* <p>
|
||||
* <p>See: <a href="http://neo.lcc.uma.es/vrp/vrp-instances/capacitated-vrp-with-time-windows-instances/">neo.org</a>
|
||||
*
|
||||
* @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;
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<maxIterations>2000</maxIterations>
|
||||
|
||||
<terminationCriteria>
|
||||
<termination basedOn="iterations">
|
||||
<iterations>100</iterations>
|
||||
</termination>
|
||||
<termination basedOn="iterations">
|
||||
<iterations>25</iterations>
|
||||
</termination>
|
||||
</terminationCriteria>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<maxIterations>2000</maxIterations>
|
||||
|
||||
<prematureBreak basedOn="iterations">
|
||||
<iterations>100</iterations>
|
||||
</prematureBreak>
|
||||
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin id="1" name="radialRuin">
|
||||
<share>0.1</share>
|
||||
</ruin>
|
||||
<insertion id="1" name="bestInsertion">
|
||||
<experimental timeSlice="10" neighboringSlices="3"/>
|
||||
</insertion>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.2</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="regretInsertion">
|
||||
|
||||
</insertion>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="greedyAcceptance"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="greedyAcceptance"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="regretInsertion">
|
||||
|
||||
</insertion>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="greedyAcceptance"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="greedyAcceptance"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="regretInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
|
||||
<memory>1</memory>
|
||||
|
||||
<searchStrategies>
|
||||
<searchStrategy name="selectRandomlyRandomRuinAndRecreate">
|
||||
<selector name="selectRandomly"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>1</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
|
||||
</strategy>
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,644 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>18</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>19</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>39600.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>20</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>7</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>23</id>
|
||||
<typeId>5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>11</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>3</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>1</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>12</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>22</id>
|
||||
<typeId>5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>15</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>16</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>9</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>4</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>2</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>24</id>
|
||||
<typeId>5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>5</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>17</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>25</id>
|
||||
<typeId>5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>13</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>27</id>
|
||||
<typeId>8T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>6</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>10</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>8</id>
|
||||
<typeId>1.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>26</id>
|
||||
<typeId>8T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>14</id>
|
||||
<typeId>3.5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>21</id>
|
||||
<typeId>5T</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>1.5T</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>3.5T</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>5T</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>8T</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="3" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>36000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>36000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="1" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>19800.0</start>
|
||||
<end>21600.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="7" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>43200.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="6" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>43200.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="5" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>36000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="4" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>36000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="9" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>54000.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="8" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>50400.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
</problem>
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>10</iterations>
|
||||
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="randomRuinSmall">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.1</share>
|
||||
</ruin>
|
||||
<insertion name="regretInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion" id="1"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.2</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<!-- <searchStrategy id="gendreauPostOpt"> -->
|
||||
<!-- <modules number="1"> -->
|
||||
<!-- <module name="gendreau"> -->
|
||||
<!-- <iterations>200</iterations> -->
|
||||
<!-- <share>0.2</share> -->
|
||||
<!-- </module> -->
|
||||
<!-- </modules> -->
|
||||
<!-- <probability>0.1</probability> -->
|
||||
<!-- </searchStrategy> -->
|
||||
</searchStrategies>
|
||||
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HETEROGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<location>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
</location>
|
||||
<typeId>vehType</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<location>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity>20</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity>200</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<locationId>j(1,5)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
<service id="2" type="service">
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
|
||||
</problem>
|
||||
|
|
@ -1,237 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HETEROGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<location>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
<index>1</index>
|
||||
</location>
|
||||
<typeId>vehType</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
<skills>skill1; SKill2</skills>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<location>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
<index>2</index>
|
||||
</location>
|
||||
<returnToDepot>false</returnToDepot>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v3</id>
|
||||
<startLocation>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
<index>3</index>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
<index>4</index>
|
||||
</endLocation>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v4</id>
|
||||
<location>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v5</id>
|
||||
<location>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType3</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity>200</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType3</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">100</dimension>
|
||||
<dimension index="1">1000</dimension>
|
||||
<dimension index="2">10000</dimension>
|
||||
<dimension index="10">100000</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<locationId>j(1,5)</locationId>
|
||||
<name>cleaning</name>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<requiredSkills>skill1, Skill2</requiredSkills>
|
||||
</service>
|
||||
|
||||
<service id="2" type="service">
|
||||
<locationId>i(3,9)</locationId>
|
||||
<name>cleaning</name>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<name>deliver-smth</name>
|
||||
<pickup>
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>i(9,9)</locationId>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
<requiredSkills>skill1, Skill2</requiredSkills>
|
||||
</shipment>
|
||||
|
||||
<shipment id="4">
|
||||
<pickup>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
<name>deliver-smth</name>
|
||||
</shipment>
|
||||
|
||||
</shipments>
|
||||
</problem>
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HETEROGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<location>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
</location>
|
||||
<typeId>vehType</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<location>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<returnToDepot>false</returnToDepot>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v3</id>
|
||||
<startLocation>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v4</id>
|
||||
<location>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v5</id>
|
||||
<location>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType3</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity>200</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType3</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">100</dimension>
|
||||
<dimension index="1">1000</dimension>
|
||||
<dimension index="2">10000</dimension>
|
||||
<dimension index="10">100000</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<locationId>j(1,5)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
<service id="2" type="service">
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<pickup>
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>i(9,9)</locationId>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
</shipment>
|
||||
|
||||
<shipment id="4">
|
||||
<pickup>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
|
||||
</shipments>
|
||||
|
||||
<initialRoutes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>v1</vehicleId>
|
||||
<start>10.</start>
|
||||
<act type="pickupShipment">
|
||||
<shipmentId>4</shipmentId>
|
||||
</act>
|
||||
<act type="deliverShipment">
|
||||
<shipmentId>4</shipmentId>
|
||||
</act>
|
||||
<end/>
|
||||
</route>
|
||||
</initialRoutes>
|
||||
|
||||
</problem>
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<typeId>vehType</typeId>
|
||||
<startLocation>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>false</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v3</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v4</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v5</id>
|
||||
<typeId>vehType3</typeId>
|
||||
<startLocation>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
<service>0.0</service>
|
||||
<wait>0.0</wait>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">200</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
<service>0.0</service>
|
||||
<wait>0.0</wait>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType3</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">100</dimension>
|
||||
<dimension index="1">1000</dimension>
|
||||
<dimension index="2">10000</dimension>
|
||||
<dimension index="3">0</dimension>
|
||||
<dimension index="4">0</dimension>
|
||||
<dimension index="5">0</dimension>
|
||||
<dimension index="6">0</dimension>
|
||||
<dimension index="7">0</dimension>
|
||||
<dimension index="8">0</dimension>
|
||||
<dimension index="9">0</dimension>
|
||||
<dimension index="10">100000</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
<service>0.0</service>
|
||||
<wait>0.0</wait>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<location>
|
||||
<id>j(1,5)</id>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<location>
|
||||
<id>i(3,9)</id>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<pickup>
|
||||
<location>
|
||||
<id>i(3,9)</id>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
</location>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<location>
|
||||
<id>i(9,9)</id>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
</location>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
<shipment id="4">
|
||||
<pickup>
|
||||
<location>
|
||||
<id>[x=10.0][y=10.0]</id>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
</location>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<location>
|
||||
<id>[x=10.0][y=0.0]</id>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
</location>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
</shipments>
|
||||
<initialRoutes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>v1</vehicleId>
|
||||
<start>10.0</start>
|
||||
<act type="pickupShipment">
|
||||
<shipmentId>4</shipmentId>
|
||||
<arrTime>0.0</arrTime>
|
||||
<endTime>0.0</endTime>
|
||||
</act>
|
||||
<act type="deliverShipment">
|
||||
<shipmentId>4</shipmentId>
|
||||
<arrTime>0.0</arrTime>
|
||||
<endTime>0.0</endTime>
|
||||
</act>
|
||||
<end>0.0</end>
|
||||
</route>
|
||||
</initialRoutes>
|
||||
</problem>
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HETEROGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<location>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
</location>
|
||||
<typeId>vehType</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<location>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity>20</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity>200</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<locationId>j(1,5)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
<service id="2" type="service">
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
<service id="4" type="service">
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<pickup>
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>i(9,9)</locationId>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
</shipments>
|
||||
|
||||
<solutions>
|
||||
<solution>
|
||||
<cost>100.0</cost>
|
||||
<routes>
|
||||
<route>
|
||||
<cost>0.0</cost>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>v1</vehicleId>
|
||||
<start>10.0</start>
|
||||
<act type="service">
|
||||
<serviceId>1</serviceId>
|
||||
<arrTime>20.0</arrTime>
|
||||
<endTime>30.0</endTime>
|
||||
</act>
|
||||
<act type="service">
|
||||
<serviceId>2</serviceId>
|
||||
<arrTime>40.0</arrTime>
|
||||
<endTime>80.0</endTime>
|
||||
</act>
|
||||
<act type="pickupShipment">
|
||||
<shipmentId>3</shipmentId>
|
||||
<arrTime>40.0</arrTime>
|
||||
<endTime>80.0</endTime>
|
||||
</act>
|
||||
<act type="deliverShipment">
|
||||
<shipmentId>3</shipmentId>
|
||||
<arrTime>40.0</arrTime>
|
||||
<endTime>80.0</endTime>
|
||||
</act>
|
||||
<end>100.0</end>
|
||||
</route>
|
||||
</routes>
|
||||
<unassignedJobs>
|
||||
<job id="4"/>
|
||||
</unassignedJobs>
|
||||
</solution>
|
||||
</solutions>
|
||||
|
||||
</problem>
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HETEROGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<location>
|
||||
<id>depotLoc2</id>
|
||||
<coord x="100.0" y="100.0"/>
|
||||
</location>
|
||||
<typeId>vehType</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<location>
|
||||
<id>depotLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<returnToDepot>false</returnToDepot>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v3</id>
|
||||
<startLocation>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v4</id>
|
||||
<location>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType2</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v5</id>
|
||||
<location>
|
||||
<id>startLoc</id>
|
||||
<coord x="10.0" y="100.0"/>
|
||||
</location>
|
||||
<endLocation>
|
||||
<id>endLoc</id>
|
||||
<coord x="1000.0" y="2000.0"/>
|
||||
</endLocation>
|
||||
<typeId>vehType3</typeId>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1000.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity>200</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType3</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">100</dimension>
|
||||
<dimension index="1">1000</dimension>
|
||||
<dimension index="2">10000</dimension>
|
||||
<dimension index="10">100000</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<locationId>j(1,5)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
<service id="2" type="service">
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<pickup>
|
||||
<locationId>i(3,9)</locationId>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<duration>10.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>i(9,9)</locationId>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
</shipment>
|
||||
|
||||
<shipment id="4">
|
||||
<pickup>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>1000.0</start>
|
||||
<end>4000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<duration>100.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>6000.0</start>
|
||||
<end>10000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
|
||||
</shipments>
|
||||
</problem>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<typeId>vehType</typeId>
|
||||
<startLocation>
|
||||
<id>loc</id>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>loc</id>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>loc</id>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>loc</id>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehType</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
<service>0.0</service>
|
||||
<wait>0.0</wait>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">200</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
<service>0.0</service>
|
||||
<wait>0.0</wait>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
</problem>
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion">
|
||||
</insertion>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomStrategy">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="schrimpfAcceptance">
|
||||
<alpha>0.1</alpha>
|
||||
<warmup>20</warmup>
|
||||
</acceptor>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.4</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialStrategy">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="schrimpfAcceptance"/>
|
||||
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,636 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>christophidesVehicle</id>
|
||||
<typeId>christophidesType</typeId>
|
||||
<location>
|
||||
<id>[x=30.0][y=40.0]</id>
|
||||
<coord x="30.0" y="40.0"/>
|
||||
</location>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>999999.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>christophidesType</id>
|
||||
<capacity>50</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="35" type="delivery">
|
||||
<locationId>[x=62.0][y=63.0]</locationId>
|
||||
<coord x="62.0" y="63.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="36" type="pickup">
|
||||
<locationId>[x=63.0][y=69.0]</locationId>
|
||||
<coord x="63.0" y="69.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="33" type="pickup">
|
||||
<locationId>[x=46.0][y=10.0]</locationId>
|
||||
<coord x="46.0" y="10.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="34" type="pickup">
|
||||
<locationId>[x=61.0][y=33.0]</locationId>
|
||||
<coord x="61.0" y="33.0"/>
|
||||
<capacity-demand>26</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="39" type="pickup">
|
||||
<locationId>[x=59.0][y=15.0]</locationId>
|
||||
<coord x="59.0" y="15.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="37" type="delivery">
|
||||
<locationId>[x=32.0][y=22.0]</locationId>
|
||||
<coord x="32.0" y="22.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="38" type="delivery">
|
||||
<locationId>[x=45.0][y=35.0]</locationId>
|
||||
<coord x="45.0" y="35.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="43" type="delivery">
|
||||
<locationId>[x=5.0][y=64.0]</locationId>
|
||||
<coord x="5.0" y="64.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="42" type="delivery">
|
||||
<locationId>[x=21.0][y=10.0]</locationId>
|
||||
<coord x="21.0" y="10.0"/>
|
||||
<capacity-demand>13</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="41" type="delivery">
|
||||
<locationId>[x=10.0][y=17.0]</locationId>
|
||||
<coord x="10.0" y="17.0"/>
|
||||
<capacity-demand>27</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="40" type="delivery">
|
||||
<locationId>[x=5.0][y=6.0]</locationId>
|
||||
<coord x="5.0" y="6.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="22" type="pickup">
|
||||
<locationId>[x=42.0][y=57.0]</locationId>
|
||||
<coord x="42.0" y="57.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="23" type="delivery">
|
||||
<locationId>[x=16.0][y=57.0]</locationId>
|
||||
<coord x="16.0" y="57.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="24" type="delivery">
|
||||
<locationId>[x=8.0][y=52.0]</locationId>
|
||||
<coord x="8.0" y="52.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="25" type="pickup">
|
||||
<locationId>[x=7.0][y=38.0]</locationId>
|
||||
<coord x="7.0" y="38.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="26" type="delivery">
|
||||
<locationId>[x=27.0][y=68.0]</locationId>
|
||||
<coord x="27.0" y="68.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="27" type="pickup">
|
||||
<locationId>[x=30.0][y=48.0]</locationId>
|
||||
<coord x="30.0" y="48.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="28" type="pickup">
|
||||
<locationId>[x=43.0][y=67.0]</locationId>
|
||||
<coord x="43.0" y="67.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="29" type="delivery">
|
||||
<locationId>[x=58.0][y=48.0]</locationId>
|
||||
<coord x="58.0" y="48.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="3" type="delivery">
|
||||
<locationId>[x=52.0][y=64.0]</locationId>
|
||||
<coord x="52.0" y="64.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="delivery">
|
||||
<locationId>[x=49.0][y=49.0]</locationId>
|
||||
<coord x="49.0" y="49.0"/>
|
||||
<capacity-demand>30</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="1" type="delivery">
|
||||
<locationId>[x=37.0][y=52.0]</locationId>
|
||||
<coord x="37.0" y="52.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="7" type="pickup">
|
||||
<locationId>[x=17.0][y=63.0]</locationId>
|
||||
<coord x="17.0" y="63.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="30" type="delivery">
|
||||
<locationId>[x=58.0][y=27.0]</locationId>
|
||||
<coord x="58.0" y="27.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="6" type="pickup">
|
||||
<locationId>[x=21.0][y=47.0]</locationId>
|
||||
<coord x="21.0" y="47.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="5" type="delivery">
|
||||
<locationId>[x=40.0][y=30.0]</locationId>
|
||||
<coord x="40.0" y="30.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="32" type="pickup">
|
||||
<locationId>[x=38.0][y=46.0]</locationId>
|
||||
<coord x="38.0" y="46.0"/>
|
||||
<capacity-demand>12</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="4" type="delivery">
|
||||
<locationId>[x=20.0][y=26.0]</locationId>
|
||||
<coord x="20.0" y="26.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="31" type="delivery">
|
||||
<locationId>[x=37.0][y=69.0]</locationId>
|
||||
<coord x="37.0" y="69.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="9" type="pickup">
|
||||
<locationId>[x=52.0][y=33.0]</locationId>
|
||||
<coord x="52.0" y="33.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="8" type="pickup">
|
||||
<locationId>[x=31.0][y=62.0]</locationId>
|
||||
<coord x="31.0" y="62.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="19" type="delivery">
|
||||
<locationId>[x=13.0][y=13.0]</locationId>
|
||||
<coord x="13.0" y="13.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="17" type="pickup">
|
||||
<locationId>[x=27.0][y=23.0]</locationId>
|
||||
<coord x="27.0" y="23.0"/>
|
||||
<capacity-demand>3</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="18" type="delivery">
|
||||
<locationId>[x=17.0][y=33.0]</locationId>
|
||||
<coord x="17.0" y="33.0"/>
|
||||
<capacity-demand>41</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="15" type="pickup">
|
||||
<locationId>[x=36.0][y=16.0]</locationId>
|
||||
<coord x="36.0" y="16.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="16" type="delivery">
|
||||
<locationId>[x=52.0][y=41.0]</locationId>
|
||||
<coord x="52.0" y="41.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="13" type="delivery">
|
||||
<locationId>[x=5.0][y=25.0]</locationId>
|
||||
<coord x="5.0" y="25.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="14" type="pickup">
|
||||
<locationId>[x=12.0][y=42.0]</locationId>
|
||||
<coord x="12.0" y="42.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="11" type="delivery">
|
||||
<locationId>[x=42.0][y=41.0]</locationId>
|
||||
<coord x="42.0" y="41.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="12" type="pickup">
|
||||
<locationId>[x=31.0][y=32.0]</locationId>
|
||||
<coord x="31.0" y="32.0"/>
|
||||
<capacity-demand>29</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="21" type="delivery">
|
||||
<locationId>[x=62.0][y=42.0]</locationId>
|
||||
<coord x="62.0" y="42.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="20" type="delivery">
|
||||
<locationId>[x=57.0][y=58.0]</locationId>
|
||||
<coord x="57.0" y="58.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="49" type="pickup">
|
||||
<locationId>[x=48.0][y=28.0]</locationId>
|
||||
<coord x="48.0" y="28.0"/>
|
||||
<capacity-demand>18</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="48" type="pickup">
|
||||
<locationId>[x=25.0][y=55.0]</locationId>
|
||||
<coord x="25.0" y="55.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="45" type="pickup">
|
||||
<locationId>[x=39.0][y=10.0]</locationId>
|
||||
<coord x="39.0" y="10.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="44" type="pickup">
|
||||
<locationId>[x=30.0][y=15.0]</locationId>
|
||||
<coord x="30.0" y="15.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="47" type="pickup">
|
||||
<locationId>[x=25.0][y=32.0]</locationId>
|
||||
<coord x="25.0" y="32.0"/>
|
||||
<capacity-demand>25</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="46" type="pickup">
|
||||
<locationId>[x=32.0][y=39.0]</locationId>
|
||||
<coord x="32.0" y="39.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="10" type="delivery">
|
||||
<locationId>[x=51.0][y=21.0]</locationId>
|
||||
<coord x="51.0" y="21.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="50" type="pickup">
|
||||
<locationId>[x=56.0][y=37.0]</locationId>
|
||||
<coord x="56.0" y="37.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
</problem>
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,512 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v</id>
|
||||
<typeId>t</typeId>
|
||||
<location>
|
||||
<id>[x=10.0][y=10.0]</id>
|
||||
<coord x="10.0" y="10.0"/>
|
||||
</location>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>500.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>t</id>
|
||||
<capacity>5</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<shipments>
|
||||
<shipment id="s437">
|
||||
<pickup>
|
||||
<locationId>[x=77.0][y=23.0]</locationId>
|
||||
<coord x="77.0" y="23.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=20.0][y=39.0]</locationId>
|
||||
<coord x="20.0" y="39.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s436">
|
||||
<pickup>
|
||||
<locationId>[x=67.0][y=1.0]</locationId>
|
||||
<coord x="67.0" y="1.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=41.0][y=7.0]</locationId>
|
||||
<coord x="41.0" y="7.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s439">
|
||||
<pickup>
|
||||
<locationId>[x=57.0][y=96.0]</locationId>
|
||||
<coord x="57.0" y="96.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=36.0][y=97.0]</locationId>
|
||||
<coord x="36.0" y="97.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s438">
|
||||
<pickup>
|
||||
<locationId>[x=28.0][y=84.0]</locationId>
|
||||
<coord x="28.0" y="84.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=93.0][y=44.0]</locationId>
|
||||
<coord x="93.0" y="44.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s433">
|
||||
<pickup>
|
||||
<locationId>[x=3.0][y=36.0]</locationId>
|
||||
<coord x="3.0" y="36.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=77.0][y=6.0]</locationId>
|
||||
<coord x="77.0" y="6.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s432">
|
||||
<pickup>
|
||||
<locationId>[x=45.0][y=11.0]</locationId>
|
||||
<coord x="45.0" y="11.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=63.0][y=80.0]</locationId>
|
||||
<coord x="63.0" y="80.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s435">
|
||||
<pickup>
|
||||
<locationId>[x=4.0][y=84.0]</locationId>
|
||||
<coord x="4.0" y="84.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=93.0][y=23.0]</locationId>
|
||||
<coord x="93.0" y="23.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s434">
|
||||
<pickup>
|
||||
<locationId>[x=80.0][y=9.0]</locationId>
|
||||
<coord x="80.0" y="9.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=19.0][y=76.0]</locationId>
|
||||
<coord x="19.0" y="76.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s931">
|
||||
<pickup>
|
||||
<locationId>[x=8.0][y=23.0]</locationId>
|
||||
<coord x="8.0" y="23.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=84.0][y=33.0]</locationId>
|
||||
<coord x="84.0" y="33.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s932">
|
||||
<pickup>
|
||||
<locationId>[x=26.0][y=89.0]</locationId>
|
||||
<coord x="26.0" y="89.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=48.0][y=55.0]</locationId>
|
||||
<coord x="48.0" y="55.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s933">
|
||||
<pickup>
|
||||
<locationId>[x=78.0][y=43.0]</locationId>
|
||||
<coord x="78.0" y="43.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=66.0][y=44.0]</locationId>
|
||||
<coord x="66.0" y="44.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s934">
|
||||
<pickup>
|
||||
<locationId>[x=73.0][y=38.0]</locationId>
|
||||
<coord x="73.0" y="38.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=89.0][y=40.0]</locationId>
|
||||
<coord x="89.0" y="40.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s930">
|
||||
<pickup>
|
||||
<locationId>[x=22.0][y=62.0]</locationId>
|
||||
<coord x="22.0" y="62.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=6.0][y=60.0]</locationId>
|
||||
<coord x="6.0" y="60.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s939">
|
||||
<pickup>
|
||||
<locationId>[x=56.0][y=17.0]</locationId>
|
||||
<coord x="56.0" y="17.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=84.0][y=71.0]</locationId>
|
||||
<coord x="84.0" y="71.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s440">
|
||||
<pickup>
|
||||
<locationId>[x=26.0][y=60.0]</locationId>
|
||||
<coord x="26.0" y="60.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=37.0][y=25.0]</locationId>
|
||||
<coord x="37.0" y="25.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s441">
|
||||
<pickup>
|
||||
<locationId>[x=96.0][y=35.0]</locationId>
|
||||
<coord x="96.0" y="35.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=93.0][y=20.0]</locationId>
|
||||
<coord x="93.0" y="20.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s442">
|
||||
<pickup>
|
||||
<locationId>[x=1.0][y=18.0]</locationId>
|
||||
<coord x="1.0" y="18.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=56.0][y=33.0]</locationId>
|
||||
<coord x="56.0" y="33.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s935">
|
||||
<pickup>
|
||||
<locationId>[x=93.0][y=44.0]</locationId>
|
||||
<coord x="93.0" y="44.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=5.0][y=90.0]</locationId>
|
||||
<coord x="5.0" y="90.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
<shipment id="s936">
|
||||
<pickup>
|
||||
<locationId>[x=31.0][y=63.0]</locationId>
|
||||
<coord x="31.0" y="63.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>[x=12.0][y=56.0]</locationId>
|
||||
<coord x="12.0" y="56.0"/>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-demand>1</capacity-demand>
|
||||
</shipment>
|
||||
|
||||
</shipments>
|
||||
</problem>
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<algorithm xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
|
||||
|
||||
<iterations>2000</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion">
|
||||
<allowVehicleSwitch>false</allowVehicleSwitch>
|
||||
</insertion>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomStrategy">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="schrimpfAcceptance">
|
||||
<alpha>0.1</alpha>
|
||||
<warmup>20</warmup>
|
||||
</acceptor>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>0.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialStrategy">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="schrimpfAcceptance"/>
|
||||
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.1</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
<probability>.5</probability>
|
||||
</searchStrategy>
|
||||
|
||||
</searchStrategies>
|
||||
</strategy>
|
||||
|
||||
|
||||
</algorithm>
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>21</id>
|
||||
<typeId>5</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>14400.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>19</id>
|
||||
<typeId>3.5</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>39600.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>5</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>3.5</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="2" type="service">
|
||||
<locationId>[x=2000.0][y=0.0]</locationId>
|
||||
<coord x="2000.0" y="0.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>54000.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="1" type="service">
|
||||
<locationId>[x=1000.0][y=1000.0]</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>19800.0</start>
|
||||
<end>21600.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
</problem>
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>veh1</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>veh2</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>type1</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="2" type="service">
|
||||
<locationId>loc_s2</locationId>
|
||||
<coord x="10.0" y="0.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
</service>
|
||||
<service id="1" type="service">
|
||||
<locationId>loc_s1</locationId>
|
||||
<coord x="20.0" y="0.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<pickup>
|
||||
<locationId>loc_pickup_shipment_3</locationId>
|
||||
<coord x="0." y="10.0"/>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>loc_deliver_shipment_3</locationId>
|
||||
<coord x="0." y="20.0"/>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
|
||||
<shipment id="4">
|
||||
<pickup>
|
||||
<locationId>loc_pickup_shipment_4</locationId>
|
||||
<coord x="0." y="12.0"/>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>loc_deliver_shipment_4</locationId>
|
||||
<coord x="0." y="18.0"/>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
|
||||
</shipments>
|
||||
|
||||
<initialRoutes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>veh1</vehicleId>
|
||||
<start>0.</start>
|
||||
<act type="deliverService">
|
||||
<serviceId>1</serviceId>
|
||||
</act>
|
||||
<end/>
|
||||
</route>
|
||||
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>veh2</vehicleId>
|
||||
<start>0.</start>
|
||||
<act type="pickupShipment">
|
||||
<shipmentId>3</shipmentId>
|
||||
</act>
|
||||
<act type="deliverShipment">
|
||||
<shipmentId>3</shipmentId>
|
||||
</act>
|
||||
<end/>
|
||||
</route>
|
||||
</initialRoutes>
|
||||
</problem>
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>veh1</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>2</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>type1</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="2" type="service">
|
||||
<locationId>loc_s2</locationId>
|
||||
<coord x="1000.0" y="0.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
</service>
|
||||
<service id="1" type="service">
|
||||
<locationId>loc_s3</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
</service>
|
||||
</services>
|
||||
<initialRoutes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>veh1</vehicleId>
|
||||
<start>0.</start>
|
||||
<act type="deliverService">
|
||||
<serviceId>1</serviceId>
|
||||
</act>
|
||||
<end/>
|
||||
</route>
|
||||
|
||||
</initialRoutes>
|
||||
</problem>
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>veh1</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>type1</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">100</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
|
||||
<shipments>
|
||||
<shipment id="3">
|
||||
<pickup>
|
||||
<locationId>loc_pickup_shipment_3</locationId>
|
||||
<coord x="0." y="10.0"/>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>loc_deliver_shipment_3</locationId>
|
||||
<coord x="0." y="20.0"/>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">100</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
|
||||
<shipment id="4">
|
||||
<pickup>
|
||||
<locationId>loc_pickup_shipment_4</locationId>
|
||||
<coord x="0." y="12.0"/>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<locationId>loc_deliver_shipment_4</locationId>
|
||||
<coord x="0." y="18.0"/>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">50</dimension>
|
||||
</capacity-dimensions>
|
||||
</shipment>
|
||||
|
||||
</shipments>
|
||||
|
||||
<initialRoutes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>veh1</vehicleId>
|
||||
<start>0.</start>
|
||||
<act type="pickupShipment">
|
||||
<shipmentId>3</shipmentId>
|
||||
</act>
|
||||
<act type="deliverShipment">
|
||||
<shipmentId>3</shipmentId>
|
||||
</act>
|
||||
<end/>
|
||||
</route>
|
||||
</initialRoutes>
|
||||
</problem>
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>veh1</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=5000.0][y=5000.0]</id>
|
||||
<coord x="5000.0" y="5000.0"/>
|
||||
</startLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>46800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>veh2</id>
|
||||
<typeId>type1</typeId>
|
||||
<startLocation>
|
||||
<id>[x=0.0][y=0.0]</id>
|
||||
<coord x="0.0" y="0.0"/>
|
||||
</startLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>64800.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>type1</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="2" type="service">
|
||||
<locationId>loc_s2</locationId>
|
||||
<coord x="1000.0" y="0.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
</service>
|
||||
<service id="1" type="service">
|
||||
<locationId>loc_s3</locationId>
|
||||
<coord x="1000.0" y="1000.0"/>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>0.0</duration>
|
||||
</service>
|
||||
</services>
|
||||
<initialRoutes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>veh1</vehicleId>
|
||||
<start>0.</start>
|
||||
<act type="deliverService">
|
||||
<serviceId>1</serviceId>
|
||||
</act>
|
||||
<end/>
|
||||
</route>
|
||||
|
||||
</initialRoutes>
|
||||
</problem>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<config>
|
||||
|
||||
<iterations>10</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="randomRuinSmall">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="randomRuin">
|
||||
<share>0.1</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="ruin_and_recreate">
|
||||
<ruin name="radialRuin">
|
||||
<share>0.3</share>
|
||||
</ruin>
|
||||
<insertion name="bestInsertion" id="1"/>
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.2</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<!-- <searchStrategy id="gendreauPostOpt"> -->
|
||||
<!-- <modules number="1"> -->
|
||||
<!-- <module name="gendreau"> -->
|
||||
<!-- <iterations>200</iterations> -->
|
||||
<!-- <share>0.2</share> -->
|
||||
<!-- </module> -->
|
||||
<!-- </modules> -->
|
||||
<!-- <probability>0.1</probability> -->
|
||||
<!-- </searchStrategy> -->
|
||||
</searchStrategies>
|
||||
|
||||
</strategy>
|
||||
|
||||
|
||||
</config>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<config>
|
||||
|
||||
<iterations>10</iterations>
|
||||
|
||||
<construction>
|
||||
<insertion name="bestInsertion"/>
|
||||
</construction>
|
||||
|
||||
<strategy>
|
||||
<memory>1</memory>
|
||||
<searchStrategies>
|
||||
<searchStrategy name="randomRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="randomRuin">
|
||||
<share>0.5</share>
|
||||
</module>
|
||||
<module name="bestInsertion">
|
||||
</module>
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="randomRuinSmall">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="randomRuin">
|
||||
<share>0.1</share>
|
||||
</module>
|
||||
<module name="bestInsertion"></module>
|
||||
</modules>
|
||||
<probability>0.4</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<searchStrategy name="radialRuinAndRecreate">
|
||||
<selector name="selectBest"/>
|
||||
<acceptor name="acceptNewRemoveWorst"/>
|
||||
<modules>
|
||||
<module name="radialRuin">
|
||||
<share>0.3</share>
|
||||
<distanceMeasure>euclid</distanceMeasure>
|
||||
</module>
|
||||
<module name="bestInsertion" id="1"></module>
|
||||
</modules>
|
||||
<probability>0.2</probability>
|
||||
</searchStrategy>
|
||||
|
||||
<!-- <searchStrategy id="gendreauPostOpt"> -->
|
||||
<!-- <modules number="1"> -->
|
||||
<!-- <module name="gendreau"> -->
|
||||
<!-- <iterations>200</iterations> -->
|
||||
<!-- <share>0.2</share> -->
|
||||
<!-- </module> -->
|
||||
<!-- </modules> -->
|
||||
<!-- <probability>0.1</probability> -->
|
||||
<!-- </searchStrategy> -->
|
||||
</searchStrategies>
|
||||
|
||||
</strategy>
|
||||
|
||||
|
||||
</config>
|
||||
|
|
@ -1,407 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>vehicle0</id>
|
||||
<typeId>vehicle_type_0</typeId>
|
||||
<startLocation>
|
||||
<id>v0_start</id>
|
||||
<index>0</index>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>v0_start</id>
|
||||
<index>0</index>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>60.0</start>
|
||||
<end>18060.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
<skills>primemover</skills>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>vehicle1</id>
|
||||
<typeId>vehicle_type_1</typeId>
|
||||
<startLocation>
|
||||
<id>v1_start</id>
|
||||
<index>0</index>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>v1_start</id>
|
||||
<index>0</index>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>60.0</start>
|
||||
<end>18060.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
<skills>primemover</skills>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>vehicle2</id>
|
||||
<typeId>vehicle_type_2</typeId>
|
||||
<startLocation>
|
||||
<id>v2_start</id>
|
||||
<index>0</index>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>v2_start</id>
|
||||
<index>0</index>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>7200.0</start>
|
||||
<end>36060.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
<skills>primemover</skills>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>vehicle3</id>
|
||||
<typeId>vehicle_type_3</typeId>
|
||||
<startLocation>
|
||||
<id>v3_start</id>
|
||||
<index>0</index>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>v3_start</id>
|
||||
<index>0</index>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>36000.0</start>
|
||||
<end>54060.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
<skills>primemover</skills>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>vehicle4</id>
|
||||
<typeId>vehicle_type_4</typeId>
|
||||
<startLocation>
|
||||
<id>v4_start</id>
|
||||
<index>0</index>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>v4_start</id>
|
||||
<index>0</index>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>36000.0</start>
|
||||
<end>54060.0</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
<skills>primemover</skills>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>vehicle_type_0</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>1.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehicle_type_1</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>1.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehicle_type_2</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>1.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehicle_type_3</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>1.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehicle_type_4</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">20</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>0.0</distance>
|
||||
<time>1.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<location>
|
||||
<id>js0</id>
|
||||
<index>1</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>600.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1800.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<location>
|
||||
<id>js2</id>
|
||||
<index>2</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">2</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>600.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>5400.0</start>
|
||||
<end>7200.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
<service id="3" type="service">
|
||||
<location>
|
||||
<id>js5</id>
|
||||
<index>3</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>1800.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>17100.0</start>
|
||||
<end>18000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
<service id="4" type="service">
|
||||
<location>
|
||||
<id>js6</id>
|
||||
<index>4</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">2</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>900.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
<service id="5" type="service">
|
||||
<location>
|
||||
<id>js8</id>
|
||||
<index>5</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">4</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>600.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
<service id="6" type="service">
|
||||
<location>
|
||||
<id>js10</id>
|
||||
<index>6</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">10</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>1500.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>29700.0</start>
|
||||
<end>32400.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
<service id="7" type="service">
|
||||
<location>
|
||||
<id>jsp3</id>
|
||||
<index>7</index>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>5594.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
<name>Test</name>
|
||||
</service>
|
||||
</services>
|
||||
<shipments>
|
||||
<shipment id="shipment1">
|
||||
<pickup>
|
||||
<location>
|
||||
<id>jsp1</id>
|
||||
<index>1</index>
|
||||
</location>
|
||||
<duration>900.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<location>
|
||||
<id>jsd1</id>
|
||||
<index>8</index>
|
||||
</location>
|
||||
<duration>900.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<name>Test</name>
|
||||
</shipment>
|
||||
<shipment id="shipment2">
|
||||
<pickup>
|
||||
<location>
|
||||
<id>jsp4</id>
|
||||
<index>9</index>
|
||||
</location>
|
||||
<duration>1200.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>21600.0</start>
|
||||
<end>23400.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<location>
|
||||
<id>jsd4</id>
|
||||
<index>8</index>
|
||||
</location>
|
||||
<duration>900.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>25200.0</start>
|
||||
<end>27000.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<name>Test</name>
|
||||
</shipment>
|
||||
<shipment id="shipment3">
|
||||
<pickup>
|
||||
<location>
|
||||
<id>jsp7</id>
|
||||
<index>9</index>
|
||||
</location>
|
||||
<duration>1200.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>37800.0</start>
|
||||
<end>41400.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<location>
|
||||
<id>jsd7</id>
|
||||
<index>8</index>
|
||||
</location>
|
||||
<duration>1800.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>43200.0</start>
|
||||
<end>45900.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<name>Test</name>
|
||||
</shipment>
|
||||
<shipment id="shipment4">
|
||||
<pickup>
|
||||
<location>
|
||||
<id>jsp9</id>
|
||||
<index>10</index>
|
||||
</location>
|
||||
<duration>300.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>45000.0</start>
|
||||
<end>48600.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</pickup>
|
||||
<delivery>
|
||||
<location>
|
||||
<id>jsd9</id>
|
||||
<index>8</index>
|
||||
</location>
|
||||
<duration>300.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>50400.0</start>
|
||||
<end>52200.0</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</delivery>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">0</dimension>
|
||||
</capacity-dimensions>
|
||||
<name>Test</name>
|
||||
</shipment>
|
||||
</shipments>
|
||||
</problem>
|
||||
|
|
@ -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": []
|
||||
}
|
||||
}
|
||||
|
|
@ -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"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,653 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>christophidesVehicle</id>
|
||||
<typeId>christophidesType</typeId>
|
||||
<location>
|
||||
<id>[x=30.0][y=40.0]</id>
|
||||
<coord x="30.0" y="40.0"/>
|
||||
</location>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>999999.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>christophidesType</id>
|
||||
<capacity>160</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="35" type="delivery">
|
||||
<locationId>[x=62.0][y=63.0]</locationId>
|
||||
<coord x="62.0" y="63.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="36" type="delivery">
|
||||
<locationId>[x=63.0][y=69.0]</locationId>
|
||||
<coord x="63.0" y="69.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="33" type="delivery">
|
||||
<locationId>[x=46.0][y=10.0]</locationId>
|
||||
<coord x="46.0" y="10.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="34" type="delivery">
|
||||
<locationId>[x=61.0][y=33.0]</locationId>
|
||||
<coord x="61.0" y="33.0"/>
|
||||
<capacity-demand>26</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="39" type="delivery">
|
||||
<locationId>[x=59.0][y=15.0]</locationId>
|
||||
<coord x="59.0" y="15.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="37" type="delivery">
|
||||
<locationId>[x=32.0][y=22.0]</locationId>
|
||||
<coord x="32.0" y="22.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="38" type="delivery">
|
||||
<locationId>[x=45.0][y=35.0]</locationId>
|
||||
<coord x="45.0" y="35.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="43" type="delivery">
|
||||
<locationId>[x=5.0][y=64.0]</locationId>
|
||||
<coord x="5.0" y="64.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="42" type="delivery">
|
||||
<locationId>[x=21.0][y=10.0]</locationId>
|
||||
<coord x="21.0" y="10.0"/>
|
||||
<capacity-demand>13</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="41" type="delivery">
|
||||
<locationId>[x=10.0][y=17.0]</locationId>
|
||||
<coord x="10.0" y="17.0"/>
|
||||
<capacity-demand>27</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="40" type="delivery">
|
||||
<locationId>[x=5.0][y=6.0]</locationId>
|
||||
<coord x="5.0" y="6.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="22" type="delivery">
|
||||
<locationId>[x=42.0][y=57.0]</locationId>
|
||||
<coord x="42.0" y="57.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="23" type="delivery">
|
||||
<locationId>[x=16.0][y=57.0]</locationId>
|
||||
<coord x="16.0" y="57.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="24" type="delivery">
|
||||
<locationId>[x=8.0][y=52.0]</locationId>
|
||||
<coord x="8.0" y="52.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="25" type="delivery">
|
||||
<locationId>[x=7.0][y=38.0]</locationId>
|
||||
<coord x="7.0" y="38.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="26" type="delivery">
|
||||
<locationId>[x=27.0][y=68.0]</locationId>
|
||||
<coord x="27.0" y="68.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="27" type="delivery">
|
||||
<locationId>[x=30.0][y=48.0]</locationId>
|
||||
<coord x="30.0" y="48.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="28" type="delivery">
|
||||
<locationId>[x=43.0][y=67.0]</locationId>
|
||||
<coord x="43.0" y="67.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="29" type="delivery">
|
||||
<locationId>[x=58.0][y=48.0]</locationId>
|
||||
<coord x="58.0" y="48.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="3" type="delivery">
|
||||
<locationId>[x=52.0][y=64.0]</locationId>
|
||||
<coord x="52.0" y="64.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="delivery">
|
||||
<locationId>[x=49.0][y=49.0]</locationId>
|
||||
<coord x="49.0" y="49.0"/>
|
||||
<capacity-demand>30</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="1" type="delivery">
|
||||
<locationId>[x=37.0][y=52.0]</locationId>
|
||||
<coord x="37.0" y="52.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="7" type="delivery">
|
||||
<locationId>[x=17.0][y=63.0]</locationId>
|
||||
<coord x="17.0" y="63.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="30" type="delivery">
|
||||
<locationId>[x=58.0][y=27.0]</locationId>
|
||||
<coord x="58.0" y="27.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="6" type="delivery">
|
||||
<locationId>[x=21.0][y=47.0]</locationId>
|
||||
<coord x="21.0" y="47.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="5" type="delivery">
|
||||
<locationId>[x=40.0][y=30.0]</locationId>
|
||||
<coord x="40.0" y="30.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="32" type="delivery">
|
||||
<locationId>[x=38.0][y=46.0]</locationId>
|
||||
<coord x="38.0" y="46.0"/>
|
||||
<capacity-demand>12</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="4" type="delivery">
|
||||
<locationId>[x=20.0][y=26.0]</locationId>
|
||||
<coord x="20.0" y="26.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="31" type="delivery">
|
||||
<locationId>[x=37.0][y=69.0]</locationId>
|
||||
<coord x="37.0" y="69.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="9" type="delivery">
|
||||
<locationId>[x=52.0][y=33.0]</locationId>
|
||||
<coord x="52.0" y="33.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="8" type="delivery">
|
||||
<locationId>[x=31.0][y=62.0]</locationId>
|
||||
<coord x="31.0" y="62.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="19" type="delivery">
|
||||
<locationId>[x=13.0][y=13.0]</locationId>
|
||||
<coord x="13.0" y="13.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="17" type="delivery">
|
||||
<locationId>[x=27.0][y=23.0]</locationId>
|
||||
<coord x="27.0" y="23.0"/>
|
||||
<capacity-demand>3</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="18" type="delivery">
|
||||
<locationId>[x=17.0][y=33.0]</locationId>
|
||||
<coord x="17.0" y="33.0"/>
|
||||
<capacity-demand>41</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="15" type="delivery">
|
||||
<locationId>[x=36.0][y=16.0]</locationId>
|
||||
<coord x="36.0" y="16.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="16" type="delivery">
|
||||
<locationId>[x=52.0][y=41.0]</locationId>
|
||||
<coord x="52.0" y="41.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="13" type="delivery">
|
||||
<locationId>[x=5.0][y=25.0]</locationId>
|
||||
<coord x="5.0" y="25.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="14" type="delivery">
|
||||
<locationId>[x=12.0][y=42.0]</locationId>
|
||||
<coord x="12.0" y="42.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="11" type="delivery">
|
||||
<locationId>[x=42.0][y=41.0]</locationId>
|
||||
<coord x="42.0" y="41.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="12" type="delivery">
|
||||
<locationId>[x=31.0][y=32.0]</locationId>
|
||||
<coord x="31.0" y="32.0"/>
|
||||
<capacity-demand>29</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="21" type="delivery">
|
||||
<locationId>[x=62.0][y=42.0]</locationId>
|
||||
<coord x="62.0" y="42.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="20" type="delivery">
|
||||
<locationId>[x=57.0][y=58.0]</locationId>
|
||||
<coord x="57.0" y="58.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="49" type="delivery">
|
||||
<locationId>[x=48.0][y=28.0]</locationId>
|
||||
<coord x="48.0" y="28.0"/>
|
||||
<capacity-demand>18</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="48" type="delivery">
|
||||
<locationId>[x=25.0][y=55.0]</locationId>
|
||||
<coord x="25.0" y="55.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="45" type="delivery">
|
||||
<locationId>[x=39.0][y=10.0]</locationId>
|
||||
<coord x="39.0" y="10.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="44" type="delivery">
|
||||
<locationId>[x=30.0][y=15.0]</locationId>
|
||||
<coord x="30.0" y="15.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="47" type="delivery">
|
||||
<locationId>[x=25.0][y=32.0]</locationId>
|
||||
<coord x="25.0" y="32.0"/>
|
||||
<capacity-demand>25</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="46" type="delivery">
|
||||
<locationId>[x=32.0][y=39.0]</locationId>
|
||||
<coord x="32.0" y="39.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="10" type="delivery">
|
||||
<locationId>[x=51.0][y=21.0]</locationId>
|
||||
<coord x="51.0" y="21.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="50" type="delivery">
|
||||
<locationId>[x=56.0][y=37.0]</locationId>
|
||||
<coord x="56.0" y="37.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
</problem>
|
||||
|
|
@ -1,653 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ 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 <http://www.gnu.org/licenses/>.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>christophidesVehicle</id>
|
||||
<typeId>christophidesType</typeId>
|
||||
<location>
|
||||
<id>[x=30.0][y=40.0]</id>
|
||||
<coord x="30.0" y="40.0"/>
|
||||
</location>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>999999.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>christophidesType</id>
|
||||
<capacity>160</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="35" type="pickup">
|
||||
<locationId>[x=62.0][y=63.0]</locationId>
|
||||
<coord x="62.0" y="63.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="36" type="pickup">
|
||||
<locationId>[x=63.0][y=69.0]</locationId>
|
||||
<coord x="63.0" y="69.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="33" type="pickup">
|
||||
<locationId>[x=46.0][y=10.0]</locationId>
|
||||
<coord x="46.0" y="10.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="34" type="pickup">
|
||||
<locationId>[x=61.0][y=33.0]</locationId>
|
||||
<coord x="61.0" y="33.0"/>
|
||||
<capacity-demand>26</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="39" type="pickup">
|
||||
<locationId>[x=59.0][y=15.0]</locationId>
|
||||
<coord x="59.0" y="15.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="37" type="pickup">
|
||||
<locationId>[x=32.0][y=22.0]</locationId>
|
||||
<coord x="32.0" y="22.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="38" type="pickup">
|
||||
<locationId>[x=45.0][y=35.0]</locationId>
|
||||
<coord x="45.0" y="35.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="43" type="pickup">
|
||||
<locationId>[x=5.0][y=64.0]</locationId>
|
||||
<coord x="5.0" y="64.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="42" type="pickup">
|
||||
<locationId>[x=21.0][y=10.0]</locationId>
|
||||
<coord x="21.0" y="10.0"/>
|
||||
<capacity-demand>13</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="41" type="pickup">
|
||||
<locationId>[x=10.0][y=17.0]</locationId>
|
||||
<coord x="10.0" y="17.0"/>
|
||||
<capacity-demand>27</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="40" type="pickup">
|
||||
<locationId>[x=5.0][y=6.0]</locationId>
|
||||
<coord x="5.0" y="6.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="22" type="pickup">
|
||||
<locationId>[x=42.0][y=57.0]</locationId>
|
||||
<coord x="42.0" y="57.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="23" type="pickup">
|
||||
<locationId>[x=16.0][y=57.0]</locationId>
|
||||
<coord x="16.0" y="57.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="24" type="pickup">
|
||||
<locationId>[x=8.0][y=52.0]</locationId>
|
||||
<coord x="8.0" y="52.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="25" type="pickup">
|
||||
<locationId>[x=7.0][y=38.0]</locationId>
|
||||
<coord x="7.0" y="38.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="26" type="pickup">
|
||||
<locationId>[x=27.0][y=68.0]</locationId>
|
||||
<coord x="27.0" y="68.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="27" type="pickup">
|
||||
<locationId>[x=30.0][y=48.0]</locationId>
|
||||
<coord x="30.0" y="48.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="28" type="pickup">
|
||||
<locationId>[x=43.0][y=67.0]</locationId>
|
||||
<coord x="43.0" y="67.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="29" type="pickup">
|
||||
<locationId>[x=58.0][y=48.0]</locationId>
|
||||
<coord x="58.0" y="48.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="3" type="pickup">
|
||||
<locationId>[x=52.0][y=64.0]</locationId>
|
||||
<coord x="52.0" y="64.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="pickup">
|
||||
<locationId>[x=49.0][y=49.0]</locationId>
|
||||
<coord x="49.0" y="49.0"/>
|
||||
<capacity-demand>30</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="1" type="pickup">
|
||||
<locationId>[x=37.0][y=52.0]</locationId>
|
||||
<coord x="37.0" y="52.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="7" type="pickup">
|
||||
<locationId>[x=17.0][y=63.0]</locationId>
|
||||
<coord x="17.0" y="63.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="30" type="pickup">
|
||||
<locationId>[x=58.0][y=27.0]</locationId>
|
||||
<coord x="58.0" y="27.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="6" type="pickup">
|
||||
<locationId>[x=21.0][y=47.0]</locationId>
|
||||
<coord x="21.0" y="47.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="5" type="pickup">
|
||||
<locationId>[x=40.0][y=30.0]</locationId>
|
||||
<coord x="40.0" y="30.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="32" type="pickup">
|
||||
<locationId>[x=38.0][y=46.0]</locationId>
|
||||
<coord x="38.0" y="46.0"/>
|
||||
<capacity-demand>12</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="4" type="pickup">
|
||||
<locationId>[x=20.0][y=26.0]</locationId>
|
||||
<coord x="20.0" y="26.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="31" type="pickup">
|
||||
<locationId>[x=37.0][y=69.0]</locationId>
|
||||
<coord x="37.0" y="69.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="9" type="pickup">
|
||||
<locationId>[x=52.0][y=33.0]</locationId>
|
||||
<coord x="52.0" y="33.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="8" type="pickup">
|
||||
<locationId>[x=31.0][y=62.0]</locationId>
|
||||
<coord x="31.0" y="62.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="19" type="pickup">
|
||||
<locationId>[x=13.0][y=13.0]</locationId>
|
||||
<coord x="13.0" y="13.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="17" type="pickup">
|
||||
<locationId>[x=27.0][y=23.0]</locationId>
|
||||
<coord x="27.0" y="23.0"/>
|
||||
<capacity-demand>3</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="18" type="pickup">
|
||||
<locationId>[x=17.0][y=33.0]</locationId>
|
||||
<coord x="17.0" y="33.0"/>
|
||||
<capacity-demand>41</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="15" type="pickup">
|
||||
<locationId>[x=36.0][y=16.0]</locationId>
|
||||
<coord x="36.0" y="16.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="16" type="pickup">
|
||||
<locationId>[x=52.0][y=41.0]</locationId>
|
||||
<coord x="52.0" y="41.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="13" type="pickup">
|
||||
<locationId>[x=5.0][y=25.0]</locationId>
|
||||
<coord x="5.0" y="25.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="14" type="pickup">
|
||||
<locationId>[x=12.0][y=42.0]</locationId>
|
||||
<coord x="12.0" y="42.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="11" type="pickup">
|
||||
<locationId>[x=42.0][y=41.0]</locationId>
|
||||
<coord x="42.0" y="41.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="12" type="pickup">
|
||||
<locationId>[x=31.0][y=32.0]</locationId>
|
||||
<coord x="31.0" y="32.0"/>
|
||||
<capacity-demand>29</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="21" type="pickup">
|
||||
<locationId>[x=62.0][y=42.0]</locationId>
|
||||
<coord x="62.0" y="42.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="20" type="pickup">
|
||||
<locationId>[x=57.0][y=58.0]</locationId>
|
||||
<coord x="57.0" y="58.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="49" type="pickup">
|
||||
<locationId>[x=48.0][y=28.0]</locationId>
|
||||
<coord x="48.0" y="28.0"/>
|
||||
<capacity-demand>18</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="48" type="pickup">
|
||||
<locationId>[x=25.0][y=55.0]</locationId>
|
||||
<coord x="25.0" y="55.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="45" type="pickup">
|
||||
<locationId>[x=39.0][y=10.0]</locationId>
|
||||
<coord x="39.0" y="10.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="44" type="pickup">
|
||||
<locationId>[x=30.0][y=15.0]</locationId>
|
||||
<coord x="30.0" y="15.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="47" type="pickup">
|
||||
<locationId>[x=25.0][y=32.0]</locationId>
|
||||
<coord x="25.0" y="32.0"/>
|
||||
<capacity-demand>25</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="46" type="pickup">
|
||||
<locationId>[x=32.0][y=39.0]</locationId>
|
||||
<coord x="32.0" y="39.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="10" type="pickup">
|
||||
<locationId>[x=51.0][y=21.0]</locationId>
|
||||
<coord x="51.0" y="21.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="50" type="pickup">
|
||||
<locationId>[x=56.0][y=37.0]</locationId>
|
||||
<coord x="56.0" y="37.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
</problem>
|
||||
|
|
@ -1,636 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetComposition>HOMOGENEOUS</fleetComposition>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>christophidesVehicle</id>
|
||||
<typeId>christophidesType</typeId>
|
||||
<location>
|
||||
<id>[x=30.0][y=40.0]</id>
|
||||
<coord x="30.0" y="40.0"/>
|
||||
</location>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>999999.0</end>
|
||||
</timeSchedule>
|
||||
</vehicle>
|
||||
</vehicles>
|
||||
<vehicleTypes>
|
||||
<type>
|
||||
<id>christophidesType</id>
|
||||
<capacity>160</capacity>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="35" type="service">
|
||||
<locationId>[x=62.0][y=63.0]</locationId>
|
||||
<coord x="62.0" y="63.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="36" type="service">
|
||||
<locationId>[x=63.0][y=69.0]</locationId>
|
||||
<coord x="63.0" y="69.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="33" type="service">
|
||||
<locationId>[x=46.0][y=10.0]</locationId>
|
||||
<coord x="46.0" y="10.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="34" type="service">
|
||||
<locationId>[x=61.0][y=33.0]</locationId>
|
||||
<coord x="61.0" y="33.0"/>
|
||||
<capacity-demand>26</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="39" type="service">
|
||||
<locationId>[x=59.0][y=15.0]</locationId>
|
||||
<coord x="59.0" y="15.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="37" type="service">
|
||||
<locationId>[x=32.0][y=22.0]</locationId>
|
||||
<coord x="32.0" y="22.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="38" type="service">
|
||||
<locationId>[x=45.0][y=35.0]</locationId>
|
||||
<coord x="45.0" y="35.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="43" type="service">
|
||||
<locationId>[x=5.0][y=64.0]</locationId>
|
||||
<coord x="5.0" y="64.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="42" type="service">
|
||||
<locationId>[x=21.0][y=10.0]</locationId>
|
||||
<coord x="21.0" y="10.0"/>
|
||||
<capacity-demand>13</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="41" type="service">
|
||||
<locationId>[x=10.0][y=17.0]</locationId>
|
||||
<coord x="10.0" y="17.0"/>
|
||||
<capacity-demand>27</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="40" type="service">
|
||||
<locationId>[x=5.0][y=6.0]</locationId>
|
||||
<coord x="5.0" y="6.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="22" type="service">
|
||||
<locationId>[x=42.0][y=57.0]</locationId>
|
||||
<coord x="42.0" y="57.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="23" type="service">
|
||||
<locationId>[x=16.0][y=57.0]</locationId>
|
||||
<coord x="16.0" y="57.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="24" type="service">
|
||||
<locationId>[x=8.0][y=52.0]</locationId>
|
||||
<coord x="8.0" y="52.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="25" type="service">
|
||||
<locationId>[x=7.0][y=38.0]</locationId>
|
||||
<coord x="7.0" y="38.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="26" type="service">
|
||||
<locationId>[x=27.0][y=68.0]</locationId>
|
||||
<coord x="27.0" y="68.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="27" type="service">
|
||||
<locationId>[x=30.0][y=48.0]</locationId>
|
||||
<coord x="30.0" y="48.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="28" type="service">
|
||||
<locationId>[x=43.0][y=67.0]</locationId>
|
||||
<coord x="43.0" y="67.0"/>
|
||||
<capacity-demand>14</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="29" type="service">
|
||||
<locationId>[x=58.0][y=48.0]</locationId>
|
||||
<coord x="58.0" y="48.0"/>
|
||||
<capacity-demand>6</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="3" type="service">
|
||||
<locationId>[x=52.0][y=64.0]</locationId>
|
||||
<coord x="52.0" y="64.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<locationId>[x=49.0][y=49.0]</locationId>
|
||||
<coord x="49.0" y="49.0"/>
|
||||
<capacity-demand>30</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="1" type="service">
|
||||
<locationId>[x=37.0][y=52.0]</locationId>
|
||||
<coord x="37.0" y="52.0"/>
|
||||
<capacity-demand>7</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="7" type="service">
|
||||
<locationId>[x=17.0][y=63.0]</locationId>
|
||||
<coord x="17.0" y="63.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="30" type="service">
|
||||
<locationId>[x=58.0][y=27.0]</locationId>
|
||||
<coord x="58.0" y="27.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="6" type="service">
|
||||
<locationId>[x=21.0][y=47.0]</locationId>
|
||||
<coord x="21.0" y="47.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="5" type="service">
|
||||
<locationId>[x=40.0][y=30.0]</locationId>
|
||||
<coord x="40.0" y="30.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="32" type="service">
|
||||
<locationId>[x=38.0][y=46.0]</locationId>
|
||||
<coord x="38.0" y="46.0"/>
|
||||
<capacity-demand>12</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="4" type="service">
|
||||
<locationId>[x=20.0][y=26.0]</locationId>
|
||||
<coord x="20.0" y="26.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="31" type="service">
|
||||
<locationId>[x=37.0][y=69.0]</locationId>
|
||||
<coord x="37.0" y="69.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="9" type="service">
|
||||
<locationId>[x=52.0][y=33.0]</locationId>
|
||||
<coord x="52.0" y="33.0"/>
|
||||
<capacity-demand>11</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="8" type="service">
|
||||
<locationId>[x=31.0][y=62.0]</locationId>
|
||||
<coord x="31.0" y="62.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="19" type="service">
|
||||
<locationId>[x=13.0][y=13.0]</locationId>
|
||||
<coord x="13.0" y="13.0"/>
|
||||
<capacity-demand>9</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="17" type="service">
|
||||
<locationId>[x=27.0][y=23.0]</locationId>
|
||||
<coord x="27.0" y="23.0"/>
|
||||
<capacity-demand>3</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="18" type="service">
|
||||
<locationId>[x=17.0][y=33.0]</locationId>
|
||||
<coord x="17.0" y="33.0"/>
|
||||
<capacity-demand>41</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="15" type="service">
|
||||
<locationId>[x=36.0][y=16.0]</locationId>
|
||||
<coord x="36.0" y="16.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="16" type="service">
|
||||
<locationId>[x=52.0][y=41.0]</locationId>
|
||||
<coord x="52.0" y="41.0"/>
|
||||
<capacity-demand>15</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="13" type="service">
|
||||
<locationId>[x=5.0][y=25.0]</locationId>
|
||||
<coord x="5.0" y="25.0"/>
|
||||
<capacity-demand>23</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="14" type="service">
|
||||
<locationId>[x=12.0][y=42.0]</locationId>
|
||||
<coord x="12.0" y="42.0"/>
|
||||
<capacity-demand>21</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="11" type="service">
|
||||
<locationId>[x=42.0][y=41.0]</locationId>
|
||||
<coord x="42.0" y="41.0"/>
|
||||
<capacity-demand>19</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="12" type="service">
|
||||
<locationId>[x=31.0][y=32.0]</locationId>
|
||||
<coord x="31.0" y="32.0"/>
|
||||
<capacity-demand>29</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="21" type="service">
|
||||
<locationId>[x=62.0][y=42.0]</locationId>
|
||||
<coord x="62.0" y="42.0"/>
|
||||
<capacity-demand>8</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="20" type="service">
|
||||
<locationId>[x=57.0][y=58.0]</locationId>
|
||||
<coord x="57.0" y="58.0"/>
|
||||
<capacity-demand>28</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="49" type="service">
|
||||
<locationId>[x=48.0][y=28.0]</locationId>
|
||||
<coord x="48.0" y="28.0"/>
|
||||
<capacity-demand>18</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="48" type="service">
|
||||
<locationId>[x=25.0][y=55.0]</locationId>
|
||||
<coord x="25.0" y="55.0"/>
|
||||
<capacity-demand>17</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="45" type="service">
|
||||
<locationId>[x=39.0][y=10.0]</locationId>
|
||||
<coord x="39.0" y="10.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="44" type="service">
|
||||
<locationId>[x=30.0][y=15.0]</locationId>
|
||||
<coord x="30.0" y="15.0"/>
|
||||
<capacity-demand>16</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="47" type="service">
|
||||
<locationId>[x=25.0][y=32.0]</locationId>
|
||||
<coord x="25.0" y="32.0"/>
|
||||
<capacity-demand>25</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="46" type="service">
|
||||
<locationId>[x=32.0][y=39.0]</locationId>
|
||||
<coord x="32.0" y="39.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="10" type="service">
|
||||
<locationId>[x=51.0][y=21.0]</locationId>
|
||||
<coord x="51.0" y="21.0"/>
|
||||
<capacity-demand>5</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="50" type="service">
|
||||
<locationId>[x=56.0][y=37.0]</locationId>
|
||||
<coord x="56.0" y="37.0"/>
|
||||
<capacity-demand>10</capacity-demand>
|
||||
<duration>0.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
</problem>
|
||||
Loading…
Add table
Add a link
Reference in a new issue