mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
activated skillConstraints
This commit is contained in:
parent
34abc1b737
commit
ddb00ce1ce
3 changed files with 19 additions and 15 deletions
|
|
@ -112,7 +112,7 @@ public class VehicleRoutingAlgorithm {
|
|||
/**
|
||||
* Adds solution to the collection of initial solutions.
|
||||
*
|
||||
* @param solution
|
||||
* @param solution to the set of initialSolutions
|
||||
*/
|
||||
public void addInitialSolution(VehicleRoutingProblemSolution solution){
|
||||
initialSolutions.add(solution);
|
||||
|
|
@ -121,7 +121,7 @@ public class VehicleRoutingAlgorithm {
|
|||
/**
|
||||
* Sets premature termination.
|
||||
*
|
||||
* @param prematureAlgorithmTermination
|
||||
* @param prematureAlgorithmTermination that terminates the algorithm according to its termination criterion
|
||||
*/
|
||||
public void setPrematureAlgorithmTermination(PrematureAlgorithmTermination prematureAlgorithmTermination){
|
||||
this.prematureAlgorithmTermination = prematureAlgorithmTermination;
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
/**
|
||||
* Constructs the builder with the problem and an algorithmConfigFile. Latter is to configure and specify the ruin-and-recreate meta-heuristic.
|
||||
*
|
||||
* @param problem
|
||||
* @param algorithmConfig
|
||||
* @param problem to solve
|
||||
* @param algorithmConfig config file of VehicleRoutingAlgorithm
|
||||
*/
|
||||
public VehicleRoutingAlgorithmBuilder(VehicleRoutingProblem problem, String algorithmConfig) {
|
||||
this.vrp=problem;
|
||||
|
|
@ -69,9 +69,9 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
|
||||
/**
|
||||
* Constructs the builder with the problem and an algorithmConfig. Latter is to configure and specify the ruin-and-recreate meta-heuristic.
|
||||
*
|
||||
* @param problem
|
||||
* @param algorithmConfig
|
||||
*
|
||||
* @param problem to solve
|
||||
* @param algorithmConfig config file of VehicleRoutingAlgorithm
|
||||
*/
|
||||
public VehicleRoutingAlgorithmBuilder(VehicleRoutingProblem problem, AlgorithmConfig algorithmConfig) {
|
||||
this.vrp=problem;
|
||||
|
|
@ -85,7 +85,7 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
* <p>If objective function is not set, a default function is applied (which basically minimizes
|
||||
* fixed and variable transportation costs ({@link VariablePlusFixedSolutionCostCalculatorFactory}).
|
||||
*
|
||||
* @param objectiveFunction
|
||||
* @param objectiveFunction to be minimized
|
||||
* @see VariablePlusFixedSolutionCostCalculatorFactory
|
||||
*/
|
||||
public void setObjectiveFunction(SolutionCostCalculator objectiveFunction) {
|
||||
|
|
@ -95,7 +95,7 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
/**
|
||||
* Sets stateManager to memorize states.
|
||||
*
|
||||
* @param stateManager
|
||||
* @param stateManager that memorizes your states
|
||||
* @see StateManager
|
||||
*/
|
||||
public void setStateManager(StateManager stateManager) {
|
||||
|
|
@ -105,7 +105,7 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
/**
|
||||
* Adds core constraints.
|
||||
*
|
||||
* <p>Thus, it adds vehicle-capacity and time-window constraints and their
|
||||
* <p>Thus, it adds vehicle-capacity, time-window and skills constraints and their
|
||||
* required stateUpdater.
|
||||
*
|
||||
*/
|
||||
|
|
@ -130,8 +130,8 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
/**
|
||||
* Sets state- and constraintManager.
|
||||
*
|
||||
* @param stateManager
|
||||
* @param constraintManager
|
||||
* @param stateManager that memorizes your states
|
||||
* @param constraintManager that manages your constraints
|
||||
* @see StateManager
|
||||
* @see ConstraintManager
|
||||
*/
|
||||
|
|
@ -143,7 +143,7 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
/**
|
||||
* Sets nuOfThreads.
|
||||
*
|
||||
* @param nuOfThreads
|
||||
* @param nuOfThreads to be operated
|
||||
*/
|
||||
public void setNuOfThreads(int nuOfThreads){
|
||||
this.nuOfThreads=nuOfThreads;
|
||||
|
|
@ -154,7 +154,7 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
*
|
||||
* <p>If algorithmConfigFile is set, it reads the configuration.
|
||||
*
|
||||
* @return
|
||||
* @return the algorithm
|
||||
*/
|
||||
public VehicleRoutingAlgorithm build() {
|
||||
if(stateManager == null) stateManager = new StateManager(vrp.getTransportCosts());
|
||||
|
|
@ -167,8 +167,10 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
if(addCoreConstraints){
|
||||
constraintManager.addLoadConstraint();
|
||||
constraintManager.addTimeWindowConstraint();
|
||||
stateManager.updateLoadStates();
|
||||
constraintManager.addSkillsConstraint();
|
||||
stateManager.updateLoadStates();
|
||||
stateManager.updateTimeWindowStates();
|
||||
stateManager.updateSkillStates();
|
||||
}
|
||||
if(algorithmConfig==null){
|
||||
algorithmConfig = new AlgorithmConfig();
|
||||
|
|
|
|||
|
|
@ -489,6 +489,7 @@ public class VehicleRoutingAlgorithms {
|
|||
}
|
||||
stateManager.updateLoadStates();
|
||||
stateManager.updateTimeWindowStates();
|
||||
stateManager.updateSkillStates();
|
||||
stateManager.addStateUpdater(new UpdateEndLocationIfRouteIsOpen());
|
||||
stateManager.addStateUpdater(new OpenRouteStateVerifier());
|
||||
stateManager.addStateUpdater(new UpdateActivityTimes(vrp.getTransportCosts()));
|
||||
|
|
@ -501,6 +502,7 @@ public class VehicleRoutingAlgorithms {
|
|||
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager,vrp.getConstraints());
|
||||
constraintManager.addTimeWindowConstraint();
|
||||
constraintManager.addLoadConstraint();
|
||||
constraintManager.addSkillsConstraint();
|
||||
|
||||
return readAndCreateAlgorithm(vrp, config, nuOfThreads, null, stateManager, constraintManager, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue