mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
clean up
This commit is contained in:
parent
a2d67c857e
commit
579964fb72
2 changed files with 12 additions and 15 deletions
|
|
@ -115,7 +115,7 @@ public class VehicleRoutingAlgorithm {
|
||||||
super();
|
super();
|
||||||
this.problem = problem;
|
this.problem = problem;
|
||||||
this.searchStrategyManager = searchStrategyManager;
|
this.searchStrategyManager = searchStrategyManager;
|
||||||
initialSolutions = new ArrayList<VehicleRoutingProblemSolution>();
|
initialSolutions = new ArrayList<>();
|
||||||
objectiveFunction = null;
|
objectiveFunction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ public class VehicleRoutingAlgorithm {
|
||||||
super();
|
super();
|
||||||
this.problem = problem;
|
this.problem = problem;
|
||||||
this.searchStrategyManager = searchStrategyManager;
|
this.searchStrategyManager = searchStrategyManager;
|
||||||
initialSolutions = new ArrayList<VehicleRoutingProblemSolution>();
|
initialSolutions = new ArrayList<>();
|
||||||
this.objectiveFunction = objectiveFunction;
|
this.objectiveFunction = objectiveFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ public class VehicleRoutingAlgorithm {
|
||||||
//this method may lead to errors if tour activities in the solution are different to the ones in the VRP
|
//this method may lead to errors if tour activities in the solution are different to the ones in the VRP
|
||||||
//(including differences in indexing)
|
//(including differences in indexing)
|
||||||
private void verifyAndAdaptSolution(VehicleRoutingProblemSolution solution) {
|
private void verifyAndAdaptSolution(VehicleRoutingProblemSolution solution) {
|
||||||
Set<Job> jobsNotInSolution = new HashSet<Job>(problem.getJobs().values());
|
Set<Job> jobsNotInSolution = new HashSet<>(problem.getJobs().values());
|
||||||
jobsNotInSolution.removeAll(solution.getUnassignedJobs());
|
jobsNotInSolution.removeAll(solution.getUnassignedJobs());
|
||||||
for (VehicleRoute route : solution.getRoutes()) {
|
for (VehicleRoute route : solution.getRoutes()) {
|
||||||
jobsNotInSolution.removeAll(route.getTourActivities().getJobs());
|
jobsNotInSolution.removeAll(route.getTourActivities().getJobs());
|
||||||
|
|
@ -225,7 +225,7 @@ public class VehicleRoutingAlgorithm {
|
||||||
double now = System.currentTimeMillis();
|
double now = System.currentTimeMillis();
|
||||||
int noIterationsThisAlgoIsRunning = maxIterations;
|
int noIterationsThisAlgoIsRunning = maxIterations;
|
||||||
counter.reset();
|
counter.reset();
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>(initialSolutions);
|
Collection<VehicleRoutingProblemSolution> solutions = new ArrayList<>(initialSolutions);
|
||||||
algorithmStarts(problem, solutions);
|
algorithmStarts(problem, solutions);
|
||||||
bestEver = Solutions.bestOf(solutions);
|
bestEver = Solutions.bestOf(solutions);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
|
|
|
||||||
|
|
@ -353,11 +353,11 @@ public class Jsprit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private StateManager stateManager = null;
|
private StateManager stateManager;
|
||||||
|
|
||||||
private ConstraintManager constraintManager = null;
|
private ConstraintManager constraintManager;
|
||||||
|
|
||||||
private ExecutorService es = null;
|
private ExecutorService es;
|
||||||
|
|
||||||
private Integer noThreads;
|
private Integer noThreads;
|
||||||
|
|
||||||
|
|
@ -365,7 +365,7 @@ public class Jsprit {
|
||||||
|
|
||||||
private boolean addCoreConstraints;
|
private boolean addCoreConstraints;
|
||||||
|
|
||||||
private SolutionCostCalculator objectiveFunction = null;
|
private SolutionCostCalculator objectiveFunction;
|
||||||
|
|
||||||
private Properties properties;
|
private Properties properties;
|
||||||
|
|
||||||
|
|
@ -612,13 +612,10 @@ public class Jsprit {
|
||||||
if (properties.containsKey(Parameter.THRESHOLD_INI_ABS.toString())) {
|
if (properties.containsKey(Parameter.THRESHOLD_INI_ABS.toString())) {
|
||||||
schrimpfAcceptance.setInitialThreshold(Double.valueOf(properties.getProperty(Parameter.THRESHOLD_INI_ABS.toString())));
|
schrimpfAcceptance.setInitialThreshold(Double.valueOf(properties.getProperty(Parameter.THRESHOLD_INI_ABS.toString())));
|
||||||
} else {
|
} else {
|
||||||
schrimpfThreshold = new IterationStartsListener() {
|
schrimpfThreshold = (i, problem, solutions) -> {
|
||||||
@Override
|
if (i == 1) {
|
||||||
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
double initialThreshold = Solutions.bestOf(solutions).getCost() * toDouble(getProperty(Parameter.THRESHOLD_INI.toString()));
|
||||||
if (i == 1) {
|
schrimpfAcceptance.setInitialThreshold(initialThreshold);
|
||||||
double initialThreshold = Solutions.bestOf(solutions).getCost() * toDouble(getProperty(Parameter.THRESHOLD_INI.toString()));
|
|
||||||
schrimpfAcceptance.setInitialThreshold(initialThreshold);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue