mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
parent
ac14f2850c
commit
4da11a6c80
2 changed files with 14 additions and 5 deletions
|
|
@ -222,18 +222,27 @@ public class VehicleRoutingAlgorithm {
|
|||
double now = System.currentTimeMillis();
|
||||
int noIterationsThisAlgoIsRunning = maxIterations;
|
||||
counter.reset();
|
||||
logger.info("algorithmStarts func call");
|
||||
algorithmStarts(problem, solutions);
|
||||
bestEver = Solutions.bestOf(solutions);
|
||||
logger.info("algorithmStarts func call finished successfully best till now cost: {}, routes: {}, unassigned: {}", bestEver.getCost(), bestEver.getRoutes().size(), bestEver.getUnassignedJobs().size());
|
||||
if (logger.isTraceEnabled()) {
|
||||
log(solutions);
|
||||
}
|
||||
logger.info("iterations start");
|
||||
for (int i = 0; i < maxIterations; i++) {
|
||||
iterationStarts(i + 1, problem, solutions);
|
||||
logger.debug("start iteration: {}", i);
|
||||
counter.incCounter();
|
||||
SearchStrategy strategy = searchStrategyManager.getRandomStrategy();
|
||||
if (i % 10 == 0) {
|
||||
logger.info("selected strategy {}", strategy.getName());
|
||||
}
|
||||
|
||||
DiscoveredSolution discoveredSolution = strategy.run(problem, solutions);
|
||||
if (i % 10 == 0) {
|
||||
logger.info("discoveredSolution: cost: {}, routes: {}, unassigned: {}", discoveredSolution.getSolution().getCost(), discoveredSolution.getSolution().getRoutes().size(), discoveredSolution.getSolution().getUnassignedJobs().size());
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
log(discoveredSolution);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -475,9 +475,9 @@ public class VehicleRoutingAlgorithms {
|
|||
// stateManager.addStateUpdater(new UpdateActivityTimes(vrp.getTransportCosts()));
|
||||
// stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager));
|
||||
|
||||
/*
|
||||
/*
|
||||
* define constraints
|
||||
*/
|
||||
*/
|
||||
//constraint manager
|
||||
if (constraintManager == null)
|
||||
constraintManager = new ConstraintManager(vrp, stateManager);
|
||||
|
|
@ -536,13 +536,13 @@ public class VehicleRoutingAlgorithms {
|
|||
|
||||
@Override
|
||||
public void uncaughtException(Thread arg0, Throwable arg1) {
|
||||
System.err.println(arg1.toString());
|
||||
log.error("error: {}", arg1.toString());
|
||||
}
|
||||
});
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
if (!executorService.isShutdown()) {
|
||||
System.err.println("shutdowHook shuts down executorService");
|
||||
log.error("shutdowHook shuts down executorService");
|
||||
executorService.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue