Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs	(revision 11495)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs	(revision 11496)
@@ -38,6 +38,4 @@
     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
-    private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
-    private const string ClonedSymbolicExpressionTreeGrammarParameterName = "ClonedSymbolicExpressionTreeGrammar";
 
     #region Parameter Properties
@@ -49,13 +47,4 @@
       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
     }
-
-    public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
-      get { return (IValueLookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName]; }
-    }
-
-    public ILookupParameter<ISymbolicExpressionGrammar> ClonedSymbolicExpressionTreeGrammarParameter {
-      get { return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[ClonedSymbolicExpressionTreeGrammarParameterName]; }
-    }
-
     #endregion
     #region Properties
@@ -66,8 +55,4 @@
     public IntValue MaximumSymbolicExpressionTreeLength {
       get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }
-    }
-
-    public ISymbolicExpressionGrammar ClonedSymbolicExpressionTreeGrammar {
-      get { return ClonedSymbolicExpressionTreeGrammarParameter.ActualValue; }
     }
 
@@ -84,8 +69,4 @@
       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName,
         "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
-      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName,
-        "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
-      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName,
-        "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
     }
 
@@ -94,19 +75,7 @@
     }
 
-    public override IOperation InstrumentedApply() {
-      if (ClonedSymbolicExpressionTreeGrammarParameter.ActualValue == null) {
-        SymbolicExpressionTreeGrammarParameter.ActualValue.ReadOnly = true;
-        IScope globalScope = ExecutionContext.Scope;
-        while (globalScope.Parent != null)
-          globalScope = globalScope.Parent;
-
-        globalScope.Variables.Add(new Variable(ClonedSymbolicExpressionTreeGrammarParameterName,
-          (ISymbolicExpressionGrammar)SymbolicExpressionTreeGrammarParameter.ActualValue.Clone()));
-      }
-      return base.InstrumentedApply();
-    }
 
     protected override ISymbolicExpressionTree Create(IRandom random) {
-      return Create(random, ClonedSymbolicExpressionTreeGrammar, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
+      return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     }
 
@@ -129,9 +98,9 @@
       var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
       if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
-      rootNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      rootNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
 
       var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
       if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
-      startNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      startNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
 
       rootNode.AddSubtree(startNode);
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs	(revision 11495)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs	(revision 11496)
@@ -38,6 +38,4 @@
     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
-    private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
-    private const string ClonedSymbolicExpressionTreeGrammarParameterName = "ClonedSymbolicExpressionTreeGrammar";
 
     #region Parameter Properties
@@ -48,12 +46,4 @@
     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
-    }
-
-    public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
-      get { return (IValueLookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName]; }
-    }
-
-    public ILookupParameter<ISymbolicExpressionGrammar> ClonedSymbolicExpressionTreeGrammarParameter {
-      get { return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[ClonedSymbolicExpressionTreeGrammarParameterName]; }
     }
 
@@ -67,9 +57,4 @@
       get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }
     }
-
-    public ISymbolicExpressionGrammar ClonedSymbolicExpressionTreeGrammar {
-      get { return ClonedSymbolicExpressionTreeGrammarParameter.ActualValue; }
-    }
-
     #endregion
 
@@ -84,8 +69,4 @@
       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName,
         "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
-      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName,
-        "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
-      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName,
-        "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
     }
 
@@ -94,19 +75,7 @@
     }
 
