Skip to content

Commit

Permalink
PLANNER-436, PLANNER-356: Solution interface no longer necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
triceo authored and ge0ffrey committed Mar 22, 2016
1 parent c230e2e commit 90b9357
Show file tree
Hide file tree
Showing 258 changed files with 2,570 additions and 2,777 deletions.
Expand Up @@ -16,9 +16,6 @@


package org.optaplanner.benchmark.config; package org.optaplanner.benchmark.config;


import java.util.ArrayList;
import java.util.regex.Pattern;

import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAlias;
import org.optaplanner.benchmark.impl.result.PlannerBenchmarkResult; import org.optaplanner.benchmark.impl.result.PlannerBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult; import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult;
Expand All @@ -27,13 +24,15 @@
import org.optaplanner.core.config.solver.SolverConfig; import org.optaplanner.core.config.solver.SolverConfig;
import org.optaplanner.core.config.util.ConfigUtils; import org.optaplanner.core.config.util.ConfigUtils;


import java.util.ArrayList;

@XStreamAlias("solverBenchmark") @XStreamAlias("solverBenchmark")
public class SolverBenchmarkConfig extends AbstractConfig<SolverBenchmarkConfig> { public class SolverBenchmarkConfig<Solution_> extends AbstractConfig<SolverBenchmarkConfig> {


private String name = null; private String name = null;


@XStreamAlias("solver") @XStreamAlias("solver")
private SolverConfig solverConfig = null; private SolverConfig<Solution_> solverConfig = null;


@XStreamAlias("problemBenchmarks") @XStreamAlias("problemBenchmarks")
private ProblemBenchmarksConfig problemBenchmarksConfig = null; private ProblemBenchmarksConfig problemBenchmarksConfig = null;
Expand All @@ -48,11 +47,11 @@ public void setName(String name) {
this.name = name; this.name = name;
} }


public SolverConfig getSolverConfig() { public SolverConfig<Solution_> getSolverConfig() {
return solverConfig; return solverConfig;
} }


public void setSolverConfig(SolverConfig solverConfig) { public void setSolverConfig(SolverConfig<Solution_> solverConfig) {
this.solverConfig = solverConfig; this.solverConfig = solverConfig;
} }


Expand Down
Expand Up @@ -19,7 +19,6 @@
import org.optaplanner.benchmark.impl.ranking.TotalRankSolverRankingWeightFactory; import org.optaplanner.benchmark.impl.ranking.TotalRankSolverRankingWeightFactory;
import org.optaplanner.benchmark.impl.ranking.TotalScoreSolverRankingComparator; import org.optaplanner.benchmark.impl.ranking.TotalScoreSolverRankingComparator;
import org.optaplanner.benchmark.impl.ranking.WorstScoreSolverRankingComparator; import org.optaplanner.benchmark.impl.ranking.WorstScoreSolverRankingComparator;
import org.optaplanner.core.api.domain.solution.Solution;


public enum SolverRankingType { public enum SolverRankingType {
/** /**
Expand Down
Expand Up @@ -16,29 +16,10 @@


package org.optaplanner.benchmark.impl; package org.optaplanner.benchmark.impl;


import java.io.File;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.optaplanner.benchmark.api.PlannerBenchmark; import org.optaplanner.benchmark.api.PlannerBenchmark;
import org.optaplanner.benchmark.api.PlannerBenchmarkException; import org.optaplanner.benchmark.api.PlannerBenchmarkException;
import org.optaplanner.benchmark.impl.report.BenchmarkReport; import org.optaplanner.benchmark.impl.report.BenchmarkReport;
import org.optaplanner.benchmark.impl.result.BenchmarkResultIO; import org.optaplanner.benchmark.impl.result.*;
import org.optaplanner.benchmark.impl.result.PlannerBenchmarkResult;
import org.optaplanner.benchmark.impl.result.ProblemBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SubSingleBenchmarkResult;
import org.optaplanner.benchmark.impl.statistic.ProblemStatistic; import org.optaplanner.benchmark.impl.statistic.ProblemStatistic;
import org.optaplanner.benchmark.impl.statistic.PureSubSingleStatistic; import org.optaplanner.benchmark.impl.statistic.PureSubSingleStatistic;
import org.optaplanner.core.config.SolverConfigContext; import org.optaplanner.core.config.SolverConfigContext;
Expand All @@ -47,6 +28,10 @@
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;


import java.io.File;
import java.util.*;
import java.util.concurrent.*;

public class PlannerBenchmarkRunner implements PlannerBenchmark { public class PlannerBenchmarkRunner implements PlannerBenchmark {


protected final transient Logger logger = LoggerFactory.getLogger(getClass()); protected final transient Logger logger = LoggerFactory.getLogger(getClass());
Expand Down Expand Up @@ -260,10 +245,10 @@ private void warmUp(Map<Future<SubSingleBenchmarkRunner>, SubSingleBenchmarkRunn
} }


protected void runSingleBenchmarks() { protected void runSingleBenchmarks() {
Map<SubSingleBenchmarkRunner, Future<SubSingleBenchmarkRunner>> futureMap Map<SubSingleBenchmarkRunner, Future<SubSingleBenchmarkRunner>> futureMap = new HashMap<>();
= new HashMap<SubSingleBenchmarkRunner, Future<SubSingleBenchmarkRunner>>();
for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) { for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List<SingleBenchmarkResult> results = problemBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult singleBenchmarkResult : results) {
for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) { for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) {
SubSingleBenchmarkRunner subSingleBenchmarkRunner = new SubSingleBenchmarkRunner( SubSingleBenchmarkRunner subSingleBenchmarkRunner = new SubSingleBenchmarkRunner(
subSingleBenchmarkResult, solverConfigContext); subSingleBenchmarkResult, solverConfigContext);
Expand All @@ -273,7 +258,7 @@ protected void runSingleBenchmarks() {
} }
} }
// Wait for the benchmarks to complete // Wait for the benchmarks to complete
for (Map.Entry<SubSingleBenchmarkRunner, Future<SubSingleBenchmarkRunner>> futureEntry : futureMap.entrySet()) { futureMap.entrySet().forEach(futureEntry -> {
SubSingleBenchmarkRunner subSingleBenchmarkRunner = futureEntry.getKey(); SubSingleBenchmarkRunner subSingleBenchmarkRunner = futureEntry.getKey();
Future<SubSingleBenchmarkRunner> future = futureEntry.getValue(); Future<SubSingleBenchmarkRunner> future = futureEntry.getValue();
Throwable failureThrowable = null; Throwable failureThrowable = null;
Expand Down Expand Up @@ -309,7 +294,7 @@ protected void runSingleBenchmarks() {
firstFailureSubSingleBenchmarkRunner = subSingleBenchmarkRunner; firstFailureSubSingleBenchmarkRunner = subSingleBenchmarkRunner;
} }
} }
} });
} }


public void benchmarkingEnded() { public void benchmarkingEnded() {
Expand Down
Expand Up @@ -16,12 +16,9 @@


package org.optaplanner.benchmark.impl; package org.optaplanner.benchmark.impl;


import java.util.concurrent.Callable;

import org.optaplanner.benchmark.impl.result.ProblemBenchmarkResult; import org.optaplanner.benchmark.impl.result.ProblemBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SubSingleBenchmarkResult; import org.optaplanner.benchmark.impl.result.SubSingleBenchmarkResult;
import org.optaplanner.benchmark.impl.statistic.SubSingleStatistic; import org.optaplanner.benchmark.impl.statistic.SubSingleStatistic;
import org.optaplanner.core.api.domain.solution.Solution;
import org.optaplanner.core.api.solver.Solver; import org.optaplanner.core.api.solver.Solver;
import org.optaplanner.core.config.SolverConfigContext; import org.optaplanner.core.config.SolverConfigContext;
import org.optaplanner.core.config.solver.SolverConfig; import org.optaplanner.core.config.solver.SolverConfig;
Expand All @@ -32,7 +29,9 @@
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.MDC; import org.slf4j.MDC;


public class SubSingleBenchmarkRunner implements Callable<SubSingleBenchmarkRunner> { import java.util.concurrent.Callable;

public class SubSingleBenchmarkRunner<Solution_> implements Callable<SubSingleBenchmarkRunner<Solution_>> {


public static final String NAME_MDC = "subSingleBenchmark.name"; public static final String NAME_MDC = "subSingleBenchmark.name";


Expand Down Expand Up @@ -77,40 +76,40 @@ public void setFailureThrowable(Throwable failureThrowable) {
// ************************************************************************ // ************************************************************************


@Override @Override
public SubSingleBenchmarkRunner call() { public SubSingleBenchmarkRunner<Solution_> call() {
MDC.put(NAME_MDC, subSingleBenchmarkResult.getName()); MDC.put(NAME_MDC, subSingleBenchmarkResult.getName());
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
ProblemBenchmarkResult problemBenchmarkResult = subSingleBenchmarkResult.getSingleBenchmarkResult().getProblemBenchmarkResult(); ProblemBenchmarkResult<Solution_> problemBenchmarkResult = subSingleBenchmarkResult.getSingleBenchmarkResult().getProblemBenchmarkResult();
Solution inputSolution = problemBenchmarkResult.readPlanningProblem(); Solution_ inputSolution = problemBenchmarkResult.readPlanningProblem();
if (!problemBenchmarkResult.getPlannerBenchmarkResult().hasMultipleParallelBenchmarks()) { if (!problemBenchmarkResult.getPlannerBenchmarkResult().hasMultipleParallelBenchmarks()) {
runtime.gc(); runtime.gc();
subSingleBenchmarkResult.setUsedMemoryAfterInputSolution(runtime.totalMemory() - runtime.freeMemory()); subSingleBenchmarkResult.setUsedMemoryAfterInputSolution(runtime.totalMemory() - runtime.freeMemory());
} }
logger.trace("Benchmark inputSolution has been read for subSingleBenchmarkResult ({}).", logger.trace("Benchmark inputSolution has been read for subSingleBenchmarkResult ({}).",
subSingleBenchmarkResult); subSingleBenchmarkResult);


SolverConfig solverConfig = subSingleBenchmarkResult.getSingleBenchmarkResult().getSolverBenchmarkResult().getSolverConfig(); SolverConfig<Solution_> solverConfig = subSingleBenchmarkResult.getSingleBenchmarkResult().getSolverBenchmarkResult().getSolverConfig();
if (subSingleBenchmarkResult.getSingleBenchmarkResult().getSubSingleCount() > 1) { if (subSingleBenchmarkResult.getSingleBenchmarkResult().getSubSingleCount() > 1) {
solverConfig = new SolverConfig(solverConfig); solverConfig = new SolverConfig<>(solverConfig);
solverConfig.offerRandomSeedFromSubSingleIndex((long) subSingleBenchmarkResult.getSubSingleBenchmarkIndex()); solverConfig.offerRandomSeedFromSubSingleIndex((long) subSingleBenchmarkResult.getSubSingleBenchmarkIndex());
} }
// Intentionally create a fresh solver for every SingleBenchmarkResult to reset Random, tabu lists, ... // Intentionally create a fresh solver for every SingleBenchmarkResult to reset Random, tabu lists, ...
Solver<Solution> solver = solverConfig.buildSolver(solverConfigContext); Solver<Solution_> solver = solverConfig.buildSolver(solverConfigContext);


for (SubSingleStatistic subSingleStatistic : subSingleBenchmarkResult.getEffectiveSubSingleStatisticMap().values()) { for (SubSingleStatistic subSingleStatistic : subSingleBenchmarkResult.getEffectiveSubSingleStatisticMap().values()) {
subSingleStatistic.open(solver); subSingleStatistic.open(solver);
subSingleStatistic.initPointList(); subSingleStatistic.initPointList();
} }


Solution outputSolution = solver.solve(inputSolution); Solution_ outputSolution = solver.solve(inputSolution);
long timeMillisSpent = solver.getTimeMillisSpent(); long timeMillisSpent = solver.getTimeMillisSpent();


DefaultSolverScope solverScope = ((DefaultSolver) solver).getSolverScope(); DefaultSolverScope<Solution_> solverScope = ((DefaultSolver<Solution_>) solver).getSolverScope();
SolutionDescriptor solutionDescriptor = solverScope.getSolutionDescriptor(); SolutionDescriptor<Solution_> solutionDescriptor = solverScope.getSolutionDescriptor();
problemBenchmarkResult.registerScale(solutionDescriptor.getEntityCount(outputSolution), problemBenchmarkResult.registerScale(solutionDescriptor.getEntityCount(outputSolution),
solutionDescriptor.getGenuineVariableCount(outputSolution), solutionDescriptor.getGenuineVariableCount(outputSolution),
solutionDescriptor.getProblemScale(outputSolution)); solutionDescriptor.getProblemScale(outputSolution));
subSingleBenchmarkResult.setScore(outputSolution.getScore()); subSingleBenchmarkResult.setScore(solutionDescriptor.getScore(outputSolution));
subSingleBenchmarkResult.setUninitializedVariableCount(solverScope.getBestUninitializedVariableCount()); subSingleBenchmarkResult.setUninitializedVariableCount(solverScope.getBestUninitializedVariableCount());
subSingleBenchmarkResult.setTimeMillisSpent(timeMillisSpent); subSingleBenchmarkResult.setTimeMillisSpent(timeMillisSpent);
subSingleBenchmarkResult.setCalculateCount(solverScope.getCalculateCount()); subSingleBenchmarkResult.setCalculateCount(solverScope.getCalculateCount());
Expand Down
Expand Up @@ -16,24 +16,23 @@


package org.optaplanner.benchmark.impl.ranking; package org.optaplanner.benchmark.impl.ranking;


import java.util.Comparator;
import java.util.List;

import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult; import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult; import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult;
import org.optaplanner.core.api.domain.solution.Solution;
import org.optaplanner.core.api.score.Score; import org.optaplanner.core.api.score.Score;


import java.util.Comparator;
import java.util.List;

/** /**
* This {@link SolverRankingWeightFactory} orders a {@link SolverBenchmarkResult} by how how many time each of it's * This {@link SolverRankingWeightFactory} orders a {@link SolverBenchmarkResult} by how how many time each of it's
* {@link SingleBenchmarkResult} beat the {@link SingleBenchmarkResult} of the other {@link SolverBenchmarkResult}s. * {@link SingleBenchmarkResult} beat the {@link SingleBenchmarkResult} of the other {@link SolverBenchmarkResult}s.
* It maximizes the overall ranking. * It maximizes the overall ranking.
* <p> * <p>
* When the inputSolutions differ greatly in size or difficulty, this often produces a difference in * When the inputSolutions differ greatly in size or difficulty, this often produces a difference in
* {@link Score} magnitude between each {@link Solution}. For example: score 10 for dataset A versus 1000 for dataset B. * {@link Score} magnitude between each solution. For example: score 10 for dataset A versus 1000 for dataset B.
* In such cases, this ranking is more fair than {@link TotalScoreSolverRankingComparator}, * In such cases, this ranking is more fair than {@link TotalScoreSolverRankingComparator},
* because in this ranking, dataset B wouldn't marginalize dataset A. * because in this ranking, dataset B wouldn't marginalize dataset A.
*/ */
Expand All @@ -47,7 +46,8 @@ public Comparable createRankingWeight(List<SolverBenchmarkResult> solverBenchmar
int lowerCount = 0; int lowerCount = 0;
List<SingleBenchmarkResult> singleBenchmarkResultList = solverBenchmarkResult.getSingleBenchmarkResultList(); List<SingleBenchmarkResult> singleBenchmarkResultList = solverBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult single : solverBenchmarkResult.getSingleBenchmarkResultList()) { for (SingleBenchmarkResult single : solverBenchmarkResult.getSingleBenchmarkResultList()) {
for (SingleBenchmarkResult otherSingle : single.getProblemBenchmarkResult().getSingleBenchmarkResultList()) { List<SingleBenchmarkResult> results = single.getProblemBenchmarkResult().getSingleBenchmarkResultList();
for (SingleBenchmarkResult otherSingle : results) {
if (single == otherSingle) { if (single == otherSingle) {
continue; continue;
} }
Expand Down
Expand Up @@ -21,7 +21,6 @@


import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.lang3.builder.CompareToBuilder;
import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult; import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult;
import org.optaplanner.core.api.domain.solution.Solution;
import org.optaplanner.core.api.score.Score; import org.optaplanner.core.api.score.Score;


/** /**
Expand Down
Expand Up @@ -16,25 +16,6 @@


package org.optaplanner.benchmark.impl.report; package org.optaplanner.benchmark.impl.report;


import java.awt.BasicStroke;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.NavigableSet;
import java.util.TreeSet;
import javax.imageio.ImageIO;

import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.Template;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
Expand All @@ -54,18 +35,13 @@
import org.jfree.chart.renderer.xy.StandardXYItemRenderer; import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.statistics.BoxAndWhiskerCategoryDataset;
import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset; import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset;
import org.jfree.data.xy.XYDataItem; import org.jfree.data.xy.XYDataItem;
import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection; import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.TextAnchor; import org.jfree.ui.TextAnchor;
import org.optaplanner.benchmark.impl.ranking.SolverRankingWeightFactory; import org.optaplanner.benchmark.impl.ranking.SolverRankingWeightFactory;
import org.optaplanner.benchmark.impl.result.PlannerBenchmarkResult; import org.optaplanner.benchmark.impl.result.*;
import org.optaplanner.benchmark.impl.result.ProblemBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SolverBenchmarkResult;
import org.optaplanner.benchmark.impl.result.SubSingleBenchmarkResult;
import org.optaplanner.benchmark.impl.statistic.ProblemStatistic; import org.optaplanner.benchmark.impl.statistic.ProblemStatistic;
import org.optaplanner.benchmark.impl.statistic.PureSubSingleStatistic; import org.optaplanner.benchmark.impl.statistic.PureSubSingleStatistic;
import org.optaplanner.benchmark.impl.statistic.SubSingleStatistic; import org.optaplanner.benchmark.impl.statistic.SubSingleStatistic;
Expand All @@ -74,6 +50,14 @@
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;


import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.text.NumberFormat;
import java.util.*;
import java.util.List;

public class BenchmarkReport { public class BenchmarkReport {


protected final transient Logger logger = LoggerFactory.getLogger(getClass()); protected final transient Logger logger = LoggerFactory.getLogger(getClass());
Expand Down Expand Up @@ -234,7 +218,8 @@ public void writeReport() {
writeTimeSpentScalabilitySummaryChart(); writeTimeSpentScalabilitySummaryChart();
writeBestScorePerTimeSpentSummaryChart(); writeBestScorePerTimeSpentSummaryChart();
for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) { for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List<SingleBenchmarkResult> results = problemBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult singleBenchmarkResult : results) {
for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) { for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) {
if (!subSingleBenchmarkResult.hasAllSuccess()) { if (!subSingleBenchmarkResult.hasAllSuccess()) {
continue; continue;
Expand All @@ -256,10 +241,12 @@ public void writeReport() {
} }
for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) { for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
if (problemBenchmarkResult.hasAnySuccess()) { if (problemBenchmarkResult.hasAnySuccess()) {
for (ProblemStatistic problemStatistic : problemBenchmarkResult.getProblemStatisticList()) { List<ProblemStatistic> statistics = problemBenchmarkResult.getProblemStatisticList();
for (ProblemStatistic problemStatistic : statistics) {
problemStatistic.writeGraphFiles(this); problemStatistic.writeGraphFiles(this);
} }
for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List<SingleBenchmarkResult> results = problemBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult singleBenchmarkResult : results) {
if (singleBenchmarkResult.hasAllSuccess()) { if (singleBenchmarkResult.hasAllSuccess()) {
for (PureSubSingleStatistic pureSubSingleStatistic : singleBenchmarkResult.getMedian().getPureSubSingleStatisticList()) { for (PureSubSingleStatistic pureSubSingleStatistic : singleBenchmarkResult.getMedian().getPureSubSingleStatisticList()) {
pureSubSingleStatistic.writeGraphFiles(this); pureSubSingleStatistic.writeGraphFiles(this);
Expand All @@ -269,7 +256,8 @@ public void writeReport() {
} }
} }
for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) { for (ProblemBenchmarkResult problemBenchmarkResult : plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List<SingleBenchmarkResult> results = problemBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult singleBenchmarkResult : results) {
for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) { for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) {
if (!subSingleBenchmarkResult.hasAllSuccess()) { if (!subSingleBenchmarkResult.hasAllSuccess()) {
continue; continue;
Expand Down Expand Up @@ -710,7 +698,8 @@ private void determineDefaultShownScoreLevelIndex() {
for (int i = 0; i < differenceCount.length; i++) { for (int i = 0; i < differenceCount.length; i++) {
differenceCount[i] = 0; differenceCount[i] = 0;
} }
for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List<SingleBenchmarkResult> results = problemBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult singleBenchmarkResult : results) {
if (singleBenchmarkResult.hasAllSuccess()) { if (singleBenchmarkResult.hasAllSuccess()) {
double[] scoreLevels = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getAverageScore()); double[] scoreLevels = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getAverageScore());
for (int i = 0; i < scoreLevels.length; i++) { for (int i = 0; i < scoreLevels.length; i++) {
Expand Down
Expand Up @@ -128,12 +128,10 @@ private void restoreOmittedBidirectionalFields(PlannerBenchmarkResult plannerBen
if (problemBenchmarkResult.getProblemStatisticList() == null) { if (problemBenchmarkResult.getProblemStatisticList() == null) {
problemBenchmarkResult.setProblemStatisticList(new ArrayList<ProblemStatistic>(0)); problemBenchmarkResult.setProblemStatisticList(new ArrayList<ProblemStatistic>(0));
} }
for (ProblemStatistic problemStatistic : problemBenchmarkResult.getProblemStatisticList()) { List<ProblemStatistic> statistics = problemBenchmarkResult.getProblemStatisticList();
problemStatistic.setProblemBenchmarkResult(problemBenchmarkResult); statistics.forEach(statistic -> statistic.setProblemBenchmarkResult(problemBenchmarkResult));
} List<SingleBenchmarkResult> results = problemBenchmarkResult.getSingleBenchmarkResultList();
for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { results.forEach(result -> result.setProblemBenchmarkResult(problemBenchmarkResult));
singleBenchmarkResult.setProblemBenchmarkResult(problemBenchmarkResult);
}
} }
for (SolverBenchmarkResult solverBenchmarkResult : plannerBenchmarkResult.getSolverBenchmarkResultList()) { for (SolverBenchmarkResult solverBenchmarkResult : plannerBenchmarkResult.getSolverBenchmarkResultList()) {
solverBenchmarkResult.setPlannerBenchmarkResult(plannerBenchmarkResult); solverBenchmarkResult.setPlannerBenchmarkResult(plannerBenchmarkResult);
Expand Down

0 comments on commit 90b9357

Please sign in to comment.