Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/OverfittingAnalyzer.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/OverfittingAnalyzer.cs	(revision 4308)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/OverfittingAnalyzer.cs	(revision 4309)
@@ -218,16 +218,16 @@
       ItemArray<DoubleValue> validationQualities = ValidationQualityParameter.ActualValue;
 
-      string targetVariable = ProblemData.TargetVariable.Value;
-
-      // select a random subset of rows in the validation set
-      int validationStart = ValidiationSamplesStart.Value;
-      int validationEnd = ValidationSamplesEnd.Value;
-      int seed = Random.Next();
-      int count = (int)((validationEnd - validationStart) * RelativeNumberOfEvaluatedSamples.Value);
-      if (count == 0) count = 1;
-      IEnumerable<int> rows = RandomEnumerable.SampleRandomNumbers(seed, validationStart, validationEnd, count);
-
-      double upperEstimationLimit = UpperEstimationLimit != null ? UpperEstimationLimit.Value : double.PositiveInfinity;
-      double lowerEstimationLimit = LowerEstimationLimit != null ? LowerEstimationLimit.Value : double.NegativeInfinity;
+      //string targetVariable = ProblemData.TargetVariable.Value;
+
+      //// select a random subset of rows in the validation set
+      //int validationStart = ValidiationSamplesStart.Value;
+      //int validationEnd = ValidationSamplesEnd.Value;
+      //int seed = Random.Next();
+      //int count = (int)((validationEnd - validationStart) * RelativeNumberOfEvaluatedSamples.Value);
+      //if (count == 0) count = 1;
+      //IEnumerable<int> rows = RandomEnumerable.SampleRandomNumbers(seed, validationStart, validationEnd, count);
+
+      //double upperEstimationLimit = UpperEstimationLimit != null ? UpperEstimationLimit.Value : double.PositiveInfinity;
+      //double lowerEstimationLimit = LowerEstimationLimit != null ? LowerEstimationLimit.Value : double.NegativeInfinity;
 
       //double bestQuality = Maximization.Value ? double.NegativeInfinity : double.PositiveInfinity;
@@ -250,6 +250,6 @@
       //if (RelativeValidationQualityParameter.ActualValue == null) {
       // first call initialize the relative quality using the difference between average training and validation quality
-      double avgTrainingQuality = qualities.Select(x => x.Value).Median();
-      double avgValidationQuality = validationQualities.Select(x => x.Value).Median();
+      double avgTrainingQuality = qualities.Select(x => x.Value).Average();
+      double avgValidationQuality = validationQualities.Select(x => x.Value).Average();
 
       if (Maximization.Value)
@@ -284,10 +284,7 @@
       bool overfitting =
         avgTrainingQuality > InitialTrainingQualityParameter.ActualValue.Value &&  // better on training than in initial generation
+        // RelativeValidationQualityParameter.ActualValue.Value < 0.0 && // validation quality is worse than training quality
         r < CorrelationLimitParameter.ActualValue.Value;  // low correlation between training and validation quality
 
-      //// if validation quality is within a certain margin of percentage deviation (default -5% .. 5%) then there is no overfitting
-      //// correlation is also bad when underfitting but validation quality cannot be a lot larger than training quality if overfitting
-      //(RelativeValidationQualityParameter.ActualValue.Value > RelativeValidationQualityUpperLimitParameter.ActualValue.Value || // better on training than on validation
-      // RelativeValidationQualityParameter.ActualValue.Value < RelativeValidationQualityLowerLimitParameter.ActualValue.Value); // better on training than on validation
 
       OverfittingParameter.ActualValue = new BoolValue(overfitting);
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 4308)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 4309)
@@ -133,4 +133,5 @@
     <Compile Include="Interfaces\IOnlineEvaluator.cs" />
     <Compile Include="MatrixExtensions.cs" />
+    <Compile Include="Operators\CovariantParsimonyPressureAdder.cs" />
     <Compile Include="Operators\CovariantParsimonyPressure.cs" />
     <Compile Include="Operators\DynamicDepthLimitInitializer.cs" />
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/CovariantParsimonyPressure.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/CovariantParsimonyPressure.cs	(revision 4308)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/CovariantParsimonyPressure.cs	(revision 4309)
@@ -47,5 +47,4 @@
       get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["AdjustedQuality"]; }
     }
