From 98655f4bcc18c24db71b0b0d41d956a91dbe6d15 Mon Sep 17 00:00:00 2001 From: Ondrej Skopek Date: Wed, 23 Sep 2015 10:12:10 +0200 Subject: [PATCH] PLANNER-401: Renamed methods in BenchmarkResult --- .../impl/PlannerBenchmarkRunner.java | 2 +- .../impl/SubSingleBenchmarkRunner.java | 2 +- .../SingleBenchmarkRankingComparator.java | 2 +- .../SubSingleBenchmarkRankingComparator.java | 5 ++-- .../impl/report/BenchmarkReport.java | 24 +++++++-------- .../impl/result/BenchmarkResult.java | 16 +++++----- .../impl/result/ProblemBenchmarkResult.java | 6 ++-- .../impl/result/SingleBenchmarkResult.java | 29 ++++++++----------- .../impl/result/SolverBenchmarkResult.java | 2 +- .../impl/result/SubSingleBenchmarkResult.java | 24 +++++++-------- .../statistic/PureSubSingleStatistic.java | 2 +- .../impl/statistic/StatisticUtils.java | 4 +-- .../impl/statistic/SubSingleStatistic.java | 10 +++---- .../bestscore/BestScoreProblemStatistic.java | 2 +- .../BestSolutionMutationProblemStatistic.java | 2 +- .../CalculateCountProblemStatistic.java | 2 +- .../memoryuse/MemoryUseProblemStatistic.java | 2 +- .../MoveCountPerStepProblemStatistic.java | 2 +- .../stepscore/StepScoreProblemStatistic.java | 2 +- .../impl/report/benchmarkReport.html.ftl | 10 +++---- 20 files changed, 70 insertions(+), 80 deletions(-) diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/PlannerBenchmarkRunner.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/PlannerBenchmarkRunner.java index c954a8d2b4..69dbcd5f50 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/PlannerBenchmarkRunner.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/PlannerBenchmarkRunner.java @@ -265,7 +265,7 @@ protected void runSingleBenchmarks() { // Explicitly returning it in the Callable guarantees memory visibility subSingleBenchmarkRunner = future.get(); // TODO WORKAROUND Remove when PLANNER-46 is fixed. - if (subSingleBenchmarkRunner.getSubSingleBenchmarkResult().getScore() == null) { + if (subSingleBenchmarkRunner.getSubSingleBenchmarkResult().getAverageScore() == null) { throw new IllegalStateException("Score is null. TODO fix PLANNER-46."); } } catch (InterruptedException e) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/SubSingleBenchmarkRunner.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/SubSingleBenchmarkRunner.java index 35606ce8b6..85d6763f58 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/SubSingleBenchmarkRunner.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/SubSingleBenchmarkRunner.java @@ -74,7 +74,7 @@ public SubSingleBenchmarkRunner call() { // Intentionally create a fresh solver for every SingleBenchmarkResult to reset Random, tabu lists, ... // TODO PLANNER-440 Use a classLoader argument buildSolver() - Solver solver = subSingleBenchmarkResult.getSolverBenchmarkResult().getSolverConfig().buildSolver(); + Solver solver = subSingleBenchmarkResult.getSingleBenchmarkResult().getSolverBenchmarkResult().getSolverConfig().buildSolver(); for (SubSingleStatistic subSingleStatistic : subSingleBenchmarkResult.getEffectiveSubSingleStatisticMap().values()) { subSingleStatistic.open(solver); diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/ranking/SingleBenchmarkRankingComparator.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/ranking/SingleBenchmarkRankingComparator.java index 1c0c924924..94ed8d4435 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/ranking/SingleBenchmarkRankingComparator.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/ranking/SingleBenchmarkRankingComparator.java @@ -30,7 +30,7 @@ public class SingleBenchmarkRankingComparator implements Comparator= datasetList.size()) { @@ -345,7 +345,7 @@ private void writeBestScoreScalabilitySummaryChart() { for (SolverBenchmarkResult solverBenchmarkResult : plannerBenchmarkResult.getSolverBenchmarkResultList()) { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { long problemScale = singleBenchmarkResult.getProblemBenchmarkResult().getProblemScale(); double[] levelValues = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getAverageScore()); for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { @@ -385,7 +385,7 @@ private void writeWinningScoreDifferenceSummaryChart() { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { String planningProblemLabel = singleBenchmarkResult.getProblemBenchmarkResult().getName(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { double[] levelValues = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getWinningScoreDifference()); for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { if (i >= datasetList.size()) { @@ -417,7 +417,7 @@ private void writeWorstScoreDifferencePercentageSummaryChart() { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { String planningProblemLabel = singleBenchmarkResult.getProblemBenchmarkResult().getName(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { double[] levelValues = singleBenchmarkResult.getWorstScoreDifferencePercentage().getPercentageLevels(); for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { if (i >= datasetList.size()) { @@ -449,7 +449,7 @@ private void writeAverageCalculateCountPerSecondSummaryChart() { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); XYSeries series = new XYSeries(solverLabel); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { long problemScale = singleBenchmarkResult.getProblemBenchmarkResult().getProblemScale(); long averageCalculateCountPerSecond = singleBenchmarkResult.getAverageCalculateCountPerSecond(); series.add((Long) problemScale, (Long) averageCalculateCountPerSecond); @@ -471,7 +471,7 @@ private void writeTimeSpentSummaryChart() { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { String planningProblemLabel = singleBenchmarkResult.getProblemBenchmarkResult().getName(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { long timeMillisSpent = singleBenchmarkResult.getTimeMillisSpent(); dataset.addValue(timeMillisSpent, solverLabel, planningProblemLabel); } @@ -489,7 +489,7 @@ private void writeTimeSpentScalabilitySummaryChart() { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); XYSeries series = new XYSeries(solverLabel); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { long problemScale = singleBenchmarkResult.getProblemBenchmarkResult().getProblemScale(); long timeMillisSpent = singleBenchmarkResult.getTimeMillisSpent(); series.add((Long) problemScale, (Long) timeMillisSpent); @@ -513,7 +513,7 @@ private void writeBestScorePerTimeSpentSummaryChart() { for (SolverBenchmarkResult solverBenchmarkResult : plannerBenchmarkResult.getSolverBenchmarkResultList()) { String solverLabel = solverBenchmarkResult.getNameWithFavoriteSuffix(); for (SingleBenchmarkResult singleBenchmarkResult : solverBenchmarkResult.getSingleBenchmarkResultList()) { - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { long timeMillisSpent = singleBenchmarkResult.getTimeMillisSpent(); double[] levelValues = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getAverageScore()); for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { @@ -583,8 +583,8 @@ private List generateSubSingleBenchmarkS for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List> valueListList = new ArrayList>(CHARTED_SCORE_LEVEL_SIZE); for (SubSingleBenchmarkResult subSingleBenchmarkResult : singleBenchmarkResult.getSubSingleBenchmarkResultList()) { - if (subSingleBenchmarkResult.isSuccess() && subSingleBenchmarkResult.isInitialized()) { - double[] levelValues = ScoreUtils.extractLevelDoubles(subSingleBenchmarkResult.getScore()); + if (subSingleBenchmarkResult.hasAnySuccess() && subSingleBenchmarkResult.isInitialized()) { + double[] levelValues = ScoreUtils.extractLevelDoubles(subSingleBenchmarkResult.getAverageScore()); for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { if (i >= valueListList.size()) { valueListList.add(new ArrayList(singleBenchmarkResult.getSuccessCount())); @@ -715,7 +715,7 @@ private void determineDefaultShownScoreLevelIndex() { differenceCount[i] = 0; } for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { double[] scoreLevels = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getAverageScore()); for (int i = 0; i < scoreLevels.length; i++) { if (scoreLevels[i] != winningScoreLevels[i]) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/BenchmarkResult.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/BenchmarkResult.java index b2cfde4994..3f5d618713 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/BenchmarkResult.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/BenchmarkResult.java @@ -23,20 +23,18 @@ public interface BenchmarkResult { - public SolverBenchmarkResult getSolverBenchmarkResult(); + public String getResultDirectoryPath(); - public ProblemBenchmarkResult getProblemBenchmarkResult(); + public File getResultDirectory(); - public String getReportDirectoryPath(); + public boolean hasAnyFailure(); - public File getReportDirectory(); - - public boolean isFailure(); - - public boolean isSuccess(); + public boolean hasAnySuccess(); public String getName(); - public Score getScore(); + public Integer getAverageUninitializedVariableCount(); + + public Score getAverageScore(); } diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/ProblemBenchmarkResult.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/ProblemBenchmarkResult.java index c4f560411b..1ec829071f 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/ProblemBenchmarkResult.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/ProblemBenchmarkResult.java @@ -282,7 +282,7 @@ public void writeOutputSolution(SubSingleBenchmarkResult subSingleBenchmarkResul return; } String filename = getName() + "." + solutionFileIO.getOutputFileExtension(); - File outputSolutionFile = new File(subSingleBenchmarkResult.getReportDirectory(), filename); + File outputSolutionFile = new File(subSingleBenchmarkResult.getResultDirectory(), filename); solutionFileIO.write(outputSolution, outputSolutionFile); } @@ -310,7 +310,7 @@ private void determineTotalsAndAveragesAndRanking() { // Do not rank a SingleBenchmarkResult that has a failure for (Iterator it = successResultList.iterator(); it.hasNext(); ) { SingleBenchmarkResult singleBenchmarkResult = it.next(); - if (singleBenchmarkResult.isFailure()) { + if (singleBenchmarkResult.hasAnyFailure()) { failureCount++; it.remove(); } else { @@ -354,7 +354,7 @@ private void determineRanking(List rankedSingleBenchmarkR private void determineWinningScoreDifference() { for (SingleBenchmarkResult singleBenchmarkResult : singleBenchmarkResultList) { - if (singleBenchmarkResult.isFailure()) { + if (singleBenchmarkResult.hasAnyFailure()) { continue; } singleBenchmarkResult.setWinningScoreDifference( diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SingleBenchmarkResult.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SingleBenchmarkResult.java index f2d6caa0db..4cb9a23790 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SingleBenchmarkResult.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SingleBenchmarkResult.java @@ -98,7 +98,6 @@ public void initSubSingleStatisticMap() { } } - @Override public SolverBenchmarkResult getSolverBenchmarkResult() { return solverBenchmarkResult; } @@ -107,7 +106,6 @@ public void setSolverBenchmarkResult(SolverBenchmarkResult solverBenchmarkResult this.solverBenchmarkResult = solverBenchmarkResult; } - @Override public ProblemBenchmarkResult getProblemBenchmarkResult() { return problemBenchmarkResult; } @@ -183,6 +181,7 @@ public void setRanking(Integer ranking) { this.ranking = ranking; } + @Override public Score getAverageScore() { return averageScore; } @@ -207,6 +206,7 @@ public double[] getStandardDeviationDoubles() { return standardDeviationDoubles; } + @Override public Integer getAverageUninitializedVariableCount() { return averageUninitializedVariableCount; } @@ -247,7 +247,7 @@ public File getBenchmarkReportDirectory() { } @Override - public boolean isSuccess() { + public boolean hasAnySuccess() { return failureCount != null && failureCount == 0; } @@ -256,7 +256,7 @@ public boolean isInitialized() { } @Override - public boolean isFailure() { + public boolean hasAnyFailure() { return failureCount != null && failureCount != 0; } @@ -299,25 +299,20 @@ public String getStandardDeviationString() { return StatisticUtils.getStandardDeviationString(standardDeviationDoubles); } - @Override - public Score getScore() { - return getAverageScore(); - } - // ************************************************************************ // Accumulate methods // ************************************************************************ - public String getReportDirectoryPath() { + public String getResultDirectoryPath() { return solverBenchmarkResult.getName(); } - public File getReportDirectory() { - return new File(problemBenchmarkResult.getProblemReportDirectory(), getReportDirectoryPath()); + public File getResultDirectory() { + return new File(problemBenchmarkResult.getProblemReportDirectory(), getResultDirectoryPath()); } public void makeDirs() { - File singleReportDirectory = getReportDirectory(); + File singleReportDirectory = getResultDirectory(); singleReportDirectory.mkdirs(); for (SubSingleBenchmarkResult subSingleBenchmarkResult : subSingleBenchmarkResultList) { subSingleBenchmarkResult.makeDirs(); @@ -343,7 +338,7 @@ private void determineRepresentativeSubSingleBenchmarkResult() { @Override public int compare(SubSingleBenchmarkResult o1, SubSingleBenchmarkResult o2) { return new CompareToBuilder() - .append(o1.isFailure(), o2.isFailure()) + .append(o1.hasAnyFailure(), o2.hasAnyFailure()) .append(o1.getRanking(), o2.getRanking()) .toComparison(); } @@ -369,7 +364,7 @@ private void determineTotalsAndAveragesAndRanking() { // Do not rank a SubSingleBenchmarkResult that has a failure for (Iterator it = successResultList.iterator(); it.hasNext(); ) { SubSingleBenchmarkResult subSingleBenchmarkResult = it.next(); - if (subSingleBenchmarkResult.isFailure()) { + if (subSingleBenchmarkResult.hasAnyFailure()) { failureCount++; it.remove(); } else { @@ -380,10 +375,10 @@ private void determineTotalsAndAveragesAndRanking() { infeasibleScoreCount++; } if (firstNonFailure) { - totalScore = subSingleBenchmarkResult.getScore(); + totalScore = subSingleBenchmarkResult.getAverageScore(); firstNonFailure = false; } else { - totalScore = totalScore.add(subSingleBenchmarkResult.getScore()); + totalScore = totalScore.add(subSingleBenchmarkResult.getAverageScore()); } } } diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SolverBenchmarkResult.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SolverBenchmarkResult.java index 13fb03e1ec..48a563c59f 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SolverBenchmarkResult.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SolverBenchmarkResult.java @@ -298,7 +298,7 @@ protected void determineTotalsAndAverages() { totalUninitializedVariableCount = 0; infeasibleScoreCount = 0; for (SingleBenchmarkResult singleBenchmarkResult : singleBenchmarkResultList) { - if (singleBenchmarkResult.isFailure()) { + if (singleBenchmarkResult.hasAnyFailure()) { failureCount++; } else { if (!singleBenchmarkResult.isInitialized()) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SubSingleBenchmarkResult.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SubSingleBenchmarkResult.java index cd4b4a0ab9..c509e216d1 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SubSingleBenchmarkResult.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/result/SubSingleBenchmarkResult.java @@ -148,8 +148,6 @@ public Integer getUninitializedVariableCount() { public void setUninitializedVariableCount(Integer uninitializedVariableCount) { this.uninitializedVariableCount = uninitializedVariableCount; } - - @Override public Score getScore() { return score; } @@ -210,7 +208,7 @@ public String getName() { } @Override - public boolean isSuccess() { + public boolean hasAnySuccess() { return succeeded != null && succeeded.booleanValue(); } @@ -219,7 +217,7 @@ public boolean isInitialized() { } @Override - public boolean isFailure() { + public boolean hasAnyFailure() { return succeeded != null && !succeeded.booleanValue(); } @@ -253,29 +251,29 @@ public String getScoreWithUninitializedPrefix() { } @Override - public SolverBenchmarkResult getSolverBenchmarkResult() { - return singleBenchmarkResult.getSolverBenchmarkResult(); + public Integer getAverageUninitializedVariableCount() { + return getUninitializedVariableCount(); } @Override - public ProblemBenchmarkResult getProblemBenchmarkResult() { - return singleBenchmarkResult.getProblemBenchmarkResult(); + public Score getAverageScore() { + return getScore(); } // ************************************************************************ // Accumulate methods // ************************************************************************ - public String getReportDirectoryPath() { + public String getResultDirectoryPath() { return "sub" + subSingleBenchmarkIndex; } - public File getReportDirectory() { - return new File(singleBenchmarkResult.getReportDirectory(), getReportDirectoryPath()); + public File getResultDirectory() { + return new File(singleBenchmarkResult.getResultDirectory(), getResultDirectoryPath()); } public void makeDirs() { - File subSingleReportDirectory = getReportDirectory(); + File subSingleReportDirectory = getResultDirectory(); subSingleReportDirectory.mkdirs(); } @@ -299,7 +297,7 @@ protected static SubSingleBenchmarkResult createMerge(SingleBenchmarkResult sing for (SubSingleStatistic subSingleStatistic : newResult.effectiveSubSingleStatisticMap.values()) { SubSingleStatistic oldSubSingleStatistic = oldResult.getSubSingleStatistic(subSingleStatistic.getStatisticType()); if (!oldSubSingleStatistic.getCsvFile().exists()) { - if (oldResult.isFailure()) { + if (oldResult.hasAnyFailure()) { subSingleStatistic.initPointList(); logger.debug("Old result ({}) is a failure, skipping merge of it's sub single statistic ({}).", oldResult, oldSubSingleStatistic); diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/PureSubSingleStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/PureSubSingleStatistic.java index 585f96fe61..7abef06ce2 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/PureSubSingleStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/PureSubSingleStatistic.java @@ -60,7 +60,7 @@ public SubSingleStatisticType getStatisticType() { public abstract void writeGraphFiles(BenchmarkReport benchmarkReport); protected File writeChartToImageFile(JFreeChart chart, String fileNameBase) { - File chartFile = new File(benchmarkResult.getReportDirectory(), fileNameBase + ".png"); + File chartFile = new File(benchmarkResult.getResultDirectory(), fileNameBase + ".png"); GraphSupport.writeChartToImageFile(chart, chartFile); return chartFile; } diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/StatisticUtils.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/StatisticUtils.java index 0dfab840eb..2670bac5d3 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/StatisticUtils.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/StatisticUtils.java @@ -40,8 +40,8 @@ public static double[] determineStandardDeviationDoubles( // averageScore can no longer be null double[] differenceSquaredTotalDoubles = null; for (BenchmarkResult benchmarkResult : solverProblemBenchmarkResultList) { - if (benchmarkResult.isSuccess()) { - Score difference = benchmarkResult.getScore().subtract(averageScore); + if (benchmarkResult.hasAnySuccess()) { + Score difference = benchmarkResult.getAverageScore().subtract(averageScore); // Calculations done on doubles to avoid common overflow when executing with an int score > 500 000 double[] differenceDoubles = ScoreUtils.extractLevelDoubles(difference); if (differenceSquaredTotalDoubles == null) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/SubSingleStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/SubSingleStatistic.java index 5a531630cc..9c9ff4918a 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/SubSingleStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/SubSingleStatistic.java @@ -85,7 +85,7 @@ public void setPointList(List

pointList) { public String getRelativeCsvFilePath() { return new StringBuilder().append(benchmarkResult.getProblemBenchmarkResult().getProblemReportDirectoryPath()) .append(File.separator) - .append(benchmarkResult.getReportDirectoryPath()) + .append(benchmarkResult.getResultDirectoryPath()) .append(File.separator) .append(getCsvFilePath()) .toString(); @@ -96,7 +96,7 @@ public String getCsvFilePath() { } public File getCsvFile() { - return new File(benchmarkResult.getReportDirectory(), getCsvFilePath()); + return new File(benchmarkResult.getResultDirectory(), getCsvFilePath()); } // ************************************************************************ @@ -126,7 +126,7 @@ private void writeCsvStatisticFile() { for (StatisticPoint point : getPointList()) { writer.append(point.toCsvLine()).append("\n"); } - if (benchmarkResult.isFailure()) { + if (benchmarkResult.hasAnyFailure()) { writer.append("Failed\n"); } } catch (IOException e) { @@ -144,7 +144,7 @@ private void readCsvStatisticFile() { throw new IllegalStateException("The pointList with size (" + pointList.size() + ") should be empty."); } if (!csvFile.exists()) { - if (benchmarkResult.isFailure()) { + if (benchmarkResult.hasAnyFailure()) { pointList = Collections.emptyList(); return; } else { @@ -163,7 +163,7 @@ private void readCsvStatisticFile() { Map stringDuplicationRemovalMap = new HashMap(1024); for (line = reader.readLine(); line != null && !line.isEmpty(); line = reader.readLine()) { if (line.equals("Failed")) { - if (benchmarkResult.isFailure()) { + if (benchmarkResult.hasAnyFailure()) { continue; } throw new IllegalStateException("SubSingleStatistic ( " + this + " ) failed even though the " diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestscore/BestScoreProblemStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestscore/BestScoreProblemStatistic.java index 9019571a32..bfcdf2b15c 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestscore/BestScoreProblemStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestscore/BestScoreProblemStatistic.java @@ -77,7 +77,7 @@ public void writeGraphFiles(BenchmarkReport benchmarkReport) { List seriesList = new ArrayList(BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE); // No direct ascending lines between 2 points, but a stepping line instead XYItemRenderer renderer = new XYStepRenderer(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { BestScoreSubSingleStatistic subSingleStatistic = (BestScoreSubSingleStatistic) singleBenchmarkResult.getSubSingleStatistic(problemStatisticType); for (BestScoreStatisticPoint point : subSingleStatistic.getPointList()) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestsolutionmutation/BestSolutionMutationProblemStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestsolutionmutation/BestSolutionMutationProblemStatistic.java index 9fe6cf3cc5..be0179e4bb 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestsolutionmutation/BestSolutionMutationProblemStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestsolutionmutation/BestSolutionMutationProblemStatistic.java @@ -74,7 +74,7 @@ public void writeGraphFiles(BenchmarkReport benchmarkReport) { for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { XYIntervalSeries series = new XYIntervalSeries(singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix()); XYItemRenderer renderer = new YIntervalRenderer(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { BestSolutionMutationSubSingleStatistic subSingleStatistic = (BestSolutionMutationSubSingleStatistic) singleBenchmarkResult.getSubSingleStatistic(problemStatisticType); for (BestSolutionMutationStatisticPoint point : subSingleStatistic.getPointList()) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/calculatecount/CalculateCountProblemStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/calculatecount/CalculateCountProblemStatistic.java index a200c5b49f..d79b12a1d5 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/calculatecount/CalculateCountProblemStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/calculatecount/CalculateCountProblemStatistic.java @@ -81,7 +81,7 @@ public void writeGraphFiles(BenchmarkReport benchmarkReport) { for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { XYSeries series = new XYSeries(singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix()); XYItemRenderer renderer = new XYLineAndShapeRenderer(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { CalculateCountSubSingleStatistic subSingleStatistic = (CalculateCountSubSingleStatistic) singleBenchmarkResult.getSubSingleStatistic(problemStatisticType); for (CalculateCountStatisticPoint point : subSingleStatistic.getPointList()) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/memoryuse/MemoryUseProblemStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/memoryuse/MemoryUseProblemStatistic.java index e195b5583f..e018596a15 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/memoryuse/MemoryUseProblemStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/memoryuse/MemoryUseProblemStatistic.java @@ -84,7 +84,7 @@ public void writeGraphFiles(BenchmarkReport benchmarkReport) { // XYSeries maxSeries = new XYSeries( // singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix() + " max"); XYItemRenderer renderer = new XYLineAndShapeRenderer(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { MemoryUseSubSingleStatistic subSingleStatistic = (MemoryUseSubSingleStatistic) singleBenchmarkResult.getSubSingleStatistic(problemStatisticType); for (MemoryUseStatisticPoint point : subSingleStatistic.getPointList()) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/movecountperstep/MoveCountPerStepProblemStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/movecountperstep/MoveCountPerStepProblemStatistic.java index e720f30e00..193ec1d77b 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/movecountperstep/MoveCountPerStepProblemStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/movecountperstep/MoveCountPerStepProblemStatistic.java @@ -88,7 +88,7 @@ public void writeGraphFiles(BenchmarkReport benchmarkReport) { XYSeries selectedSeries = new XYSeries( singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix() + " selected"); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { MoveCountPerStepSubSingleStatistic subSingleStatistic = (MoveCountPerStepSubSingleStatistic) singleBenchmarkResult.getSubSingleStatistic(problemStatisticType); for (MoveCountPerStepStatisticPoint point : subSingleStatistic.getPointList()) { diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/stepscore/StepScoreProblemStatistic.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/stepscore/StepScoreProblemStatistic.java index c83df153ad..c4db7997c9 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/stepscore/StepScoreProblemStatistic.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/stepscore/StepScoreProblemStatistic.java @@ -77,7 +77,7 @@ public void writeGraphFiles(BenchmarkReport benchmarkReport) { List seriesList = new ArrayList(BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE); // No direct ascending lines between 2 points, but a stepping line instead XYItemRenderer renderer = new XYStepRenderer(); - if (singleBenchmarkResult.isSuccess()) { + if (singleBenchmarkResult.hasAnySuccess()) { StepScoreSubSingleStatistic subSingleStatistic = (StepScoreSubSingleStatistic) singleBenchmarkResult.getSubSingleStatistic(problemStatisticType); for (StepScoreStatisticPoint point : subSingleStatistic.getPointList()) { diff --git a/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/report/benchmarkReport.html.ftl b/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/report/benchmarkReport.html.ftl index c5ea93cca5..c22e73e768 100644 --- a/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/report/benchmarkReport.html.ftl +++ b/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/report/benchmarkReport.html.ftl @@ -182,7 +182,7 @@ <#else> <#assign singleBenchmarkResult = solverBenchmarkResult.findSingleBenchmark(problemBenchmarkResult)> - <#if !singleBenchmarkResult.success> + <#if !singleBenchmarkResult.hasAnySuccess> Failed <#else> <#if solverBenchmarkResult.subSingleCount lte 1> @@ -252,7 +252,7 @@ <#else> <#assign singleBenchmarkResult = solverBenchmarkResult.findSingleBenchmark(problemBenchmarkResult)> - <#if !singleBenchmarkResult.success> + <#if !singleBenchmarkResult.hasAnySuccess> Failed <#else> ${singleBenchmarkResult.winningScoreDifference} <@addSolverProblemBenchmarkResultBadges solverProblemBenchmarkResult=singleBenchmarkResult/> @@ -291,7 +291,7 @@ <#else> <#assign singleBenchmarkResult = solverBenchmarkResult.findSingleBenchmark(problemBenchmarkResult)> - <#if !singleBenchmarkResult.success> + <#if !singleBenchmarkResult.hasAnySuccess> Failed <#else> ${singleBenchmarkResult.worstScoreDifferencePercentage.toString(.locale)} <@addSolverProblemBenchmarkResultBadges solverProblemBenchmarkResult=singleBenchmarkResult/> @@ -376,7 +376,7 @@ <#else> <#assign singleBenchmarkResult = solverBenchmarkResult.findSingleBenchmark(problemBenchmarkResult)> - <#if !singleBenchmarkResult.success> + <#if !singleBenchmarkResult.hasAnySuccess> Failed <#else> <#if solverBenchmarkResult.subSingleCount lte 1> @@ -437,7 +437,7 @@ <#else> <#assign singleBenchmarkResult = solverBenchmarkResult.findSingleBenchmark(problemBenchmarkResult)> - <#if !singleBenchmarkResult.success> + <#if !singleBenchmarkResult.hasAnySuccess> Failed <#else> <#if solverBenchmarkResult.subSingleCount lte 1>