Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Analyzers/BestMovingPeaksBenchmarkSolutionAnalyzer.cs
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Analyzers/BestMovingPeaksBenchmarkSolutionAnalyzer.cs	(revision 16609)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Analyzers/BestMovingPeaksBenchmarkSolutionAnalyzer.cs	(revision 16609)
@@ -0,0 +1,146 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 System;
+using System.Linq;
+using HeuristicLab.Analysis;
+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;
+
+namespace HeuristicLab.Problems.MovingPeaksBenchmark {
+  /// <summary>
+  /// An operator for analyzing the best solution for a SingleObjectiveTestFunction problem.
+  /// </summary>
+  [Item("BestMovingPeaksBenchmarkSolutionAnalyzer", "An operator for analyzing the best solution for a Moving Peaks Benchmark problem.")]
+  [StorableClass]
+  public class BestMovingPeaksBenchmarkSolutionAnalyzer : SingleSuccessorOperator, IBestMovingPeaksBenchmarkSolutionAnalyzer {
+    public virtual bool EnabledByDefault {
+      get { return true; }
+    }
+
+    public LookupParameter<BoolValue> MaximizationParameter {
+      get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ScopeTreeLookupParameter<RealVector> RealVectorParameter {
+      get { return (ScopeTreeLookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+    ILookupParameter IBestMovingPeaksBenchmarkSolutionAnalyzer.RealVectorParameter {
+      get { return RealVectorParameter; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+    ILookupParameter IBestMovingPeaksBenchmarkSolutionAnalyzer.QualityParameter {
+      get { return QualityParameter; }
+    }
+    public ILookupParameter<RealVector> BestKnownSolutionParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestKnownSolution"]; }
+    }
+    public ILookupParameter<DoubleValue> BestKnownQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
+    }
+    public IValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+
+    [StorableConstructor]
+    protected BestMovingPeaksBenchmarkSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected BestMovingPeaksBenchmarkSolutionAnalyzer(BestMovingPeaksBenchmarkSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public BestMovingPeaksBenchmarkSolutionAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector", "The SingleObjectiveTestFunction solutions from which the best solution should be visualized."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the SingleObjectiveTestFunction solutions which should be visualized."));
+      Parameters.Add(new LookupParameter<RealVector>("BestKnownSolution", "The best known solution."));
+      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution."));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the SingleObjectiveTestFunction solution should be stored."));
+
+      MaximizationParameter.Hidden = true;
+      RealVectorParameter.Hidden = true;
+      QualityParameter.Hidden = true;
+      BestKnownSolutionParameter.Hidden = true;
+      BestKnownQualityParameter.Hidden = true;
+      ResultsParameter.Hidden = true;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BestMovingPeaksBenchmarkSolutionAnalyzer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      ItemArray<RealVector> realVectors = RealVectorParameter.ActualValue;
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      bool max = MaximizationParameter.ActualValue.Value;
+      DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue;
+
+      int i = -1;
+      if (!max) i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
+      else i = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index;
+
+      if (bestKnownQuality == null ||
+          max && qualities[i].Value > bestKnownQuality.Value
+          || !max && qualities[i].Value < bestKnownQuality.Value) {
+        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value);
+        BestKnownSolutionParameter.ActualValue = (RealVector)realVectors[i].Clone();
+      }
+
+      RealVector best = (RealVector)realVectors[i].Clone();
+      RealVector bestKnown = (RealVector)BestKnownSolutionParameter.ActualValue.Clone();
+      ResultCollection results = ResultsParameter.ActualValue;
+      IResult bestSolution, bestKnownSolution;
+      if (!results.TryGetValue("Best Solution", out bestSolution)) {
+        bestSolution = new Result("Best Solution", best);
+        results.Add(bestSolution);
+      } else {
+        bestSolution.Value = best;
+      }
+      if (!results.TryGetValue("Best Known Solution", out bestKnownSolution)) {
+        bestKnownSolution = new Result("Best Known Solution", bestKnown);
+        results.Add(bestKnownSolution);
+      } else {
+        bestKnownSolution.Value = bestKnown;
+      }
+
+      double distanceToOptimum = 0;
+      for (int j = 0; j < best.Length; j++) {
+        distanceToOptimum += (best[j] - bestKnown[j]) * (best[j] - bestKnown[j]);
+      }
+      distanceToOptimum = Math.Sqrt(distanceToOptimum);
+
+      IResult distanceTable;
+      if (!results.TryGetValue("Distance to Optimum", out distanceTable)) {
+        DataTable table = new DataTable("Distance to Optimum");
+        table.Rows.Add(new DataRow("Distance to Optimum"));
+        distanceTable = new Result("Distance to Optimum", table);
+        results.Add(distanceTable);
+      }
+      (distanceTable.Value as DataTable).Rows["Distance to Optimum"].Values.Add(distanceToOptimum);
+
+      return base.Apply();
+    }
+  }
+}
Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/HeuristicLab.Problems.MovingPeaksBenchmark-3.3.csproj
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/HeuristicLab.Problems.MovingPeaksBenchmark-3.3.csproj	(revision 16608)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/HeuristicLab.Problems.MovingPeaksBenchmark-3.3.csproj	(revision 16609)
@@ -48,4 +48,6 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Analyzers\BestMovingPeaksBenchmarkSolutionAnalyzer.cs" />
+    <Compile Include="Interfaces\IBestMovingPeaksBenchmarkSolutionAnalyzer.cs" />
     <Compile Include="Interfaces\IMovingPeaksBenchmarkProblemEvaluator.cs" />
     <Compile Include="MovingPeaksBenchmarkProblem.cs" />
