Index: branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRAlgorithm.cs
===================================================================
--- branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRAlgorithm.cs	(revision 14563)
+++ branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRAlgorithm.cs	(revision 14573)
@@ -302,5 +302,5 @@
 
       if (!replaced && offspring != null) {
-        if (Context.HillclimbingSuited(offspring)) {
+        if (Context.HillclimbingSuited(offspring.Fitness)) {
           HillClimb(offspring, token, CalculateSubspace(Context.Population.Select(x => x.Solution)));
           if (Replace(offspring, token)) {
@@ -566,9 +566,8 @@
       AdaptiveWalk(newScope, maxEvals, token, subspace);
       
+      Context.AddAdaptivewalkingResult(scope, newScope);
       if (Context.IsBetter(newScope, scope)) {
-        Context.AddAdaptivewalkingResult(scope, newScope);
         scope.Adopt(newScope);
-      } else if (!Eq(newScope, scope))
-        Context.AddAdaptivewalkingResult(scope, newScope);
+      }
     }
     protected abstract void AdaptiveWalk(ISingleObjectiveSolutionScope<TSolution> scope, int maxEvals, CancellationToken token, ISolutionSubspace<TSolution> subspace = null);
Index: branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs
===================================================================
--- branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs	(revision 14563)
+++ branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/MemPRContext.cs	(revision 14573)
@@ -27,4 +27,5 @@
 using HeuristicLab.Algorithms.DataAnalysis;
 using HeuristicLab.Algorithms.MemPR.Interfaces;
+using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -343,4 +344,11 @@
     }
 
+    #region Breeding Performance
+    public void AddBreedingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
+      if (IsBetter(a, b))
+        breedingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, child.Fitness));
+      else breedingStat.Add(Tuple.Create(b.Fitness, a.Fitness, parentDist, child.Fitness));
+      if (breedingStat.Count % 10 == 0) RelearnBreedingPerformanceModel();
+    }
     public void RelearnBreedingPerformanceModel() {
       breedingPerformanceModel = RunRegression(PrepareRegression(ToListRow(breedingStat)), breedingPerformanceModel).Model;
@@ -360,5 +368,13 @@
       return Random.NextDouble() < ProbabilityAcceptAbsolutePerformanceModel(new List<double> { p1.Fitness, p2.Fitness, dist }, breedingPerformanceModel);
     }
-
+    #endregion
+
+    #region Relinking Performance
+    public void AddRelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
+      if (IsBetter(a, b))
+        relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
+      else relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - b.Fitness : b.Fitness - child.Fitness));
+      if (relinkingStat.Count % 10 == 0) RelearnRelinkingPerformanceModel();
+    }
     public void RelearnRelinkingPerformanceModel() {
       relinkingPerformanceModel = RunRegression(PrepareRegression(ToListRow(relinkingStat)), relinkingPerformanceModel).Model;
@@ -381,5 +397,13 @@
       return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(p2.Fitness, new List<double> { p1.Fitness, p2.Fitness, dist }, relinkingPerformanceModel);
     }
-
+    #endregion
+
+    #region Delinking Performance
+    public void AddDelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
+      if (IsBetter(a, b))
+        delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
+      else delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - b.Fitness : b.Fitness - child.Fitness));
+      if (delinkingStat.Count % 10 == 0) RelearnDelinkingPerformanceModel();
+    }
     public void RelearnDelinkingPerformanceModel() {
       delinkingPerformanceModel = RunRegression(PrepareRegression(ToListRow(delinkingStat)), delinkingPerformanceModel).Model;
@@ -401,5 +425,11 @@
       return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(p2.Fitness, new List<double> { p1.Fitness, p2.Fitness, dist }, delinkingPerformanceModel);
     }
-
+    #endregion
+
+    #region Sampling Performance
+    public void AddSamplingResult(ISingleObjectiveSolutionScope<TSolution> sample, double avgDist) {
+      samplingStat.Add(Tuple.Create(avgDist, sample.Fitness));
+      if (samplingStat.Count % 10 == 0) RelearnSamplingPerformanceModel();
+    }
     public void RelearnSamplingPerformanceModel() {
       samplingPerformanceModel = RunRegression(PrepareRegression(ToListRow(samplingStat)), samplingPerformanceModel).Model;
@@ -410,10 +440,13 @@
       return Random.NextDouble() < ProbabilityAcceptAbsolutePerformanceModel(new List<double> { avgDist }, samplingPerformanceModel);
     }
-
+    #endregion
+
+    #region Hillclimbing Performance
+    public void AddHillclimbingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
+      hillclimbingStat.Add(Tuple.Create(input.Fitness, Maximization ? outcome.Fitness - input.Fitness : input.Fitness - outcome.Fitness));
+      if (hillclimbingStat.Count % 10 == 0) RelearnHillclimbingPerformanceModel();
+    }
     public void RelearnHillclimbingPerformanceModel() {
       hillclimbingPerformanceModel = RunRegression(PrepareRegression(ToListRow(hillclimbingStat)), hillclimbingPerformanceModel).Model;
-    }
-    public bool HillclimbingSuited(ISingleObjectiveSolutionScope<TSolution> scope) {
-      return HillclimbingSuited(scope.Fitness);
     }
     public bool HillclimbingSuited(double startingFitness) {
@@ -423,10 +456,13 @@
       return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(startingFitness, new List<double> { startingFitness }, hillclimbingPerformanceModel);
     }
-
+    #endregion
+
+    #region Adaptivewalking Performance
+    public void AddAdaptivewalkingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
+      adaptivewalkingStat.Add(Tuple.Create(input.Fitness, Maximization ? outcome.Fitness - input.Fitness : input.Fitness - outcome.Fitness));
+      if (adaptivewalkingStat.Count % 10 == 0) RelearnAdaptiveWalkPerformanceModel();
+    }
     public void RelearnAdaptiveWalkPerformanceModel() {
       adaptiveWalkPerformanceModel = RunRegression(PrepareRegression(ToListRow(adaptivewalkingStat)), adaptiveWalkPerformanceModel).Model;
-    }
-    public bool AdaptivewalkingSuited(ISingleObjectiveSolutionScope<TSolution> scope) {
-      return AdaptivewalkingSuited(scope.Fitness);
     }
     public bool AdaptivewalkingSuited(double startingFitness) {
@@ -434,6 +470,7 @@
       if (startingFitness < AdaptivewalkingStat.Min(x => x.Item1) || startingFitness > AdaptivewalkingStat.Max(x => x.Item1))
         return true;
-      return Random.NextDouble() < ProbabilityAcceptAbsolutePerformanceModel(new List<double> { startingFitness }, adaptiveWalkPerformanceModel);
-    }
+      return Random.NextDouble() < ProbabilityAcceptRelativePerformanceModel(startingFitness, new List<double> { startingFitness }, adaptiveWalkPerformanceModel);
+    }
+    #endregion
 
     public IConfidenceRegressionSolution GetSolution(IConfidenceRegressionModel model, IEnumerable<Tuple<double, double>> data) {
@@ -447,7 +484,7 @@
     }
 
