Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationPhenotypicDiversityAnalyzer.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationPhenotypicDiversityAnalyzer.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationPhenotypicDiversityAnalyzer.cs	(revision 12049)
@@ -20,5 +20,4 @@
 #endregion
 
-using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Analysis;
@@ -30,5 +29,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Analyzers {
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("SymbolicClassificationPhenotypicDiversityAnalyzer", "An analyzer which calculates diversity based on the phenotypic distance between trees")]
   [StorableClass]
@@ -39,4 +38,5 @@
     private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
     private const string ProblemDataParameterName = "ProblemData";
+    private const string ModelCreatorParameterName = "ModelCreator";
     private const string EstimationLimitsParameterName = "EstimationLimits";
     private const string UseClassValuesParameterName = "UseClassValues";
@@ -53,4 +53,7 @@
       get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
     }
+    public ILookupParameter<ISymbolicDiscriminantFunctionClassificationModelCreator> ModelCreatorParameter {
+      get { return (ILookupParameter<ISymbolicDiscriminantFunctionClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
+    }
     public IValueLookupParameter<IClassificationProblemData> ProblemDataParameter {
       get { return (IValueLookupParameter<IClassificationProblemData>)Parameters[ProblemDataParameterName]; }
@@ -65,5 +68,5 @@
 
     #region properties
-    bool UseClassValues {
+    private bool UseClassValues {
       get { return UseClassValuesParameter.Value.Value; }
       set { UseClassValuesParameter.Value.Value = value; }
@@ -78,7 +81,7 @@
       Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
       Parameters.Add(new ValueLookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
+      Parameters.Add(new LookupParameter<ISymbolicDiscriminantFunctionClassificationModelCreator>(ModelCreatorParameterName, "The model creator for creating discriminant function classification models."));
       Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees."));
-      Parameters.Add(new FixedValueParameter<BoolValue>(UseClassValuesParameterName,
-        "Specifies whether the raw estimated values of the tree or the corresponding class values should be used for similarity calculation.", new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(UseClassValuesParameterName, "Specifies whether the raw estimated values of the tree or the corresponding class values should be used for similarity calculation.", new BoolValue(false)));
       #endregion
     }
@@ -100,34 +103,17 @@
       var trees = SymbolicExpressionTreeParameter.ActualValue;
       var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var problemData = ProblemDataParameter.ActualValue;
       var ds = ProblemDataParameter.ActualValue.Dataset;
       var rows = ProblemDataParameter.ActualValue.TrainingIndices;
-
-      if (UseClassValues) {
-        var problemData = ProblemDataParameter.ActualValue;
-        var evaluatedValues = new ItemArray<DoubleArray>(trees.Length);
-        for (int i = 0; i < trees.Length; ++i) {
-          var t = trees[i];
-          double[] classValues, thresholds;
-          var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(t, ds, rows).ToArray();
-          AccuracyMaximizationThresholdCalculator.CalculateThresholds(problemData, estimatedValues,
-            problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices),
-            out classValues, out thresholds);
-          var estimatedClassValues = new List<double>();
-          foreach (var x in estimatedValues) {
-            int classIndex = 0;
-            // find first threshold value which is larger than x => class index = threshold index + 1
-            for (int j = 0; j < thresholds.Length; j++) {
-              if (x > thresholds[j]) classIndex++;
-              else break;
-            }
-            estimatedClassValues.Add(classValues.ElementAt(classIndex - 1));
-          }
-          evaluatedValues[i] = new DoubleArray(estimatedClassValues.ToArray());
-        }
-        EvaluatedValuesParameter.ActualValue = evaluatedValues;
-      } else {
-        var evaluatedValues = new ItemArray<DoubleArray>(trees.Select(t => new DoubleArray(interpreter.GetSymbolicExpressionTreeValues(t, ds, rows).ToArray())));
-        EvaluatedValuesParameter.ActualValue = evaluatedValues;
+      var modelCreator = ModelCreatorParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var evaluatedValues = new ItemArray<DoubleArray>(trees.Length);
+      for (int i = 0; i < trees.Length; ++i) {
+        var model = (IDiscriminantFunctionClassificationModel)modelCreator.CreateSymbolicDiscriminantFunctionClassificationModel(trees[i], interpreter, estimationLimits.Lower, estimationLimits.Upper);
+        model.RecalculateModelParameters(problemData, rows);
+        var values = UseClassValues ? model.GetEstimatedClassValues(ds, rows) : model.GetEstimatedValues(ds, rows);
+        evaluatedValues[i] = new DoubleArray(values.ToArray());
       }
+      EvaluatedValuesParameter.ActualValue = evaluatedValues;
       return base.Apply();
     }
Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs	(revision 12049)
@@ -24,5 +24,4 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Problems.DataAnalysis.Symbolic.Analyzers;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -147,4 +146,15 @@
           op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
       }
+
+      foreach (var op in Operators.OfType<SymbolicClassificationPhenotypicDiversityAnalyzer>()) {
+        var sim = op.SimilarityCalculator as SymbolicExpressionTreePhenotypicSimilarityCalculator;
+        if (sim == null) {
+          op.SimilarityCalculator = new SymbolicExpressionTreePhenotypicSimilarityCalculator {
+            SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName
+          };
+        } else {
+          sim.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        }
+      }
     }
   }
Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionPhenotypicDiversityAnalyzer.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionPhenotypicDiversityAnalyzer.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionPhenotypicDiversityAnalyzer.cs	(revision 12049)
@@ -29,5 +29,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Analyzers {
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("SymbolicRegressionPhenotypicDiversityAnalyzer", "An analyzer which calculates diversity based on the phenotypic distance between trees")]
   [StorableClass]
Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs	(revision 12049)
@@ -25,5 +25,4 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Problems.DataAnalysis.Symbolic.Analyzers;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -113,5 +112,4 @@
       Operators.Add(new SymbolicRegressionSolutionsAnalyzer());
       Operators.Add(new SymbolicRegressionPhenotypicDiversityAnalyzer());
-
       ParameterizeOperators();
     }
@@ -143,4 +141,14 @@
         }
       }