-    public override IOperation InstrumentedApply() {
-      if (ClonedSymbolicExpressionTreeGrammarParameter.ActualValue == null) {
-        SymbolicExpressionTreeGrammarParameter.ActualValue.ReadOnly = true;
-        IScope globalScope = ExecutionContext.Scope;
-        while (globalScope.Parent != null)
-          globalScope = globalScope.Parent;
-
-        globalScope.Variables.Add(new Variable(ClonedSymbolicExpressionTreeGrammarParameterName,
-          (ISymbolicExpressionGrammar)SymbolicExpressionTreeGrammarParameter.ActualValue.Clone()));
-      }
-      return base.InstrumentedApply();
-    }
 
     protected override ISymbolicExpressionTree Create(IRandom random) {
-      return Create(random, ClonedSymbolicExpressionTreeGrammar,
+      return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue,
         MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     }
@@ -128,10 +97,11 @@
       var tree = new SymbolicExpressionTree();
       var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
-      rootNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
       if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
+      rootNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
+
 
       var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
       if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
-      startNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      startNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
 
       rootNode.AddSubtree(startNode);
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs	(revision 11495)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs	(revision 11496)
@@ -39,6 +39,4 @@
     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
-    private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
-    private const string ClonedSymbolicExpressionTreeGrammarParameterName = "ClonedSymbolicExpressionTreeGrammar";
     #region Parameter Properties
     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
@@ -47,10 +45,4 @@
     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
-    }
-    public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
-      get { return (IValueLookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName]; }
-    }
-    public ILookupParameter<ISymbolicExpressionGrammar> ClonedSymbolicExpressionTreeGrammarParameter {
-      get { return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[ClonedSymbolicExpressionTreeGrammarParameterName]; }
     }
     #endregion
@@ -61,7 +53,4 @@
     public IntValue MaximumSymbolicExpressionTreeDepth {
       get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; }
-    }
-    public ISymbolicExpressionGrammar SymbolicExpressionTreeGrammar {
-      get { return ClonedSymbolicExpressionTreeGrammarParameter.ActualValue; }
     }
     #endregion
@@ -74,6 +63,4 @@
       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree."));
       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
-      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName, "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
-      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName, "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
     }
 
@@ -81,24 +68,8 @@
       return new ProbabilisticTreeCreator(this, cloner);
     }
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      if (!Parameters.ContainsKey(ClonedSymbolicExpressionTreeGrammarParameterName))
-        Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName, "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
-    }
-
-    public override IOperation InstrumentedApply() {
-      if (ClonedSymbolicExpressionTreeGrammarParameter.ActualValue == null) {
-        SymbolicExpressionTreeGrammarParameter.ActualValue.ReadOnly = true;
-        IScope globalScope = ExecutionContext.Scope;
-        while (globalScope.Parent != null)
-          globalScope = globalScope.Parent;
-
-        globalScope.Variables.Add(new Variable(ClonedSymbolicExpressionTreeGrammarParameterName, (ISymbolicExpressionGrammar)SymbolicExpressionTreeGrammarParameter.ActualValue.Clone()));
-      }
-      return base.InstrumentedApply();
-    }
+
 
     protected override ISymbolicExpressionTree Create(IRandom random) {
-      return Create(random, SymbolicExpressionTreeGrammar, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
+      return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     }
 
@@ -111,8 +82,10 @@
       var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
       if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
-      rootNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      rootNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
+
       var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
-      startNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
       if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
+      startNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
+
       rootNode.AddSubtree(startNode);
       PTC2(random, startNode, maxTreeLength, maxTreeDepth);
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/RampedHalfAndHalfTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/RampedHalfAndHalfTreeCreator.cs	(revision 11495)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/RampedHalfAndHalfTreeCreator.cs	(revision 11496)
@@ -36,6 +36,4 @@
     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
-    private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
-    private const string ClonedSymbolicExpressionTreeGrammarParameterName = "ClonedSymbolicExpressionTreeGrammar";
 
     #region Parameter Properties
@@ -48,16 +46,4 @@
     }
 
-    public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
-      get {
-        return (IValueLookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName];
-      }
-    }
-
-    public ILookupParameter<ISymbolicExpressionGrammar> ClonedSymbolicExpressionTreeGrammarParameter {
-      get {
-        return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[ClonedSymbolicExpressionTreeGrammarParameterName];
-      }
-    }
-
     #endregion
     #region Properties
@@ -68,8 +54,4 @@
     public IntValue MaximumSymbolicExpressionTreeLength {
       get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }
-    }
-
-    public ISymbolicExpressionGrammar ClonedSymbolicExpressionTreeGrammar {
-      get { return ClonedSymbolicExpressionTreeGrammarParameter.ActualValue; }
     }
     #endregion
@@ -85,8 +67,4 @@
       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName,
         "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
-      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName,
-        "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
-      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName,
-        "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
     }
 
@@ -95,19 +73,6 @@
     }
 
-    public override IOperation InstrumentedApply() {
-      if (ClonedSymbolicExpressionTreeGrammarParameter.ActualValue == null) {
-        SymbolicExpressionTreeGrammarParameter.ActualValue.ReadOnly = true;
-        IScope globalScope = ExecutionContext.Scope;
-        while (globalScope.Parent != null)
-          globalScope = globalScope.Parent;
-
-        globalScope.Variables.Add(new Variable(ClonedSymbolicExpressionTreeGrammarParameterName,
-          (ISymbolicExpressionGrammar)SymbolicExpressionTreeGrammarParameter.ActualValue.Clone()));
-      }
-      return base.InstrumentedApply();
-    }
-
     protected override ISymbolicExpressionTree Create(IRandom random) {
-      return Create(random, ClonedSymbolicExpressionTreeGrammar, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
+      return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
     }
 
@@ -129,9 +94,9 @@
       var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
       if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
-      rootNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      rootNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
 
       var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
       if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);
-      startNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      startNode.SetGrammar(grammar.CreateExpressionTreeGrammar());
 
       rootNode.AddSubtree(startNode);
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/SymbolicExpressionTreeCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/SymbolicExpressionTreeCreator.cs	(revision 11495)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/SymbolicExpressionTreeCreator.cs	(revision 11496)
@@ -33,17 +33,21 @@
   public abstract class SymbolicExpressionTreeCreator : SymbolicExpressionTreeOperator, ISymbolicExpressionTreeCreator {
     private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
+    private const string ClonedSymbolicExpressionTreeGrammarParameterName = "ClonedSymbolicExpressionTreeGrammar";
+
     #region Parameter Properties
     public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
       get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
     }
+
+    public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
+      get { return (IValueLookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName]; }
+    }
+
+    public ILookupParameter<ISymbolicExpressionGrammar> ClonedSymbolicExpressionTreeGrammarParameter {
+      get { return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[ClonedSymbolicExpressionTreeGrammarParameterName]; }
+    }
     #endregion
 
-    #region Properties
-    public ISymbolicExpressionTree SymbolicExpressionTree {
-      get { return SymbolicExpressionTreeParameter.ActualValue; }
-      set { SymbolicExpressionTreeParameter.ActualValue = value; }
-    }
-
-    #endregion
     [StorableConstructor]
     protected SymbolicExpressionTreeCreator(bool deserializing) : base(deserializing) { }
@@ -52,8 +56,27 @@
       : base() {
       Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree that should be created."));
+      Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName,
+        "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));
+      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName,
+        "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(ClonedSymbolicExpressionTreeGrammarParameterName))
+        Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName, "An immutable clone of the concrete grammar that is actually used to create and manipulate trees."));
     }
 
     public override IOperation InstrumentedApply() {
-      SymbolicExpressionTree = Create(Random);
+      if (ClonedSymbolicExpressionTreeGrammarParameter.ActualValue == null) {
+        SymbolicExpressionTreeGrammarParameter.ActualValue.ReadOnly = true;
+        IScope globalScope = ExecutionContext.Scope;
+        while (globalScope.Parent != null)
+          globalScope = globalScope.Parent;
+
+        globalScope.Variables.Add(new Variable(ClonedSymbolicExpressionTreeGrammarParameterName,
+          (ISymbolicExpressionGrammar)SymbolicExpressionTreeGrammarParameter.ActualValue.Clone()));
+      }
+      SymbolicExpressionTreeParameter.ActualValue = Create(Random);
       return base.InstrumentedApply();
     }
