Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAAnalyzer.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAAnalyzer.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAAnalyzer.cs	(revision 9129)
@@ -0,0 +1,120 @@
+﻿#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.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMAAnalyzer", "Analyzes the development of strategy parameters and visualizes the performance of CMA-ES.")]
+  [StorableClass]
+  public sealed class CMAAnalyzer : SingleSuccessorOperator, IAnalyzer {
+
+    public bool EnabledByDefault {
+      get { return false; }
+    }
+
+    #region Parameter Properties
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+
+    public IScopeTreeLookupParameter<RealVector> RealVectorParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+
+    public ILookupParameter<ResultCollection> ResultsParameter {
+      get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private CMAAnalyzer(bool deserializing) : base(deserializing) { }
+    private CMAAnalyzer(CMAAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public CMAAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The CMA strategy parameters to be analyzed."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector", "The real vector that is being optimized."));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection to store the results in."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAAnalyzer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var sp = StrategyParametersParameter.ActualValue;
+      var vector = RealVectorParameter.ActualValue[0];
+      var results = ResultsParameter.ActualValue;
+
+      DataTable axisRatio;
+      if (results.ContainsKey("AxisRatio")) {
+        axisRatio = (DataTable)results["AxisRatio"].Value;
+      } else {
+        axisRatio = new DataTable("AxisRatio");
+        axisRatio.Rows.Add(new DataRow("AxisRatio"));
+        results.Add(new Result("AxisRatio", axisRatio));
+      }
+      axisRatio.Rows["AxisRatio"].Values.Add(sp.AxisRatio.Value);
+
+      DataTable sigma;
+      if (results.ContainsKey("Sigma")) {
+        sigma = (DataTable)results["Sigma"].Value;
+      } else {
+        sigma = new DataTable("Sigma");
+        sigma.Rows.Add(new DataRow("Sigma"));
+        results.Add(new Result("Sigma", sigma));
+      }
+      sigma.Rows["Sigma"].Values.Add(sp.Sigma.Value);
+
+      DataTable scaling;
+      if (results.ContainsKey("Scaling")) {
+        scaling = (DataTable)results["Scaling"].Value;
+      } else {
+        scaling = new DataTable("Scaling");
+        for (int i = 0; i < sp.C.Rows; i++)
+          scaling.Rows.Add(new DataRow("Axis" + i.ToString()));
+        results.Add(new Result("Scaling", scaling));
+      }
+      for (int i = 0; i < sp.C.Rows; i++)
+        scaling.Rows["Axis" + i.ToString()].Values.Add(sp.D[i]);
+
+      DataTable realVector;
+      if (results.ContainsKey("RealVector")) {
+        realVector = (DataTable)results["RealVector"].Value;
+      } else {
+        realVector = new DataTable("RealVector");
+        for (int i = 0; i < vector.Length; i++)
+          realVector.Rows.Add(new DataRow("Axis" + i.ToString()));
+        results.Add(new Result("RealVector", realVector));
+      }
+      for (int i = 0; i < vector.Length; i++)
+        realVector.Rows["Axis" + i.ToString()].Values.Add(vector[i]);
+
+      return base.Apply();
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAEqualweightedRecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAEqualweightedRecombinator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAEqualweightedRecombinator.cs	(revision 9129)
@@ -0,0 +1,48 @@
+﻿#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;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMA Equal-weighted Recombinator", "Calculates weighted mean using equal weights.")]
+  [StorableClass]
+  public class CMAEqualweightedRecombinator : CMARecombinator {
+
+    [StorableConstructor]
+    protected CMAEqualweightedRecombinator(bool deserializing) : base(deserializing) { }
+    protected CMAEqualweightedRecombinator(CMAEqualweightedRecombinator original, Cloner cloner) : base(original, cloner) { }
+    public CMAEqualweightedRecombinator() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAEqualweightedRecombinator(this, cloner);
+    }
+
+    protected override DoubleArray GetWeights(int mu) {
+      var weights = new DoubleArray(mu);
+      for (int i = 0; i < mu; i++)
+        weights[i] = 1.0 / mu;
+      return weights;
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAInitializer.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAInitializer.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAInitializer.cs	(revision 9129)
@@ -0,0 +1,187 @@
+﻿#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.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMAInitializer", "Initializes the covariance matrix and step size variables.")]
+  [StorableClass]
+  public class CMAInitializer : SingleSuccessorOperator, ICMAInitializer, 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<DoubleMatrix> SigmaBoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["SigmaBounds"]; }
+    }
+
+    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."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("SigmaBounds", "The bounds for sigma value can be omitted, given as one value for all dimensions or a value for each dimension. First column specifies minimum, second column maximum value."));
+      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.", new IntValue(0)));
+      Parameters.Add(new LookupParameter<IntValue>("PopulationSize", "The population size (lambda)."));
+      Parameters.Add(new LookupParameter<IntValue>("Mu", "Optional, 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 mu = MuParameter.ActualValue;
+
+      var sp = new CMAParameters();
+      sp.Mu = mu == null ? new IntValue((int)Math.Floor(lambda / 2.0)) : new IntValue(mu.Value);
+      sp.QualityHistorySize = 10 + 30 * N / lambda;
+      sp.QualityHistory = new Queue<double>(sp.QualityHistorySize + 1);
+
+      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 sigmaBounds = SigmaBoundsParameter.ActualValue;
+      if (sigmaBounds != null && sigmaBounds.Rows > 0) {
+        for (int i = 0; i < N; i++) {
+          var d = sigmaBounds[Math.Min(i, sigmaBounds.Rows - 1), 0];
+          if (d > sigma * minSqrtdiagC) sigma = d / minSqrtdiagC;
+        }
+        for (int i = 0; i < N; i++) {
+          var d = sigmaBounds[Math.Min(i, sigmaBounds.Rows - 1), 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 (sigmaBounds != null) sp.SigmaBounds = (DoubleMatrix)sigmaBounds.Clone();
+      sp.InitialIterations = new IntValue(initialIterations.Value);
+
+      StrategyParametersParameter.ActualValue = sp;
+      return base.Apply();
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALinearweightedRecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALinearweightedRecombinator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALinearweightedRecombinator.cs	(revision 9129)
@@ -0,0 +1,49 @@
+﻿#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;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMA Linear-weighted Recombinator", "Calculates weighted mean using linear increasing weights.")]
+  [StorableClass]
+  public class CMALinearweightedRecombinator : CMARecombinator {
+
+    [StorableConstructor]
+    protected CMALinearweightedRecombinator(bool deserializing) : base(deserializing) { }
+    protected CMALinearweightedRecombinator(CMALinearweightedRecombinator original, Cloner cloner) : base(original, cloner) { }
+    public CMALinearweightedRecombinator() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMALinearweightedRecombinator(this, cloner);
+    }
+
+    protected override DoubleArray GetWeights(int mu) {
+      var weights = new DoubleArray(mu);
+      var sum = (mu + 1) * mu / 2.0; // sum of arithmetic progression mu..1
+      for (int i = 0; i < mu; i++)
+        weights[i] = (mu - i) / sum;
+      return weights;
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALogweightedRecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALogweightedRecombinator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMALogweightedRecombinator.cs	(revision 9129)
@@ -0,0 +1,51 @@
+﻿#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.Linq;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMA Log-weighted Recombinator", "Calculates weighted mean based on a logarithmic increasing weights.")]
+  [StorableClass]
+  public class CMALogweightedRecombinator : CMARecombinator {
+
+    [StorableConstructor]
+    protected CMALogweightedRecombinator(bool deserializing) : base(deserializing) { }
+    protected CMALogweightedRecombinator(CMALogweightedRecombinator original, Cloner cloner) : base(original, cloner) { }
+    public CMALogweightedRecombinator() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMALogweightedRecombinator(this, cloner);
+    }
+
+    protected override DoubleArray GetWeights(int mu) {
+      var weights = new DoubleArray(mu);
+      for (int i = 0; i < mu; i++) weights[i] = Math.Log((mu + 1.0) / (i + 1.0));
+      var sum = weights.Sum();
+      for (int i = 0; i < mu; i++) weights[i] /= sum;
+      return weights;
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAMutator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAMutator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAMutator.cs	(revision 9129)
@@ -0,0 +1,152 @@
+﻿#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.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Random;
+using System;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMAMutator", "Mutates the solution vector according to the CMA-ES scheme.")]
+  [StorableClass]
+  public sealed class CMAMutator : SingleSuccessorOperator, IStochasticOperator, ICMAManipulator, IIterationBasedOperator {
+
+    public Type CMAType {
+      get { return typeof(CMAParameters); }
+    }
+
+    #region Parameter Properties
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+
+    public ILookupParameter<IntValue> PopulationSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; }
+    }
+
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+
+    public ILookupParameter<RealVector> MeanParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Mean"]; }
+    }
+
+    public IScopeTreeLookupParameter<RealVector> RealVectorParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+
+    public IValueParameter<IntValue> MaxTriesParameter {
+      get { return (IValueParameter<IntValue>)Parameters["MaxTries"]; }
+    }
+    #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>("PopulationSize", "The population size (lambda) determines how many offspring should be created."));
+      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>("Mean", "The current mean solution."));
+      Parameters.Add(new ScopeTreeLookupParameter<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."));
+      Parameters.Add(new ValueParameter<IntValue>("MaxTries", "The maximum number of tries a mutation should be performed if it was outside the bounds.", new IntValue(1000)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CMAMutator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var maxTries = MaxTriesParameter.Value.Value;
+      var random = RandomParameter.ActualValue;
+      var lambda = PopulationSizeParameter.ActualValue.Value;
+      var xmean = MeanParameter.ActualValue;
+      var arx = RealVectorParameter.ActualValue;
+      var sp = StrategyParametersParameter.ActualValue;
+      var iterations = IterationsParameter.ActualValue.Value;
+      var initialIterations = sp.InitialIterations.Value;
+      var bounds = BoundsParameter.ActualValue;
+
+      if (arx == null || arx.Length == 0) {
+        arx = new ItemArray<RealVector>(lambda);
+        for (int i = 0; i < lambda; i++) arx[i] = new RealVector(xmean.Length);
+        RealVectorParameter.ActualValue = arx;
+      }
+      var nd = new NormalDistributedRandom(random, 0, 1);
+
+      for (int i = 0; i < lambda; i++) {
+        int tries = 0;
+        if (initialIterations > iterations) {
+          for (int k = 0; k < arx[i].Length; k++) {
+            do {
+              tries++;
+              arx[i][k] = xmean[k] + sp.Sigma.Value * sp.D[k] * nd.NextDouble();
+            } while ((bounds[k % bounds.Rows, 0] > arx[i][k] || arx[i][k] > bounds[k % bounds.Rows, 1]) && tries < maxTries);
+          }
+        } else {
+          bool inRange;
+          var B = sp.B;
+          tries = 0;
+          do {
+            tries++;
+            inRange = true;
+            var artmp = new double[arx[0].Length];
+            for (int k = 0; k < arx[0].Length; ++k)
+              artmp[k] = sp.D[k] * nd.NextDouble();
+
+            for (int k = 0; k < arx[0].Length; k++) {
+              var sum = 0.0;
+              for (int j = 0; j < arx[0].Length; j++)
+                sum += B[k, j] * artmp[j];
+              arx[i][k] = xmean[k] + sp.Sigma.Value * sum; // m + sig * Normal(0,C) 
+              if (bounds[k % bounds.Rows, 0] > arx[i][k] || arx[i][k] > bounds[k % bounds.Rows, 1])
+                inRange = false;
+            }
+          } while (!inRange && tries < maxTries);
+        }
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMARecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMARecombinator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMARecombinator.cs	(revision 9129)
@@ -0,0 +1,91 @@
+﻿#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.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMARecombinator", "Base class that calculates the weighted mean of a number of offspring.")]
+  [StorableClass]
+  public abstract class CMARecombinator : SingleSuccessorOperator, ICMARecombinator {
+
+    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<RealVector> OldMeanParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["OldMean"]; }
+    }
+
+    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) { }
+    protected 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<RealVector>("OldMean", "The old mean solution."));
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The CMA-ES strategy parameters used for mutation."));
+      OffspringParameter.ActualName = "RealVector";
+      MeanParameter.ActualName = "XMean";
+      OldMeanParameter.ActualName = "XOld";
+    }
+
+    public override IOperation Apply() {
+      var sp = StrategyParametersParameter.ActualValue;
+      if (sp.Weights == null) sp.Weights = GetWeights(sp.Mu.Value);
+
+      var offspring = OffspringParameter.ActualValue;
+      var mean = new RealVector(offspring[0].Length);
+      for (int i = 0; i < mean.Length; i++) {
+        for (int j = 0; j < sp.Mu.Value; j++)
+          mean[i] += sp.Weights[j] * offspring[j][i];
+      }
+
+      var oldMean = MeanParameter.ActualValue;
+      MeanParameter.ActualValue = mean;
+      OldMeanParameter.ActualValue = oldMean;
+      return base.Apply();
+    }
+
+    protected abstract DoubleArray GetWeights(int mu);
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAUpdater.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAUpdater.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAOperators/CMAUpdater.cs	(revision 9129)
@@ -0,0 +1,256 @@
+﻿#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.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMAUpdater", "Updates the covariance matrix and strategy parameters of CMA-ES.")]
+  [StorableClass]
+  public class CMAUpdater : SingleSuccessorOperator, ICMAUpdater, IIterationBasedOperator {
+
+    public Type CMAType {
+      get { return typeof(CMAParameters); }
+    }
+
+    #region Parameter Properties
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+
+    public ILookupParameter<RealVector> MeanParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Mean"]; }
+    }
+
+    public ILookupParameter<RealVector> OldMeanParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["OldMean"]; }
+    }
+
+    public IScopeTreeLookupParameter<RealVector> OffspringParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Offspring"]; }
+    }
+
+    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumEvaluatedSolutionsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
+    }
+
+    public ILookupParameter<BoolValue> DegenerateStateParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters["DegenerateState"]; }
+    }
+    #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 LookupParameter<RealVector>("Mean", "The new mean."));
+      Parameters.Add(new LookupParameter<RealVector>("OldMean", "The old mean."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Offspring", "The created offspring solutions."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the offspring."));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The number of iterations passed."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions."));
+      Parameters.Add(new LookupParameter<BoolValue>("DegenerateState", "Whether the algorithm state has degenerated and should be terminated."));
+      MeanParameter.ActualName = "XMean";
+      OldMeanParameter.ActualName = "XOld";
+      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 = OldMeanParameter.ActualValue;
+      var xmean = MeanParameter.ActualValue;
+      var offspring = OffspringParameter.ActualValue;
+      var quality = QualityParameter.ActualValue;
+      var lambda = offspring.Length;
+
+      var N = xmean.Length;
+      var sp = StrategyParametersParameter.ActualValue;
+
+      #region Initialize default values for strategy parameter adjustment
+      if (sp.ChiN == null) sp.ChiN = new DoubleValue(Math.Sqrt(N) * (1.0 - 1.0 / (4.0 * N) + 1.0 / (21.0 * N * N)));
+      if (sp.MuEff == null) sp.MuEff = new DoubleValue(sp.Weights.Sum() * sp.Weights.Sum() / sp.Weights.Sum(x => x * x));
+      if (sp.CS == null) sp.CS = new DoubleValue((sp.MuEff.Value + 2) / (N + sp.MuEff.Value + 3));
+      if (sp.Damps == null) {
+        var maxIterations = MaximumIterationsParameter.ActualValue.Value;
+        var maxEvals = MaximumEvaluatedSolutionsParameter.ActualValue.Value;
+        sp.Damps = new DoubleValue(2 * Math.Max(0, Math.Sqrt((sp.MuEff.Value - 1) / (N + 1)) - 1)
+                                * Math.Max(0.3, 1 - N / (1e-6 + Math.Min(maxIterations, maxEvals / lambda))) + sp.CS.Value + 1);
+      }
+      if (sp.CC == null) sp.CC = new DoubleValue(4.0 / (N + 4));
+      if (sp.MuCov == null) sp.MuCov = new DoubleValue(sp.MuEff.Value);
+      if (sp.CCov == null) sp.CCov = new DoubleValue(2.0 / ((N + 1.41) * (N + 1.41) * sp.MuCov.Value)
+                             + (1 - (1.0 / sp.MuCov.Value)) * Math.Min(1, (2 * sp.MuEff.Value - 1) / (sp.MuEff.Value + (N + 2) * (N + 2))));
+      if (sp.CCovSep == null) sp.CCovSep = new DoubleValue(Math.Min(1, sp.CCov.Value * (N + 1.5) / 3));
+      #endregion
+
+      sp.QualityHistory.Enqueue(quality[0].Value);
+      while (sp.QualityHistory.Count > sp.QualityHistorySize && sp.QualityHistorySize >= 0)
+        sp.QualityHistory.Dequeue();
+
+      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.SigmaBounds != null && sp.SigmaBounds.Rows > 0) {
+        for (int i = 0; i < N; i++) {
+          var d = sp.SigmaBounds[Math.Min(i, sp.SigmaBounds.Rows - 1), 0];
+          if (d > sp.Sigma.Value * minSqrtdiagC) sp.Sigma.Value = d / minSqrtdiagC;
+        }
+        for (int i = 0; i < N; i++) {
+          var d = sp.SigmaBounds[Math.Min(i, sp.SigmaBounds.Rows - 1), 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;
+        var success = alglib.smatrixevd(c, N, 1, false, out eVal, out eVec);
+        DegenerateStateParameter.ActualValue = new BoolValue(!success);
+        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: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAParameters.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAParameters.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAParameters.cs	(revision 9129)
@@ -0,0 +1,308 @@
+﻿#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.Collections.Generic;
+using System.ComponentModel;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  [Item("CMAParameters", "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 DoubleMatrix sigmaBounds;
+    public DoubleMatrix SigmaBounds {
+      get { return sigmaBounds; }
+      set {
+        if (sigmaBounds == value) return;
+        sigmaBounds = value;
+        OnPropertyChanged("SigmaBounds");
+      }
+    }
+
+    [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 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");
+      }
+    }
+
+    [Storable]
+    private Queue<double> qualityHistory;
+    public Queue<double> QualityHistory {
+      get { return qualityHistory; }
+      set { qualityHistory = value; }
+    }
+
+    [Storable]
+    private int qualityHistorySize;
+    public int QualityHistorySize {
+      get { return qualityHistorySize; }
+      set { qualityHistorySize = value; }
+    }
+
+    [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.bDz = cloner.Clone(original.bDz);
+      this.c = cloner.Clone(original.c);
+      this.cCov = cloner.Clone(original.cCov);
+      this.cCovSep = cloner.Clone(original.cCovSep);
+      this.cc = cloner.Clone(original.cc);
+      this.chiN = cloner.Clone(original.chiN);
+      this.cs = cloner.Clone(original.cs);
+      this.d = cloner.Clone(original.d);
+      this.damps = cloner.Clone(original.damps);
+      this.initialIterations = cloner.Clone(original.initialIterations);
+      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.sigmaBounds = cloner.Clone(original.sigmaBounds);
+      this.weights = cloner.Clone(original.weights);
+
+      this.qualityHistory = new Queue<double>(original.qualityHistory);
+      this.qualityHistorySize = original.qualityHistorySize;
+    }
+    public CMAParameters() { }
+
+    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.Algorithms.CMAEvolutionStrategy/3.3/HeuristicLab.Algorithms.CMAEvolutionStrategy-3.3.csproj
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/HeuristicLab.Algorithms.CMAEvolutionStrategy-3.3.csproj	(revision 9128)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/HeuristicLab.Algorithms.CMAEvolutionStrategy-3.3.csproj	(revision 9129)
@@ -93,4 +93,9 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="ALGLIB-3.6.0, Version=3.6.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.6.0.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
     <Reference Include="HeuristicLab.Analysis-3.3">
       <SpecificVersion>False</SpecificVersion>
@@ -157,4 +162,5 @@
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
+    <Reference Include="System.Drawing" />
     <Reference Include="System.Xml.Linq">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -167,8 +173,21 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="CMAAnalyzer.cs" />
+    <Compile Include="CMAOperators\CMAInitializer.cs" />
+    <Compile Include="CMAOperators\CMALogweightedRecombinator.cs" />
+    <Compile Include="CMAOperators\CMAMutator.cs" />
+    <Compile Include="CMAOperators\CMALinearweightedRecombinator.cs" />
+    <Compile Include="CMAOperators\CMAEqualweightedRecombinator.cs" />
+    <Compile Include="CMAParameters.cs" />
+    <Compile Include="CMAOperators\CMARecombinator.cs" />
+    <Compile Include="CMAOperators\CMAUpdater.cs" />
+    <Compile Include="Interfaces\ICMAInitializer.cs" />
+    <Compile Include="Interfaces\ICMAManipulator.cs" />
+    <Compile Include="Interfaces\ICMARecombinator.cs" />
+    <Compile Include="Interfaces\ICMAUpdater.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="CMAEvolutionStrategy.cs" />
-    <Compile Include="CMAEvolutionStrategyMainLoop.cs" />
+    <Compile Include="Terminator.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -195,4 +214,9 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Encodings.RealVectorEncoding\3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj">
+      <Project>{bb6d334a-4bb6-4674-9883-31a6ebb32cab}</Project>
+      <Name>HeuristicLab.Encodings.RealVectorEncoding-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
       <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
@@ -201,4 +225,5 @@
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/HeuristicLab.Algorithms.CMAEvolutionStrategy-3.3.csproj.DotSettings
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/HeuristicLab.Algorithms.CMAEvolutionStrategy-3.3.csproj.DotSettings	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/HeuristicLab.Algorithms.CMAEvolutionStrategy-3.3.csproj.DotSettings	(revision 9129)
@@ -0,0 +1,3 @@
+﻿<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+	<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=CMAOperators/@EntryIndexedValue">True</s:Boolean>
+	<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Interfaces/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAInitializer.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAInitializer.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAInitializer.cs	(revision 9129)
@@ -0,0 +1,38 @@
+﻿#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.Core;
+using HeuristicLab.Data;
+using System;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  public interface ICMAInitializer : IOperator {
+    Type CMAType { get; }
+
+    ILookupParameter<IntValue> PopulationSizeParameter { get; }
+    ILookupParameter<IntValue> MuParameter { get; }
+    IValueLookupParameter<IntValue> InitialIterationsParameter { get; }
+    IValueLookupParameter<IntValue> DimensionParameter { get; }
+    IValueLookupParameter<DoubleArray> InitialSigmaParameter { get; }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAManipulator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAManipulator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAManipulator.cs	(revision 9129)
@@ -0,0 +1,38 @@
+﻿#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.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using System;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  public interface ICMAManipulator : IOperator {
+    Type CMAType { get; }
+
+    ILookupParameter<IntValue> PopulationSizeParameter { get; }
+    ILookupParameter<RealVector> MeanParameter { get; }
+    IScopeTreeLookupParameter<RealVector> RealVectorParameter { get; }
+    IValueLookupParameter<DoubleMatrix> BoundsParameter { get; }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMARecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMARecombinator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMARecombinator.cs	(revision 9129)
@@ -0,0 +1,36 @@
+﻿#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.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using System;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  public interface ICMARecombinator : IOperator {
+    Type CMAType { get; }
+
+    IScopeTreeLookupParameter<RealVector> OffspringParameter { get; }
+    ILookupParameter<RealVector> MeanParameter { get; }
+    ILookupParameter<RealVector> OldMeanParameter { get; }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAUpdater.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAUpdater.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Interfaces/ICMAUpdater.cs	(revision 9129)
@@ -0,0 +1,40 @@
+﻿#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.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using System;
+
+namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
+  public interface ICMAUpdater : IOperator {
+    Type CMAType { get; }
+
+    ILookupParameter<RealVector> MeanParameter { get; }
+    ILookupParameter<RealVector> OldMeanParameter { get; }
+    IScopeTreeLookupParameter<RealVector> OffspringParameter { get; }
+    IScopeTreeLookupParameter<DoubleValue> QualityParameter { get; }
+    IValueLookupParameter<IntValue> MaximumEvaluatedSolutionsParameter { get; }
+    ILookupParameter<BoolValue> DegenerateStateParameter { get; }
+  }
+}
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Properties/AssemblyInfo.cs.frame	(revision 9128)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Properties/AssemblyInfo.cs.frame	(revision 9129)
@@ -27,5 +27,5 @@
 // associated with an assembly.
 [assembly: AssemblyTitle("HeuristicLab.Algorithms.CMAEvolutionStrategy")]
-[assembly: AssemblyDescription("HeuristicLab CMA Evolution Strategy (CMA-ES)")]
+[assembly: AssemblyDescription("HeuristicLab implementation of CMA Evolution Strategy (CMA-ES)")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
Index: /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Terminator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Terminator.cs	(revision 9129)
+++ /branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/Terminator.cs	(revision 9129)
@@ -0,0 +1,187 @@
+﻿#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.Algorithms.CMAEvolutionStrategy {
+  [Item("Terminator", "Decides if the algorithm should terminate or not.")]
+  [StorableClass]
+  public class Terminator : Operator, IIterationBasedOperator {
+
+    protected OperatorParameter ContinueParameter {
+      get { return (OperatorParameter)Parameters["Continue"]; }
+    }
+    protected OperatorParameter TerminateParameter {
+      get { return (OperatorParameter)Parameters["Terminate"]; }
+    }
+
+    public IOperator Continue {
+      get { return ContinueParameter.Value; }
+      set { ContinueParameter.Value = value; }
+    }
+
+    public IOperator Terminate {
+      get { return TerminateParameter.Value; }
+      set { TerminateParameter.Value = value; }
+    }
+
+    public IValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+
+    public ILookupParameter<CMAParameters> StrategyParametersParameter {
+      get { return (ILookupParameter<CMAParameters>)Parameters["StrategyParameters"]; }
+    }
+
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+
+    public ILookupParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
+    }
+
+    public IValueLookupParameter<IntValue> MaximumEvaluatedSolutionsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
+    }
+
+    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public IValueLookupParameter<DoubleValue> TargetQualityParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["TargetQuality"]; }
+    }
+
+    public IValueLookupParameter<DoubleValue> MinimumQualityChangeParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["MinimumQualityChange"]; }
+    }
+
+    public IValueLookupParameter<DoubleValue> MinimumQualityHistoryChangeParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["MinimumQualityHistoryChange"]; }
+    }
+
+    public IValueLookupParameter<DoubleValue> MinimumStandardDeviationParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["MinimumStandardDeviation"]; }
+    }
+
+    public ILookupParameter<DoubleArray> InitialSigmaParameter {
+      get { return (ILookupParameter<DoubleArray>)Parameters["InitialSigma"]; }
+    }
+
+    public IValueLookupParameter<DoubleValue> MaximumStandardDeviationChangeParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["MaximumStandardDeviationChange"]; }
+    }
+
+    public ILookupParameter<BoolValue> DegenerateStateParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters["DegenerateState"]; }
+    }
+
+    [StorableConstructor]
+    protected Terminator(bool deserializing) : base(deserializing) { }
+    protected Terminator(Terminator original, Cloner cloner)
+      : base(original, cloner) { }
+    public Terminator() {
+      Parameters.Add(new OperatorParameter("Continue", "The operator that is executed if the stop conditions have not been met!"));
+      Parameters.Add(new OperatorParameter("Terminate", "The operator that is executed if the stop conditions have been met!"));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is to be maximized and false otherwise."));
+      Parameters.Add(new LookupParameter<CMAParameters>("StrategyParameters", "The CMA-ES strategy parameters."));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The number of iterations passed."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations."));
+      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the offspring."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("TargetQuality", "(stopFitness) Surpassing this quality value terminates the algorithm."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MinimumQualityChange", "(stopTolFun) If the range of fitness values is less than a certain value the algorithm terminates (set to 0 or positive value to enable)."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MinimumQualityHistoryChange", "(stopTolFunHist) If the range of fitness values is less than a certain value for a certain time the algorithm terminates (set to 0 or positive to enable)."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MinimumStandardDeviation", "(stopTolXFactor) If the standard deviation falls below a certain value the algorithm terminates (set to 0 or positive to enable)."));
+      Parameters.Add(new LookupParameter<DoubleArray>("InitialSigma", "The initial value for Sigma."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumStandardDeviationChange", "(stopTolUpXFactor) If the standard deviation changes by a value larger than this parameter the algorithm stops (set to a value > 0 to enable)."));
+      Parameters.Add(new LookupParameter<BoolValue>("DegenerateState", "Whether the algorithm state has degenerated and should be terminated."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Terminator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var terminateOp = Terminate != null ? ExecutionContext.CreateOperation(Terminate) : null;
+
+      var degenerated = DegenerateStateParameter.ActualValue.Value;
+      if (degenerated) return terminateOp;
+
+      var iterations = IterationsParameter.ActualValue.Value;
+      var maxIterations = MaximumIterationsParameter.ActualValue.Value;
+      if (iterations >= maxIterations) return terminateOp;
+
+      var evals = EvaluatedSolutionsParameter.ActualValue.Value;
+      var maxEvals = MaximumEvaluatedSolutionsParameter.ActualValue.Value;
+      if (evals >= maxEvals) return terminateOp;
+
+      var maximization = MaximizationParameter.ActualValue.Value;
+      var bestQuality = QualityParameter.ActualValue.First().Value;
+      var targetQuality = TargetQualityParameter.ActualValue.Value;
+      if (iterations > 1 && (maximization && bestQuality >= targetQuality
+        || !maximization && bestQuality <= targetQuality)) return terminateOp;
+
+      var sp = StrategyParametersParameter.ActualValue;
+      var worstQuality = QualityParameter.ActualValue.Last().Value;
+      var minHist = sp.QualityHistory.Min();
+      var maxHist = sp.QualityHistory.Max();
+      var change = Math.Max(maxHist, Math.Max(bestQuality, worstQuality))
+                   - Math.Min(minHist, Math.Min(bestQuality, worstQuality));
+      var stopTolFun = MinimumQualityChangeParameter.ActualValue.Value;
+      if (change <= stopTolFun) return terminateOp;
+
+      if (iterations > sp.QualityHistorySize &&
+          maxHist - minHist <= MinimumQualityHistoryChangeParameter.ActualValue.Value)
+        return terminateOp;
+
+      double minSqrtdiagC = int.MaxValue, maxSqrtdiagC = int.MinValue;
+      for (int i = 0; i < sp.C.Rows; 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]);
+      }
+
+      var tolx = MinimumStandardDeviationParameter.ActualValue.Value;
+      if (sp.Sigma.Value * maxSqrtdiagC < tolx
+          && sp.Sigma.Value * sp.PC.Select(x => Math.Abs(x)).Max() < tolx) return terminateOp;
+
+      var stopTolUpXFactor = MaximumStandardDeviationChangeParameter.ActualValue.Value;
+      if (sp.Sigma.Value * maxSqrtdiagC > stopTolUpXFactor * InitialSigmaParameter.ActualValue.Max())
+        return terminateOp;
+
+      return Continue != null ? ExecutionContext.CreateOperation(Continue) : null;
+    }
+  }
+}
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 9128)
+++ /branches/CMAES/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj	(revision 9129)
@@ -99,9 +99,4 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="ALGLIB-3.6.0, Version=3.6.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.6.0.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
     <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -173,10 +168,4 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="CMAESOperators\CMAAnalyzer.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" />