+      foreach (var op in Operators.OfType<SymbolicRegressionPhenotypicDiversityAnalyzer>()) {
+        var sim = op.SimilarityCalculator as SymbolicExpressionTreePhenotypicSimilarityCalculator;
+        if (sim == null) {
+          op.SimilarityCalculator = new SymbolicExpressionTreePhenotypicSimilarityCalculator {
+            SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName
+          };
+        } else {
+          sim.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        }
+      }
     }
   }
Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs	(revision 12049)
@@ -119,5 +119,4 @@
       set { ProblemDataParameter.Value = value; }
     }
-
     public ISymbolicDataAnalysisGrammar SymbolicExpressionTreeGrammar {
       get { return SymbolicExpressionTreeGrammarParameter.Value; }
@@ -128,5 +127,4 @@
       set { SymbolicExpressionTreeInterpreterParameter.Value = value; }
     }
-
     public IntValue MaximumSymbolicExpressionTreeDepth {
       get { return MaximumSymbolicExpressionTreeDepthParameter.Value; }
@@ -144,5 +142,4 @@
       get { return RelativeNumberOfEvaluatedSamplesParameter.Value; }
     }
-
     public IntRange FitnessCalculationPartition {
       get { return FitnessCalculationPartitionParameter.Value; }
@@ -352,4 +349,14 @@
         op.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
       }
+      foreach (var op in operators.OfType<SymbolicDataAnalysisBottomUpDiversityAnalyzer>()) {
+        var sim = op.SimilarityCalculator as SymbolicExpressionTreeBottomUpSimilarityCalculator;
+        if (sim == null) {
+          op.SimilarityCalculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator {
+            SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName
+          };
+        } else {
+          sim.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        }
+      }
     }
 
Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs	(revision 12049)
@@ -60,4 +60,7 @@
 
     public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
+      if (leftSolution == rightSolution)
+        return 1.0;
+
       var t1 = leftSolution.Variables[SolutionVariableName].Value as ISymbolicExpressionTree;
       var t2 = rightSolution.Variables[SolutionVariableName].Value as ISymbolicExpressionTree;
Index: branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs
===================================================================
--- branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs	(revision 12030)
+++ branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs	(revision 12049)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -63,4 +63,7 @@
 
     public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
+      if (leftSolution == rightSolution)
+        return 1.0;
+
       var leftValues = (DoubleArray)leftSolution.Variables["EstimatedValues"].Value;
       var rightValues = (DoubleArray)rightSolution.Variables["EstimatedValues"].Value;
