diff options
Diffstat (limited to 'src/jcgp/backend/statistics')
-rw-r--r-- | src/jcgp/backend/statistics/StatisticsLogger.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jcgp/backend/statistics/StatisticsLogger.java b/src/jcgp/backend/statistics/StatisticsLogger.java index dfbcdbe..7165a11 100644 --- a/src/jcgp/backend/statistics/StatisticsLogger.java +++ b/src/jcgp/backend/statistics/StatisticsLogger.java @@ -173,6 +173,7 @@ public class StatisticsLogger { public int getSuccessfulRuns() { int count = 0; for (RunEntry runEntry : runEntries) { + // only increment if solution was perfect if (runEntry.isSuccessful()) { count++; } @@ -189,7 +190,7 @@ public class StatisticsLogger { * @return the success rate across all runs. */ public double getSuccessRate() { - return getSuccessfulRuns() / runEntries.size(); + return getSuccessfulRuns() / (double) runEntries.size(); } /** @@ -203,6 +204,7 @@ public class StatisticsLogger { double average = 0; int successfulRuns = getSuccessfulRuns(); for (RunEntry runEntry : runEntries) { + // only if solution was perfect if (runEntry.isSuccessful()) { average += runEntry.getGeneration() / successfulRuns; } @@ -221,6 +223,7 @@ public class StatisticsLogger { double average = getAverageSuccessfulGenerations(); double temp, stdDev = 0; for (RunEntry runEntry : runEntries) { + // only if solution was perfect if (runEntry.isSuccessful()) { temp = runEntry.getGeneration() - average; temp = temp * temp; |