-    protected RegressionProblemData PrepareRegression(List<List<double>> sample) {
-      var columns = sample.First().Select(y => new List<double>()).ToList();
-      foreach (var next in sample.Shuffle(Random)) {
+    protected RegressionProblemData PrepareRegression(List<List<double>> data) {
+      var columns = data.First().Select(y => new List<double>()).ToList();
+      foreach (var next in data.Shuffle(Random)) {
         for (var i = 0; i < next.Count; i++) {
           columns[i].Add(next[i]);
@@ -456,6 +493,6 @@
       var ds = new Dataset(columns.Select((v, i) => i < columns.Count - 1 ? "in" + i : "out").ToList(), columns);
       var regPrb = new RegressionProblemData(ds, Enumerable.Range(0, columns.Count - 1).Select(x => "in" + x), "out") {
-        TrainingPartition = { Start = 0, End = Math.Min(50, sample.Count) },
-        TestPartition = { Start = Math.Min(50, sample.Count), End = sample.Count }
+        TrainingPartition = { Start = 0, End = Math.Min(50, data.Count) },
+        TestPartition = { Start = Math.Min(50, data.Count), End = data.Count }
       };
       return regPrb;
@@ -463,5 +500,7 @@
 
     protected static IConfidenceRegressionSolution RunRegression(RegressionProblemData trainingData, IConfidenceRegressionModel baseLineModel = null) {
+      var targetValues = trainingData.Dataset.GetDoubleValues(trainingData.TargetVariable, trainingData.TrainingIndices).ToList();
       var baseline = baseLineModel != null ? new ConfidenceRegressionSolution(baseLineModel, trainingData) : null;
+      var constantSolution = new ConfidenceRegressionSolution(new ConfidenceConstantModel(targetValues.Average(), targetValues.Variance(), trainingData.TargetVariable), trainingData);
       var gpr = new GaussianProcessRegression { Problem = { ProblemData = trainingData } };
       if (trainingData.InputVariables.CheckedItems.Any(x => alglib.pearsoncorr2(trainingData.Dataset.GetDoubleValues(x.Value.Value).ToArray(), trainingData.TargetVariableValues.ToArray()) > 0.8)) {
@@ -479,8 +518,25 @@
         cnt++;
       } while (cnt < 10 && (solution == null || solution.TrainingRSquared.IsAlmost(0)));
-      if (baseline == null) return solution;
-      if (trainingData.Dataset.Rows < 60)
-        return solution.TrainingMeanAbsoluteError < baseline.TrainingMeanAbsoluteError ? solution : baseline;
-      return solution.TestMeanAbsoluteError < baseline.TestMeanAbsoluteError ? solution : baseline;
+
+      return GetBestRegressionSolution(constantSolution, baseline, solution);
+    }
+
+    private static IConfidenceRegressionSolution GetBestRegressionSolution(IConfidenceRegressionSolution constant, IConfidenceRegressionSolution baseline, IConfidenceRegressionSolution solution) {
+      if (baseline == null)
+        return constant.TrainingMeanAbsoluteError < solution.TrainingMeanAbsoluteError ? constant : solution;
+
+      double a, b, c;
+      if (constant.ProblemData.Dataset.Rows < 60) {
+        c = constant.TrainingMeanAbsoluteError;
+        b = baseline.TrainingMeanAbsoluteError;
+        a = solution.TrainingMeanAbsoluteError;
+      } else {
+        c = constant.TestMeanAbsoluteError;
+        b = baseline.TestMeanAbsoluteError;
+        a = solution.TestMeanAbsoluteError;
+      }
+      if (c < b && (c < a || b < a)) return constant;
+      if (b < c && (b < a || c < a)) return baseline;
+      return solution;
     }
 
@@ -488,9 +544,12 @@
       using (var evt = new AutoResetEvent(false)) {
         EventHandler exeStateChanged = (o, args) => {
-          if (algorithm.ExecutionState == ExecutionState.Paused || algorithm.ExecutionState == ExecutionState.Stopped)
+          if (algorithm.ExecutionState != ExecutionState.Started)
             evt.Set();
         };
         algorithm.ExecutionStateChanged += exeStateChanged;
-        algorithm.Prepare(true);
+        if (algorithm.ExecutionState != ExecutionState.Prepared) {
+          algorithm.Prepare(true);
+          evt.WaitOne();
+        }
         algorithm.Start();
         evt.WaitOne();
@@ -547,40 +606,4 @@
     }
 
-    public void AddBreedingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
-      if (IsBetter(a, b))
-        breedingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, child.Fitness));
-      else breedingStat.Add(Tuple.Create(b.Fitness, a.Fitness, parentDist, child.Fitness));
-      if (breedingStat.Count % 10 == 0) RelearnBreedingPerformanceModel();
-    }
-
-    public void AddRelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
-      if (IsBetter(a, b))
-        relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
-      else relinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - b.Fitness : b.Fitness - child.Fitness));
-      if (relinkingStat.Count % 10 == 0) RelearnRelinkingPerformanceModel();
-    }
-
-    public void AddDelinkingResult(ISingleObjectiveSolutionScope<TSolution> a, ISingleObjectiveSolutionScope<TSolution> b, double parentDist, ISingleObjectiveSolutionScope<TSolution> child) {
-      if (IsBetter(a, b))
-        delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - a.Fitness : a.Fitness - child.Fitness));
-      else delinkingStat.Add(Tuple.Create(a.Fitness, b.Fitness, parentDist, Maximization ? child.Fitness - b.Fitness : b.Fitness - child.Fitness));
-      if (delinkingStat.Count % 10 == 0) RelearnDelinkingPerformanceModel();
-    }
-
-    public void AddSamplingResult(ISingleObjectiveSolutionScope<TSolution> sample, double avgDist) {
-      samplingStat.Add(Tuple.Create(avgDist, sample.Fitness));
-      if (samplingStat.Count % 10 == 0) RelearnSamplingPerformanceModel();
-    }
-
-    public void AddHillclimbingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
-      hillclimbingStat.Add(Tuple.Create(input.Fitness, Maximization ? outcome.Fitness - input.Fitness : input.Fitness - outcome.Fitness));
-      if (hillclimbingStat.Count % 10 == 0) RelearnHillclimbingPerformanceModel();
-    }
-
-    public void AddAdaptivewalkingResult(ISingleObjectiveSolutionScope<TSolution> input, ISingleObjectiveSolutionScope<TSolution> outcome) {
-      adaptivewalkingStat.Add(Tuple.Create(input.Fitness, outcome.Fitness));
-      if (adaptivewalkingStat.Count % 10 == 0) RelearnAdaptiveWalkPerformanceModel();
-    }
-
     #region IExecutionContext members
     public IAtomicOperation CreateOperation(IOperator op) {
@@ -599,32 +622,4 @@
       return new ExecutionContext(this, op, s);
     }