@@ -60,4 +62,8 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
+      <Project>{887425b4-4348-49ed-a457-b7d2c26ddbf9}</Project>
+      <Name>HeuristicLab.Analysis-3.3</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
       <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
@@ -100,4 +106,8 @@
       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{f4539fb6-4708-40c9-be64-0a1390aea197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Interfaces/IBestMovingPeaksBenchmarkSolutionAnalyzer.cs
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Interfaces/IBestMovingPeaksBenchmarkSolutionAnalyzer.cs	(revision 16609)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Interfaces/IBestMovingPeaksBenchmarkSolutionAnalyzer.cs	(revision 16609)
@@ -0,0 +1,34 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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.Optimization;
+
+namespace HeuristicLab.Problems.MovingPeaksBenchmark {
+  /// <summary>
+  /// An interface which represents operators for analyzing the best solution of Moving Peaks Benchmark problems given in real vector representation.
+  /// </summary>
+  public interface IBestMovingPeaksBenchmarkSolutionAnalyzer : IAnalyzer, ISingleObjectiveOperator {
+    ILookupParameter RealVectorParameter { get; }
+    ILookupParameter QualityParameter { get; }
+    IValueLookupParameter<ResultCollection> ResultsParameter { get; }
+  }
+}
Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Interfaces/IMovingPeaksBenchmarkProblemEvaluator.cs
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Interfaces/IMovingPeaksBenchmarkProblemEvaluator.cs	(revision 16608)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Interfaces/IMovingPeaksBenchmarkProblemEvaluator.cs	(revision 16609)
@@ -30,7 +30,7 @@
   /// </summary>
   public interface IMovingPeaksBenchmarkProblemEvaluator : ISingleObjectiveEvaluator {
-    ILookupParameter<DoubleMatrix> PeakLocationsParameter { get; }
-    ILookupParameter<DoubleArray> PeakWidthsParameter { get; }
-    ILookupParameter<DoubleArray> PeakHeightsParameter { get; }
+    IValueLookupParameter<DoubleMatrix> PeakLocationsParameter { get; }
+    IValueLookupParameter<DoubleArray> PeakWidthsParameter { get; }
+    IValueLookupParameter<DoubleArray> PeakHeightsParameter { get; }
     ILookupParameter<RealVector> PointParameter { get; }
   }
Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblem.cs
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblem.cs	(revision 16608)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblem.cs	(revision 16609)
@@ -62,18 +62,18 @@
       get { return (ValueParameter<DoubleMatrix>)Parameters["InitialPeakLocations"]; }
     }
-    public ValueParameter<DoubleMatrix> PeakLocationsParameter {
-      get { return (ValueParameter<DoubleMatrix>)Parameters["PeakLocations"]; }
-    }
     public ValueParameter<DoubleArray> InitialPeakWidthsParameter {
       get { return (ValueParameter<DoubleArray>)Parameters["InitialPeakWidths"]; }
     }
-    public ValueParameter<DoubleArray> PeakWidthsParameter {
-      get { return (ValueParameter<DoubleArray>)Parameters["PeakWidths"]; }
-    }
     public ValueParameter<DoubleArray> InitialPeakHeightsParameter {
       get { return (ValueParameter<DoubleArray>)Parameters["InitialPeakHeights"]; }
     }
-    public ValueParameter<DoubleArray> PeakHeightsParameter {
-      get { return (ValueParameter<DoubleArray>)Parameters["PeakHeights"]; }
+    public FixedValueParameter<IntValue> MovingPeaksRandomSeedParameter {
+      get { return (FixedValueParameter<IntValue>)Parameters["MovingPeaksRandomSeed"]; }
+    }
+    public FixedValueParameter<IntValue> PeakMovementIntervalParameter {
+      get { return (FixedValueParameter<IntValue>)Parameters["PeakMovementInterval"]; }
+    }
+    public FixedValueParameter<DoubleValue> PeakMovementStrengthParameter {
+      get { return (FixedValueParameter<DoubleValue>)Parameters["PeakMovementStrength"]; }
     }
     public OptionalValueParameter<RealVector> BestKnownSolutionParameter {
@@ -99,27 +99,24 @@
       set { InitialPeakLocationsParameter.Value = value; }
     }
-    public DoubleMatrix PeakLocations {
-      get { return PeakLocationsParameter.Value; }
-      set { PeakLocationsParameter.Value = value; }
-    }
     public DoubleArray InitialPeakWidths {
       get { return InitialPeakWidthsParameter.Value; }
       set { InitialPeakWidthsParameter.Value = value; }
     }
-    public DoubleArray PeakWidths {
-      get { return PeakWidthsParameter.Value; }
-      set { PeakWidthsParameter.Value = value; }
-    }
     public DoubleArray InitialPeakHeights {
       get { return InitialPeakHeightsParameter.Value; }
       set { InitialPeakHeightsParameter.Value = value; }
     }
-    public DoubleArray PeakHeights {
-      get { return PeakHeightsParameter.Value; }
-      set { PeakHeightsParameter.Value = value; }
-    }
-    //    private BestSingleObjectiveTestFunctionSolutionAnalyzer BestSingleObjectiveTestFunctionSolutionAnalyzer {
-    //      get { return Operators.OfType<BestSingleObjectiveTestFunctionSolutionAnalyzer>().FirstOrDefault(); }
-    //    }
+    public IntValue MovingPeaksRandomSeed {
+      get { return MovingPeaksRandomSeedParameter.Value; }
+    }
+    public IntValue PeakMovementInterval {
+      get { return PeakMovementIntervalParameter.Value; }
+    }
+    public DoubleValue PeakMovementStrength {
+      get { return PeakMovementStrengthParameter.Value; }
+    }
+    private BestMovingPeaksBenchmarkSolutionAnalyzer BestMovingPeaksBenchmarkSolutionAnalyzer {
+      get { return Operators.OfType<BestMovingPeaksBenchmarkSolutionAnalyzer>().FirstOrDefault(); }
+    }
     #endregion
 
@@ -147,4 +144,5 @@
       var defaultWidths = new double[] { 0.1, 0.1, 0.1, 0.1, 0.1 };
       var defaultHeights = new double[] { 50.0, 50.0, 50.0, 50.0, 50.0 };
+      var defaultBestKnown = new double[] { 08.0, 64.0, 67.0, 55.0, 04.0 };
 
       Parameters.Add(new ValueParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension.", new DoubleMatrix(defaultBounds)));
@@ -152,14 +150,13 @@
       Parameters.Add(new ValueParameter<IntValue>("Peaks", "The number of peaks.", new IntValue(5)));
       Parameters.Add(new ValueParameter<DoubleMatrix>("InitialPeakLocations", "Initial coordinates of each peaks.", new DoubleMatrix(defaultPeaks)));
-      Parameters.Add(new ValueParameter<DoubleMatrix>("PeakLocations", "Current coordinates of each peaks.", new DoubleMatrix(defaultPeaks)));
       Parameters.Add(new ValueParameter<DoubleArray>("InitialPeakWidths", "Initial width of each peak.", new DoubleArray(defaultWidths)));
-      Parameters.Add(new ValueParameter<DoubleArray>("PeakWidths", "Current width of each peak.", new DoubleArray(defaultWidths)));
       Parameters.Add(new ValueParameter<DoubleArray>("InitialPeakHeights", "Initial height of each peak.", new DoubleArray(defaultHeights)));
-      Parameters.Add(new ValueParameter<DoubleArray>("PeakHeights", "Current height of each peak.", new DoubleArray(defaultHeights)));
-
-      //Parameters.Add(new OptionalValueParameter<RealVector>("BestKnownSolution", "The best known solution for this test function instance."));
+      Parameters.Add(new FixedValueParameter<IntValue>("MovingPeaksRandomSeed", "The random seed for initializing the PRNG for changing the peaks.", new IntValue(666)));
+      Parameters.Add(new FixedValueParameter<IntValue>("PeakMovementInterval", "The interval in evaluated solutions in which peaks are moved.", new IntValue(1000)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("PeakMovementStrength", "The length of the random vector used for changing peak locations.", new DoubleValue(1.0)));
+      Parameters.Add(new OptionalValueParameter<RealVector>("BestKnownSolution", "The location of the highest peak.", new RealVector(defaultBestKnown)));
 
       Maximization.Value = true;
-      //BestKnownQuality = new DoubleValue(Evaluator.BestKnownQuality);
+      BestKnownQuality = new DoubleValue(defaultHeights.Max());
 
       //strategyVectorCreator = new StdDevStrategyVectorCreator();
@@ -181,11 +178,4 @@
     public override IDeepCloneable Clone(Cloner cloner) {
       return new MovingPeaksBenchmarkProblem(this, cloner);
-    }
-
-    protected override void OnReset() {
-      base.OnReset();
-      PeakLocations = InitialPeakLocations.Clone() as DoubleMatrix;
-      PeakWidths = InitialPeakWidths.Clone() as DoubleArray;
-      PeakHeights = InitialPeakHeights.Clone() as DoubleArray;
     }
 
@@ -297,14 +287,12 @@
     }
     private void ParameterizeAnalyzers() {
-      //if (BestSingleObjectiveTestFunctionSolutionAnalyzer != null) {
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.ResultsParameter.ActualName = "Results";
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
-      //  BestSingleObjectiveTestFunctionSolutionAnalyzer.BoundsParameter.ActualName = BoundsParameter.Name;
-      //}
+      if (BestMovingPeaksBenchmarkSolutionAnalyzer != null) {
+        BestMovingPeaksBenchmarkSolutionAnalyzer.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
+        BestMovingPeaksBenchmarkSolutionAnalyzer.ResultsParameter.ActualName = "Results";
+        BestMovingPeaksBenchmarkSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
+        BestMovingPeaksBenchmarkSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
+        BestMovingPeaksBenchmarkSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
+        BestMovingPeaksBenchmarkSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      }
     }
     private void InitializeOperators() {
@@ -316,5 +304,5 @@
       //Operators.Add(new QualitySimilarityCalculator());
 
-      //Operators.Add(new BestSingleObjectiveTestFunctionSolutionAnalyzer());
+      Operators.Add(new BestMovingPeaksBenchmarkSolutionAnalyzer());
       //Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>()));
       ParameterizeAnalyzers();
Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblemEvaluator.cs
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblemEvaluator.cs	(revision 16608)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblemEvaluator.cs	(revision 16609)
@@ -20,4 +20,6 @@
 #endregion
 
+using System;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -25,6 +27,8 @@
 using HeuristicLab.Encodings.RealVectorEncoding;
 using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.MovingPeaksBenchmark {
@@ -32,12 +36,26 @@
   [StorableClass]
   public class MovingPeaksBenchmarkProblemEvaluator : InstrumentedOperator, IMovingPeaksBenchmarkProblemEvaluator {
-    public ILookupParameter<DoubleMatrix> PeakLocationsParameter {
-      get { return (ILookupParameter<DoubleMatrix>)Parameters["PeakLocations"]; }
-    }
-    public ILookupParameter<DoubleArray> PeakWidthsParameter {
-      get { return (ILookupParameter<DoubleArray>)Parameters["PeakWidths"]; }
-    }
-    public ILookupParameter<DoubleArray> PeakHeightsParameter {
-      get { return (ILookupParameter<DoubleArray>)Parameters["PeakHeights"]; }
+    [Storable]
+    IRandom uniformRandom;
+    [Storable]
+    long executions;
+
+    public IValueLookupParameter<DoubleMatrix> PeakLocationsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["PeakLocations"]; }
+    }
+    public IValueLookupParameter<DoubleArray> PeakWidthsParameter {
+      get { return (IValueLookupParameter<DoubleArray>)Parameters["PeakWidths"]; }
+    }
+    public IValueLookupParameter<DoubleArray> PeakHeightsParameter {
+      get { return (IValueLookupParameter<DoubleArray>)Parameters["PeakHeights"]; }
+    }
+    public ILookupParameter<IntValue> MovingPeaksRandomSeedParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["MovingPeaksRandomSeed"]; }
+    }
+    public ILookupParameter<IntValue> PeakMovementIntervalParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["PeakMovementInterval"]; }
+    }
+    public ILookupParameter<DoubleValue> PeakMovementStrengthParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["PeakMovementStrength"]; }
     }
     public ILookupParameter<RealVector> PointParameter {
@@ -46,4 +64,13 @@
     public ILookupParameter<DoubleValue> QualityParameter {
       get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+    public ILookupParameter<DoubleValue> BestKnownQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
+    }
+    public ILookupParameter<RealVector> BestKnownSolutionParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestKnownSolution"]; }
+    }
+    public IValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     }
 
