private void determineDefaultShownScoreLevelIndex() {
   defaultShownScoreLevelIndex = Integer.MAX_VALUE;
   for (ProblemBenchmarkResult problemBenchmarkResult :
       plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
     if (problemBenchmarkResult.hasAnySuccess()) {
       double[] winningScoreLevels =
           ScoreUtils.extractLevelDoubles(
               problemBenchmarkResult.getWinningSingleBenchmarkResult().getAverageScore());
       int[] differenceCount = new int[winningScoreLevels.length];
       for (int i = 0; i < differenceCount.length; i++) {
         differenceCount[i] = 0;
       }
       for (SingleBenchmarkResult singleBenchmarkResult :
           problemBenchmarkResult.getSingleBenchmarkResultList()) {
         if (singleBenchmarkResult.hasAllSuccess()) {
           double[] scoreLevels =
               ScoreUtils.extractLevelDoubles(singleBenchmarkResult.getAverageScore());
           for (int i = 0; i < scoreLevels.length; i++) {
             if (scoreLevels[i] != winningScoreLevels[i]) {
               differenceCount[i] = differenceCount[i] + 1;
             }
           }
         }
       }
       int firstInterestingLevel = differenceCount.length - 1;
       for (int i = 0; i < differenceCount.length; i++) {
         if (differenceCount[i] > 0) {
           firstInterestingLevel = i;
           break;
         }
       }
       if (defaultShownScoreLevelIndex > firstInterestingLevel) {
         defaultShownScoreLevelIndex = firstInterestingLevel;
       }
     }
   }
 }
 public void writeReport() {
   logger.info("Generating benchmark report...");
   summaryDirectory = new File(plannerBenchmarkResult.getBenchmarkReportDirectory(), "summary");
   summaryDirectory.mkdir();
   plannerBenchmarkResult.accumulateResults(this);
   fillWarningList();
   writeBestScoreSummaryCharts();
   writeBestScoreScalabilitySummaryChart();
   writeWinningScoreDifferenceSummaryChart();
   writeWorstScoreDifferencePercentageSummaryChart();
   writeAverageCalculateCountPerSecondSummaryChart();
   writeTimeSpentSummaryChart();
   writeTimeSpentScalabilitySummaryChart();
   writeBestScorePerTimeSpentSummaryChart();
   writeSubSingleBenchmarkScoreCharts();
   for (ProblemBenchmarkResult problemBenchmarkResult :
       plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
     for (SingleBenchmarkResult singleBenchmarkResult :
         problemBenchmarkResult.getSingleBenchmarkResultList()) {
       for (SubSingleBenchmarkResult subSingleBenchmarkResult :
           singleBenchmarkResult.getSubSingleBenchmarkResultList()) {
         if (!subSingleBenchmarkResult.hasAllSuccess()) {
           continue;
         }
         for (SubSingleStatistic subSingleStatistic :
             subSingleBenchmarkResult.getEffectiveSubSingleStatisticMap().values()) {
           try {
             subSingleStatistic.unhibernatePointList();
           } catch (IllegalStateException e) {
             if (!plannerBenchmarkResult.getAggregation()) {
               throw new IllegalStateException(
                   "Failed to unhibernate point list of SubSingleStatistic ("
                       + subSingleStatistic
                       + ") of SubSingleBenchmark ("
                       + subSingleBenchmarkResult
                       + ").",
                   e);
             }
             logger.trace(
                 "This is expected, aggregator doesn't copy CSV files. Could not read CSV file "
                     + "({}) of sub single statistic ({}).",
                 subSingleStatistic.getCsvFile().getAbsolutePath(),
                 subSingleStatistic);
           }
         }
       }
     }
   }
   for (ProblemBenchmarkResult problemBenchmarkResult :
       plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
     if (problemBenchmarkResult.hasAnySuccess()) {
       for (ProblemStatistic problemStatistic : problemBenchmarkResult.getProblemStatisticList()) {
         problemStatistic.writeGraphFiles(this);
       }
       for (SingleBenchmarkResult singleBenchmarkResult :
           problemBenchmarkResult.getSingleBenchmarkResultList()) {
         if (singleBenchmarkResult.hasAllSuccess()) {
           for (PureSubSingleStatistic pureSubSingleStatistic :
               singleBenchmarkResult.getMedian().getPureSubSingleStatisticList()) {
             pureSubSingleStatistic.writeGraphFiles(this);
           }
         }
       }
     }
   }
   for (ProblemBenchmarkResult problemBenchmarkResult :
       plannerBenchmarkResult.getUnifiedProblemBenchmarkResultList()) {
     for (SingleBenchmarkResult singleBenchmarkResult :
         problemBenchmarkResult.getSingleBenchmarkResultList()) {
       for (SubSingleBenchmarkResult subSingleBenchmarkResult :
           singleBenchmarkResult.getSubSingleBenchmarkResultList()) {
         if (!subSingleBenchmarkResult.hasAllSuccess()) {
           continue;
         }
         for (SubSingleStatistic subSingleStatistic :
             subSingleBenchmarkResult.getEffectiveSubSingleStatisticMap().values()) {
           if (plannerBenchmarkResult.getAggregation()) {
             subSingleStatistic.setPointList(null);
           } else {
             subSingleStatistic.hibernatePointList();
           }
         }
       }
     }
   }
   determineDefaultShownScoreLevelIndex();
   writeHtmlOverviewFile();
 }