protected static SingleBenchmarkResult createMerge( SolverBenchmarkResult solverBenchmarkResult, ProblemBenchmarkResult problemBenchmarkResult, SingleBenchmarkResult oldResult) { SingleBenchmarkResult newResult = new SingleBenchmarkResult(solverBenchmarkResult, problemBenchmarkResult); newResult.pureSingleStatisticList = new ArrayList<PureSingleStatistic>(oldResult.pureSingleStatisticList.size()); for (PureSingleStatistic oldSingleStatistic : oldResult.pureSingleStatisticList) { newResult.pureSingleStatisticList.add( oldSingleStatistic.getStatisticType().buildPureSingleStatistic(newResult)); } newResult.initSingleStatisticMap(); for (SingleStatistic singleStatistic : newResult.effectiveSingleStatisticMap.values()) { singleStatistic.setPointList( oldResult.getSingleStatistic(singleStatistic.getStatisticType()).getPointList()); } // Skip oldResult.reportDirectory // Skip oldResult.usedMemoryAfterInputSolution newResult.succeeded = oldResult.succeeded; newResult.score = oldResult.score; newResult.timeMillisSpent = oldResult.timeMillisSpent; newResult.calculateCount = oldResult.calculateCount; solverBenchmarkResult.getSingleBenchmarkResultList().add(newResult); problemBenchmarkResult.getSingleBenchmarkResultList().add(newResult); return newResult; }
@Override public void writeGraphFiles(BenchmarkReport benchmarkReport) { List<XYPlot> plotList = new ArrayList<XYPlot>(BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE); int seriesIndex = 0; for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { List<XYSeries> seriesList = new ArrayList<XYSeries>(BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE); // No direct ascending lines between 2 points, but a stepping line instead XYItemRenderer renderer = new XYStepRenderer(); if (singleBenchmarkResult.isSuccess()) { BestScoreSingleStatistic singleStatistic = (BestScoreSingleStatistic) singleBenchmarkResult.getSingleStatistic(problemStatisticType); for (BestScoreStatisticPoint point : singleStatistic.getPointList()) { long timeMillisSpent = point.getTimeMillisSpent(); double[] levelValues = ScoreUtils.extractLevelDoubles(point.getScore()); for (int i = 0; i < levelValues.length && i < BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE; i++) { if (i >= seriesList.size()) { seriesList.add( new XYSeries( singleBenchmarkResult .getSolverBenchmarkResult() .getNameWithFavoriteSuffix())); } seriesList.get(i).add(timeMillisSpent, levelValues[i]); } } // TODO if startingSolution is initialized and no improvement is made, a horizontal line // should be shown // Draw a horizontal line from the last new best step to how long the solver actually ran long timeMillisSpent = singleBenchmarkResult.getTimeMillisSpent(); double[] bestScoreLevels = ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getScore()); for (int i = 0; i < bestScoreLevels.length && i < BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE; i++) { if (i >= seriesList.size()) { seriesList.add( new XYSeries( singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix())); } seriesList.get(i).add(timeMillisSpent, bestScoreLevels[i]); } if (singleStatistic.getPointList().size() <= 1) { // Workaround for // https://sourceforge.net/tracker/?func=detail&aid=3387330&group_id=15494&atid=115494 renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); } } if (singleBenchmarkResult.getSolverBenchmarkResult().isFavorite()) { // Make the favorite more obvious renderer.setSeriesStroke(0, new BasicStroke(2.0f)); } for (int i = 0; i < seriesList.size(); i++) { if (i >= plotList.size()) { plotList.add(createPlot(benchmarkReport, i)); } plotList.get(i).setDataset(seriesIndex, new XYSeriesCollection(seriesList.get(i))); plotList.get(i).setRenderer(seriesIndex, renderer); } seriesIndex++; } graphFileList = new ArrayList<File>(plotList.size()); for (int scoreLevelIndex = 0; scoreLevelIndex < plotList.size(); scoreLevelIndex++) { JFreeChart chart = new JFreeChart( problemBenchmarkResult.getName() + " best score level " + scoreLevelIndex + " statistic", JFreeChart.DEFAULT_TITLE_FONT, plotList.get(scoreLevelIndex), true); graphFileList.add( writeChartToImageFile( chart, problemBenchmarkResult.getName() + "BestScoreStatisticLevel" + scoreLevelIndex)); } }