-
     public ILookupParameter<BoolValue> MaximizationParameter {
       get { return (ILookupParameter<BoolValue>)Parameters["Maximization"]; }
@@ -54,4 +53,7 @@
       get { return (IValueLookupParameter<DoubleValue>)Parameters["K"]; }
     }
+    public ILookupParameter<DoubleValue> CParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["C"]; }
+    }
     public ILookupParameter<IntValue> GenerationsParameter {
       get { return (ILookupParameter<IntValue>)Parameters["Generations"]; }
@@ -63,13 +65,4 @@
       get { return (IValueLookupParameter<BoolValue>)Parameters["ApplyParsimonyPressure"]; }
     }
-    public ILookupParameter<DataTable> ValidationQualityParameter {
-      get { return (ILookupParameter<DataTable>)Parameters["Validation Quality"]; }
-    }
-    //public ILookupParameter<DoubleValue> CurrentBestValidationQualityParameter {
-    //  get { return (ILookupParameter<DoubleValue>)Parameters["Current best validation quality"]; }
-    //}
-    //public ILookupParameter<DoubleValue> BestValidationQualityParameter {
-    //  get { return (ILookupParameter<DoubleValue>)Parameters["Best solution quality (validation)"]; }
-    //}
     public ILookupParameter<DoubleValue> LengthCorrelationParameter {
       get { return (ILookupParameter<DoubleValue>)Parameters["Correlation(Length, AdjustedFitness)"]; }
@@ -78,15 +71,6 @@
       get { return (ILookupParameter<DoubleValue>)Parameters["Correlation(Fitness, AdjustedFitness)"]; }
     }
-    //public IValueLookupParameter<IntValue> GenerationSpanParameter {
-    //  get { return (IValueLookupParameter<IntValue>)Parameters["GenerationSpan"]; }
-    //}
-    //public IValueLookupParameter<PercentValue> OverfittingLimitParameter {
-    //  get { return (IValueLookupParameter<PercentValue>)Parameters["OverfittingLimit"]; }
-    //}
     public IValueLookupParameter<PercentValue> ComplexityAdaptionParameter {
       get { return (IValueLookupParameter<PercentValue>)Parameters["ComplexityAdaption"]; }
-    }
-    public ILookupParameter<DataTable> QualitiesParameter {
-      get { return (ILookupParameter<DataTable>)Parameters["Qualities"]; }
     }
     public IValueLookupParameter<DoubleValue> MinAverageSizeParameter {
@@ -103,16 +87,11 @@
       Parameters.Add(new ValueLookupParameter<DoubleValue>("K", new DoubleValue(1.0)));
       Parameters.Add(new LookupParameter<IntValue>("Generations"));
-      Parameters.Add(new ValueLookupParameter<IntValue>("FirstGenerationParameter", new IntValue(5)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("FirstGenerationParameter", new IntValue(1)));
       Parameters.Add(new ValueLookupParameter<BoolValue>("ApplyParsimonyPressure"));
-      //Parameters.Add(new LookupParameter<DoubleValue>("Current best validation quality"));
-      //Parameters.Add(new LookupParameter<DoubleValue>("Best solution quality (validation)"));
-      Parameters.Add(new LookupParameter<DataTable>("Validation Quality"));
-      Parameters.Add(new LookupParameter<DataTable>("Qualities"));
-      //Parameters.Add(new ValueLookupParameter<IntValue>("GenerationSpan", new IntValue(5)));
-      //Parameters.Add(new ValueLookupParameter<PercentValue>("OverfittingLimit", new PercentValue(5)));
-      Parameters.Add(new ValueLookupParameter<PercentValue>("ComplexityAdaption", new PercentValue(-5)));
+      Parameters.Add(new ValueLookupParameter<PercentValue>("ComplexityAdaption", new PercentValue(-0.01)));
       Parameters.Add(new LookupParameter<DoubleValue>("Correlation(Length, AdjustedFitness)"));
       Parameters.Add(new LookupParameter<DoubleValue>("Correlation(Fitness, AdjustedFitness)"));
       Parameters.Add(new ValueLookupParameter<DoubleValue>("MinAverageSize", new DoubleValue(15)));
+      Parameters.Add(new LookupParameter<DoubleValue>("C"));
     }
 
@@ -130,32 +109,17 @@
       }
       if (!Parameters.ContainsKey("FirstGenerationParameter")) {
-        Parameters.Add(new ValueLookupParameter<IntValue>("FirstGenerationParameter", new IntValue(5)));
+        Parameters.Add(new ValueLookupParameter<IntValue>("FirstGenerationParameter", new IntValue(1)));
       }
       if (!Parameters.ContainsKey("ApplyParsimonyPressure")) {
         Parameters.Add(new ValueLookupParameter<BoolValue>("ApplyParsimonyPressure"));
       }
-      //if (!Parameters.ContainsKey("Current best validation quality")) {
-      //  Parameters.Add(new LookupParameter<DoubleValue>("Current best validation quality"));
-      //}
-      //if (!Parameters.ContainsKey("Best solution quality (validation)")) {
-      //  Parameters.Add(new LookupParameter<DoubleValue>("Best solution quality (validation)"));
-      //}
-      if (!Parameters.ContainsKey("Correlation(Length, AdjustedFitness)")) {
-        Parameters.Add(new LookupParameter<DoubleValue>("Correlation(Length, AdjustedFitness)"));
-      }
-      if (!Parameters.ContainsKey("Correlation(Fitness, AdjustedFitness)")) {
-        Parameters.Add(new LookupParameter<DoubleValue>("Correlation(Fitness, AdjustedFitness)"));
-      }
-      if (!Parameters.ContainsKey("Validation Quality")) {
-        Parameters.Add(new LookupParameter<DataTable>("Validation Quality"));
-      }
-      if (!Parameters.ContainsKey("Qualities")) {
-        Parameters.Add(new LookupParameter<DataTable>("Qualities"));
-      }
       if (!Parameters.ContainsKey("ComplexityAdaption")) {
-        Parameters.Add(new ValueLookupParameter<PercentValue>("ComplexityAdaption", new PercentValue(-5)));
+        Parameters.Add(new ValueLookupParameter<PercentValue>("ComplexityAdaption", new PercentValue(-0.01)));
       }
       if (!Parameters.ContainsKey("MinAverageSize")) {
         Parameters.Add(new ValueLookupParameter<DoubleValue>("MinAverageSize", new DoubleValue(15)));
+      }
+      if (!Parameters.ContainsKey("C")) {
+        Parameters.Add(new LookupParameter<DoubleValue>("C"));
       }
     }
@@ -194,15 +158,14 @@
 
         double sizeAdaption = lengthMeanCalculator.Mean * ComplexityAdaptionParameter.ActualValue.Value;
-        if (sizeAdaption < 0) sizeAdaption = Math.Floor(sizeAdaption);
-        else sizeAdaption = Math.Ceiling(sizeAdaption);
-        double g = lengthMeanCalculator.Mean + sizeAdaption;
-        if (g < MinAverageSizeParameter.ActualValue.Value)
-          g = MinAverageSizeParameter.ActualValue.Value;
+        if (lengthMeanCalculator.Mean + sizeAdaption < MinAverageSizeParameter.ActualValue.Value)
+          sizeAdaption = 0.0;
 
         //            cov(l, f) - (g(t+1) - mu(t)) avgF
         // c(t) =  --------------------------------------------
         //           cov(l, l^k) - (g(t+1) - mu(t)) E[l^k]
-        double c = lengthFitnessCovEvaluator.Covariance - (g - lengthMeanCalculator.Mean) * fitnessMeanCalculator.Mean;
-        c /= lengthAdjLengthCovEvaluator.Covariance - (g - lengthMeanCalculator.Mean) * adjLengthMeanCalculator.Mean;
+        double c = lengthFitnessCovEvaluator.Covariance - sizeAdaption * fitnessMeanCalculator.Mean;
+        c /= lengthAdjLengthCovEvaluator.Covariance - sizeAdaption * adjLengthMeanCalculator.Mean;
+
+        CParameter.ActualValue = new DoubleValue(c);
 
         // adjust fitness
