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();
|
||||
this.problem = problem;
|
||||
this.searchStrategyManager = searchStrategyManager;
|
||||
initialSolutions = new ArrayList<VehicleRoutingProblemSolution>();
|
||||
initialSolutions = new ArrayList<>();
|
||||
objectiveFunction = null;
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ public class VehicleRoutingAlgorithm {
|
|||
super();
|
||||
this.problem = problem;
|
||||
this.searchStrategyManager = searchStrategyManager;
|
||||
initialSolutions = new ArrayList<VehicleRoutingProblemSolution>();
|
||||
initialSolutions = new ArrayList<>();
|
||||
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
|
||||
//(including differences in indexing)
|
||||
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());
|
||||
for (VehicleRoute route : solution.getRoutes()) {
|
||||
jobsNotInSolution.removeAll(route.getTourActivities().getJobs());
|
||||
|
|
@ -225,7 +225,7 @@ public class VehicleRoutingAlgorithm {
|
|||
double now = System.currentTimeMillis();
|
||||
int noIterationsThisAlgoIsRunning = maxIterations;
|
||||
counter.reset();
|
||||
Collection<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>(initialSolutions);
|
||||
Collection<VehicleRoutingProblemSolution> solutions = new ArrayList<>(initialSolutions);
|
||||
algorithmStarts(problem, solutions);
|
||||
bestEver = Solutions.bestOf(solutions);
|
||||
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;
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ public class Jsprit {
|
|||
|
||||
private boolean addCoreConstraints;
|
||||
|
||||
private SolutionCostCalculator objectiveFunction = null;
|
||||
private SolutionCostCalculator objectiveFunction;
|
||||
|
||||
private Properties properties;
|
||||
|
||||
|
|
@ -612,13 +612,10 @@ public class Jsprit {
|
|||
if (properties.containsKey(Parameter.THRESHOLD_INI_ABS.toString())) {
|
||||
schrimpfAcceptance.setInitialThreshold(Double.valueOf(properties.getProperty(Parameter.THRESHOLD_INI_ABS.toString())));
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
schrimpfThreshold = (i, problem, solutions) -> {
|
||||
if (i == 1) {
|
||||
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