Index: /branches/CMAES/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
===================================================================
--- /branches/CMAES/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 9128)
+++ /branches/CMAES/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 9129)
@@ -154,8 +154,4 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Interfaces\ICMAESRecombinator.cs" />
-    <Compile Include="Interfaces\ICMAESManipulator.cs" />
-    <Compile Include="Interfaces\ICMAESUpdater.cs" />
-    <Compile Include="Interfaces\ICMAESInitializer.cs" />
     <Compile Include="Interfaces\ISingleObjectivePathRelinker.cs" />
     <Compile Include="Interfaces\ISingleObjectiveImprovementOperator.cs" />
Index: anches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESInitializer.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESInitializer.cs	(revision 9128)
+++ 	(revision )
@@ -1,36 +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.Core;
-using HeuristicLab.Data;
-using System;
-
-namespace HeuristicLab.Optimization {
-  public interface ICMAESInitializer : IOperator {
-    Type CMAType { get; }
-
-    ILookupParameter<IntValue> PopulationSizeParameter { get; }
-    ILookupParameter<IntValue> MuParameter { get; }
-    IValueLookupParameter<DoubleArray> InitialSigmaParameter { get; }
-  }
-}
Index: anches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESManipulator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESManipulator.cs	(revision 9128)
+++ 	(revision )
@@ -1,31 +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.Core;
-using System;
-
-namespace HeuristicLab.Optimization {
-  public interface ICMAESManipulator : IOperator {
-    Type CMAType { get; }
-  }
-}
Index: anches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESRecombinator.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESRecombinator.cs	(revision 9128)
+++ 	(revision )
@@ -1,31 +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.Core;
-using System;
-
-namespace HeuristicLab.Optimization {
-  public interface ICMAESRecombinator : IOperator {
-    Type CMAType { get; }
-  }
-}
Index: anches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESUpdater.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Optimization/3.3/Interfaces/ICMAESUpdater.cs	(revision 9128)
+++ 	(revision )
@@ -1,31 +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.Core;
-using System;
-
-namespace HeuristicLab.Optimization {
-  public interface ICMAESUpdater : IOperator {
-    Type CMAType { get; }
-  }
-}
Index: /branches/CMAES/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
===================================================================
--- /branches/CMAES/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs	(revision 9128)
+++ /branches/CMAES/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs	(revision 9129)
@@ -401,22 +401,4 @@
         op.Bounds = Bounds;
       }
-      foreach (var op in Operators.OfType<CMAInitializer>()) {
-        op.DimensionParameter.ActualName = ProblemSizeParameter.Name;
-      }
-      foreach (var op in Operators.OfType<CMAMutator>()) {
-        op.BoundsParameter.ActualName = BoundsParameter.Name;
-        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-      }
-      foreach (var op in Operators.OfType<CMARecombinator>()) {
-        op.MeanParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-        op.OffspringParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-      }
-      foreach (var op in Operators.OfType<CMAUpdater>()) {
-        op.MeansParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-        op.OffspringParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-      }
-      foreach (var op in Operators.OfType<CMAAnalyzer>()) {
-        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-      }
     }
     private void UpdateStrategyVectorBounds() {
