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();
|
double now = System.currentTimeMillis();
|
||||||
int noIterationsThisAlgoIsRunning = maxIterations;
|
int noIterationsThisAlgoIsRunning = maxIterations;
|
||||||
counter.reset();
|
counter.reset();
|
||||||
|
logger.info("algorithmStarts func call");
|
||||||
algorithmStarts(problem, solutions);
|
algorithmStarts(problem, solutions);
|
||||||
bestEver = Solutions.bestOf(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()) {
|
if (logger.isTraceEnabled()) {
|
||||||
log(solutions);
|
log(solutions);
|
||||||
}
|
}
|
||||||
logger.info("iterations start");
|
|
||||||
for (int i = 0; i < maxIterations; i++) {
|
for (int i = 0; i < maxIterations; i++) {
|
||||||
iterationStarts(i + 1, problem, solutions);
|
iterationStarts(i + 1, problem, solutions);
|
||||||
logger.debug("start iteration: {}", i);
|
logger.debug("start iteration: {}", i);
|
||||||
counter.incCounter();
|
counter.incCounter();
|
||||||
SearchStrategy strategy = searchStrategyManager.getRandomStrategy();
|
SearchStrategy strategy = searchStrategyManager.getRandomStrategy();
|
||||||
|
if (i % 10 == 0) {
|
||||||
|
logger.info("selected strategy {}", strategy.getName());
|
||||||
|
}
|
||||||
|
|
||||||
DiscoveredSolution discoveredSolution = strategy.run(problem, solutions);
|
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()) {
|
if (logger.isTraceEnabled()) {
|
||||||
log(discoveredSolution);
|
log(discoveredSolution);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -536,13 +536,13 @@ public class VehicleRoutingAlgorithms {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uncaughtException(Thread arg0, Throwable arg1) {
|
public void uncaughtException(Thread arg0, Throwable arg1) {
|
||||||
System.err.println(arg1.toString());
|
log.error("error: {}", arg1.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!executorService.isShutdown()) {
|
if (!executorService.isShutdown()) {
|
||||||
System.err.println("shutdowHook shuts down executorService");
|
log.error("shutdowHook shuts down executorService");
|
||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue