Index: /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj
===================================================================
--- /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 12195)
+++ /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj	(revision 12196)
@@ -220,4 +220,5 @@
     <Compile Include="Grammars\SymbolicExpressionGrammar.cs" />
     <Compile Include="Grammars\SymbolicExpressionTreeGrammar.cs" />
+    <Compile Include="SymbolicExpressionTreeEncoding.cs" />
     <Compile Include="SymbolicExpressionTreeTopLevelNode.cs" />
     <Compile Include="Crossovers\SubtreeCrossover.cs">
Index: /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeEncoding.cs
===================================================================
--- /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeEncoding.cs	(revision 12196)
+++ /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeEncoding.cs	(revision 12196)
@@ -0,0 +1,178 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [Item("SymbolicExpressionTreeEncoding", "Describes a symbolic expression tree encoding.")]
+  [StorableClass]
+  public class SymbolicExpressionTreeEncoding : Encoding<ISymbolicExpressionTreeCreator> {
+    #region Encoding Parameters
+    [Storable]
+    private IFixedValueParameter<IntValue> treeLengthParameter;
+    public IFixedValueParameter<IntValue> TreeLengthParameter {
+      get { return treeLengthParameter; }
+      set {
+        if (value == null) throw new ArgumentNullException("Tree length parameter must not be null.");
+        if (value.Value == null) throw new ArgumentNullException("Tree length parameter value must not be null.");
+        if (treeLengthParameter == value) return;
+
+        if (treeLengthParameter != null)
+          Parameters.Remove(treeLengthParameter);
+
+        treeLengthParameter = value;
+        Parameters.Add(treeLengthParameter);
+      }
+    }
+
+    [Storable]
+    private IFixedValueParameter<IntValue> treeDepthParameter;
+    public IFixedValueParameter<IntValue> TreeDepthParameter {
+      get { return treeDepthParameter; }
+      set {
+        if (value == null) throw new ArgumentNullException("Tree length parameter must not be null.");
+        if (value.Value == null) throw new ArgumentNullException("Tree length parameter value must not be null.");
+        if (treeDepthParameter == value) return;
+
+        if (treeDepthParameter != null)
+          Parameters.Remove(treeDepthParameter);
+
+        treeDepthParameter = value;
+        Parameters.Add(treeDepthParameter);
+      }
+    }
+    #endregion
+
+
+    [StorableConstructor]
+    public SymbolicExpressionTreeEncoding(bool deserializing) : base(deserializing) { }
+
+    public SymbolicExpressionTreeEncoding(Encoding<ISymbolicExpressionTreeCreator> original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public SymbolicExpressionTreeEncoding() : this("SymbolicExpressionTree") { }
+    public SymbolicExpressionTreeEncoding(string name) : base(name) { }
+
+    private SymbolicExpressionTreeEncoding(SymbolicExpressionTreeEncoding original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeEncoding(this, cloner);
+    }
+
+    public override void ConfigureOperators(IEnumerable<IOperator> operators) {
+      ConfigureCreators(operators.OfType<ISymbolicExpressionTreeCreator>());
+      ConfigureCrossovers(operators.OfType<ISymbolicExpressionTreeCrossover>());
+      ConfigureManipulators(operators.OfType<ISymbolicExpressionTreeManipulator>());
+    }
+
+    private void OnLengthParameterChanged() {
+      RegisterLengthParameterEvents();
+      ConfigureOperators(Operators);
+    }
+
+    private void OnDepthParameterChanged() {
+      RegisterDepthParameterEvents();
+      ConfigureOperators(Operators);
+    }
+
+    private void RegisterLengthParameterEvents() {
+      TreeLengthParameter.ValueChanged += (o, s) => ConfigureOperators(Operators);
+      TreeLengthParameter.Value.ValueChanged += (o, s) => ConfigureOperators(Operators);
+    }
+
+    private void RegisterDepthParameterEvents() {
+      TreeDepthParameter.ValueChanged += (o, s) => ConfigureOperators(Operators);
+      TreeDepthParameter.Value.ValueChanged += (o, s) => ConfigureOperators(Operators);
+    }
+
+    #region Operator discovery
+    private static readonly IEnumerable<Type> encodingSpecificOperatorTypes;
+
+    static SymbolicExpressionTreeEncoding() {
+      encodingSpecificOperatorTypes = new List<Type>
+      {
+        typeof(ISymbolicExpressionTreeOperator),
+        typeof(ISymbolicExpressionTreeCreator),
+        typeof(ISymbolicExpressionTreeCrossover),
+        typeof(ISymbolicExpressionTreeManipulator)
+      };
+    }
+
+    private void DiscoverOperators() {
+      var assembly = typeof(ISymbolicExpressionTreeOperator).Assembly;
+      var discoveredTypes = ApplicationManager.Manager.GetTypes(encodingSpecificOperatorTypes, assembly, true, false, false);
+      var operators = discoveredTypes.Select(t => (IOperator)Activator.CreateInstance(t));
+      var newOperators = operators.Except(Operators, new TypeEqualityComparer<IOperator>()).ToList();
+
+      ConfigureOperators(newOperators);
+      foreach (var @operator in newOperators)
+        AddOperator(@operator);
+    }
+    #endregion
+
+    #region Specific operator wiring
+    private void ConfigureCreators(IEnumerable<ISymbolicExpressionTreeCreator> creators) {
+      foreach (var creator in creators) {
+        creator.SymbolicExpressionTreeParameter.ActualName = Name;
+        // creator should have depth and length parameters?
+      }
+    }
+
+    private void ConfigureCrossovers(IEnumerable<ISymbolicExpressionTreeCrossover> crossovers) {
+      foreach (var crossover in crossovers) {
+        crossover.ParentsParameter.ActualName = Name;
+        crossover.ChildParameter.ActualName = Name;
+      }
+    }
+
+    private void ConfigureManipulators(IEnumerable<ISymbolicExpressionTreeManipulator> manipulators) {
+      foreach (var manipulator in manipulators) {
+        manipulator.SymbolicExpressionTreeParameter.ActualName = Name;
+        manipulator.SymbolicExpressionTreeParameter.Hidden = true;
+      }
+    }
+    #endregion
+  }
+
+  public static class IndividualExtensionMethods {
+    public static ISymbolicExpressionTree SymbolicExpressionTree(this Individual individual) {
+      var encoding = individual.GetEncoding<SymbolicExpressionTreeEncoding>();
+      return individual.SymbolicExpressionTree(encoding.Name);
+    }
+
+    public static ISymbolicExpressionTree SymbolicExpressionTree(this Individual individual, string name) {
+      return (ISymbolicExpressionTree)individual[name];
+    }
+  }
+}
