From 29c655f874541d2a8757b71eda2caef53e613ddc Mon Sep 17 00:00:00 2001 From: Marcel Kronfeld Date: Thu, 4 Sep 2008 11:15:08 +0000 Subject: [PATCH] Fixed problem in RankMuCMA mutator with large ranges --- .../server/go/operators/mutation/MutateESRankMuCMA.java | 9 +++++++-- src/eva2/server/go/populations/Population.java | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java b/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java index e594682f..111934cc 100644 --- a/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java +++ b/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java @@ -82,7 +82,9 @@ public class MutateESRankMuCMA implements InterfaceMutationGenerational, Seriali */ private double getInitSigma(Population initGen) { switch (initialSig) { - case avgInitialDistance: return initGen.getPopulationMeasures()[0]; + case avgInitialDistance: + // scaled by average range as the measures are normed + return initGen.getPopulationMeasures()[0]*getAvgRange(); case halfRange: return getAvgRange()/2.; default: return 0.2; } @@ -181,8 +183,11 @@ public class MutateESRankMuCMA implements InterfaceMutationGenerational, Seriali if (TRACE_2) System.out.println("Aft: C is \n" + mC.toString()); /* update of sigma */ - sigma *= Math.exp(((psNorm / expRandStepLen) - 1) * getCs() + double sigFact = Math.exp(((psNorm / expRandStepLen) - 1) * getCs() / getDamps()); + if (Double.isInfinite(sigFact)) sigma *= 10.; // in larger search spaces sigma tends to explode after init. + else sigma *= sigFact; + if (Double.isInfinite(sigma) || Double.isNaN(sigma)) { System.err.println("Error, unstable sigma!"); } diff --git a/src/eva2/server/go/populations/Population.java b/src/eva2/server/go/populations/Population.java index de2fe208..3f18c750 100644 --- a/src/eva2/server/go/populations/Population.java +++ b/src/eva2/server/go/populations/Population.java @@ -873,7 +873,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea /** * Returns the average, minimal and maximal phenotypic individual distance as diversity measure for the population. - * + * Distances are thus scaled by the problem range. + * * @return the average, minimal and maximal mean distance of individuals in an array of three */ public double[] getPopulationMeasures() {