I managed to find a solution for this. If someone knows a better solution, please let me know.
public File aggregateAllBenchmarks() {
// Load benchmark configuration
PlannerBenchmarkConfig benchmarkConfig = PlannerBenchmarkConfig.createFromXmlResource("benchmarkConfig.xml");
File benchmarkDirectory = new File(String.valueOf(benchmarkConfig.getBenchmarkDirectory()));
if (!benchmarkDirectory.exists() || !benchmarkDirectory.isDirectory()) {
throw new IllegalArgumentException("Benchmark directory does not exist: " + benchmarkDirectory);
}
// Read all existing benchmark results from the directory
BenchmarkResultIO benchmarkResultIO = new BenchmarkResultIO();
List<PlannerBenchmarkResult> plannerBenchmarkResults =
benchmarkResultIO.readPlannerBenchmarkResultList(benchmarkDirectory);
if (plannerBenchmarkResults.isEmpty()) {
throw new IllegalArgumentException("No benchmark results found in directory: " + benchmarkDirectory);
}
// Collect all single benchmark results and preserve solver names
List<SingleBenchmarkResult> allSingleBenchmarkResults = new ArrayList<>();
Map<SolverBenchmarkResult, String> solverBenchmarkResultNameMap = new HashMap<>();
for (PlannerBenchmarkResult plannerResult : plannerBenchmarkResults) {
for (SolverBenchmarkResult solverResult : plannerResult.getSolverBenchmarkResultList()) {
allSingleBenchmarkResults.addAll(solverResult.getSingleBenchmarkResultList());
solverBenchmarkResultNameMap.put(solverResult, solverResult.getName());
}
}
// Create and configure the benchmark aggregator
BenchmarkAggregator aggregator = new BenchmarkAggregator();
aggregator.setBenchmarkDirectory(benchmarkDirectory);
aggregator.setBenchmarkReportConfig(benchmarkConfig.getBenchmarkReportConfig());
// Perform the aggregation - returns HTML report file
File htmlOverviewFile = aggregator.aggregate(allSingleBenchmarkResults, solverBenchmarkResultNameMap);
return htmlOverviewFile;
}