Index: /trunk/sources/HeuristicLab 3.3.sln
===================================================================
--- /trunk/sources/HeuristicLab 3.3.sln	(revision 3222)
+++ /trunk/sources/HeuristicLab 3.3.sln	(revision 3223)
@@ -39,4 +39,5 @@
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab 3.3", "HeuristicLab 3.3\HeuristicLab 3.3.csproj", "{B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}"
 	ProjectSection(ProjectDependencies) = postProject
+		{125D3006-67F5-48CB-913E-73C0548F17FA} = {125D3006-67F5-48CB-913E-73C0548F17FA}
 		{489CFE09-FDF7-4C89-BAB5-BD09CADD61AD} = {489CFE09-FDF7-4C89-BAB5-BD09CADD61AD}
 		{72104A0B-90E7-42F3-9ABE-9BBBADD4B943} = {72104A0B-90E7-42F3-9ABE-9BBBADD4B943}
@@ -79,4 +80,5 @@
 		{BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {BF7D9494-A586-457B-8DF9-ED599F9E6A71}
 		{DE12659F-87C4-48E6-B2E3-4E73DD95A540} = {DE12659F-87C4-48E6-B2E3-4E73DD95A540}
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4} = {F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}
 		{DBECB8B0-B166-4133-BAF1-ED67C3FD7FCA} = {DBECB8B0-B166-4133-BAF1-ED67C3FD7FCA}
 		{887425B4-4348-49ED-A457-B7D2C26DDBF9} = {887425B4-4348-49ED-A457-B7D2C26DDBF9}
