Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/DefaultSymbolicExpressionGrammarView.Designer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/DefaultSymbolicExpressionGrammarView.Designer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/DefaultSymbolicExpressionGrammarView.Designer.cs	(revision 4803)
@@ -0,0 +1,72 @@
+﻿#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
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  partial class DefaultSymbolicExpressionGrammarView {
+    /// <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 Component 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.checkedItemListView = new HeuristicLab.Core.Views.CheckedItemListView<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols.Symbol>();
+      this.SuspendLayout();
+      this.checkedItemListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.checkedItemListView.Location = new System.Drawing.Point(3, 3);
+      this.checkedItemListView.Name = "itemListView";
+      this.checkedItemListView.Size = new System.Drawing.Size(274, 239);
+      this.checkedItemListView.TabIndex = 0;
+      // 
+      // DefaultSymbolicExpressionGrammarView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.checkedItemListView);
+      this.Name = "DefaultSymbolicExpressionGrammarView";
+      this.Size = new System.Drawing.Size(280, 245);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    protected HeuristicLab.Core.Views.CheckedItemListView<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols.Symbol> checkedItemListView;
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/DefaultSymbolicExpressionGrammarView.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/DefaultSymbolicExpressionGrammarView.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/DefaultSymbolicExpressionGrammarView.cs	(revision 4803)
@@ -0,0 +1,105 @@
+﻿#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.Windows.Forms;
+using HeuristicLab.Core;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  [View("Symbolic Expression Grammar View")]
+  [Content(typeof(DefaultSymbolicExpressionGrammar), true)]
+  public partial class DefaultSymbolicExpressionGrammarView : ItemView {
+    private CheckedItemList<Symbol> symbols;
+
+    public new DefaultSymbolicExpressionGrammar Content {
+      get { return (DefaultSymbolicExpressionGrammar)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public DefaultSymbolicExpressionGrammarView() {
+      InitializeComponent();
+      symbols = new CheckedItemList<Symbol>();
+      symbols.CheckedItemsChanged += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<Symbol>>(symbols_CheckedItemsChanged);
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      UpdateControl();
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      checkedItemListView.Enabled = Content != null;
+      checkedItemListView.ReadOnly = ReadOnly;
+    }
+
+    #region content event handlers
+    private void Content_Changed(object sender, EventArgs e) {
+      UpdateControl();
+    }
+    #endregion
+
+    #region helpers
+    private void UpdateControl() {
+      if (Content == null) {
+        ClearSymbols();
+        checkedItemListView.Content = symbols.AsReadOnly();
+      } else {
+        ClearSymbols();
+        foreach (Symbol symbol in Content.Symbols) {
+          if (!(symbol is ReadOnlySymbol)) {
+            symbol.Changed += new EventHandler(symbol_Changed);
+            symbols.Add(symbol, symbol.InitialFrequency > 0.0);
+          }
+        }
+        checkedItemListView.Content = symbols.AsReadOnly();
+      }
+      SetEnabledStateOfControls();
+    }
+
+
+    private void symbol_Changed(object sender, EventArgs e) {
+      Symbol symbol = (Symbol)sender;
+      symbols.SetItemCheckedState(symbol, symbol.InitialFrequency > 0.0);
+    }
+
+    private void symbols_CheckedItemsChanged(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<HeuristicLab.Collections.IndexedItem<Symbol>> e) {
+      ICheckedItemList<Symbol> checkedItemList = (ICheckedItemList<Symbol>)sender;
+      foreach (var indexedItem in e.Items) {
+        if (checkedItemList.ItemChecked(indexedItem.Value)) {
+          indexedItem.Value.InitialFrequency = 1.0;
+        } else {
+          indexedItem.Value.InitialFrequency = 0.0;
+        }
+      }
+    }
+    private void ClearSymbols() {
+      foreach (Symbol s in symbols)
+        s.Changed -= new EventHandler(symbol_Changed);
+      symbols.Clear();
+    }
+    #endregion
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.Designer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.Designer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.Designer.cs	(revision 4803)
@@ -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
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  partial class GraphicalSymbolicExpressionTreeView {
+    /// <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 Component 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.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
+      this.SuspendLayout();
+      // 
+      // functionTreeChart
+      // 
+      this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
+      this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.symbolicExpressionTreeChart.Tree = null;
+      this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
+      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
+      this.symbolicExpressionTreeChart.Name = "functionTreeChart";
+      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(407, 367);
+      this.symbolicExpressionTreeChart.Spacing = 5;
+      this.symbolicExpressionTreeChart.TabIndex = 0;
+      this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Times New Roman", 6F);
+      // 
+      // FunctionTreeView
+      // 
+      this.AllowDrop = true;
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.symbolicExpressionTreeChart);
+      this.Name = "FunctionTreeView";
+      this.Size = new System.Drawing.Size(407, 367);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private SymbolicExpressionTreeChart symbolicExpressionTreeChart;
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/GraphicalSymbolicExpressionTreeView.cs	(revision 4803)
@@ -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.Windows.Forms;
+using HeuristicLab.Core.Views;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  [View("Graphical SymbolicExpressionTree View")]
+  [Content(typeof(SymbolicExpressionTree), true)]
+  public partial class GraphicalSymbolicExpressionTreeView : ItemView {
+    public new SymbolicExpressionTree Content {
+      get { return (SymbolicExpressionTree)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public GraphicalSymbolicExpressionTreeView()
+      : base() {
+      InitializeComponent();
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content == null) {
+        symbolicExpressionTreeChart.Tree = null;
+      } else {
+        symbolicExpressionTreeChart.Tree = Content;
+      }
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      symbolicExpressionTreeChart.Enabled = Content != null;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.csproj
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.csproj	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.csproj	(revision 4803)
@@ -0,0 +1,218 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" 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>{6F42C5F8-16CD-43EE-8208-FD4573A69D85}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views</RootNamespace>
+    <AssemblyName>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation />
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <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="DefaultSymbolicExpressionGrammarView.cs" />
+    <Compile Include="DefaultSymbolicExpressionGrammarView.Designer.cs">
+      <DependentUpon>DefaultSymbolicExpressionGrammarView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="SymbolView.cs" />
+    <Compile Include="SymbolView.Designer.cs">
+      <DependentUpon>SymbolView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="GraphicalSymbolicExpressionTreeView.cs" />
+    <Compile Include="GraphicalSymbolicExpressionTreeView.Designer.cs">
+      <DependentUpon>GraphicalSymbolicExpressionTreeView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SymbolicExpressionTreeChart.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SymbolicExpressionTreeChart.Designer.cs">
+      <DependentUpon>SymbolicExpressionTreeChart.cs</DependentUpon>
+    </Compile>
+    <Compile Include="SymbolicExpressionView.cs" />
+    <Compile Include="SymbolicExpressionView.Designer.cs">
+      <DependentUpon>SymbolicExpressionView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="VisualSymbolicExpressionTreeNode.cs" />
+  </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\3.3\HeuristicLab.Common-3.3.csproj">
+      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
+      <Name>HeuristicLab.Common-3.3</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.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.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
+      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
+      <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
+      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
+      <Name>HeuristicLab.MainForm-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs.frame" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </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\HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs"</PreBuildEvent>
+  </PropertyGroup>
+  <PropertyGroup>
+    <PostBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+set Platform=$(PlatformName)
+
+call UpdateLocalInstallation.cmd
+</PostBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs	(revision 4803)
@@ -0,0 +1,39 @@
+#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.Views {
+  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.3.1.0")]
+  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
+  public class HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin : PluginBase {
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs.frame
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs.frame	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs.frame	(revision 4803)
@@ -0,0 +1,39 @@
+#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.Views {
+  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.3.1.$WCREV$")]
+  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
+  public class HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin : PluginBase {
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/Properties/AssemblyInfo.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/Properties/AssemblyInfo.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/Properties/AssemblyInfo.cs	(revision 4803)
@@ -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.Views")]
+[assembly: AssemblyDescription("HeuristicLab symbolic expression tree encoding views")]
+[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("266fc20e-e762-4f01-8d2d-17187186d0f9")]
+
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.1.0")]
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/Properties/AssemblyInfo.frame
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/Properties/AssemblyInfo.frame	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/Properties/AssemblyInfo.frame	(revision 4803)
@@ -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.Views")]
+[assembly: AssemblyDescription("HeuristicLab symbolic expression tree encoding views")]
+[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("266fc20e-e762-4f01-8d2d-17187186d0f9")]
+
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.1.$WCREV$")]
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolView.Designer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolView.Designer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolView.Designer.cs	(revision 4803)
@@ -0,0 +1,112 @@
+﻿#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
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  partial class SymbolView {
+    /// <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 Component 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.initialFrequencyLabel = new System.Windows.Forms.Label();
+      this.initialFrequencyTextBox = new System.Windows.Forms.TextBox();
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+      this.SuspendLayout();
+      // 
+      // nameTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      this.nameTextBox.Location = new System.Drawing.Point(117, 0);
+      this.nameTextBox.Size = new System.Drawing.Size(200, 20);
+      // 
+      // descriptionTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.descriptionTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.descriptionTextBox.Location = new System.Drawing.Point(117, 26);
+      this.descriptionTextBox.Size = new System.Drawing.Size(200, 20);
+      // 
+      // initialFrequencyLabel
+      // 
+      this.initialFrequencyLabel.AutoSize = true;
+      this.initialFrequencyLabel.Location = new System.Drawing.Point(6, 56);
+      this.initialFrequencyLabel.Name = "initialFrequencyLabel";
+      this.initialFrequencyLabel.Size = new System.Drawing.Size(84, 13);
+      this.initialFrequencyLabel.TabIndex = 4;
+      this.initialFrequencyLabel.Text = "Initial frequency:";
+      this.toolTip.SetToolTip(this.initialFrequencyLabel, "Relative frequency of the symbol in randomly created trees");
+      // 
+      // initialFrequencyTextBox
+      // 
+      this.initialFrequencyTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.initialFrequencyTextBox.Location = new System.Drawing.Point(117, 53);
+      this.initialFrequencyTextBox.Name = "initialFrequencyTextBox";
+      this.initialFrequencyTextBox.Size = new System.Drawing.Size(200, 20);
+      this.initialFrequencyTextBox.TabIndex = 5;
+      this.initialFrequencyTextBox.TextChanged += new System.EventHandler(this.initialFrequencyTextBox_TextChanged);
+      // 
+      // SymbolView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.initialFrequencyLabel);
+      this.Controls.Add(this.initialFrequencyTextBox);
+      this.Name = "SymbolView";
+      this.Size = new System.Drawing.Size(320, 79);
+      this.Controls.SetChildIndex(this.initialFrequencyTextBox, 0);
+      this.Controls.SetChildIndex(this.initialFrequencyLabel, 0);
+      this.Controls.SetChildIndex(this.nameLabel, 0);
+      this.Controls.SetChildIndex(this.descriptionLabel, 0);
+      this.Controls.SetChildIndex(this.nameTextBox, 0);
+      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    protected System.Windows.Forms.Label initialFrequencyLabel;
+    protected System.Windows.Forms.TextBox initialFrequencyTextBox;
+
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolView.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolView.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolView.cs	(revision 4803)
@@ -0,0 +1,92 @@
+﻿#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.Windows.Forms;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  [View("Symbol View")]
+  [Content(typeof(Symbol), false)]
+  public partial class SymbolView : NamedItemView {
+    public new Symbol Content {
+      get { return (Symbol)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public SymbolView() {
+      InitializeComponent();
+    }
+
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.Changed += new EventHandler(Content_Changed);
+    }
+
+    protected override void DeregisterContentEvents() {
+      base.DeregisterContentEvents();
+      Content.Changed -= new EventHandler(Content_Changed);
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      UpdateControl();
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      initialFrequencyTextBox.Enabled = Content != null;
+      initialFrequencyTextBox.ReadOnly = ReadOnly;
+    }
+
+    #region content event handlers
+    private void Content_Changed(object sender, EventArgs e) {
+      UpdateControl();
+    }
+    #endregion
+
+    #region control event handlers
+    private void initialFrequencyTextBox_TextChanged(object sender, EventArgs e) {
+      double freq;
+      if (double.TryParse(initialFrequencyTextBox.Text, out freq) && freq >= 0.0) {
+        Content.InitialFrequency = freq;
+        errorProvider.SetError(initialFrequencyTextBox, string.Empty);
+      } else {
+        errorProvider.SetError(initialFrequencyTextBox, "Invalid value");
+      }
+    }
+    #endregion
+
+    #region helpers
+    private void UpdateControl() {
+      if (Content == null) {
+        initialFrequencyTextBox.Text = string.Empty;
+      } else {
+        initialFrequencyTextBox.Text = Content.InitialFrequency.ToString();
+      }
+      SetEnabledStateOfControls();
+    }
+    #endregion
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.Designer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.Designer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.Designer.cs	(revision 4803)
@@ -0,0 +1,96 @@
+﻿#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
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  partial class SymbolicExpressionTreeChart {
+    /// <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 Component 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();
+      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
+      this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+      this.saveImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
+      this.contextMenuStrip.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // contextMenuStrip
+      // 
+      this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.saveImageToolStripMenuItem});
+      this.contextMenuStrip.Name = "contextMenuStrip";
+      this.contextMenuStrip.Size = new System.Drawing.Size(135, 26);
+      // 
+      // saveImageToolStripMenuItem
+      // 
+      this.saveImageToolStripMenuItem.Name = "saveImageToolStripMenuItem";
+      this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
+      this.saveImageToolStripMenuItem.Text = "Save Image";
+      this.saveImageToolStripMenuItem.Click += new System.EventHandler(this.saveImageToolStripMenuItem_Click);
+      // 
+      // saveFileDialog
+      // 
+      this.saveFileDialog.Filter = "Bitmap (*.bmp)|*.bmp|EMF (*.emf)|*.emf";
+      this.saveFileDialog.FilterIndex = 1;      
+      // SymbolicExpressionTreeChart
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.ContextMenuStrip = this.contextMenuStrip;
+      this.Name = "SymbolicExpressionTreeChart";
+      this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseClick);
+      this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseDoubleClick);
+      this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseDown);
+      this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseMove);
+      this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseUp);
+      this.contextMenuStrip.ResumeLayout(false);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.ToolTip toolTip;
+    private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
+    private System.Windows.Forms.ToolStripMenuItem saveImageToolStripMenuItem;
+    private System.Windows.Forms.SaveFileDialog saveFileDialog;
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.cs	(revision 4803)
@@ -0,0 +1,326 @@
+﻿#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.Drawing;
+using System.Drawing.Imaging;
+using System.Windows.Forms;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  public sealed partial class SymbolicExpressionTreeChart : UserControl {
+    private Image image;
+    private StringFormat stringFormat;
+    private Dictionary<SymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode> visualTreeNodes;
+
+    public SymbolicExpressionTreeChart() {
+      InitializeComponent();
+      this.image = new Bitmap(Width, Height);
+      this.stringFormat = new StringFormat();
+      this.stringFormat.Alignment = StringAlignment.Center;
+      this.stringFormat.LineAlignment = StringAlignment.Center;
+      this.spacing = 5;
+      this.lineColor = Color.Black;
+      this.backgroundColor = Color.White;
+      this.textFont = new Font("Times New Roman", 8);
+    }
+
+    public SymbolicExpressionTreeChart(SymbolicExpressionTree tree)
+      : this() {
+      this.Tree = tree;
+    }
+
+    private int spacing;
+    public int Spacing {
+      get { return this.spacing; }
+      set {
+        this.spacing = value;
+        this.Repaint();
+      }
+    }
+
+    private Color lineColor;
+    public Color LineColor {
+      get { return this.lineColor; }
+      set {
+        this.lineColor = value;
+        this.Repaint();
+      }
+    }
+
+    private Color backgroundColor;
+    public Color BackgroundColor {
+      get { return this.backgroundColor; }
+      set {
+        this.backgroundColor = value;
+        this.Repaint();
+      }
+    }
+
+    private Font textFont;
+    public Font TextFont {
+      get { return this.textFont; }
+      set {
+        this.textFont = value;
+        this.Repaint();
+      }
+    }
+
+    private SymbolicExpressionTree tree;
+    public SymbolicExpressionTree Tree {
+      get { return this.tree; }
+      set {
+        tree = value;
+        visualTreeNodes = new Dictionary<SymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode>();
+        if (tree != null) {
+          foreach (SymbolicExpressionTreeNode node in tree.IterateNodesPrefix())
+            visualTreeNodes[node] = new VisualSymbolicExpressionTreeNode(node);
+        }
+        Repaint();
+      }
+    }
+
+    protected override void OnPaint(PaintEventArgs e) {
+      base.OnPaint(e);
+      e.Graphics.DrawImage(image, 0, 0);
+    }
+    protected override void OnResize(EventArgs e) {
+      base.OnResize(e);
+      if (this.Width == 0 || this.Height == 0)
+        this.image = new Bitmap(1, 1);
+      else
+        this.image = new Bitmap(Width, Height);
+      this.Repaint();
+    }
+
+    public void Repaint() {
+      this.GenerateImage();
+      this.Refresh();
+    }
+
+    private void GenerateImage() {
+      using (Graphics graphics = Graphics.FromImage(image)) {
+        graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
+        graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
+        graphics.Clear(backgroundColor);
+        if (tree != null) {
+          int height = this.Height / tree.Height;
+          DrawFunctionTree(tree, graphics, 0, 0, this.Width, height);
+        }
+      }
+    }
+
+    public VisualSymbolicExpressionTreeNode GetVisualSymbolicExpressionTreeNode(SymbolicExpressionTreeNode symbolicExpressionTreeNode) {
+      if (visualTreeNodes.ContainsKey(symbolicExpressionTreeNode))
+        return visualTreeNodes[symbolicExpressionTreeNode];
+      return null;
+    }
+
+    #region events
+    public event MouseEventHandler SymbolicExpressionTreeNodeClicked;
+    private void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
+      var clicked = SymbolicExpressionTreeNodeClicked;
+      if (clicked != null)
+        clicked(sender, e);
+    }
+
+    private void SymbolicExpressionTreeChart_MouseClick(object sender, MouseEventArgs e) {
+      VisualSymbolicExpressionTreeNode visualTreeNode = FindVisualSymbolicExpressionTreeNodeAt(e.X, e.Y);
+      if (visualTreeNode != null)
+        OnSymbolicExpressionTreeNodeClicked(visualTreeNode, e);
+    }
+
+    public event MouseEventHandler SymbolicExpressionTreeNodeDoubleClicked;
+    private void OnSymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
+      var doubleClicked = SymbolicExpressionTreeNodeDoubleClicked;
+      if (doubleClicked != null)
+        doubleClicked(sender, e);
+    }
+
+    private void SymbolicExpressionTreeChart_MouseDoubleClick(object sender, MouseEventArgs e) {
+      VisualSymbolicExpressionTreeNode visualTreeNode = FindVisualSymbolicExpressionTreeNodeAt(e.X, e.Y);
+      if (visualTreeNode != null)
+        OnSymbolicExpressionTreeNodeDoubleClicked(visualTreeNode, e);
+    }
+
+    public event ItemDragEventHandler SymbolicExpressionTreeNodeDrag;
+    private void OnSymbolicExpressionTreeNodeDragDrag(object sender, ItemDragEventArgs e) {
+      var dragged = SymbolicExpressionTreeNodeDrag;
+      if (dragged != null)
+        dragged(sender, e);
+    }
+
+    private VisualSymbolicExpressionTreeNode draggedSymbolicExpressionTree;
+    private MouseButtons dragButtons;
+    private void SymbolicExpressionTreeChart_MouseDown(object sender, MouseEventArgs e) {
+      this.dragButtons = e.Button;
+      this.draggedSymbolicExpressionTree = FindVisualSymbolicExpressionTreeNodeAt(e.X, e.Y);
+    }
+    private void SymbolicExpressionTreeChart_MouseUp(object sender, MouseEventArgs e) {
+      this.draggedSymbolicExpressionTree = null;
+      this.dragButtons = MouseButtons.None;
+    }
+
+    private void SymbolicExpressionTreeChart_MouseMove(object sender, MouseEventArgs e) {
+      VisualSymbolicExpressionTreeNode visualTreeNode = FindVisualSymbolicExpressionTreeNodeAt(e.X, e.Y);
+      if (draggedSymbolicExpressionTree != null &&
+        draggedSymbolicExpressionTree != visualTreeNode) {
+        OnSymbolicExpressionTreeNodeDragDrag(draggedSymbolicExpressionTree, new ItemDragEventArgs(dragButtons, draggedSymbolicExpressionTree));
+        draggedSymbolicExpressionTree = null;
+      } else if (draggedSymbolicExpressionTree == null &&
+        visualTreeNode != null) {
+        string tooltipText = visualTreeNode.ToolTip;
+        if (this.toolTip.GetToolTip(this) != tooltipText)
+          this.toolTip.SetToolTip(this, tooltipText);
+
+      } else if (visualTreeNode == null)
+        this.toolTip.SetToolTip(this, "");
+    }
+
+    private VisualSymbolicExpressionTreeNode FindVisualSymbolicExpressionTreeNodeAt(int x, int y) {
+      foreach (var visualTreeNode in visualTreeNodes.Values) {
+        if (x >= visualTreeNode.X && x <= visualTreeNode.X + visualTreeNode.Width &&
+            y >= visualTreeNode.Y && y <= visualTreeNode.Y + visualTreeNode.Height)
+          return visualTreeNode;
+      }
+      return null;
+    }
+    #endregion
+
+    #region methods for painting the symbolic expression tree
+    private void DrawFunctionTree(SymbolicExpressionTree tree, Graphics graphics, int x, int y, int width, int height) {
+      DrawFunctionTree(tree.Root, graphics, x, y, width, height, Point.Empty);
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="functionTree"> functiontree to draw</param>
+    /// <param name="graphics">graphics object to draw on</param>
+    /// <param name="x">x coordinate of drawing area</param>
+    /// <param name="y">y coordinate of drawing area</param>
+    /// <param name="width">width of drawing area</param>
+    /// <param name="height">height of drawing area</param>
+    private void DrawFunctionTree(SymbolicExpressionTreeNode node, Graphics graphics, int x, int y, int width, int height, Point connectionPoint) {
+      VisualSymbolicExpressionTreeNode visualTreeNode = visualTreeNodes[node];
+      float center_x = x + width / 2;
+      float center_y = y + height / 2;
+      int actualWidth = width - spacing;
+      int actualHeight = height - spacing;
+
+      SolidBrush textBrush = new SolidBrush(visualTreeNode.TextColor);
+      Pen linePen = new Pen(this.lineColor);
+      Pen nodeLinePen = new Pen(visualTreeNode.LineColor);
+      SolidBrush nodeFillBrush = new SolidBrush(visualTreeNode.FillColor);
+
+      //calculate size of node
+      if (actualWidth >= visualTreeNode.PreferredWidth && actualHeight >= visualTreeNode.PreferredHeight) {
+        visualTreeNode.Width = visualTreeNode.PreferredWidth;
+        visualTreeNode.Height = visualTreeNode.PreferredHeight;
+        visualTreeNode.X = (int)center_x - visualTreeNode.Width / 2;
+        visualTreeNode.Y = (int)center_y - visualTreeNode.Height / 2;
+      }
+        //width too small to draw in desired sized
+      else if (actualWidth < visualTreeNode.PreferredWidth && actualHeight >= visualTreeNode.PreferredHeight) {
+        visualTreeNode.Width = actualWidth;
+        visualTreeNode.Height = visualTreeNode.PreferredHeight;
+        visualTreeNode.X = x;
+        visualTreeNode.Y = (int)center_y - visualTreeNode.Height / 2;
+      }
+        //height too small to draw in desired sized
+      else if (actualWidth >= visualTreeNode.PreferredWidth && actualHeight < visualTreeNode.PreferredHeight) {
+        visualTreeNode.Width = visualTreeNode.PreferredWidth;
+        visualTreeNode.Height = actualHeight;
+        visualTreeNode.X = (int)center_x - visualTreeNode.Width / 2;
+        visualTreeNode.Y = y;
+      }
+        //width and height too small to draw in desired size
+      else {
+        visualTreeNode.Width = actualWidth;
+        visualTreeNode.Height = actualHeight;
+        visualTreeNode.X = x;
+        visualTreeNode.Y = y;
+      }
+
+      //draw terminal node
+      if (node.SubTrees.Count == 0) {
+        graphics.FillRectangle(nodeFillBrush, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height);
+        graphics.DrawRectangle(nodeLinePen, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height);
+      } else {
+        graphics.FillEllipse(nodeFillBrush, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height);
+        graphics.DrawEllipse(nodeLinePen, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height);
+      }
+
+      //draw name of symbol
+      var text = node.ToString();
+      graphics.DrawString(text, textFont, textBrush, new RectangleF(visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height), stringFormat);
+
+      //draw connection line to parent node
+      if (!connectionPoint.IsEmpty)
+        graphics.DrawLine(linePen, connectionPoint, new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y));
+
+      //calculate areas for the subtrees according to their tree size and call drawFunctionTree
+      Point connectFrom = new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y + visualTreeNode.Height);
+      int[] xBoundaries = new int[node.SubTrees.Count + 1];
+      xBoundaries[0] = x;
+      for (int i = 0; i < node.SubTrees.Count; i++) {
+        xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)node.SubTrees[i].GetSize()) / (node.GetSize() - 1));
+        DrawFunctionTree(node.SubTrees[i], graphics, xBoundaries[i], y + height,
+          xBoundaries[i + 1] - xBoundaries[i], height, connectFrom);
+      }
+    }
+    #endregion
+
+    #region save image
+    private void saveImageToolStripMenuItem_Click(object sender, EventArgs e) {
+      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
+        string filename = saveFileDialog.FileName.ToLower();
+        if (filename.EndsWith("bmp")) SaveImageAsBitmap(filename);
+        else if (filename.EndsWith("emf")) SaveImageAsEmf(filename);
+        else SaveImageAsBitmap(filename);
+      }
+    }
+
+    private void SaveImageAsBitmap(string filename) {
+      if (tree == null) return;
+      Image image = new Bitmap(Width, Height);
+      using (Graphics g = Graphics.FromImage(image)) {
+        int height = this.Height / tree.Height;
+        DrawFunctionTree(tree, g, 0, 0, Width, height);
+      }
+      image.Save(filename);
+    }
+
+    private void SaveImageAsEmf(string filename) {
+      if (tree == null) return;
+      using (Graphics g = CreateGraphics()) {
+        using (Metafile file = new Metafile(filename, g.GetHdc())) {
+          using (Graphics emfFile = Graphics.FromImage(file)) {
+            int height = this.Height / tree.Height;
+            DrawFunctionTree(tree, emfFile, 0, 0, Width, height);
+          }
+        }
+        g.ReleaseHdc();
+      }
+    }
+    #endregion
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.Designer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.Designer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.Designer.cs	(revision 4803)
@@ -0,0 +1,74 @@
+﻿#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
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  partial class SymbolicExpressionView {
+    /// <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 Component 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.textBox = new System.Windows.Forms.TextBox();
+      this.SuspendLayout();
+      // 
+      // textBox
+      // 
+      this.textBox.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.textBox.Location = new System.Drawing.Point(0, 0);
+      this.textBox.Multiline = true;
+      this.textBox.Name = "textBox";
+      this.textBox.Size = new System.Drawing.Size(150, 150);
+      this.textBox.TabIndex = 0;
+      // 
+      // SymbolicExpressionTreeView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.textBox);
+      this.Name = "SymbolicExpressionTreeView";
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.TextBox textBox;
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionView.cs	(revision 4803)
@@ -0,0 +1,56 @@
+﻿#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.Windows.Forms;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  [View("SymbolicExpression View")]
+  [Content(typeof(SymbolicExpressionTree), false)]
+  public partial class SymbolicExpressionView : AsynchronousContentView {
+    private SymbolicExpressionTreeStringFormatter treeFormatter;
+
+    public new SymbolicExpressionTree Content {
+      get { return (SymbolicExpressionTree)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public SymbolicExpressionView() {
+      InitializeComponent();
+      treeFormatter = new SymbolicExpressionTreeStringFormatter();
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content == null)
+        textBox.Text = string.Empty;
+      else
+        textBox.Text = treeFormatter.Format(Content);
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      textBox.Enabled = Content != null;
+      textBox.ReadOnly = ReadOnly;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/VisualSymbolicExpressionTreeNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/VisualSymbolicExpressionTreeNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/VisualSymbolicExpressionTreeNode.cs	(revision 4803)
@@ -0,0 +1,125 @@
+﻿#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.Drawing;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
+  public class VisualSymbolicExpressionTreeNode {
+    private static readonly Color defaultLineColor = Color.Black;
+    private static readonly Color defaultTextColor = Color.Black;
+    private static readonly Color defaultFillColor = Color.White;
+    private const int defaultPreferredWidth = 70;
+    private const int defaultPreferredHeight = 46;
+
+    public VisualSymbolicExpressionTreeNode(SymbolicExpressionTreeNode symbolicExpressionTreeNode) :
+      this(symbolicExpressionTreeNode, defaultLineColor) {
+    }
+
+    public VisualSymbolicExpressionTreeNode(SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor) :
+      this(symbolicExpressionTreeNode, lineColor, defaultTextColor) {
+    }
+
+    public VisualSymbolicExpressionTreeNode(SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor) :
+      this(symbolicExpressionTreeNode, lineColor, textColor, defaultFillColor) {
+    }
+
+    public VisualSymbolicExpressionTreeNode(SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor) :
+      this(symbolicExpressionTreeNode, lineColor, textColor, fillColor, defaultPreferredWidth, defaultPreferredHeight) {
+    }
+
+    public VisualSymbolicExpressionTreeNode(SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor, int width, int height) {
+      this.symbolicExpressionTreeNode = symbolicExpressionTreeNode;
+      this.lineColor = lineColor;
+      this.textColor = textColor;
+      this.fillColor = fillColor;
+      this.preferredWidth = width;
+      this.preferredHeight = height;
+      this.ToolTip = symbolicExpressionTreeNode.ToString();
+    }
+
+    #region members for internal use only
+    private int x;
+    public int X {
+      get { return x; }
+      internal set { this.x = value; }
+    }
+
+    private int y;
+    public int Y {
+      get { return y; }
+      internal set { this.y = value; }
+    }
+
+    private int width;
+    public int Width {
+      get { return this.width; }
+      internal set { this.width = value; }
+    }
+
+    private int height;
+    public int Height {
+      get { return this.height; }
+      internal set { this.height = value; }
+    }
+    #endregion
+
+    private SymbolicExpressionTreeNode symbolicExpressionTreeNode;
+    public SymbolicExpressionTreeNode SymbolicExpressionTreeNode {
+      get { return this.symbolicExpressionTreeNode; }
+    }
+
+    private int preferredWidth;
+    public int PreferredWidth {
+      get { return this.preferredWidth; }
+      set { this.preferredWidth = value; }
+    }
+
+    private int preferredHeight;
+    public int PreferredHeight {
+      get { return this.preferredHeight; }
+      set { this.preferredHeight = value; }
+    }
+
+    private Color lineColor;
+    public Color LineColor {
+      get { return this.lineColor; }
+      set { this.lineColor = value; }
+    }
+
+    private Color textColor;
+    public Color TextColor {
+      get { return this.textColor; }
+      set { this.textColor = value; }
+    }
+
+    private Color fillColor;
+    public Color FillColor {
+      get { return this.fillColor; }
+      set { this.fillColor = value; }
+    }
+
+    private string toolTip;
+    public string ToolTip {
+      get { return toolTip; }
+      set { toolTip = value; }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAverageMaxSymbolicExpressionTreeSizeAnalyzer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAverageMaxSymbolicExpressionTreeSizeAnalyzer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAverageMaxSymbolicExpressionTreeSizeAnalyzer.cs	(revision 4803)
@@ -0,0 +1,130 @@
+#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.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers {
+  /// <summary>
+  /// An operator that tracks the min average and max tree size.
+  /// </summary>
+  [Item("MinAverageMaxSymbolicExpressionTreeSizeAnalyzer", "An operator that tracks the min avgerage and max tree size.")]
+  [StorableClass]
+  public sealed class MinAverageMaxSymbolicExpressionTreeSizeAnalyzer : AlgorithmOperator, ISymbolicExpressionTreeAnalyzer {
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string SymbolicExpressionTreeSizeParameterName = "SymbolicExpressionTreeSize";
+    private const string SymbolicExpressionTreeSizesParameterName = "Symbolic expression tree size";
+    private const string MinTreeSizeParameterName = "Min tree size";
+    private const string AverageTreeSizeParameterName = "Average tree size";
+    private const string MaxTreeSizeParameterName = "Max tree size";
+    private const string ResultsParameterName = "Results";
+
+    #region parameter properties
+    public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; }
+    }
+    public ValueLookupParameter<DataTable> SymbolicExpressionTreeSizesParameter {
+      get { return (ValueLookupParameter<DataTable>)Parameters[SymbolicExpressionTreeSizesParameterName]; }
+    }
+    public ValueLookupParameter<VariableCollection> ResultsParameter {
+      get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; }
+    }
+
+    [Storable]
+    private MinAverageMaxValueAnalyzer valueAnalyzer;
+    [Storable]
+    private UniformSubScopesProcessor subScopesProcessor;
+
+    #endregion
+    [StorableConstructor]
+    private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(bool deserializing) : base() { }
+    private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionTreeSizeAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+      AfterDeserialization();
+    }
+    public MinAverageMaxSymbolicExpressionTreeSizeAnalyzer()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose size should be calculated."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(SymbolicExpressionTreeSizeParameterName, "The tree size of the symbolic expression tree."));
+      Parameters.Add(new ValueLookupParameter<DataTable>(SymbolicExpressionTreeSizesParameterName, "The data table to store the tree sizes."));
+      Parameters.Add(new ValueLookupParameter<VariableCollection>(ResultsParameterName, "The results collection where the analysis values should be stored."));
+
+      subScopesProcessor = new UniformSubScopesProcessor();
+      SymbolicExpressionTreeSizeCalculator sizeCalculator = new SymbolicExpressionTreeSizeCalculator();
+      valueAnalyzer = new MinAverageMaxValueAnalyzer();
+
+      subScopesProcessor.Depth.Value = SymbolicExpressionTreeParameter.Depth;
+      sizeCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
+      sizeCalculator.SymbolicExpressionTreeSizeParameter.ActualName = SymbolicExpressionTreeSizeParameter.Name;
+      valueAnalyzer.ValueParameter.ActualName = sizeCalculator.SymbolicExpressionTreeSizeParameter.Name;
+      valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth;
+      valueAnalyzer.AverageValueParameter.ActualName = AverageTreeSizeParameterName;
+      valueAnalyzer.CollectAverageValueInResultsParameter.Value = new BoolValue(false);
+      valueAnalyzer.MaxValueParameter.ActualName = MaxTreeSizeParameterName;
+      valueAnalyzer.CollectMaxValueInResultsParameter.Value = new BoolValue(false);
+      valueAnalyzer.MinValueParameter.ActualName = MinTreeSizeParameterName;
+      valueAnalyzer.CollectMinValueInResultsParameter.Value = new BoolValue(false);
+      valueAnalyzer.ValuesParameter.ActualName = SymbolicExpressionTreeSizesParameter.Name;
+
+      OperatorGraph.InitialOperator = subScopesProcessor;
+      subScopesProcessor.Operator = sizeCalculator;
+      sizeCalculator.Successor = null;
+      subScopesProcessor.Successor = valueAnalyzer;
+      valueAnalyzer.Successor = null;
+
+      AfterDeserialization();
+    }
+
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged);
+      SymbolicExpressionTreeSizeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeSizeParameter_DepthChanged);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(this, cloner);
+    }
+
+    private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) {
+      OnDepthParameterChanged();
+    }
+
+    private void SymbolicExpressionTreeSizeParameter_DepthChanged(object sender, EventArgs e) {
+      OnDepthParameterChanged();
+    }
+
+    private void OnDepthParameterChanged() {
+      valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth;
+      subScopesProcessor.Depth.Value = SymbolicExpressionTreeParameter.Depth;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/SymbolicExpressionTreeSizeCalculator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/SymbolicExpressionTreeSizeCalculator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/SymbolicExpressionTreeSizeCalculator.cs	(revision 4803)
@@ -0,0 +1,77 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers {
+  /// <summary>
+  /// An operator that outputs the tree size of a symbolic expression tree.
+  /// </summary>
+  [Item("SymbolicExpressionTreeSizeCalculator", "An operator that outputs the tree size of a symbolic expression tree.")]
+  [StorableClass]
+  public sealed class SymbolicExpressionTreeSizeCalculator : SingleSuccessorOperator {
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string SymbolicExpressionTreeSizeParameterName = "SymbolicExpressionTreeSize";
+
+    #region parameter properties
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    public ILookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public SymbolicExpressionTree SymbolicExpressionTree {
+      get { return SymbolicExpressionTreeParameter.ActualValue; }
+    }
+    public DoubleValue SymbolicExpressionTreeSize {
+      get { return SymbolicExpressionTreeSizeParameter.ActualValue; }
+      set { SymbolicExpressionTreeSizeParameter.ActualValue = value; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private SymbolicExpressionTreeSizeCalculator(bool deserializing) : base(deserializing) { }
+    private SymbolicExpressionTreeSizeCalculator(SymbolicExpressionTreeSizeCalculator original, Cloner cloner) : base(original, cloner) { }
+    public SymbolicExpressionTreeSizeCalculator()
+      : base() {
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose size should be calculated."));
+      Parameters.Add(new LookupParameter<DoubleValue>(SymbolicExpressionTreeSizeParameterName, "The tree size of the symbolic expression tree."));
+    }
+
+    public override IOperation Apply() {
+      SymbolicExpressionTree tree = SymbolicExpressionTree;
+      SymbolicExpressionTreeSize = new DoubleValue(tree.Size);
+      return base.Apply();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeSizeCalculator(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentCreater.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentCreater.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentCreater.cs	(revision 4803)
@@ -0,0 +1,195 @@
+﻿#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// Creates a new argument within one function-defining branch of a symbolic expression tree.
+  /// As described in Koza, Bennett, Andre, Keane, Genetic Programming III - Darwinian Invention and Problem Solving, 1999, pp. 106
+  /// </summary>
+  [Item("ArgumentCreater", "Manipulates a symbolic expression by creating a new argument within one function-defining branch.")]
+  [StorableClass]
+  public sealed class ArgumentCreater : SymbolicExpressionTreeArchitectureManipulator {
+    [StorableConstructor]
+    private ArgumentCreater(bool deserializing) : base(deserializing) { }
+    private ArgumentCreater(ArgumentCreater original, Cloner cloner) : base(original, cloner) { }
+    public ArgumentCreater() : base() { }
+    public override sealed void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success) {
+      success = CreateNewArgument(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ArgumentCreater(this, cloner);
+    }
+
+    public static bool CreateNewArgument(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefiningBranches, int maxFunctionArguments) {
+      // work on a copy in case we find out later that the tree would be too big
+      // in this case it's easiest to simply return the original tree.
+      SymbolicExpressionTree clonedTree = (SymbolicExpressionTree)symbolicExpressionTree.Clone();
+
+      var functionDefiningBranches = clonedTree.IterateNodesPrefix().OfType<DefunTreeNode>();
+      if (functionDefiningBranches.Count() == 0)
+        // no function defining branch found => abort
+        return false;
+
+      // select a random function defining branch
+      var selectedDefunBranch = functionDefiningBranches.SelectRandom(random);
+      var definedArguments = (from symbol in selectedDefunBranch.Grammar.Symbols.OfType<Argument>()
+                              select symbol.ArgumentIndex).Distinct();
+      if (definedArguments.Count() >= maxFunctionArguments)
+        // max number of arguments reached => abort
+        return false;
+
+      var allowedArgumentIndexes = Enumerable.Range(0, maxFunctionArguments);
+      var newArgumentIndex = allowedArgumentIndexes.Except(definedArguments).First();
+      ArgumentTreeNode newArgumentNode = MakeArgumentNode(newArgumentIndex);
+
+      // this operation potentially creates very big trees so the access to the size property might throw overflow exception
+      try {
+        if (CreateNewArgumentForDefun(random, clonedTree, selectedDefunBranch, newArgumentNode) && clonedTree.Size < maxTreeSize && clonedTree.Height < maxTreeHeight) {
+
+          // size constraints are fulfilled 
+          // replace root of original tree with root of manipulated tree
+          symbolicExpressionTree.Root = clonedTree.Root;
+          return true;
+        } else {
+          // keep originalTree
+          return false;
+        }
+      }
+      catch (OverflowException) {
+        // keep original tree
+        return false;
+      }
+    }
+
+    private static bool CreateNewArgumentForDefun(IRandom random, SymbolicExpressionTree tree, DefunTreeNode defunBranch, ArgumentTreeNode newArgumentNode) {
+      // select a random cut point in the function defining branch
+      // the branch at the cut point is to be replaced by a new argument node
+      var cutPoints = (from node in defunBranch.IterateNodesPrefix()
+                       where node.SubTrees.Count > 0
+                       from subtree in node.SubTrees
+                       select new { Parent = node, ReplacedChildIndex = node.SubTrees.IndexOf(subtree), ReplacedChild = subtree }).ToList();
+
+      if (cutPoints.Count() == 0)
+        // no cut point found => abort;
+        return false;
+      var selectedCutPoint = cutPoints[random.Next(cutPoints.Count)];
+      // replace the branch at the cut point with an argument node
+      var replacedBranch = selectedCutPoint.ReplacedChild;
+      selectedCutPoint.Parent.RemoveSubTree(selectedCutPoint.ReplacedChildIndex);
+      selectedCutPoint.Parent.InsertSubTree(selectedCutPoint.ReplacedChildIndex, newArgumentNode);
+
+      // find all old invocations of the selected ADF and attach a cloned version of the replaced branch (with all argument-nodes expanded)
+      // iterate in post-fix order to make sure that the subtrees of n are already adapted when n is processed
+      var invocationNodes = (from node in tree.IterateNodesPostfix().OfType<InvokeFunctionTreeNode>()
+                             where node.Symbol.FunctionName == defunBranch.FunctionName
+                             where node.SubTrees.Count == defunBranch.NumberOfArguments
+                             select node).ToList();
+      // do this repeatedly until no matching invocations are found      
+      while (invocationNodes.Count > 0) {
+        List<SymbolicExpressionTreeNode> newlyAddedBranches = new List<SymbolicExpressionTreeNode>();
+        foreach (var invocationNode in invocationNodes) {
+          // check that the invocation node really has the correct number of arguments
+          if (invocationNode.SubTrees.Count != defunBranch.NumberOfArguments) throw new InvalidOperationException();
+          // append a new argument branch after expanding all argument nodes
+          var clonedBranch = (SymbolicExpressionTreeNode)replacedBranch.Clone();
+          clonedBranch = ReplaceArgumentsInBranch(clonedBranch, invocationNode.SubTrees);
+          invocationNode.InsertSubTree(newArgumentNode.Symbol.ArgumentIndex, clonedBranch);
+          newlyAddedBranches.Add(clonedBranch);
+        }
+        // iterate in post-fix order to make sure that the subtrees of n are already adapted when n is processed
+        invocationNodes = (from newlyAddedBranch in newlyAddedBranches
+                           from node in newlyAddedBranch.IterateNodesPostfix().OfType<InvokeFunctionTreeNode>()
+                           where node.Symbol.FunctionName == defunBranch.FunctionName
+                           where node.SubTrees.Count == defunBranch.NumberOfArguments
+                           select node).ToList();
+      }
+      // increase expected number of arguments of function defining branch
+      // it's possible that the number of actually referenced arguments was reduced (all references were replaced by a single new argument)
+      // but the number of expected arguments is increased anyway
+      defunBranch.NumberOfArguments++;
+      defunBranch.Grammar.AddSymbol(newArgumentNode.Symbol);
+      defunBranch.Grammar.SetMinSubtreeCount(newArgumentNode.Symbol, 0);
+      defunBranch.Grammar.SetMaxSubtreeCount(newArgumentNode.Symbol, 0);
+      // allow the argument as child of any other symbol
+      foreach (var symb in defunBranch.Grammar.Symbols)
+        for (int i = 0; i < defunBranch.Grammar.GetMaxSubtreeCount(symb); i++) {
+          defunBranch.Grammar.SetAllowedChild(symb, newArgumentNode.Symbol, i);
+        }
+      foreach (var subtree in tree.Root.SubTrees) {
+        // when the changed function is known in the branch then update the number of arguments
+        var matchingSymbol = subtree.Grammar.Symbols.OfType<InvokeFunction>().Where(s => s.FunctionName == defunBranch.FunctionName).SingleOrDefault();
+        if (matchingSymbol != null) {
+          subtree.Grammar.SetMinSubtreeCount(matchingSymbol, defunBranch.NumberOfArguments);
+          subtree.Grammar.SetMaxSubtreeCount(matchingSymbol, defunBranch.NumberOfArguments);
+          foreach (var child in subtree.GetAllowedSymbols(0)) {
+            for (int i = 0; i < subtree.Grammar.GetMaxSubtreeCount(matchingSymbol); i++) {
+              subtree.Grammar.SetAllowedChild(matchingSymbol, child, i);
+            }
+          }
+        }
+      }
+
+      return true;
+    }
+
+    private static SymbolicExpressionTreeNode ReplaceArgumentsInBranch(SymbolicExpressionTreeNode branch, IList<SymbolicExpressionTreeNode> argumentTrees) {
+      ArgumentTreeNode argNode = branch as ArgumentTreeNode;
+      if (argNode != null) {
+        // replace argument nodes by a clone of the original subtree that provided the result for the argument node
+        return (SymbolicExpressionTreeNode)argumentTrees[argNode.Symbol.ArgumentIndex].Clone();
+      } else {
+        // call recursively for all subtree
+        List<SymbolicExpressionTreeNode> subtrees = new List<SymbolicExpressionTreeNode>(branch.SubTrees);
+        while (branch.SubTrees.Count > 0) branch.RemoveSubTree(0);
+        foreach (var subtree in subtrees) {
+          branch.AddSubTree(ReplaceArgumentsInBranch(subtree, argumentTrees));
+        }
+        return branch;
+      }
+    }
+
+    private static ArgumentTreeNode MakeArgumentNode(int argIndex) {
+      var node = (ArgumentTreeNode)(new Argument(argIndex)).CreateTreeNode();
+      return node;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDeleter.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDeleter.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDeleter.cs	(revision 4803)
@@ -0,0 +1,113 @@
+﻿#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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// As described in Koza, Bennett, Andre, Keane, Genetic Programming III - Darwinian Invention and Problem Solving, 1999, pp. 112
+  /// </summary>
+  [Item("ArgumentDeleter", "Manipulates a symbolic expression by deleting an argument from an existing function defining branch.")]
+  [StorableClass]
+  public sealed class ArgumentDeleter : SymbolicExpressionTreeArchitectureManipulator {
+    [StorableConstructor]
+    private ArgumentDeleter(bool deserializing) : base(deserializing) { }
+    private ArgumentDeleter(ArgumentDeleter original, Cloner cloner) : base(original, cloner) { }
+    public ArgumentDeleter() : base() { }
+
+    public override sealed void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success) {
+      success = DeleteArgument(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ArgumentDeleter(this, cloner);
+    }
+
+    public static bool DeleteArgument(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefiningBranches, int maxFunctionArguments) {
+
+      var functionDefiningBranches = symbolicExpressionTree.IterateNodesPrefix().OfType<DefunTreeNode>();
+      if (functionDefiningBranches.Count() == 0)
+        // no function defining branch => abort
+        return false;
+      var selectedDefunBranch = functionDefiningBranches.SelectRandom(random);
+      if (selectedDefunBranch.NumberOfArguments <= 1)
+        // argument deletion by consolidation is not possible => abort
+        return false;
+      // the argument to be removed is always the one with the largest index 
+      // (otherwise we would have to decrement the index of the larger argument symbols)
+      var removedArgument = (from sym in selectedDefunBranch.Grammar.Symbols.OfType<Argument>()
+                             select sym.ArgumentIndex).Distinct().OrderBy(x => x).Last();
+      // find invocations of the manipulated funcion and remove the specified argument tree
+      var invocationNodes = (from node in symbolicExpressionTree.IterateNodesPrefix().OfType<InvokeFunctionTreeNode>()
+                             where node.Symbol.FunctionName == selectedDefunBranch.FunctionName
+                             select node).ToList();
+      foreach (var invokeNode in invocationNodes) {
+        invokeNode.RemoveSubTree(removedArgument);
+      }
+
+      DeleteArgumentByConsolidation(random, selectedDefunBranch, removedArgument);
+
+      // delete the dynamic argument symbol that matches the argument to be removed
+      var matchingSymbol = selectedDefunBranch.Grammar.Symbols.OfType<Argument>().Where(s => s.ArgumentIndex == removedArgument).Single();
+      selectedDefunBranch.Grammar.RemoveSymbol(matchingSymbol);
+      selectedDefunBranch.NumberOfArguments--;
+      // reduce arity in known functions of all root branches
+      foreach (var subtree in symbolicExpressionTree.Root.SubTrees) {
+        var matchingInvokeSymbol = subtree.Grammar.Symbols.OfType<InvokeFunction>().Where(s => s.FunctionName == selectedDefunBranch.FunctionName).SingleOrDefault();
+        if (matchingInvokeSymbol != null) {
+          subtree.Grammar.SetMinSubtreeCount(matchingInvokeSymbol, selectedDefunBranch.NumberOfArguments);
+          subtree.Grammar.SetMaxSubtreeCount(matchingInvokeSymbol, selectedDefunBranch.NumberOfArguments);
+        }
+      }
+      return true;
+    }
+
+    private static void DeleteArgumentByConsolidation(IRandom random, DefunTreeNode branch, int removedArgumentIndex) {
+      // replace references to the deleted argument with random references to existing arguments
+      var possibleArgumentSymbols = (from sym in branch.Grammar.Symbols.OfType<Argument>()
+                                     where sym.ArgumentIndex != removedArgumentIndex
+                                     select sym).ToList();
+      var argNodes = from node in branch.IterateNodesPrefix().OfType<ArgumentTreeNode>()
+                     where node.Symbol.ArgumentIndex == removedArgumentIndex
+                     select node;
+      foreach (var argNode in argNodes) {
+        var replacementSymbol = possibleArgumentSymbols.SelectRandom(random);
+        argNode.Symbol = replacementSymbol;
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDuplicater.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDuplicater.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/ArgumentDuplicater.cs	(revision 4803)
@@ -0,0 +1,142 @@
+﻿#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// Manipulates a symbolic expression by duplicating an existing argument node of a function-defining branch.
+  /// As described in Koza, Bennett, Andre, Keane, Genetic Programming III - Darwinian Invention and Problem Solving, 1999, pp. 94
+  /// </summary>
+  [Item("ArgumentDuplicater", "Manipulates a symbolic expression by duplicating an existing argument node of a function-defining branch.")]
+  [StorableClass]
+  public sealed class ArgumentDuplicater : SymbolicExpressionTreeArchitectureManipulator {
+    [StorableConstructor]
+    private ArgumentDuplicater(bool deserializing) : base(deserializing) { }
+    private ArgumentDuplicater(ArgumentDuplicater original, Cloner cloner) : base(original, cloner) { }
+    public ArgumentDuplicater() : base() { }
+
+    public override sealed void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success) {
+      success = DuplicateArgument(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ArgumentDuplicater(this, cloner);
+    }
+
+    public static bool DuplicateArgument(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefiningBranches, int maxFunctionArguments) {
+      var functionDefiningBranches = symbolicExpressionTree.IterateNodesPrefix().OfType<DefunTreeNode>();
+
+      var allowedArgumentIndexes = Enumerable.Range(0, maxFunctionArguments);
+      if (functionDefiningBranches.Count() == 0)
+        // no function defining branches => abort
+        return false;
+
+      var selectedDefunBranch = functionDefiningBranches.SelectRandom(random);
+      var argumentSymbols = selectedDefunBranch.Grammar.Symbols.OfType<Argument>();
+      if (argumentSymbols.Count() == 0 || argumentSymbols.Count() >= maxFunctionArguments)
+        // when no argument or number of arguments is already at max allowed value => abort
+        return false;
+      var selectedArgumentSymbol = argumentSymbols.SelectRandom(random);
+      var takenIndexes = argumentSymbols.Select(s => s.ArgumentIndex);
+      var newArgumentIndex = allowedArgumentIndexes.Except(takenIndexes).First();
+
+      var newArgSymbol = new Argument(newArgumentIndex);
+
+      // replace existing references to the original argument with references to the new argument randomly in the selectedBranch
+      var argumentNodes = selectedDefunBranch.IterateNodesPrefix().OfType<ArgumentTreeNode>();
+      foreach (var argNode in argumentNodes) {
+        if (argNode.Symbol == selectedArgumentSymbol) {
+          if (random.NextDouble() < 0.5) {
+            argNode.Symbol = newArgSymbol;
+          }
+        }
+      }
+      // find invocations of the functions and duplicate the matching argument branch
+      var invocationNodes = (from node in symbolicExpressionTree.IterateNodesPrefix().OfType<InvokeFunctionTreeNode>()
+                             where node.Symbol.FunctionName == selectedDefunBranch.FunctionName
+                             where node.SubTrees.Count == selectedDefunBranch.NumberOfArguments
+                             select node).ToList();
+      // do this repeatedly until no matching invocations are found      
+      while (invocationNodes.Count() > 0) {
+        List<SymbolicExpressionTreeNode> newlyAddedBranches = new List<SymbolicExpressionTreeNode>();
+        foreach (var invokeNode in invocationNodes) {
+          // check that the invocation node really has the correct number of arguments
+          if (invokeNode.SubTrees.Count != selectedDefunBranch.NumberOfArguments) throw new InvalidOperationException();
+          var argumentBranch = invokeNode.SubTrees[selectedArgumentSymbol.ArgumentIndex];
+          var clonedArgumentBranch = (SymbolicExpressionTreeNode)argumentBranch.Clone();
+          invokeNode.InsertSubTree(newArgumentIndex, clonedArgumentBranch);
+          newlyAddedBranches.Add(clonedArgumentBranch);
+        }
+        invocationNodes = (from newlyAddedBranch in newlyAddedBranches
+                           from node in newlyAddedBranch.IterateNodesPrefix().OfType<InvokeFunctionTreeNode>()
+                           where node.Symbol.FunctionName == selectedDefunBranch.FunctionName
+                           where node.SubTrees.Count == selectedDefunBranch.NumberOfArguments
+                           select node).ToList();
+      }
+      // register the new argument symbol and increase the number of arguments of the ADF
+      selectedDefunBranch.Grammar.AddSymbol(newArgSymbol);
+      selectedDefunBranch.Grammar.SetMinSubtreeCount(newArgSymbol, 0);
+      selectedDefunBranch.Grammar.SetMaxSubtreeCount(newArgSymbol, 0);
+      // allow the argument as child of any other symbol
+      foreach (var symb in selectedDefunBranch.Grammar.Symbols)
+        for (int i = 0; i < selectedDefunBranch.Grammar.GetMaxSubtreeCount(symb); i++) {
+          selectedDefunBranch.Grammar.SetAllowedChild(symb, newArgSymbol, i);
+        }
+      selectedDefunBranch.NumberOfArguments++;
+
+      // increase the arity of the changed ADF in all branches that can use this ADF
+      foreach (var subtree in symbolicExpressionTree.Root.SubTrees) {
+        var matchingInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
+                                    where symb.FunctionName == selectedDefunBranch.FunctionName
+                                    select symb).SingleOrDefault();
+        if (matchingInvokeSymbol != null) {
+          subtree.Grammar.SetMinSubtreeCount(matchingInvokeSymbol, selectedDefunBranch.NumberOfArguments);
+          subtree.Grammar.SetMaxSubtreeCount(matchingInvokeSymbol, selectedDefunBranch.NumberOfArguments);
+          foreach (var child in subtree.GetAllowedSymbols(0)) {
+            for (int i = 0; i < subtree.Grammar.GetMaxSubtreeCount(matchingInvokeSymbol); i++) {
+              subtree.Grammar.SetAllowedChild(matchingInvokeSymbol, child, i);
+            }
+          }
+        }
+      }
+      return true;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/GrammarModifier.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/GrammarModifier.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/GrammarModifier.cs	(revision 4803)
@@ -0,0 +1,69 @@
+﻿#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.Collections.Generic;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  public static class GrammarModifier {
+    public static void AddDynamicSymbol(ISymbolicExpressionGrammar grammar, Symbol classRepresentative, string symbolName, int nArgs) {
+      var invokeSym = new InvokeFunction(symbolName);
+      grammar.AddSymbol(invokeSym);
+      grammar.SetMinSubtreeCount(invokeSym, nArgs);
+      grammar.SetMaxSubtreeCount(invokeSym, nArgs);
+      SetSyntaxConstraints(grammar, classRepresentative, invokeSym);
+    }
+
+
+    public static void AddDynamicArguments(ISymbolicExpressionGrammar grammar, Symbol classRepresentative, IEnumerable<int> argumentIndexes) {
+      foreach (int argIndex in argumentIndexes) {
+        var argSymbol = new Argument(argIndex);
+        grammar.AddSymbol(argSymbol);
+        grammar.SetMinSubtreeCount(argSymbol, 0);
+        grammar.SetMaxSubtreeCount(argSymbol, 0);
+        SetSyntaxConstraints(grammar, classRepresentative, argSymbol);
+      }
+    }
+
+    private static void SetSyntaxConstraints(ISymbolicExpressionGrammar grammar, Symbol classRepresentative, Symbol newSymbol) {
+      // allow symbol as child of the representative first to make sure that the symbol 
+      // is in the list of parents and children
+      for (int i = 0; i < grammar.GetMaxSubtreeCount(classRepresentative); i++) {
+        grammar.SetAllowedChild(classRepresentative, newSymbol, i);
+      }
+      // for all available symbols add the new symbol as allowed child iff the available symbol is an allowed child of the class representative
+      foreach (var parent in grammar.Symbols) {
+        if (grammar.IsAllowedChild(classRepresentative, parent, 0))
+          for (int arg = 0; arg < grammar.GetMaxSubtreeCount(parent); arg++) {
+            grammar.SetAllowedChild(parent, newSymbol, arg);
+          }
+      }
+      // for all available symbols add the new symbol as allowed parent iff the available symbol is an allowed child of the class representative
+      foreach (var child in grammar.Symbols) {
+        if (grammar.IsAllowedChild(classRepresentative, child, 0))
+          for (int arg = 0; arg < grammar.GetMaxSubtreeCount(newSymbol); arg++) {
+            grammar.SetAllowedChild(newSymbol, child, arg);
+          }
+      }
+    }
+
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs	(revision 4803)
@@ -0,0 +1,134 @@
+﻿#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.Linq;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  [Item("MultiSymbolicExpressionTreeArchitectureManipulator", "Randomly selects and applies one of its architecture manipulators every time it is called.")]
+  [StorableClass]
+  public sealed class MultiSymbolicExpressionTreeArchitectureManipulator : StochasticMultiBranch<ISymbolicExpressionTreeArchitectureManipulator>, ISymbolicExpressionTreeArchitectureManipulator, IStochasticOperator {
+    private const string MaxTreeSizeParameterName = "MaxTreeSize";
+    private const string MaxTreeHeightParameterName = "MaxTreeHeight";
+    private const string SymbolicExpressionGrammarParameterName = "SymbolicExpressionGrammar";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string MaxFunctionArgumentsParameterName = "MaxFunctionArguments";
+    private const string MaxFunctionDefiningBranchesParameterName = "MaxFunctionDefiningBranches";
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    protected override bool CreateChildOperation {
+      get { return true; }
+    }
+    #region ISymbolicExpressionTreeArchitectureManipulator Members
+    public IValueLookupParameter<IntValue> MaxFunctionDefinitionsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxFunctionDefiningBranchesParameterName]; }
+    }
+    public IValueLookupParameter<IntValue> MaxFunctionArgumentsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxFunctionArgumentsParameterName]; }
+    }
+    #endregion
+
+    #region ISymbolicExpressionTreeManipulator Members
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    #endregion
+
+    #region ISymbolicExpressionTreeOperator Members
+    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]; }
+    }
+    #endregion
+
+
+    [StorableConstructor]
+    private MultiSymbolicExpressionTreeArchitectureManipulator(bool deserializing) : base(deserializing) { }
+    private MultiSymbolicExpressionTreeArchitectureManipulator(MultiSymbolicExpressionTreeArchitectureManipulator original, Cloner cloner) : base(original, cloner) { }
+    public MultiSymbolicExpressionTreeArchitectureManipulator()
+      : base() {
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxFunctionDefiningBranchesParameterName, "The maximal allowed number of function defining branches."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxFunctionArgumentsParameterName, "The maximal allowed number of arguments of a newly created function."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeSizeParameterName, "The maximal size (number of nodes) of the symbolic expression tree."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeHeightParameterName, "The maximal height of the symbolic expression tree (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."));
+
+      foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicExpressionTreeArchitectureManipulator))) {
+        if (!typeof(MultiOperator<ISymbolicExpressionTreeArchitectureManipulator>).IsAssignableFrom(type))
+          Operators.Add((ISymbolicExpressionTreeArchitectureManipulator)Activator.CreateInstance(type), true);
+      }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MultiSymbolicExpressionTreeArchitectureManipulator(this, cloner);
+    }
+
+    protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {
+      base.Operators_ItemsReplaced(sender, e);
+      ParameterizeManipulators();
+    }
+
+    protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {
+      base.Operators_ItemsAdded(sender, e);
+      ParameterizeManipulators();
+    }
+
+    private void ParameterizeManipulators() {
+      foreach (ISymbolicExpressionTreeArchitectureManipulator manipulator in Operators.OfType<ISymbolicExpressionTreeArchitectureManipulator>()) {
+        manipulator.MaxTreeSizeParameter.ActualName = MaxTreeSizeParameter.Name;
+        manipulator.MaxTreeHeightParameter.ActualName = MaxTreeHeightParameter.Name;
+        manipulator.SymbolicExpressionGrammarParameter.ActualName = SymbolicExpressionGrammarParameter.Name;
+        manipulator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
+        manipulator.MaxFunctionDefinitionsParameter.ActualName = MaxFunctionArgumentsParameter.Name;
+        manipulator.MaxFunctionArgumentsParameter.ActualName = MaxFunctionArgumentsParameter.Name;
+      }
+
+      foreach (IStochasticOperator manipulator in Operators.OfType<IStochasticOperator>()) {
+        manipulator.RandomParameter.ActualName = RandomParameter.Name;
+      }
+    }
+
+    #region ISymbolicExpressionTreeArchitectureManipulator Members
+    public void ModifyArchitecture(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments, out bool success) {
+      var op = Operators.SelectRandom(random);
+      op.ModifyArchitecture(random, symbolicExpressionTree, grammar, maxTreeSize, maxTreeHeight, maxFunctionDefiningBranches, maxFunctionArguments, out success);
+    }
+    #endregion
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineCreater.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineCreater.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineCreater.cs	(revision 4803)
@@ -0,0 +1,230 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// Manipulates a symbolic expression by adding one new function-defining branch containing
+  /// a proportion of a preexisting branch and by creating a reference to the new branch.
+  /// As described in Koza, Bennett, Andre, Keane, Genetic Programming III - Darwinian Invention and Problem Solving, 1999, pp. 97
+  /// </summary>
+  [Item("SubroutineCreater", "Manipulates a symbolic expression by adding one new function-defining branch containing a proportion of a preexisting branch and by creating a reference to the new branch.")]
+  [StorableClass]
+  public sealed class SubroutineCreater : SymbolicExpressionTreeArchitectureManipulator {
+    private const double ARGUMENT_CUTOFF_PROBABILITY = 0.05;
+
+    [StorableConstructor]
+    private SubroutineCreater(bool deserializing) : base(deserializing) { }
+    private SubroutineCreater(SubroutineCreater original, Cloner cloner) : base(original, cloner) { }
+    public SubroutineCreater() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SubroutineCreater(this, cloner);
+    }
+
+    public override sealed void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success) {
+      success = CreateSubroutine(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
+    }
+
+    public static bool CreateSubroutine(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefiningBranches, int maxFunctionArguments) {
+      var functionDefiningBranches = symbolicExpressionTree.IterateNodesPrefix().OfType<DefunTreeNode>();
+      if (functionDefiningBranches.Count() >= maxFunctionDefiningBranches)
+        // allowed maximum number of ADF reached => abort
+        return false;
+      if (symbolicExpressionTree.Size + 4 > maxTreeSize)
+        // defining a new function causes an size increase by 4 nodes (max) if the max tree size is reached => abort
+        return false;
+      string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefiningBranches * 10 - 1)).ToString(); // >= 100 functions => ###
+      var allowedFunctionNames = from index in Enumerable.Range(0, maxFunctionDefiningBranches)
+                                 select "ADF" + index.ToString(formatString);
+
+      // select a random body (either the result producing branch or an ADF branch)
+      var bodies = from node in symbolicExpressionTree.Root.SubTrees
+                   select new { Tree = node, Size = node.GetSize() };
+      var totalNumberOfBodyNodes = bodies.Select(x => x.Size).Sum();
+      int r = random.Next(totalNumberOfBodyNodes);
+      int aggregatedNumberOfBodyNodes = 0;
+      SymbolicExpressionTreeNode selectedBody = null;
+      foreach (var body in bodies) {
+        aggregatedNumberOfBodyNodes += body.Size;
+        if (aggregatedNumberOfBodyNodes > r)
+          selectedBody = body.Tree;
+      }
+      // sanity check
+      if (selectedBody == null) throw new InvalidOperationException();
+
+      // select a random cut point in the selected branch
+      var allCutPoints = from parent in selectedBody.IterateNodesPrefix()
+                         from subtree in parent.SubTrees
+                         select new { Parent = parent, ReplacedBranchIndex = parent.SubTrees.IndexOf(subtree), ReplacedBranch = subtree };
+      if (allCutPoints.Count() == 0)
+        // no cut points => abort
+        return false;
+      string newFunctionName = allowedFunctionNames.Except(functionDefiningBranches.Select(x => x.FunctionName)).First();
+      var selectedCutPoint = allCutPoints.SelectRandom(random);
+      // select random branches as argument cut-off points (replaced by argument terminal nodes in the function)
+      List<SymbolicExpressionTreeNode> argumentBranches = SelectRandomArgumentBranches(selectedCutPoint.ReplacedBranch, random, ARGUMENT_CUTOFF_PROBABILITY, maxFunctionArguments);
+      SymbolicExpressionTreeNode functionBody = selectedCutPoint.ReplacedBranch;
+      // disconnect the function body from the tree
+      selectedCutPoint.Parent.RemoveSubTree(selectedCutPoint.ReplacedBranchIndex);
+      // disconnect the argument branches from the function
+      functionBody = DisconnectBranches(functionBody, argumentBranches);
+      // insert a function invocation symbol instead
+      var invokeNode = (InvokeFunctionTreeNode)(new InvokeFunction(newFunctionName)).CreateTreeNode();
+      selectedCutPoint.Parent.InsertSubTree(selectedCutPoint.ReplacedBranchIndex, invokeNode);
+      // add the branches selected as argument as subtrees of the function invocation node
+      foreach (var argumentBranch in argumentBranches)
+        invokeNode.AddSubTree(argumentBranch);
+
+      // insert a new function defining branch
+      var defunNode = (DefunTreeNode)(new Defun()).CreateTreeNode();
+      defunNode.FunctionName = newFunctionName;
+      defunNode.AddSubTree(functionBody);
+      symbolicExpressionTree.Root.AddSubTree(defunNode);
+      // the grammar in the newly defined function is a clone of the grammar of the originating branch
+      defunNode.SetGrammar((ISymbolicExpressionGrammar)selectedBody.Grammar.Clone());
+      // remove all argument symbols from grammar
+      var oldArgumentSymbols = defunNode.Grammar.Symbols.OfType<Argument>().ToList();
+      foreach (var oldArgSymb in oldArgumentSymbols)
+        defunNode.Grammar.RemoveSymbol(oldArgSymb);
+      // find unique argument indexes and matching symbols in the function defining branch 
+      var newArgumentIndexes = (from node in defunNode.IterateNodesPrefix().OfType<ArgumentTreeNode>()
+                                select node.Symbol.ArgumentIndex).Distinct();
+      // add argument symbols to grammar of function defining branch
+      GrammarModifier.AddDynamicArguments(defunNode.Grammar, defunNode.Symbol, newArgumentIndexes);
+      defunNode.NumberOfArguments = newArgumentIndexes.Count();
+      if (defunNode.NumberOfArguments != argumentBranches.Count) throw new InvalidOperationException();
+      // add invoke symbol for newly defined function to the original branch 
+      var allowedParents = from symb in selectedBody.Grammar.Symbols
+                           where !(symb is ProgramRootSymbol)
+                           select symb;
+      var allowedChildren = from symb in selectedBody.Grammar.Symbols
+                            where selectedBody.Grammar.IsAllowedChild(selectedBody.Symbol, symb, 0)
+                            select symb;
+      GrammarModifier.AddDynamicSymbol(selectedBody.Grammar, selectedBody.Symbol, defunNode.FunctionName, defunNode.NumberOfArguments);
+
+      // when the new function body was taken from another function definition
+      // add invoke symbol for newly defined function to all branches that are allowed to invoke the original branch
+      if (selectedBody.Symbol is Defun) {
+        var originalFunctionDefinition = selectedBody as DefunTreeNode;
+        foreach (var subtree in symbolicExpressionTree.Root.SubTrees) {
+          var originalBranchInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
+                                            where symb.FunctionName == originalFunctionDefinition.FunctionName
+                                            select symb).SingleOrDefault();
+          // when the original branch can be invoked from the subtree then also allow invocation of the function
+          if (originalBranchInvokeSymbol != null) {
+            allowedParents = from symb in subtree.Grammar.Symbols
+                             where !(symb is ProgramRootSymbol)
+                             select symb;
+            allowedChildren = from symb in subtree.Grammar.Symbols
+                              where subtree.Grammar.IsAllowedChild(subtree.Symbol, symb, 0)
+                              select symb;
+            GrammarModifier.AddDynamicSymbol(subtree.Grammar, subtree.Symbol, defunNode.FunctionName, defunNode.NumberOfArguments);
+          }
+        }
+      }
+      return true;
+    }
+
+    private static SymbolicExpressionTreeNode DisconnectBranches(SymbolicExpressionTreeNode node, List<SymbolicExpressionTreeNode> argumentBranches) {
+      if (argumentBranches.Contains(node)) {
+        var argumentIndex = argumentBranches.IndexOf(node);
+        var argSymbol = new Argument(argumentIndex);
+        return argSymbol.CreateTreeNode();
+      }
+      // remove the subtrees so that we can clone only the root node
+      List<SymbolicExpressionTreeNode> subtrees = new List<SymbolicExpressionTreeNode>(node.SubTrees);
+      while (node.SubTrees.Count > 0) node.RemoveSubTree(0);
+      // recursively apply function for subtrees or append a argument terminal node
+      foreach (var subtree in subtrees) {
+        node.AddSubTree(DisconnectBranches(subtree, argumentBranches));
+      }
+      return node;
+    }
+
+    private static List<SymbolicExpressionTreeNode> SelectRandomArgumentBranches(SymbolicExpressionTreeNode selectedRoot,
+      IRandom random,
+      double cutProbability,
+      int maxArguments) {
+      // breadth first determination of argument cut-off points
+      // we must make sure that we cut off all original argument nodes and that the number of new argument is smaller than the limit
+      List<SymbolicExpressionTreeNode> argumentBranches = new List<SymbolicExpressionTreeNode>();
+      if (selectedRoot is ArgumentTreeNode) {
+        argumentBranches.Add(selectedRoot);
+        return argumentBranches;
+      } else {
+        // get the number of argument nodes (which must be cut-off) in the sub-trees
+        var numberOfArgumentsInSubtrees = (from subtree in selectedRoot.SubTrees
+                                           let nArgumentsInTree = subtree.IterateNodesPrefix().OfType<ArgumentTreeNode>().Count()
+                                           select nArgumentsInTree).ToList();
+        // determine the minimal number of new argument nodes for each sub-tree
+        var minNewArgumentsForSubtrees = numberOfArgumentsInSubtrees.Select(x => x > 0 ? 1 : 0).ToList();
+        if (minNewArgumentsForSubtrees.Sum() > maxArguments) {
+          argumentBranches.Add(selectedRoot);
+          return argumentBranches;
+        }
+        // cut-off in the sub-trees in random order
+        var randomIndexes = (from index in Enumerable.Range(0, selectedRoot.SubTrees.Count)
+                             select new { Index = index, OrderValue = random.NextDouble() }).OrderBy(x => x.OrderValue).Select(x => x.Index);
+        foreach (var subtreeIndex in randomIndexes) {
+          var subtree = selectedRoot.SubTrees[subtreeIndex];
+          minNewArgumentsForSubtrees[subtreeIndex] = 0;
+          // => cut-off at 0..n points somewhere in the current sub-tree
+          // determine the maximum number of new arguments that should be created in the branch
+          // as the maximum for the whole branch minus already added arguments minus minimal number of arguments still left
+          int maxArgumentsFromBranch = maxArguments - argumentBranches.Count - minNewArgumentsForSubtrees.Sum();
+          // when no argument is allowed from the current branch then we have to include the whole branch into the function
+          // otherwise: choose randomly wether to cut off immediately or wether to extend the function body into the branch
+          if (maxArgumentsFromBranch == 0) {
+            // don't cut at all => the whole sub-tree branch is included in the function body
+            // (we already checked ahead of time that there are no arguments left over in the subtree)
+          } else if (random.NextDouble() >= cutProbability) {
+            argumentBranches.AddRange(SelectRandomArgumentBranches(subtree, random, cutProbability, maxArgumentsFromBranch));
+          } else {
+            // cut-off at current sub-tree
+            argumentBranches.Add(subtree);
+          }
+        }
+        return argumentBranches;
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDeleter.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDeleter.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDeleter.cs	(revision 4803)
@@ -0,0 +1,121 @@
+﻿#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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// Manipulates a symbolic expression by deleting a preexisting function-defining branch.
+  /// As described in Koza, Bennett, Andre, Keane, Genetic Programming III - Darwinian Invention and Problem Solving, 1999, pp. 108
+  /// </summary>
+  [Item("SubroutineDeleter", "Manipulates a symbolic expression by deleting a preexisting function-defining branch.")]
+  [StorableClass]
+  public sealed class SubroutineDeleter : SymbolicExpressionTreeArchitectureManipulator {
+    [StorableConstructor]
+    private SubroutineDeleter(bool deserializing) : base(deserializing) { }
+    private SubroutineDeleter(SubroutineDeleter original, Cloner cloner) : base(original, cloner) { }
+    public SubroutineDeleter() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SubroutineDeleter(this, cloner);
+    }
+
+    public override sealed void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success) {
+      success = DeleteSubroutine(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
+    }
+
+    public static bool DeleteSubroutine(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefiningBranches, int maxFunctionArguments) {
+      var functionDefiningBranches = symbolicExpressionTree.IterateNodesPrefix().OfType<DefunTreeNode>();
+
+      if (functionDefiningBranches.Count() == 0)
+        // no ADF to delete => abort
+        return false;
+      var selectedDefunBranch = functionDefiningBranches.SelectRandom(random);
+      // remove the selected defun
+      int defunSubtreeIndex = symbolicExpressionTree.Root.SubTrees.IndexOf(selectedDefunBranch);
+      symbolicExpressionTree.Root.RemoveSubTree(defunSubtreeIndex);
+
+      // remove references to deleted function
+      foreach (var subtree in symbolicExpressionTree.Root.SubTrees.OfType<SymbolicExpressionTreeTopLevelNode>()) {
+        var matchingInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
+                                    where symb.FunctionName == selectedDefunBranch.FunctionName
+                                    select symb).SingleOrDefault();
+        if (matchingInvokeSymbol != null) {
+          subtree.Grammar.RemoveSymbol(matchingInvokeSymbol);
+        }
+      }
+
+      DeletionByRandomRegeneration(random, symbolicExpressionTree, selectedDefunBranch);
+      return true;
+    }
+
+    private static void DeletionByRandomRegeneration(IRandom random, SymbolicExpressionTree symbolicExpressionTree, DefunTreeNode selectedDefunBranch) {
+      // find first invocation and replace it with a randomly generated tree
+      // can't find all invocations in one step because once we replaced a top level invocation
+      // the invocations below it are removed already
+      var invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
+                                from subtree in node.SubTrees.OfType<InvokeFunctionTreeNode>()
+                                where subtree.Symbol.FunctionName == selectedDefunBranch.FunctionName
+                                select new { Parent = node, ReplacedChildIndex = node.SubTrees.IndexOf(subtree), ReplacedChild = subtree }).FirstOrDefault();
+      while (invocationCutPoint != null) {
+        // deletion by random regeneration
+        SymbolicExpressionTreeNode replacementTree = null;
+        // TODO: should weight symbols by tickets
+        var selectedSymbol = invocationCutPoint.Parent.GetAllowedSymbols(invocationCutPoint.ReplacedChildIndex).SelectRandom(random);
+
+        int minPossibleSize = invocationCutPoint.Parent.Grammar.GetMinExpressionLength(selectedSymbol);
+        int maxSize = Math.Max(minPossibleSize, invocationCutPoint.ReplacedChild.GetSize());
+        int minPossibleHeight = invocationCutPoint.Parent.Grammar.GetMinExpressionDepth(selectedSymbol);
+        int maxHeight = Math.Max(minPossibleHeight, invocationCutPoint.ReplacedChild.GetHeight());
+        replacementTree = selectedSymbol.CreateTreeNode();
+        if (replacementTree.HasLocalParameters)
+          replacementTree.ResetLocalParameters(random);
+        invocationCutPoint.Parent.RemoveSubTree(invocationCutPoint.ReplacedChildIndex);
+        invocationCutPoint.Parent.InsertSubTree(invocationCutPoint.ReplacedChildIndex, replacementTree);
+
+        ProbabilisticTreeCreator.PTC2(random, replacementTree, maxSize, maxHeight, 0, 0);
+
+        invocationCutPoint = (from node in symbolicExpressionTree.IterateNodesPrefix()
+                              from subtree in node.SubTrees.OfType<InvokeFunctionTreeNode>()
+                              where subtree.Symbol.FunctionName == selectedDefunBranch.FunctionName
+                              select new { Parent = node, ReplacedChildIndex = node.SubTrees.IndexOf(subtree), ReplacedChild = subtree }).FirstOrDefault();
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SubroutineDuplicater.cs	(revision 4803)
@@ -0,0 +1,113 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// Manipulates a symbolic expression by duplicating a preexisting function-defining branch.
+  /// As described in Koza, Bennett, Andre, Keane, Genetic Programming III - Darwinian Invention and Problem Solving, 1999, pp. 88
+  /// </summary>
+  [Item("SubroutineDuplicater", "Manipulates a symbolic expression by duplicating a preexisting function-defining branch.")]
+  [StorableClass]
+  public sealed class SubroutineDuplicater : SymbolicExpressionTreeArchitectureManipulator {
+    [StorableConstructor]
+    private SubroutineDuplicater(bool deserializing) : base(deserializing) { }
+    private SubroutineDuplicater(SubroutineDuplicater original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public SubroutineDuplicater() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SubroutineDuplicater(this, cloner);
+    }
+
+    public override sealed void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success) {
+      success = DuplicateSubroutine(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefiningBranches.Value, maxFunctionArguments.Value);
+    }
+
+    public static bool DuplicateSubroutine(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefiningBranches, int maxFunctionArguments) {
+      var functionDefiningBranches = symbolicExpressionTree.IterateNodesPrefix().OfType<DefunTreeNode>();
+      if (functionDefiningBranches.Count() == 0 || functionDefiningBranches.Count() == maxFunctionDefiningBranches)
+        // no function defining branches to duplicate or already reached the max number of ADFs
+        return false;
+
+      string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefiningBranches) + 1).ToString(); // >= 100 functions => ###
+      var allowedFunctionNames = from index in Enumerable.Range(0, maxFunctionDefiningBranches)
+                                 select "ADF" + index.ToString(formatString);
+      var selectedBranch = functionDefiningBranches.SelectRandom(random);
+      var duplicatedDefunBranch = (DefunTreeNode)selectedBranch.Clone();
+      string newFunctionName = allowedFunctionNames.Except(UsedFunctionNames(symbolicExpressionTree)).First();
+      duplicatedDefunBranch.FunctionName = newFunctionName;
+      symbolicExpressionTree.Root.AddSubTree(duplicatedDefunBranch);
+      duplicatedDefunBranch.SetGrammar((ISymbolicExpressionGrammar)selectedBranch.Grammar.Clone());
+      // add an invoke symbol for each branch that is allowed to invoke the original function
+      foreach (var subtree in symbolicExpressionTree.Root.SubTrees.OfType<SymbolicExpressionTreeTopLevelNode>()) {
+        var matchingInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
+                                    where symb.FunctionName == selectedBranch.FunctionName
+                                    select symb).SingleOrDefault();
+        if (matchingInvokeSymbol != null) {
+          GrammarModifier.AddDynamicSymbol(subtree.Grammar, subtree.Symbol, duplicatedDefunBranch.FunctionName, duplicatedDefunBranch.NumberOfArguments);
+        }
+        // in the current subtree:
+        // for all invoke nodes of the original function replace the invoke of the original function with an invoke of the new function randomly
+        var originalFunctionInvocations = from node in subtree.IterateNodesPrefix().OfType<InvokeFunctionTreeNode>()
+                                          where node.Symbol.FunctionName == selectedBranch.FunctionName
+                                          select node;
+        foreach (var originalFunctionInvokeNode in originalFunctionInvocations) {
+          var newInvokeSymbol = (from symb in subtree.Grammar.Symbols.OfType<InvokeFunction>()
+                                 where symb.FunctionName == duplicatedDefunBranch.FunctionName
+                                 select symb).Single();
+          // flip coin wether to replace with newly defined function
+          if (random.NextDouble() < 0.5) {
+            originalFunctionInvokeNode.Symbol = newInvokeSymbol;
+          }
+        }
+      }
+      return true;
+    }
+
+    private static IEnumerable<string> UsedFunctionNames(SymbolicExpressionTree symbolicExpressionTree) {
+      return from node in symbolicExpressionTree.IterateNodesPrefix()
+             where node.Symbol is Defun
+             select ((DefunTreeNode)node).FunctionName;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SymbolicExpressionTreeArchitectureManipulator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SymbolicExpressionTreeArchitectureManipulator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/SymbolicExpressionTreeArchitectureManipulator.cs	(revision 4803)
@@ -0,0 +1,78 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
+  /// <summary>
+  /// Base class for architecture altering operators for symbolic expression trees.
+  /// </summary>
+  [StorableClass]
+  public abstract class SymbolicExpressionTreeArchitectureManipulator : SymbolicExpressionTreeManipulator, ISymbolicExpressionTreeArchitectureManipulator {
+    private const string MaxFunctionArgumentsParameterName = "MaxFunctionArguments";
+    private const string MaxFunctionDefiningBranchesParameterName = "MaxFunctionDefiningBranches";
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    public IValueLookupParameter<IntValue> MaxFunctionDefinitionsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxFunctionDefiningBranchesParameterName]; }
+    }
+    public IValueLookupParameter<IntValue> MaxFunctionArgumentsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxFunctionArgumentsParameterName]; }
+    }
+    public IntValue MaxFunctionDefiningBranches {
+      get { return MaxFunctionDefinitionsParameter.ActualValue; }
+    }
+    public IntValue MaxFunctionArguments {
+      get { return MaxFunctionArgumentsParameter.ActualValue; }
+    }
+    [StorableConstructor]
+    protected SymbolicExpressionTreeArchitectureManipulator(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTreeArchitectureManipulator(SymbolicExpressionTreeArchitectureManipulator original, Cloner cloner) : base(original, cloner) { }
+    public SymbolicExpressionTreeArchitectureManipulator()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxFunctionDefiningBranchesParameterName, "The maximal allowed number of function defining branches."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxFunctionArgumentsParameterName, "The maximal allowed number of arguments of a newly created function."));
+    }
+
+    protected override sealed void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
+      ModifyArchitecture(random, symbolicExpressionTree, grammar, maxTreeSize, maxTreeHeight, MaxFunctionDefiningBranches, MaxFunctionArguments, out success);
+    }
+
+    public abstract void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree tree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize,
+      IntValue maxTreeHeight,
+      IntValue maxFunctionDefinitions,
+      IntValue maxFunctionArguments,
+      out bool success
+      );
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/Instruction.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/Instruction.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/Instruction.cs	(revision 4803)
@@ -0,0 +1,37 @@
+﻿#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
+
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Compiler {
+  // total size of this struct should be small to improve cache access while executing the code
+  // should be aligned to 8/16/32 byte
+  // size = 4(8) + 1 + 1 + 2 = 8 (12)
+  public struct Instruction {
+    // the tree node can hold additional data that is necessary for the execution of this instruction
+    public SymbolicExpressionTreeNode dynamicNode;
+    // op code of the function that determines what operation should be executed
+    public byte opCode;
+    // number of arguments of the current instruction
+    public byte nArguments;
+    // an optional short value (addresses for calls, argument index for arguments)
+    public ushort iArg0;
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/SymbolicExpressionTreeCompiler.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/SymbolicExpressionTreeCompiler.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Compiler/SymbolicExpressionTreeCompiler.cs	(revision 4803)
@@ -0,0 +1,89 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Compiler {
+  public class SymbolicExpressionTreeCompiler {
+    private Dictionary<string, ushort> entryPoint = new Dictionary<string, ushort>();
+    private List<Func<Instruction, Instruction>> postInstructionCompiledHooks = new List<Func<Instruction, Instruction>>();
+
+    public Instruction[] Compile(SymbolicExpressionTree tree, Func<SymbolicExpressionTreeNode, byte> opCodeMapper) {
+      List<Instruction> code = new List<Instruction>();
+      entryPoint.Clear();
+      // compile main body branches
+      foreach (var branch in tree.Root.SubTrees[0].SubTrees) {
+        code.AddRange(Compile(branch, opCodeMapper));
+      }
+      // compile function branches
+      var functionBranches = from node in tree.IterateNodesPrefix()
+                             where node.Symbol is Defun
+                             select node;
+      foreach (DefunTreeNode branch in functionBranches) {
+        if (code.Count > ushort.MaxValue) throw new ArgumentException("Code for the tree is too long (> ushort.MaxValue).");
+        entryPoint[branch.FunctionName] = (ushort)code.Count;
+        code.AddRange(Compile(branch.SubTrees[0], opCodeMapper));
+      }
+      // address of all functions is fixed now
+      // iterate through code again and fill in the jump locations
+      for (int i = 0; i < code.Count; i++) {
+        Instruction instr = code[i];
+        if (instr.dynamicNode.Symbol is InvokeFunction) {
+          var invokeNode = (InvokeFunctionTreeNode)instr.dynamicNode;
+          instr.iArg0 = entryPoint[invokeNode.Symbol.FunctionName];
+          code[i] = instr;
+        }
+      }
+
+      return code.ToArray();
+    }
+
+    private IEnumerable<Instruction> Compile(SymbolicExpressionTreeNode branch, Func<SymbolicExpressionTreeNode, byte> opCodeMapper) {
+      foreach (var node in branch.IterateNodesPrefix()) {
+        Instruction instr = new Instruction();
+        if (node.SubTrees.Count > 255) throw new ArgumentException("Number of subtrees is too big (>255)");
+        instr.nArguments = (byte)node.SubTrees.Count;
+        instr.opCode = opCodeMapper(node);
+        if (node.Symbol is Argument) {
+          var argNode = (ArgumentTreeNode)node;
+          instr.iArg0 = (ushort)argNode.Symbol.ArgumentIndex;
+        }
+        instr.dynamicNode = node;
+        foreach (var hook in postInstructionCompiledHooks) {
+          instr = hook(instr);
+        }
+        yield return instr;
+      }
+    }
+
+    /// <summary>
+    /// Adds a function that will be called every time an instruction is compiled.
+    /// The compiled will insert the instruction returned by the hook into the code.
+    /// </summary>
+    /// <param name="hook">The hook that should be called for each compiled instruction.</param>
+    public void AddInstructionPostProcessingHook(Func<Instruction, Instruction> hook) {
+      postInstructionCompiledHooks.Add(hook);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs	(revision 4803)
@@ -0,0 +1,284 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators {
+  [StorableClass]
+  [Item("ProbabilisticTreeCreator", "An operator that creates new symbolic expression trees with uniformly distributed size")]
+  public sealed class ProbabilisticTreeCreator : SymbolicExpressionTreeCreator {
+    private const int MAX_TRIES = 100;
+    [StorableConstructor]
+    private ProbabilisticTreeCreator(bool deserializing) : base(deserializing) { }
+    private ProbabilisticTreeCreator(ProbabilisticTreeCreator original, Cloner cloner) : base(original, cloner) { }
+    public ProbabilisticTreeCreator() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ProbabilisticTreeCreator(this, cloner);
+    }
+
+    protected override SymbolicExpressionTree Create(
+      IRandom random,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefinitions, IntValue maxFunctionArguments) {
+      return Create(random, grammar, maxTreeSize.Value, maxTreeHeight.Value, maxFunctionDefinitions.Value, maxFunctionArguments.Value);
+    }
+
+    public static SymbolicExpressionTree Create(IRandom random, ISymbolicExpressionGrammar grammar,
+      int maxTreeSize, int maxTreeHeight,
+      int maxFunctionDefinitions, int maxFunctionArguments
+      ) {
+      SymbolicExpressionTree tree = new SymbolicExpressionTree();
+      var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
+      if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random);
+      rootNode.SetGrammar(new SymbolicExpressionTreeGrammar(grammar));
+      tree.Root = PTC2(random, rootNode, maxTreeSize, maxTreeHeight, maxFunctionDefinitions, maxFunctionArguments);
+      return tree;
+    }
+
+    private class TreeExtensionPoint {
+      public SymbolicExpressionTreeNode Parent { get; set; }
+      public int ChildIndex { get; set; }
+      public int ExtensionPointDepth { get; set; }
+    }
+
+    public static SymbolicExpressionTreeNode PTC2(IRandom random, SymbolicExpressionTreeNode seedNode,
+      int maxTreeSize, int maxDepth, int maxFunctionDefinitions, int maxFunctionArguments) {
+      // tree size is limited by the grammar and by the explicit size constraints
+      int allowedMinSize = seedNode.Grammar.GetMinExpressionLength(seedNode.Symbol);
+      int allowedMaxSize = Math.Min(maxTreeSize, seedNode.Grammar.GetMaxExpressionLength(seedNode.Symbol));
+      int tries = 0;
+      while (tries++ < MAX_TRIES) {
+        // 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 + 1);
+        if (treeSize <= 1 || maxDepth <= 1) return seedNode;
+
+        bool success = CreateFullTreeFromSeed(random, seedNode, seedNode.Grammar, treeSize, maxDepth, maxFunctionDefinitions, maxFunctionArguments);
+
+        // if successful => check constraints and return the tree if everything looks ok        
+        if (success && seedNode.GetSize() <= maxTreeSize && seedNode.GetHeight() <= maxDepth) {
+          return seedNode;
+        } else {
+          // clean seedNode
+          while (seedNode.SubTrees.Count > 0) seedNode.RemoveSubTree(0);
+        }
+        // try a different size MAX_TRIES times
+      }
+      throw new ArgumentException("Couldn't create a random valid tree.");
+    }
+
+    private static bool CreateFullTreeFromSeed(IRandom random, SymbolicExpressionTreeNode root, ISymbolicExpressionGrammar globalGrammar,
+      int size, int maxDepth, int maxFunctionDefinitions, int maxFunctionArguments) {
+      try {
+        TryCreateFullTreeFromSeed(random, root, globalGrammar, size, maxDepth, maxFunctionDefinitions, maxFunctionArguments);
+        return true;
+      }
+      catch (ArgumentException) { return false; }
+    }
+
+    private static void TryCreateFullTreeFromSeed(IRandom random, SymbolicExpressionTreeNode root, ISymbolicExpressionGrammar globalGrammar,
+      int size, int maxDepth, int maxFunctionDefinitions, int maxFunctionArguments) {
+      List<TreeExtensionPoint> extensionPoints = new List<TreeExtensionPoint>();
+      int currentSize = 1;
+      int totalListMinSize = globalGrammar.GetMinExpressionLength(root.Symbol) - 1;
+      int actualArity = SampleArity(random, root, size);
+      for (int i = 0; i < actualArity; i++) {
+        // insert a dummy sub-tree and add the pending extension to the list
+        var dummy = new SymbolicExpressionTreeNode();
+        root.AddSubTree(dummy);
+        extensionPoints.Add(new TreeExtensionPoint { Parent = root, ChildIndex = i, ExtensionPointDepth = 0 });
+      }
+      // while there are pending extension points and we have not reached the limit of adding new extension points
+      while (extensionPoints.Count > 0 && totalListMinSize + currentSize < size) {
+        int randomIndex = random.Next(extensionPoints.Count);
+        TreeExtensionPoint nextExtension = extensionPoints[randomIndex];
+        extensionPoints.RemoveAt(randomIndex);
+        SymbolicExpressionTreeNode parent = nextExtension.Parent;
+        int argumentIndex = nextExtension.ChildIndex;
+        int extensionDepth = nextExtension.ExtensionPointDepth;
+        if (extensionDepth + parent.Grammar.GetMinExpressionDepth(parent.Symbol) >= maxDepth) {
+          ReplaceWithMinimalTree(random, root, parent, argumentIndex, maxFunctionDefinitions, maxFunctionArguments);
+        } else {
+          var allowedSymbols = from s in parent.Grammar.Symbols
+                               where parent.Grammar.IsAllowedChild(parent.Symbol, s, argumentIndex)
+                               where parent.Grammar.GetMinExpressionDepth(s) + extensionDepth - 1 < maxDepth
+                               where parent.Grammar.GetMaxExpressionLength(s) > size - totalListMinSize - currentSize
+                               select s;
+          Symbol selectedSymbol = SelectRandomSymbol(random, allowedSymbols);
+          SymbolicExpressionTreeNode newTree = selectedSymbol.CreateTreeNode();
+          if (newTree.HasLocalParameters) newTree.ResetLocalParameters(random);
+          parent.RemoveSubTree(argumentIndex);
+          parent.InsertSubTree(argumentIndex, newTree);
+
+          InitializeNewTreeNode(random, root, newTree, maxFunctionDefinitions, maxFunctionArguments);
+
+          currentSize++;
+          totalListMinSize--;
+
+          actualArity = SampleArity(random, newTree, size - currentSize);
+          for (int i = 0; i < actualArity; i++) {
+            // insert a dummy sub-tree and add the pending extension to the list
+            var dummy = new SymbolicExpressionTreeNode();
+            newTree.AddSubTree(dummy);
+            extensionPoints.Add(new TreeExtensionPoint { Parent = newTree, ChildIndex = i, ExtensionPointDepth = extensionDepth + 1 });
+          }
+          totalListMinSize += newTree.Grammar.GetMinExpressionLength(newTree.Symbol);
+        }
+      }
+      // fill all pending extension points
+      while (extensionPoints.Count > 0) {
+        int randomIndex = random.Next(extensionPoints.Count);
+        TreeExtensionPoint nextExtension = extensionPoints[randomIndex];
+        extensionPoints.RemoveAt(randomIndex);
+        SymbolicExpressionTreeNode parent = nextExtension.Parent;
+        int a = nextExtension.ChildIndex;
+        int d = nextExtension.ExtensionPointDepth;
+        ReplaceWithMinimalTree(random, root, parent, a, maxFunctionDefinitions, maxFunctionArguments);
+      }
+    }
+
+    private static void ReplaceWithMinimalTree(IRandom random, SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode parent, int argumentIndex, int maxFunctionDefinitions, int maxFunctionArguments) {
+      // determine possible symbols that will lead to the smallest possible tree
+      var possibleSymbols = (from s in parent.GetAllowedSymbols(argumentIndex)
+                             group s by parent.Grammar.GetMinExpressionLength(s) into g
+                             orderby g.Key
+                             select g).First();
+      var selectedSymbol = SelectRandomSymbol(random, possibleSymbols);
+      var tree = selectedSymbol.CreateTreeNode();
+      if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
+      parent.RemoveSubTree(argumentIndex);
+      parent.InsertSubTree(argumentIndex, tree);
+      InitializeNewTreeNode(random, root, tree, maxFunctionDefinitions, maxFunctionArguments);
+      for (int i = 0; i < tree.GetMinSubtreeCount(); i++) {
+        // insert a dummy sub-tree and add the pending extension to the list
+        var dummy = new SymbolicExpressionTreeNode();
+        tree.AddSubTree(dummy);
+        // replace the just inserted dummy by recursive application
+        ReplaceWithMinimalTree(random, root, tree, i, maxFunctionDefinitions, maxFunctionArguments);
+      }
+    }
+
+    private static void InitializeNewTreeNode(IRandom random, SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode newTree, int maxFunctionDefinitions, int maxFunctionArguments) {
+      // NB it is assumed that defuns are only allowed as children of root and nowhere else
+      // also assumes that newTree is already attached to root somewhere
+      if (IsTopLevelBranch(root, newTree)) {
+        ((SymbolicExpressionTreeTopLevelNode)newTree).SetGrammar((ISymbolicExpressionGrammar)root.Grammar.Clone());
+
+        // allow invokes of existing ADFs with higher index
+        int argIndex = root.SubTrees.IndexOf(newTree);
+        for (int i = argIndex + 1; i < root.SubTrees.Count; i++) {
+          var otherDefunNode = root.SubTrees[i] as DefunTreeNode;
+          if (otherDefunNode != null) {
+            GrammarModifier.AddDynamicSymbol(newTree.Grammar, newTree.Symbol, otherDefunNode.FunctionName, otherDefunNode.NumberOfArguments);
+          }
+        }
+      }
+      if (newTree.Symbol is Defun) {
+        var defunTree = newTree as DefunTreeNode;
+        string formatString = new StringBuilder().Append('0', (int)Math.Log10(maxFunctionDefinitions * 10 - 1)).ToString(); // >= 100 functions => ###
+        var allowedNames = from index in Enumerable.Range(0, maxFunctionDefinitions)
+                           select "ADF" + index.ToString(formatString);
+        var takenNames = (from node in root.IterateNodesPrefix().OfType<DefunTreeNode>()
+                          select node.FunctionName).Distinct();
+        var remainingNames = allowedNames.Except(takenNames).ToList();
+        string functionName = remainingNames[random.Next(remainingNames.Count)];
+        // set name and number of arguments of the ADF
+        int nArgs = random.Next(maxFunctionArguments);
+        defunTree.FunctionName = functionName;
+        defunTree.NumberOfArguments = nArgs;
+        if (nArgs > 0) {
+          GrammarModifier.AddDynamicArguments(defunTree.Grammar, defunTree.Symbol, Enumerable.Range(0, nArgs));
+        }
+        // in existing branches with smaller index allow invoke of current function
+        int argIndex = root.SubTrees.IndexOf(newTree);
+        for (int i = 0; i < argIndex; i++) {
+          // if not dummy node
+          if (root.SubTrees[i].Symbol != null) {
+            var existingBranch = root.SubTrees[i];
+            GrammarModifier.AddDynamicSymbol(existingBranch.Grammar, existingBranch.Symbol, functionName, nArgs);
+          }
+        }
+      }
+    }
+
+    private static bool IsTopLevelBranch(SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode branch) {
+      return branch is SymbolicExpressionTreeTopLevelNode;
+    }
+
+    private static Symbol SelectRandomSymbol(IRandom random, IEnumerable<Symbol> symbols) {
+      var symbolList = symbols.ToList();
+      var ticketsSum = symbolList.Select(x => x.InitialFrequency).Sum();
+      if (ticketsSum == 0.0) throw new ArgumentException("The initial frequency of all allowed symbols is zero.");
+      var r = random.NextDouble() * ticketsSum;
+      double aggregatedTickets = 0;
+      for (int i = 0; i < symbolList.Count; i++) {
+        aggregatedTickets += symbolList[i].InitialFrequency;
+        if (aggregatedTickets > r) {
+          return symbolList[i];
+        }
+      }
+      // this should never happen
+      throw new ArgumentException("There is a problem with the initial frequency setting of allowed symbols.");
+    }
+
+    private static int SampleArity(IRandom random, SymbolicExpressionTreeNode node, int targetSize) {
+      // select actualArity randomly with the constraint that the sub-trees in the minimal arity can become large enough
+      int minArity = node.GetMinSubtreeCount();
+      int maxArity = node.GetMaxSubtreeCount();
+      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
+      long aggregatedLongestExpressionLength = 0;
+      for (int i = 0; i < maxArity; i++) {
+        aggregatedLongestExpressionLength += (from s in node.GetAllowedSymbols(i)
+                                              select node.Grammar.GetMaxExpressionLength(s)).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
+      long aggregatedShortestExpressionLength = 0;
+      for (int i = 0; i < maxArity; i++) {
+        aggregatedShortestExpressionLength += (from s in node.GetAllowedSymbols(i)
+                                               select node.Grammar.GetMinExpressionLength(s)).Min();
+        if (aggregatedShortestExpressionLength > targetSize) {
+          maxArity = i;
+          break;
+        }
+      }
+      if (minArity > maxArity) throw new ArgumentException();
+      return random.Next(minArity, maxArity + 1);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/SymbolicExpressionTreeCreator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/SymbolicExpressionTreeCreator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/SymbolicExpressionTreeCreator.cs	(revision 4803)
@@ -0,0 +1,87 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators {
+  /// <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 : SymbolicExpressionTreeOperator, ISymbolicExpressionTreeCreator {
+    private const string MaxFunctionDefinitionsParameterName = "MaxFunctionDefinitions";
+    private const string MaxFunctionArgumentsParameterName = "MaxFunctionArguments";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    #region Parameter Properties
+    public IValueLookupParameter<IntValue> MaxFunctionDefinitionsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxFunctionDefinitionsParameterName]; }
+    }
+    public IValueLookupParameter<IntValue> MaxFunctionArgumentsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters[MaxFunctionArgumentsParameterName]; }
+    }
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    #endregion
+
+    #region Propeties
+    public IntValue MaxFunctionDefinitions {
+      get { return MaxFunctionDefinitionsParameter.ActualValue; }
+    }
+    public IntValue MaxFunctionArguments {
+      get { return MaxFunctionArgumentsParameter.ActualValue; }
+    }
+    public SymbolicExpressionTree SymbolicExpressionTree {
+      get { return SymbolicExpressionTreeParameter.ActualValue; }
+      set { SymbolicExpressionTreeParameter.ActualValue = value; }
+    }
+
+    #endregion
+    [StorableConstructor]
+    protected SymbolicExpressionTreeCreator(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTreeCreator(SymbolicExpressionTreeCreator original, Cloner cloner) : base(original, cloner) { }
+    protected SymbolicExpressionTreeCreator()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxFunctionDefinitionsParameterName, "Maximal number of function definitions in the symbolic expression tree."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxFunctionArgumentsParameterName, "Maximal number of arguments of automatically defined functions in the symbolic expression tree."));
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree that should be created."));
+    }
+
+    public sealed override IOperation Apply() {
+      SymbolicExpressionTree = Create(Random, SymbolicExpressionGrammar,
+        MaxTreeSize, MaxTreeHeight, MaxFunctionDefinitions, MaxFunctionArguments);
+      return base.Apply();
+    }
+
+    protected abstract SymbolicExpressionTree Create(
+      IRandom random,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefinitions, IntValue maxFunctionArguments
+      );
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/CrossoverPoint.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/CrossoverPoint.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/CrossoverPoint.cs	(revision 4803)
@@ -0,0 +1,35 @@
+#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
+
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers {
+  public class CrossoverPoint {
+    public SymbolicExpressionTreeNode Parent { get; set; }
+    public SymbolicExpressionTreeNode Child { get; set; }
+    public int SubtreeIndex {
+      get { return Parent.SubTrees.IndexOf(Child); }
+    }
+    public CrossoverPoint(SymbolicExpressionTreeNode parent, SymbolicExpressionTreeNode child) {
+      this.Parent = parent;
+      this.Child = child;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SubtreeCrossover.cs	(revision 4803)
@@ -0,0 +1,201 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers {
+  /// <summary>
+  /// 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.
+  /// </summary>  
+  [Item("SubtreeCrossover", "An operator which performs subtree swapping crossover.")]
+  [StorableClass]
+  public sealed class SubtreeCrossover : SymbolicExpressionTreeCrossover {
+    public IValueLookupParameter<PercentValue> InternalCrossoverPointProbabilityParameter {
+      get { return (IValueLookupParameter<PercentValue>)Parameters["InternalCrossoverPointProbability"]; }
+    }
+    [StorableConstructor]
+    private SubtreeCrossover(bool deserializing) : base(deserializing) { }
+    private SubtreeCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { }
+    public SubtreeCrossover()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<PercentValue>("InternalCrossoverPointProbability", "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SubtreeCrossover(this, cloner);
+    }
+
+    protected override SymbolicExpressionTree Cross(IRandom random,
+      SymbolicExpressionTree parent0, SymbolicExpressionTree parent1,
+      IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
+      return Cross(random, parent0, parent1, InternalCrossoverPointProbabilityParameter.ActualValue.Value, maxTreeSize.Value, maxTreeHeight.Value, out success);
+    }
+
+    public static SymbolicExpressionTree Cross(IRandom random,
+      SymbolicExpressionTree parent0, SymbolicExpressionTree parent1,
+      double internalCrossoverPointProbability, int maxTreeSize, int maxTreeHeight, out bool success) {
+      // select a random crossover point in the first parent 
+      SymbolicExpressionTreeNode crossoverPoint0;
+      int replacedSubtreeIndex;
+      SelectCrossoverPoint(random, parent0, internalCrossoverPointProbability, maxTreeSize - 1, maxTreeHeight - 1, out crossoverPoint0, out replacedSubtreeIndex);
+
+      // calculate the max size and height that the inserted branch can have 
+      int maxInsertedBranchSize = maxTreeSize - (parent0.Size - crossoverPoint0.SubTrees[replacedSubtreeIndex].GetSize());
+      int maxInsertedBranchHeight = maxTreeHeight - GetBranchLevel(parent0.Root, crossoverPoint0);
+
+      List<SymbolicExpressionTreeNode> allowedBranches = new List<SymbolicExpressionTreeNode>();
+      parent1.Root.ForEachNodePostfix((n) => {
+        if (n.GetSize() < maxInsertedBranchSize &&
+          n.GetHeight() < maxInsertedBranchHeight &&
+          IsMatchingPointType(crossoverPoint0, replacedSubtreeIndex, n))
+          allowedBranches.Add(n);
+      });
+
+      if (allowedBranches.Count == 0) {
+        success = false;
+        return parent0;
+      } else {
+        var selectedBranch = SelectRandomBranch(random, allowedBranches, internalCrossoverPointProbability);
+
+        // manipulate the tree of parent0 in place
+        // replace the branch in tree0 with the selected branch from tree1
+        crossoverPoint0.RemoveSubTree(replacedSubtreeIndex);
+        crossoverPoint0.InsertSubTree(replacedSubtreeIndex, selectedBranch);
+        success = true;
+        return parent0;
+      }
+    }
+
+    private static bool IsMatchingPointType(SymbolicExpressionTreeNode parent, int replacedSubtreeIndex, SymbolicExpressionTreeNode branch) {
+      // check syntax constraints of direct parent - child relation
+      if (!parent.Grammar.ContainsSymbol(branch.Symbol) ||
+          !parent.Grammar.IsAllowedChild(parent.Symbol, branch.Symbol, replacedSubtreeIndex)) return false;
+
+      bool result = true;
+      // check point type for the whole branch
+      branch.ForEachNodePostfix((n) => {
+        result =
+          result &&
+          parent.Grammar.ContainsSymbol(n.Symbol) &&
+          n.SubTrees.Count >= parent.Grammar.GetMinSubtreeCount(n.Symbol) &&
+          n.SubTrees.Count <= parent.Grammar.GetMaxSubtreeCount(n.Symbol);
+      });
+      return result;
+    }
+
+    private static void SelectCrossoverPoint(IRandom random, SymbolicExpressionTree parent0, double internalNodeProbability, int maxBranchSize, int maxBranchHeight, out SymbolicExpressionTreeNode crossoverPoint, out int subtreeIndex) {
+      if (internalNodeProbability < 0.0 || internalNodeProbability > 1.0) throw new ArgumentException("internalNodeProbability");
+      List<CrossoverPoint> internalCrossoverPoints = new List<CrossoverPoint>();
+      List<CrossoverPoint> leafCrossoverPoints = new List<CrossoverPoint>();
+      parent0.Root.ForEachNodePostfix((n) => {
+        if (n.SubTrees.Count > 0 &&
+          n.GetSize() < maxBranchSize &&
+          n.GetHeight() < maxBranchHeight &&
+          n != parent0.Root
+          ) {
+          foreach (var child in n.SubTrees) {
+            if (child.SubTrees.Count > 0)
+              internalCrossoverPoints.Add(new CrossoverPoint(n, child));
+            else
+              leafCrossoverPoints.Add(new CrossoverPoint(n, child));
+          }
+        }
+      });
+      if (random.NextDouble() < internalNodeProbability) {
+        // select from internal node if possible
+        if (internalCrossoverPoints.Count > 0) {
+          // select internal crossover point or leaf
+          var selectedCrossoverPoint = internalCrossoverPoints[random.Next(internalCrossoverPoints.Count)];
+          crossoverPoint = selectedCrossoverPoint.Parent;
+          subtreeIndex = selectedCrossoverPoint.SubtreeIndex;
+        } else {
+          // otherwise select external node
+          var selectedCrossoverPoint = leafCrossoverPoints[random.Next(leafCrossoverPoints.Count)];
+          crossoverPoint = selectedCrossoverPoint.Parent;
+          subtreeIndex = selectedCrossoverPoint.SubtreeIndex;
+        }
+      } else if (leafCrossoverPoints.Count > 0) {
+        // select from leaf crossover point if possible
+        var selectedCrossoverPoint = leafCrossoverPoints[random.Next(leafCrossoverPoints.Count)];
+        crossoverPoint = selectedCrossoverPoint.Parent;
+        subtreeIndex = selectedCrossoverPoint.SubtreeIndex;
+      } else {
+        // otherwise select internal crossover point
+        var selectedCrossoverPoint = internalCrossoverPoints[random.Next(internalCrossoverPoints.Count)];
+        crossoverPoint = selectedCrossoverPoint.Parent;
+        subtreeIndex = selectedCrossoverPoint.SubtreeIndex;
+      }
+    }
+
+    private static SymbolicExpressionTreeNode SelectRandomBranch(IRandom random, IEnumerable<SymbolicExpressionTreeNode> branches, double internalNodeProbability) {
+      if (internalNodeProbability < 0.0 || internalNodeProbability > 1.0) throw new ArgumentException("internalNodeProbability");
+      List<SymbolicExpressionTreeNode> allowedInternalBranches;
+      List<SymbolicExpressionTreeNode> allowedLeafBranches;
+      if (random.NextDouble() < internalNodeProbability) {
+        // select internal node if possible
+        allowedInternalBranches = (from branch in branches
+                                   where branch.SubTrees.Count > 0
+                                   select branch).ToList();
+        if (allowedInternalBranches.Count > 0) {
+          return allowedInternalBranches.SelectRandom(random);
+        } else {
+          // no internal nodes allowed => select leaf nodes
+          allowedLeafBranches = (from branch in branches
+                                 where branch.SubTrees.Count == 0
+                                 select branch).ToList();
+          return allowedLeafBranches.SelectRandom(random);
+        }
+      } else {
+        // select leaf node if possible
+        allowedLeafBranches = (from branch in branches
+                               where branch.SubTrees.Count == 0
+                               select branch).ToList();
+        if (allowedLeafBranches.Count > 0) {
+          return allowedLeafBranches.SelectRandom(random);
+        } else {
+          allowedInternalBranches = (from branch in branches
+                                     where branch.SubTrees.Count > 0
+                                     select branch).ToList();
+          return allowedInternalBranches.SelectRandom(random);
+        }
+      }
+    }
+
+    private static int GetBranchLevel(SymbolicExpressionTreeNode root, SymbolicExpressionTreeNode point) {
+      if (root == point) return 0;
+      foreach (var subtree in root.SubTrees) {
+        int branchLevel = GetBranchLevel(subtree, point);
+        if (branchLevel < int.MaxValue) return 1 + branchLevel;
+      }
+      return int.MaxValue;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SymbolicExpressionTreeCrossover.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SymbolicExpressionTreeCrossover.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Crossovers/SymbolicExpressionTreeCrossover.cs	(revision 4803)
@@ -0,0 +1,86 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers {
+  /// <summary>
+  /// A base class for operators that perform a crossover of symbolic expression trees.
+  /// </summary>
+  [Item("SymbolicExpressionTreeCrossover", "A base class for operators that perform a crossover of symbolic expression trees.")]
+  [StorableClass]
+  public abstract class SymbolicExpressionTreeCrossover : SymbolicExpressionTreeOperator, ISymbolicExpressionTreeCrossover {
+    private const string ParentsParameterName = "Parents";
+    private const string ChildParameterName = "Child";
+    private const string FailedCrossoverEventsParameterName = "FailedCrossoverEvents";
+    public ILookupParameter<ItemArray<SymbolicExpressionTree>> ParentsParameter {
+      get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[ParentsParameterName]; }
+    }
+    public ILookupParameter<SymbolicExpressionTree> ChildParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[ChildParameterName]; }
+    }
+    public IValueParameter<IntValue> FailedCrossoverEventsParameter {
+      get { return (ValueParameter<IntValue>)Parameters[FailedCrossoverEventsParameterName]; }
+    }
+
+    public IntValue FailedCrossoverEvents {
+      get { return FailedCrossoverEventsParameter.Value; }
+    }
+    [StorableConstructor]
+    protected SymbolicExpressionTreeCrossover(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTreeCrossover(SymbolicExpressionTreeCrossover original, Cloner cloner) : base(original, cloner) { }
+    protected SymbolicExpressionTreeCrossover()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed."));
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover."));
+      Parameters.Add(new ValueParameter<IntValue>(FailedCrossoverEventsParameterName, "The number of failed crossover events (child is an exact copy of a parent)", new IntValue()));
+    }
+
+    public sealed override IOperation Apply() {
+      if (ParentsParameter.ActualValue.Length != 2)
+        throw new ArgumentException("Number of parents must be exactly two for symbolic expression tree crossover operators.");
+
+      SymbolicExpressionTree parent0 = ParentsParameter.ActualValue[0];
+      SymbolicExpressionTree parent1 = ParentsParameter.ActualValue[1];
+
+      IRandom random = RandomParameter.ActualValue;
+
+      bool success;
+      SymbolicExpressionTree result = Cross(random, parent0, parent1,
+        MaxTreeSizeParameter.ActualValue, MaxTreeHeightParameter.ActualValue, out success);
+
+      if (!success) FailedCrossoverEvents.Value++;
+
+      ChildParameter.ActualValue = result;
+      return base.Apply();
+    }
+
+    protected abstract SymbolicExpressionTree Cross(IRandom random,
+      SymbolicExpressionTree parent0, SymbolicExpressionTree parent1,
+      IntValue maxTreeSize, IntValue maxTreeHeight, out bool success);
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs	(revision 4803)
@@ -0,0 +1,328 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  /// <summary>
+  /// The default symbolic expression grammar stores symbols and syntactic constraints for symbols.
+  /// Symbols are treated as equvivalent if they have the same name.
+  /// Syntactic constraints limit the number of allowed sub trees for a node with a symbol and which symbols are allowed 
+  /// in the sub-trees of a symbol (can be specified for each sub-tree index separately).
+  /// </summary>
+  [StorableClass]
+  [Item("DefaultSymbolicExpressionGrammar", "Represents a grammar that defines the syntax of symbolic expression trees.")]
+  public abstract class DefaultSymbolicExpressionGrammar : Item, ISymbolicExpressionGrammar {
+
+    #region properties for separation between implementation and persistence
+    [Storable]
+    private IEnumerable<KeyValuePair<string, int>> MinSubTreeCount {
+      get { return minSubTreeCount.AsEnumerable(); }
+      set { minSubTreeCount = value.ToDictionary(x => x.Key, x => x.Value); }
+    }
+
+    [Storable]
+    private IEnumerable<KeyValuePair<string, int>> MaxSubTreeCount {
+      get { return maxSubTreeCount.AsEnumerable(); }
+      set { maxSubTreeCount = value.ToDictionary(x => x.Key, x => x.Value); }
+    }
+
+    [Storable]
+    private IEnumerable<KeyValuePair<string, IEnumerable<IEnumerable<string>>>> AllowedChildSymbols {
+      get {
+        return (from parentEntry in allowedChildSymbols
+                let setEnumeration = parentEntry.Value.Select(set => set.AsEnumerable()).ToList()
+                select new KeyValuePair<string, IEnumerable<IEnumerable<string>>>(parentEntry.Key, setEnumeration))
+                .ToList();
+      }
+      set {
+        allowedChildSymbols = new Dictionary<string, List<List<string>>>();
+        foreach (var pair in value) {
+          allowedChildSymbols[pair.Key] = new List<List<string>>();
+          foreach (var entry in pair.Value) {
+            var hashSet = new List<string>();
+            foreach (string child in entry) {
+              hashSet.Add(child);
+            }
+            allowedChildSymbols[pair.Key].Add(hashSet);
+          }
+        }
+      }
+    }
+    [Storable]
+    private IEnumerable<KeyValuePair<string, Symbol>> AllSymbols {
+      get { return allSymbols.AsEnumerable(); }
+      set { allSymbols = value.ToDictionary(x => x.Key, x => x.Value); }
+    }
+    #endregion
+
+    private Dictionary<string, int> minSubTreeCount;
+    private Dictionary<string, int> maxSubTreeCount;
+    private Dictionary<string, List<List<string>>> allowedChildSymbols;
+    private Dictionary<string, Symbol> allSymbols;
+    [Storable]
+    private Symbol startSymbol;
+
+    [StorableConstructor]
+    protected DefaultSymbolicExpressionGrammar(bool deserializing)
+      : base(deserializing) {
+      cachedMinExpressionLength = new Dictionary<string, int>();
+      cachedMaxExpressionLength = new Dictionary<string, int>();
+      cachedMinExpressionDepth = new Dictionary<string, int>();
+    }
+    // cloning ctor
+    protected DefaultSymbolicExpressionGrammar(DefaultSymbolicExpressionGrammar original, Cloner cloner)
+      : base(original, cloner) {
+      this.cachedMinExpressionLength = new Dictionary<string, int>();
+      this.cachedMaxExpressionLength = new Dictionary<string, int>();
+      this.cachedMinExpressionDepth = new Dictionary<string, int>();
+      minSubTreeCount = new Dictionary<string, int>(original.minSubTreeCount);
+      maxSubTreeCount = new Dictionary<string, int>(original.maxSubTreeCount);
+
+      allSymbols = new Dictionary<string, Symbol>();
+      foreach (Symbol symbol in original.allSymbols.Values.Select(s => cloner.Clone(s)))
+        allSymbols.Add(symbol.Name, symbol);
+
+      startSymbol = cloner.Clone<Symbol>(original.startSymbol);
+      allowedChildSymbols = new Dictionary<string, List<List<string>>>();
+      foreach (var entry in original.allowedChildSymbols) {
+        allowedChildSymbols[entry.Key] = new List<List<string>>(entry.Value.Count);
+        foreach (var set in entry.Value) {
+          allowedChildSymbols[entry.Key].Add(new List<string>(set));
+        }
+      }
+    }
+    protected DefaultSymbolicExpressionGrammar()
+      : base() {
+      this.minSubTreeCount = new Dictionary<string, int>();
+      this.maxSubTreeCount = new Dictionary<string, int>();
+      this.allowedChildSymbols = new Dictionary<string, List<List<string>>>();
+      this.allSymbols = new Dictionary<string, Symbol>();
+      this.cachedMinExpressionLength = new Dictionary<string, int>();
+      this.cachedMaxExpressionLength = new Dictionary<string, int>();
+      this.cachedMinExpressionDepth = new Dictionary<string, int>();
+
+      this.startSymbol = new StartSymbol();
+      this.AddSymbol(startSymbol);
+      this.SetMinSubtreeCount(startSymbol, 1);
+      this.SetMaxSubtreeCount(startSymbol, 1);
+    }
+
+    protected DefaultSymbolicExpressionGrammar(ISymbolicExpressionGrammar grammar)
+      : base() {
+      Cloner cloner = new Cloner();
+      this.cachedMinExpressionLength = new Dictionary<string, int>();
+      this.cachedMaxExpressionLength = new Dictionary<string, int>();
+      this.cachedMinExpressionDepth = new Dictionary<string, int>();
+
+      this.minSubTreeCount = new Dictionary<string, int>();
+      this.maxSubTreeCount = new Dictionary<string, int>();
+      this.allowedChildSymbols = new Dictionary<string, List<List<string>>>();
+      this.allSymbols = new Dictionary<string, Symbol>();
+
+      this.StartSymbol = (Symbol)cloner.Clone(grammar.StartSymbol);
+
+      foreach (Symbol symbol in grammar.Symbols) {
+        Symbol clonedSymbol = (Symbol)cloner.Clone(symbol);
+        this.AddSymbol(clonedSymbol);
+        this.SetMinSubtreeCount(clonedSymbol, grammar.GetMinSubtreeCount(symbol));
+        this.SetMaxSubtreeCount(clonedSymbol, grammar.GetMaxSubtreeCount(symbol));
+      }
+
+      foreach (Symbol parent in grammar.Symbols) {
+        for (int i = 0; i < grammar.GetMaxSubtreeCount(parent); i++) {
+          foreach (Symbol child in grammar.Symbols) {
+            if (grammar.IsAllowedChild(parent, child, i)) {
+              this.SetAllowedChild((Symbol)cloner.Clone(parent), (Symbol)cloner.Clone(child), i);
+            }
+          }
+        }
+      }
+    }
+
+    public void Clear() {
+      minSubTreeCount.Clear();
+      maxSubTreeCount.Clear();
+      allowedChildSymbols.Clear();
+      allSymbols.Clear();
+
+      cachedMaxExpressionLength.Clear();
+      cachedMinExpressionLength.Clear();
+      cachedMinExpressionDepth.Clear();
+
+      startSymbol = new StartSymbol();
+      AddSymbol(startSymbol);
+      SetMinSubtreeCount(startSymbol, 1);
+      SetMaxSubtreeCount(startSymbol, 1);
+    }
+
+    #region ISymbolicExpressionGrammar Members
+    public Symbol StartSymbol {
+      get { return startSymbol; }
+      set { startSymbol = value; }
+    }
+
+    public void AddSymbol(Symbol symbol) {
+      if (ContainsSymbol(symbol)) throw new ArgumentException("Symbol " + symbol + " is already defined.");
+      allSymbols.Add(symbol.Name, symbol);
+      allowedChildSymbols[symbol.Name] = new List<List<string>>();
+      ClearCaches();
+    }
+
+    public void RemoveSymbol(Symbol symbol) {
+      foreach (var parent in Symbols) {
+        for (int i = 0; i < GetMaxSubtreeCount(parent); i++)
+          if (IsAllowedChild(parent, symbol, i))
+            allowedChildSymbols[parent.Name][i].Remove(symbol.Name);
+      }
+      allSymbols.Remove(symbol.Name);
+      minSubTreeCount.Remove(symbol.Name);
+      maxSubTreeCount.Remove(symbol.Name);
+      allowedChildSymbols.Remove(symbol.Name);
+      ClearCaches();
+    }
+
+    public IEnumerable<Symbol> Symbols {
+      get { return allSymbols.Values.AsEnumerable(); }
+    }
+
+    public bool ContainsSymbol(Symbol symbol) {
+      return allSymbols.ContainsKey(symbol.Name);
+    }
+
+    public void SetAllowedChild(Symbol parent, Symbol child, int argumentIndex) {
+      if (!ContainsSymbol(parent)) throw new ArgumentException("Unknown symbol: " + parent, "parent");
+      if (!ContainsSymbol(child)) throw new ArgumentException("Unknown symbol: " + child, "child");
+      if (argumentIndex >= GetMaxSubtreeCount(parent)) throw new ArgumentException("Symbol " + parent + " can have only " + GetMaxSubtreeCount(parent) + " subtrees.");
+      allowedChildSymbols[parent.Name][argumentIndex].Add(child.Name);
+      ClearCaches();
+    }
+
+    public bool IsAllowedChild(Symbol parent, Symbol child, int argumentIndex) {
+      if (!ContainsSymbol(parent)) throw new ArgumentException("Unknown symbol: " + parent, "parent");
+      if (!ContainsSymbol(child)) throw new ArgumentException("Unknown symbol: " + child, "child");
+      if (argumentIndex >= GetMaxSubtreeCount(parent)) throw new ArgumentException("Symbol " + parent + " can have only " + GetMaxSubtreeCount(parent) + " subtrees.");
+      return allowedChildSymbols[parent.Name][argumentIndex].Contains(child.Name);
+    }
+
+    private Dictionary<string, int> cachedMinExpressionLength;
+    public int GetMinExpressionLength(Symbol symbol) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      if (!cachedMinExpressionLength.ContainsKey(symbol.Name)) {
+        cachedMinExpressionLength[symbol.Name] = int.MaxValue; // prevent infinite recursion
+        long sumOfMinExpressionLengths = 1 + (from argIndex in Enumerable.Range(0, GetMinSubtreeCount(symbol))
+                                              let minForSlot = (long)(from s in Symbols
+                                                                      where IsAllowedChild(symbol, s, argIndex)
+                                                                      select GetMinExpressionLength(s)).DefaultIfEmpty(0).Min()
+                                              select minForSlot).DefaultIfEmpty(0).Sum();
+
+        cachedMinExpressionLength[symbol.Name] = (int)Math.Min(sumOfMinExpressionLengths, int.MaxValue);
+      }
+      return cachedMinExpressionLength[symbol.Name];
+    }
+
+    private Dictionary<string, int> cachedMaxExpressionLength;
+    public int GetMaxExpressionLength(Symbol symbol) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      if (!cachedMaxExpressionLength.ContainsKey(symbol.Name)) {
+        cachedMaxExpressionLength[symbol.Name] = int.MaxValue; // prevent infinite recursion
+        long sumOfMaxTrees = 1 + (from argIndex in Enumerable.Range(0, GetMaxSubtreeCount(symbol))
+                                  let maxForSlot = (long)(from s in Symbols
+                                                          where IsAllowedChild(symbol, s, argIndex)
+                                                          select GetMaxExpressionLength(s)).DefaultIfEmpty(0).Max()
+                                  select maxForSlot).DefaultIfEmpty(0).Sum();
+        long limit = int.MaxValue;
+        cachedMaxExpressionLength[symbol.Name] = (int)Math.Min(sumOfMaxTrees, limit);
+      }
+      return cachedMaxExpressionLength[symbol.Name];
+    }
+
+    private Dictionary<string, int> cachedMinExpressionDepth;
+    public int GetMinExpressionDepth(Symbol symbol) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      if (!cachedMinExpressionDepth.ContainsKey(symbol.Name)) {
+        cachedMinExpressionDepth[symbol.Name] = int.MaxValue; // prevent infinite recursion
+        cachedMinExpressionDepth[symbol.Name] = 1 + (from argIndex in Enumerable.Range(0, GetMinSubtreeCount(symbol))
+                                                     let minForSlot = (from s in Symbols
+                                                                       where IsAllowedChild(symbol, s, argIndex)
+                                                                       select GetMinExpressionDepth(s)).DefaultIfEmpty(0).Min()
+                                                     select minForSlot).DefaultIfEmpty(0).Max();
+      }
+      return cachedMinExpressionDepth[symbol.Name];
+    }
+
+    public void SetMaxSubtreeCount(Symbol symbol, int nSubTrees) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      maxSubTreeCount[symbol.Name] = nSubTrees;
+      while (allowedChildSymbols[symbol.Name].Count <= nSubTrees)
+        allowedChildSymbols[symbol.Name].Add(new List<string>());
+      while (allowedChildSymbols[symbol.Name].Count > nSubTrees) {
+        allowedChildSymbols[symbol.Name].RemoveAt(allowedChildSymbols[symbol.Name].Count - 1);
+      }
+      ClearCaches();
+    }
+
+    public void SetMinSubtreeCount(Symbol symbol, int nSubTrees) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      minSubTreeCount[symbol.Name] = nSubTrees;
+      ClearCaches();
+    }
+
+    public int GetMinSubtreeCount(Symbol symbol) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      return minSubTreeCount[symbol.Name];
+    }
+
+    public int GetMaxSubtreeCount(Symbol symbol) {
+      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
+      return maxSubTreeCount[symbol.Name];
+    }
+    #endregion
+
+    private void ClearCaches() {
+      cachedMinExpressionLength.Clear();
+      cachedMaxExpressionLength.Clear();
+      cachedMinExpressionDepth.Clear();
+    }
+
+    protected void InitializeShallowClone(DefaultSymbolicExpressionGrammar original) {
+      minSubTreeCount = new Dictionary<string, int>(original.minSubTreeCount);
+      maxSubTreeCount = new Dictionary<string, int>(original.maxSubTreeCount);
+
+      allSymbols = new Dictionary<string, Symbol>(original.allSymbols);
+      startSymbol = original.startSymbol;
+      allowedChildSymbols = new Dictionary<string, List<List<string>>>(original.allowedChildSymbols.Count);
+      foreach (var entry in original.allowedChildSymbols) {
+        allowedChildSymbols[entry.Key] = new List<List<string>>(entry.Value.Count);
+        foreach (var set in entry.Value) {
+          allowedChildSymbols[entry.Key].Add(new List<string>(set));
+        }
+      }
+    }
+
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/EnumerableExtensions.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/EnumerableExtensions.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/EnumerableExtensions.cs	(revision 4803)
@@ -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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  public static class EnumerableExtensions {
+    public static T SelectRandom<T>(this IEnumerable<T> xs, IRandom random) {
+      var list = xs as IList<T>;
+      if (list != null) {
+        return list[random.Next(list.Count)];
+      } else {
+        list = xs.ToList();
+        return list[random.Next(list.Count)];
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs	(revision 4803)
@@ -0,0 +1,188 @@
+#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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  [Item("GlobalSymbolicExpressionGrammar", "Represents a grammar that defines the syntax of symbolic expression trees.")]
+  public sealed class GlobalSymbolicExpressionGrammar : DefaultSymbolicExpressionGrammar {
+    [Storable]
+    private int minFunctionDefinitions;
+    public int MinFunctionDefinitions {
+      get { return minFunctionDefinitions; }
+      set {
+        minFunctionDefinitions = value;
+        UpdateAdfConstraints();
+      }
+    }
+    [Storable]
+    private int maxFunctionDefinitions;
+    public int MaxFunctionDefinitions {
+      get { return maxFunctionDefinitions; }
+      set {
+        maxFunctionDefinitions = value;
+        UpdateAdfConstraints();
+      }
+    }
+    [Storable]
+    private int minFunctionArguments;
+    public int MinFunctionArguments {
+      get { return minFunctionArguments; }
+      set {
+        minFunctionArguments = value;
+      }
+    }
+    [Storable]
+    private int maxFunctionArguments;
+    public int MaxFunctionArguments {
+      get { return maxFunctionArguments; }
+      set {
+        maxFunctionArguments = value;
+      }
+    }
+
+    [Storable]
+    private Defun defunSymbol;
+
+    [StorableConstructor]
+    private GlobalSymbolicExpressionGrammar(bool deserializing) : base(deserializing) { }
+    private GlobalSymbolicExpressionGrammar(GlobalSymbolicExpressionGrammar original, Cloner cloner)
+      : base(original, cloner) {
+      defunSymbol = (Defun)cloner.Clone(original.defunSymbol);
+      maxFunctionArguments = original.maxFunctionArguments;
+      minFunctionArguments = original.minFunctionArguments;
+      maxFunctionDefinitions = original.maxFunctionDefinitions;
+      minFunctionDefinitions = original.minFunctionDefinitions;
+    }
+
+    public GlobalSymbolicExpressionGrammar(ISymbolicExpressionGrammar mainBranchGrammar)
+      : base(mainBranchGrammar) {
+      maxFunctionArguments = 3;
+      maxFunctionDefinitions = 3;
+
+      ProgramRootSymbol programRootSymbol = Symbols.OfType<ProgramRootSymbol>().FirstOrDefault();
+      if (programRootSymbol == null) {
+        programRootSymbol = new ProgramRootSymbol();
+        AddSymbol(programRootSymbol);
+      }
+      StartSymbol = programRootSymbol;
+
+      defunSymbol = Symbols.OfType<Defun>().FirstOrDefault();
+      if (defunSymbol == null) {
+        defunSymbol = new Defun();
+        AddSymbol(defunSymbol);
+      }
+
+      SetMinSubtreeCount(StartSymbol, minFunctionDefinitions + 1); // min number of ADF + 1 for RPB
+      SetMaxSubtreeCount(StartSymbol, maxFunctionDefinitions + 1); // max number of ADF + 1 for RPB
+      // defun can have only one child
+      SetMinSubtreeCount(defunSymbol, 1); 
+      SetMaxSubtreeCount(defunSymbol, 1);
+
+
+      // the start symbol of the mainBranchGrammar is allowed as the result producing branch
+      SetAllowedChild(StartSymbol, Symbols.Where(s => s.Name == mainBranchGrammar.StartSymbol.Name).First(), 0);
+
+      // defuns are allowed as children on the same level and after RPB
+      for (int i = 0; i < maxFunctionDefinitions; i++) {
+        // +1 because RPB has index 0
+        SetAllowedChild(StartSymbol, defunSymbol, i + 1); 
+      }
+
+      // every symbol of the mainBranchGrammar that is allowed as child of the start symbol is also allowed as direct child of defun
+      foreach (var symb in mainBranchGrammar.Symbols) {
+        if (mainBranchGrammar.IsAllowedChild(mainBranchGrammar.StartSymbol, symb, 0))
+          SetAllowedChild(defunSymbol, Symbols.Where(s => s.Name == symb.Name).First(), 0);
+      }
+    }
+
+    [Obsolete]
+    private void Initialize(ISymbolicExpressionGrammar mainBranchGrammar) {
+      base.Clear();
+
+      // remove the start symbol of the default grammar
+      RemoveSymbol(StartSymbol);
+
+      StartSymbol = new ProgramRootSymbol();
+      defunSymbol = new Defun();
+      AddSymbol(StartSymbol);
+      AddSymbol(defunSymbol);
+
+      SetMinSubtreeCount(StartSymbol, minFunctionDefinitions + 1);
+      SetMaxSubtreeCount(StartSymbol, maxFunctionDefinitions + 1);
+      SetMinSubtreeCount(defunSymbol, 1);
+      SetMaxSubtreeCount(defunSymbol, 1);
+
+      // ADF branches maxFunctionDefinitions 
+      for (int argumentIndex = 1; argumentIndex < maxFunctionDefinitions + 1; argumentIndex++) {
+        SetAllowedChild(StartSymbol, defunSymbol, argumentIndex);
+      }
+
+      if (mainBranchGrammar != null) {
+        // copy symbols from mainBranchGrammar
+        foreach (var symb in mainBranchGrammar.Symbols) {
+          AddSymbol(symb);
+          SetMinSubtreeCount(symb, mainBranchGrammar.GetMinSubtreeCount(symb));
+          SetMaxSubtreeCount(symb, mainBranchGrammar.GetMaxSubtreeCount(symb));
+        }
+
+        // the start symbol of the mainBranchGrammar is allowed as the result producing branch
+        SetAllowedChild(StartSymbol, mainBranchGrammar.StartSymbol, 0);
+
+        // copy syntax constraints from mainBranchGrammar
+        foreach (var parent in mainBranchGrammar.Symbols) {
+          for (int i = 0; i < mainBranchGrammar.GetMaxSubtreeCount(parent); i++) {
+            foreach (var child in mainBranchGrammar.Symbols) {
+              if (mainBranchGrammar.IsAllowedChild(parent, child, i)) {
+                SetAllowedChild(parent, child, i);
+              }
+            }
+          }
+        }
+
+        // every symbol of the mainBranchGrammar that is allowed as child of the start symbol is also allowed as direct child of defun
+        foreach (var symb in mainBranchGrammar.Symbols) {
+          if (mainBranchGrammar.IsAllowedChild(mainBranchGrammar.StartSymbol, symb, 0))
+            SetAllowedChild(defunSymbol, symb, 0);
+        }
+      }
+    }
+    private void UpdateAdfConstraints() {
+      SetMinSubtreeCount(StartSymbol, minFunctionDefinitions + 1);
+      SetMaxSubtreeCount(StartSymbol, maxFunctionDefinitions + 1);
+
+      // ADF branches maxFunctionDefinitions 
+      for (int argumentIndex = 1; argumentIndex < maxFunctionDefinitions + 1; argumentIndex++) {
+        SetAllowedChild(StartSymbol, defunSymbol, argumentIndex);
+      }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GlobalSymbolicExpressionGrammar(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTree-3.3.csproj	(revision 4803)
@@ -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\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</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: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj	(revision 4803)
@@ -0,0 +1,258 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" 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>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation />
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </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>
+    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="HeuristicLab.Analysis-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <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="Analyzers\MinAverageMaxSymbolicExpressionTreeSizeAnalyzer.cs" />
+    <Compile Include="Analyzers\SymbolicExpressionTreeSizeCalculator.cs" />
+    <Compile Include="ArchitectureManipulators\ArgumentCreater.cs" />
+    <Compile Include="ArchitectureManipulators\ArgumentDeleter.cs" />
+    <Compile Include="ArchitectureManipulators\ArgumentDuplicater.cs" />
+    <Compile Include="ArchitectureManipulators\GrammarModifier.cs" />
+    <Compile Include="ArchitectureManipulators\MultiSymbolicExpressionTreeArchitectureManipulator.cs" />
+    <Compile Include="ArchitectureManipulators\SubroutineCreater.cs" />
+    <Compile Include="ArchitectureManipulators\SubroutineDeleter.cs" />
+    <Compile Include="ArchitectureManipulators\SubroutineDuplicater.cs" />
+    <Compile Include="ArchitectureManipulators\SymbolicExpressionTreeArchitectureManipulator.cs" />
+    <Compile Include="Compiler\Instruction.cs" />
+    <Compile Include="Compiler\SymbolicExpressionTreeCompiler.cs" />
+    <Compile Include="Creators\SymbolicExpressionTreeCreator.cs" />
+    <Compile Include="Crossovers\CrossoverPoint.cs" />
+    <Compile Include="Crossovers\SymbolicExpressionTreeCrossover.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeAnalyzer.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeArchitectureManipulator.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeCreator.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeCrossover.cs" />
+    <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeManipulator.cs" />
+    <Compile Include="Manipulators\ReplaceBranchManipulation.cs" />
+    <Compile Include="Manipulators\FullTreeShaker.cs" />
+    <Compile Include="Manipulators\MultiSymbolicExpressionTreeManipulator.cs" />
+    <Compile Include="Manipulators\OnePointShaker.cs" />
+    <Compile Include="Manipulators\SymbolicExpressionTreeManipulator.cs" />
+    <Compile Include="SymbolicExpressionTreeGrammar.cs" />
+    <Compile Include="SymbolicExpressionTreeStringFormatter.cs" />
+    <Compile Include="SymbolicExpressionTreeTopLevelNode.cs" />
+    <Compile Include="Crossovers\SubtreeCrossover.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="GlobalSymbolicExpressionGrammar.cs" />
+    <Compile Include="EnumerableExtensions.cs" />
+    <Compile Include="DefaultSymbolicExpressionGrammar.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SymbolicExpressionTreeOperator.cs" />
+    <Compile Include="SymbolicExpressionTreeTerminalNode.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionGrammar.cs" />
+    <Compile Include="Creators\ProbabilisticTreeCreator.cs" />
+    <Compile Include="HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs" />
+    <Compile Include="Interfaces\ISymbolicExpressionTreeOperator.cs" />
+    <Compile Include="SymbolicExpressionTree.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SymbolicExpressionTreeNode.cs" />
+    <Compile Include="Symbols\Argument.cs" />
+    <Compile Include="Symbols\ArgumentTreeNode.cs" />
+    <Compile Include="Symbols\ReadOnlySymbol.cs" />
+    <Compile Include="Symbols\StartSymbol.cs" />
+    <Compile Include="Symbols\InvokeFunction.cs" />
+    <Compile Include="Symbols\InvokeFunctionTreeNode.cs" />
+    <Compile Include="Symbols\DefunTreeNode.cs" />
+    <Compile Include="Symbols\Defun.cs" />
+    <Compile Include="Symbols\ProgramRootSymbol.cs" />
+    <Compile Include="Symbols\Symbol.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
+  </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>
+  <PropertyGroup>
+    <PostBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+set Platform=$(PlatformName)
+
+call UpdateLocalInstallation.cmd</PostBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs	(revision 4803)
@@ -0,0 +1,42 @@
+#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.1.0")]
+  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Analysis", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Collections", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Common", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Common.Resources", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Core", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Data", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Operators", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3.1.0")]
+  public class HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin : PluginBase {
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs.frame	(revision 4803)
@@ -0,0 +1,42 @@
+#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.1.$WCREV$")]
+  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Analysis", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Collections", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Common", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Common.Resources", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Core", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Data", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Operators", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3.1.0")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3.1.0")]
+  public class HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin : PluginBase {
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionGrammar.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionGrammar.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionGrammar.cs	(revision 4803)
@@ -0,0 +1,43 @@
+#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.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  public interface ISymbolicExpressionGrammar : IItem {
+    Symbol StartSymbol { get; }
+    void AddSymbol(Symbol symbol);
+    void RemoveSymbol(Symbol symbol);
+    IEnumerable<Symbol> Symbols { get; }
+    bool ContainsSymbol(Symbol symbol);
+    void SetAllowedChild(Symbol parent, Symbol child, int argumentIndex);
+    bool IsAllowedChild(Symbol parent, Symbol child, int argumentIndex);
+    int GetMinExpressionLength(Symbol start);
+    int GetMaxExpressionLength(Symbol start);
+    int GetMinExpressionDepth(Symbol start);
+    int GetMinSubtreeCount(Symbol symbol);
+    void SetMinSubtreeCount(Symbol symbol, int value);
+    int GetMaxSubtreeCount(Symbol symbol);
+    void SetMaxSubtreeCount(Symbol symbol, int value);
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeAnalyzer.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeAnalyzer.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeAnalyzer.cs	(revision 4803)
@@ -0,0 +1,32 @@
+﻿#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.Optimization;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces {
+  /// <summary>
+  /// Interface for analyzers that can be applied to symbolic expression trees.
+  /// </summary>
+  public interface ISymbolicExpressionTreeAnalyzer : IAnalyzer {
+    ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeArchitectureManipulator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeArchitectureManipulator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeArchitectureManipulator.cs	(revision 4803)
@@ -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 HeuristicLab.Core;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces {
+  /// <summary>
+  /// Interface for operators that manipulate symbolic expression trees.
+  /// </summary>
+  public interface ISymbolicExpressionTreeArchitectureManipulator : ISymbolicExpressionTreeManipulator {
+    IValueLookupParameter<IntValue> MaxFunctionDefinitionsParameter { get; }
+    IValueLookupParameter<IntValue> MaxFunctionArgumentsParameter { get; }
+
+    void ModifyArchitecture(
+      IRandom random,
+      SymbolicExpressionTree symbolicExpressionTree,
+      ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight,
+      IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments,
+      out bool success);
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeCreator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeCreator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeCreator.cs	(revision 4803)
@@ -0,0 +1,35 @@
+﻿#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.Optimization;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces {
+  /// <summary>
+  /// Interface for operators that create symbolic expression trees.
+  /// </summary>
+  public interface ISymbolicExpressionTreeCreator : ISymbolicExpressionTreeOperator, ISolutionCreator {
+    ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
+    IValueLookupParameter<IntValue> MaxFunctionDefinitionsParameter { get; }
+    IValueLookupParameter<IntValue> MaxFunctionArgumentsParameter { get; }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeCrossover.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeCrossover.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeCrossover.cs	(revision 4803)
@@ -0,0 +1,33 @@
+﻿#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.Optimization;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces {
+  /// <summary>
+  /// Interface for crossover operators that can be applied to symbolic expression trees.
+  /// </summary>
+  public interface ISymbolicExpressionTreeCrossover : ISymbolicExpressionTreeOperator, ICrossover {
+    ILookupParameter<ItemArray<SymbolicExpressionTree>> ParentsParameter { get; }
+    ILookupParameter<SymbolicExpressionTree> ChildParameter { get; }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeManipulator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeManipulator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeManipulator.cs	(revision 4803)
@@ -0,0 +1,32 @@
+﻿#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.Optimization;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces {
+  /// <summary>
+  /// Interface for operators that manipulate symbolic expression trees.
+  /// </summary>
+  public interface ISymbolicExpressionTreeManipulator : ISymbolicExpressionTreeOperator, IManipulator {
+    ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeOperator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeOperator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Interfaces/ISymbolicExpressionTreeOperator.cs	(revision 4803)
@@ -0,0 +1,34 @@
+﻿#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;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces {
+  /// <summary>
+  /// Interface for operators that can be applied to symbolic expression trees.
+  /// </summary>
+  public interface ISymbolicExpressionTreeOperator : IOperator {
+    IValueLookupParameter<IntValue> MaxTreeSizeParameter { get; }
+    IValueLookupParameter<IntValue> MaxTreeHeightParameter { get; }
+    ILookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionGrammarParameter { get; }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ChangeNodeTypeManipulation.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ChangeNodeTypeManipulation.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ChangeNodeTypeManipulation.cs	(revision 4803)
@@ -0,0 +1,107 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
+  [StorableClass]
+  [Item("ChangeNodeTypeManipulation", "Selects a random tree node and changes the symbol.")]
+  public sealed class ChangeNodeTypeManipulation : SymbolicExpressionTreeManipulator {
+
+    [StorableConstructor]
+    private ChangeNodeTypeManipulation(bool deserializing) : base(deserializing) { }
+    private ChangeNodeTypeManipulation(ChangeNodeTypeManipulation original, Cloner cloner) : base(original, cloner) { }
+    public ChangeNodeTypeManipulation() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ChangeNodeTypeManipulation(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
+      ChangeNodeType(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, out success);
+    }
+
+    public static void ChangeNodeType(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, int maxTreeSize, int maxTreeHeight, out bool success) {
+
+      // select any node as parent (except the root node)
+      var manipulationPoint = (from parent in symbolicExpressionTree.Root.IterateNodesPrefix().Skip(1)
+                               from subtree in parent.SubTrees
+                               select new { Parent = parent, Node = subtree, Index = parent.SubTrees.IndexOf(subtree) }).SelectRandom(random);
+      // find possible symbols for the node (also considering the existing branches below it)
+      var allowedSymbols = from symbol in manipulationPoint.Parent.GetAllowedSymbols(manipulationPoint.Index)
+                           where manipulationPoint.Node.SubTrees.Count <= manipulationPoint.Node.Grammar.GetMaxSubtreeCount(symbol)
+                           where manipulationPoint.Node.SubTrees.Count >= manipulationPoint.Node.Grammar.GetMinSubtreeCount(symbol)
+                           select symbol;
+
+      if (allowedSymbols.Count() <= 1) {
+        success = false;
+        return;
+      }
+      var node = manipulationPoint.Node;
+      // keep only symbols that are still possible considering the existing sub-trees
+      var constrainedSymbols = from symbol in allowedSymbols
+                               let disallowedSubtrees =
+                                     from subtree in node.SubTrees
+                                     where !node.Grammar.IsAllowedChild(symbol, subtree.Symbol, node.SubTrees.IndexOf(subtree))
+                                     select subtree
+                               where disallowedSubtrees.Count() == 0
+                               select symbol;
+      if (constrainedSymbols.Count() <= 1) {
+        success = false;
+        return;
+      }
+      var newSymbol = SelectRandomSymbol(random, constrainedSymbols);
+
+      // replace the old node with the new node
+      var newNode = newSymbol.CreateTreeNode();
+      if (newNode.HasLocalParameters)
+        newNode.ResetLocalParameters(random);
+      foreach (var subtree in node.SubTrees)
+        newNode.AddSubTree(subtree);
+      manipulationPoint.Parent.RemoveSubTree(manipulationPoint.Index);
+      manipulationPoint.Parent.InsertSubTree(manipulationPoint.Index, newNode);
+      success = true;
+    }
+
+    private static Symbol SelectRandomSymbol(IRandom random, IEnumerable<Symbol> symbols) {
+      var symbolList = symbols.ToList();
+      var ticketsSum = symbolList.Select(x => x.InitialFrequency).Sum();
+      if (ticketsSum == 0.0) throw new ArgumentException("The initial frequency of all allowed symbols is zero.");
+      var r = random.NextDouble() * ticketsSum;
+      double aggregatedTickets = 0;
+      for (int i = 0; i < symbolList.Count; i++) {
+        aggregatedTickets += symbolList[i].InitialFrequency;
+        if (aggregatedTickets > r) {
+          return symbolList[i];
+        }
+      }
+      // this should never happen
+      throw new ArgumentException("There is a problem with the initial frequency setting of allowed symbols.");
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs	(revision 4803)
@@ -0,0 +1,50 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
+  [StorableClass]
+  [Item("FullTreeShaker", "Manipulates all nodes that have local parameters.")]
+  public sealed class FullTreeShaker : SymbolicExpressionTreeManipulator {
+
+    [StorableConstructor]
+    private FullTreeShaker(bool deserializing) : base(deserializing) { }
+    private FullTreeShaker(FullTreeShaker original, Cloner cloner) : base(original, cloner) { }
+    public FullTreeShaker() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FullTreeShaker(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
+      foreach (var node in symbolicExpressionTree.IterateNodesPrefix()) {
+        if (node.HasLocalParameters) {
+          node.ShakeLocalParameters(random, 1.0);
+        }
+      }
+      success = true;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/MultiSymbolicExpressionTreeManipulator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/MultiSymbolicExpressionTreeManipulator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/MultiSymbolicExpressionTreeManipulator.cs	(revision 4803)
@@ -0,0 +1,112 @@
+﻿#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.Linq;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
+  [Item("MultiSymbolicExpressionTreeManipulator", "Randomly selects and applies one of its manipulators every time it is called.")]
+  [StorableClass]
+  public sealed class MultiSymbolicExpressionTreeManipulator : StochasticMultiBranch<ISymbolicExpressionTreeManipulator>, ISymbolicExpressionTreeManipulator, IStochasticOperator {
+    private const string MaxTreeSizeParameterName = "MaxTreeSize";
+    private const string MaxTreeHeightParameterName = "MaxTreeHeight";
+    private const string SymbolicExpressionGrammarParameterName = "SymbolicExpressionGrammar";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    protected override bool CreateChildOperation {
+      get { return true; }
+    }
+
+    #region ISymbolicExpressionTreeManipulator Members
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    #endregion
+
+    #region ISymbolicExpressionTreeOperator Members
+    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]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private MultiSymbolicExpressionTreeManipulator(bool deserializing) : base(deserializing) { }
+    private MultiSymbolicExpressionTreeManipulator(MultiSymbolicExpressionTreeManipulator original, Cloner cloner) : base(original, cloner) { }
+    public MultiSymbolicExpressionTreeManipulator()
+      : base() {
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeSizeParameterName, "The maximal size (number of nodes) of the symbolic expression tree."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeHeightParameterName, "The maximal height of the symbolic expression tree (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."));
+
+      foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicExpressionTreeManipulator))) {
+        if (!typeof(MultiOperator<ISymbolicExpressionTreeManipulator>).IsAssignableFrom(type) && !typeof(ISymbolicExpressionTreeArchitectureManipulator).IsAssignableFrom(type))
+          Operators.Add((ISymbolicExpressionTreeManipulator)Activator.CreateInstance(type), true);
+      }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MultiSymbolicExpressionTreeManipulator(this, cloner);
+    }
+
+    protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>> e) {
+      base.Operators_ItemsReplaced(sender, e);
+      ParameterizeManipulators();
+    }
+
+    protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>> e) {
+      base.Operators_ItemsAdded(sender, e);
+      ParameterizeManipulators();
+    }
+
+    private void ParameterizeManipulators() {
+      foreach (ISymbolicExpressionTreeManipulator manipulator in Operators.OfType<ISymbolicExpressionTreeManipulator>()) {
+        manipulator.MaxTreeSizeParameter.ActualName = MaxTreeSizeParameter.Name;
+        manipulator.MaxTreeHeightParameter.ActualName = MaxTreeHeightParameter.Name;
+        manipulator.SymbolicExpressionGrammarParameter.ActualName = SymbolicExpressionGrammarParameter.Name;
+        manipulator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
+      }
+
+      foreach (IStochasticOperator manipulator in Operators.OfType<IStochasticOperator>()) {
+        manipulator.RandomParameter.ActualName = RandomParameter.Name;
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/OnePointShaker.cs	(revision 4803)
@@ -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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
+  [StorableClass]
+  [Item("OnePointShaker", "Selects a random node with local parameters and manipulates the selected node.")]
+  public sealed class OnePointShaker : SymbolicExpressionTreeManipulator {
+    [StorableConstructor]
+    private OnePointShaker(bool deserializing) : base(deserializing) { }
+    private OnePointShaker(OnePointShaker original, Cloner cloner) : base(original, cloner) { }
+    public OnePointShaker() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new OnePointShaker(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
+      var parametricNodes = from node in symbolicExpressionTree.IterateNodesPrefix()
+                            where node.HasLocalParameters
+                            select node;
+      if (parametricNodes.Count() > 0) {
+        SymbolicExpressionTreeNode selectedPoint = parametricNodes.SelectRandom(random);
+
+        selectedPoint.ShakeLocalParameters(random, 1.0);
+        success = true;
+      } else {
+        success = false;
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ReplaceBranchManipulation.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ReplaceBranchManipulation.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ReplaceBranchManipulation.cs	(revision 4803)
@@ -0,0 +1,95 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
+  [StorableClass]
+  [Item("ReplaceBranchManipulation", "Selects a branch of the tree randomly and replaces it with a newly initialized branch (using PTC2).")]
+  public sealed class ReplaceBranchManipulation : SymbolicExpressionTreeManipulator {
+    [StorableConstructor]
+    private ReplaceBranchManipulation(bool deserializing) : base(deserializing) { }
+    private ReplaceBranchManipulation(ReplaceBranchManipulation original, Cloner cloner) : base(original, cloner) { }
+    public ReplaceBranchManipulation() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ReplaceBranchManipulation(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
+      ReplaceRandomBranch(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, out success);
+    }
+
+    public static void ReplaceRandomBranch(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, int maxTreeSize, int maxTreeHeight, out bool success) {
+      success = false;
+      // select any node as parent (except the root node)
+      var manipulationPoint = (from parent in symbolicExpressionTree.Root.IterateNodesPrefix().Skip(1)
+                               from subtree in parent.SubTrees
+                               select new { Parent = parent, Node = subtree, Index = parent.SubTrees.IndexOf(subtree) }).SelectRandom(random);
+      // find possible symbols for the node (also considering the existing branches below it)
+      var allowedSymbols = from symbol in manipulationPoint.Parent.GetAllowedSymbols(manipulationPoint.Index)
+                           select symbol;
+
+      if (allowedSymbols.Count() <= 1) {
+        return;
+      }
+      var oldBranch = manipulationPoint.Node;
+      int oldBranchSize = manipulationPoint.Node.GetSize();
+
+      var seedSymbol = SelectRandomSymbol(random, allowedSymbols);
+
+      // replace the old node with the new node
+      var seedNode = seedSymbol.CreateTreeNode();
+      if (seedNode.HasLocalParameters)
+        seedNode.ResetLocalParameters(random);
+
+      manipulationPoint.Parent.RemoveSubTree(manipulationPoint.Index);
+      manipulationPoint.Parent.InsertSubTree(manipulationPoint.Index, seedNode);
+      int maxSize = Math.Max(oldBranchSize, seedNode.Grammar.GetMinExpressionLength(seedNode.Symbol)) * 2;
+      var bla = ProbabilisticTreeCreator.PTC2(random, seedNode, maxSize, maxSize, 0, 0);
+      success = true;
+    }
+
+    private static Symbol SelectRandomSymbol(IRandom random, IEnumerable<Symbol> symbols) {
+      var symbolList = symbols.ToList();
+      var ticketsSum = symbolList.Select(x => x.InitialFrequency).Sum();
+      if (ticketsSum == 0.0) throw new ArgumentException("The initial frequency of all allowed symbols is zero.");
+      var r = random.NextDouble() * ticketsSum;
+      double aggregatedTickets = 0;
+      for (int i = 0; i < symbolList.Count; i++) {
+        aggregatedTickets += symbolList[i].InitialFrequency;
+        if (aggregatedTickets > r) {
+          return symbolList[i];
+        }
+      }
+      // this should never happen
+      throw new ArgumentException("There is a problem with the initial frequency setting of allowed symbols.");
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/SymbolicExpressionTreeManipulator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/SymbolicExpressionTreeManipulator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/SymbolicExpressionTreeManipulator.cs	(revision 4803)
@@ -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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("SymbolicExpressionTreeManipulator", "A base class for operators that manipulate symbolic expression trees.")]
+  [StorableClass]
+  public abstract class SymbolicExpressionTreeManipulator : SymbolicExpressionTreeOperator, ISymbolicExpressionTreeManipulator {
+    private const string FailedManipulationEventsParameterName = "FailedManipulationEvents";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+
+    #region Parameter Properties
+    public IValueParameter<IntValue> FailedManipulationEventsParameter {
+      get { return (IValueParameter<IntValue>)Parameters[FailedManipulationEventsParameterName]; }
+    }
+    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public IntValue FailedManipulationEvents {
+      get { return FailedManipulationEventsParameter.Value; }
+    }
+    public SymbolicExpressionTree SymbolicExpressionTree {
+      get { return SymbolicExpressionTreeParameter.ActualValue; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeManipulator(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTreeManipulator(SymbolicExpressionTreeManipulator original, Cloner cloner) : base(original, cloner) { }
+    public SymbolicExpressionTreeManipulator()
+      : base() {
+      Parameters.Add(new ValueParameter<IntValue>(FailedManipulationEventsParameterName, "The number of failed manipulation events.", new IntValue()));
+      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied."));
+    }
+
+    public sealed override IOperation Apply() {
+      SymbolicExpressionTree tree = SymbolicExpressionTreeParameter.ActualValue;
+      bool success;
+      Manipulate(RandomParameter.ActualValue, tree, SymbolicExpressionGrammarParameter.ActualValue,
+        MaxTreeSizeParameter.ActualValue, MaxTreeHeightParameter.ActualValue, out success);
+
+      if (!success) FailedManipulationEvents.Value++;
+      return base.Apply();
+    }
+
+    protected abstract void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar,
+      IntValue maxTreeSize, IntValue maxTreeHeight, out bool success);
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.cs	(revision 4803)
@@ -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.1.0")]
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.frame
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.frame	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Properties/AssemblyInfo.frame	(revision 4803)
@@ -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.1.$WCREV$")]
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTree.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTree.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTree.cs	(revision 4803)
@@ -0,0 +1,92 @@
+#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.Drawing;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  [Item("SymbolicExpressionTree", "Represents a symbolic expression tree.")]
+  public class SymbolicExpressionTree : Item {
+    public override Image ItemImage {
+      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Function; }
+    }
+    [Storable]
+    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 {
+        if (root == null)
+          return 0;
+        return root.GetSize();
+      }
+    }
+
+    public int Height {
+      get {
+        if (root == null)
+          return 0;
+        return root.GetHeight();
+      }
+    }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTree(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTree(SymbolicExpressionTree original, Cloner cloner)
+      : base(original, cloner) {
+      root = cloner.Clone(original.Root);
+    }
+    public SymbolicExpressionTree() : base() { }
+    public SymbolicExpressionTree(SymbolicExpressionTreeNode root)
+      : base() {
+      this.Root = root;
+    }
+
+    public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPrefix() {
+      if (root == null)
+        return new SymbolicExpressionTreeNode[0];
+      return root.IterateNodesPrefix();
+    }
+    public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPostfix() {
+      if (root == null)
+        return new SymbolicExpressionTreeNode[0];
+      return root.IterateNodesPostfix();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTree(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeGrammar.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeGrammar.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeGrammar.cs	(revision 4803)
@@ -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 HeuristicLab.Common;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  public sealed class SymbolicExpressionTreeGrammar : DefaultSymbolicExpressionGrammar {
+    public SymbolicExpressionTreeGrammar(ISymbolicExpressionGrammar grammar)
+      : base(grammar) {
+    }
+    [StorableConstructor]
+    private SymbolicExpressionTreeGrammar(bool deserializing) : base(deserializing) { }
+    // don't call storable ctor of base class to prevent full cloning
+    // instead use storable ctor to initialize an empty grammar and fill with InizializeShallowClone
+    private SymbolicExpressionTreeGrammar(SymbolicExpressionTreeGrammar original, Cloner cloner)
+      : base(false) {
+      cloner.RegisterClonedObject(original, this);
+      InitializeShallowClone(original);
+    }
+    private SymbolicExpressionTreeGrammar() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeGrammar(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs	(revision 4803)
@@ -0,0 +1,195 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  public class SymbolicExpressionTreeNode : DeepCloneable {
+    [Storable]
+    private IList<SymbolicExpressionTreeNode> subTrees;
+    [Storable]
+    private Symbol symbol;
+
+    // cached values to prevent unnecessary tree iterations
+    private short size;
+    private short height;
+
+    public Symbol Symbol {
+      get { return symbol; }
+      protected set { symbol = value; }
+    }
+
+    // parent relation is not persisted or cloned (will be set on AddSubtree or RemoveSubtree)
+    private SymbolicExpressionTreeNode parent;
+    internal SymbolicExpressionTreeNode Parent {
+      get { return parent; }
+      set { parent = value; }
+    }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeNode(bool deserializing) { }
+    protected SymbolicExpressionTreeNode(SymbolicExpressionTreeNode original, Cloner cloner)
+      : base() {
+      symbol = original.symbol; // symbols are reused
+      subTrees = new List<SymbolicExpressionTreeNode>(original.SubTrees.Count);
+      foreach (var subtree in original.SubTrees) {
+        var clonedSubTree = cloner.Clone(subtree);
+        subTrees.Add(clonedSubTree);
+        clonedSubTree.Parent = this;
+      }
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeNode(this, cloner);
+    }
+
+    internal SymbolicExpressionTreeNode()
+      : base() {
+      // don't allocate subtrees list here!
+      // because we don't want to allocate it in terminal nodes
+    }
+
+    public SymbolicExpressionTreeNode(Symbol symbol)
+      : base() {
+      subTrees = new List<SymbolicExpressionTreeNode>(3);
+      this.symbol = symbol;
+    }
+
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      foreach (var subtree in SubTrees) {
+        subtree.Parent = this;
+      }
+    }
+
+    public virtual bool HasLocalParameters {
+      get { return false; }
+    }
+
+    public virtual IList<SymbolicExpressionTreeNode> SubTrees {
+      get { return subTrees; }
+    }
+
+    public virtual ISymbolicExpressionGrammar Grammar {
+      get { return parent.Grammar; }
+    }
+
+    public int GetSize() {
+      if (size > 0) return size;
+      else {
+        size = 1;
+        if (SubTrees != null) {
+          for (int i = 0; i < SubTrees.Count; i++) {
+            checked { size += (short)SubTrees[i].GetSize(); }
+          }
+        }
+        return size;
+      }
+    }
+
+    public int GetHeight() {
+      if (height > 0) return height;
+      else {
+        if (SubTrees != null) {
+          for (int i = 0; i < SubTrees.Count; i++) height = Math.Max(height, (short)SubTrees[i].GetHeight());
+        }
+        height++;
+        return height;
+      }
+    }
+
+    public virtual void ResetLocalParameters(IRandom random) { }
+    public virtual void ShakeLocalParameters(IRandom random, double shakingFactor) { }
+
+    public virtual void AddSubTree(SymbolicExpressionTreeNode tree) {
+      SubTrees.Add(tree);
+      tree.Parent = this;
+      ResetCachedValues();
+    }
+
+    public virtual void InsertSubTree(int index, SymbolicExpressionTreeNode tree) {
+      SubTrees.Insert(index, tree);
+      tree.Parent = this;
+      ResetCachedValues();
+    }
+
+    public virtual void RemoveSubTree(int index) {
+      SubTrees[index].Parent = null;
+      SubTrees.RemoveAt(index);
+      ResetCachedValues();
+    }
+
+    public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPrefix() {
+      List<SymbolicExpressionTreeNode> list = new List<SymbolicExpressionTreeNode>();
+      ForEachNodePrefix((n) => list.Add(n));
+      return list;
+    }
+
+    public void ForEachNodePrefix(Action<SymbolicExpressionTreeNode> a) {
+      a(this);
+      if (SubTrees != null) {
+        for (int i = 0; i < SubTrees.Count; i++) {
+          SubTrees[i].ForEachNodePrefix(a);
+        }
+      }
+    }
+
+    public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPostfix() {
+      List<SymbolicExpressionTreeNode> list = new List<SymbolicExpressionTreeNode>();
+      ForEachNodePostfix((n) => list.Add(n));
+      return list;
+    }
+
+    public void ForEachNodePostfix(Action<SymbolicExpressionTreeNode> a) {
+      if (SubTrees != null) {
+        for (int i = 0; i < SubTrees.Count; i++) {
+          SubTrees[i].ForEachNodePostfix(a);
+        }
+      }
+      a(this);
+    }
+
+    public IEnumerable<Symbol> GetAllowedSymbols(int argumentIndex) {
+      return Grammar.Symbols.Where(s => Grammar.IsAllowedChild(Symbol, s, argumentIndex));
+    }
+    public int GetMinSubtreeCount() {
+      return Grammar.GetMinSubtreeCount(Symbol);
+    }
+    public int GetMaxSubtreeCount() {
+      return Grammar.GetMaxSubtreeCount(Symbol);
+    }
+    public override string ToString() {
+      return Symbol.Name;
+    }
+
+    private void ResetCachedValues() {
+      size = 0; height = 0;
+      if (parent != null) parent.ResetCachedValues();
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeOperator.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeOperator.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeOperator.cs	(revision 4803)
@@ -0,0 +1,88 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
+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 for symbolic expression trees.
+  /// </summary>
+  [Item("SymbolicExpressionTreeOperator", "A base class for operators for symbolic expression trees.")]
+  [StorableClass]
+  public abstract class SymbolicExpressionTreeOperator : SingleSuccessorOperator, IStochasticOperator, ISymbolicExpressionTreeOperator {
+    private const string RandomParameterName = "Random";
+    private const string MaxTreeSizeParameterName = "MaxTreeSize";
+    private const string MaxTreeHeightParameterName = "MaxTreeHeight";
+    private const string SymbolicExpressionGrammarParameterName = "SymbolicExpressionGrammar";
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    #region Parameter Properties
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters[RandomParameterName]; }
+    }
+    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]; }
+    }
+    #endregion
+
+    #region Properties
+    public IRandom Random {
+      get { return RandomParameter.ActualValue; }
+    }
+    public IntValue MaxTreeSize {
+      get { return MaxTreeSizeParameter.ActualValue; }
+    }
+    public IntValue MaxTreeHeight {
+      get { return MaxTreeHeightParameter.ActualValue; }
+    }
+    public ISymbolicExpressionGrammar SymbolicExpressionGrammar {
+      get { return SymbolicExpressionGrammarParameter.ActualValue; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeOperator(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTreeOperator(SymbolicExpressionTreeOperator original, Cloner cloner) : base(original, cloner) { }
+    protected SymbolicExpressionTreeOperator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The pseudo random number generator which should be used for symbolic expression tree operators."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeSizeParameterName, "The maximal size (number of nodes) of the symbolic expression tree."));
+      Parameters.Add(new ValueLookupParameter<IntValue>(MaxTreeHeightParameterName, "The maximal height of the symbolic expression tree (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."));
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeStringFormatter.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeStringFormatter.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeStringFormatter.cs	(revision 4803)
@@ -0,0 +1,62 @@
+﻿#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.Text;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  
+  public class SymbolicExpressionTreeStringFormatter {
+    
+    public bool Indent { get; set; }
+    
+    public SymbolicExpressionTreeStringFormatter()
+      : base() {
+      Indent = true;
+    }
+
+    public string Format(SymbolicExpressionTree symbolicExpressionTree) {
+      return FormatRecursively(symbolicExpressionTree.Root, 0);
+    }
+
+    private string FormatRecursively(SymbolicExpressionTreeNode node, int indentLength) {
+      StringBuilder strBuilder = new StringBuilder();
+      if (Indent) strBuilder.Append(' ', indentLength);
+      strBuilder.Append("(");
+      // internal nodes or leaf nodes?
+      if (node.SubTrees.Count > 0) {
+        // symbol on same line as '('
+        strBuilder.AppendLine(node.ToString());
+        // each subtree expression on a new line
+        // and closing ')' also on new line
+        foreach (var subtree in node.SubTrees) {
+          strBuilder.AppendLine(FormatRecursively(subtree, indentLength + 2));
+        }
+        if (Indent) strBuilder.Append(' ', indentLength);
+        strBuilder.Append(")");
+      } else {
+        // symbol in the same line with as '(' and ')'
+        strBuilder.Append(node.ToString());
+        strBuilder.Append(")");
+      }
+      return strBuilder.ToString();
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTerminalNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTerminalNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTerminalNode.cs	(revision 4803)
@@ -0,0 +1,64 @@
+#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 HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  public abstract class SymbolicExpressionTreeTerminalNode : SymbolicExpressionTreeNode {
+    private static List<SymbolicExpressionTreeNode> emptyList = new List<SymbolicExpressionTreeNode>();
+    public override IList<SymbolicExpressionTreeNode> SubTrees {
+      get {
+        return SymbolicExpressionTreeTerminalNode.emptyList;
+      }
+    }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeTerminalNode(bool deserializing) : base(deserializing) { }
+    // don't call storable constructor of base to prevent allocation of sub-trees list in base!
+    protected SymbolicExpressionTreeTerminalNode(SymbolicExpressionTreeTerminalNode original, Cloner cloner)
+      : base() {
+      // symbols are reused
+      this.Symbol = original.Symbol;
+    }
+    protected SymbolicExpressionTreeTerminalNode() : base() { }
+
+    protected SymbolicExpressionTreeTerminalNode(Symbol symbol)
+      : base() {
+      // symbols are reused
+      this.Symbol = symbol;
+    }
+
+    public override void AddSubTree(SymbolicExpressionTreeNode tree) {
+      throw new NotSupportedException();
+    }
+    public override void InsertSubTree(int index, SymbolicExpressionTreeNode tree) {
+      throw new NotSupportedException();
+    }
+    public override void RemoveSubTree(int index) {
+      throw new NotSupportedException();
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTopLevelNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTopLevelNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTopLevelNode.cs	(revision 4803)
@@ -0,0 +1,52 @@
+#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.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
+  [StorableClass]
+  public class SymbolicExpressionTreeTopLevelNode : SymbolicExpressionTreeNode {
+    [Storable]
+    private ISymbolicExpressionGrammar grammar;
+    public override ISymbolicExpressionGrammar Grammar {
+      get { return grammar; }
+    }
+    public void SetGrammar(ISymbolicExpressionGrammar grammar) {
+      this.grammar = grammar;
+    }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeTopLevelNode(bool deserializing) : base(deserializing) { }
+    protected SymbolicExpressionTreeTopLevelNode(SymbolicExpressionTreeTopLevelNode original, Cloner cloner)
+      : base(original, cloner) {
+      grammar = cloner.Clone(original.Grammar);
+    }
+    public SymbolicExpressionTreeTopLevelNode() : base() { }
+    public SymbolicExpressionTreeTopLevelNode(Symbol symbol) : base(symbol) { }
+
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeTopLevelNode(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs	(revision 4803)
@@ -0,0 +1,65 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  /// <summary>
+  /// Symbol for function arguments
+  /// </summary>
+  [StorableClass]
+  [Item(Argument.ArgumentName, Argument.ArgumentDescription)]
+  public sealed class Argument : ReadOnlySymbol {
+    public const string ArgumentName = "Argument";
+    public const string ArgumentDescription = "Symbol that represents a function argument.";
+    [Storable]
+    private int argumentIndex;
+    public int ArgumentIndex {
+      get { return argumentIndex; }
+    }
+
+    public override bool CanChangeDescription {
+      get { return false; }
+    }
+
+    [StorableConstructor]
+    private Argument(bool deserializing) : base(deserializing) { }
+    private Argument(Argument original, Cloner cloner)
+      : base(original, cloner) {
+      argumentIndex = original.argumentIndex;
+      name = "ARG" + original.argumentIndex;
+    }
+    public Argument(int argumentIndex)
+      : base("ARG" + argumentIndex, Argument.ArgumentDescription) {
+      this.argumentIndex = argumentIndex;
+      this.name = "ARG" + argumentIndex;
+    }
+
+    public override SymbolicExpressionTreeNode CreateTreeNode() {
+      return new ArgumentTreeNode(this);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Argument(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs	(revision 4803)
@@ -0,0 +1,46 @@
+#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.Common;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  public sealed class ArgumentTreeNode : SymbolicExpressionTreeTerminalNode {
+    internal new Argument Symbol {
+      get { return (Argument)base.Symbol; }
+      set {
+        if (value == null) throw new ArgumentNullException();
+        if (!(value is Argument)) throw new ArgumentException();
+        base.Symbol = value;
+      }
+    }
+
+    [StorableConstructor]
+    private ArgumentTreeNode(bool deserializing) : base(deserializing) { }
+    private ArgumentTreeNode(ArgumentTreeNode original, Cloner cloner) : base(original, cloner) { }
+    public ArgumentTreeNode(Argument argSymbol) : base(argSymbol) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ArgumentTreeNode(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Defun.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Defun.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Defun.cs	(revision 4803)
@@ -0,0 +1,48 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  /// <summary>
+  /// Symbol for function defining branches
+  /// </summary>
+  [StorableClass]
+  [Item(Defun.DefunName, Defun.DefunDescription)]
+  public sealed class Defun : ReadOnlySymbol {
+    public const string DefunName = "Defun";
+    public const string DefunDescription = "Symbol that represents a function defining node.";
+
+    [StorableConstructor]
+    private Defun(bool deserializing) : base(deserializing) { }
+    private Defun(Defun original, Cloner cloner) : base(original, cloner) { }
+    public Defun() : base(Defun.DefunName, Defun.DefunDescription) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Defun(this, cloner);
+    }
+
+    public override SymbolicExpressionTreeNode CreateTreeNode() {
+      return new DefunTreeNode(this);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs	(revision 4803)
@@ -0,0 +1,58 @@
+#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.Common;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  public sealed class DefunTreeNode : SymbolicExpressionTreeTopLevelNode {
+    private int numberOfArguments;
+    [Storable]
+    public int NumberOfArguments {
+      get { return numberOfArguments; }
+      set { numberOfArguments = value; }
+    }
+    private string functionName;
+    [Storable]
+    public string FunctionName {
+      get { return functionName; }
+      set { this.functionName = value; }
+    }
+
+    [StorableConstructor]
+    private DefunTreeNode(bool deserializing) : base(deserializing) { }
+    private DefunTreeNode(DefunTreeNode original, Cloner cloner)
+      : base(original, cloner) {
+      functionName = original.functionName;
+      numberOfArguments = original.numberOfArguments;
+    }
+
+    public DefunTreeNode(Defun defunSymbol) : base(defunSymbol) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new DefunTreeNode(this, cloner);
+    }
+
+    public override string ToString() {
+      return FunctionName;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs	(revision 4803)
@@ -0,0 +1,70 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  /// <summary>
+  /// Symbol for invoking automatically defined functions
+  /// </summary>
+  [StorableClass]
+  [Item(InvokeFunction.InvokeFunctionName, InvokeFunction.InvokeFunctionDescription)]
+  public sealed class InvokeFunction : ReadOnlySymbol {
+    public const string InvokeFunctionName = "InvokeFunction";
+    public const string InvokeFunctionDescription = "Symbol that the invocation of another function.";
+    public override bool CanChangeName {
+      get {
+        return false;
+      }
+    }
+    [Storable]
+    private string functionName;
+    public string FunctionName {
+      get { return functionName; }
+      set {
+        if (value == null) throw new ArgumentNullException();
+        functionName = value;
+      }
+    }
+
+    [StorableConstructor]
+    private InvokeFunction(bool deserializing) : base(deserializing) { }
+    private InvokeFunction(InvokeFunction original, Cloner cloner)
+      : base(original, cloner) {
+      functionName = original.functionName;
+      name = "Invoke: " + original.functionName;
+    }
+    public InvokeFunction(string functionName)
+      : base("Invoke: " + functionName, InvokeFunction.InvokeFunctionDescription) {
+      this.FunctionName = functionName;
+    }
+
+    public override SymbolicExpressionTreeNode CreateTreeNode() {
+      return new InvokeFunctionTreeNode(this);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new InvokeFunction(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs	(revision 4803)
@@ -0,0 +1,46 @@
+#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.Common;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  public sealed class InvokeFunctionTreeNode : SymbolicExpressionTreeNode {
+    public new InvokeFunction Symbol {
+      get { return (InvokeFunction)base.Symbol; }
+      internal set {
+        if (value == null) throw new ArgumentNullException();
+        if (!(value is InvokeFunction)) throw new ArgumentNullException();
+        base.Symbol = value;
+      }
+    }
+
+    [StorableConstructor]
+    private InvokeFunctionTreeNode(bool deserializing) : base(deserializing) { }
+    private InvokeFunctionTreeNode(InvokeFunctionTreeNode original, Cloner cloner) : base(original, cloner) { }
+    public InvokeFunctionTreeNode(InvokeFunction invokeSymbol) : base(invokeSymbol) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new InvokeFunctionTreeNode(this, cloner);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ProgramRootSymbol.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ProgramRootSymbol.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ProgramRootSymbol.cs	(revision 4803)
@@ -0,0 +1,44 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  [Item(ProgramRootSymbol.ProgramRootSymbolName, ProgramRootSymbol.ProgramRootSymbolDescription)]
+  public sealed class ProgramRootSymbol : ReadOnlySymbol {
+    public const string ProgramRootSymbolName = "ProgramRootSymbol";
+    public const string ProgramRootSymbolDescription = "Special symbol that represents the program root node of a symbolic expression tree.";
+
+    [StorableConstructor]
+    private ProgramRootSymbol(bool deserializing) : base(deserializing) { }
+    private ProgramRootSymbol(ProgramRootSymbol original, Cloner cloner) : base(original, cloner) { }
+    public ProgramRootSymbol() : base(ProgramRootSymbol.ProgramRootSymbolName, ProgramRootSymbol.ProgramRootSymbolDescription) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ProgramRootSymbol(this, cloner);
+    }
+    public override SymbolicExpressionTreeNode CreateTreeNode() {
+      return new SymbolicExpressionTreeTopLevelNode(this);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ReadOnlySymbol.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ReadOnlySymbol.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ReadOnlySymbol.cs	(revision 4803)
@@ -0,0 +1,43 @@
+#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  [Item("ReadOnlySymbol", "Represents a symbol in a symbolic function tree that cannot be modified.")]
+  public abstract class ReadOnlySymbol : Symbol {
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    public override bool CanChangeDescription {
+      get { return false; }
+    }
+
+    [StorableConstructor]
+    protected ReadOnlySymbol(bool deserializing) : base(deserializing) { }
+    protected ReadOnlySymbol(ReadOnlySymbol original, Cloner cloner) : base(original, cloner) { }
+    protected ReadOnlySymbol(string name, string description) : base(name, description) { }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbol.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbol.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbol.cs	(revision 4803)
@@ -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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  [Item(StartSymbol.StartSymbolName, StartSymbol.StartSymbolDescription)]
+  public sealed class StartSymbol : ReadOnlySymbol {
+    public const string StartSymbolName = "StartSymbol";
+    public const string StartSymbolDescription = "Special symbol that represents the starting node of the result producing branch of a symbolic expression tree.";
+
+    [StorableConstructor]
+    private StartSymbol(bool deserializing) : base(deserializing) { }
+    private StartSymbol(StartSymbol original, Cloner cloner) : base(original, cloner) { }
+    public StartSymbol() : base(StartSymbol.StartSymbolName, StartSymbol.StartSymbolDescription) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new StartSymbol(this, cloner);
+    }
+
+    public override SymbolicExpressionTreeNode CreateTreeNode() {
+      return new SymbolicExpressionTreeTopLevelNode(this);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbolTreeNode.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbolTreeNode.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbolTreeNode.cs	(revision 4803)
@@ -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 HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.GeneralSymbols {
+  [StorableClass]
+  public sealed class StartSymbolTreeNode : SymbolicExpressionTreeTopLevelNode {
+    // copy constructor
+    private StartSymbolTreeNode(StartSymbolTreeNode original)
+      : base(original) {
+    }
+
+    public StartSymbolTreeNode(StartSymbol startSymbol) : base(startSymbol) { }
+
+    public override object Clone() {
+      return new StartSymbolTreeNode(this);
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs	(revision 4803)
@@ -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 System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
+  [StorableClass]
+  [Item("Symbol", "Represents a symbol in a symbolic function tree.")]
+  public abstract class Symbol : NamedItem {
+    #region Properties
+    [Storable]
+    private double initialFrequency;
+    public double InitialFrequency {
+      get { return initialFrequency; }
+      set {
+        if (value < 0.0) throw new ArgumentException("InitialFrequency must be positive");
+        if (value != initialFrequency) {
+          initialFrequency = value;
+          OnChanged(EventArgs.Empty);
+        }
+      }
+    }
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected Symbol(bool deserializing) : base(deserializing) { }
+    protected Symbol(Symbol original, Cloner cloner)
+      : base(original, cloner) {
+      initialFrequency = original.initialFrequency;
+    }
+    protected Symbol()
+      : base() {
+      initialFrequency = 1.0;
+    }
+
+    protected Symbol(string name, string description)
+      : base(name, description) {
+      initialFrequency = 1.0;
+    }
+
+
+    public virtual SymbolicExpressionTreeNode CreateTreeNode() {
+      return new SymbolicExpressionTreeNode(this);
+    }
+
+    #region events
+    public event EventHandler Changed;
+    protected void OnChanged(EventArgs e) {
+      EventHandler handlers = Changed;
+      if (handlers != null)
+        handlers(this, e);
+    }
+    #endregion
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/AllArchitectureAlteringOperatorsTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/AllArchitectureAlteringOperatorsTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/AllArchitectureAlteringOperatorsTest.cs	(revision 4803)
@@ -0,0 +1,108 @@
+﻿#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.Diagnostics;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class AllArchitectureAlteringOperatorsTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int N_ITERATIONS = 20;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void AllArchitectureAlteringOperatorsDistributionTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var newTrees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      int failedEvents = 0;
+      IntValue maxTreeSize = new IntValue(100);
+      IntValue maxTreeHeigth = new IntValue(10);
+      IntValue maxDefuns = new IntValue(3);
+      IntValue maxArgs = new IntValue(3);
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Stopwatch stopwatch = new Stopwatch();
+      stopwatch.Start();
+      var combinedAAOperator = new MultiSymbolicExpressionTreeArchitectureManipulator();
+      for (int g = 0; g < N_ITERATIONS; g++) {
+        for (int i = 0; i < POPULATION_SIZE; i++) {
+          if (random.NextDouble() < 0.5) {
+            // manipulate
+            var selectedTree = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
+            var op = combinedAAOperator.Operators.SelectRandom(random);
+            bool success = false;
+            op.ModifyArchitecture(random, selectedTree, grammar, maxTreeSize, maxTreeHeigth, maxDefuns, maxArgs, out success);
+            if (!success) failedEvents++;
+            Util.IsValid(selectedTree);
+            newTrees.Add(selectedTree);
+          } else {
+            // crossover
+            var par0 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
+            var par1 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
+            bool success;
+            newTrees.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, 100, 10, out success));
+            if (!success) failedEvents++;
+          }
+        }
+        trees = newTrees;
+      }
+      stopwatch.Stop();
+      var msPerOperation = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE / (double)N_ITERATIONS;
+      Assert.Inconclusive("AllArchitectureAlteringOperators: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE / N_ITERATIONS * 100 + " %" + Environment.NewLine +
+        "Operations / s: ~" + Math.Round(1000.0 / (msPerOperation)) + "operations / s)" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 200, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentCreaterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentCreaterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentCreaterTest.cs	(revision 4803)
@@ -0,0 +1,73 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class ArgumentCreaterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void ArgumentCreaterDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        if (!ArgumentCreater.CreateNewArgument(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3))
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("ArgumentCreator: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 200, 20) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentDeleterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentDeleterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentDeleterTest.cs	(revision 4803)
@@ -0,0 +1,73 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class ArgumentDeleterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void ArgumentDeleterDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        if (!ArgumentDeleter.DeleteArgument(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3))
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("ArgumentDeleter: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentDuplicaterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentDuplicaterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentDuplicaterTest.cs	(revision 4803)
@@ -0,0 +1,73 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class ArgumentDuplicaterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void ArgumentDuplicaterDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister();
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        if (!ArgumentDuplicater.DuplicateArgument(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3))
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("ArgumentDuplicater: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 200, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ChangeNodeTypeManipulationTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ChangeNodeTypeManipulationTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ChangeNodeTypeManipulationTest.cs	(revision 4803)
@@ -0,0 +1,75 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class ChangeNodeTypeManipulationTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void ChangeNodeTypeManipulationDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister();
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        bool success;
+        ChangeNodeTypeManipulation.ChangeNodeType(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, out success);
+        if (!success)
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("ChangeNodeTypeManipulation: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Grammars.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Grammars.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Grammars.cs	(revision 4803)
@@ -0,0 +1,128 @@
+﻿#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.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  public static class Grammars {
+    private class Addition : Symbol {
+      protected Addition(Addition original, Cloner cloner) : base(original, cloner) { }
+      public Addition() : base("Addition", "") { }
+      public override IDeepCloneable Clone(Cloner cloner) {
+        return new Addition(this, cloner);
+      }
+    }
+    private class Subtraction : Symbol {
+      protected Subtraction(Subtraction original, Cloner cloner) : base(original, cloner) { }
+      public Subtraction() : base("Subtraction", "") { }
+      public override IDeepCloneable Clone(Cloner cloner) {
+        return new Subtraction(this, cloner);
+      }
+    }
+    private class Multiplication : Symbol {
+      protected Multiplication(Multiplication original, Cloner cloner) : base(original, cloner) { }
+      public Multiplication() : base("Multiplication", "") { }
+      public override IDeepCloneable Clone(Cloner cloner) {
+        return new Multiplication(this, cloner);
+      }
+    }
+    private class Division : Symbol {
+      protected Division(Division original, Cloner cloner) : base(original, cloner) { }
+      public Division() : base("Division", "") { }
+      public override IDeepCloneable Clone(Cloner cloner) {
+        return new Division(this, cloner);
+      }
+    }
+    private class Terminal : Symbol {
+      protected Terminal(Terminal original, Cloner cloner) : base(original, cloner) { }
+      public Terminal() : base("Terminal", "") { }
+      public override IDeepCloneable Clone(Cloner cloner) {
+        return new Terminal(this, cloner);
+      }
+    }
+
+    private class SimpleArithmeticGrammar : DefaultSymbolicExpressionGrammar {
+      protected SimpleArithmeticGrammar(SimpleArithmeticGrammar original, Cloner cloner) : base(original, cloner) { }
+      public SimpleArithmeticGrammar()
+        : base() {
+        Initialize();
+      }
+
+      public override IDeepCloneable Clone(Cloner cloner) {
+        return new SimpleArithmeticGrammar(this, cloner);
+      }
+
+      private void Initialize() {
+        var add = new Addition();
+        var sub = new Subtraction();
+        var mul = new Multiplication();
+        var div = new Division();
+        var terminal = new Terminal();
+
+        var allSymbols = new List<Symbol>() { add, sub, mul, div, terminal };
+        var functionSymbols = new List<Symbol>() { add, sub, mul, div };
+        foreach (var symb in allSymbols)
+          AddSymbol(symb);
+
+        foreach (var funSymb in functionSymbols) {
+          SetMinSubtreeCount(funSymb, 1);
+          SetMaxSubtreeCount(funSymb, 3);
+        }
+        SetMinSubtreeCount(terminal, 0);
+        SetMaxSubtreeCount(terminal, 0);
+
+        // allow each symbol as child of the start symbol
+        foreach (var symb in allSymbols) {
+          SetAllowedChild(StartSymbol, symb, 0);
+        }
+
+        // allow each symbol as child of every other symbol (except for terminals that have maxSubtreeCount == 0)
+        foreach (var parent in allSymbols) {
+          for (int i = 0; i < GetMaxSubtreeCount(parent); i++)
+            foreach (var child in allSymbols) {
+              SetAllowedChild(parent, child, i);
+            }
+        }
+      }
+    }
+
+    public static ISymbolicExpressionGrammar CreateSimpleArithmeticGrammar() {
+      var g = new GlobalSymbolicExpressionGrammar(new SimpleArithmeticGrammar());
+      g.MaxFunctionArguments = 0;
+      g.MinFunctionArguments = 0;
+      g.MaxFunctionDefinitions = 0;
+      g.MinFunctionDefinitions = 0;
+      return g;
+    }
+
+    public static ISymbolicExpressionGrammar CreateArithmeticAndAdfGrammar() {
+      var g = new GlobalSymbolicExpressionGrammar(new SimpleArithmeticGrammar());
+      g.MaxFunctionArguments = 3;
+      g.MinFunctionArguments = 0;
+      g.MaxFunctionDefinitions = 3;
+      g.MinFunctionDefinitions = 0;
+      return g;
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests.csproj
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests.csproj	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests.csproj	(revision 4803)
@@ -0,0 +1,190 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" 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>{8824925E-3E00-4543-8293-7DDACE4737F8}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests</RootNamespace>
+    <AssemblyName>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation />
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ArgumentCreaterTest.cs" />
+    <Compile Include="ArgumentDeleterTest.cs" />
+    <Compile Include="ArgumentDuplicaterTest.cs" />
+    <Compile Include="AllArchitectureAlteringOperatorsTest.cs" />
+    <Compile Include="ChangeNodeTypeManipulationTest.cs" />
+    <Compile Include="ReplaceBranchManipulationTest.cs" />
+    <Compile Include="SubroutineDeleterTest.cs" />
+    <Compile Include="SubroutineDuplicaterTest.cs" />
+    <Compile Include="Grammars.cs" />
+    <Compile Include="SubroutineCreaterTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SubtreeCrossoverTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Util.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ProbabilisticTreeCreaterTest.cs" />
+  </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\3.3\HeuristicLab.Common-3.3.csproj">
+      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
+      <Name>HeuristicLab.Common-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.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\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</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>
+    <ProjectReference Include="..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj">
+      <Project>{125D3006-67F5-48CB-913E-73C0548F17FA}</Project>
+      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\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>
+  -->
+</Project>
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ProbabilisticTreeCreaterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ProbabilisticTreeCreaterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ProbabilisticTreeCreaterTest.cs	(revision 4803)
@@ -0,0 +1,89 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class ProbabilisticTreeCreaterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void ProbabilisticTreeCreaterDistributionsTest() {
+      var randomTrees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateSimpleArithmeticGrammar();
+      var random = new MersenneTwister(31415);
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        randomTrees.Add(ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 0, 0));
+      }
+
+      foreach (var tree in randomTrees) {
+        Util.IsValid(tree);
+      }
+      Assert.Inconclusive("ProbabilisticTreeCreator: " + Environment.NewLine +
+        Util.GetSizeDistributionString(randomTrees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(randomTrees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine
+        );
+    }
+
+
+    [TestMethod()]
+    public void ProbabilisticTreeCreaterWithAdfDistributionsTest() {
+      var randomTrees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        Util.IsValid(tree);
+        randomTrees.Add(tree);
+      }
+      Assert.Inconclusive("ProbabilisticTreeCreator: " + Environment.NewLine +
+        Util.GetSizeDistributionString(randomTrees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(randomTrees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(randomTrees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Properties/AssemblyInfo.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Properties/AssemblyInfo.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Properties/AssemblyInfo.cs	(revision 4803)
@@ -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.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.Tests")]
+[assembly: AssemblyCopyright("Copyright ©  2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM componenets.  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("e232a6a8-a54f-4629-8962-98c1597f1b8d")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ReplaceBranchManipulationTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ReplaceBranchManipulationTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ReplaceBranchManipulationTest.cs	(revision 4803)
@@ -0,0 +1,77 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class ReplaceBranchManipulationTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void ReplaceBranchManipulationDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        bool success;
+        ReplaceBranchManipulation.ReplaceRandomBranch(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, out success);
+        if (!success) {
+          failedEvents++;
+        } else {
+          Util.IsValid(tree);
+          trees.Add(tree);
+        }
+      }
+      Assert.Inconclusive("ReplaceBranchManipulation: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineCreaterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineCreaterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineCreaterTest.cs	(revision 4803)
@@ -0,0 +1,73 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class SubroutineCreaterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void SubroutineCreaterDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        if (!SubroutineCreater.CreateSubroutine(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3))
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("SubroutineCreator: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineDeleterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineDeleterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineDeleterTest.cs	(revision 4803)
@@ -0,0 +1,73 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class SubroutineDeleterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void SubroutineDeleterDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister(31415);
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        if (!SubroutineDeleter.DeleteSubroutine(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3))
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("SubroutineDeleter: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineDuplicaterTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineDuplicaterTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubroutineDuplicaterTest.cs	(revision 4803)
@@ -0,0 +1,73 @@
+﻿#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 HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class SubroutineDuplicaterTest {
+    private const int POPULATION_SIZE = 1000;
+    private const int MAX_TREE_SIZE = 100;
+    private const int MAX_TREE_HEIGHT = 10;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void SubroutineDuplicaterDistributionsTest() {
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister();
+      int failedEvents = 0;
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
+        if (!SubroutineDuplicater.DuplicateSubroutine(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3))
+          failedEvents++;
+        Util.IsValid(tree);
+        trees.Add(tree);
+      }
+      Assert.Inconclusive("SubroutineDuplicater: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubtreeCrossoverTest.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubtreeCrossoverTest.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/SubtreeCrossoverTest.cs	(revision 4803)
@@ -0,0 +1,92 @@
+﻿#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.Diagnostics;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  [TestClass]
+  public class SubtreeCrossoverTest {
+    private const int POPULATION_SIZE = 1000;
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    [TestMethod()]
+    public void SubtreeCrossoverDistributionsTest() {
+      int generations = 5;
+      var trees = new List<SymbolicExpressionTree>();
+      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
+      var random = new MersenneTwister();
+      int failedEvents = 0;
+      List<SymbolicExpressionTree> crossoverTrees;
+      double msPerCrossoverEvent;
+
+      for (int i = 0; i < POPULATION_SIZE; i++) {
+        trees.Add(ProbabilisticTreeCreator.Create(random, grammar, 100, 10, 3, 3));
+      }
+      Stopwatch stopwatch = new Stopwatch();
+      stopwatch.Start();
+      for (int gCount = 0; gCount < generations; gCount++) {
+        var newPopulation = new List<SymbolicExpressionTree>();
+        for (int i = 0; i < POPULATION_SIZE; i++) {
+          var par0 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
+          var par1 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone();
+          bool success;
+          newPopulation.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, 100, 10, out success));
+          if (!success) failedEvents++;
+        }
+        crossoverTrees = newPopulation;
+      }
+      stopwatch.Stop();
+      foreach (var tree in trees)
+        Util.IsValid(tree);
+
+      msPerCrossoverEvent = stopwatch.ElapsedMilliseconds / (double)POPULATION_SIZE / (double)generations;
+
+      Assert.Inconclusive("SubtreeCrossover: " + Environment.NewLine +
+        "Failed events: " + failedEvents / (double)POPULATION_SIZE * 100 + " %" + Environment.NewLine +
+        msPerCrossoverEvent + " ms per crossover event (~" + Math.Round(1000.0 / (msPerCrossoverEvent)) + "crossovers / s)" + Environment.NewLine +
+        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
+        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
+        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
+        Util.GetTerminalDistributionString(trees) + Environment.NewLine
+        );
+    }
+  }
+}
Index: /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Util.cs
===================================================================
--- /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Util.cs	(revision 4803)
+++ /branches/SmalltalkExport/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/Util.cs	(revision 4803)
@@ -0,0 +1,149 @@
+﻿#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.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
+  public static class Util {
+    public static string GetSizeDistributionString(IList<SymbolicExpressionTree> trees, int maxTreeSize, int binSize) {
+      int[] histogram = new int[maxTreeSize / binSize];
+      for (int i = 0; i < trees.Count; i++) {
+        int binIndex = Math.Min(histogram.Length - 1, trees[i].Size / binSize);
+        histogram[binIndex]++;
+      }
+      StringBuilder strBuilder = new StringBuilder();
+      for (int i = 0; i < histogram.Length - 1; i++) {
+        strBuilder.Append(Environment.NewLine);
+        strBuilder.Append("< "); strBuilder.Append((i + 1) * binSize);
+        strBuilder.Append(": "); strBuilder.AppendFormat("{0:#0.00%}", histogram[i] / (double)trees.Count);
+      }
+      strBuilder.Append(Environment.NewLine);
+      strBuilder.Append(">= "); strBuilder.Append(histogram.Length * binSize);
+      strBuilder.Append(": "); strBuilder.AppendFormat("{0:#0.00%}", histogram[histogram.Length - 1] / (double)trees.Count);
+
+      return "Size distribution: " + strBuilder;
+    }
+
+    public static string GetFunctionDistributionString(IList<SymbolicExpressionTree> trees) {
+      Dictionary<string, int> occurances = new Dictionary<string, int>();
+      double n = 0.0;
+      for (int i = 0; i < trees.Count; i++) {
+        foreach (var node in trees[i].IterateNodesPrefix()) {
+          if (node.SubTrees.Count > 0) {
+            if (!occurances.ContainsKey(node.Symbol.Name))
+              occurances[node.Symbol.Name] = 0;
+            occurances[node.Symbol.Name]++;
+            n++;
+          }
+        }
+      }
+      StringBuilder strBuilder = new StringBuilder();
+      foreach (var function in occurances.Keys) {
+        strBuilder.Append(Environment.NewLine);
+        strBuilder.Append(function); strBuilder.Append(": ");
+        strBuilder.AppendFormat("{0:#0.00%}", occurances[function] / n);
+      }
+      return "Function distribution: " + strBuilder;
+    }
+
+    public static string GetNumberOfSubTreesDistributionString(IList<SymbolicExpressionTree> trees) {
+      Dictionary<int, int> occurances = new Dictionary<int, int>();
+      double n = 0.0;
+      for (int i = 0; i < trees.Count; i++) {
+        foreach (var node in trees[i].IterateNodesPrefix()) {
+          if (!occurances.ContainsKey(node.SubTrees.Count))
+            occurances[node.SubTrees.Count] = 0;
+          occurances[node.SubTrees.Count]++;
+          n++;
+        }
+      }
+      StringBuilder strBuilder = new StringBuilder();
+      foreach (var arity in occurances.Keys) {
+        strBuilder.Append(Environment.NewLine);
+        strBuilder.Append(arity); strBuilder.Append(": ");
+        strBuilder.AppendFormat("{0:#0.00%}", occurances[arity] / n);
+      }
+      return "Distribution of function arities: " + strBuilder;
+    }
+
+
+    public static string GetTerminalDistributionString(IList<SymbolicExpressionTree> trees) {
+      Dictionary<string, int> occurances = new Dictionary<string, int>();
+      double n = 0.0;
+      for (int i = 0; i < trees.Count; i++) {
+        foreach (var node in trees[i].IterateNodesPrefix()) {
+          if (node.SubTrees.Count == 0) {
+            if (!occurances.ContainsKey(node.Symbol.Name))
+              occurances[node.Symbol.Name] = 0;
+            occurances[node.Symbol.Name]++;
+            n++;
+          }
+        }
+      }
+      StringBuilder strBuilder = new StringBuilder();
+      foreach (var function in occurances.Keys) {
+        strBuilder.Append(Environment.NewLine);
+        strBuilder.Append(function); strBuilder.Append(": ");
+        strBuilder.AppendFormat("{0:#0.00%}", occurances[function] / n);
+      }
+      return "Terminal distribution: " + strBuilder;
+    }
+
+    public static void IsValid(SymbolicExpressionTree tree) {
+      int reportedSize = tree.Size;
+      int actualSize = tree.IterateNodesPostfix().Count();
+      Assert.AreEqual(actualSize, reportedSize);
+
+      foreach (var defunTreeNode in tree.Root.SubTrees.OfType<DefunTreeNode>()) {
+        int arity = defunTreeNode.NumberOfArguments;
+        var invoke = new InvokeFunction(defunTreeNode.FunctionName);
+        foreach (var otherRootNode in tree.Root.SubTrees) {
+          if (otherRootNode.Grammar.ContainsSymbol(invoke)) {
+            Assert.IsTrue(otherRootNode.Grammar.GetMinSubtreeCount(invoke) == arity);
+            Assert.IsTrue(otherRootNode.Grammar.GetMaxSubtreeCount(invoke) == arity);
+          }
+        }
+      }
+      //Assert.AreEqual(tree.Root.Symbol, tree.Root.Grammar.StartSymbol);
+      //foreach (var subtree in tree.Root.SubTrees)
+      //  Assert.AreNotSame(subtree.Grammar, tree.Root.Grammar);
+      IsValid(tree.Root);
+    }
+
+    public static void IsValid(SymbolicExpressionTreeNode treeNode) {
+      var matchingSymbol = (from symb in treeNode.Grammar.Symbols
+                            where symb.Name == treeNode.Symbol.Name
+                            select symb).SingleOrDefault();
+      Assert.IsTrue(treeNode.SubTrees.Count >= treeNode.Grammar.GetMinSubtreeCount(matchingSymbol));
+      Assert.IsTrue(treeNode.SubTrees.Count <= treeNode.Grammar.GetMaxSubtreeCount(matchingSymbol));
+      for (int i = 0; i < treeNode.SubTrees.Count; i++) {
+        Assert.IsTrue(treeNode.GetAllowedSymbols(i).Select(x => x.Name).Contains(treeNode.SubTrees[i].Symbol.Name));
+        IsValid(treeNode.SubTrees[i]);
+      }
+    }
+  }
+}
Index: /branches/SmalltalkExport/PreBuildEvent.cmd
===================================================================
--- /branches/SmalltalkExport/PreBuildEvent.cmd	(revision 4803)
+++ /branches/SmalltalkExport/PreBuildEvent.cmd	(revision 4803)
@@ -0,0 +1,1 @@
+SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
Index: /branches/SmalltalkExport/SmalltalkExport.sln
===================================================================
--- /branches/SmalltalkExport/SmalltalkExport.sln	(revision 4803)
+++ /branches/SmalltalkExport/SmalltalkExport.sln	(revision 4803)
@@ -0,0 +1,46 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+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.Encodings.SymbolicExpressionTreeEncoding.Views-3.3", "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views\3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.csproj", "{6F42C5F8-16CD-43EE-8208-FD4573A69D85}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Debug|x64.ActiveCfg = Debug|x64
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Debug|x64.Build.0 = Debug|x64
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Debug|x86.ActiveCfg = Debug|x86
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Debug|x86.Build.0 = Debug|x86
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|Any CPU.Build.0 = Release|Any CPU
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|x64.ActiveCfg = Release|x64
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|x64.Build.0 = Release|x64
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|x86.ActiveCfg = Release|x86
+		{125D3006-67F5-48CB-913E-73C0548F17FA}.Release|x86.Build.0 = Release|x86
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Debug|x64.ActiveCfg = Debug|x64
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Debug|x64.Build.0 = Debug|x64
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Debug|x86.ActiveCfg = Debug|x86
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Debug|x86.Build.0 = Debug|x86
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Release|x64.ActiveCfg = Release|x64
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Release|x64.Build.0 = Release|x64
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Release|x86.ActiveCfg = Release|x86
+		{6F42C5F8-16CD-43EE-8208-FD4573A69D85}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Index: /branches/SmalltalkExport/UpdateLocalInstallation.cmd
===================================================================
--- /branches/SmalltalkExport/UpdateLocalInstallation.cmd	(revision 4803)
+++ /branches/SmalltalkExport/UpdateLocalInstallation.cmd	(revision 4803)
@@ -0,0 +1,4 @@
+set target=C:\Program Files\HeuristicLab 3.3\
+
+copy "%SolutionDir%\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.3\%Outdir%\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll" "%target%"
+copy "%SolutionDir%\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views\3.3\%Outdir%\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.dll" "%target%"
