diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-04 19:23:52 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-04 19:23:52 +0100 |
commit | aa9e74e7f67789f6353fc26e02ee8e68e40609a2 (patch) | |
tree | 3ad4ed8a0717a9983775a38b0cc8d9a10c01302a /src/jcgp/backend/statistics | |
parent | c4fc7e307caf03c93c4203aff8960ffcb3ca8737 (diff) |
Added more comments, minor refactorings
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; |