@@ -52,9 +79,25 @@
     protected MovingPeaksBenchmarkProblemEvaluator(MovingPeaksBenchmarkProblemEvaluator original, Cloner cloner) : base(original, cloner) { }
     public MovingPeaksBenchmarkProblemEvaluator() : base() {
-      Parameters.Add(new LookupParameter<DoubleMatrix>("PeakLocations", "Current position of the peaks."));
-      Parameters.Add(new LookupParameter<DoubleArray>("PeakWidths", "Current width of the peaks."));
-      Parameters.Add(new LookupParameter<DoubleArray>("PeakHeights", "Current height of the peaks."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("PeakLocations", "Current position of the peaks."));
+      PeakLocationsParameter.ActualName = "InitialPeakLocations";
+      Parameters.Add(new ValueLookupParameter<DoubleArray>("PeakWidths", "Current width of the peaks."));
+      PeakWidthsParameter.ActualName = "InitialPeakWidths";
+      Parameters.Add(new ValueLookupParameter<DoubleArray>("PeakHeights", "Current height of the peaks."));
+      PeakHeightsParameter.ActualName = "InitialPeakHeights";
+      Parameters.Add(new LookupParameter<IntValue>("MovingPeaksRandomSeed", "The random seed for initializing the PRNG for changing the peaks."));
+      Parameters.Add(new LookupParameter<IntValue>("PeakMovementInterval", "The interval in evaluated solutions in which peaks are moved."));
+      Parameters.Add(new LookupParameter<DoubleValue>("PeakMovementStrength", "The length of the random vector used for changing peak locations."));
       Parameters.Add(new LookupParameter<RealVector>("Point", "The point which should be evaluated."));
       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "Quality value of the evaluated point."));
