Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaCreator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaCreator.cs	(revision 13564)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaCreator.cs	(revision 13565)
@@ -189,35 +189,5 @@
       }
 
-      Func<double, double> rule;
       var replacementRule = ReplacementRatioUpdateRuleParameter.Value.Value;
-
-      switch (replacementRule) {
-        case "f(x) = x": {
-            rule = x => x;
-            break;
-          }
-        case "f(x) = tanh(x)": {
-            rule = x => Math.Tanh(x);
-            break;
-          }
-        case "f(x) = tanh(2x)": {
-            rule = x => Math.Tanh(2 * x);
-            break;
-          }
-        case "f(x) = tanh(3x)": {
-            rule = x => Math.Tanh(3 * x);
-            break;
-          }
-        case "f(x) = tanh(4x)": {
-            rule = x => Math.Tanh(4 * x);
-            break;
-          }
-        case "f(x) = 1-sqrt(1-x)": {
-            rule = x => 1 - Math.Sqrt(1 - x);
-            break;
-          }
-        default:
-          throw new ArgumentException("Unknown replacement rule");
-      }
 
       var evaluateSchemas = new OperationCollection();
@@ -235,5 +205,5 @@
       #region create schemas and add subscopes representing the individuals
       foreach (var schema in schemas) {
-        evaluateSchemas.Add(ExecutionContext.CreateChildOperation(new SchemaEvaluator { Schema = schema, ReplacementRule = rule }, ExecutionContext.Scope));
+        evaluateSchemas.Add(ExecutionContext.CreateChildOperation(new SchemaEvaluator { Schema = schema, ReplacementRule = replacementRule }, ExecutionContext.Scope));
       }
       #endregion
Index: /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaEvaluator.cs
===================================================================
--- /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaEvaluator.cs	(revision 13564)
+++ /branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/SchemaEvaluator.cs	(revision 13565)
@@ -132,14 +132,14 @@
     #endregion
 
-    private readonly SymbolicExpressionTreePhenotypicSimilarityCalculator calculator = new SymbolicExpressionTreePhenotypicSimilarityCalculator();
-    private readonly QueryMatch qm;
-
-    public Func<double, double> ReplacementRule { get; set; }
-
-    private readonly ISymbolicExpressionTreeNodeEqualityComparer comp = new SymbolicExpressionTreeNodeEqualityComparer {
-      MatchConstantValues = false,
-      MatchVariableWeights = false,
-      MatchVariableNames = true
-    };
+    private QueryMatch qm;
+
+    [Storable]
+    private SymbolicExpressionTreePhenotypicSimilarityCalculator calculator;
+
+    [Storable]
+    public string ReplacementRule { get; set; }
+
+    [Storable]
+    private ISymbolicExpressionTreeNodeEqualityComparer comparer;
 
     [Storable]
@@ -153,9 +153,19 @@
       if (!Parameters.ContainsKey(StrictSchemaMatchingParameterName))
         Parameters.Add(new LookupParameter<BoolValue>(StrictSchemaMatchingParameterName));
+
+      if (calculator == null)
+        calculator = new SymbolicExpressionTreePhenotypicSimilarityCalculator();
+
+      if (comparer == null)
+        comparer = new SymbolicExpressionTreeNodeEqualityComparer { MatchVariableNames = true, MatchVariableWeights = true, MatchConstantValues = false };
+
+      qm = new QueryMatch(comparer) { MatchParents = true };
     }
 
     public SchemaEvaluator() {
-      qm = new QueryMatch(comp) { MatchParents = true };
-      this.updateQualityOperator = new UpdateQualityOperator();
+      calculator = new SymbolicExpressionTreePhenotypicSimilarityCalculator();
+      comparer = new SymbolicExpressionTreeNodeEqualityComparer { MatchVariableNames = true, MatchVariableWeights = true, MatchConstantValues = false };
+      qm = new QueryMatch(comparer) { MatchParents = true };
+      updateQualityOperator = new UpdateQualityOperator();
       #region add parameters
       Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SchemaParameterName, "The current schema to be evaluated"));
@@ -186,7 +196,8 @@
 
     protected SchemaEvaluator(SchemaEvaluator original, Cloner cloner) : base(original, cloner) {
-      this.comp = new SymbolicExpressionTreeNodeEqualityComparer();
-      this.qm = new QueryMatch(comp) { MatchParents = original.qm?.MatchParents ?? true };
-      this.updateQualityOperator = new UpdateQualityOperator();
+      calculator = cloner.Clone(original.calculator);
+      comparer = cloner.Clone(original.comparer);
+      qm = new QueryMatch(comparer) { MatchParents = true };
+      updateQualityOperator = new UpdateQualityOperator();
       Schema = original.Schema;
     }
@@ -199,9 +210,9 @@
       var strictSchemaMatching = StrictSchemaMatchingParameter.ActualValue.Value;
       if (strictSchemaMatching) {
-        comp.MatchVariableWeights = true;
-        comp.MatchConstantValues = true;
+        comparer.MatchVariableWeights = true;
+        comparer.MatchConstantValues = true;
       } else {
-        comp.MatchVariableWeights = false;
-        comp.MatchConstantValues = false;
+        comparer.MatchVariableWeights = false;
+        comparer.MatchConstantValues = false;
       }
 
@@ -281,5 +292,5 @@
       if (adaptiveReplacementRatio) {
         var r = (double)matchingIndividuals.Count / individuals.Count;
-        replacementRatio = ReplacementRule(r);
+        replacementRatio = CalculateReplacementRatio(r);
       } else {
         replacementRatio = ReplacementRatio.Value;
@@ -305,4 +316,29 @@
     }
 
+    private double CalculateReplacementRatio(double r) {
+      switch (ReplacementRule) {
+        case "f(x) = x": {
+            return r;
+          }
+        case "f(x) = tanh(x)": {
+            return Math.Tanh(r);
+          }
+        case "f(x) = tanh(2x)": {
+            return Math.Tanh(2 * r);
+          }
+        case "f(x) = tanh(3x)": {
+            return Math.Tanh(3 * r);
+          }
+        case "f(x) = tanh(4x)": {
+            return Math.Tanh(4 * r);
+          }
+        case "f(x) = 1-sqrt(1-x)": {
+            return 1 - Math.Sqrt(1 - r);
+          }
+        default:
+          throw new ArgumentException("Unknown replacement rule");
+      }
+    }
+
     public static double CalculateSimilarity(ScopeList individuals, ISolutionSimilarityCalculator calculator, bool parallel = false, int nThreads = -1) {
       double similarity = 0;
