>From ae3d62525e1ebe734b075850b10e537f3c0d9360 Mon Sep 17 00:00:00 2001 From: carrot-osc <359468@mail.muni.cz> Date: Mon, 6 May 2013 00:20:43 +0200 Subject: [PATCH 1/6] average solver score added to DefaultPlannerBenchmark --- .../benchmark/impl/DefaultPlannerBenchmark.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java index 1fa8fa2..770094a 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java @@ -39,6 +39,7 @@ import org.optaplanner.benchmark.api.PlannerBenchmark; import org.optaplanner.benchmark.api.ranking.SolverBenchmarkRankingWeightFactory; import org.optaplanner.benchmark.impl.history.BenchmarkHistoryReport; import org.optaplanner.benchmark.impl.report.BenchmarkReport; +import org.optaplanner.core.api.score.Score; import org.optaplanner.core.api.solver.Solver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,6 +76,7 @@ public class DefaultPlannerBenchmark implements PlannerBenchmark { private Long averageProblemScale = null; private SolverBenchmark favoriteSolverBenchmark; private long benchmarkTimeMillisSpend; + private Score averageSolverScore; public String getName() { return name; @@ -175,6 +177,14 @@ public class DefaultPlannerBenchmark implements PlannerBenchmark { public long getBenchmarkTimeMillisSpend() { return benchmarkTimeMillisSpend; } + + public Score getAverageSolverScore() { + return averageSolverScore; + } + + public void setAverageSolverScore(Score averageSolverScore) { + this.averageSolverScore = averageSolverScore; + } // ************************************************************************ // Benchmark methods @@ -310,6 +320,7 @@ public class DefaultPlannerBenchmark implements PlannerBenchmark { } determineTotalsAndAverages(); determineSolverBenchmarkRanking(); + determineAverageSolverScore(); benchmarkTimeMillisSpend = calculateTimeMillisSpend(); benchmarkReport.writeReport(); if (benchmarkHistoryReportEnabled) { @@ -330,6 +341,14 @@ public class DefaultPlannerBenchmark implements PlannerBenchmark { } } + private void determineAverageSolverScore() { + Score result = null; + for (SolverBenchmark sb : solverBenchmarkList) { + result = (result == null) ? sb.getAverageScore() : result.add(sb.getAverageScore()); + } + averageSolverScore = result.divide(solverBenchmarkList.size()); + } + private void determineTotalsAndAverages() { long totalProblemScale = 0L; int problemScaleCount = 0; -- 1.7.9.5 >From edcf279dab5ab44fccc6c6ab66ca9338515b7d3a Mon Sep 17 00:00:00 2001 From: carrot-osc <359468@mail.muni.cz> Date: Mon, 6 May 2013 01:10:58 +0200 Subject: [PATCH 2/6] BestScorePerTimeChart (scatter plot) added to BenchmarkReport --- .../benchmark/impl/report/BenchmarkReport.java | 124 ++++++++++++++++++-- 1 file changed, 114 insertions(+), 10 deletions(-) diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java index 5aa301b..d9651ec 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java @@ -17,6 +17,7 @@ package org.optaplanner.benchmark.impl.report; import java.awt.BasicStroke; +import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; @@ -30,35 +31,45 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; + import javax.imageio.ImageIO; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; import org.apache.commons.io.IOUtils; -import org.optaplanner.benchmark.impl.DefaultPlannerBenchmark; -import org.optaplanner.benchmark.impl.ProblemBenchmark; -import org.optaplanner.benchmark.impl.SingleBenchmark; -import org.optaplanner.benchmark.impl.SolverBenchmark; -import org.optaplanner.benchmark.impl.statistic.MillisecondsSpendNumberFormat; -import org.optaplanner.benchmark.impl.statistic.ProblemStatistic; -import org.optaplanner.core.api.solver.SolverFactory; import org.jfree.chart.JFreeChart; +import org.jfree.chart.LegendItem; +import org.jfree.chart.LegendItemCollection; +import org.jfree.chart.LegendItemSource; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.labels.ItemLabelAnchor; import org.jfree.chart.labels.ItemLabelPosition; import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; +import org.jfree.chart.labels.XYItemLabelGenerator; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.chart.renderer.xy.StandardXYItemRenderer; import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.title.LegendTitle; import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.data.general.DatasetUtilities; +import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import org.jfree.ui.TextAnchor; +import org.optaplanner.benchmark.impl.DefaultPlannerBenchmark; +import org.optaplanner.benchmark.impl.ProblemBenchmark; +import org.optaplanner.benchmark.impl.SingleBenchmark; +import org.optaplanner.benchmark.impl.SolverBenchmark; +import org.optaplanner.benchmark.impl.statistic.MillisecondsSpendNumberFormat; +import org.optaplanner.benchmark.impl.statistic.ProblemStatistic; +import org.optaplanner.core.api.solver.SolverFactory; + +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; public class BenchmarkReport { @@ -70,6 +81,7 @@ public class BenchmarkReport { protected File htmlOverviewFile = null; protected File summaryDirectory = null; protected List bestScoreSummaryChartFileList = null; + protected List bestScorePerTimeChartFileList = null; protected List bestScoreScalabilitySummaryChartFileList = null; protected List winningScoreDifferenceSummaryChartFileList = null; protected List worstScoreDifferencePercentageSummaryChartFileList = null; @@ -107,6 +119,10 @@ public class BenchmarkReport { public List getBestScoreSummaryChartFileList() { return bestScoreSummaryChartFileList; } + + public List getBestScorePerTimeChartFileList() { + return bestScorePerTimeChartFileList; + } public List getBestScoreScalabilitySummaryChartFileList() { return bestScoreScalabilitySummaryChartFileList; @@ -178,6 +194,7 @@ public class BenchmarkReport { summaryDirectory.mkdir(); fillWarningList(); writeBestScoreSummaryCharts(); + writeBestScorePerTimeSummaryChart(); writeBestScoreScalabilitySummaryChart(); writeWinningScoreDifferenceSummaryChart(); writeWorstScoreDifferencePercentageSummaryChart(); @@ -238,6 +255,93 @@ public class BenchmarkReport { scoreLevelIndex++; } } + + private void writeBestScorePerTimeSummaryChart() { + // Each scoreLevel has it's own dataset and chartFile + List datasetList = new ArrayList(CHARTED_SCORE_LEVEL_SIZE); + for (SolverBenchmark solverBenchmark : plannerBenchmark.getSolverBenchmarkList()) { + String solverLabel = solverBenchmark.getNameWithFavoriteSuffix(); + for (SingleBenchmark singleBenchmark : solverBenchmark.getSingleBenchmarkList()) { + String planningProblemLabel = singleBenchmark.getProblemBenchmark().getName(); + if (singleBenchmark.isSuccess()) { + double[] levelValues = singleBenchmark.getScore().toDoubleLevels(); + for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { + if (i >= datasetList.size()) { + datasetList.add(new XYSeriesCollection()); + } + double relativeScore = (levelValues[i] == 0d) ? 0 : levelValues[i] / Math.abs(plannerBenchmark.getAverageSolverScore().toDoubleLevels()[i]); + if (datasetList.get(i).getSeriesIndex(solverLabel) == -1) { + XYSeries series = new XYSeries(solverLabel, false); + series.add(singleBenchmark.getTimeMillisSpend(), relativeScore); + datasetList.get(i).addSeries(series); + } else { + datasetList.get(i).getSeries(solverLabel).add(singleBenchmark.getTimeMillisSpend(), relativeScore); + } + } + } + } + } + bestScorePerTimeChartFileList = new ArrayList(datasetList.size()); + int scoreLevelIndex = 0; + for (XYSeriesCollection dataset : datasetList) { + XYPlot plot = createBestScorePerTimePlot(dataset, "Time spent", "Best score (relative to average)", NumberFormat.getInstance(locale)); + JFreeChart chart = new JFreeChart("Best score per time level " + scoreLevelIndex + " (lower is better)", plot); + addBestScorePerTimeLegend(chart); + bestScorePerTimeChartFileList.add(writeChartToImageFile(chart, "bestScorePerTimeLevel" + scoreLevelIndex)); + scoreLevelIndex++; + } + } + + private void addBestScorePerTimeLegend(JFreeChart chart) { + LegendTitle legend = new LegendTitle(new LegendItemSource() { + @Override + public LegendItemCollection getLegendItems() { + LegendItemCollection coll = new LegendItemCollection(); + int i = 1; + for (ProblemBenchmark pb : plannerBenchmark.getUnifiedProblemBenchmarkList()) { + coll.add(new LegendItem("(" + i++ +") " + pb.getName())); + + } + return coll; + } + }); + legend.setBorder(1, 1, 1, 1); + legend.setBackgroundPaint(Color.WHITE); + chart.addLegend(legend); + } + + private XYPlot createBestScorePerTimePlot(XYSeriesCollection dataset, String xAxisLabel, + String yAxisLabel, NumberFormat numberFormat) { + NumberAxis xAxis = new NumberAxis(xAxisLabel); + xAxis.setNumberFormatOverride(numberFormat); + NumberAxis yAxis = new NumberAxis(yAxisLabel); + yAxis.setNumberFormatOverride(numberFormat); + double minimum = DatasetUtilities.findMinimumRangeValue(dataset).doubleValue(); + if (minimum != 0d) { + yAxis.setUpperBound(0.02); + yAxis.setLowerBound(minimum - 0.2); + } + XYPlot plot = new XYPlot(dataset, xAxis, yAxis, createBestScorePerTimeRenderer()); + plot.setOrientation(PlotOrientation.VERTICAL); + return plot; + } + + private XYItemRenderer createBestScorePerTimeRenderer() { + XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); + renderer.setAutoPopulateSeriesShape(false); + renderer.setBaseSeriesVisible(true); + renderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() { + @Override + public String generateLabel(XYDataset xyd, int i, int i1) { + return String.valueOf(i1 + 1); + } + }); + renderer.setBaseItemLabelsVisible(true); + ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER); + renderer.setBaseNegativeItemLabelPosition(position); + renderer.setBasePositiveItemLabelPosition(position); + return renderer; + } private void writeBestScoreScalabilitySummaryChart() { // Each scoreLevel has it's own dataset and chartFile -- 1.7.9.5 >From ec6e0827181c8794ff47a67c31b5c76538b3f247 Mon Sep 17 00:00:00 2001 From: carrot-osc <359468@mail.muni.cz> Date: Mon, 6 May 2013 01:12:55 +0200 Subject: [PATCH 3/6] support for best score per time scatter plot in html report --- .../impl/history/benchmarkHistory.html.ftl | 12 ++++++- .../benchmark/impl/report/benchmarkReport.html.ftl | 33 +++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/history/benchmarkHistory.html.ftl b/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/history/benchmarkHistory.html.ftl index c72064a..432360f 100644 --- a/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/history/benchmarkHistory.html.ftl +++ b/optaplanner-benchmark/src/main/resources/org/optaplanner/benchmark/impl/history/benchmarkHistory.html.ftl @@ -51,6 +51,9 @@ Best score
  • + Best score per time +
  • +
  • Best score scalability
  • @@ -94,6 +97,10 @@ <#----> <#----> +
    +

    Best score per time summary

    +

    TODO

    <#-- TODO --> +

    Best score scalability summary

    TODO

    <#-- TODO --> @@ -113,6 +120,9 @@ Best score
  • + Best score per time +
  • +
  • Best score scalability
  • @@ -231,4 +241,4 @@ - + \ No newline at end of file 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 7b35778..d5b0a67 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 @@ -97,6 +97,9 @@ Best score
  • + Best score per time +
  • +
  • Best score scalability
  • @@ -161,6 +164,31 @@ +
    +

    Best score per time

    +
    + +
    + <#assign scoreLevelIndex = 0> + <#list benchmarkReport.bestScorePerTimeChartFileList as bestScorePerTimeChartFile> +
    +
    + +
    +
    + <#assign scoreLevelIndex = scoreLevelIndex + 1> + +
    +
    +

    Best score scalability summary

    @@ -301,6 +329,9 @@ Best score
  • + Best score per time +
  • +
  • Best score scalability
  • @@ -618,4 +649,4 @@ - + \ No newline at end of file -- 1.7.9.5 >From a4b085bd4ed9e6839ce8b20724de970ac1ce69dc Mon Sep 17 00:00:00 2001 From: carrot-osc <359468@mail.muni.cz> Date: Tue, 7 May 2013 01:39:29 +0200 Subject: [PATCH 4/6] modified score calculation in report --- .../benchmark/impl/report/BenchmarkReport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java index d9651ec..be44e65 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java @@ -269,7 +269,7 @@ public class BenchmarkReport { if (i >= datasetList.size()) { datasetList.add(new XYSeriesCollection()); } - double relativeScore = (levelValues[i] == 0d) ? 0 : levelValues[i] / Math.abs(plannerBenchmark.getAverageSolverScore().toDoubleLevels()[i]); + double relativeScore = (levelValues[i] == 0d) ? 0 : -(levelValues[i] / plannerBenchmark.getAverageSolverScore().toDoubleLevels()[i]); if (datasetList.get(i).getSeriesIndex(solverLabel) == -1) { XYSeries series = new XYSeries(solverLabel, false); series.add(singleBenchmark.getTimeMillisSpend(), relativeScore); @@ -342,7 +342,7 @@ public class BenchmarkReport { renderer.setBasePositiveItemLabelPosition(position); return renderer; } - + private void writeBestScoreScalabilitySummaryChart() { // Each scoreLevel has it's own dataset and chartFile List> seriesListList = new ArrayList>( -- 1.7.9.5 >From 77a220b71ad16f03ef14fc08dbca38f187b298a5 Mon Sep 17 00:00:00 2001 From: carrot-osc <359468@mail.muni.cz> Date: Tue, 7 May 2013 01:50:32 +0200 Subject: [PATCH 5/6] removed unused variable in BenchmarkReport --- .../benchmark/impl/report/BenchmarkReport.java | 1 - 1 file changed, 1 deletion(-) diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java index be44e65..85d40b9 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java @@ -262,7 +262,6 @@ public class BenchmarkReport { for (SolverBenchmark solverBenchmark : plannerBenchmark.getSolverBenchmarkList()) { String solverLabel = solverBenchmark.getNameWithFavoriteSuffix(); for (SingleBenchmark singleBenchmark : solverBenchmark.getSingleBenchmarkList()) { - String planningProblemLabel = singleBenchmark.getProblemBenchmark().getName(); if (singleBenchmark.isSuccess()) { double[] levelValues = singleBenchmark.getScore().toDoubleLevels(); for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { -- 1.7.9.5 >From 3b7b61e522d7ee855ac3f6d351f8fec1854d886b Mon Sep 17 00:00:00 2001 From: carrot-osc <359468@mail.muni.cz> Date: Fri, 14 Jun 2013 23:24:55 +0200 Subject: [PATCH 6/6] Reverted changes, modified formatting --- .../benchmark/impl/DefaultPlannerBenchmark.java | 24 ++-- .../benchmark/impl/report/BenchmarkReport.java | 122 ++++++++++---------- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java index 770094a..b7d4e6b 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/DefaultPlannerBenchmark.java @@ -177,14 +177,14 @@ public class DefaultPlannerBenchmark implements PlannerBenchmark { public long getBenchmarkTimeMillisSpend() { return benchmarkTimeMillisSpend; } - + public Score getAverageSolverScore() { - return averageSolverScore; - } + return averageSolverScore; + } - public void setAverageSolverScore(Score averageSolverScore) { - this.averageSolverScore = averageSolverScore; - } + public void setAverageSolverScore(Score averageSolverScore) { + this.averageSolverScore = averageSolverScore; + } // ************************************************************************ // Benchmark methods @@ -342,13 +342,13 @@ public class DefaultPlannerBenchmark implements PlannerBenchmark { } private void determineAverageSolverScore() { - Score result = null; - for (SolverBenchmark sb : solverBenchmarkList) { - result = (result == null) ? sb.getAverageScore() : result.add(sb.getAverageScore()); - } - averageSolverScore = result.divide(solverBenchmarkList.size()); + Score result = null; + for (SolverBenchmark sb : solverBenchmarkList) { + result = (result == null) ? sb.getAverageScore() : result.add(sb.getAverageScore()); + } + averageSolverScore = result.divide(solverBenchmarkList.size()); } - + private void determineTotalsAndAverages() { long totalProblemScale = 0L; int problemScaleCount = 0; diff --git a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java index 85d40b9..653c599 100644 --- a/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java +++ b/optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/report/BenchmarkReport.java @@ -119,10 +119,10 @@ public class BenchmarkReport { public List getBestScoreSummaryChartFileList() { return bestScoreSummaryChartFileList; } - + public List getBestScorePerTimeChartFileList() { - return bestScorePerTimeChartFileList; - } + return bestScorePerTimeChartFileList; + } public List getBestScoreScalabilitySummaryChartFileList() { return bestScoreScalabilitySummaryChartFileList; @@ -255,9 +255,9 @@ public class BenchmarkReport { scoreLevelIndex++; } } - + private void writeBestScorePerTimeSummaryChart() { - // Each scoreLevel has it's own dataset and chartFile + // Each scoreLevel has it's own dataset and chartFile List datasetList = new ArrayList(CHARTED_SCORE_LEVEL_SIZE); for (SolverBenchmark solverBenchmark : plannerBenchmark.getSolverBenchmarkList()) { String solverLabel = solverBenchmark.getNameWithFavoriteSuffix(); @@ -267,12 +267,13 @@ public class BenchmarkReport { for (int i = 0; i < levelValues.length && i < CHARTED_SCORE_LEVEL_SIZE; i++) { if (i >= datasetList.size()) { datasetList.add(new XYSeriesCollection()); - } - double relativeScore = (levelValues[i] == 0d) ? 0 : -(levelValues[i] / plannerBenchmark.getAverageSolverScore().toDoubleLevels()[i]); + } + double relativeScore = (levelValues[i] == 0d) ? 0 : + -(levelValues[i] / plannerBenchmark.getAverageSolverScore().toDoubleLevels()[i]); if (datasetList.get(i).getSeriesIndex(solverLabel) == -1) { - XYSeries series = new XYSeries(solverLabel, false); - series.add(singleBenchmark.getTimeMillisSpend(), relativeScore); - datasetList.get(i).addSeries(series); + XYSeries series = new XYSeries(solverLabel, false); + series.add(singleBenchmark.getTimeMillisSpend(), relativeScore); + datasetList.get(i).addSeries(series); } else { datasetList.get(i).getSeries(solverLabel).add(singleBenchmark.getTimeMillisSpend(), relativeScore); } @@ -283,65 +284,64 @@ public class BenchmarkReport { bestScorePerTimeChartFileList = new ArrayList(datasetList.size()); int scoreLevelIndex = 0; for (XYSeriesCollection dataset : datasetList) { - XYPlot plot = createBestScorePerTimePlot(dataset, "Time spent", "Best score (relative to average)", NumberFormat.getInstance(locale)); + XYPlot plot = createBestScorePerTimePlot(dataset, "Time spent", "Best score (relative to average)", NumberFormat.getInstance(locale)); JFreeChart chart = new JFreeChart("Best score per time level " + scoreLevelIndex + " (lower is better)", plot); - addBestScorePerTimeLegend(chart); + addBestScorePerTimeLegend(chart); bestScorePerTimeChartFileList.add(writeChartToImageFile(chart, "bestScorePerTimeLevel" + scoreLevelIndex)); scoreLevelIndex++; } } - private void addBestScorePerTimeLegend(JFreeChart chart) { - LegendTitle legend = new LegendTitle(new LegendItemSource() { - @Override - public LegendItemCollection getLegendItems() { - LegendItemCollection coll = new LegendItemCollection(); - int i = 1; - for (ProblemBenchmark pb : plannerBenchmark.getUnifiedProblemBenchmarkList()) { - coll.add(new LegendItem("(" + i++ +") " + pb.getName())); - - } - return coll; - } - }); - legend.setBorder(1, 1, 1, 1); - legend.setBackgroundPaint(Color.WHITE); - chart.addLegend(legend); - } - + private void addBestScorePerTimeLegend(JFreeChart chart) { + LegendTitle legend = new LegendTitle(new LegendItemSource() { + @Override + public LegendItemCollection getLegendItems() { + LegendItemCollection coll = new LegendItemCollection(); + int i = 1; + for (ProblemBenchmark pb : plannerBenchmark.getUnifiedProblemBenchmarkList()) { + coll.add(new LegendItem("(" + i++ +") " + pb.getName())); + } + return coll; + } + }); + legend.setBorder(1, 1, 1, 1); + legend.setBackgroundPaint(Color.WHITE); + chart.addLegend(legend); + } + private XYPlot createBestScorePerTimePlot(XYSeriesCollection dataset, String xAxisLabel, - String yAxisLabel, NumberFormat numberFormat) { - NumberAxis xAxis = new NumberAxis(xAxisLabel); - xAxis.setNumberFormatOverride(numberFormat); - NumberAxis yAxis = new NumberAxis(yAxisLabel); - yAxis.setNumberFormatOverride(numberFormat); - double minimum = DatasetUtilities.findMinimumRangeValue(dataset).doubleValue(); - if (minimum != 0d) { - yAxis.setUpperBound(0.02); - yAxis.setLowerBound(minimum - 0.2); - } - XYPlot plot = new XYPlot(dataset, xAxis, yAxis, createBestScorePerTimeRenderer()); - plot.setOrientation(PlotOrientation.VERTICAL); - return plot; - } - + String yAxisLabel, NumberFormat numberFormat) { + NumberAxis xAxis = new NumberAxis(xAxisLabel); + xAxis.setNumberFormatOverride(numberFormat); + NumberAxis yAxis = new NumberAxis(yAxisLabel); + yAxis.setNumberFormatOverride(numberFormat); + double minimum = DatasetUtilities.findMinimumRangeValue(dataset).doubleValue(); + if (minimum != 0d) { + yAxis.setUpperBound(0.02); + yAxis.setLowerBound(minimum - 0.2); + } + XYPlot plot = new XYPlot(dataset, xAxis, yAxis, createBestScorePerTimeRenderer()); + plot.setOrientation(PlotOrientation.VERTICAL); + return plot; + } + private XYItemRenderer createBestScorePerTimeRenderer() { - XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); - renderer.setAutoPopulateSeriesShape(false); - renderer.setBaseSeriesVisible(true); - renderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() { - @Override - public String generateLabel(XYDataset xyd, int i, int i1) { - return String.valueOf(i1 + 1); - } - }); - renderer.setBaseItemLabelsVisible(true); - ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER); - renderer.setBaseNegativeItemLabelPosition(position); - renderer.setBasePositiveItemLabelPosition(position); - return renderer; - } - + XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); + renderer.setAutoPopulateSeriesShape(false); + renderer.setBaseSeriesVisible(true); + renderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() { + @Override + public String generateLabel(XYDataset xyd, int i, int i1) { + return String.valueOf(i1 + 1); + } + }); + renderer.setBaseItemLabelsVisible(true); + ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER); + renderer.setBaseNegativeItemLabelPosition(position); + renderer.setBasePositiveItemLabelPosition(position); + return renderer; + } + private void writeBestScoreScalabilitySummaryChart() { // Each scoreLevel has it's own dataset and chartFile List> seriesListList = new ArrayList>( -- 1.7.9.5