// ************************************************************************
public SingleBenchmarkRunner call() {
MDC.put(NAME_MDC, singleBenchmarkResult.getName());
Runtime runtime = Runtime.getRuntime();
ProblemBenchmarkResult problemBenchmarkResult = singleBenchmarkResult.getProblemBenchmarkResult();
Solution inputSolution = problemBenchmarkResult.readPlanningProblem();
if (!problemBenchmarkResult.getPlannerBenchmarkResult().hasMultipleParallelBenchmarks()) {
runtime.gc();
singleBenchmarkResult.setUsedMemoryAfterInputSolution(runtime.totalMemory() - runtime.freeMemory());
}
logger.trace("Benchmark inputSolution has been read for singleBenchmarkResult ({}).",
singleBenchmarkResult.getName());
// Intentionally create a fresh solver for every SingleBenchmarkResult to reset Random, tabu lists, ...
Solver solver = singleBenchmarkResult.getSolverBenchmarkResult().getSolverConfig().buildSolver();
for (SingleStatistic singleStatistic : singleBenchmarkResult.getEffectiveSingleStatisticMap().values()) {
singleStatistic.open(solver);
}
solver.solve(inputSolution);
long timeMillisSpent = solver.getTimeMillisSpent();
Solution outputSolution = solver.getBestSolution();
DefaultSolverScope solverScope = ((DefaultSolver) solver).getSolverScope();
SolutionDescriptor solutionDescriptor = solverScope.getSolutionDescriptor();
problemBenchmarkResult.registerScale(solutionDescriptor.getEntityCount(outputSolution),
solutionDescriptor.getVariableCount(outputSolution),
solutionDescriptor.getProblemScale(outputSolution));
singleBenchmarkResult.setScore(outputSolution.getScore());
singleBenchmarkResult.setTimeMillisSpent(timeMillisSpent);
singleBenchmarkResult.setCalculateCount(solverScope.getCalculateCount());
for (SingleStatistic singleStatistic : singleBenchmarkResult.getEffectiveSingleStatisticMap().values()) {
singleStatistic.close(solver);
singleStatistic.writeCsvStatisticFile();
}
problemBenchmarkResult.writeOutputSolution(singleBenchmarkResult, outputSolution);
MDC.remove(NAME_MDC);
return this;
}