mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
fix #186
This commit is contained in:
parent
e543665da2
commit
55e1baa205
4 changed files with 65 additions and 56 deletions
|
|
@ -42,6 +42,7 @@ import jsprit.core.algorithm.termination.VariationCoefficientTermination;
|
|||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.constraint.ConstraintManager;
|
||||
import jsprit.core.problem.constraint.SwitchNotFeasible;
|
||||
import jsprit.core.problem.solution.SolutionCostCalculator;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
|
|
@ -478,6 +479,7 @@ public class VehicleRoutingAlgorithms {
|
|||
constraintManager.addTimeWindowConstraint();
|
||||
constraintManager.addLoadConstraint();
|
||||
constraintManager.addSkillsConstraint();
|
||||
constraintManager.addConstraint(new SwitchNotFeasible(stateManager));
|
||||
|
||||
return readAndCreateAlgorithm(vrp, config, nuOfThreads, null, stateManager, constraintManager, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class SwitchNotFeasible implements HardRouteConstraint{
|
|||
@Override
|
||||
public boolean fulfilled(JobInsertionContext insertionContext) {
|
||||
Boolean notFeasible = stateManager.getRouteState(insertionContext.getRoute(),insertionContext.getNewVehicle(), InternalStates.SWITCH_NOT_FEASIBLE,Boolean.class);
|
||||
if(notFeasible == null) return true;
|
||||
if(notFeasible == null || insertionContext.getRoute().getVehicle().getVehicleTypeIdentifier().equals(insertionContext.getNewVehicle().getVehicleTypeIdentifier())) return true;
|
||||
else return !notFeasible;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue