Index: branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs	(revision 16813)
@@ -22,4 +22,5 @@
 using System;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,5 +29,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 using HeuristicLab.Problems.DataAnalysis;
 using HeuristicLab.Problems.Instances;
@@ -60,4 +60,6 @@
     private static readonly CovarianceSquaredExponentialIso sqrExpIso;
 
+    private static readonly SymbolicExpressionTreeEncoding defaultEncoding;
+
     static GaussianProcessCovarianceOptimizationProblem() {
       // cumbersome initialization because of ConstrainedValueParameters
@@ -150,10 +152,11 @@
     private ICovarianceFunction covFunc;
 
-    public GaussianProcessCovarianceOptimizationProblem()
-      : base() {
+    public GaussianProcessCovarianceOptimizationProblem() : base(new SymbolicExpressionTreeEncoding()) {
       Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "The data for the regression problem", new RegressionProblemData()));
       Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptIterationsParameterName, "Number of optimization steps for hyperparameter values", new IntValue(50)));
       Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of random restarts for constant optimization.", new IntValue(10)));
       Parameters["Restarts"].Hidden = true;
+
+
       var g = new SimpleSymbolicExpressionGrammar();
       g.AddSymbols(new string[] { "Sum", "Product" }, 2, 2);
@@ -181,5 +184,8 @@
         "SquaredExponentialIso"
       });
-      base.Encoding = new SymbolicExpressionTreeEncoding(g, 10, 5);
+
+      Encoding.TreeLength = 10;
+      Encoding.TreeDepth = 5;
+      Encoding.Grammar = g;
     }
 
@@ -327,6 +333,5 @@
         var gradients = model.HyperparameterGradients;
         Array.Copy(gradients, grad, gradients.Length);
-      }
-      catch (ArgumentException) {
+      } catch (ArgumentException) {
         // building the GaussianProcessModel might fail, in this case we return the worst possible objective value
         func = 1.0E+300;
Index: branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeProblem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeProblem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeProblem.cs	(revision 16813)
@@ -24,9 +24,9 @@
 using System;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
 using HeuristicLab.Optimization;
-using HEAL.Attic;
 
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
@@ -46,5 +46,5 @@
     }
 
-    protected SymbolicExpressionTreeProblem() : base() { }
+    protected SymbolicExpressionTreeProblem(SymbolicExpressionTreeEncoding encoding) : base(encoding) { }
 
     public override void Analyze(ISymbolicExpressionTree[] trees, double[] qualities, ResultCollection results,
@@ -63,4 +63,5 @@
         var bestIdx = Array.IndexOf(qualities, bestQuality);
         var bestClone = (IItem)trees[bestIdx].Clone();
+
         results["Best Solution"].Value = bestClone;
         results["Best Solution Quality"].Value = new DoubleValue(bestQuality);
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs	(revision 16813)
@@ -23,4 +23,5 @@
 using System.Diagnostics.Contracts;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -29,5 +30,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 
@@ -116,16 +116,18 @@
     #endregion
 
-    public Problem()
-      : base() {
+    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
       BoolMatrix world = new BoolMatrix(ToBoolMatrix(santaFeAntTrail));
       Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world));
       Parameters.Add(new ValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600)));
 
-      base.BestKnownQuality = 89;
       var g = new SimpleSymbolicExpressionGrammar();
       g.AddSymbols(new string[] { "IfFoodAhead", "Prog2" }, 2, 2);
       g.AddSymbols(new string[] { "Prog3" }, 3, 3);
       g.AddTerminalSymbols(new string[] { "Move", "Left", "Right" });
-      base.Encoding = new SymbolicExpressionTreeEncoding(g, 20, 10);
+
+      Encoding.TreeLength = 20;
+      Encoding.TreeDepth = 10;
+      Encoding.Grammar = g;
+      base.BestKnownQuality = 89;
     }
 
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs	(revision 16813)
@@ -23,9 +23,9 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 using HeuristicLab.Problems.DataAnalysis;
 using HeuristicLab.Problems.Instances;
@@ -81,10 +81,9 @@
     #endregion
 
-    public Problem()
-      : base() {
+    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
       Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "The data for the regression problem", new RegressionProblemData()));
 
-      var g = new SimpleSymbolicExpressionGrammar(); // empty grammar is replaced in UpdateGrammar()
-      base.Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
+      Encoding.TreeLength = 100;
+      Encoding.TreeDepth = 17;
 
       UpdateGrammar();
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs	(revision 16813)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,5 +29,4 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 
@@ -78,9 +78,9 @@
 
     public EvenParityProblem()