@@ -224,5 +226,7 @@
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Services.Deployment-3.3.Tests", "HeuristicLab.Services.Deployment\3.3\Tests\HeuristicLab.Services.Deployment-3.3.Tests.csproj", "{421D9CCA-5A48-4813-AB9C-ED7025F9CC35}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Encodings.SymbolicExpressionTree-3.3", "HeuristicLab.Encodings.SymbolicExpressionTree\3.3\HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj", "{125D3006-67F5-48CB-913E-73C0548F17FA}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3", "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj", "{125D3006-67F5-48CB-913E-73C0548F17FA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.ArtificialAnt-3.3", "HeuristicLab.Problems.ArtificialAnt\3.3\HeuristicLab.Problems.ArtificialAnt-3.3.csproj", "{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}"
 EndProject
 Global
@@ -1259,7 +1263,23 @@
 		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|x86.ActiveCfg = Release|x86
 		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|x86.Build.0 = Release|x86
-		{125D3006-67F5-48CB-913E-73C0548F17FA}.Services|Any CPU.ActiveCfg = Release|Any CPU
-		{125D3006-67F5-48CB-913E-73C0548F17FA}.Services|x64.ActiveCfg = Release|x64
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Services|Any CPU.ActiveCfg = Release|x86
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Services|x64.ActiveCfg = Release|x86
 		{125D3006-67F5-48CB-913E-73C0548F17FA}.Services|x86.ActiveCfg = Release|x86
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Services|x86.Build.0 = Release|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Debug|x64.ActiveCfg = Debug|x64
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Debug|x64.Build.0 = Debug|x64
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Debug|x86.ActiveCfg = Debug|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Debug|x86.Build.0 = Debug|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Release|x64.ActiveCfg = Release|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Release|x64.Build.0 = Release|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Release|x86.ActiveCfg = Release|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Release|x86.Build.0 = Release|x86
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Services|Any CPU.ActiveCfg = Release|Any CPU
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Services|x64.ActiveCfg = Release|x64
+		{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}.Services|x86.ActiveCfg = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: /trunk/sources/HeuristicLab 3.3/Files.txt
===================================================================
--- /trunk/sources/HeuristicLab 3.3/Files.txt	(revision 3222)
+++ /trunk/sources/HeuristicLab 3.3/Files.txt	(revision 3223)
@@ -24,4 +24,5 @@
 HeuristicLab.Encodings.PermutationEncoding\3.3:HeuristicLab.Encodings.PermutationEncoding-3.3.dll
 HeuristicLab.Encodings.RealVectorEncoding\3.3:HeuristicLab.Encodings.RealVectorEncoding-3.3.dll
+HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.3:HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll
 HeuristicLab.Logging\3.3:HeuristicLab.Logging-3.3.dll
 HeuristicLab.MainForm\3.2:HeuristicLab.MainForm-3.2.dll
@@ -40,4 +41,5 @@
 HeuristicLab.Persistence.GUI\3.3:HeuristicLab.Persistence.GUI-3.3.dll
 HeuristicLab.PluginAdministrator\3.3:HeuristicLab.PluginAdministrator-3.3.dll
+HeuristicLab.Problems.ArtificialAnt\3.3:HeuristicLab.Problems.ArtificialAnt-3.3.dll
 HeuristicLab.Problems.Knapsack\3.3:HeuristicLab.Problems.Knapsack-3.3.dll
 HeuristicLab.Problems.Knapsack.Views\3.3:HeuristicLab.Problems.Knapsack.Views-3.3.dll
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs	(revision 3223)
@@ -0,0 +1,224 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Random;
+using System;
+using System.Linq;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  [Item("ProbabilisticTreeCreator", "An operator that creates new symbolic expression trees with uniformly distributed size")]
+  public class ProbabilisticTreeCreator : SymbolicExpressionTreeCreator {
+    private const int MAX_TRIES = 100;
+    public ProbabilisticTreeCreator()
+      : base() {
+    }
+
+    protected override SymbolicExpressionTree Create(IRandom random, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight) {
+      return Apply(random, grammar, maxTreeSize.Value, maxTreeHeight.Value);
+    }
+
+    public SymbolicExpressionTree Apply(IRandom random, ISymbolicExpressionGrammar grammar, int maxTreeSize, int maxTreeHeight) {
+      // tree size is limited by the grammar and by the explicit size constraints
+      int allowedMinSize = grammar.MinimalExpressionLength(grammar.StartSymbol);
+      int allowedMaxSize = Math.Min(maxTreeSize, grammar.MaximalExpressionLength(grammar.StartSymbol));
+      // select a target tree size uniformly in the possible range (as determined by explicit limits and limits of the grammar)
+      int treeSize = random.Next(allowedMinSize, allowedMaxSize);
+      SymbolicExpressionTree tree = new SymbolicExpressionTree();
+      int tries = 0;
+      do {
+        try {
+          // determine possible root symbols to create a tree of the target size
+          var possibleRootSymbols = from symbol in grammar.AllowedSymbols(grammar.StartSymbol, 0)
+                                    where treeSize <= grammar.MaximalExpressionLength(symbol)
+                                    where treeSize >= grammar.MinimalExpressionLength(symbol)
+                                    select symbol;
+          Symbol rootSymbol = SelectRandomSymbol(random, possibleRootSymbols);
+          tree.Root = PTC2(random, grammar, rootSymbol, treeSize, maxTreeHeight);
+        }
+        catch (ArgumentException) {
+          // try a different size
+          treeSize = random.Next(allowedMinSize, allowedMaxSize);
+          tries = 0;
+        }
+        if (tries++ >= MAX_TRIES) {
+          // try a different size
+          treeSize = random.Next(allowedMinSize, allowedMaxSize);
+          tries = 0;
+        }
+      } while (tree.Root == null || tree.Size > maxTreeSize || tree.Height > maxTreeHeight);
+      return tree;
+    }
+
+    private Symbol SelectRandomSymbol(IRandom random, IEnumerable<Symbol> symbols) {
+      var symbolList = symbols.ToList();
+      return symbolList[random.Next(symbolList.Count)];
+    }
+
+
+    private SymbolicExpressionTreeNode PTC2(IRandom random, ISymbolicExpressionGrammar grammar, Symbol rootSymbol, int size, int maxDepth) {
+      SymbolicExpressionTreeNode root = rootSymbol.CreateTreeNode();
+      if (size <= 1 || maxDepth <= 1) return root;
+      List<object[]> list = new List<object[]>();
+      int currentSize = 1;
+      int totalListMinSize = grammar.MinimalExpressionLength(rootSymbol) - 1;
+
+      int actualArity = SampleArity(random, grammar, rootSymbol, size);
+      for (int i = 0; i < actualArity; i++) {
+        // insert a dummy sub-tree and add the pending extension to the list
+        root.AddSubTree(null);
+        list.Add(new object[] { root, i, 2 });
+      }
+
+      // while there are pending extension points and we have not reached the limit of adding new extension points
+      while (list.Count > 0 && totalListMinSize + currentSize < size) {
+        int randomIndex = random.Next(list.Count);
+        object[] nextExtension = list[randomIndex];
+        list.RemoveAt(randomIndex);
+        SymbolicExpressionTreeNode parent = (SymbolicExpressionTreeNode)nextExtension[0];
+        int argumentIndex = (int)nextExtension[1];
+        int extensionDepth = (int)nextExtension[2];
+        if (extensionDepth + grammar.MinimalExpressionDepth(parent.Symbol) >= maxDepth) {
+          parent.RemoveSubTree(argumentIndex);
+          SymbolicExpressionTreeNode branch = CreateMinimalTree(random, grammar, grammar.AllowedSymbols(parent.Symbol, argumentIndex));
+          parent.InsertSubTree(argumentIndex, branch); // insert a smallest possible tree
+          currentSize += branch.GetSize();
+          totalListMinSize -= branch.GetSize();
+        } else {
+          var allowedSubFunctions = from s in grammar.AllowedSymbols(parent.Symbol, argumentIndex)
+                                    where grammar.MinimalExpressionDepth(parent.Symbol) + extensionDepth - 1 < maxDepth
+                                    where grammar.MaximalExpressionLength(s) > size - totalListMinSize - currentSize ||
+                                          totalListMinSize + currentSize >= size * 0.9 // if the necessary size is almost reached then also allow
+                                    // terminals or terminal-branches
+                                    select s;
+          Symbol selectedSymbol = SelectRandomSymbol(random, allowedSubFunctions);
+          SymbolicExpressionTreeNode newTree = selectedSymbol.CreateTreeNode();
+          parent.RemoveSubTree(argumentIndex);
+          parent.InsertSubTree(argumentIndex, newTree);
+          currentSize++;
+          totalListMinSize--;
+
+          actualArity = SampleArity(random, grammar, selectedSymbol, size - currentSize);
+          for (int i = 0; i < actualArity; i++) {
+            // insert a dummy sub-tree and add the pending extension to the list
+            newTree.AddSubTree(null);
+            list.Add(new object[] { newTree, i, extensionDepth + 1 });
+          }
+          totalListMinSize += grammar.MinimalExpressionLength(selectedSymbol);
+        }
+      }
+      // fill all pending extension points
+      while (list.Count > 0) {
+        int randomIndex = random.Next(list.Count);
+        object[] nextExtension = list[randomIndex];
+        list.RemoveAt(randomIndex);
+        SymbolicExpressionTreeNode parent = (SymbolicExpressionTreeNode)nextExtension[0];
+        int a = (int)nextExtension[1];
+        int d = (int)nextExtension[2];
+        parent.RemoveSubTree(a);
+        parent.InsertSubTree(a,
+          CreateMinimalTree(random, grammar, grammar.AllowedSymbols(parent.Symbol, a))); // append a tree with minimal possible height
+      }
+      return root;
+    }
+
+    private int SampleArity(IRandom random, ISymbolicExpressionGrammar grammar, Symbol symbol, int targetSize) {
+      // select actualArity randomly with the constraint that the sub-trees in the minimal arity can become large enough
+      int minArity = grammar.MinSubTrees(symbol);
+      int maxArity = grammar.MaxSubTrees(symbol);
+      if (maxArity >= targetSize) {
+        maxArity = targetSize;
+      }
+      // the min number of sub-trees has to be set to a value that is large enough so that the largest possible tree is at least tree size
+      // if 1..3 trees are possible and the largest possible first sub-tree is smaller larger than the target size then minArity should be at least 2
+      int aggregatedLongestExpressionLength = 1;
+      for (int i = 0; i < maxArity; i++) {
+        aggregatedLongestExpressionLength += (from s in grammar.AllowedSymbols(symbol, i)
+                                              select grammar.MaximalExpressionLength(symbol)).Max();
+        if (aggregatedLongestExpressionLength < targetSize) minArity = i;
+        else break;
+      }
+
+      // the max number of sub-trees has to be set to a value that is small enough so that the smallest possible tree is at most tree size 
+      // if 1..3 trees are possible and the smallest possible first sub-tree is already larger than the target size then maxArity should be at most 0
+      int aggregatedShortestExpressionLength = 1;
+      for (int i = 0; i < maxArity; i++) {
+        aggregatedShortestExpressionLength += (from s in grammar.AllowedSymbols(symbol, i)
+                                               select grammar.MinimalExpressionLength(symbol)).Min();
+        if (aggregatedShortestExpressionLength > targetSize) {
+          maxArity = i;
+          break;
+        }
+      }
+      if (minArity > maxArity) throw new ArgumentException();
+      return random.Next(minArity, maxArity + 1);
+    }
+
+    private SymbolicExpressionTreeNode CreateMinimalTree(IRandom random, ISymbolicExpressionGrammar grammar, IEnumerable<Symbol> symbols) {
+      // determine possible symbols that will lead to the smallest possible tree
+      var possibleSymbols = (from s in symbols
+                             group s by grammar.MinimalExpressionLength(s) into g
+                             orderby g.Key
+                             select g).First();
+      var selectedSymbol = SelectRandomSymbol(random, possibleSymbols);
+      // build minimal tree by recursive application
+      var tree = selectedSymbol.CreateTreeNode();
+      for (int i = 0; i < grammar.MinSubTrees(selectedSymbol); i++)
+        tree.AddSubTree(CreateMinimalTree(random, grammar, grammar.AllowedSymbols(selectedSymbol, i)));
+      return tree;
+    }
+
+    //private bool IsRecursiveExpansionPossible(Symbol symbol) {
+    //  return FindCycle(function, new Stack<IFunction>());
+    //}
+
+    //private Dictionary<IFunction, bool> inCycle = new Dictionary<IFunction, bool>();
+    //private bool FindCycle(IFunction function, Stack<IFunction> functionChain) {
+    //  if (inCycle.ContainsKey(function)) {
+    //    return inCycle[function];
+    //  } else if (IsTerminal(function)) {
+    //    inCycle[function] = false;
+    //    return false;
+    //  } else if (functionChain.Contains(function)) {
+    //    inCycle[function] = true;
+    //    return true;
+    //  } else {
+    //    functionChain.Push(function);
+    //    bool result = false;
+    //    // all slot indexes
+    //    for (int i = 0; i < function.MaxSubTrees; i++) {
+    //      foreach (IFunction subFunction in GetAllowedSubFunctions(function, i)) {
+    //        result |= FindCycle(subFunction, functionChain);
+    //      }
+    //    }
+
+    //    functionChain.Pop();
+    //    inCycle[function] = result;
+    //    return result;
+    //  }
+    //}
+
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/RampedTreeCreator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/RampedTreeCreator.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/RampedTreeCreator.cs	(revision 3223)
@@ -0,0 +1,69 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using System;
+using HeuristicLab.Random;
+using System.Diagnostics;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class RampedTreeCreator : OperatorBase {
+    public override string Description {
+      get { return @"Generates a new random operator tree."; }
+    }
+
+    public RampedTreeCreator()
+      : base() {
+      AddVariableInfo(new VariableInfo("Random", "Uniform random number generator", typeof(MersenneTwister), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionLibrary", "The function library containing all available functions", typeof(FunctionLibrary), VariableKind.In));
+      AddVariableInfo(new VariableInfo("MinTreeHeight", "The minimal allowed height of the tree", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionTree", "The created tree", typeof(IGeneticProgrammingModel), VariableKind.New | VariableKind.Out));
+      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.New | VariableKind.Out));
+      AddVariableInfo(new VariableInfo("TreeHeight", "The height of the tree", typeof(IntData), VariableKind.New | VariableKind.Out));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      IRandom random = GetVariableValue<IRandom>("Random", scope, true);
+      FunctionLibrary opLibrary = GetVariableValue<FunctionLibrary>("FunctionLibrary", scope, true);
+      int minTreeHeight = GetVariableValue<IntData>("MinTreeHeight", scope, true).Data;
+      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
+      double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data;
+
+      TreeGardener gardener = new TreeGardener(random, opLibrary);
+
+      int treeHeight = random.Next(minTreeHeight, maxTreeHeight + 1);
+      IFunctionTree root;
+      if(random.NextDouble() <= balancedTreesRate) {
+        root = gardener.CreateBalancedRandomTree(Int32.MaxValue, treeHeight);
+      } else {
+        root = gardener.CreateUnbalancedRandomTree(Int32.MaxValue, treeHeight);
+      }
+
+      Debug.Assert(gardener.IsValidTree(root) && root.GetHeight() <= maxTreeHeight);
+
+      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("FunctionTree"), new GeneticProgrammingModel(root)));
+      return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(root), scope);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/GPCrossoverBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/GPCrossoverBase.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/GPCrossoverBase.cs	(revision 3223)
@@ -0,0 +1,58 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Core;
+using System.Diagnostics;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public abstract class GPCrossoverBase : CrossoverBase {
+    public GPCrossoverBase()
+      : base() {
+      AddVariableInfo(new VariableInfo("FunctionLibrary", "The operator library containing all available operators", typeof(FunctionLibrary), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionTree", "The tree to crossover", typeof(IGeneticProgrammingModel), VariableKind.In | VariableKind.New));
+    }
+
+    internal abstract IFunctionTree Cross(IScope scope, TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1);
+
+    protected override void Cross(IScope scope, IRandom random) {
+      FunctionLibrary opLibrary = GetVariableValue<FunctionLibrary>("FunctionLibrary", scope, true);
+      TreeGardener gardener = new TreeGardener(random, opLibrary);
+
+      if (scope.SubScopes.Count != 2)
+        throw new InvalidOperationException("Number of parents must be exactly two.");
+
+      IGeneticProgrammingModel parent0 = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope.SubScopes[0], false);
+      IGeneticProgrammingModel parent1 = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope.SubScopes[1], false);
+
+      // randomly swap parents to remove a possible bias from selection (e.g. when using gender-specific selection)
+      if (random.NextDouble() < 0.5) {
+        IGeneticProgrammingModel tmp = parent0;
+        parent0 = parent1;
+        parent1 = tmp;
+      }
+
+      IFunctionTree child = Cross(scope, gardener, random, parent0.FunctionTree, parent1.FunctionTree);
+      Debug.Assert(gardener.IsValidTree(child));
+      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("FunctionTree"), new GeneticProgrammingModel(child)));
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/LangdonHomologousCrossOver.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/LangdonHomologousCrossOver.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/LangdonHomologousCrossOver.cs	(revision 3223)
@@ -0,0 +1,56 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Random;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  /// <summary>
+  /// Implementation of a homologous crossover operator as described in: 
+  /// William B. Langdon 
+  /// Size Fair and Homologous Tree Genetic Programming Crossovers, 
+  /// Genetic Programming and Evolvable Machines, Vol. 1, Number 1/2, pp. 95-119, April 2000
+  /// </summary>
+  public class LangdonHomologousCrossOver : SizeFairCrossOver {
+    protected override IFunctionTree SelectReplacement(MersenneTwister random, List<int> replacedTrail, List<CrossoverPoint> crossoverPoints) {
+      List<CrossoverPoint> bestPoints = new List<CrossoverPoint> { crossoverPoints[0] };
+      int bestMatchLength = MatchingSteps(replacedTrail, crossoverPoints[0].trail);
+      for (int i = 1; i < crossoverPoints.Count; i++) {
+        int currentMatchLength = MatchingSteps(replacedTrail, crossoverPoints[i].trail);
+        if (currentMatchLength > bestMatchLength) {
+          bestMatchLength = currentMatchLength;
+          bestPoints.Clear();
+          bestPoints.Add(crossoverPoints[i]);
+        } else if (currentMatchLength == bestMatchLength) {
+          bestPoints.Add(crossoverPoints[i]);
+        }
+      }
+      return bestPoints[random.Next(bestPoints.Count)].tree;
+    }
+    private int MatchingSteps(List<int> t1, List<int> t2) {
+      int n = Math.Min(t1.Count, t2.Count);
+      for (int i = 0; i < n; i++) if (t1[i] != t2[i]) return i;
+      return n;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/OnePointCrossOver.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/OnePointCrossOver.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/OnePointCrossOver.cs	(revision 3223)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  /// <summary>
+  /// Implementation of a homologous one point crossover operator as described in: 
+  /// W. B. Langdon and R. Poli.  Foundations of Genetic Programming. Springer-Verlag, 2002.
+  /// </summary>
+  public class OnePointCrossOver : SizeConstrictedGPCrossoverBase {
+    // internal data structure to represent crossover points
+    private class CrossoverPoint {
+      public IFunctionTree parent0;
+      public IFunctionTree parent1;
+      public int childIndex;
+    }
+    public override string Description {
+      get {
+        return @"One point crossover for trees as described in W. B. Langdon and R. Poli. Foundations of Genetic Programming. Springer-Verlag, 2002.";
+      }
+    }
+
+    internal override IFunctionTree Cross(TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1, int maxTreeSize, int maxTreeHeight) {
+      List<CrossoverPoint> allowedCrossOverPoints = new List<CrossoverPoint>();
+      GetCrossOverPoints(gardener, tree0, tree1, maxTreeSize - tree0.GetSize(), allowedCrossOverPoints);
+      if (allowedCrossOverPoints.Count > 0) {
+        CrossoverPoint crossOverPoint = allowedCrossOverPoints[random.Next(allowedCrossOverPoints.Count)];
+        IFunctionTree parent0 = crossOverPoint.parent0;
+        IFunctionTree branch1 = crossOverPoint.parent1.SubTrees[crossOverPoint.childIndex];
+        parent0.RemoveSubTree(crossOverPoint.childIndex);
+        parent0.InsertSubTree(crossOverPoint.childIndex, branch1);
+      }
+      return tree0;
+    }
+
+    private void GetCrossOverPoints(TreeGardener gardener, IFunctionTree branch0, IFunctionTree branch1, int maxNewNodes, List<CrossoverPoint> crossoverPoints) {
+      if (branch0.SubTrees.Count != branch1.SubTrees.Count) return;
+
+      for (int i = 0; i < branch0.SubTrees.Count; i++) {
+        // if the current branch can be attached as a sub-tree to branch0
+        if (gardener.GetAllowedSubFunctions(branch0.Function, i).Contains(branch1.SubTrees[i].Function) &&
+           branch1.SubTrees[i].GetSize() - branch0.SubTrees[i].GetSize() <= maxNewNodes) {
+          CrossoverPoint p = new CrossoverPoint();
+          p.childIndex = i;
+          p.parent0 = branch0;
+          p.parent1 = branch1;
+          crossoverPoints.Add(p);
+        }
+        GetCrossOverPoints(gardener, branch0.SubTrees[i], branch1.SubTrees[i], maxNewNodes, crossoverPoints);
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SizeConstrictedGPCrossoverBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SizeConstrictedGPCrossoverBase.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SizeConstrictedGPCrossoverBase.cs	(revision 3223)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public abstract class SizeConstrictedGPCrossoverBase : GPCrossoverBase {
+
+    private int MaxRecombinationTries { get { return 20; } }
+
+    public SizeConstrictedGPCrossoverBase()
+      : base() {
+      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
+    }
+
+    internal override IFunctionTree Cross(IScope scope, TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1) {
+      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
+      int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data;
+
+      // when tree0 is terminal then try to cross into tree1, when tree1 is also terminal just return tree0 unchanged.
+      IFunctionTree newTree;
+      int tries = 0;
+      do {
+        if (tries++ > MaxRecombinationTries)
+          // if after so many tries it was not possible to create a solution within the given size constraints just return the tree without changes.
+          return tree0;
+        if (tree0.SubTrees.Count > 0) {
+          newTree = Cross(gardener, random, (IFunctionTree)tree0.Clone(), (IFunctionTree)tree1.Clone(), maxTreeSize, maxTreeHeight);
+        } else if (tree1.SubTrees.Count > 0) {
+          newTree = Cross(gardener, random, (IFunctionTree)tree1.Clone(), (IFunctionTree)tree0.Clone(), maxTreeSize, maxTreeHeight);
+        } else newTree = tree0;
+      } while (newTree.GetSize() > maxTreeSize || newTree.GetHeight() > maxTreeHeight);
+      return newTree;
+    }
+
+    internal abstract IFunctionTree Cross(TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1, int maxTreeSize, int maxTreeHeight);
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SizeFairCrossOver.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SizeFairCrossOver.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SizeFairCrossOver.cs	(revision 3223)
@@ -0,0 +1,148 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.GP.Interfaces;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  /// <summary>
+  /// Implementation of a size fair crossover operator as described in: 
+  /// William B. Langdon 
+  /// Size Fair and Homologous Tree Genetic Programming Crossovers, 
+  /// Genetic Programming and Evolvable Machines, Vol. 1, Number 1/2, pp. 95-119, April 2000
+  /// </summary>
+  public class SizeFairCrossOver : SizeConstrictedGPCrossoverBase {
+    private int MaxRecombinationTries { get { return 20; } }
+    // private data structure for crossover points
+    protected class CrossoverPoint {
+      public IFunctionTree tree;
+      public int branchSize;
+      public List<int> trail;
+    }
+
+    internal override IFunctionTree Cross(TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1, int maxTreeSize, int maxTreeHeight) {
+      int tries = 0;
+      IFunctionTree insertedBranch = null;
+      IFunctionTree parent = null;
+      int removedBranchIndex = 0;
+      do {
+        // select a random suboperator of the 'receiving' tree
+        while (parent == null) parent = gardener.GetRandomParentNode(tree0);
+        removedBranchIndex = random.Next(parent.SubTrees.Count);
+        insertedBranch = GetReplacementBranch((MersenneTwister)random, gardener, tree0, parent, removedBranchIndex, tree1, maxTreeSize, maxTreeHeight);
+      } while (insertedBranch == null && tries++ < MaxRecombinationTries);
+
+      if (insertedBranch != null) {
+        // replace the branch below the crossoverpoint with the selected branch from root1
+        parent.RemoveSubTree(removedBranchIndex);
+        parent.InsertSubTree(removedBranchIndex, insertedBranch);
+      }
+      return tree0;
+    }
+
+    private IFunctionTree GetReplacementBranch(MersenneTwister random, TreeGardener gardener, IFunctionTree intoTree, IFunctionTree parent, int replacedBranchIndex, IFunctionTree fromTree, int maxTreeSize, int maxTreeHeight) {
+      IList<IFunction> allowedFunctions = new List<IFunction>(gardener.GetAllowedSubFunctions(parent.Function, replacedBranchIndex));
+      int removedBranchSize = parent.SubTrees[replacedBranchIndex].GetSize();
+      int maxBranchSize = maxTreeSize - (intoTree.GetSize() - removedBranchSize);
+      int maxBranchHeight = maxTreeHeight - gardener.GetBranchLevel(intoTree, parent);  // returns 1 if intoTree==parent and 2 if parent is a child of intoTree
+      List<int> replacedTrail = GetTrail(intoTree, parent);
+      replacedTrail.Add(replacedBranchIndex);
+
+      List<CrossoverPoint> shorterBranches = new List<CrossoverPoint>();
+      List<CrossoverPoint> longerBranches = new List<CrossoverPoint>();
+      List<CrossoverPoint> equalLengthBranches = new List<CrossoverPoint>();
+
+      FindPossibleBranches(fromTree, allowedFunctions, maxBranchSize, maxBranchHeight, removedBranchSize, shorterBranches, equalLengthBranches, longerBranches, new List<int>());
+
+      if (shorterBranches.Count > 0 && longerBranches.Count > 0) {
+        double pEqualLength = equalLengthBranches.Count > 0 ? 1.0 / removedBranchSize : 0.0;
+        double pLonger;
+        if (parent.GetSize() == maxTreeSize) {
+          pLonger = 0.0;
+        } else {
+          pLonger = (1.0 - pEqualLength) / (longerBranches.Count * (1.0 + longerBranches.Average(p => p.branchSize) / shorterBranches.Average(p => p.branchSize)));
+        }
+        double pShorter = (1.0 - pEqualLength - pLonger);
+
+        double r = random.NextDouble();
+        if (r < pLonger) {
+          return SelectReplacement(random, replacedTrail, longerBranches);
+        } else if (r < pLonger + pShorter) {
+          return SelectReplacement(random, replacedTrail, shorterBranches);
+        } else {
+          return SelectReplacement(random, replacedTrail, equalLengthBranches);
+        }
+      } else if (equalLengthBranches.Count > 0) {
+        return SelectReplacement(random, replacedTrail, equalLengthBranches);
+      } else {
+        return null;
+      }
+    }
+
+    protected virtual IFunctionTree SelectReplacement(MersenneTwister random, List<int> replacedTrail, List<CrossoverPoint> crossoverPoints) {
+      return crossoverPoints[random.Next(crossoverPoints.Count)].tree;
+    }
+
+    private void FindPossibleBranches(IFunctionTree tree, IList<IFunction> allowedFunctions, int maxBranchSize, int maxBranchHeight, int removedBranchSize,
+      List<CrossoverPoint> shorterBranches, List<CrossoverPoint> equalLengthBranches, List<CrossoverPoint> longerBranches, List<int> trail) {
+      int treeSize = tree.GetSize();
+      if (allowedFunctions.Contains(tree.Function) && treeSize <= maxBranchSize && tree.GetHeight() <= maxBranchHeight) {
+        CrossoverPoint p = new CrossoverPoint();
+        p.branchSize = treeSize;
+        p.tree = tree;
+        p.trail = new List<int>(trail);
+        if (treeSize < removedBranchSize) shorterBranches.Add(p);
+        else if (treeSize > removedBranchSize) longerBranches.Add(p);
+        else equalLengthBranches.Add(p);
+      }
+      for (int i = 0; i < tree.SubTrees.Count; i++) {
+        trail.Add(i);
+        FindPossibleBranches(tree.SubTrees[i], allowedFunctions, maxBranchSize, maxBranchHeight, removedBranchSize, shorterBranches, equalLengthBranches, longerBranches, trail);
+        trail.RemoveAt(trail.Count - 1);
+      }
+    }
+
+    private List<int> GetTrail(IFunctionTree root, IFunctionTree branch) {
+      List<int> trail = new List<int>();
+      GetTrail(root, branch, trail);
+      trail.Reverse();
+      trail.RemoveAt(trail.Count - 1);
+      return trail;
+    }
+    private void GetTrail(IFunctionTree root, IFunctionTree branch, List<int> trail) {
+      if (root == branch) {
+        trail.Add(-1); // add flag that there was a match
+        return;
+      }
+
+      for (int i = 0; i < root.SubTrees.Count; i++) {
+        GetTrail(root.SubTrees[i], branch, trail);
+        if (trail.Count > 0) {
+          trail.Add(i);
+          return;
+        }
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/StandardCrossOver.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/StandardCrossOver.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/StandardCrossOver.cs	(revision 3223)
@@ -0,0 +1,78 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class StandardCrossOver : SizeConstrictedGPCrossoverBase {
+    private int MaxRecombinationTries { get { return 20; } }
+
+    public override string Description {
+      get {
+        return @"Takes two parent individuals P0 and P1 each. Selects a random node N0 of P0 and a random node N1 of P1.
+And replaces the branch with root0 N0 in P0 with N1 from P1 if the tree-size limits are not violated.
+When recombination with N0 and N1 would create a tree that is too large or invalid the operator randomly selects new N0 and N1 
+until a valid configuration is found.";
+      }
+    }
+
+    internal override IFunctionTree Cross(TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1, int maxTreeSize, int maxTreeHeight) {
+      int tries = 0;
+      List<IFunctionTree> allowedCrossoverPoints = null;
+      IFunctionTree parent0;
+      int replacedChildIndex;
+      do {
+        // select a random crossover point in the first parent tree0
+        parent0 = null;
+        while (parent0 == null) parent0 = gardener.GetRandomParentNode(tree0);
+        // select a random branch to replace
+        replacedChildIndex = random.Next(parent0.SubTrees.Count);
+
+        // calculate the max size and height that the inserted branch can have 
+        int maxInsertedBranchSize = maxTreeSize - (tree0.GetSize() - parent0.SubTrees[replacedChildIndex].GetSize());
+        int maxInsertedBranchHeight = maxTreeHeight - gardener.GetBranchLevel(tree0, parent0); // branchlevel is 1 if tree0==parent0
+
+        IList<IFunction> allowedFunctions = new List<IFunction>(gardener.GetAllowedSubFunctions(parent0.Function, replacedChildIndex));
+        allowedCrossoverPoints = GetPossibleCrossoverPoints(tree1, maxInsertedBranchSize, maxInsertedBranchHeight, allowedFunctions);
+      } while (allowedCrossoverPoints.Count == 0 && tries++ < MaxRecombinationTries);
+
+      if (allowedCrossoverPoints.Count > 0) {
+        IFunctionTree branch1 = allowedCrossoverPoints[random.Next(allowedCrossoverPoints.Count)];
+
+        // replace the branch in tree0 with the selected branch from tree1
+        parent0.RemoveSubTree(replacedChildIndex);
+        parent0.InsertSubTree(replacedChildIndex, branch1);
+      }
+      return tree0;
+    }
+
+    private List<IFunctionTree> GetPossibleCrossoverPoints(IFunctionTree tree, int maxInsertedBranchSize, int maxInsertedBranchHeight, IList<IFunction> allowedFunctions) {
+      List<IFunctionTree> crossoverPoints = new List<IFunctionTree>();
+      foreach (IFunctionTree possiblePoint in TreeGardener.GetAllSubTrees(tree)) {
+        if (allowedFunctions.Contains(possiblePoint.Function) && possiblePoint.GetSize() <= maxInsertedBranchSize && possiblePoint.GetHeight() <= maxInsertedBranchHeight)
+          crossoverPoints.Add(possiblePoint);
+      }
+      return crossoverPoints;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/UniformCrossover.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/UniformCrossover.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/UniformCrossover.cs	(revision 3223)
@@ -0,0 +1,154 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  /// <summary>
+  /// Implementation of a homologous uniform crossover operator as described in: 
+  /// R. Poli and W. B. Langdon.  On the Search Properties of Different Crossover Operators in Genetic Programming.
+  /// In Proceedings of Genetic Programming '98, Madison, Wisconsin, 1998.
+  /// </summary>
+  public class UniformCrossover : SizeConstrictedGPCrossoverBase {
+    // internal datastructure to represent crossover points
+    private class CrossoverPoint {
+      public IFunctionTree Parent0;
+      public IFunctionTree Parent1;
+      public int ChildIndex;
+      public bool IsInternal;
+    }
+
+    public override string Description {
+      get {
+        return @"Uniform crossover as defined by Poli and Langdon";
+      }
+    }
+
+    internal override IFunctionTree Cross(TreeGardener gardener, IRandom random, IFunctionTree tree0, IFunctionTree tree1, int maxTreeSize, int maxTreeHeight) {
+      List<CrossoverPoint> allowedCrossOverPoints = new List<CrossoverPoint>();
+      GetCrossOverPoints(gardener, tree0, tree1, allowedCrossOverPoints);
+      // iterate through the list of crossover points and swap nodes with p=0.5
+      foreach (CrossoverPoint crossoverPoint in allowedCrossOverPoints) {
+        if (random.NextDouble() < 0.5) {
+          if (crossoverPoint.IsInternal) {
+            ExchangeNodes(crossoverPoint);
+          } else {
+            SwapSubtrees(crossoverPoint);
+          }
+        }
+      }
+      return tree0;
+    }
+
+    private void GetCrossOverPoints(TreeGardener gardener, IFunctionTree branch0, IFunctionTree branch1, List<CrossoverPoint> crossoverPoints) {
+      if (branch0.SubTrees.Count != branch1.SubTrees.Count) return; // branches have to have same number of sub-trees to be valid crossover points
+      // iterate over all sub-trees
+      for (int i = 0; i < branch0.SubTrees.Count; i++) {
+        IFunctionTree currentSubTree0 = branch0.SubTrees[i];
+        IFunctionTree currentSubTree1 = branch1.SubTrees[i];
+        // when the current sub-tree in branch1 can be attached as a child of branch0
+        // and the sub-tree of branch0 can be attached as child of branch1.
+        // note: we have to check both cases because either branch0 or branch1 can end up in the result tree
+        if (gardener.GetAllowedSubFunctions(branch0.Function, i).Contains(currentSubTree1.Function) &&
+          gardener.GetAllowedSubFunctions(branch1.Function, i).Contains(currentSubTree0.Function)) {
+          // and the sub-tree is at the border of the common region 
+          if (currentSubTree0.SubTrees.Count != currentSubTree1.SubTrees.Count) {
+            // then we have found a valid crossover point
+            CrossoverPoint p = new CrossoverPoint();
+            p.ChildIndex = i;
+            p.Parent0 = branch0;
+            p.Parent1 = branch1;
+            p.IsInternal = false;
+            crossoverPoints.Add(p);
+          } else {
+            // when the sub-trees are not on the border of the common region
+            // we also have to check if the children of the current sub-trees of branch0 and branch1 can be exchanged 
+            if (CanHaveSubTrees(gardener, currentSubTree0, currentSubTree1.SubTrees) &&
+              CanHaveSubTrees(gardener, currentSubTree1, currentSubTree0.SubTrees)) {
+              CrossoverPoint p = new CrossoverPoint();
+              p.ChildIndex = i;
+              p.Parent0 = branch0;
+              p.Parent1 = branch1;
+              p.IsInternal = true;
+              crossoverPoints.Add(p);
+            }
+          }
+        }
+        GetCrossOverPoints(gardener, currentSubTree0, currentSubTree1, crossoverPoints);
+      }
+    }
+
+    private bool CanHaveSubTrees(TreeGardener gardener, IFunctionTree parent, IList<IFunctionTree> subTrees) {
+      for (int i = 0; i < subTrees.Count; i++) {
+        if (!gardener.GetAllowedSubFunctions(parent.Function, i).Contains(subTrees[i].Function)) return false;
+      }
+      return true;
+    }
+
+    private void ExchangeNodes(CrossoverPoint crossoverPoint) {
+      IFunctionTree parent0 = crossoverPoint.Parent0;
+      IFunctionTree parent1 = crossoverPoint.Parent1;
+      int childIndex = crossoverPoint.ChildIndex;
+      IFunctionTree branch0 = crossoverPoint.Parent0.SubTrees[childIndex];
+      IFunctionTree branch1 = crossoverPoint.Parent1.SubTrees[childIndex];
+      // exchange the branches in the parent
+      parent0.RemoveSubTree(childIndex);
+      parent0.InsertSubTree(childIndex, branch1);
+      parent1.RemoveSubTree(childIndex);
+      parent1.InsertSubTree(childIndex, branch0);
+
+      ExchangeChildren(branch0, branch1);
+    }
+
+    private void SwapSubtrees(CrossoverPoint crossoverPoint) {
+      IFunctionTree parent0 = crossoverPoint.Parent0;
+      IFunctionTree parent1 = crossoverPoint.Parent1;
+      int childIndex = crossoverPoint.ChildIndex;
+      IFunctionTree branch0 = crossoverPoint.Parent0.SubTrees[childIndex];
+      IFunctionTree branch1 = crossoverPoint.Parent1.SubTrees[childIndex];
+      // insert branch1 into parent0 replacing branch0
+      parent0.RemoveSubTree(childIndex);
+      parent0.InsertSubTree(childIndex, branch1);
+      // insert branch0 into parent1 replacing branch1
+      parent1.RemoveSubTree(childIndex);
+      parent1.InsertSubTree(childIndex, branch0);
+    }
+
+    private void ExchangeChildren(IFunctionTree branch0, IFunctionTree branch1) {
+      List<IFunctionTree> branch0Children = new List<IFunctionTree>(branch0.SubTrees); // lists to backup subtrees
+      List<IFunctionTree> branch1Children = new List<IFunctionTree>(branch1.SubTrees);
+
+      // remove children of branch0 and branch1
+      while (branch1.SubTrees.Count > 0) branch1.RemoveSubTree(0);
+      while (branch0.SubTrees.Count > 0) branch0.RemoveSubTree(0);
+
+      // add original children of branch0 to branch1
+      foreach (IFunctionTree subTree in branch0Children) {
+        branch1.AddSubTree(subTree);
+      }
+      // add original children of branch1 to branch0
+      foreach (IFunctionTree subTree in branch1Children) {
+        branch0.AddSubTree(subTree);
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj	(revision 3223)
@@ -0,0 +1,144 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{125D3006-67F5-48CB-913E-73C0548F17FA}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Encodings.SymbolicExpressionTree</RootNamespace>
+    <AssemblyName>HeuristicLab.Encodings.SymbolicExpressionTree-3.3</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Symbol.cs" />
+    <Compile Include="SymbolicExpressionTree.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="HeuristicLabEncodingsSymbolicExpressionTreePlugin.cs.frame" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
+      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
+      <Name>HeuristicLab.Core-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
+      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
+      <Name>HeuristicLab.Data-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
+      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
+      <Name>HeuristicLab.Optimization-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
+      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
+      <Name>HeuristicLab.Parameters-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
+      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
+      <Name>HeuristicLab.Persistence-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Creators\" />
+    <Folder Include="Crossovers\" />
+    <Folder Include="Interfaces\" />
+    <Folder Include="Manipulators\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabEncodingsSymbolicExpressionTreePlugin.cs.frame" "%25ProjectDir%25\HeuristicLabEncodingsSymbolicExpressionTreePlugin.cs"</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj	(revision 3223)
@@ -0,0 +1,156 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{125D3006-67F5-48CB-913E-73C0548F17FA}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding</RootNamespace>
+    <AssemblyName>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Interfaces\ISymbolicExpressionGrammar.cs" />
+    <Compile Include="Creators\ProbabilisticTreeCreator.cs" />
+    <Compile Include="HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs" />
+    <Compile Include="SymbolicExpressionGrammar.cs" />
+    <Compile Include="SymbolicExpressionTreeCreator.cs" />
+    <Compile Include="SymbolicExpressionTree.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Symbol.cs" />
+    <Compile Include="SymbolicExpressionTreeNode.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
+      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
+      <Name>HeuristicLab.Collections-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
+      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
+      <Name>HeuristicLab.Core-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
+      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
+      <Name>HeuristicLab.Data-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
+      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
+      <Name>HeuristicLab.Operators-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
+      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
+      <Name>HeuristicLab.Optimization-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
+      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
+      <Name>HeuristicLab.Parameters-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
+      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
+      <Name>HeuristicLab.Persistence-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Crossovers\" />
+    <Folder Include="Manipulators\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs"</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame	(revision 3223)
@@ -0,0 +1,38 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.3.0.$WCREV$")]
+  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Core", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Data", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Random", "3.3.0.0")]
+  public class HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin : PluginBase {
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/IFunction.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/IFunction.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/IFunction.cs	(revision 3223)
@@ -0,0 +1,43 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public interface IFunction : IItem {
+    string Name { get; }
+    IFunctionTree GetTreeNode();
+    ICollection<IFunction> GetAllowedSubFunctions(int index);
+    void AddAllowedSubFunction(IFunction f, int index);
+    void RemoveAllowedSubFunction(IFunction f, int index);
+    bool IsAllowedSubFunction(IFunction f, int index);
+    int MinSubTrees { get; }
+    int MaxSubTrees { get; }
+    int MinTreeHeight { get; }
+    int MinTreeSize { get; }
+    double Tickets { get; }
+    IOperator Initializer { get; }
+    IOperator Manipulator { get; }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/IFunctionTree.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/IFunctionTree.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/IFunctionTree.cs	(revision 3223)
@@ -0,0 +1,41 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public interface IFunctionTree {
+    bool HasLocalParameters { get; }
+    IList<IFunctionTree> SubTrees { get; }
+    IFunction Function { get; }
+    IOperation CreateShakingOperation(IScope scope);
+    IOperation CreateInitOperation(IScope scope);
+    int GetSize();
+    int GetHeight();
+    void AddSubTree(IFunctionTree tree);
+    void InsertSubTree(int index, IFunctionTree tree);
+    void RemoveSubTree(int index);
+    string ToString();
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionGrammar.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionGrammar.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionGrammar.cs	(revision 3223)
@@ -0,0 +1,45 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 System.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  public interface ISymbolicExpressionGrammar : IItem {
+    Symbol StartSymbol { get; }
+    // IEnumerable<Symbol> Symbols { get; }
+
+    // void AddSymbol(Symbol symbol);
+    // void RemoveSymbol(Symbol symbol);
+
+    IEnumerable<Symbol> AllowedSymbols(Symbol parent, int argumentIndex);
+    int MinimalExpressionLength(Symbol start);
+    int MaximalExpressionLength(Symbol start);
+    int MinimalExpressionDepth(Symbol start);
+    int MinSubTrees(Symbol start);
+    int MaxSubTrees(Symbol start);
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ChangeNodeTypeManipulation.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ChangeNodeTypeManipulation.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ChangeNodeTypeManipulation.cs	(revision 3223)
@@ -0,0 +1,169 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+using System.Diagnostics;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class ChangeNodeTypeManipulation : GPManipulatorBase {
+
+    public override string Description {
+      get {
+        return @"This manipulation operator selects a random tree-node and changes the function type.
+If this leads to a constraint-violation (wrong number or type of sub-trees) the sub-trees are repaired
+resulting in a valid tree again.";
+      }
+    }
+
+    public ChangeNodeTypeManipulation()
+      : base() {
+    }
+
+    internal override IOperation Manipulate(MersenneTwister random, IGeneticProgrammingModel gpModel, FunctionLibrary library, int maxTreeSize, int maxTreeHeight, IScope scope) {
+      TreeGardener gardener = new TreeGardener(random, library);
+      IFunctionTree parent = gardener.GetRandomParentNode(gpModel.FunctionTree);
+      IFunctionTree selectedChild;
+      int selectedChildIndex;
+      if (parent == null) {
+        selectedChildIndex = 0;
+        selectedChild = gpModel.FunctionTree;
+      } else {
+        selectedChildIndex = random.Next(parent.SubTrees.Count);
+        selectedChild = parent.SubTrees[selectedChildIndex];
+      }
+
+      if (selectedChild.SubTrees.Count == 0) {
+        IFunctionTree newTerminal = ChangeTerminalType(parent, selectedChild, selectedChildIndex, gardener, random);
+        if (parent == null) {
+          // no parent means the new child is the initial operator
+          gpModel.FunctionTree = newTerminal;
+        } else {
+          parent.RemoveSubTree(selectedChildIndex);
+          parent.InsertSubTree(selectedChildIndex, newTerminal);
+          // updating the variable is not necessary because it stays the same
+        }
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // size and height stays the same when changing a terminal so no need to update the variables
+        // schedule an operation to initialize the new terminal
+        return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newTerminal), scope);
+      } else {
+        List<IFunctionTree> uninitializedBranches;
+        IFunctionTree newFunctionTree = ChangeFunctionType(parent, selectedChild, selectedChildIndex, gardener, random, out uninitializedBranches);
+        // in rare cases the function creates a tree that breaks the size limits
+        // calculate the height and size difference and 
+        // check if the size of the new tree is still in the allowed bounds
+        int oldChildSize = selectedChild.GetSize();
+        int oldChildHeight = selectedChild.GetHeight();
+        int newChildSize = newFunctionTree.GetSize();
+        int newChildHeight = newFunctionTree.GetHeight();
+        if ((gpModel.Height - oldChildHeight) + newChildHeight > maxTreeHeight ||
+          (gpModel.Size - oldChildSize) + newChildSize > maxTreeSize) {
+          // if size-constraints are violated don't change anything
+          return null;
+        }
+        if (parent == null) {
+          // no parent means the new function is the initial operator
+          gpModel.FunctionTree = newFunctionTree;
+        } else {
+          // remove the old child
+          parent.RemoveSubTree(selectedChildIndex);
+          // add the new child as sub-tree of parent
+          parent.InsertSubTree(selectedChildIndex, newFunctionTree);
+        }
+        // update size and height
+        gpModel.Size = gpModel.Size - oldChildSize + newChildSize;
+        gpModel.Height = gpModel.FunctionTree.GetHeight(); // must recalculate height because we can't know wether the manipulated branch was the deepest branch
+        // check if whole tree is ok
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // return a composite operation that initializes all created sub-trees
+        return Util.CreateInitializationOperation(uninitializedBranches, scope);
+      }
+    }
+
+    private IFunctionTree ChangeTerminalType(IFunctionTree parent, IFunctionTree child, int childIndex, TreeGardener gardener, MersenneTwister random) {
+      IList<IFunction> allowedTerminals;
+      if (parent == null) {
+        allowedTerminals = gardener.Terminals;
+      } else {
+        allowedTerminals = new List<IFunction>();
+        var allAllowedChildren = gardener.GetAllowedSubFunctions(parent.Function, childIndex);
+        foreach (IFunction c in allAllowedChildren) {
+          if (TreeGardener.IsTerminal(c)) allowedTerminals.Add(c);
+        }
+      }
+      // selecting from the terminals should always work since the current child was also a terminal
+      // so in the worst case we will just create a new terminal of the same type again.
+      return gardener.CreateRandomTree(allowedTerminals, 1, 1);
+    }
+
+    private IFunctionTree ChangeFunctionType(IFunctionTree parent, IFunctionTree child, int childIndex, TreeGardener gardener, MersenneTwister random,
+      out List<IFunctionTree> uninitializedBranches) {
+      // since there are subtrees, we have to check which 
+      // and how many of the existing subtrees we can reuse.
+      // first let's choose the function we want to use instead of the old child. For this we have to determine the
+      // pool of allowed functions based on constraints of the parent if there is one.
+      List<IFunction> allowedFunctions = new List<IFunction>(gardener.GetAllowedSubFunctions(parent != null ? parent.Function : null, childIndex));
+      // try to make a tree with the same arity as the old child.
+      int actualArity = child.SubTrees.Count;
+      // create a new tree-node for a randomly selected function
+      IFunction selectedFunction = allowedFunctions[random.Next(allowedFunctions.Count)];
+      // arity of the selected operator
+      int minArity = selectedFunction.MinSubTrees;
+      int maxArity = selectedFunction.MaxSubTrees;
+      // if the old child had too many sub-trees then the new child should keep as many sub-trees as possible
+      if (actualArity > maxArity)
+        actualArity = maxArity;
+      if (actualArity < minArity)
+        actualArity = minArity;
+      // create a list that holds old sub-trees that we can reuse in the new tree
+      List<IFunctionTree> availableSubTrees = new List<IFunctionTree>(child.SubTrees);
+      List<IFunctionTree> freshSubTrees = new List<IFunctionTree>();
+      IFunctionTree newTree = selectedFunction.GetTreeNode();
+      // randomly select the sub-trees that we keep
+      for (int i = 0; i < actualArity; i++) {
+        // fill all sub-tree slots of the new tree
+        // if for a given slot i there are multiple existing sub-trees that can be used in that slot
+        // then use a random existing sub-tree. When there are no existing sub-trees
+        // that fit in the given slot then create a new random tree and use it for the slot
+        ICollection<IFunction> allowedSubFunctions = gardener.GetAllowedSubFunctions(selectedFunction, i);
+        var matchingSubTrees = availableSubTrees.Where(subTree => allowedSubFunctions.Contains(subTree.Function));
+        if (matchingSubTrees.Count() > 0) {
+          IFunctionTree selectedSubTree = matchingSubTrees.ElementAt(random.Next(matchingSubTrees.Count()));
+          // we can just add it as subtree
+          newTree.InsertSubTree(i, selectedSubTree);
+          availableSubTrees.Remove(selectedSubTree); // the branch shouldn't be available for the following slots
+        } else {
+          // no existing matching tree found => create a new tree of minimal size
+          IFunctionTree freshTree = gardener.CreateRandomTree(allowedSubFunctions, 1, 1);
+          freshSubTrees.AddRange(TreeGardener.GetAllSubTrees(freshTree));
+          newTree.InsertSubTree(i, freshTree);
+        }
+      }
+      freshSubTrees.Add(newTree);
+      uninitializedBranches = freshSubTrees;
+      return newTree;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/CutOutNodeManipulation.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/CutOutNodeManipulation.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/CutOutNodeManipulation.cs	(revision 3223)
@@ -0,0 +1,111 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+using System.Diagnostics;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class CutOutNodeManipulation : GPManipulatorBase {
+    public override string Description {
+      get {
+        return @"Takes a tree, selects a random node of the tree and then tries to replace a random sub-tree
+of that node with one of the childs of the selected child.
+
+               O                             O
+              / \                           / \
+             O   X                         O   2
+                / \    2 is selected =>       / \
+               1   2                         4   5
+              /   / \
+             3   4   5
+";
+      }
+    }
+
+    public CutOutNodeManipulation()
+      : base() {
+    }
+
+
+    internal override IOperation Manipulate(MersenneTwister random, IGeneticProgrammingModel gpModel, FunctionLibrary library, int maxTreeSize, int maxTreeHeight, IScope scope) {
+      TreeGardener gardener = new TreeGardener(random, library);
+      IFunctionTree parent = gardener.GetRandomParentNode(gpModel.FunctionTree);
+      // parent == null means we should cut out the root node
+      // => return a random sub-tree of the root
+      if (parent == null) {
+        // when there are sub-trees then replace the old tree with a random sub-tree
+        if (gpModel.FunctionTree.SubTrees.Count > 0) {
+          gpModel.FunctionTree = gpModel.FunctionTree.SubTrees[random.Next(gpModel.FunctionTree.SubTrees.Count)];
+          Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+          // we reused a sub-tree so we don't have to schedule initialization operations
+          return null;
+        } else {
+          // we want to cut the root node and there are no sub-trees => create a new random terminal
+          gpModel.FunctionTree = gardener.CreateRandomTree(gardener.Terminals, 1, 1);
+          Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+
+          // schedule an operation to initialize the whole tree
+          return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(gpModel.FunctionTree), scope);
+        }
+      }
+
+      // select a child to cut away
+      int childIndex = random.Next(parent.SubTrees.Count);
+      IFunctionTree child = parent.SubTrees[childIndex];
+      // match the sub-trees of the child with the allowed sub-trees of the parent
+      ICollection<IFunction> allowedFunctions = gardener.GetAllowedSubFunctions(parent.Function, childIndex);
+      IFunctionTree[] possibleChilds = child.SubTrees.Where(t => allowedFunctions.Contains(t.Function)).ToArray();
+      if (possibleChilds.Length > 0) {
+        // replace child with a random child of that child
+        IFunctionTree selectedChild = possibleChilds[random.Next(possibleChilds.Length)];
+        parent.RemoveSubTree(childIndex);
+        parent.InsertSubTree(childIndex, selectedChild);
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // recalculate the size and height of our tree
+        gpModel.Size = gpModel.FunctionTree.GetSize();
+        gpModel.Height = gpModel.FunctionTree.GetHeight();
+        // don't need to schedule initialization operations
+        return null;
+      } else {
+        // can't reuse an existing branch => create a new tree
+        // determine the level of the parent
+        int parentLevel = gardener.GetBranchLevel(gpModel.FunctionTree, parent);
+        // first remove the old child (first step essential!)
+        parent.RemoveSubTree(childIndex);
+        // then determine the number of nodes left over after the child has been removed!
+        int remainingNodes = gpModel.FunctionTree.GetSize();
+        allowedFunctions = gardener.GetAllowedSubFunctions(parent.Function, childIndex);
+        IFunctionTree newFunctionTree = gardener.CreateRandomTree(allowedFunctions, maxTreeSize - remainingNodes, maxTreeHeight - parentLevel);
+        parent.InsertSubTree(childIndex, newFunctionTree);
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // recalculate size and height
+        gpModel.Size = gpModel.FunctionTree.GetSize();
+        gpModel.Height = gpModel.FunctionTree.GetHeight();
+        // schedule an initialization operation for the new function-tree
+        return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newFunctionTree), scope);
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/DeleteSubTreeManipulation.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/DeleteSubTreeManipulation.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/DeleteSubTreeManipulation.cs	(revision 3223)
@@ -0,0 +1,87 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.Random;
+using System.Diagnostics;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class DeleteSubTreeManipulation : GPManipulatorBase {
+    public override string Description {
+      get {
+        return @"Deletes a random sub-tree of the input tree. If the remaining tree is not valid 
+the operator tries to fix the tree by generating random subtrees where necessary.";
+      }
+    }
+
+    public DeleteSubTreeManipulation()
+      : base() {
+    }
+
+    internal override IOperation Manipulate(MersenneTwister random, IGeneticProgrammingModel gpModel, FunctionLibrary library, int maxTreeSize, int maxTreeHeight, IScope scope) {
+      TreeGardener gardener = new TreeGardener(random, library);
+      IFunctionTree parent = gardener.GetRandomParentNode(gpModel.FunctionTree);
+
+      // parent==null means the whole tree should be deleted.
+      // => return a new minimal random tree
+      if (parent == null) {
+        IFunctionTree newTree = gardener.CreateBalancedRandomTree(1, 1);
+        // check if the tree is ok
+        Debug.Assert(gardener.IsValidTree(newTree));
+        gpModel.FunctionTree = newTree;
+        // schedule an operation to initialize the newly created operator
+        return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newTree), scope);
+      }
+
+      // select a branch to prune
+      int childIndex = random.Next(parent.SubTrees.Count);
+      if (parent.SubTrees.Count > parent.Function.MinSubTrees) {
+        parent.RemoveSubTree(childIndex);
+        // actually since the next sub-trees are shifted in the place of the removed branch
+        // it might be possible that these sub-trees are not allowed in the place of the old branch
+        // we ignore this problem for now.
+        // when this starts to become a problem a possible solution is to go through the shifted branches from the place of the shifted
+        // and find the first one that doesn't fit. At this position we insert a new randomly initialized subtree of matching type (gkronber 25.12.07)
+
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // recalculate size and height
+        gpModel.Size = gpModel.FunctionTree.GetSize();
+        gpModel.Height = gpModel.FunctionTree.GetHeight();
+        // root hasn't changed so don't need to update 'FunctionTree' variable
+        return null;
+      } else {
+        // replace with a minimal random seedling
+        parent.RemoveSubTree(childIndex);
+        ICollection<IFunction> allowedFunctions = gardener.GetAllowedSubFunctions(parent.Function, childIndex);
+        IFunctionTree newFunctionTree = gardener.CreateRandomTree(allowedFunctions, 1, 1);
+        parent.InsertSubTree(childIndex, newFunctionTree);
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // recalculate size and height
+        gpModel.Size = gpModel.FunctionTree.GetSize();
+        gpModel.Height = gpModel.FunctionTree.GetHeight();
+        // return an initialization operation for the newly created tree
+        return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newFunctionTree), scope);
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs	(revision 3223)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Random;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class FullTreeShaker : DelegatingOperator {
+    public override string Description {
+      get { return "Manipulates all tree nodes for which a manipulator is defined."; }
+    }
+
+    public FullTreeShaker()
+      : base() {
+      AddVariableInfo(new VariableInfo("Random", "A random generator (uniform)", typeof(MersenneTwister), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionLibrary", "Function library that defines function mutations", typeof(FunctionLibrary), VariableKind.In));
+      AddVariableInfo(new VariableInfo("ShakingFactor", "Variable that determines the force of the shaking operation", typeof(DoubleData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be mutated", typeof(IGeneticProgrammingModel), VariableKind.In | VariableKind.Out));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      FunctionLibrary library = GetVariableValue<FunctionLibrary>("FunctionLibrary", scope, true);
+      IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, false);
+      MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true);
+
+      // save all existing sub-scopes in a backup scope
+      Scope backupScope = new Scope("backup");
+      foreach (Scope subScope in scope.SubScopes) {
+        backupScope.AddSubScope(subScope);
+      }
+
+      // create a scope for all shaking operations
+      Scope tempScope = new Scope("Temp. manipulation scope");
+      scope.AddSubScope(tempScope); // scope containing a subscope for each manipulation
+      scope.AddSubScope(backupScope); // scope containing the old subscopes
+
+      // create a composite operation for all shaking operations
+      CompositeOperation next = new CompositeOperation();
+      next.ExecuteInParallel = false;
+
+      // enqueue all shaking operations
+      foreach (IFunctionTree subTree in TreeGardener.GetAllSubTrees(gpModel.FunctionTree).Where(x=>x.HasLocalParameters)) {
+        IOperation shakingOperation = subTree.CreateShakingOperation(tempScope);
+        next.AddOperation(shakingOperation);
+      }
+
+      // schedule a reducer operation to delete all temporary scopes and restore
+      // the subscopes of the backup scope after all manipulations are finished.
+      next.AddOperation(new AtomicOperation(new RightReducer(), scope));
+      return next;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/GPManipulatorBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/GPManipulatorBase.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/GPManipulatorBase.cs	(revision 3223)
@@ -0,0 +1,49 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Core;
+using HeuristicLab.Random;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public abstract class GPManipulatorBase : OperatorBase {
+    public GPManipulatorBase()
+      : base() {
+      AddVariableInfo(new VariableInfo("Random", "Uniform random number generator", typeof(MersenneTwister), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionLibrary", "The operator library containing all available operators", typeof(FunctionLibrary), VariableKind.In));
+      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionTree", "The tree to crossover", typeof(IGeneticProgrammingModel), VariableKind.In | VariableKind.New));
+    }
+
+    internal abstract IOperation Manipulate(MersenneTwister random, IGeneticProgrammingModel gpModel, FunctionLibrary library, int maxSize, int maxHeight, IScope scope);
+
+    public override IOperation Apply(IScope scope) {
+      FunctionLibrary funLibrary = GetVariableValue<FunctionLibrary>("FunctionLibrary", scope, true);
+      IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, false);
+      MersenneTwister random = GetVariableValue<MersenneTwister>("Random", scope, true);
+      int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data;
+      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
+
+      return Manipulate(random, gpModel, funLibrary, maxTreeSize, maxTreeHeight, scope);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs	(revision 3223)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Linq;
+using HeuristicLab.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Random;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class OnePointShaker : DelegatingOperator {
+    public override string Description {
+      get { return "Selects a random node of all tree-nodes that have a manipulator defined and manipulates the selected node."; }
+    }
+
+    public OnePointShaker()
+      : base() {
+      AddVariableInfo(new VariableInfo("FunctionLibrary", "Function library that defines mutation operations for functions", typeof(FunctionLibrary), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Random", "A random generator (uniform)", typeof(MersenneTwister), VariableKind.In));
+      AddVariableInfo(new VariableInfo("ShakingFactor", "Factor that determines the force of the shaking operation", typeof(DoubleData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be mutated", typeof(IGeneticProgrammingModel), VariableKind.In | VariableKind.Out));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      FunctionLibrary library = GetVariableValue<FunctionLibrary>("FunctionLibrary", scope, true);
+      IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, false);
+      MersenneTwister mt = GetVariableValue<MersenneTwister>("Random", scope, true);
+
+      // get all nodes with local parameters
+      var parametricBranches = TreeGardener.GetAllSubTrees(gpModel.FunctionTree).Where(branch => branch.HasLocalParameters);
+      if (parametricBranches.Count() == 0) return null; // don't manipulate anything if there are no nodes with a manipulation operator
+      IFunctionTree selectedBranch = parametricBranches.ElementAt(mt.Next(parametricBranches.Count()));
+
+      // save the exising sub-scopes in a backup scope
+      Scope backupScope = new Scope("backup");
+      foreach (Scope subScope in scope.SubScopes) {
+        backupScope.AddSubScope(subScope);
+      }
+
+      // create a scope for all shaking operations
+      Scope tempScope = new Scope("Temp. manipulation scope");
+      
+      // add the new sub-scopes
+      scope.AddSubScope(tempScope);
+      scope.AddSubScope(backupScope);
+
+      CompositeOperation next = new CompositeOperation();
+      next.ExecuteInParallel = false;
+      // the next operation should first manipulate and then restore the sub-scopes from the backup scope
+      next.AddOperation(selectedBranch.CreateShakingOperation(tempScope));
+      next.AddOperation(new AtomicOperation(new RightReducer(), scope));
+
+      return next;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/SubstituteSubTreeManipulation.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/SubstituteSubTreeManipulation.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/SubstituteSubTreeManipulation.cs	(revision 3223)
@@ -0,0 +1,84 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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 HeuristicLab.Core;
+using HeuristicLab.Random;
+using System.Diagnostics;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTree {
+  public class SubstituteSubTreeManipulation : GPManipulatorBase {
+
+    public override string Description {
+      get { return "Selects a random node of the tree and replaces it with randomly initialized subtree."; }
+    }
+
+    public SubstituteSubTreeManipulation()
+      : base() {
+    }
+
+    internal override IOperation Manipulate(MersenneTwister random, IGeneticProgrammingModel gpModel, FunctionLibrary library, int maxTreeSize, int maxTreeHeight, IScope scope) {
+      TreeGardener gardener = new TreeGardener(random, library);
+      IFunctionTree parent = gardener.GetRandomParentNode(gpModel.FunctionTree);
+      if (parent == null) {
+        // parent == null means we should subsitute the whole tree
+        // => create a new random tree
+        IFunctionTree newTree = gardener.CreateRandomTree(gardener.AllFunctions, maxTreeSize, maxTreeHeight);
+        Debug.Assert(gardener.IsValidTree(newTree));
+
+        gpModel.FunctionTree = newTree;
+        // return a CompositeOperation that randomly initializes the new tree
+        return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newTree), scope);
+      } else {
+        // determine a random child of the parent to be replaced
+        int childIndex = random.Next(parent.SubTrees.Count);
+        // get the list of allowed functions for the new sub-tree
+        ICollection<IFunction> allowedFunctions = gardener.GetAllowedSubFunctions(parent.Function, childIndex);
+        if (allowedFunctions.Count == 0) {
+          // don't change anything
+          // this shouldn't happen
+          throw new InvalidProgramException();
+        }
+
+        // calculate the maximum size and height of the new sub-tree based on the location where
+        // it will be inserted
+        int parentLevel = gardener.GetBranchLevel(gpModel.FunctionTree, parent);
+        int maxSubTreeHeight = maxTreeHeight - parentLevel;
+        int maxSubTreeSize = maxTreeSize - (gpModel.Size - parent.SubTrees[childIndex].GetSize());
+
+        // create a random function tree
+        IFunctionTree newTree = gardener.CreateRandomTree(allowedFunctions, maxSubTreeSize, maxSubTreeHeight);
+        parent.RemoveSubTree(childIndex);
+        parent.InsertSubTree(childIndex, newTree);
+
+        Debug.Assert(gardener.IsValidTree(gpModel.FunctionTree));
+        // update the values of treeSize and treeHeight
+        gpModel.Size = gpModel.FunctionTree.GetSize();
+        gpModel.Height = gpModel.FunctionTree.GetHeight();
+        // the root hasn't changed so we don't need to update 
+        // return a CompositeOperation that randomly initializes all nodes of the new subtree
+        return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(newTree), scope);
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.frame
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.frame	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.frame	(revision 3223)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding")]
+[assembly: AssemblyDescription("HeuristicLab symbolic expression tree encoding and related operators")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2010 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6f0b963e-ff24-4396-b7bd-f8997b6eda55")]
+
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.0.$WCREV$")]
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbol.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbol.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbol.cs	(revision 3223)
@@ -0,0 +1,208 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using HeuristicLab.Core;
+using System.Linq;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  [Item("Symbol", "Represents a symbol in a symbolic function tree.")]
+  public abstract class Symbol : Item {
+    private List<List<Symbol>> allowedSubFunctions = new List<List<Symbol>>();
+    private int minArity = -1;
+    private int maxArity = -1;
+    private double tickets = 1.0;
+    private IOperator initializer;
+    private IOperator manipulator;
+    private int minTreeHeight = -1;
+    private int minTreeSize = -1;
+
+    private string name;
+    public virtual string Name {
+      get { return name; }
+      set {
+        if (string.IsNullOrEmpty(value)) throw new ArgumentException();
+        if (value != name) {
+          name = value;
+        }
+      }
+    }
+
+    protected Symbol() {
+      name = this.GetType().Name;
+    }
+
+    public int MinSubTrees {
+      get {
+        return minArity;
+      }
+      protected internal set {
+        if (value < 0) throw new ArgumentException();
+        if (minArity != value) {
+          minArity = value;
+          while (minArity > allowedSubFunctions.Count) allowedSubFunctions.Add(new List<Symbol>());
+          ResetCachedValues();
+        }
+      }
+    }
+
+    public int MaxSubTrees {
+      get {
+        return maxArity;
+      }
+      protected internal set {
+        if (value < 0) throw new ArgumentException();
+        if (value < minArity) throw new ArgumentException();
+        if (value != maxArity) {
+          maxArity = value;
+          while (allowedSubFunctions.Count > maxArity) allowedSubFunctions.RemoveAt(allowedSubFunctions.Count - 1);
+          while (maxArity > allowedSubFunctions.Count) {
+            if (allowedSubFunctions.Count > 0) {
+              // copy the list of allowed sub-functions from the previous slot
+              allowedSubFunctions.Add(new List<Symbol>(allowedSubFunctions[allowedSubFunctions.Count - 1]));
+            } else {
+              // add empty list
+              allowedSubFunctions.Add(new List<Symbol>());
+            }
+          }
+          ResetCachedValues();
+        }
+      }
+    }
+
+
+    public int MinTreeSize {
+      get {
+        if (minTreeSize <= 0) {
+          RecalculateMinimalTreeSize();
+        }
+        // Debug.Assert(minTreeSize > 0);
+        return minTreeSize;
+      }
+    }
+
+    public int MinTreeHeight {
+      get {
+        if (minTreeHeight <= 0) {
+          RecalculateMinimalTreeHeight();
+        }
+        // Debug.Assert(minTreeHeight > 0);
+        return minTreeHeight;
+      }
+    }
+
+    public double Tickets {
+      get { return tickets; }
+      set {
+        if (value < 0.0) throw new ArgumentException("Number of tickets must be positive");
+        if (value != tickets) {
+          tickets = value;
+        }
+      }
+    }
+
+    public IOperator Initializer {
+      get { return initializer; }
+      set {
+        if (initializer != value) {
+          initializer = value;
+        }
+      }
+    }
+
+    public IOperator Manipulator {
+      get { return manipulator; }
+      set {
+        if (manipulator != value) {
+          manipulator = value;
+        }
+      }
+    }
+
+    public virtual SymbolicExpressionTreeNode CreateTreeNode() {
+      return new SymbolicExpressionTreeNode(this);
+    }
+
+    public IEnumerable<Symbol> GetAllowedSubFunctions(int index) {
+      if (index < 0 || index > MaxSubTrees) throw new ArgumentException("Index outside of allowed range. index = " + index);
+      return allowedSubFunctions[index];
+    }
+
+    public void AddAllowedSubFunction(Symbol symbol, int index) {
+      if (index < 0 || index > MaxSubTrees) throw new ArgumentException("Index outside of allowed range. index = " + index);
+      if (allowedSubFunctions[index] == null) {
+        allowedSubFunctions[index] = new List<Symbol>();
+      }
+      if (!allowedSubFunctions[index].Contains(symbol)) {
+        allowedSubFunctions[index].Add(symbol);
+      }
+      ResetCachedValues();
+    }
+    public void RemoveAllowedSubFunction(Symbol symbol, int index) {
+      if (index < 0 || index > MaxSubTrees) throw new ArgumentException("Index outside of allowed range. index = " + index);
+      if (allowedSubFunctions[index].Contains(symbol)) {
+        allowedSubFunctions[index].Remove(symbol);
+        ResetCachedValues();
+      }
+    }
+
+    private void ResetCachedValues() {
+      minTreeHeight = -1;
+      minTreeSize = -1;
+    }
+
+    public bool IsAllowedSubFunction(Symbol symbol, int index) {
+      return GetAllowedSubFunctions(index).Contains(symbol);
+    }
+
+    private void RecalculateMinimalTreeSize() {
+      if (MinSubTrees == 0) minTreeSize = 1;
+      else {
+        minTreeSize = int.MaxValue; // prevent infinite recursion        
+        minTreeSize = 1 + (from slot in Enumerable.Range(0, MinSubTrees)
+                           let minForSlot = (from function in GetAllowedSubFunctions(slot)
+                                             where function != this
+                                             select function.MinTreeSize).DefaultIfEmpty(0).Min()
+                           select minForSlot).Sum();
+      }
+    }
+
+    private void RecalculateMinimalTreeHeight() {
+      if (MinSubTrees == 0) minTreeHeight = 1;
+      else {
+        minTreeHeight = int.MaxValue;
+        minTreeHeight = 1 + (from slot in Enumerable.Range(0, MinSubTrees)
+                             let minForSlot = (from function in GetAllowedSubFunctions(slot)
+                                               where function != this
+                                               select function.MinTreeHeight).DefaultIfEmpty(0).Min()
+                             select minForSlot).Max();
+      }
+    }
+
+    public override string ToString() {
+      return name;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionGrammar.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionGrammar.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionGrammar.cs	(revision 3223)
@@ -0,0 +1,110 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 System.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  [Item("SymbolicExpressionGrammar", "Represents a grammar that defines the syntax of symbolic expression trees.")]
+  public class SymbolicExpressionGrammar : Item, ISymbolicExpressionGrammar {
+    //private List<Symbol> symbols = new List<Symbol>();
+    //public IEnumerable<Symbol> Symbols {
+    //  get { return symbols; }
+    //}
+
+    // internal implementation of a symbol for the start symbol
+    private class EmptySymbol : Symbol {
+    }
+
+    private Dictionary<Symbol, Dictionary<int, IEnumerable<Symbol>>> allowedSymbols;
+
+    public SymbolicExpressionGrammar()
+      : base() {
+      startSymbol = new EmptySymbol();
+      allowedSymbols = new Dictionary<Symbol, Dictionary<int, IEnumerable<Symbol>>>();
+    }
+
+    //public void AddSymbol(Symbol symbol) {
+    //  if (!symbols.Contains(symbol)) {
+    //    symbols.Add(symbol);
+    //    symbol.ToStringChanged += new EventHandler(symbol_ToStringChanged);
+
+    //    OnToStringChanged();
+    //  }
+    //}
+
+    //public void RemoveSymbol(Symbol symbol) {
+    //  symbols.Remove(symbol);
+    //  symbol.ToStringChanged -= new EventHandler(symbol_ToStringChanged);
+
+    //  // remove the operator from the allowed sub-functions of all functions
+    //  foreach (Symbol f in Symbols) {
+    //    for (int i = 0; i < f.MaxSubTrees; i++) {
+    //      f.RemoveAllowedSubFunction(symbol, i);
+    //    }
+    //  }
+    //  OnToStringChanged();
+    //}
+
+    private void symbol_ToStringChanged(object sender, EventArgs e) {
+      OnToStringChanged();
+    }
+
+    #region ISymbolicExpressionGrammar Members
+
+    public Symbol startSymbol;
+    public Symbol StartSymbol {
+      get { return startSymbol; }
+    }
+   
+    public IEnumerable<Symbol> AllowedSymbols(Symbol parent, int argumentIndex) {
+      return allowedSymbols[parent][argumentIndex];
+    }
+
+    public int MinimalExpressionLength(Symbol start) {
+      throw new NotImplementedException();
+    }
+
+    public int MaximalExpressionLength(Symbol start) {
+      throw new NotImplementedException();
+    }
+
+    public int MinimalExpressionDepth(Symbol start) {
+      throw new NotImplementedException();
+    }
+
+    public int MinSubTrees(Symbol start) {
+      throw new NotImplementedException();
+    }
+
+    public int MaxSubTrees(Symbol start) {
+      throw new NotImplementedException();
+    }
+
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTree.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTree.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTree.cs	(revision 3223)
@@ -0,0 +1,68 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  [Item("SymbolicExpressionTree", "Represents a symbolic expression tree.")]
+  public class SymbolicExpressionTree : Item {
+    private SymbolicExpressionTreeNode root;
+    public SymbolicExpressionTreeNode Root {
+      get { return root; }
+      set {
+        if (value == null) throw new ArgumentNullException();
+        else if (value != root) {
+          root = value;
+          OnToStringChanged();
+        }
+      }
+    }
+
+    public int Size {
+      get {
+        return root.GetSize();
+      }
+    }
+
+    public int Height {
+      get {
+        return root.GetHeight();
+      }
+    }
+
+    public SymbolicExpressionTree() : base() { }
+
+    public SymbolicExpressionTree(SymbolicExpressionTreeNode root) : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      SymbolicExpressionTree clone = new SymbolicExpressionTree();
+      cloner.RegisterClonedObject(this, clone);
+      clone.root = (SymbolicExpressionTreeNode)this.root.Clone();
+      return clone;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeCreator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeCreator.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeCreator.cs	(revision 3223)
@@ -0,0 +1,79 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  /// <summary>
+  /// A base class for operators creating symbolic expression trees.
+  /// </summary>
+  [Item("SymbolicExpressionTreeCreator", "A base class for operators creating symbolic expression trees.")]
+  [StorableClass]
+  public abstract class SymbolicExpressionTreeCreator : SingleSuccessorOperator, ISolutionCreator, IStochasticOperator {
+    private const string RandomParameterName = "Random";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string MaxTreeSizeParameterName = "MaxTreeSize";
+    private const string MaxTreeHeightParameterName = "MaxTreeHeight";
+    private const string SymbolicExpressionGrammarParameterName = "SymbolicExpressionGrammar";
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters[RandomParameterName]; }
+    }
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    public IValueLookupParameter<IntValue> MaxTreeSizeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxTreeSizeParameterName]; }
+    }
+    public IValueLookupParameter<IntValue> MaxTreeHeightParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxTreeHeightParameterName]; }
+    }
+    public ILookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionGrammarParameter {
+      get { return (ILookupParameter<ISymbolicExpressionGrammar>)Parameters[SymbolicExpressionGrammarParameterName]; }
+    }
+
+    protected SymbolicExpressionTreeCreator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The pseudo random number generator which should be used for stochastic solution creation operators."));
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree that should be initialized."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeSizeParameterName, "The maximal size (number of nodes) of the symbolic expression tree that should be initialized."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeHeightParameterName, "The maximal height of the symbolic expression tree that should be initialized (a tree with one node has height = 0)."));
+      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionGrammarParameterName, "The grammar that defines the allowed symbols and syntax of the symbolic expression trees."));
+    }
+
+    public sealed override IOperation Apply() {
+      SymbolicExpressionTreeParameter.ActualValue = Create(RandomParameter.ActualValue, SymbolicExpressionGrammarParameter.ActualValue,
+        MaxTreeSizeParameter.ActualValue, MaxTreeHeightParameter.ActualValue);
+      return base.Apply();
+    }
+
+    protected abstract SymbolicExpressionTree Create(IRandom random, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight);
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeCrossover.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeCrossover.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeCrossover.cs	(revision 3223)
@@ -0,0 +1,71 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  /// <summary>
+  /// A base class for operators that perform a crossover of real-valued vectors.
+  /// </summary>
+  [Item("RealVectorCrossover", "A base class for operators that perform a crossover of real-valued vectors.")]
+  [StorableClass]
+  public abstract class RealVectorCrossover : SingleSuccessorOperator, IRealVectorCrossover, IStochasticOperator {
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public ILookupParameter<ItemArray<RealVector>> ParentsParameter {
+      get { return (SubScopesLookupParameter<RealVector>)Parameters["Parents"]; }
+    }
+    public ILookupParameter<RealVector> ChildParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Child"]; }
+    }
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+
+    protected RealVectorCrossover()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic crossover operators."));
+      Parameters.Add(new SubScopesLookupParameter<RealVector>("Parents", "The parent vectors which should be crossed."));
+      Parameters.Add(new LookupParameter<RealVector>("Child", "The child vector resulting from the crossover."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds of the real vector."));
+    }
+
+    public sealed override IOperation Apply() {
+      RealVector result = Cross(RandomParameter.ActualValue, ParentsParameter.ActualValue);
+      DoubleMatrix bounds = BoundsParameter.ActualValue;
+      if (bounds != null) BoundsChecker.Apply(result, bounds);
+      ChildParameter.ActualValue = result;
+      return base.Apply();
+    }
+
+    protected abstract RealVector Cross(IRandom random, ItemArray<RealVector> parents);
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeManipulator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeManipulator.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeManipulator.cs	(revision 3223)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("RealVectorManipulator", "A base class for operators that manipulate real-valued vectors.")]
+  [StorableClass]
+  public abstract class RealVectorManipulator : SingleSuccessorOperator, IRealVectorManipulator, IStochasticOperator {
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public ILookupParameter<RealVector> RealVectorParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+
+    protected RealVectorManipulator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
+      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The vector which should be manipulated."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds of the real vector."));
+    }
+
+    public sealed override IOperation Apply() {
+      RealVector vector = RealVectorParameter.ActualValue;
+      Manipulate(RandomParameter.ActualValue, vector);
+      DoubleMatrix bounds = BoundsParameter.ActualValue;
+      if (bounds != null) BoundsChecker.Apply(vector, bounds);
+      return base.Apply();
+    }
+
+    protected abstract void Manipulate(IRandom random, RealVector realVector);
+  }
+}
Index: /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs	(revision 3223)
@@ -0,0 +1,96 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  public class SymbolicExpressionTreeNode : DeepCloneable {
+    private List<SymbolicExpressionTreeNode> subTrees;
+    private Symbol symbol;
+
+    public SymbolicExpressionTreeNode() {
+    }
+
+    public SymbolicExpressionTreeNode(Symbol symbol) {
+      subTrees = new List<SymbolicExpressionTreeNode>();
+      this.symbol = symbol;
+    }
+
+    //protected SymbolicExpressionTreeNode(SymbolicExpressionTreeNode original) {
+    //  this.symbol = original.Symbol;
+    //  this.subTrees = new List<SymbolicExpressionTreeNode>(original.SubTrees.Count);
+    //  foreach (SymbolicExpressionTreeNode originalSubTree in original.SubTrees) {
+    //    this.SubTrees.Add((SymbolicExpressionTreeNode)originalSubTree.Clone());
+    //  }
+    //}
+
+    internal virtual bool HasLocalParameters {
+      get { return false; }
+    }
+
+    public virtual IList<SymbolicExpressionTreeNode> SubTrees {
+      get { return subTrees; }
+    }
+
+    public Symbol Symbol {
+      get { return symbol; }
+      protected set { symbol = value; }
+    }
+
+    internal int GetSize() {
+      int size = 1;
+      foreach (SymbolicExpressionTreeNode tree in SubTrees) size += tree.GetSize();
+      return size;
+    }
+
+    internal int GetHeight() {
+      int maxHeight = 0;
+      foreach (SymbolicExpressionTreeNode tree in SubTrees) maxHeight = Math.Max(maxHeight, tree.GetHeight());
+      return maxHeight + 1;
+    }
+
+    //public virtual IOperation CreateShakingOperation(IScope scope) {
+    //  return null;
+    //}
+
+    //public virtual IOperation CreateInitOperation(IScope scope) {
+    //  return null;
+    //}
+
+    protected internal virtual void AddSubTree(SymbolicExpressionTreeNode tree) {
+      SubTrees.Add(tree);
+    }
+
+    protected internal virtual void InsertSubTree(int index, SymbolicExpressionTreeNode tree) {
+      SubTrees.Insert(index, tree);
+    }
+
+    protected internal virtual void RemoveSubTree(int index) {
+      SubTrees.RemoveAt(index);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/AntInterpreter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/AntInterpreter.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/AntInterpreter.cs	(revision 3223)
@@ -0,0 +1,147 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.ArtificialAnt {
+  internal class AntInterpreter {
+    private const int N_FOOD_ITEMS = 89;
+    private const int WORLD_WIDTH = 32;
+    private const int WORLD_HEIGHT = 32;
+    private const int FOOD = 1;
+    private const int EMPTY = 0;
+    private int[] SANTA_FE_TRAIL = new int[] {
+      0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 
+      0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 
+      0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 
+      0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    };
+
+    private int[] trail;
+
+    public int ElapsedTime { get; set; }
+    public int MaxTimeSteps { get; set; }
+    public int FoodEaten { get; set; }
+    private int currentDirection;
+    private int currentLocation;
+
+    public AntInterpreter() {
+      currentLocation = 0;
+      currentDirection = 0;
+      FoodEaten = 0;
+      trail = new int[WORLD_HEIGHT * WORLD_WIDTH];
+      Array.Copy(SANTA_FE_TRAIL, trail, SANTA_FE_TRAIL.Length);
+    }
+
+    internal void Run(SymbolicExpressionTree tree) {
+      while (FoodEaten < N_FOOD_ITEMS && ElapsedTime < MaxTimeSteps) {
+        Step(tree.Root);
+      }
+    }
+
+    internal void Step(SymbolicExpressionTreeNode currentNode) {
+      if (currentNode.Symbol is Left) {
+        if (ElapsedTime >= MaxTimeSteps || FoodEaten >= N_FOOD_ITEMS) return;
+        currentDirection = (currentDirection + 3) % 4;
+        ElapsedTime++;
+      } else if (currentNode.Symbol is Right) {
+        if (ElapsedTime >= MaxTimeSteps || FoodEaten >= N_FOOD_ITEMS) return;
+        currentDirection = (currentDirection + 1) % 4;
+        ElapsedTime++;
+      } else if (currentNode.Symbol is Move) {
+        if (ElapsedTime >= MaxTimeSteps || FoodEaten >= N_FOOD_ITEMS) return;
+        currentLocation = NextField();
+        FoodEaten += trail[currentLocation];
+        trail[currentLocation] = EMPTY;
+        ElapsedTime++;
+      } else if (currentNode.Symbol is IfFoodAhead) {
+        if (trail[NextField()] == FOOD) {
+          Step(currentNode.SubTrees[0]);
+        } else {
+          Step(currentNode.SubTrees[1]);
+        }
+      } else if (currentNode.Symbol is Prog2) {
+        Step(currentNode.SubTrees[0]);
+        Step(currentNode.SubTrees[1]);
+        return;
+      } else if (currentNode.Symbol is Prog3) {
+        Step(currentNode.SubTrees[0]);
+        Step(currentNode.SubTrees[1]);
+        Step(currentNode.SubTrees[2]);
+        return;
+      } else {
+        throw new InvalidOperationException(currentNode.Symbol.ToString());
+      }
+    }
+
+    private int NextField() {
+      int currentLocationX = currentLocation % WORLD_WIDTH;
+      int currentLocationY = currentLocation / WORLD_HEIGHT;
+
+      switch (currentDirection) {
+        case 0:
+          currentLocationX = (currentLocationX + 1) % WORLD_WIDTH; // EAST
+          break;
+        case 1:
+          currentLocationY = (currentLocationY + 1) % WORLD_HEIGHT; // SOUTH
+          break;
+        case 2:
+          currentLocationX = (currentLocationX + WORLD_WIDTH - 1) % WORLD_WIDTH; // WEST
+          break;
+        case 3:
+          currentLocationY = (currentLocationY + WORLD_HEIGHT - 1) % WORLD_HEIGHT; // NORTH
+          break;
+        default:
+          throw new InvalidOperationException();
+      }
+      return currentLocationY * WORLD_WIDTH + currentLocationX;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntExpressionGrammar.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntExpressionGrammar.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntExpressionGrammar.cs	(revision 3223)
@@ -0,0 +1,145 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using System.Collections.Generic;
+using System;
+using HeuristicLab.Core;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public class ArtificialAntExpressionGrammar : Item, ISymbolicExpressionGrammar {
+
+    private class EmptySymbol : Symbol { }
+
+    public ArtificialAntExpressionGrammar()
+      : base() {
+    }
+    #region ISymbolicExpressionGrammar Members
+
+    private EmptySymbol startSymbol = new EmptySymbol();
+    public Symbol StartSymbol {
+      get { return startSymbol; }
+    }
+
+    private static List<Symbol> allSymbols = new List<Symbol>() {
+      new IfFoodAhead(),
+      new Prog2(),
+      new Prog3(),
+      new Move(),
+      new Left(),
+      new Right()
+    };
+    private Dictionary<Type, Dictionary<int, IEnumerable<Symbol>>> allowedSymbols = new Dictionary<Type, Dictionary<int, IEnumerable<Symbol>>>() {
+      {
+        typeof(EmptySymbol),
+        new Dictionary<int, IEnumerable<Symbol>>() 
+        {
+          { 0, allSymbols},
+        }
+      },      {
+        typeof(IfFoodAhead),
+        new Dictionary<int, IEnumerable<Symbol>>() 
+        {
+          { 0, allSymbols},
+          { 1, allSymbols}
+        }
+      },
+      {
+        typeof(Prog2),
+        new Dictionary<int, IEnumerable<Symbol>>() 
+        {
+          { 0, allSymbols},
+          { 1, allSymbols}
+        }
+      },
+      {
+        typeof(Prog3),
+        new Dictionary<int, IEnumerable<Symbol>>() 
+        {
+          { 0, allSymbols},
+          { 1, allSymbols},
+          { 2, allSymbols}
+        }
+      },
+    };
+    public IEnumerable<Symbol> AllowedSymbols(Symbol parent, int argumentIndex) {
+      return allowedSymbols[parent.GetType()][argumentIndex];
+    }
+
+    private Dictionary<Type, int> minLength = new Dictionary<Type, int>() {
+      {typeof(EmptySymbol), 1}, 
+      {typeof(IfFoodAhead), 3},
+      {typeof(Prog2), 3},
+      {typeof(Prog3), 4},
+      {typeof(Move), 1},
+      {typeof(Left), 1},
+      {typeof(Right), 1}
+    };
+    public int MinimalExpressionLength(Symbol start) {
+      return minLength[start.GetType()];
+    }
+
+    private Dictionary<Type, int> maxLength = new Dictionary<Type, int>() {
+      {typeof(EmptySymbol), int.MaxValue}, 
+      {typeof(IfFoodAhead), int.MaxValue},
+      {typeof(Prog2), int.MaxValue},
+      {typeof(Prog3), int.MaxValue},
+      {typeof(Move), 1},
+      {typeof(Left), 1},
+      {typeof(Right), 1}
+    };
+    public int MaximalExpressionLength(Symbol start) {
+      return maxLength[start.GetType()];
+    }
+
+    private Dictionary<Type, int> minDepth = new Dictionary<Type, int>() {
+      {typeof(EmptySymbol), 1}, 
+      {typeof(IfFoodAhead), 1},
+      {typeof(Prog2), 1},
+      {typeof(Prog3), 1},
+      {typeof(Move), 0},
+      {typeof(Left), 0},
+      {typeof(Right), 0}
+    };
+    public int MinimalExpressionDepth(Symbol start) {
+      return minDepth[start.GetType()];
+    }
+
+
+    private Dictionary<Type, int> subTrees = new Dictionary<Type, int>() {
+      {typeof(EmptySymbol), 1}, 
+      {typeof(IfFoodAhead), 2},
+      {typeof(Prog2), 2},
+      {typeof(Prog3), 3},
+      {typeof(Move), 0},
+      {typeof(Left), 0},
+      {typeof(Right), 0}
+    };
+    public int MinSubTrees(Symbol start) {
+      return subTrees[start.GetType()];
+    }
+    public int MaxSubTrees(Symbol start) {
+      return subTrees[start.GetType()];
+    }
+
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs	(revision 3223)
@@ -0,0 +1,229 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 System.Drawing;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.ArtificialAnt {
+  [Item("ArtificialAntProblem", "Represents the Artificial Ant problem.")]
+  [Creatable("Problems")]
+  [StorableClass]
+  public sealed class ArtificialAntProblem : ParameterizedNamedItem, ISingleObjectiveProblem {
+    public override Image ItemImage {
+      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
+    }
+
+    #region Parameter Properties
+    public ValueParameter<BoolValue> MaximizationParameter {
+      get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    IParameter ISingleObjectiveProblem.MaximizationParameter {
+      get { return MaximizationParameter; }
+    }
+    public ValueParameter<SymbolicExpressionTreeCreator> SolutionCreatorParameter {
+      get { return (ValueParameter<SymbolicExpressionTreeCreator>)Parameters["SolutionCreator"]; }
+    }
+    IParameter IProblem.SolutionCreatorParameter {
+      get { return SolutionCreatorParameter; }
+    }
+    public ValueParameter<Evaluator> EvaluatorParameter {
+      get { return (ValueParameter<Evaluator>)Parameters["Evaluator"]; }
+    }
+    IParameter IProblem.EvaluatorParameter {
+      get { return EvaluatorParameter; }
+    }
+    public ValueParameter<ISymbolicExpressionGrammar> ArtificialAntExpressionGrammarParameter {
+      get { return (ValueParameter<ISymbolicExpressionGrammar>)Parameters["ArtificialAntExpressionGrammar"]; }
+    }
+    public ValueParameter<IntValue> MaxExpressionLengthParameter {
+      get { return (ValueParameter<IntValue>)Parameters["MaxExpressionLength"]; }
+    }
+    public ValueParameter<IntValue> MaxExpressionDepthParameter {
+      get { return (ValueParameter<IntValue>)Parameters["MaxExpressionDepth"]; }
+    }
+
+    public OptionalValueParameter<IAntTrailVisualizer> VisualizerParameter {
+      get { return (OptionalValueParameter<IAntTrailVisualizer>)Parameters["Visualizer"]; }
+    }
+    IParameter IProblem.VisualizerParameter {
+      get { return VisualizerParameter; }
+    }
+    public ValueParameter<DoubleValue> BestKnownQualityParameter {
+      get { return (ValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
+    }
+    IParameter ISingleObjectiveProblem.BestKnownQualityParameter {
+      get { return BestKnownQualityParameter; }
+    }
+    #endregion
+
+    #region Properties
+    public SymbolicExpressionTreeCreator SolutionCreator {
+      get { return SolutionCreatorParameter.Value; }
+      set { SolutionCreatorParameter.Value = value; }
+    }
+    ISolutionCreator IProblem.SolutionCreator {
+      get { return SolutionCreatorParameter.Value; }
+    }
+    public Evaluator Evaluator {
+      get { return EvaluatorParameter.Value; }
+      set { EvaluatorParameter.Value = value; }
+    }
+    ISingleObjectiveEvaluator ISingleObjectiveProblem.Evaluator {
+      get { return EvaluatorParameter.Value; }
+    }
+    IEvaluator IProblem.Evaluator {
+      get { return EvaluatorParameter.Value; }
+    }
+    public ISymbolicExpressionGrammar ArtificialAntExpressionGrammar {
+      get { return ArtificialAntExpressionGrammarParameter.Value; }
+    }
+    public IAntTrailVisualizer Visualizer {
+      get { return VisualizerParameter.Value; }
+      set { VisualizerParameter.Value = value; }
+    }
+    ISolutionsVisualizer IProblem.Visualizer {
+      get { return VisualizerParameter.Value; }
+    }
+    public DoubleValue BestKnownQuality {
+      get { return BestKnownQualityParameter.Value; }
+    }
+    private List<IOperator> operators;
+    public IEnumerable<IOperator> Operators {
+      get { return operators; }
+    }
+    #endregion
+
+    public ArtificialAntProblem()
+      : base() {
+      SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();
+      Evaluator evaluator = new Evaluator();
+      ArtificialAntExpressionGrammar grammar = new ArtificialAntExpressionGrammar();
+
+      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to true as the Artificial Ant Problem is a maximization problem.", new BoolValue(true)));
+      Parameters.Add(new ValueParameter<SymbolicExpressionTreeCreator>("SolutionCreator", "The operator which should be used to create new artificial ant solutions.", creator));
+      Parameters.Add(new ValueParameter<Evaluator>("Evaluator", "The operator which should be used to evaluate artificial ant solutions.", evaluator));
+      Parameters.Add(new ValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this OneMax instance.", new DoubleValue(200)));
+      Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("ArtificialAntExpressionGrammar", "The grammar that should be used for artificial ant expressions.", grammar));
+      Parameters.Add(new ValueParameter<IntValue>("MaxExpressionLength", "Maximal length of the expression to control the artificial ant.", new IntValue(100)));
+      Parameters.Add(new ValueParameter<IntValue>("MaxExpressionDepth", "Maximal depth of the expression to control the artificial ant.", new IntValue(10)));
+      Parameters.Add(new ValueParameter<IAntTrailVisualizer>("Visualizer", "The operator which should be used to visualize artificial ant solutions.", null));
+
+      creator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolution";
+      evaluator.QualityParameter.ActualName = "FoodEaten";
+      ParameterizeSolutionCreator();
+      ParameterizeEvaluator();
+
+      Initialize();
+    }
+
+    [StorableConstructor]
+    private ArtificialAntProblem(bool deserializing) : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      ArtificialAntProblem clone = (ArtificialAntProblem)base.Clone(cloner);
+      clone.Initialize();
+      return clone;
+    }
+
+    #region Events
+    public event EventHandler SolutionCreatorChanged;
+    private void OnSolutionCreatorChanged() {
+      if (SolutionCreatorChanged != null)
+        SolutionCreatorChanged(this, EventArgs.Empty);
+    }
+    public event EventHandler EvaluatorChanged;
+    private void OnEvaluatorChanged() {
+      if (EvaluatorChanged != null)
+        EvaluatorChanged(this, EventArgs.Empty);
+    }
+    public event EventHandler VisualizerChanged;
+    private void OnVisualizerChanged() {
+      if (VisualizerChanged != null)
+        VisualizerChanged(this, EventArgs.Empty);
+    }
+
+    public event EventHandler OperatorsChanged;
+    private void OnOperatorsChanged() {
+      if (OperatorsChanged != null)
+        OperatorsChanged(this, EventArgs.Empty);
+    }
+
+    private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
+      SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
+      ParameterizeSolutionCreator();
+      ParameterizeEvaluator();
+      ParameterizeOperators();
+      OnSolutionCreatorChanged();
+    }
+    private void SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged(object sender, EventArgs e) {
+      ParameterizeEvaluator();
+      ParameterizeOperators();
+    }
+    private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
+      ParameterizeEvaluator();
+      OnEvaluatorChanged();
+    }
+    #endregion
+
+    #region Helpers
+    [StorableHook(HookType.AfterDeserialization)]
+    private void Initialize() {
+      InitializeOperators();
+      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
+      SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
+      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
+    }
+    private void ParameterizeSolutionCreator() {
+      SolutionCreator.SymbolicExpressionGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name;
+    }
+    private void ParameterizeEvaluator() {
+      Evaluator.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+    }
+    private void InitializeOperators() {
+      operators = new List<IOperator>();
+      operators.Add(Evaluator);
+      operators.Add(SolutionCreator);
+      ParameterizeOperators();
+    }
+
+    private void ParameterizeOperators() {
+      foreach (ProbabilisticTreeCreator op in Operators.OfType<ProbabilisticTreeCreator>()) {
+        op.MaxTreeHeightParameter.ActualName = MaxExpressionDepthParameter.Name;
+        op.MaxTreeSizeParameter.ActualName = MaxExpressionLengthParameter.Name;
+        op.SymbolicExpressionGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name;
+      }
+      foreach (Evaluator op in Operators.OfType<Evaluator>()) {
+        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+      }
+    }
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblemView.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblemView.Designer.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblemView.Designer.cs	(revision 3223)
@@ -0,0 +1,31 @@
+﻿namespace HeuristicLab.Problems.ArtificialAnt {
+  partial class ArtificialAntProblemView {
+    /// <summary>
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary>
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Windows Form Designer generated code
+
+    /// <summary>
+    /// Required method for Designer support - do not modify
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.components = new System.ComponentModel.Container();
+    }
+
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblemView.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblemView.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblemView.cs	(revision 3223)
@@ -0,0 +1,35 @@
+﻿using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.Optimization.Views;
+using HeuristicLab.MainForm;
+
+namespace HeuristicLab.Problems.ArtificialAnt {
+  [View("ArtificialAntProblem View")]
+  [Content(typeof(ArtificialAntProblem), true)]
+  public partial class ArtificialAntProblemView : ProblemView {
+    public new ArtificialAntProblem Content {
+      get { return (ArtificialAntProblem)base.Content; }
+      set { base.Content = value; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="ArtificialAntProblemView"/>.
+    /// </summary>
+    public ArtificialAntProblemView() {
+      InitializeComponent();
+    }
+    /// <summary>
+    /// Intializes a new instance of <see cref="ArtificialAntProblemView"/> with the given <paramref name="item"/>.
+    /// </summary>
+    /// <param name="item">The item that should be displayed.</param>
+    public ArtificialAntProblemView(ArtificialAntProblem content)
+      : this() {
+      Content = content;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Evaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Evaluator.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Evaluator.cs	(revision 3223)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Operators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Optimization;
+
+namespace HeuristicLab.Problems.ArtificialAnt {
+  [Item("ArtificialAntEvaluator", "Evaluates an artificial ant solution.")]
+  [StorableClass]
+  public class Evaluator : SingleSuccessorOperator, ISingleObjectiveEvaluator {
+
+    public ILookupParameter<DoubleValue> QualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; }
+    }
+    public Evaluator()
+      : base() {
+      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the evaluated artificial ant solution."));
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>("SymbolicExpressionTree", "The artificial ant solution encoded as a symbolic expression tree that should be evaluated"));
+    }
+
+    public sealed override IOperation Apply() {
+
+      SymbolicExpressionTree solution = SymbolicExpressionTreeParameter.ActualValue;
+      AntInterpreter interpreter = new AntInterpreter();
+      interpreter.MaxTimeSteps = 600;
+      interpreter.Run(solution);
+
+      QualityParameter.ActualValue = new DoubleValue(interpreter.FoodEaten);
+      return null;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLab.Problems.ArtificialAnt-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLab.Problems.ArtificialAnt-3.3.csproj	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLab.Problems.ArtificialAnt-3.3.csproj	(revision 3223)
@@ -0,0 +1,186 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{F5C0ECAC-EDBA-4024-872A-1F74AFCB20B4}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Problems.ArtificialAnt</RootNamespace>
+    <AssemblyName>HeuristicLab.Problems.ArtificialAnt-3.3</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AntInterpreter.cs" />
+    <Compile Include="HeuristicLabProblemsArtificialAntPlugin.cs" />
+    <Compile Include="IAntTrailVisualizer.cs" />
+    <Compile Include="Evaluator.cs" />
+    <Compile Include="ArtificialAntExpressionGrammar.cs" />
+    <Compile Include="ArtificialAntProblem.cs" />
+    <Compile Include="ArtificialAntProblemView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="ArtificialAntProblemView.Designer.cs">
+      <DependentUpon>ArtificialAntProblemView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Symbols\IfFoodAhead.cs" />
+    <Compile Include="Symbols\Left.cs" />
+    <Compile Include="Symbols\Move.cs" />
+    <Compile Include="Symbols\Prog2.cs" />
+    <Compile Include="Symbols\Prog3.cs" />
+    <Compile Include="Symbols\Right.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
+      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
+      <Name>HeuristicLab.Collections-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.2\HeuristicLab.Common.Resources-3.2.csproj">
+      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
+      <Name>HeuristicLab.Common.Resources-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
+      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
+      <Name>HeuristicLab.Core.Views-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
+      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
+      <Name>HeuristicLab.Core-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
+      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
+      <Name>HeuristicLab.Data-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj">
+      <Project>{125D3006-67F5-48CB-913E-73C0548F17FA}</Project>
+      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.2\HeuristicLab.MainForm.WindowsForms-3.2.csproj">
+      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
+      <Name>HeuristicLab.MainForm.WindowsForms-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.MainForm\3.2\HeuristicLab.MainForm-3.2.csproj">
+      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
+      <Name>HeuristicLab.MainForm-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
+      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
+      <Name>HeuristicLab.Operators-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
+      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
+      <Name>HeuristicLab.Optimization.Views-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
+      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
+      <Name>HeuristicLab.Optimization-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
+      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
+      <Name>HeuristicLab.Parameters-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
+      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
+      <Name>HeuristicLab.Persistence-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabProblemsArtificialAntPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabProblemsArtificialAntPlugin.cs"</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLabProblemsArtificialAntPlugin.cs.frame
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLabProblemsArtificialAntPlugin.cs.frame	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/HeuristicLabProblemsArtificialAntPlugin.cs.frame	(revision 3223)
@@ -0,0 +1,41 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.ArtificialAnt {
+  [Plugin("HeuristicLab.Problems.ArtificialAnt","3.3.0.$WCREV$")]
+  [PluginFile("HeuristicLab.Problems.ArtificialAnt-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Common.Resources", "3.2.0.0")]
+  [PluginDependency("HeuristicLab.Core", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Data", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","3.3.0.0")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Operators", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3.0.0")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3.0.0")]
+  public class HeuristicLabProblemsArtificialAntPlugin : PluginBase {
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/IAntTrailVisualizer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/IAntTrailVisualizer.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/IAntTrailVisualizer.cs	(revision 3223)
@@ -0,0 +1,29 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public interface IAntTrailVisualizer : ISolutionsVisualizer {
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Properties/AssemblyInfo.frame
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Properties/AssemblyInfo.frame	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Properties/AssemblyInfo.frame	(revision 3223)
@@ -0,0 +1,55 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Problems.ArtificialAnt")]
+[assembly: AssemblyDescription("HeuristicLab artificial ant problem classes")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2010 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("69563847-2b75-4aa4-a924-f24b74d19947")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.0.$WCREV$")]
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/IfFoodAhead.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/IfFoodAhead.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/IfFoodAhead.cs	(revision 3223)
@@ -0,0 +1,26 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public sealed class IfFoodAhead : Symbol {
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Left.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Left.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Left.cs	(revision 3223)
@@ -0,0 +1,26 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public sealed class Left : Symbol {
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Move.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Move.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Move.cs	(revision 3223)
@@ -0,0 +1,26 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public sealed class Move : Symbol {
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Prog2.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Prog2.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Prog2.cs	(revision 3223)
@@ -0,0 +1,27 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public sealed class Prog2 : Symbol {
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Prog3.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Prog3.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Prog3.cs	(revision 3223)
@@ -0,0 +1,31 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public sealed class Prog3 : Symbol {
+
+    public Prog3()
+      : base() {
+      MinSubTrees = 3; MaxSubTrees = 3;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Right.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Right.cs	(revision 3223)
+++ /trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/Symbols/Right.cs	(revision 3223)
@@ -0,0 +1,26 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+namespace HeuristicLab.Problems.ArtificialAnt {
+  public sealed class Right : Symbol {
+  }
+}