+      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "Quality value of the highest peak."));
+      Parameters.Add(new LookupParameter<RealVector>("BestKnownSolution", "The location of the highest peak."));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection for storing result values."));
+
+      PeakLocationsParameter.Hidden = true;
+      PeakWidthsParameter.Hidden = true;
+      PeakHeightsParameter.Hidden = true;
+      BestKnownQualityParameter.Hidden = true;
+      BestKnownSolutionParameter.Hidden = true;
+      ResultsParameter.Hidden = true;
     }
 
@@ -67,4 +110,41 @@
       DoubleArray widths = PeakWidthsParameter.ActualValue;
       DoubleArray heights = PeakHeightsParameter.ActualValue;
+
+      if (PeakLocationsParameter.Value == null) {
+        peaks = peaks.Clone() as DoubleMatrix;
+        widths = widths.Clone() as DoubleArray;
+        heights = heights.Clone() as DoubleArray;
+        PeakLocationsParameter.Value = peaks;
+        PeakWidthsParameter.Value = widths;
+        PeakHeightsParameter.Value = heights;
+
+        ResultCollection results = ResultsParameter.ActualValue;
+        results.Add(new Result("Current Peak Locations", peaks));
+        results.Add(new Result("Current Peak Widths", widths));
+        results.Add(new Result("Current Peak Heights", heights));
+      }
+      if (uniformRandom == null) {
+        uniformRandom = new MersenneTwister();
+        uniformRandom.Reset(MovingPeaksRandomSeedParameter.ActualValue.Value);
+      }
+
+      // move peaks if peaks movement interval is reached
+      lock (this) {
+        if ((executions % PeakMovementIntervalParameter.ActualValue.Value) == 0) {
+          MovePeaks(uniformRandom, peaks, widths, heights, PeakMovementStrengthParameter.ActualValue.Value);
+
+          // update best known solution & quality according to highest peak
+          double maxHeight = heights.Max();
+          int peakIndex = Array.IndexOf(heights.CloneAsArray(), maxHeight);
+          double[] peak = new double[peaks.Columns];
+          for (int i = 0; i < peak.Length; i++) {
+            peak[i] = peaks[peakIndex, i];
+          }
+          BestKnownSolutionParameter.ActualValue = new RealVector(peak);
+          BestKnownQualityParameter.ActualValue.Value = heights.Max();
+        }
+        executions++;
+      }
+
       RealVector point = PointParameter.ActualValue;
       double quality = Apply(peaks, widths, heights, point);