-      : base() {
+      : base(new SymbolicExpressionTreeEncoding()) {
       Parameters.Add(new FixedValueParameter<IntValue>(NumberOfBitsParameterName, "The number of bits for the input parameter for the even parity function", new IntValue(4)));
 
-      var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar
-      Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
+      Encoding.TreeLength = 100;
+      Encoding.TreeDepth = 17;
 
       UpdateGrammar();
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs	(revision 16813)
@@ -24,4 +24,5 @@
 using System.Diagnostics.Contracts;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -29,5 +30,4 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 
@@ -81,12 +81,11 @@
 
     public MultiplexerProblem()
-      : base() {
+      : base(new SymbolicExpressionTreeEncoding()) {
       Parameters.Add(new FixedValueParameter<IntValue>(NumberOfBitsParameterName,
         "The number of bits for the input parameter for the multiplexer function. This is the sum of the number of address bits and the number of input lines. E.g. the 11-MUX has 3 address bits and 8 input lines",
         new IntValue(11)));
 
-      var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar
-      Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
-
+      Encoding.TreeLength = 100;
+      Encoding.TreeDepth = 17;
       UpdateGrammar();
       RegisterEventHandlers();
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/LawnMower/Problem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/LawnMower/Problem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/LawnMower/Problem.cs	(revision 16813)
@@ -22,4 +22,5 @@
 using System;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,5 +29,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 using HeuristicLab.Random;
 
@@ -62,6 +62,5 @@
     #endregion
 
-    public Problem()
-      : base() {
+    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
       Parameters.Add(new FixedValueParameter<IntValue>(LawnWidthParameterName, "Width of the lawn.", new IntValue(8)));
       Parameters.Add(new FixedValueParameter<IntValue>(LawnLengthParameterName, "Length of the lawn.", new IntValue(8)));
@@ -77,5 +76,7 @@
       }
 
-      Encoding = new SymbolicExpressionTreeEncoding(g, 1000, 17);
+      Encoding.TreeLength = 1000;
+      Encoding.TreeDepth = 17;
+      Encoding.Grammar = g;
     }
 
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs	(revision 16813)
@@ -20,4 +20,5 @@
 #endregion
 
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -26,5 +27,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.GeneticProgramming.Robocode {
@@ -73,6 +73,5 @@
     }
 
-    public Problem()
-      : base() {
+    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
       DirectoryValue robocodeDir = new DirectoryValue { Value = @"robocode" };
 
@@ -85,5 +84,7 @@
       Parameters.Add(new ValueParameter<EnemyCollection>(EnemiesParameterName, "The enemies that should be battled.", robotList));
 
-      Encoding = new SymbolicExpressionTreeEncoding(new Grammar(), 1000, 10);
+      Encoding.TreeLength = 1000;
+      Encoding.TreeDepth = 10;
+      Encoding.Grammar = new Grammar();
       Encoding.FunctionArguments = 0;
       Encoding.FunctionDefinitions = 0;
@@ -134,5 +135,5 @@
     }
 
-    void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {
+    private void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {
       EnemiesParameter.Value.RobocodePath = RobocodePathParameter.Value.Value;
     }
Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntProblem.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntProblem.cs	(revision 16812)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntProblem.cs	(revision 16813)
@@ -23,4 +23,5 @@
 
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -29,5 +30,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 using HeuristicLab.Problems.GeneticProgramming.ArtificialAnt;
 using HeuristicLab.Problems.GrammaticalEvolution.Mappers;
@@ -85,6 +85,5 @@
     }
 
-    public GEArtificialAntProblem()
-      : base() {
+    public GEArtificialAntProblem() : base(new IntegerVectorEncoding()) {
       wrappedAntProblem = new HeuristicLab.Problems.GeneticProgramming.ArtificialAnt.Problem();
       Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", wrappedAntProblem.World));
@@ -92,5 +91,6 @@
       Parameters.Add(new ValueParameter<IGenotypeToPhenotypeMapper>("GenotypeToPhenotypeMapper", "Maps the genotype (an integer vector) to the phenotype (a symbolic expression tree).", new DepthFirstMapper()));
 
-      Encoding = new IntegerVectorEncoding(30) { Bounds = new IntMatrix(new int[,] { { 0, 100 } }) };
+      Encoding.Length = 30;
+      Encoding.Bounds = new IntMatrix(new int[,] { { 0, 100 } });
 
       BestKnownQuality = wrappedAntProblem.BestKnownQuality;