-    #endregion
-
-    #region Math Helper
-    // normal distribution CDF (left of x) for N(0;1) standard normal distribution
-    // from http://www.johndcook.com/blog/csharp_phi/
-    // license: "This code is in the public domain. Do whatever you want with it, no strings attached."
-    // added: 2016-11-19 21:46 CET
-    /*protected static double Phi(double x) {
-      // constants
-      double a1 = 0.254829592;
-      double a2 = -0.284496736;
-      double a3 = 1.421413741;
-      double a4 = -1.453152027;
-      double a5 = 1.061405429;
-      double p = 0.3275911;
-
-      // Save the sign of x
-      int sign = 1;
-      if (x < 0)
-        sign = -1;
-      x = Math.Abs(x) / Math.Sqrt(2.0);
-
-      // A&S formula 7.1.26
-      double t = 1.0 / (1.0 + p * x);
-      double y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.Exp(-x * x);
-
-      return 0.5 * (1.0 + sign * y);
-    }*/
     #endregion
 
Index: branches/MemPRAlgorithm/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
===================================================================
--- branches/MemPRAlgorithm/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 14563)
+++ branches/MemPRAlgorithm/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 14573)
@@ -136,4 +136,5 @@
     <Compile Include="Implementation\Clustering\ClusteringProblemData.cs" />
     <Compile Include="Implementation\Clustering\ClusteringSolution.cs" />
+    <Compile Include="Implementation\ConfidenceConstantModel.cs" />
     <Compile Include="Implementation\ConstantModel.cs" />
     <Compile Include="Implementation\DataAnalysisModel.cs" />
Index: branches/MemPRAlgorithm/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ConfidenceConstantModel.cs
===================================================================
--- branches/MemPRAlgorithm/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ConfidenceConstantModel.cs	(revision 14573)
+++ branches/MemPRAlgorithm/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ConfidenceConstantModel.cs	(revision 14573)
@@ -0,0 +1,105 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  [StorableClass]
+  [Item("Confidence Constant Model", "A model that always returns the same constant mean value and variance regardless of the presented input data.")]
+  public class ConfidenceConstantModel : RegressionModel, IConfidenceRegressionModel, IStringConvertibleValue {
+    public override IEnumerable<string> VariablesUsedForPrediction { get { return Enumerable.Empty<string>(); } }
+
+
+    [Storable]
+    private readonly double constant;
+    public double Constant {
+      get { return constant; }
+      // setter not implemented because manipulation of the constant is not allowed
+    }
+
+    [Storable]
+    private readonly double variance;
+    public double Variance {
+      get { return variance; }
+      // setter not implemented because manipulation of the variance is not allowed
+    }
+
+    [StorableConstructor]
+    protected ConfidenceConstantModel(bool deserializing) : base(deserializing) { }
+    protected ConfidenceConstantModel(ConfidenceConstantModel original, Cloner cloner)
+      : base(original, cloner) {
+      this.constant = original.constant;
+      this.variance = original.variance;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) { return new ConfidenceConstantModel(this, cloner); }
+
+    public ConfidenceConstantModel(double constant, double variance, string targetVariable)
+      : base(targetVariable) {
+      this.name = ItemName;
+      this.description = ItemDescription;
+      this.constant = constant;
+      this.variance = variance;
+      this.ReadOnly = true; // changing a constant regression model is not supported
+    }
+
+    public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
+      return rows.Select(row => Constant);
+    }
+
+    public IEnumerable<double> GetEstimatedVariances(IDataset dataset, IEnumerable<int> rows) {
+      return rows.Select(x => Variance);
+    }
+
+    public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
+      return new ConfidenceRegressionSolution(this, new RegressionProblemData(problemData));
+    }
+
+    public override string ToString() {
+      return string.Format("Constant: {0:E4}, Variance: {1:E4}", Constant, Variance);
+    }
+
+    #region IStringConvertibleValue
+    public bool ReadOnly { get; private set; }
+    public bool Validate(string value, out string errorMessage) {
+      throw new NotSupportedException(); // changing a constant regression model is not supported
+    }
+
+    public string GetValue() {
+      return string.Format("{0:E4}", constant);
+    }
+
+    public bool SetValue(string value) {
+      throw new NotSupportedException(); // changing a constant regression model is not supported
+    }
+
+#pragma warning disable 0067
+    public event EventHandler ValueChanged;
+#pragma warning restore 0067
+    #endregion
+  }
+}