@@ -230,4 +193,5 @@
 
       } else {
+        CParameter.ActualValue = new DoubleValue(0.0);
         // adjusted fitness is equal to fitness
         AdjustedQualityParameter.ActualValue = (ItemArray<DoubleValue>)QualityParameter.ActualValue.Clone();
Index: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/CovariantParsimonyPressureAdder.cs
===================================================================
--- branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/CovariantParsimonyPressureAdder.cs	(revision 4309)
+++ branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/CovariantParsimonyPressureAdder.cs	(revision 4309)
@@ -0,0 +1,114 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 alglib;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using System.Collections.Generic;
+using HeuristicLab.Problems.DataAnalysis.Evaluators;
+using HeuristicLab.Analysis;
+
+namespace HeuristicLab.Problems.DataAnalysis.Operators {
+  [Item("Covariant Parsimony Pressure Adder", "Covariant Parsimony Pressure Adder.")]
+  [StorableClass]
+  public class CovariantParsimonyPressureAdder : SingleSuccessorOperator {
+    public IScopeTreeLookupParameter<SymbolicExpressionTree> ParentsParameter {
+      get { return (IScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters["Parents"]; }
+    }
+    public IScopeTreeLookupParameter<DoubleValue> ParentQualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["ParentQuality"]; }
+    }
+    public IScopeTreeLookupParameter<DoubleValue> ParentAdjustedQualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["ParentAdjustedQuality"]; }
+    }
+    public ILookupParameter<SymbolicExpressionTree> OffspringParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["Offspring"]; }
+    }
+    public ILookupParameter<DoubleValue> OffspringQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["OffspringQuality"]; }
+    }
+    public ILookupParameter<DoubleValue> OffspringAdjustedQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["OffspringAdjustedQuality"]; }
+    }
+    public IValueLookupParameter<DoubleValue> KParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["K"]; }
+    }
+    public IValueLookupParameter<BoolValue> ApplyParsimonyPressureParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["ApplyParsimonyPressure"]; }
+    }
+    public ILookupParameter<DoubleValue> CParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["C"]; }
+    }
+
+    [StorableConstructor]
+    public CovariantParsimonyPressureAdder(bool deserializing) : base(deserializing) { }
+    public CovariantParsimonyPressureAdder()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>("Parents"));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("ParentQuality"));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("ParentAdjustedQuality"));
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>("Offspring"));
+      Parameters.Add(new LookupParameter<DoubleValue>("OffspringQuality"));
+      Parameters.Add(new LookupParameter<DoubleValue>("OffspringAdjustedQuality"));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("K", new DoubleValue(1)));
+      Parameters.Add(new LookupParameter<DoubleValue>("C"));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("ApplyParsimonyPressure"));
+    }
+
+    [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+    }
+
+    public override IOperation Apply() {
+      if (ApplyParsimonyPressureParameter.ActualValue.Value) {
+        double k = KParameter.ActualValue.Value;
+        double c = CParameter.ActualValue.Value;
+
+        // handle offspring
+        var offspringLength = OffspringParameter.ActualValue.Size;
+        OffspringAdjustedQualityParameter.ActualValue = new DoubleValue(OffspringQualityParameter.ActualValue.Value - c * Math.Pow(offspringLength, k));
+
+        // handle parents
+        ItemArray<SymbolicExpressionTree> parents = ParentsParameter.ActualValue;
+        ItemArray<DoubleValue> parentQualities = ParentQualityParameter.ActualValue;
+
+        ItemArray<DoubleValue> adjQualities = new ItemArray<DoubleValue>(parentQualities.Length);
+
+        for (int i = 0; i < adjQualities.Length; i++) {
+          adjQualities[i] = new DoubleValue(parentQualities[i].Value - c * Math.Pow(parents[i].Size, k));
+        }
+        ParentAdjustedQualityParameter.ActualValue = adjQualities;
+      } else {
+        // adjusted fitness is equal to fitness
+        ParentAdjustedQualityParameter.ActualValue = (ItemArray<DoubleValue>)ParentQualityParameter.ActualValue.Clone();
+        OffspringAdjustedQualityParameter.ActualValue = (DoubleValue)OffspringQualityParameter.ActualValue.Clone();
+      }
+      return base.Apply();
+    }
+  }
+}