@@ -73,7 +153,18 @@
     }
 
+    public override void InitializeState() {
+      base.InitializeState();
+      executions = 0;
+    }
+
+    public override void ClearState() {
+      base.ClearState();
+      uniformRandom = null;
+      PeakLocationsParameter.Value = null;
+      PeakWidthsParameter.Value = null;
+      PeakHeightsParameter.Value = null;
+    }
+
     public double Apply(DoubleMatrix peaks, DoubleArray widths, DoubleArray heights, RealVector point) {
-      heights[0] *= 1.01;
-
       double max = 0;
       double val = 0;
@@ -89,4 +180,29 @@
       return max;
     }
+
+    private void MovePeaks(IRandom uniformRandom, DoubleMatrix peaks, DoubleArray widths, DoubleArray heights, double strength) {
+      IRandom normalRandom = new NormalDistributedRandom(uniformRandom, 0, 1);
+      for (int i = 0; i < peaks.Rows; i++) {
+        double[] v = RandomVector(uniformRandom, peaks.Columns, strength);
+        for (int j = 0; j < v.Length; j++) {
+          peaks[i, j] += v[j];
+        }
+        widths[i] = widths[i] + 0.01 * normalRandom.NextDouble();
+        heights[i] = heights[i] + 7 * normalRandom.NextDouble();
+      }
+    }
+
+    private double[] RandomVector(IRandom uniformRandom, int dimensions, double length) {
+      double[] vector = new double[dimensions];
+
+      for (int i = 0; i < vector.Length; i++) {
+        vector[i] = uniformRandom.NextDouble() - 0.5;
+      }
+      double factor = length / Math.Sqrt(vector.Select(x => x * x).Sum());
+      for (int i = 0; i < vector.Length; i++) {
+        vector[i] *= factor; 
+      }
+      return vector;
+    }
   }
 }
Index: /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Plugin.cs.frame
===================================================================
--- /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Plugin.cs.frame	(revision 16608)
+++ /branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/Plugin.cs.frame	(revision 16609)
@@ -28,5 +28,5 @@
   [PluginFile("HeuristicLab.Problems.MovingPeaksBenchmark-3.3.dll", PluginFileType.Assembly)]
   [Plugin("HeuristicLab.Problems.MovingPeaksBenchmark", "3.3.15.$WCREV$")]
-//  [PluginDependency("HeuristicLab.Analysis", "3.3")]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
@@ -41,4 +41,5 @@
   [PluginDependency("HeuristicLab.Parameters", "3.3")]
   [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Random", "3.3")]
   public class HeuristicLabProblemsMovingPeaksBenchmarkPlugin : PluginBase {
   }
