/*
* plot search progress of different algorithms
*/
final XYLineChartBuilder chartBuilder = XYLineChartBuilder.newInstance("alpha-sensitivity", "iterations", "costs");
computationalLab.addListener(new CalculationListener() {
@Override
public void calculationStarts(BenchmarkInstance p, final String algorithmName,VehicleRoutingAlgorithm algorithm, int run) {
algorithm.addListener(new IterationStartsListener() {
@Override
public void informIterationStarts(int i, VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
/*
* plot only distance-costs, i.e. without fixed costs
*/
VehicleRoutingProblemSolution bestOf = Solutions.bestOf(solutions);
chartBuilder.addData(algorithmName, i, bestOf.getCost()-bestOf.getRoutes().size()*100.);
}
});
}
@Override
public void calculationEnds(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run,Collection<VehicleRoutingProblemSolution> solutions) {}
});
/*
* define dataCollector to collect an arbitrary number of indicators as well as solutions
*/
final DataCollector dataCollector = new DataCollector();
computationalLab.addListener(new CalculationListener() {
@Override
public void calculationStarts(BenchmarkInstance p, String algorithmName,VehicleRoutingAlgorithm algorithm, int run) {}
@Override