Index: /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAInitializer.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAInitializer.cs	(revision 9118)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAInitializer.cs	(revision 9118)
@@ -0,0 +1,192 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System;
+using System.Linq;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("CMAInitializer", "Initializes the covariance matrix and step size variables.")]
+  [StorableClass]
+  public class CMAInitializer : SingleSuccessorOperator, IRealVectorOperator, ICMAESInitializer, IIterationBasedOperator {
+
+    public Type CMAType {
+      get { return typeof(CMAParameters); }
+    }
+
+    #region Parameter Properties
+    public IValueLookupParameter<IntValue> DimensionParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["Dimension"]; }
+    }
+
+    public IValueLookupParameter<DoubleArray> InitialSigmaParameter {
+      get { return (IValueLookupParameter<DoubleArray>)Parameters["InitialSigma"]; }
+    }
+
+    public IValueLookupParameter<DoubleArray> MaxSigmaParameter {
+      get { return (IValueLookupParameter<DoubleArray>)Parameters["MaxSigma"]; }
+    }
+
+    public IValueLookupParameter<DoubleArray> MinSigmaParameter {
+      get { return (IValueLookupParameter<DoubleArray>)Parameters["MinSigma"]; }
+    }
+
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> InitialIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["InitialIterations"]; }
+    }
+
+    public ILookupParameter<IntValue> PopulationSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; }
+    }
+
+    public ILookupParameter<IntValue> MuParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Mu"]; }
+    }
+
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected CMAInitializer(bool deserializing) : base(deserializing) { }
+    protected CMAInitializer(CMAInitializer original, Cloner cloner) : base(original, cloner) { }
+    public CMAInitializer()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<IntValue>("Dimension", "The problem dimension (N)."));
+      Parameters.Add(new ValueLookupParameter<DoubleArray>("InitialSigma", "The initial value for Sigma (need to be > 0), can be single dimensioned or an array that should be equal to the size of the vector.", new DoubleArray(new[] { 0.5 })));
+      Parameters.Add(new ValueLookupParameter<DoubleArray>("MaxSigma", "The maximum sigma value can be omitted, given as one value for all dimensions or a value for each dimension."));
+      Parameters.Add(new ValueLookupParameter<DoubleArray>("MinSigma", "The minimum sigma value can be omitted, given as one value for all dimensions or a value for each dimension."));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The current iteration that is being processed."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations to be processed."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("InitialIterations", "The number of iterations that should be performed using the diagonal covariance matrix only."));
+      Parameters.Add(new LookupParameter<IntValue>("PopulationSize", "The population size (lambda)."));
+      Parameters.Add(new LookupParameter<IntValue>("Mu", "The number of offspring considered for updating of the strategy parameters."));
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The strategy parameters for real-encoded CMA-ES."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAInitializer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var N = DimensionParameter.ActualValue.Value;
+      var lambda = PopulationSizeParameter.ActualValue.Value;
+
+      var sp = new CMAParameters(N, lambda);
+
+      var s = InitialSigmaParameter.ActualValue;
+      if (s == null || s.Length == 0) throw new InvalidOperationException("Initial standard deviation (sigma) must be given.");
+      var sigma = s.Max();
+      if (sigma <= 0) throw new InvalidOperationException("Initial standard deviation (sigma) must be > 0.");
+
+      var pc = new double[N]; // evolution paths for C
+      var ps = new double[N]; // evolution paths for sigma
+      var B = new double[N, N]; // B defines the coordinate system
+      var D = new double[N]; // diagonal D defines the scaling
+      var C = new double[N, N]; // covariance matrix C
+      var BDz = new double[N];
+      double minSqrtdiagC = int.MaxValue, maxSqrtdiagC = int.MinValue;
+      for (int i = 0; i < N; i++) {
+        B[i, i] = 1;
+        if (s.Length == 1) D[i] = 1;
+        else if (s.Length == N) D[i] = s[i] / sigma;
+        else throw new InvalidOperationException("Initial standard deviation (sigma) must either contain only one value for all dimension or for every dimension.");
+        if (D[i] <= 0) throw new InvalidOperationException("Initial standard deviation (sigma) values must all be > 0.");
+        C[i, i] = D[i] * D[i];
+        if (Math.Sqrt(C[i, i]) < minSqrtdiagC) minSqrtdiagC = Math.Sqrt(C[i, i]);
+        if (Math.Sqrt(C[i, i]) > maxSqrtdiagC) maxSqrtdiagC = Math.Sqrt(C[i, i]);
+      }
+
+      // ensure maximal and minimal standard deviations
+      var minSigma = MinSigmaParameter.ActualValue;
+      if (minSigma != null && minSigma.Length > 0) {
+        for (int i = 0; i < N; i++) {
+          var d = minSigma[(int)Math.Min(i, minSigma.Length - 1)];
+          if (d > sigma * minSqrtdiagC) sigma = d / minSqrtdiagC;
+        }
+      }
+      var maxSigma = MaxSigmaParameter.ActualValue;
+      if (maxSigma != null && maxSigma.Length > 0) {
+        for (int i = 0; i < N; i++) {
+          var d = maxSigma[(int)Math.Min(i, maxSigma.Length - 1)];
+          if (d > sigma * maxSqrtdiagC) sigma = d / maxSqrtdiagC;
+        }
+      }
+      // end ensure ...
+
+      // testAndCorrectNumerics
+      double fac = 1;
+      if (D.Max() < 1e-6)
+        fac = 1.0 / D.Max();
+      else if (D.Min() > 1e4)
+        fac = 1.0 / D.Min();
+
+      if (fac != 1.0) {
+        sigma /= fac;
+        for (int i = 0; i < N; i++) {
+          pc[i] *= fac;
+          D[i] *= fac;
+          for (int j = 0; j < N; j++)
+            C[i, j] *= fac * fac;
+        }
+      }
+      // end testAndCorrectNumerics
+
+      var initialIterations = InitialIterationsParameter.ActualValue;
+      if (initialIterations == null) {
+        initialIterations = new IntValue(0);
+      }
+
+      double maxD = D.Max(), minD = D.Min();
+      if (minD == 0) sp.AxisRatio = new DoubleValue(double.PositiveInfinity);
+      else sp.AxisRatio = new DoubleValue(maxD / minD);
+      sp.PC = new DoubleArray(pc);
+      sp.PS = new DoubleArray(ps);
+      sp.B = new DoubleMatrix(B);
+      sp.D = new DoubleArray(D);
+      sp.C = new DoubleMatrix(C);
+      sp.BDz = new DoubleArray(BDz);
+      sp.Sigma = new DoubleValue(sigma);
+      if (maxSigma != null) sp.MaxSigma = (DoubleArray)maxSigma.Clone();
+      if (minSigma != null) sp.MinSigma = (DoubleArray)minSigma.Clone();
+      sp.InitialIterations = new IntValue(initialIterations.Value);
+
+      MuParameter.ActualValue = new IntValue(sp.Mu.Value);
+      StrategyParametersParameter.ActualValue = sp;
+      return base.Apply();
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAMutator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAMutator.cs	(revision 9118)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAMutator.cs	(revision 9118)
@@ -0,0 +1,128 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Random;
+using System;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("CovarianceMatrixMutator", "Mutates the solution vector according to the CMA-ES scheme.")]
+  [StorableClass]
+  public sealed class CMAMutator : SingleSuccessorOperator, IStochasticOperator, IRealVectorOperator, ICMAESManipulator, IIterationBasedOperator {
+    private const int MaxTries = 1000;
+
+    public Type CMAType {
+      get { return typeof(CMAParameters); }
+    }
+
+    #region Parameter Properties
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+
+    public ILookupParameter<RealVector> RealVectorParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private CMAMutator(bool deserializing) : base(deserializing) { }
+    private CMAMutator(CMAMutator original, Cloner cloner) : base(original, cloner) { }
+    public CMAMutator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The current iteration that is being processed."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations to be processed."));
+      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The solution vector of real values."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The bounds for the dimensions."));
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The CMA-ES strategy parameters used for mutation."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAMutator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var random = RandomParameter.ActualValue;
+      var arx = RealVectorParameter.ActualValue;
+      var sp = StrategyParametersParameter.ActualValue;
+      var iterations = IterationsParameter.ActualValue.Value;
+      var initialIterations = sp.InitialIterations.Value;
+      var bounds = BoundsParameter.ActualValue;
+
+      var nd = new NormalDistributedRandom(random, 0, 1);
+
+      var copy = (RealVector)arx.Clone();
+      int tries;
+      if (initialIterations > iterations) {
+        for (int i = 0; i < arx.Length; i++) {
+          tries = 0;
+          do {
+            tries++;
+            arx[i] = copy[i] + sp.Sigma.Value * sp.D[i] * nd.NextDouble();
+          } while ((bounds[i % bounds.Rows, 0] > arx[i] || arx[i] > bounds[i % bounds.Rows, 1]) && tries < MaxTries);
+        }
+      } else {
+        bool inRange;
+        tries = 0;
+        do {
+          tries++;
+          inRange = true;
+          var artmp = new double[arx.Length];
+          for (int i = 0; i < arx.Length; ++i)
+            artmp[i] = sp.D[i] * nd.NextDouble();
+
+          for (int i = 0; i < arx.Length; i++) {
+            var sum = 0.0;
+            for (int j = 0; j < arx.Length; j++)
+              sum += sp.B[i, j] * artmp[j];
+            arx[i] = copy[i] + sp.Sigma.Value * sum; // m + sig * Normal(0,C) 
+            if (bounds[i % bounds.Rows, 0] > arx[i] || arx[i] > bounds[i % bounds.Rows, 1])
+              inRange = false;
+          }
+        } while (!inRange && tries < MaxTries);
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAParameters.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAParameters.cs	(revision 9118)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAParameters.cs	(revision 9118)
@@ -0,0 +1,354 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System;
+using System.ComponentModel;
+using System.Linq;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("CMAES Strategy Parameters", "CMA-ES controls many strategy parameters that guide the search and which are combined in this class.")]
+  [StorableClass]
+  public sealed class CMAParameters : Item, INotifyPropertyChanged {
+
+    [Storable]
+    private DoubleValue axisRatio;
+    public DoubleValue AxisRatio {
+      get { return axisRatio; }
+      set {
+        if (axisRatio == value) return;
+        axisRatio = value;
+        OnPropertyChanged("AxisRatio");
+      }
+    }
+
+    [Storable]
+    private DoubleValue sigma;
+    public DoubleValue Sigma {
+      get { return sigma; }
+      set {
+        if (sigma == value) return;
+        sigma = value;
+        OnPropertyChanged("Sigma");
+      }
+    }
+
+    [Storable]
+    private DoubleArray minSigma;
+    public DoubleArray MinSigma {
+      get { return minSigma; }
+      set {
+        if (minSigma == value) return;
+        minSigma = value;
+        OnPropertyChanged("MinSigma");
+      }
+    }
+
+    [Storable]
+    private DoubleArray maxSigma;
+    public DoubleArray MaxSigma {
+      get { return maxSigma; }
+      set {
+        if (maxSigma == value) return;
+        maxSigma = value;
+        OnPropertyChanged("MaxSigma");
+      }
+    }
+
+    [Storable]
+    private IntValue mu;
+    public IntValue Mu {
+      get { return mu; }
+      set {
+        if (mu == value) return;
+        mu = value;
+        OnPropertyChanged("Mu");
+      }
+    }
+
+    [Storable]
+    private DoubleArray weights;
+    public DoubleArray Weights {
+      get { return weights; }
+      set {
+        if (weights == value) return;
+        weights = value;
+        OnPropertyChanged("Weights");
+      }
+    }
+
+    [Storable]
+    private DoubleValue muEff;
+    public DoubleValue MuEff {
+      get { return muEff; }
+      set {
+        if (muEff == value) return;
+        muEff = value;
+        OnPropertyChanged("MuEff");
+      }
+    }
+
+    [Storable]
+    private DoubleValue cc;
+    public DoubleValue CC {
+      get { return cc; }
+      set {
+        if (cc == value) return;
+        cc = value;
+        OnPropertyChanged("CC");
+      }
+    }
+
+    [Storable]
+    private DoubleValue cs;
+    public DoubleValue CS {
+      get { return cs; }
+      set {
+        if (cs == value) return;
+        cs = value;
+        OnPropertyChanged("CS");
+      }
+    }
+
+    [Storable]
+    private DoubleValue c1;
+    public DoubleValue C1 {
+      get { return c1; }
+      set {
+        if (c1 == value) return;
+        c1 = value;
+        OnPropertyChanged("C1");
+      }
+    }
+
+    [Storable]
+    private DoubleValue cmu;
+    public DoubleValue CMU {
+      get { return cmu; }
+      set {
+        if (cmu == value) return;
+        cmu = value;
+        OnPropertyChanged("CMU");
+      }
+    }
+
+    [Storable]
+    private DoubleValue damps;
+    public DoubleValue Damps {
+      get { return damps; }
+      set {
+        if (damps == value) return;
+        damps = value;
+        OnPropertyChanged("Damps");
+      }
+    }
+
+    [Storable]
+    private DoubleValue muCov;
+    public DoubleValue MuCov {
+      get { return muCov; }
+      set {
+        if (muCov == value) return;
+        muCov = value;
+        OnPropertyChanged("MuCov");
+      }
+    }
+
+    [Storable]
+    private DoubleValue cCov;
+    public DoubleValue CCov {
+      get { return cCov; }
+      set {
+        if (cCov == value) return;
+        cCov = value;
+        OnPropertyChanged("CCov");
+      }
+    }
+
+    [Storable]
+    private DoubleValue cCovSep;
+    public DoubleValue CCovSep {
+      get { return cCovSep; }
+      set {
+        if (cCovSep == value) return;
+        cCovSep = value;
+        OnPropertyChanged("CCovSep");
+      }
+    }
+
+    [Storable]
+    private DoubleArray pc;
+    public DoubleArray PC {
+      get { return pc; }
+      set {
+        if (pc == value) return;
+        pc = value;
+        OnPropertyChanged("PC");
+      }
+    }
+
+    [Storable]
+    private DoubleArray ps;
+    public DoubleArray PS {
+      get { return ps; }
+      set {
+        if (ps == value) return;
+        ps = value;
+        OnPropertyChanged("PS");
+      }
+    }
+
+    [Storable]
+    private DoubleMatrix b;
+    public DoubleMatrix B {
+      get { return b; }
+      set {
+        if (b == value) return;
+        b = value;
+        OnPropertyChanged("B");
+      }
+    }
+
+    [Storable]
+    private DoubleArray d;
+    public DoubleArray D {
+      get { return d; }
+      set {
+        if (d == value) return;
+        d = value;
+        OnPropertyChanged("D");
+      }
+    }
+
+    [Storable]
+    private DoubleMatrix c;
+    public DoubleMatrix C {
+      get { return c; }
+      set {
+        if (c == value) return;
+        c = value;
+        OnPropertyChanged("C");
+      }
+    }
+
+    [Storable]
+    private DoubleArray bDz;
+    public DoubleArray BDz {
+      get { return bDz; }
+      set {
+        if (bDz == value) return;
+        bDz = value;
+        OnPropertyChanged("BDz");
+      }
+    }
+
+    [Storable]
+    private DoubleValue chiN;
+    public DoubleValue ChiN {
+      get { return chiN; }
+      set {
+        if (chiN == value) return;
+        chiN = value;
+        OnPropertyChanged("ChiN");
+      }
+    }
+
+    [Storable]
+    private IntValue initialIterations;
+    public IntValue InitialIterations {
+      get { return initialIterations; }
+      set {
+        if (initialIterations == value) return;
+        initialIterations = value;
+        OnPropertyChanged("InitialIterations");
+      }
+    }
+
+    [StorableConstructor]
+    private CMAParameters(bool deserializing) : base(deserializing) { }
+    private CMAParameters(CMAParameters original, Cloner cloner)
+      : base(original, cloner) {
+      this.axisRatio = cloner.Clone(original.axisRatio);
+      this.b = cloner.Clone(original.b);
+      this.c = cloner.Clone(original.c);
+      this.c1 = cloner.Clone(original.c1);
+      this.cc = cloner.Clone(original.cc);
+      this.cCov = cloner.Clone(original.cCov);
+      this.cCovSep = cloner.Clone(original.cCovSep);
+      this.chiN = cloner.Clone(original.chiN);
+      this.cmu = cloner.Clone(original.cmu);
+      this.cs = cloner.Clone(original.cs);
+      this.d = cloner.Clone(original.d);
+      this.initialIterations = cloner.Clone(original.initialIterations);
+      this.bDz = cloner.Clone(original.bDz);
+      this.maxSigma = cloner.Clone(original.maxSigma);
+      this.minSigma = cloner.Clone(original.minSigma);
+      this.mu = cloner.Clone(original.mu);
+      this.muCov = cloner.Clone(original.muCov);
+      this.muEff = cloner.Clone(original.muEff);
+      this.pc = cloner.Clone(original.pc);
+      this.ps = cloner.Clone(original.ps);
+      this.sigma = cloner.Clone(original.sigma);
+      this.weights = cloner.Clone(original.weights);
+    }
+    public CMAParameters() { }
+    public CMAParameters(int dimension, int lambda) {
+      SetDefaults(dimension, lambda);
+    }
+
+    private void SetDefaults(int N, int lambda) {
+      ChiN = new DoubleValue(Math.Sqrt(N) * (1.0 - 1.0 / (4.0 * N) + 1.0 / (21.0 * N * N)));
+      Mu = new IntValue((int)Math.Floor(lambda / 2.0));
+
+      var w = new double[Mu.Value];
+      for (int i = 0; i < Mu.Value; i++)
+        w[i] = (Math.Log(Mu.Value + 1) - Math.Log(i + 1));
+
+      var sum = w.Sum();
+      for (int i = 0; i < w.Length; i++) w[i] /= sum;
+
+      Weights = new DoubleArray(w);
+      MuEff = new DoubleValue(1.0 / Weights.Sum(x => x * x));
+      CS = new DoubleValue((MuEff.Value + 2) / (N + MuEff.Value + 3));
+      Damps = new DoubleValue(2 * Math.Max(0, Math.Sqrt((MuEff.Value - 1) / (N + 1)) - 1)
+                                * Math.Max(0.3, 1 - N / (1e-6 + /*TODO earliest stop (MaxGen)*/ 1000))
+                              + CS.Value + 1);
+      CC = new DoubleValue(4.0 / (N + 4));
+      MuCov = new DoubleValue(MuEff.Value);
+      CCov = new DoubleValue(2.0 / ((N + 1.41) * (N + 1.41) * MuCov.Value)
+                             + (1 - (1.0 / MuCov.Value)) * Math.Min(1, (2 * MuEff.Value - 1) / (MuEff.Value + (N + 2) * (N + 2))));
+      CCovSep = new DoubleValue(Math.Min(1, CCov.Value * (N + 1.5) / 3));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAParameters(this, cloner);
+    }
+
+    public event PropertyChangedEventHandler PropertyChanged;
+    private void OnPropertyChanged(string name) {
+      var handler = PropertyChanged;
+      if (handler != null) handler(this, new PropertyChangedEventArgs(name));
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMARecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMARecombinator.cs	(revision 9118)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMARecombinator.cs	(revision 9118)
@@ -0,0 +1,82 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("CMARecombinator", "Calculates the weighted mean of a number of offspring.")]
+  [StorableClass]
+  public class CMARecombinator : SingleSuccessorOperator, IRealVectorOperator, ICMAESRecombinator {
+
+    public Type CMAType {
+      get { return typeof(CMAParameters); }
+    }
+
+    #region Parameter Properties
+    public IScopeTreeLookupParameter<RealVector> OffspringParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Offspring"]; }
+    }
+
+    public ILookupParameter<RealVector> MeanParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Mean"]; }
+    }
+
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected CMARecombinator(bool deserializing) : base(deserializing) { }
+    protected CMARecombinator(CMARecombinator original, Cloner cloner) : base(original, cloner) { }
+    public CMARecombinator()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Offspring", "The offspring that should be recombined."));
+      Parameters.Add(new LookupParameter<RealVector>("Mean", "The new mean solution."));
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The CMA-ES strategy parameters used for mutation."));
+      OffspringParameter.ActualName = "RealVector";
+      MeanParameter.ActualName = "RealVector";
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMARecombinator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var sp = StrategyParametersParameter.ActualValue;
+      var offspring = OffspringParameter.ActualValue;
+      var mean = new RealVector(offspring[0].Length);
+      for (int i = 0; i < mean.Length; i++) {
+        for (int j = 0; j < offspring.Length; j++)
+          mean[i] += sp.Weights[j] * offspring[j][i];
+      }
+
+      MeanParameter.ActualValue = mean;
+      return base.Apply();
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAUpdater.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAUpdater.cs	(revision 9118)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CMAUpdater.cs	(revision 9118)
@@ -0,0 +1,214 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System;
+using System.Linq;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("CMAUpdater", "Updates the covariance matrix and strategy parameters of CMA-ES.")]
+  [StorableClass]
+  public class CMAUpdater : SingleSuccessorOperator, IRealVectorOperator, ICMAESUpdater, IIterationBasedOperator {
+
+    public Type CMAType {
+      get { return typeof(CMAParameters); }
+    }
+
+    #region Parameter Properties
+
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+
+    public IScopeTreeLookupParameter<RealVector> MeansParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Means"]; }
+    }
+
+    public IScopeTreeLookupParameter<RealVector> OffspringParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Offspring"]; }
+    }
+
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected CMAUpdater(bool deserializing) : base(deserializing) { }
+    protected CMAUpdater(CMAUpdater original, Cloner cloner) : base(original, cloner) { }
+    public CMAUpdater()
+      : base() {
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The strategy parameters of CMA-ES."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Means", "The old and the new mean.", 2));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Offspring", "The created offspring solutions.", 3));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The number of iterations passed."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations."));
+      MeansParameter.ActualName = "RealVector";
+      OffspringParameter.ActualName = "RealVector";
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAUpdater(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var iterations = IterationsParameter.ActualValue.Value;
+
+      var xold = MeansParameter.ActualValue[0];
+      var xmean = MeansParameter.ActualValue[1];
+      var offspring = OffspringParameter.ActualValue;
+
+      var sp = StrategyParametersParameter.ActualValue;
+      var N = sp.C.Rows;
+
+      for (int i = 0; i < N; i++) {
+        sp.BDz[i] = Math.Sqrt(sp.MuEff.Value) * (xmean[i] - xold[i]) / sp.Sigma.Value;
+      }
+
+      if (sp.InitialIterations.Value >= iterations) {
+        for (int i = 0; i < N; i++) {
+          sp.PS[i] = (1 - sp.CS.Value) * sp.PS[i]
+                     + Math.Sqrt(sp.CS.Value * (2 - sp.CS.Value)) * sp.BDz[i] / sp.D[i];
+        }
+      } else {
+        var artmp = new double[N];
+        for (int i = 0; i < N; i++) {
+          var sum = 0.0;
+          for (int j = 0; j < N; j++) {
+            sum += sp.B[j, i] * sp.BDz[j];
+          }
+          artmp[i] = sum / sp.D[i];
+        }
+        for (int i = 0; i < N; i++) {
+          var sum = 0.0;
+          for (int j = 0; j < N; j++) {
+            sum += sp.B[i, j] * artmp[j];
+          }
+          sp.PS[i] = (1 - sp.CS.Value) * sp.PS[i] + Math.Sqrt(sp.CS.Value * (2 - sp.CS.Value)) * sum;
+        }
+      }
+      var normPS = Math.Sqrt(sp.PS.Select(x => x * x).Sum());
+      var hsig = normPS / Math.Sqrt(1 - Math.Pow(1 - sp.CS.Value, 2 * iterations)) / sp.ChiN.Value < 1.4 + 2.0 / (N + 1) ? 1.0 : 0.0;
+      for (int i = 0; i < sp.PC.Length; i++) {
+        sp.PC[i] = (1 - sp.CC.Value) * sp.PC[i]
+                   + hsig * Math.Sqrt(sp.CC.Value * (2 - sp.CC.Value)) * sp.BDz[i];
+      }
+
+      if (sp.CCov.Value > 0) {
+        if (sp.InitialIterations.Value >= iterations) {
+          for (int i = 0; i < N; i++) {
+            sp.C[i, i] = (1 - sp.CCovSep.Value) * sp.C[i, i]
+                         + sp.CCov.Value * (1 / sp.MuCov.Value)
+                         * (sp.PC[i] * sp.PC[i] + (1 - hsig) * sp.CC.Value * (2 - sp.CC.Value) * sp.C[i, i]);
+            for (int k = 0; k < sp.Mu.Value; k++) {
+              sp.C[i, i] += sp.CCov.Value * (1 - 1 / sp.MuCov.Value) * sp.Weights[k] * (offspring[k][i] - xold[i]) *
+                            (offspring[k][i] - xold[i]) / (sp.Sigma.Value * sp.Sigma.Value);
+            }
+          }
+        } else {
+          for (int i = 0; i < N; i++) {
+            for (int j = 0; j < N; j++) {
+              sp.C[i, j] = (1 - sp.CCov.Value) * sp.C[i, j]
+                           + sp.CCov.Value * (1 / sp.MuCov.Value)
+                           * (sp.PC[i] * sp.PC[j] + (1 - hsig) * sp.CC.Value * (2 - sp.CC.Value) * sp.C[i, j]);
+              for (int k = 0; k < sp.Mu.Value; k++) {
+                sp.C[i, j] += sp.CCov.Value * (1 - 1 / sp.MuCov.Value) * sp.Weights[k] * (offspring[k][i] - xold[i]) *
+                              (offspring[k][j] - xold[j]) / (sp.Sigma.Value * sp.Sigma.Value);
+              }
+            }
+          }
+        }
+      }
+      sp.Sigma.Value *= Math.Exp((sp.CS.Value / sp.Damps.Value) * (normPS / sp.ChiN.Value - 1));
+
+      double minSqrtdiagC = int.MaxValue, maxSqrtdiagC = int.MinValue;
+      for (int i = 0; i < N; i++) {
+        if (Math.Sqrt(sp.C[i, i]) < minSqrtdiagC) minSqrtdiagC = Math.Sqrt(sp.C[i, i]);
+        if (Math.Sqrt(sp.C[i, i]) > maxSqrtdiagC) maxSqrtdiagC = Math.Sqrt(sp.C[i, i]);
+      }
+
+      // ensure maximal and minimal standard deviations
+      if (sp.MinSigma != null && sp.MinSigma.Length > 0) {
+        for (int i = 0; i < N; i++) {
+          var d = sp.MinSigma[Math.Min(i, sp.MinSigma.Length - 1)];
+          if (d > sp.Sigma.Value * minSqrtdiagC) sp.Sigma.Value = d / minSqrtdiagC;
+        }
+      }
+      if (sp.MaxSigma != null && sp.MaxSigma.Length > 0) {
+        for (int i = 0; i < N; i++) {
+          var d = sp.MaxSigma[Math.Min(i, sp.MaxSigma.Length - 1)];
+          if (d > sp.Sigma.Value * maxSqrtdiagC) sp.Sigma.Value = d / maxSqrtdiagC;
+        }
+      }
+      // end ensure ...
+
+      // testAndCorrectNumerics
+      double fac = 1;
+      if (sp.D.Max() < 1e-6)
+        fac = 1.0 / sp.D.Max();
+      else if (sp.D.Min() > 1e4)
+        fac = 1.0 / sp.D.Min();
+
+      if (fac != 1.0) {
+        sp.Sigma.Value /= fac;
+        for (int i = 0; i < N; i++) {
+          sp.PC[i] *= fac;
+          sp.D[i] *= fac;
+          for (int j = 0; j < N; j++)
+            sp.C[i, j] *= fac * fac;
+        }
+      }
+      // end testAndCorrectNumerics
+
+      if (sp.InitialIterations.Value >= iterations) {
+        for (int i = 0; i < N; i++)
+          sp.D[i] = Math.Sqrt(sp.C[i, i]);
+      } else {
+        var c = new double[sp.C.Rows, sp.C.Columns];
+        for (int i = 0; i < sp.C.Rows; i++)
+          for (int j = 0; j < sp.C.Columns; j++)
+            c[i, j] = sp.C[i, j];
+        double[] eVal;
+        double[,] eVec;
+        if (!alglib.smatrixevd(c, N, 1, false, out eVal, out eVec))
+          throw new InvalidOperationException("Unable to perform eigendecomposition of matrix.");
+        sp.B = new DoubleMatrix(eVec);
+
+        for (int i = 0; i < sp.D.Length; i++)
+          sp.D[i] = Math.Sqrt(eVal[i]);
+
+        if (sp.D.Min() == 0.0) sp.AxisRatio.Value = double.PositiveInfinity;
+        else sp.AxisRatio.Value = sp.D.Max() / sp.D.Min();
+      }
+      return base.Apply();
+    }
+  }
+}
Index: anches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixInitializer.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixInitializer.cs	(revision 9117)
+++ 	(revision )
@@ -1,120 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using System;
-using System.Linq;
-
-namespace HeuristicLab.Encodings.RealVectorEncoding {
-  [Item("Default", "Initializes the covariance matrix and step size variables.")]
-  [StorableClass]
-  public class CovarianceMatrixInitializer : SingleSuccessorOperator, IRealVectorOperator, ICMAESInitializer {
-
-    public Type CMAType {
-      get { return typeof(CovarianceMatrixStrategyParameters); }
-    }
-
-    #region Parameter Properties
-    public IValueLookupParameter<IntValue> DimensionParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters["Dimension"]; }
-    }
-
-    public ILookupParameter<IntValue> PopulationSizeParameter {
-      get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; }
-    }
-
-    public ILookupParameter<IntValue> MuParameter {
-      get { return (ILookupParameter<IntValue>)Parameters["Mu"]; }
-    }
-
-    public ILookupParameter<CovarianceMatrixStrategyParameters> StrategyParametersParameter {
-      get { return (ILookupParameter<CovarianceMatrixStrategyParameters>)Parameters["StrategyParameters"]; }
-    }
-    #endregion
-
-    [StorableConstructor]
-    protected CovarianceMatrixInitializer(bool deserializing) : base(deserializing) { }
-    protected CovarianceMatrixInitializer(CovarianceMatrixInitializer original, Cloner cloner) : base(original, cloner) { }
-    public CovarianceMatrixInitializer()
-      : base() {
-      Parameters.Add(new ValueLookupParameter<IntValue>("Dimension", "The problem dimension (N)."));
-      Parameters.Add(new LookupParameter<IntValue>("PopulationSize", "The population size (lambda)."));
-      Parameters.Add(new LookupParameter<IntValue>("Mu", "The number of offspring considered for updating of the strategy parameters."));
-      Parameters.Add(new LookupParameter<CovarianceMatrixStrategyParameters>("StrategyParameters", "The strategy parameters for real-encoded CMA-ES."));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new CovarianceMatrixInitializer(this, cloner);
-    }
-
-    public override IOperation Apply() {
-      var N = DimensionParameter.ActualValue.Value;
-      var lambda = PopulationSizeParameter.ActualValue.Value;
-      var mu = (lambda / 2.0);
-      var weights = Enumerable.Range(1, (int)mu).Select(x => Math.Log(mu + 0.5) - Math.Log(x)).ToArray();
-      mu = Math.Floor(mu);
-      var sum = weights.Sum();
-      weights = weights.Select(x => x / sum).ToArray();
-      var mueff = 1 / weights.Sum(x => x * x);
-
-      var cc = (4 + mueff / N) / (N + 4 + 2 * mueff / N);  // time constant for cumulation for C
-      var cs = (mueff + 2) / (N + mueff + 5);  // t-const for cumulation for sigma control
-      var c1 = 2 / ((N + 1.3) * (N + 1.3) + mueff);    // learning rate for rank-one update of C
-      var cmu = 2 * (mueff - 2 + 1 / mueff) / ((N + 2) * (N + 2) + mueff);  // and for rank-mu update
-
-      var pc = new double[N]; // evolution paths for C
-      var ps = new double[N]; // evolution paths for sigma
-      var B = new double[N, N]; // B defines the coordinate system
-      for (int i = 0; i < N; i++) B[i, i] = 1;
-      var D = new double[N]; // diagonal D defines the scaling
-      for (int i = 0; i < N; i++) D[i] = 1;
-      var C = (double[,])B.Clone(); // covariance matrix C
-      var invsqrtC = (double[,])C.Clone(); // C^-1/2
-      var chiN = Math.Sqrt(N) * (1 - 1 / (4 * N) + 1 / (21 * N * N)); // expectation of  ||N(0,I)|| == norm(randn(N,1))
-
-      MuParameter.ActualValue = new IntValue((int)mu);
-      StrategyParametersParameter.ActualValue = new CovarianceMatrixStrategyParameters() {
-        B = new DoubleMatrix(B),
-        C = new DoubleMatrix(C),
-        C1 = new DoubleValue(c1),
-        CC = new DoubleValue(cc),
-        ChiN = new DoubleValue(chiN),
-        CMU = new DoubleValue(cmu),
-        CS = new DoubleValue(cs),
-        D = new DoubleArray(D),
-        InvSqrtC = new DoubleMatrix(invsqrtC),
-        Mu = new IntValue((int)mu),
-        MuEff = new DoubleValue(mueff),
-        PC = new DoubleArray(pc),
-        PS = new DoubleArray(ps),
-        Sigma = new DoubleValue(0.5),
-        Weights = new DoubleArray(weights)
-      };
-      return base.Apply();
-    }
-  }
-}
Index: anches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixMutator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixMutator.cs	(revision 9117)
+++ 	(revision )
@@ -1,88 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Random;
-using System;
-
-namespace HeuristicLab.Encodings.RealVectorEncoding {
-  [Item("CovarianceMatrixMutator", "Mutates the solution vector according to the CMA-ES scheme.")]
-  [StorableClass]
-  public class CovarianceMatrixMutator : SingleSuccessorOperator, IStochasticOperator, IRealVectorOperator, ICMAESManipulator {
-
-    public Type CMAType {
-      get { return typeof(CovarianceMatrixStrategyParameters); }
-    }
-
-    #region Parameter Properties
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
-    }
-
-    public ILookupParameter<RealVector> RealVectorParameter {
-      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
-    }
-
-    public ILookupParameter<CovarianceMatrixStrategyParameters> StrategyParametersParameter {
-      get { return (ILookupParameter<CovarianceMatrixStrategyParameters>)Parameters["StrategyParameters"]; }
-    }
-    #endregion
-
-    [StorableConstructor]
-    protected CovarianceMatrixMutator(bool deserializing) : base(deserializing) { }
-    protected CovarianceMatrixMutator(CovarianceMatrixMutator original, Cloner cloner) : base(original, cloner) { }
-    public CovarianceMatrixMutator()
-      : base() {
-      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
-      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The solution vector of real values."));
-      Parameters.Add(new LookupParameter<CovarianceMatrixStrategyParameters>("StrategyParameters", "The CMA-ES strategy parameters used for mutation."));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new CovarianceMatrixMutator(this, cloner);
-    }
-
-    public override IOperation Apply() {
-      var random = RandomParameter.ActualValue;
-      var arx = RealVectorParameter.ActualValue;
-      var sp = StrategyParametersParameter.ActualValue;
-
-      var nd = new NormalDistributedRandom(random, 0, 1);
-
-      var artmp = new double[arx.Length];
-      for (int i = 0; i < arx.Length; ++i)
-        artmp[i] = sp.D[i] * nd.NextDouble();
-
-      for (int i = 0; i < arx.Length; i++) {
-        var sum = 0.0;
-        for (int j = 0; j < arx.Length; j++)
-          sum += sp.B[i, j] * artmp[j];
-        arx[i] += sp.Sigma.Value * artmp[i]; // m + sig * Normal(0,C) 
-      }
-      return base.Apply();
-    }
-  }
-}
Index: anches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixRecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixRecombinator.cs	(revision 9117)
+++ 	(revision )
@@ -1,82 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using System;
-
-namespace HeuristicLab.Encodings.RealVectorEncoding {
-  [Item("CovarianceMatrixRecombinator", "Calculates the weighted mean of a number of offspring.")]
-  [StorableClass]
-  public class CovarianceMatrixRecombinator : SingleSuccessorOperator, IRealVectorOperator, ICMAESRecombinator {
-
-    public Type CMAType {
-      get { return typeof(CovarianceMatrixStrategyParameters); }
-    }
-
-    #region Parameter Properties
-    public IScopeTreeLookupParameter<RealVector> OffspringParameter {
-      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Offspring"]; }
-    }
-
-    public ILookupParameter<RealVector> MeanParameter {
-      get { return (ILookupParameter<RealVector>)Parameters["Mean"]; }
-    }
-
-    public ILookupParameter<CovarianceMatrixStrategyParameters> StrategyParametersParameter {
-      get { return (ILookupParameter<CovarianceMatrixStrategyParameters>)Parameters["StrategyParameters"]; }
-    }
-    #endregion
-
-    [StorableConstructor]
-    protected CovarianceMatrixRecombinator(bool deserializing) : base(deserializing) { }
-    protected CovarianceMatrixRecombinator(CovarianceMatrixRecombinator original, Cloner cloner) : base(original, cloner) { }
-    public CovarianceMatrixRecombinator()
-      : base() {
-      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Offspring", "The offspring that should be recombined."));
-      Parameters.Add(new LookupParameter<RealVector>("Mean", "The new mean solution."));
-      Parameters.Add(new LookupParameter<CovarianceMatrixStrategyParameters>("StrategyParameters", "The CMA-ES strategy parameters used for mutation."));
-      OffspringParameter.ActualName = "RealVector";
-      MeanParameter.ActualName = "RealVector";
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new CovarianceMatrixRecombinator(this, cloner);
-    }
-
-    public override IOperation Apply() {
-      var sp = StrategyParametersParameter.ActualValue;
-      var offspring = OffspringParameter.ActualValue;
-      var mean = new RealVector(offspring[0].Length);
-      for (int i = 0; i < mean.Length; i++) {
-        for (int j = 0; j < offspring.Length; j++)
-          mean[i] += sp.Weights[j] * offspring[j][i];
-      }
-
-      MeanParameter.ActualValue = mean;
-      return base.Apply();
-    }
-  }
-}
Index: anches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixStrategyParameters.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixStrategyParameters.cs	(revision 9117)
+++ 	(revision )
@@ -1,229 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using System.ComponentModel;
-
-namespace HeuristicLab.Encodings.RealVectorEncoding {
-  [Item("CMAES Strategy Parameters", "CMA-ES controls many strategy parameters that guide the search and which are combined in this class.")]
-  [StorableClass]
-  public sealed class CovarianceMatrixStrategyParameters : Item, INotifyPropertyChanged {
-    [Storable]
-    private DoubleValue sigma;
-    public DoubleValue Sigma {
-      get { return sigma; }
-      set {
-        if (sigma == value) return;
-        sigma = value;
-        OnPropertyChanged("Sigma");
-      }
-    }
-
-    [Storable]
-    private IntValue mu;
-    public IntValue Mu {
-      get { return mu; }
-      set {
-        if (mu == value) return;
-        mu = value;
-        OnPropertyChanged("Mu");
-      }
-    }
-
-    [Storable]
-    private DoubleArray weights;
-    public DoubleArray Weights {
-      get { return weights; }
-      set {
-        if (weights == value) return;
-        weights = value;
-        OnPropertyChanged("Weights");
-      }
-    }
-
-    [Storable]
-    private DoubleValue muEff;
-    public DoubleValue MuEff {
-      get { return muEff; }
-      set {
-        if (muEff == value) return;
-        muEff = value;
-        OnPropertyChanged("VarianceEffectiveness");
-      }
-    }
-
-    [Storable]
-    private DoubleValue cc;
-    public DoubleValue CC {
-      get { return cc; }
-      set {
-        if (cc == value) return;
-        cc = value;
-        OnPropertyChanged("CC");
-      }
-    }
-
-    [Storable]
-    private DoubleValue cs;
-    public DoubleValue CS {
-      get { return cs; }
-      set {
-        if (cs == value) return;
-        cs = value;
-        OnPropertyChanged("CS");
-      }
-    }
-
-    [Storable]
-    private DoubleValue c1;
-    public DoubleValue C1 {
-      get { return c1; }
-      set {
-        if (c1 == value) return;
-        c1 = value;
-        OnPropertyChanged("C1");
-      }
-    }
-
-    [Storable]
-    private DoubleValue cmu;
-    public DoubleValue CMU {
-      get { return cmu; }
-      set {
-        if (cmu == value) return;
-        cmu = value;
-        OnPropertyChanged("CMU");
-      }
-    }
-
-    [Storable]
-    private DoubleArray pc;
-    public DoubleArray PC {
-      get { return pc; }
-      set {
-        if (pc == value) return;
-        pc = value;
-        OnPropertyChanged("PC");
-      }
-    }
-
-    [Storable]
-    private DoubleArray ps;
-    public DoubleArray PS {
-      get { return ps; }
-      set {
-        if (ps == value) return;
-        ps = value;
-        OnPropertyChanged("PS");
-      }
-    }
-
-    [Storable]
-    private DoubleMatrix b;
-    public DoubleMatrix B {
-      get { return b; }
-      set {
-        if (b == value) return;
-        b = value;
-        OnPropertyChanged("B");
-      }
-    }
-
-    [Storable]
-    private DoubleArray d;
-    public DoubleArray D {
-      get { return d; }
-      set {
-        if (d == value) return;
-        d = value;
-        OnPropertyChanged("D");
-      }
-    }
-
-    [Storable]
-    private DoubleMatrix c;
-    public DoubleMatrix C {
-      get { return c; }
-      set {
-        if (c == value) return;
-        c = value;
-        OnPropertyChanged("C");
-      }
-    }
-
-    [Storable]
-    private DoubleMatrix invSqrtC;
-    public DoubleMatrix InvSqrtC {
-      get { return invSqrtC; }
-      set {
-        if (invSqrtC == value) return;
-        invSqrtC = value;
-        OnPropertyChanged("InvSqrtC");
-      }
-    }
-
-    [Storable]
-    private DoubleValue chiN;
-    public DoubleValue ChiN {
-      get { return chiN; }
-      set {
-        if (chiN == value) return;
-        chiN = value;
-        OnPropertyChanged("ChiN");
-      }
-    }
-
-    [StorableConstructor]
-    private CovarianceMatrixStrategyParameters(bool deserializing) : base(deserializing) { }
-    private CovarianceMatrixStrategyParameters(CovarianceMatrixStrategyParameters original, Cloner cloner)
-      : base(original, cloner) {
-      this.b = cloner.Clone(original.b);
-      this.c = cloner.Clone(original.c);
-      this.c1 = cloner.Clone(original.c1);
-      this.cc = cloner.Clone(original.cc);
-      this.chiN = cloner.Clone(original.chiN);
-      this.cmu = cloner.Clone(original.cmu);
-      this.cs = cloner.Clone(original.cs);
-      this.d = cloner.Clone(original.d);
-      this.invSqrtC = cloner.Clone(original.invSqrtC);
-      this.mu = cloner.Clone(original.mu);
-      this.muEff = cloner.Clone(original.muEff);
-      this.pc = cloner.Clone(original.pc);
-      this.ps = cloner.Clone(original.ps);
-      this.sigma = cloner.Clone(original.sigma);
-      this.weights = cloner.Clone(original.weights);
-    }
-    public CovarianceMatrixStrategyParameters() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new CovarianceMatrixStrategyParameters(this, cloner);
-    }
-
-    public event PropertyChangedEventHandler PropertyChanged;
-    private void OnPropertyChanged(string name) {
-      var handler = PropertyChanged;
-      if (handler != null) handler(this, new PropertyChangedEventArgs(name));
-    }
-  }
-}
Index: anches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixUpdater.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/CMAESOperators/CovarianceMatrixUpdater.cs	(revision 9117)
+++ 	(revision )
@@ -1,147 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using System;
-using System.Linq;
-
-namespace HeuristicLab.Encodings.RealVectorEncoding {
-  [Item("CovarianceMatrixUpdater", "Updates the covariance matrix and strategy parameters of CMA-ES.")]
-  [StorableClass]
-  public class CovarianceMatrixUpdater : SingleSuccessorOperator, IRealVectorOperator, ICMAESUpdater, IStochasticOperator, IIterationBasedOperator {
-
-    public Type CMAType {
-      get { return typeof(CovarianceMatrixStrategyParameters); }
-    }
-
-    #region Parameter Properties
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
-    }
-
-    public ILookupParameter<CovarianceMatrixStrategyParameters> StrategyParametersParameter {
-      get { return (ILookupParameter<CovarianceMatrixStrategyParameters>)Parameters["StrategyParameters"]; }
-    }
-
-    public IScopeTreeLookupParameter<RealVector> MeansParameter {
-      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Means"]; }
-    }
-
-    public IScopeTreeLookupParameter<RealVector> OffspringParameter {
-      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Offspring"]; }
-    }
-
-    public ILookupParameter<IntValue> IterationsParameter {
-      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
-    }
-
-    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
-    }
-    #endregion
-
-    [StorableConstructor]
-    protected CovarianceMatrixUpdater(bool deserializing) : base(deserializing) { }
-    protected CovarianceMatrixUpdater(CovarianceMatrixUpdater original, Cloner cloner) : base(original, cloner) { }
-    public CovarianceMatrixUpdater()
-      : base() {
-      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
-      Parameters.Add(new LookupParameter<CovarianceMatrixStrategyParameters>("StrategyParameters", "The strategy parameters of CMA-ES."));
-      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Means", "The old and the new mean.", 2));
-      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Offspring", "The created offspring solutions.", 3));
-      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The number of iterations passed."));
-      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations."));
-      MeansParameter.ActualName = "RealVector";
-      OffspringParameter.ActualName = "RealVector";
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new CovarianceMatrixUpdater(this, cloner);
-    }
-
-    public override IOperation Apply() {
-
-      var random = RandomParameter.ActualValue;
-      var iterations = IterationsParameter.ActualValue.Value;
-
-      var xold = MeansParameter.ActualValue[0];
-      var xmean = MeansParameter.ActualValue[1];
-      var offspring = OffspringParameter.ActualValue;
-
-      var sp = StrategyParametersParameter.ActualValue;
-      var N = sp.PC.Length;
-      var damps = 1 + 2 * Math.Max(0, Math.Sqrt((sp.MuEff.Value - 1.0) / (N + 1)) - 1.0) + sp.CS.Value;
-
-      for (int i = 0; i < sp.PS.Length; i++) {
-        var matmul = 0.0;
-        for (int j = 0; j < sp.PS.Length; j++) {
-          matmul += sp.InvSqrtC[i, j] * (xmean[j] - xold[j]);
-        }
-        sp.PS[i] = (1 - sp.CS.Value) * sp.PS[i]
-                   + Math.Sqrt(sp.CS.Value * (2 - sp.CS.Value) * sp.MuEff.Value) * matmul / sp.Sigma.Value;
-      }
-      var normPS = sp.PS.Select(x => x * x).Sum();
-      var hsig = normPS / Math.Sqrt(1 - Math.Pow(1 - sp.CS.Value, 2 * iterations)) / sp.ChiN.Value < 1.4 + 2.0 / (N + 1) ? 1.0 : 0.0;
-      for (int i = 0; i < sp.PC.Length; i++) {
-        sp.PC[i] = (1 - sp.CC.Value) * sp.PC[i]
-                   + hsig * Math.Sqrt(sp.CC.Value * (2 - sp.CC.Value) * sp.MuEff.Value) * (xmean[i] - xold[i]) / sp.Sigma.Value;
-      }
-      var c = new double[sp.C.Rows, sp.C.Columns];
-      for (int i = 0; i < sp.C.Rows; i++) {
-        for (int j = 0; j < sp.C.Columns; j++) {
-          c[i, j] = (1 - sp.C1.Value - sp.CMU.Value) * sp.C[i, j]
-                       + (1 - hsig) * sp.CC.Value * (2 - sp.CC.Value) * sp.C[i, j];
-          for (int k = 0; k < sp.Mu.Value; k++) {
-            c[i, j] += sp.CMU.Value * sp.Weights[k] * (offspring[k][i] - xold[i]) * (offspring[k][j] - xold[j]) / (sp.Sigma.Value * sp.Sigma.Value);
-          }
-          sp.C[i, j] = c[i, j];
-        }
-      }
-      sp.Sigma.Value = sp.Sigma.Value * Math.Exp((sp.CS.Value / damps) * (normPS / sp.ChiN.Value - 1));
-
-      double[] eval;
-      double[,] evec;
-      if (!alglib.smatrixevd(c, N, 1, false, out eval, out evec))
-        throw new InvalidOperationException("Unable to perform eigendecomposition of matrix.");
-
-      sp.B = new DoubleMatrix(evec);
-      for (int i = 0; i < sp.D.Length; i++)
-        sp.D[i] = Math.Sqrt(eval[i]);
-
-      for (int i = 0; i < N; i++) {
-        for (int j = 0; j < N; j++) {
-          sp.InvSqrtC[i, j] = 0;
-          var v = sp.B[i, j] * (1 / sp.D[j]);
-          for (int k = 0; k < N; k++) {
-            sp.InvSqrtC[i, j] += v * sp.B[k, j];
-          }
-        }
-      }
-      return base.Apply();
-    }
-  }
-}
Index: /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj
===================================================================
--- /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj	(revision 9117)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj	(revision 9118)
@@ -163,9 +163,9 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="CMAESOperators\CovarianceMatrixRecombinator.cs" />
-    <Compile Include="CMAESOperators\CovarianceMatrixStrategyParameters.cs" />
-    <Compile Include="CMAESOperators\CovarianceMatrixInitializer.cs" />
-    <Compile Include="CMAESOperators\CovarianceMatrixMutator.cs" />
-    <Compile Include="CMAESOperators\CovarianceMatrixUpdater.cs" />
+    <Compile Include="CMAESOperators\CMARecombinator.cs" />
+    <Compile Include="CMAESOperators\CMAParameters.cs" />
+    <Compile Include="CMAESOperators\CMAInitializer.cs" />
+    <Compile Include="CMAESOperators\CMAMutator.cs" />
+    <Compile Include="CMAESOperators\CMAUpdater.cs" />
     <Compile Include="Interfaces\IRealVectorMultiNeighborhoodShakingOperator.cs" />
     <Compile Include="ParticleOperators\RealVectorParticleCreator.cs" />
