Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs	(revision 7778)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs	(revision 7779)
@@ -26,5 +26,5 @@
 
 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
-  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7514")]
+  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.7522")]
   [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Analysis", "3.3")]
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.Designer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.Designer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.Designer.cs	(revision 7779)
@@ -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
+
+namespace HeuristicLab.EvolutionaryTracking.Views {
+  partial class GenealogyGraphChart {
+    /// <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.SuspendLayout();
+      // 
+      // GenealogyGraphChart
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Name = "GenealogyGraphChart";
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    //private System.Windows.Forms.ToolTip toolTip;
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.cs	(revision 7779)
@@ -0,0 +1,246 @@
+﻿#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.Drawing2D;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Visualization;
+
+namespace HeuristicLab.EvolutionaryTracking.Views {
+  public partial class GenealogyGraphChart : ChartControl {
+    private Dictionary<GenealogyGraphNode, List<VisualGenealogyGraphNode>> _visualNodeMap;
+    private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> _visualArcMap;
+    private const int Diameter = 20;
+    private int x, y;
+    private const int Cx = 30, Cy = 30;
+
+    private VisualGenealogyGraphNode _selectedGenealogyGraphNode;
+    public VisualGenealogyGraphNode SelectedGenealogyGraphNode { get { return _selectedGenealogyGraphNode; } }
+    private Visualization.Rectangle _targetRectangle; // provides a  rectangle mark of the currently selected genealogy graph node
+
+    private SymbolicExpressionTreeGenealogyGraph _graph;
+    public SymbolicExpressionTreeGenealogyGraph Graph {
+      get { return _graph; }
+      internal set {
+        _graph = value;
+        _visualNodeMap = new Dictionary<GenealogyGraphNode, List<VisualGenealogyGraphNode>>();
+        _visualArcMap = new Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc>();
+        DrawGraph();
+      }
+    }
+
+    public event MouseEventHandler GenealogyGraphNodeClicked;
+    private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
+      var clicked = GenealogyGraphNodeClicked;
+      if (clicked != null) clicked(sender, e);
+    }
+
+    public GenealogyGraphChart() {
+      Chart = new Chart(0, 0, PreferredSize.Width, PreferredSize.Height);
+      x = 0;
+      y = PreferredSize.Height + Cx + 2 * Diameter;
+    }
+
+    public void DrawGraph() {
+      if (_graph == null) return;
+      Chart.UpdateEnabled = false;
+      var layers = Graph.Values.GroupBy(node => node.Rank).OrderBy(g => g.Key);
+      // show elites in every graph level
+      List<GenealogyGraphNode> currLayer = null, prevLayer = null;
+      double currRank = 0.0;
+      int count = layers.Count();
+      for (int i = 0; i != count; ++i) {
+        // propagate elites from successive layers
+        if (currRank == (int)currRank) prevLayer = currLayer;
+        currRank = layers.ElementAt(i).Key;
+        currLayer = layers.ElementAt(i).ToList();
+        if (i > 0 && currRank == (int)currRank) {
+          // this code injects elites that propagate from the previous generation into the current graph layer, so that they can be represented as visual nodes
+          int prevCount = prevLayer.Count(node => node.IsElite);
+          int currCount = currLayer.Count(node => node.IsElite);
+          for (int j = currCount; j < prevCount; ++j) currLayer.Add(prevLayer.ElementAt(j));
+        }
+        currLayer.Sort(); // uses the CompareTo() method inside the GenealogyGraphNode class
+
+        foreach (var node in currLayer) {
+          var pen = new Pen(Color.LightGray);
+          var nl = Environment.NewLine;
+          var visualNode = new VisualGenealogyGraphNode(Chart, x, y, x + Diameter, y + Diameter, pen, null) {
+            Data = node, ToolTipText = "Id: " + node.Label + nl + "Rank: " + node.Rank + nl + "Quality: " + String.Format("{0:0.0000}", node.Quality) + nl + "IsElite: " + node.IsElite
+          };
+          Chart.Group.Add(visualNode);
+          if (!_visualNodeMap.ContainsKey(node)) _visualNodeMap[node] = new List<VisualGenealogyGraphNode>();
+          _visualNodeMap[node].Add(visualNode);
+          // connect visual nodes that actually represent the same individual in the genealogy graph (this applies for elites) with a dashed line
+          if (_visualNodeMap[node].Count > 1) {
+            for (int c = _visualNodeMap[node].Count; c >= 2; --c) {
+              var n1 = _visualNodeMap[node][c - 1];
+              var n2 = _visualNodeMap[node][c - 2];
+              var visualArc = AddArc(Chart, n1, n2, new Pen(Color.LightGray) { DashStyle = DashStyle.Dash });
+              _visualArcMap[Tuple.Create(n1, n2)] = visualArc;
+            }
+          }
+          x += Cx; // increment horizontal coordinate
+          if (node.InEdges == null) continue;
+          // add visual edges
+          foreach (var arc in node.InEdges) {
+            var parent = arc.Target;
+            // find the visual parent node that is closest to the current node in terms of vertical distance
+            var visualParent = _visualNodeMap[parent].Where(p => p.Center.Y > visualNode.Center.Y).OrderByDescending(p => p.Center.Y).Last();
+            DashStyle style;
+            if (visualParent.Data == visualNode.Data) {
+              style = DashStyle.Dash;
+            } else {
+              style = arc.OperatorType == 0 ? DashStyle.Solid : DashStyle.Dash;
+            }
+            var arcPen = new Pen(Color.Transparent) { DashStyle = style };
+            _visualArcMap[Tuple.Create(visualParent, visualNode)] = AddArc(Chart, visualParent, visualNode, arcPen);
+          }
+        }
+        y -= Cy; // decrement vertical coordinate (because the origin is upside down)
+        x = 0; // reset horizontal coordinate
+      }
+
+      Chart.UpdateEnabled = true;
+      Chart.EnforceUpdate();
+    }
+
+    // add an arc between the source and the target nodes, using the specified pen color
+    // adds the arc to the arc lists of both nodes and to the primitive group of the chart
+    private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) {
+      var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush };
+      arc.UpdatePosition();
+      source.OutgoingArcs.Add(arc);
+      target.IncomingArcs.Add(arc);
+      chart.Group.Add(arc);
+      return arc;
+    }
+
+    protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) {
+      if (Chart.Mode != ChartMode.Select)
+        base.pictureBox_MouseUp(sender, e);
+      else { // select mode
+        Chart.UpdateEnabled = false;
+        // clear colors
+        foreach (var primitive in Chart.Group.Primitives) {
+          if (primitive is VisualGenealogyGraphNode) {
+            var visualNode = primitive as VisualGenealogyGraphNode;
+            visualNode.Brush = null;
+          } else if (primitive is VisualGenealogyGraphArc) {
+            var visualArc = primitive as VisualGenealogyGraphArc;
+            if (visualArc.Source.Data != visualArc.Target.Data) visualArc.Pen.Brush = new SolidBrush(Color.Transparent);
+          }
+        }
+        // get selected node
+        var visualNodes = Chart.GetAllPrimitives(e.Location).Where(p => p is VisualGenealogyGraphNode).ToList();
+        if (visualNodes.Count > 0) {
+          _selectedGenealogyGraphNode = visualNodes[0] as VisualGenealogyGraphNode;
+          // color selected node and its genealogy
+          if (_selectedGenealogyGraphNode == null) return;
+          var gNode = _selectedGenealogyGraphNode.Data; // genealogy graph node (representing an individual in the population) 
+          double rank = gNode.Rank;
+          var ancestors = gNode.Ancestors().Where(a => a.Rank < rank).ToList();
+          ancestors.Add(gNode);
+          // use special highlighting for the currently selected genealogy graph node
+          var center = _selectedGenealogyGraphNode.Center;
+          var size = _selectedGenealogyGraphNode.Size;
+          double x1 = center.X - size.Width / 2, x2 = x1 + size.Width;
+          double y1 = center.Y - size.Height / 2, y2 = y1 + size.Height;
+          if (_targetRectangle != null) _targetRectangle.SetPosition(x1, y1, x2, y2);
+          else {
+            _targetRectangle = new Visualization.Rectangle(Chart, x1, y1, x2, y2, new Pen(Color.Black), null);
+            Chart.Group.Add(_targetRectangle);
+          }
+          // highlight selected node and its ancestry
+          foreach (var node in ancestors.SelectMany(n => _visualNodeMap[n])) {
+            node.Brush = new SolidBrush(node.ToColor());
+            if (node.IncomingArcs != null && node == _visualNodeMap[node.Data].First())
+              foreach (var arc in node.IncomingArcs) {
+                if (arc.Source.Data == node.Data) continue;
+                var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
+                var end = new Point((int)arc.End.X, (int)arc.End.Y);
+                arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
+                if (node.Data.CutpointIndex == -1) { // if the cut index wasn't computed yet
+                  var parent = arc.Source.Data.Data as ISymbolicExpressionTree;
+                  var child = node.Data.Data as ISymbolicExpressionTree;
+                  node.Data.CutpointIndex = GetCutIndex(parent, child);
+                }
+              }
+          }
+          // highlight the descendants
+          var descendants = gNode.Descendants().Where(a => a.Rank > rank).ToList();
+          descendants.Add(gNode);
+          foreach (var node in descendants.SelectMany(n => _visualNodeMap[n])) {
+            node.Brush = new SolidBrush(node.ToColor());
+            foreach (var arc in node.IncomingArcs.Where(a => descendants.Contains(a.Source.Data))) {
+              if (arc.Source.Data == node.Data) continue;
+              var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
+              var end = new Point((int)arc.End.X, (int)arc.End.Y);
+              arc.Pen.Brush = new LinearGradientBrush(start, end, arc.Source.ToColor(), arc.Target.ToColor());
+            }
+          }
+        } else {
+          _selectedGenealogyGraphNode = null;
+        }
+        // update
+        Chart.UpdateEnabled = true;
+        Chart.EnforceUpdate();
+        if (_selectedGenealogyGraphNode != null) /* emit clicked event */ OnGenealogyGraphNodeClicked(_selectedGenealogyGraphNode, e);
+      }
+    }
+
+    public void ClearAllNodes() {
+      Chart.UpdateEnabled = false;
+      foreach (var node in Chart.Group.Primitives.Where(p => p is VisualGenealogyGraphNode).Cast<VisualGenealogyGraphNode>()) {
+        node.Brush = null;
+        if (node.IncomingArcs != null)
+          foreach (var arc in node.IncomingArcs)
+            if (arc.Source.Data != node.Data) arc.Pen = new Pen(Color.Transparent);
+      }
+      Chart.UpdateEnabled = true;
+      Chart.EnforceUpdate();
+    }
+
+    public void HighlightNodes(IEnumerable<ISymbolicExpressionTree> trees, Color color) {
+      Chart.UpdateEnabled = false;
+      foreach (var visualNode in trees.Select(tree => _visualNodeMap[Graph.GetNode(tree)]).SelectMany(vList => vList))
+        visualNode.Brush = new SolidBrush(color);
+
+      Chart.UpdateEnabled = true;
+      Chart.EnforceUpdate();
+    }
+
+    // maybe this method does't belong here
+    // TODO: find a good location for this kind of functionality
+    private static int GetCutIndex(ISymbolicExpressionTree parent, ISymbolicExpressionTree child) {
+      var e1 = parent.IterateNodesPostfix().GetEnumerator();
+      var e2 = child.IterateNodesPostfix().GetEnumerator();
+      int pos = -1;
+      var comparer = new SymbolicExpressionTreeGenealogyGraph.SymbolicExpressionTreeNodeComparer(0);
+      while (e1.MoveNext() && e2.MoveNext() && comparer.Equals(e1.Current, e2.Current)) ++pos;
+      return pos;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.Designer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.Designer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.Designer.cs	(revision 7779)
@@ -0,0 +1,244 @@
+﻿
+namespace HeuristicLab.EvolutionaryTracking.Views {
+  partial class GenealogyGraphView {
+    /// <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.mainTableLayout = new System.Windows.Forms.TableLayoutPanel();
+      this.splitContainer = new System.Windows.Forms.SplitContainer();
+      this.topControlBox = new System.Windows.Forms.GroupBox();
+      this.similarityModeLabel = new System.Windows.Forms.Label();
+      this.similarityModeSelector = new System.Windows.Forms.ComboBox();
+      this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
+      this.genealogyTableLayout = new System.Windows.Forms.TableLayoutPanel();
+      this.graphControlsPanel = new System.Windows.Forms.Panel();
+      this.selectModeButton = new System.Windows.Forms.RadioButton();
+      this.moveModeButton = new System.Windows.Forms.RadioButton();
+      this.zoomModeButton = new System.Windows.Forms.RadioButton();
+      this.genealogyGraphChart = new HeuristicLab.EvolutionaryTracking.Views.GenealogyGraphChart();
+      this.mainTableLayout.SuspendLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+      this.splitContainer.Panel1.SuspendLayout();
+      this.splitContainer.Panel2.SuspendLayout();
+      this.splitContainer.SuspendLayout();
+      this.topControlBox.SuspendLayout();
+      this.genealogyTableLayout.SuspendLayout();
+      this.graphControlsPanel.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // mainTableLayout
+      // 
+      this.mainTableLayout.ColumnCount = 1;
+      this.mainTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+      this.mainTableLayout.Controls.Add(this.splitContainer, 0, 1);
+      this.mainTableLayout.Controls.Add(this.topControlBox, 0, 0);
+      this.mainTableLayout.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.mainTableLayout.Location = new System.Drawing.Point(0, 0);
+      this.mainTableLayout.Name = "mainTableLayout";
+      this.mainTableLayout.RowCount = 2;
+      this.mainTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
+      this.mainTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+      this.mainTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+      this.mainTableLayout.Size = new System.Drawing.Size(528, 443);
+      this.mainTableLayout.TabIndex = 6;
+      // 
+      // splitContainer
+      // 
+      this.splitContainer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+      this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.splitContainer.Location = new System.Drawing.Point(3, 53);
+      this.splitContainer.Name = "splitContainer";
+      // 
+      // splitContainer.Panel1
+      // 
+      this.splitContainer.Panel1.Controls.Add(this.genealogyTableLayout);
+      this.splitContainer.Panel1MinSize = 50;
+      // 
+      // splitContainer.Panel2
+      // 
+      this.splitContainer.Panel2.Controls.Add(this.symbolicExpressionTreeChart);
+      this.splitContainer.Panel2MinSize = 50;
+      this.splitContainer.Size = new System.Drawing.Size(522, 387);
+      this.splitContainer.SplitterDistance = 241;
+      this.splitContainer.TabIndex = 7;
+      // 
+      // topControlBox
+      // 
+      this.topControlBox.Controls.Add(this.similarityModeLabel);
+      this.topControlBox.Controls.Add(this.similarityModeSelector);
+      this.topControlBox.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.topControlBox.Location = new System.Drawing.Point(3, 3);
+      this.topControlBox.Name = "topControlBox";
+      this.topControlBox.Size = new System.Drawing.Size(522, 44);
+      this.topControlBox.TabIndex = 6;
+      this.topControlBox.TabStop = false;
+      this.topControlBox.Text = "Controls";
+      // 
+      // similarityModeLabel
+      // 
+      this.similarityModeLabel.AutoSize = true;
+      this.similarityModeLabel.Location = new System.Drawing.Point(6, 20);
+      this.similarityModeLabel.Name = "similarityModeLabel";
+      this.similarityModeLabel.Size = new System.Drawing.Size(80, 13);
+      this.similarityModeLabel.TabIndex = 1;
+      this.similarityModeLabel.Text = "Similarity Mode:";
+      // 
+      // similarityModeSelector
+      // 
+      this.similarityModeSelector.FormattingEnabled = true;
+      this.similarityModeSelector.Items.AddRange(new object[] {
+            "Exact",
+            "High",
+            "Relaxed"});
+      this.similarityModeSelector.Location = new System.Drawing.Point(92, 17);
+      this.similarityModeSelector.Name = "similarityModeSelector";
+      this.similarityModeSelector.Size = new System.Drawing.Size(148, 21);
+      this.similarityModeSelector.TabIndex = 0;
+      this.similarityModeSelector.SelectedIndexChanged += new System.EventHandler(this.similarityModeSelector_SelectedIndexChanged);
+      // 
+      // symbolicExpressionTreeChart
+      // 
+      this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
+      this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
+      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
+      this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
+      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(275, 385);
+      this.symbolicExpressionTreeChart.Spacing = 5;
+      this.symbolicExpressionTreeChart.SuspendRepaint = false;
+      this.symbolicExpressionTreeChart.TabIndex = 2;
+      this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
+      this.symbolicExpressionTreeChart.Tree = null;
+      // 
+      // genealogyTableLayout
+      // 
+      this.genealogyTableLayout.ColumnCount = 1;
+      this.genealogyTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+      this.genealogyTableLayout.Controls.Add(this.genealogyGraphChart, 0, 1);
+      this.genealogyTableLayout.Controls.Add(this.graphControlsPanel, 0, 0);
+      this.genealogyTableLayout.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.genealogyTableLayout.Location = new System.Drawing.Point(0, 0);
+      this.genealogyTableLayout.Name = "genealogyTableLayout";
+      this.genealogyTableLayout.RowCount = 2;
+      this.genealogyTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
+      this.genealogyTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+      this.genealogyTableLayout.Size = new System.Drawing.Size(239, 385);
+      this.genealogyTableLayout.TabIndex = 4;
+      // 
+      // graphControlsPanel
+      // 
+      this.graphControlsPanel.Controls.Add(this.selectModeButton);
+      this.graphControlsPanel.Controls.Add(this.moveModeButton);
+      this.graphControlsPanel.Controls.Add(this.zoomModeButton);
+      this.graphControlsPanel.Location = new System.Drawing.Point(3, 3);
+      this.graphControlsPanel.Name = "graphControlsPanel";
+      this.graphControlsPanel.Size = new System.Drawing.Size(194, 30);
+      this.graphControlsPanel.TabIndex = 0;
+      // 
+      // selectModeButton
+      // 
+      this.selectModeButton.Appearance = System.Windows.Forms.Appearance.Button;
+      this.selectModeButton.AutoSize = true;
+      this.selectModeButton.Location = new System.Drawing.Point(103, 3);
+      this.selectModeButton.Name = "selectModeButton";
+      this.selectModeButton.Size = new System.Drawing.Size(47, 23);
+      this.selectModeButton.TabIndex = 5;
+      this.selectModeButton.TabStop = true;
+      this.selectModeButton.Text = "Select";
+      this.selectModeButton.UseVisualStyleBackColor = true;
+      this.selectModeButton.CheckedChanged += new System.EventHandler(this.selectModeButton_CheckedChanged);
+      // 
+      // moveModeButton
+      // 
+      this.moveModeButton.Appearance = System.Windows.Forms.Appearance.Button;
+      this.moveModeButton.AutoSize = true;
+      this.moveModeButton.Location = new System.Drawing.Point(3, 3);
+      this.moveModeButton.Name = "moveModeButton";
+      this.moveModeButton.Size = new System.Drawing.Size(44, 23);
+      this.moveModeButton.TabIndex = 3;
+      this.moveModeButton.TabStop = true;
+      this.moveModeButton.Text = "Move";
+      this.moveModeButton.UseVisualStyleBackColor = true;
+      this.moveModeButton.CheckedChanged += new System.EventHandler(this.moveModeButton_CheckedChanged);
+      // 
+      // zoomModeButton
+      // 
+      this.zoomModeButton.Appearance = System.Windows.Forms.Appearance.Button;
+      this.zoomModeButton.AutoSize = true;
+      this.zoomModeButton.Location = new System.Drawing.Point(53, 3);
+      this.zoomModeButton.Name = "zoomModeButton";
+      this.zoomModeButton.Size = new System.Drawing.Size(44, 23);
+      this.zoomModeButton.TabIndex = 4;
+      this.zoomModeButton.TabStop = true;
+      this.zoomModeButton.Text = "Zoom";
+      this.zoomModeButton.UseVisualStyleBackColor = true;
+      this.zoomModeButton.CheckedChanged += new System.EventHandler(this.zoomModeButton_CheckedChanged);
+      // 
+      // genealogyGraphChart
+      // 
+      this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control;
+      this.genealogyGraphChart.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.genealogyGraphChart.Location = new System.Drawing.Point(3, 39);
+      this.genealogyGraphChart.Name = "genealogyGraphChart";
+      this.genealogyGraphChart.ScaleOnResize = true;
+      this.genealogyGraphChart.Size = new System.Drawing.Size(233, 343);
+      this.genealogyGraphChart.TabIndex = 2;
+      // 
+      // GenealogyGraphView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.mainTableLayout);
+      this.Name = "GenealogyGraphView";
+      this.Size = new System.Drawing.Size(528, 443);
+      this.mainTableLayout.ResumeLayout(false);
+      this.splitContainer.Panel1.ResumeLayout(false);
+      this.splitContainer.Panel2.ResumeLayout(false);
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+      this.splitContainer.ResumeLayout(false);
+      this.topControlBox.ResumeLayout(false);
+      this.topControlBox.PerformLayout();
+      this.genealogyTableLayout.ResumeLayout(false);
+      this.graphControlsPanel.ResumeLayout(false);
+      this.graphControlsPanel.PerformLayout();
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.TableLayoutPanel mainTableLayout;
+    private System.Windows.Forms.SplitContainer splitContainer;
+    private System.Windows.Forms.GroupBox topControlBox;
+    private System.Windows.Forms.Label similarityModeLabel;
+    private System.Windows.Forms.ComboBox similarityModeSelector;
+    private Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart symbolicExpressionTreeChart;
+    private System.Windows.Forms.TableLayoutPanel genealogyTableLayout;
+    private GenealogyGraphChart genealogyGraphChart;
+    private System.Windows.Forms.Panel graphControlsPanel;
+    private System.Windows.Forms.RadioButton selectModeButton;
+    private System.Windows.Forms.RadioButton moveModeButton;
+    private System.Windows.Forms.RadioButton zoomModeButton;
+
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs	(revision 7779)
@@ -0,0 +1,177 @@
+﻿#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.Drawing;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
+using HeuristicLab.MainForm;
+using HeuristicLab.Visualization;
+
+namespace HeuristicLab.EvolutionaryTracking.Views {
+  [View("SymbolicExpressionTreeGenealogyGraph")]
+  [Content(typeof(SymbolicExpressionTreeGenealogyGraph), IsDefaultView = true)]
+  public sealed partial class GenealogyGraphView : ItemView {
+    private VisualSymbolicExpressionTreeNode _selectedVisualSymbolicExpressionTreeNode;
+
+    public new SymbolicExpressionTreeGenealogyGraph Content {
+      get { return (SymbolicExpressionTreeGenealogyGraph)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public GenealogyGraphView()
+      : base() {
+      InitializeComponent();
+      similarityModeSelector.SelectedIndex = 0; // set default similarity mode to "exact"
+    }
+
+    protected override void DeregisterContentEvents() {
+      // TODO: Deregister your event handlers here
+      genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
+      symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked -= treeChart_SymbolicExpressionTreeNodeClicked;
+      base.DeregisterContentEvents();
+    }
+
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      // TODO: Register your event handlers here
+      genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
+      symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionTreeNodeClicked;
+    }
+
+    #region Event Handlers (Content)
+    // TODO: Put event handlers of the content here
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content == null)
+        genealogyGraphChart.Graph = null;
+      else {
+        genealogyGraphChart.Graph = Content;
+        var best = Content.Values.OrderByDescending(x => x.Quality).First();
+        symbolicExpressionTreeChart.Tree = (ISymbolicExpressionTree)best.Data;
+      }
+    }
+
+    private void Content_GraphChanged(object sender, EventArgs e) {
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      genealogyGraphChart.Enabled = Content != null;
+    }
+    #endregion
+
+    #region Event Handlers (child controls)
+
+    // TODO: Put event handlers of child controls here.
+    private void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
+      // the hierarchy goes like this: VisualGenealogyGraphNode --> GenealogyGraphNode --> symbolicExpressionTree
+      var visualGenealogyGraphNode = (VisualGenealogyGraphNode)sender;
+      var genealogyGraphNode = (GenealogyGraphNode)visualGenealogyGraphNode.Data;
+      symbolicExpressionTreeChart.Tree = (ISymbolicExpressionTree)genealogyGraphNode.Data;
+      if (_selectedVisualSymbolicExpressionTreeNode != null) {
+        var nodes = symbolicExpressionTreeChart.Tree.IterateNodesPostfix().ToArray();
+        var fragments = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode.IterateNodesPostfix().ToArray();
+        int index = SymbolicExpressionTreeGenealogyGraph.FindMatch(nodes, fragments, similarityModeSelector.SelectedIndex);
+        if (index != -1) {
+          _selectedVisualSymbolicExpressionTreeNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(nodes[index + fragments.Count() - 1]);
+          var subtree = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode;
+          foreach (var visualNode in subtree.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node))) {
+            visualNode.FillColor = Color.LightBlue;
+          }
+          symbolicExpressionTreeChart.Repaint();
+        }
+      }
+      // the cutpoint index represents the index of the node/subtree (when the tree is enumerated in postfix order) 
+      // that was changed (by mutation) or received from a parent (by crossover)
+      if (visualGenealogyGraphNode.Data.CutpointIndex != -1) {
+        var gNode = visualGenealogyGraphNode.Data;
+        var symbExprTree = gNode.Data as ISymbolicExpressionTree;
+        if (symbExprTree == null) return;
+        var nodes = symbExprTree.IterateNodesPostfix();
+        var fragment = nodes.ElementAt(gNode.CutpointIndex);
+        if (fragment != null) foreach (var node in fragment.IterateNodesPostfix()) {
+            var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node);
+            visualNode.FillColor = Color.LightPink;
+          }
+        symbolicExpressionTreeChart.Repaint();
+      }
+    }
+
+    private void moveModeButton_CheckedChanged(object sender, EventArgs e) {
+      var btn = (RadioButton)sender;
+      if (btn.Checked) { genealogyGraphChart.Chart.Mode = ChartMode.Move; }
+    }
+
+    private void zoomModeButton_CheckedChanged(object sender, EventArgs e) {
+      var btn = (RadioButton)sender;
+      if (btn.Checked) { genealogyGraphChart.Chart.Mode = ChartMode.Zoom; }
+    }
+
+    private void selectModeButton_CheckedChanged(object sender, EventArgs e) {
+      var btn = (RadioButton)sender;
+      if (btn.Checked) { genealogyGraphChart.Chart.Mode = ChartMode.Select; }
+    }
+
+    private void treeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
+      _selectedVisualSymbolicExpressionTreeNode = (VisualSymbolicExpressionTreeNode)sender;
+      // find out which individuals in the genealogy graph contain this specific subtree
+      var treeNode = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode;
+      Color[] colors = { Color.LightSkyBlue, Color.PaleGreen, Color.Tan };
+
+      genealogyGraphChart.ClearAllNodes(); // clear node colors
+      // color each graph node according to the degree to which it matches the selected tree fragment
+      foreach (var i in Enum.GetValues(typeof(SymbolicExpressionTreeGenealogyGraph.SimilarityLevel)).Cast<int>().Reverse()) {
+        var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, i).ToList();
+        if (owners.Any()) genealogyGraphChart.HighlightNodes(owners, colors[i]); // highlight matching individuals from the genealogy
+      }
+
+      // highlight subtree nodes in the tree chart
+      foreach (var visualNode in symbolicExpressionTreeChart.Tree.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))
+        visualNode.FillColor = Color.Transparent;
+
+      foreach (var visualNode in treeNode.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))
+        visualNode.FillColor = Color.LightBlue;
+
+      // refresh the tree chart
+      symbolicExpressionTreeChart.Repaint();
+    }
+
+    private void similarityModeSelector_SelectedIndexChanged(object sender, EventArgs e) {
+      if (_selectedVisualSymbolicExpressionTreeNode == null) return;
+      var treeNode = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode;
+      var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, similarityModeSelector.SelectedIndex).ToList();
+      if (owners.Any()) {
+        genealogyGraphChart.ClearAllNodes(); // clear the fill color of all nodes
+        genealogyGraphChart.HighlightNodes(owners, Color.LightSkyBlue); // highlight matching individuals from the genealogy
+      }
+      // highlight subtree nodes in the tree chart
+      foreach (var visualNode in symbolicExpressionTreeChart.Tree.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))
+        visualNode.FillColor = Color.Transparent;
+      foreach (var visualNode in treeNode.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))
+        visualNode.FillColor = Color.LightBlue;
+    }
+    #endregion
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/HeuristicLab.EvolutionaryTracking.Views-3.4.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/HeuristicLab.EvolutionaryTracking.Views-3.4.csproj	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/HeuristicLab.EvolutionaryTracking.Views-3.4.csproj	(revision 7779)
@@ -0,0 +1,138 @@
+﻿<?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>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{318DFE8C-CA23-4F1B-A4AC-62B425060241}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.EvolutionaryTracking.Views</RootNamespace>
+    <AssemblyName>HeuristicLab.EvolutionaryTracking.Views-3.4</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</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>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core.Views-3.3">
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm-3.3">
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Visualization-3.3, Version=3.3.0.5170, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="GenealogyGraphChart.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="GenealogyGraphChart.Designer.cs">
+      <DependentUpon>GenealogyGraphChart.cs</DependentUpon>
+    </Compile>
+    <Compile Include="GenealogyGraphView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="GenealogyGraphView.Designer.cs">
+      <DependentUpon>GenealogyGraphView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Plugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="VisualGenealogyGraphArc.cs" />
+    <Compile Include="VisualGenealogyGraphNode.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.EvolutionaryTracking\3.4\HeuristicLab.EvolutionaryTracking-3.4.csproj">
+      <Project>{1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}</Project>
+      <Name>HeuristicLab.EvolutionaryTracking-3.4</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+  </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>
+  -->
+</Project>
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs	(revision 7779)
@@ -0,0 +1,41 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.EvolutionaryTracking.Views {
+  [Plugin("HeuristicLab.EvolutionaryTracking.Views", "Provides controls and views for the evolution graph and related structures.", "3.4.2.7439")]
+  [PluginFile("HeuristicLab.EvolutionaryTracking.Views-3.4.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  public class HeuristicLabEvolutionaryTrackingPlugin : PluginBase {
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs.frame
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs.frame	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Plugin.cs.frame	(revision 7779)
@@ -0,0 +1,41 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.EvolutionaryTracking {
+  [Plugin("HeuristicLab.EvolutionaryTracking", "Provides operators and related classes for tracking the evolution within a GA.", "3.4.2.7439")]
+  [PluginFile("HeuristicLab.EvolutionaryTracking-3.4.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  public class HeuristicLabEvolutionaryTrackingPlugin : PluginBase {
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/AssemblyInfo.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/AssemblyInfo.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/AssemblyInfo.cs	(revision 7779)
@@ -0,0 +1,36 @@
+﻿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.EvolutionaryTracking.Views")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab.EvolutionaryTracking.Views")]
+[assembly: AssemblyCopyright("Copyright ©  2012")]
+[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("6f37d400-0cd8-4c21-adca-5537e483eed2")]
+
+// 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 Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/Resources.Designer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/Resources.Designer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/Resources.Designer.cs	(revision 7779)
@@ -0,0 +1,63 @@
+﻿//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.261
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace HeuristicLab.EvolutionaryTracking.Views.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.EvolutionaryTracking.Views.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+    }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/Resources.resx
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/Resources.resx	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/Properties/Resources.resx	(revision 7779)
@@ -0,0 +1,120 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphArc.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphArc.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphArc.cs	(revision 7779)
@@ -0,0 +1,83 @@
+﻿#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.Drawing;
+using HeuristicLab.Visualization;
+
+namespace HeuristicLab.EvolutionaryTracking.Views {
+  class VisualGenealogyGraphArc : Line {
+    public VisualGenealogyGraphNode Source;
+    public VisualGenealogyGraphNode Target;
+
+    public VisualGenealogyGraphArc(IChart chart, PointD start, PointD end)
+      : base(chart, start, end) {
+    }
+    public VisualGenealogyGraphArc(IChart chart, double x1, double y1, double x2, double y2)
+      : this(chart, new PointD(x1, y1), new PointD(x2, y2)) {
+    }
+    public VisualGenealogyGraphArc(IChart chart, PointD start, PointD end, Pen pen)
+      : base(chart, start, end, pen) {
+    }
+    public VisualGenealogyGraphArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen)
+      : base(chart, source.Center, target.Center, pen) {
+      Source = source;
+      Target = target;
+      UpdatePosition();
+    }
+    public VisualGenealogyGraphArc(IChart chart, double x1, double y1, double x2, double y2, Pen pen)
+      : this(chart, new PointD(x1, y1), new PointD(x2, y2), pen) {
+    }
+
+    internal void UpdatePosition() {
+      // calculate the positions of the arc ends so that virtually the line will go through the centers of the two elliptical node shapes
+      PointD c1 = Source.Center;
+      PointD c2 = Target.Center;
+      double x = Math.Abs(c1.X - c2.X);
+      double y = Math.Abs(c1.Y - c2.Y);
+      double theta = Math.Atan(y / x); // returns angle in radians
+      // compute the intersection point between an ellipse-shaped node and a line passing through its center with the angular coordinate theta
+      PointD p1 = Source.CalculateIntersection(theta);
+      PointD p2 = Target.CalculateIntersection(theta);
+      // translate coordinates to real-world values
+      double p1X, p1Y, p2X, p2Y;
+      if (c1.X > c2.X) {
+        p1X = c1.X - p1.X;
+        p2X = c2.X + p2.X;
+      } else {
+        p1X = c1.X + p1.X;
+        p2X = c2.X - p2.X;
+      }
+      if (c1.Y > c2.Y) {
+        p1Y = c1.Y - p1.Y;
+        p2Y = c2.Y + p2.Y;
+      } else {
+        p1Y = c1.Y + p1.Y;
+        p2Y = c2.Y - p1.Y;
+      }
+      p1.X = p1X;
+      p1.Y = p1Y;
+      p2.X = p2X;
+      p2.Y = p2Y;
+      SetPosition(p1, p2);
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphNode.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphNode.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphNode.cs	(revision 7779)
@@ -0,0 +1,85 @@
+﻿#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.Visualization;
+
+namespace HeuristicLab.EvolutionaryTracking.Views {
+  public class VisualGenealogyGraphNode : Ellipse {
+    public GenealogyGraphNode Data { get; internal set; }
+    internal List<VisualGenealogyGraphArc> IncomingArcs = new List<VisualGenealogyGraphArc>();
+    internal List<VisualGenealogyGraphArc> OutgoingArcs = new List<VisualGenealogyGraphArc>();
+
+    public VisualGenealogyGraphNode(IChart chart, PointD lowerLeft, PointD upperRight)
+      : base(chart, lowerLeft, upperRight) {
+    }
+    public VisualGenealogyGraphNode(IChart chart, double x1, double y1, double x2, double y2)
+      : this(chart, new PointD(x1, y1), new PointD(x2, y2)) {
+    }
+    public VisualGenealogyGraphNode(IChart chart, PointD lowerLeft, PointD upperRight, Pen pen, Brush brush)
+      : base(chart, lowerLeft, upperRight, pen, brush) {
+    }
+    public VisualGenealogyGraphNode(IChart chart, double x1, double y1, double x2, double y2, Pen pen, Brush brush)
+      : this(chart, new PointD(x1, y1), new PointD(x2, y2), pen, brush) {
+    }
+
+    // compute the intersection point of an ellipse and a line passing through its center with the angular coordinate theta
+    public PointD CalculateIntersection(double theta) {
+      double sin = Math.Sin(theta);
+      double cos = Math.Cos(theta);
+      double a = Size.Width / 2;
+      double b = Size.Height / 2;
+      double r = a * b / Math.Sqrt(Math.Pow(a * sin, 2) + Math.Pow(b * cos, 2)); // radius at intersection point
+      double rx = r * cos; // X-component (relative to the origin/center of the ellipse)
+      double ry = r * sin; // Y-component (relative to the origin/center of the ellipse)
+      return new PointD(rx, ry);
+    }
+
+    public override void SetPosition(PointD lowLeft, PointD upRight) {
+      base.SetPosition(lowLeft, upRight);
+      foreach (var a in IncomingArcs) a.UpdatePosition();
+      foreach (var a in OutgoingArcs) a.UpdatePosition();
+    }
+
+    public PointD Center {
+      get { return new PointD((LowerLeft.X + UpperRight.X) / 2, (LowerLeft.Y + UpperRight.Y) / 2); }
+    }
+
+    public Color ToColor() {
+      return Color.FromArgb((int)((1 - Data.Quality) * 255), (int)(Data.Quality * 255), 0);
+    }
+
+    public override void Draw(Graphics graphics) {
+      if (Data.IsElite) {
+        Point p = Chart.TransformWorldToPixel(new PointD(LowerLeft.X, LowerLeft.Y + Size.Height));
+        Size s = Chart.TransformWorldToPixel(Size);
+        if (Brush != null)
+          graphics.FillEllipse(Brush, p.X, p.Y, s.Width, s.Height);
+        graphics.DrawEllipse(Pen, p.X, p.Y, s.Width, s.Height);
+        graphics.DrawEllipse(Pen, p.X + 2, p.Y + 2, s.Width - 4, s.Height - 4);
+      } else {
+        base.Draw(graphics);
+      }
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs	(revision 7778)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Analyzers/SymbolicExpressionTreeGenealogyAnalyzer.cs	(revision 7779)
@@ -22,4 +22,5 @@
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Globalization;
 using System.Linq;
@@ -36,5 +37,4 @@
 using HeuristicLab.Problems.DataAnalysis;
 using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
 using CloneMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItem>;
 using TraceMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItemList<HeuristicLab.Core.IItem>>;
@@ -47,4 +47,6 @@
   [StorableClass]
   public sealed class SymbolicExpressionTreeGenealogyAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    public enum GeneticOperator { Crossover, Mutation }
+
     private const string UpdateIntervalParameterName = "UpdateInterval";
     private const string UpdateCounterParameterName = "UpdateCounter";
@@ -213,10 +215,10 @@
         var gScope = ExecutionContext.Scope;
         while (gScope.Parent != null) gScope = gScope.Parent;
-        GenealogyGraph graph;
+        SymbolicExpressionTreeGenealogyGraph graph;
         if (!Results.ContainsKey(PopulationGraphResultParameterName)) {
-          graph = new GenealogyGraph();
+          graph = new SymbolicExpressionTreeGenealogyGraph();
           Results.Add(new Result(PopulationGraphResultParameterName, PopulationGraphResultParameterDescription, graph));
         } else {
-          graph = (GenealogyGraph)Results[PopulationGraphResultParameterName].Value;
+          graph = (SymbolicExpressionTreeGenealogyGraph)Results[PopulationGraphResultParameterName].Value;
         }
         // get tree quality values
@@ -225,5 +227,5 @@
                          let quality = (DoubleValue)s.Variables["Quality"].Value
                          orderby quality.Value descending
-                         select new Tuple<IItem, double>(individual, quality.Value)).ToDictionary(t => t.Item1, t => t.Item2);
+                         select new Tuple<ISymbolicExpressionTree, double>((ISymbolicExpressionTree)individual, quality.Value)).ToDictionary(t => t.Item1, t => t.Item2);
 
         // add all individuals to the evolutionary graph
@@ -232,6 +234,5 @@
 
         if (generation == 0) {
-          // at generation 0 no trace map is present (since no reproduction has taken place yet), 
-          // so we only add the initial trees as nodes in the genealogy graph
+          // at generation 0 no trace map is present (since no reproduction has taken place yet), so we only add the initial trees as nodes in the genealogy graph
           for (int i = 0; i != qualities.Count; ++i) {
             var tree = qualities.ElementAt(i).Key;
@@ -242,77 +243,75 @@
         }
 
+        // add nodes to genealogy graph
         for (int i = 0; i != qualities.Count; ++i) {
           var child = qualities.ElementAt(i).Key;
           label = (generation * qualities.Count + i + 1).ToString(CultureInfo.InvariantCulture);
-          if (i < Elites.Value) {
-            if (graph.HasNode(child))
-              graph.GetNode(child).Label += "\\n" + label;
-            else
-              graph.AddNode(child, qualities[child], label, generation, true);
-          } else
-            graph.AddNode(child, qualities[child], label, generation);
+          if (!graph.HasNode(child)) graph.AddNode(child, qualities[child], label, generation, i < Elites.Value);
           if (!GlobalTraceMap.ContainsKey(child)) continue;
           var parents = GlobalTraceMap[child];
+
           foreach (var parent in parents) {
+            int opType;
             if (GlobalTraceMap.ContainsKey(parent)) {
               double quality = Evaluate((ISymbolicExpressionTree)parent);
-              graph.AddNode(parent, quality, "", generation - 0.5);
-              foreach (var p in GlobalTraceMap[parent])
-                graph.AddArc(p, parent);
+              graph.AddNode((ISymbolicExpressionTree)parent, quality, "", generation - 0.5);
+              var pp = GlobalTraceMap[parent];
+              foreach (var p in pp) {
+                opType = pp.Count == 2 ? (int)GeneticOperator.Crossover : (int)GeneticOperator.Mutation;
+                graph.AddArc((ISymbolicExpressionTree)p, (ISymbolicExpressionTree)parent, opType);
+              }
             }
-            graph.AddArc(parent, child);
+            opType = parents.Count == 2 ? (int)GeneticOperator.Crossover : (int)GeneticOperator.Mutation;
+            graph.AddArc((ISymbolicExpressionTree)parent, child, opType);
           }
         }
 
+        // clear trace and clone maps in preparation for the next generation
         GlobalTraceMap.Clear();
         GlobalCloneMap.Clear();
 
-        #region end of the run
-        bool maxGenerationsReached = (Generations.Value == MaximumGenerations.Value);
-        bool isOsga = (SelectionPressure != null && MaximumSelectionPressure != null);
-        bool maxSelectionPressureReached = isOsga && (SelectionPressure.Value >= MaximumSelectionPressure.Value);
-        if (maxGenerationsReached || maxSelectionPressureReached) {
-          var path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
-
-          // write whole graph to a dot file
-          WriteDot(path + @"\lineage.dot", graph);
-
-          // get genealogy of the best solution
-          var bestSolution = (ISymbolicExpressionTree)qualities.First().Key;
-          var genealogy = graph.GetNode(bestSolution).Genealogy();
-          WriteDot(path + @"\bestlineage.dot", genealogy);
-
-          // write the direct root lineage of the best solution (is it useful?)
-
-          // calculate impact values of nodes in the best solution, attempt to trace those with high impact to their origins
-          var calculator = new SymbolicRegressionSolutionValuesCalculator();
-          var impactValues = calculator.CalculateImpactValues(bestSolution, SymbolicExpressionInterpreter, SymbolicRegressionProblemData, 0, 0);
-          foreach (var pair in impactValues.Where(pair => !(pair.Key is ConstantTreeNode || pair.Key is VariableTreeNode) && pair.Value > 0.9)) {
-            var node = pair.Key;
-
-            foreach (var ancestor in genealogy.Keys) {
-              graph.GetNode(ancestor).Color = ContainsSubtree(ancestor as ISymbolicExpressionTree, node) ? new Color { R = 0, G = 0, B = 150 } : new Color { R = 255, G = 255, B = 255 };
-            }
-          }
-          WriteDot(path + @"\impactancestry.dot", genealogy);
-
-          // trim the graph
-          // exclude the individuals of the last generation
-          var individuals = graph.Keys.Except(qualities.Select(x => x.Key)).ToList();
-          bool done = false;
-          while (!done) {
-            done = true;
-            foreach (var ind in individuals) {
-              // if node has no outgoing connections (absence of offspring), remove it from the graph
-              var node = graph.GetNode(ind);
-              if (node == null) continue;
-              if (node.OutEdges == null) {
-                done = false; // we still have "dead" nodes
-                graph.RemoveNode(ind);
-              }
-            }
-          }
-          WriteDot(path + @"\trimmedlineage.dot", graph);
-        }
+        #region end of the run (code for writing results to dot files)
+        //bool maxGenerationsReached = (Generations.Value == MaximumGenerations.Value);
+        //bool isOsga = (SelectionPressure != null && MaximumSelectionPressure != null);
+        //bool maxSelectionPressureReached = isOsga && (SelectionPressure.Value >= MaximumSelectionPressure.Value);
+        //if (maxGenerationsReached || maxSelectionPressureReached) {
+        //  var path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+
+        //  // write whole graph to a dot file
+        //  WriteDot(path + @"\lineage.dot", graph);
+
+        //  // get genealogy of the best solution
+        //  var bestSolution = (ISymbolicExpressionTree)qualities.First().Key;
+        //  var genealogy = graph.GetNode(bestSolution).Ancestors();
+        //  //WriteDot(path + @"\bestlineage.dot", genealogy);
+
+        //  // write the direct root lineage of the best solution (is it useful?)
+
+        //  // calculate impact values of nodes in the best solution, attempt to trace those with high impact to their origins
+        //  var calculator = new SymbolicRegressionSolutionValuesCalculator();
+        //  var impactValues = calculator.CalculateImpactValues(bestSolution, SymbolicExpressionInterpreter, SymbolicRegressionProblemData, 0, 0);
+        //  foreach (var pair in impactValues.Where(pair => !(pair.Key is ConstantTreeNode || pair.Key is VariableTreeNode)).OrderByDescending(pair => pair.Value).Take(2)) {
+        //    var node = pair.Key;
+        //  }
+        //  //WriteDot(path + @"\impactancestry.dot", genealogy);
+
+        //  // trim the graph
+        //  // exclude the individuals of the last generation
+        //  var individuals = graph.Keys.Except(qualities.Select(x => x.Key)).ToList();
+        //  bool done = false;
+        //  while (!done) {
+        //    done = true;
+        //    foreach (var ind in individuals) {
+        //      // if node has no outgoing connections (absence of offspring), remove it from the graph
+        //      var node = graph.GetNode(ind);
+        //      if (node == null) continue;
+        //      if (node.OutEdges == null) {
+        //        done = false; // we still have "dead" nodes
+        //        graph.RemoveNode(ind);
+        //      }
+        //    }
+        //  }
+        //  WriteDot(path + @"\trimmedlineage.dot", graph);
+        //}
         #endregion
       }
@@ -336,14 +335,13 @@
 
     #region Export to dot file
-    private static void WriteDot(string path, GenealogyGraph graph) {
+    private static void WriteDot(string path, SymbolicExpressionTreeGenealogyGraph graph) {
       using (var file = new System.IO.StreamWriter(path)) {
         string nl = Environment.NewLine;
-        file.WriteLine("digraph \"lineage " + graph.AverageDegree.ToString(CultureInfo.InvariantCulture) + "\" {" + nl +
-                       "ratio=auto;" + nl +
-                       "mincross=2.0");
+        file.WriteLine("digraph \"lineage " + graph.AverageDegree.ToString(CultureInfo.InvariantCulture) + "\" {" + nl + "ratio=auto;" + nl + "mincross=2.0");
         file.WriteLine("\tnode [shape=circle,label=\"\",style=filled]");
 
         foreach (var node in graph.Values) {
-          string fillColor = String.Format("#{0:x2}{1:x2}{2:x2}", node.Color.R, node.Color.G, node.Color.B);
+          var color = Color.FromArgb((int)((1 - node.Quality) * 255), (int)(node.Quality * 255), 0);
+          string fillColor = String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B);
           string shape = "circle";
           if (node.IsElite)
@@ -353,5 +351,6 @@
             continue;
           foreach (var edge in node.InEdges) {
-            var edgeStyle = node.InEdges.Count == 1 ? "dashed" : String.Empty;
+            //var edgeStyle = node.InEdges.Count == 1 ? "dashed" : String.Empty;
+            var edgeStyle = String.Empty;
             file.WriteLine("\t\"" + edge.Target.Id + "\" -> \"" + node.Id + "\" [arrowsize=.5, color=\"" + fillColor + "\", style=\"" + edgeStyle + "\"];");
           }
@@ -370,13 +369,6 @@
     #endregion
 
-    #region Allele tracking
-    private bool ContainsSubtree(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode node) {
-      return tree.IterateNodesPostfix().Where(n => n.Symbol == node.Symbol && n.GetLength() == node.GetLength())
-                                       .Where(n => n.Subtrees.Any() && node.Subtrees.Any())
-                                       .Any(n => n.Subtrees.First().Symbol == node.Subtrees.First().Symbol);
-    }
-    #endregion
-
     #region Extra / not really needed
+    // method of iterating tree nodes in a breadth-wise manner
     private IEnumerable<ISymbolicExpressionTreeNode> IterateNodes(ISymbolicExpressionTree tree) {
       return IterateNodes(tree.Root);
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/GenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/GenealogyGraph.cs	(revision 7778)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/GenealogyGraph.cs	(revision 7779)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#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;
@@ -8,32 +29,21 @@
 
 namespace HeuristicLab.EvolutionaryTracking {
-  public class GenealogyGraph : NamedItem {
-    private readonly Dictionary<object, Node> _dictionary;
+  [Item("Genealogy graph", "Generic class for tracking the evolution of objects.")]
+  public class GenealogyGraph<T> : NamedItem, IGenealogyGraph<T> where T : class {
+    private readonly Dictionary<T, GenealogyGraphNode> _dictionary;
 
     public GenealogyGraph() {
-      _dictionary = new Dictionary<object, Node>();
-    }
-
-    public GenealogyGraph(GenealogyGraph g) {
-      _dictionary = new Dictionary<object, Node>(g._dictionary);
+      _dictionary = new Dictionary<T, GenealogyGraphNode>();
+    }
+
+    public GenealogyGraph(GenealogyGraph<T> g) {
+      _dictionary = new Dictionary<T, GenealogyGraphNode>(g._dictionary);
     }
 
     public override IDeepCloneable Clone(Cloner cloner) {
-      return new GenealogyGraph(this, cloner);
-    }
-
-    public override string ItemName {
-      get { return "GenealogyGraph"; }
-    }
-
-    public override string ItemDescription {
-      get { return "A graph describing the genealogies of all the individuals"; }
-    }
-
-    public new Version ItemVersion {
-      get { return new Version(3, 3, 6); }
-    }
-
-    public new Image ItemImage {
+      return new GenealogyGraph<T>(this, cloner);
+    }
+
+    public override Image ItemImage {
       get { return Common.Resources.VSImageLibrary.Graph; }
     }
@@ -44,30 +54,30 @@
     }
 
-    private GenealogyGraph(GenealogyGraph original, Cloner cloner)
+    private GenealogyGraph(GenealogyGraph<T> original, Cloner cloner)
       : base(original, cloner) {
-      _dictionary = new Dictionary<object, Node>(original._dictionary);
-    }
-
-    public bool HasNode(object t) {
+      _dictionary = new Dictionary<T, GenealogyGraphNode>(original._dictionary);
+    }
+
+    public bool HasNode(T t) {
       return _dictionary.ContainsKey(t);
     }
 
-    public Node GetNode(object t) {
-      return this.HasNode(t) ? _dictionary[t] : null;
-    }
-
-    public IEnumerable<object> Keys {
+    public GenealogyGraphNode GetNode(T t) {
+      return HasNode(t) ? _dictionary[t] : null;
+    }
+
+    public IEnumerable<T> Keys {
       get { return _dictionary.Keys; }
     }
 
-    public IEnumerable<Node> Values {
+    public IEnumerable<GenealogyGraphNode> Values {
       get { return _dictionary.Values; }
     }
 
-    public bool Any() {
-      return _dictionary.Any();
-    }
-
-    public bool Any(Func<KeyValuePair<object, Node>, bool> predicate) {
+    public bool IsEmpty {
+      get { return !_dictionary.Any(); }
+    }
+
+    public bool Any(Func<KeyValuePair<T, GenealogyGraphNode>, bool> predicate) {
       return _dictionary.Any(predicate);
     }
@@ -81,11 +91,11 @@
     /// </summary>
     /// <param name="t">The symbolic expression tree</param>
-    /// <param name="q">The quality value </param>
-    /// <param name="l">The node label</param>
+    /// <param name="quality">The quality value </param>
+    /// <param name="label">The node label</param>
+    /// <param name="rank">The node rank</param>
     /// <param name="elite">Specifies if this node is an elite</param>
-    public void AddNode(object t, double q = 0.0, string l = "", double g = 0, bool elite = false) {
+    public void AddNode(T t, double quality = 0.0, string label = "", double rank = 0, bool elite = false, int cutIndex = -1) {
       if (HasNode(t)) return;
-      var color = new Color { R = (byte)(255 - 255 * q), G = (byte)(255 * q), B = 50 };
-      _dictionary[t] = new Node { Data = t, Quality = q, Label = l, IsElite = elite, Rank = g, Color = color };
+      _dictionary[t] = new GenealogyGraphNode { Data = t, Quality = quality, Label = label, IsElite = elite, Rank = rank, CutpointIndex = cutIndex };
     }
 
@@ -93,9 +103,8 @@
     ///  more of a low level method to minimize memory usage when creating and returning subgraphs
     /// </summary>
-    /// <param name="n"></param>
-    public void AddNode(Node n) {
-      var t = n.Data;
-      if (HasNode(t))
-        return;
+    /// <param name="n">The node to be added</param>
+    public void AddNode(GenealogyGraphNode n) {
+      var t = (T)n.Data;
+      if (HasNode(t)) return;
       _dictionary[t] = n;
     }
@@ -105,8 +114,7 @@
     /// </summary>
     /// <param name="t">The graph node</param>
-    public void RemoveNode(object t) {
-      if (!_dictionary.ContainsKey(t))
-        return;
-      Node n = _dictionary[t];
+    public void RemoveNode(T t) {
+      if (!_dictionary.ContainsKey(t)) return;
+      GenealogyGraphNode n = _dictionary[t];
       if (n.InEdges != null) {
         foreach (var e in n.InEdges.Where(e => e.Target.OutEdges != null)) {
@@ -138,8 +146,8 @@
     /// <param name="b"></param>
     /// <param name="label"></param>
-    public void AddArc(object a, object b, string label = "") {
-      Node src, dest;
+    public void AddArc(T a, T b, int opType = 0) {
+      GenealogyGraphNode src, dest;
       if (!HasNode(a)) {
-        src = new Node { Data = a };
+        src = new GenealogyGraphNode { Data = a };
         _dictionary[a] = src;
       } else {
@@ -147,5 +155,5 @@
       }
       if (!HasNode(b)) {
-        dest = new Node { Data = b };
+        dest = new GenealogyGraphNode { Data = b };
         _dictionary[b] = dest;
       } else {
@@ -153,12 +161,12 @@
       }
       // add forward and reverse arcs
-      src.AddForwardArc(dest, label);
-      dest.AddReverseArc(src, label);
-    }
-
-    public void AddArcs(object[] a, object b, string label) {
-      Node src, dest;
+      src.AddForwardArc(dest, opType);
+      dest.AddReverseArc(src, opType);
+    }
+
+    public void AddArcs(T[] a, T b, int opType = 0) {
+      GenealogyGraphNode src, dest;
       if (!HasNode(b)) {
-        dest = new Node { Data = b };
+        dest = new GenealogyGraphNode { Data = b };
         _dictionary[b] = dest;
       } else {
@@ -167,52 +175,48 @@
       foreach (var o in a) {
         if (!HasNode(o)) {
-          src = new Node { Data = o };
+          src = new GenealogyGraphNode { Data = o };
           _dictionary[o] = src;
         } else {
           src = _dictionary[o];
         }
-        src.AddForwardArc(dest, label);
-        dest.AddReverseArc(src, label);
+        src.AddForwardArc(dest, opType);
+        dest.AddReverseArc(src, opType);
       }
     }
   }
 
-  public class Node {
+  public class GenealogyGraphNode : IComparable {
     public string Id { get; private set; }
     public string Label { get; set; }
     public bool IsElite { get; set; }
-    public List<Arc> InEdges { get; set; }
-    public List<Arc> OutEdges { get; set; }
     public object Data { get; set; }
     public double Quality { get; set; }
     public double Rank { get; set; }
-    public Color Color { get; set; }
-
-    public int Degree {
-      get { return (InEdges == null ? 0 : InEdges.Count) + (OutEdges == null ? 0 : OutEdges.Count); }
-    }
-
-    public Node() {
+    public int CutpointIndex { get; set; }
+    public List<GenealogyGraphArc> InEdges { get; set; }
+    public List<GenealogyGraphArc> OutEdges { get; set; }
+
+    public int Degree { get { return (InEdges == null ? 0 : InEdges.Count) + (OutEdges == null ? 0 : OutEdges.Count); } }
+
+    public GenealogyGraphNode() { Id = Guid.NewGuid().ToString(); }
+
+    public GenealogyGraphNode(GenealogyGraphNode node) {
       Id = Guid.NewGuid().ToString();
-    }
-
-    /// <summary>
-    /// Returns a genealogical graph rooted in the current node, containing all ancestry information
+      Rank = node.Rank;
+      Quality = node.Quality;
+      IsElite = node.IsElite;
+      Label = node.Label;
+      Data = node.Data;
+      InEdges = node.InEdges;
+      OutEdges = node.OutEdges;
+      CutpointIndex = node.CutpointIndex;
+    }
+
+    /// <summary>
+    /// Returns all the ancestors of the current node
     /// </summary>
     /// <returns></returns>
-    public GenealogyGraph Genealogy() {
-      var graph = new GenealogyGraph();
-      graph.AddNode(this);
-      foreach (var node in this.Ancestors())
-        graph.AddNode(node);
-      return graph;
-    }
-
-    /// <summary>
-    /// Returns an enumerable of all the ancestors of the current node
-    /// </summary>
-    /// <returns></returns>
-    public IEnumerable<Node> Ancestors() {
-      var nodes = new HashSet<Node> { this };
+    public IEnumerable<GenealogyGraphNode> Ancestors() {
+      var nodes = new HashSet<GenealogyGraphNode> { this };
       int offset = 0;
       int c0 = 1;
@@ -231,18 +235,50 @@
     }
 
-    public void AddForwardArc(Node target, string label) {
-      var e = new Arc { Target = target, Label = label };
-      if (OutEdges == null)
-        OutEdges = new List<Arc> { e };
-      else
-        OutEdges.Add(e);
-    }
-
-    public void AddReverseArc(Node target, string label) {
-      var e = new Arc { Target = target, Label = label };
-      if (InEdges == null)
-        InEdges = new List<Arc> { e };
-      else
-        InEdges.Add(e);
+    /// <summary>
+    /// Returns all the descendants of the current node (identical to above method except for using the OutEdges)
+    /// </summary>
+    /// <returns></returns>
+    public IEnumerable<GenealogyGraphNode> Descendants() {
+      var nodes = new HashSet<GenealogyGraphNode> { this };
+      int offset = 0;
+      int c0 = 1;
+      while (offset != c0) {
+        int c1 = c0;
+        for (int i = offset; i != c1; ++i) {
+          if (nodes.ElementAt(i).OutEdges == null) continue;
+          foreach (var p in nodes.ElementAt(i).OutEdges.Select(e => e.Target)) {
+            nodes.Add(p);
+            yield return p;
+          }
+        }
+        offset = c1;
+        c0 = nodes.Count;
+      }
+    }
+
+    public void AddForwardArc(GenealogyGraphNode target, int opType) {
+      var e = new GenealogyGraphArc { Target = target, OperatorType = opType };
+      if (OutEdges == null) OutEdges = new List<GenealogyGraphArc> { e };
+      else OutEdges.Add(e);
+    }
+
+    public void AddReverseArc(GenealogyGraphNode target, int opType) {
+      var e = new GenealogyGraphArc { Target = target, OperatorType = opType };
+      if (InEdges == null) InEdges = new List<GenealogyGraphArc> { e };
+      else InEdges.Add(e);
+    }
+
+    // comparable
+    // may seem weird, it is actually implemented so higher quality means "less than" in terms of ordering
+    // if quality is equal, the elite node takes precedence
+    public int CompareTo(object obj) {
+      if (obj == null) return 1;
+      var other = obj as GenealogyGraphNode;
+      if (other == null) return 1;
+      if (Quality.Equals(other.Quality)) {
+        if (IsElite) return -1;
+        return other.IsElite ? 1 : -1;
+      }
+      return other.Quality.CompareTo(Quality);
     }
   }
@@ -251,16 +287,13 @@
   /// An arc is an edge along with an orientation
   /// </summary>
-  public class Arc {
-    public Node Target { get; set; }
-    public string Label { get; set; }
-    public double Weight { get; set; }
-    // other attributes
-  }
-  // an edge can be represented as a tuple<Node, Node> TODO: figure it out (might be useful for easier querying)
-
-  public struct Color {
-    public byte R { get; set; }
-    public byte G { get; set; }
-    public byte B { get; set; }
+  public class GenealogyGraphArc {
+    public GenealogyGraphNode Target { get; set; }
+    // OperationType is an identifier for the genetic operation (mutation, crossover) that a graph arc will represent 
+    // So basically it describes which operator was applied to an individual/graph node (the one emitting the arc), 
+    // while Target represents the end result of that operator (node ==GeneticOperation==> Target)
+    public int OperatorType { get; set; }
+    // these two fields are not used, but they might be useful later 
+    public string Label { get; set; } // might be useful later
+    public double Weight { get; set; } // might be useful later
   }
 }
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/HeuristicLab.EvolutionaryTracking-3.4.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/HeuristicLab.EvolutionaryTracking-3.4.csproj	(revision 7778)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/HeuristicLab.EvolutionaryTracking-3.4.csproj	(revision 7779)
@@ -72,13 +72,4 @@
     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="Microsoft.GLEE">
-      <HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft Research\GLEE\bin\Microsoft.GLEE.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.GLEE.Drawing">
-      <HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft Research\GLEE\bin\Microsoft.GLEE.Drawing.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.GLEE.GraphViewerGDI">
-      <HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft Research\GLEE\bin\Microsoft.GLEE.GraphViewerGDI.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -94,16 +85,10 @@
     <Compile Include="Analyzers\SymbolicExpressionTreeGenealogyAnalyzer.cs" />
     <Compile Include="GenealogyGraph.cs" />
-    <Compile Include="GenealogyGraphView.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
-    <Compile Include="GenealogyGraphView.Designer.cs">
-      <DependentUpon>GenealogyGraphView.cs</DependentUpon>
-    </Compile>
+    <Compile Include="Interfaces\IGenealogyGraph.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SymbolicExpressionTreeGenealogyGraph.cs" />
   </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Interfaces\" />
-  </ItemGroup>
+  <ItemGroup />
   <ItemGroup>
     <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Interfaces/IGenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Interfaces/IGenealogyGraph.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/Interfaces/IGenealogyGraph.cs	(revision 7779)
@@ -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 HeuristicLab.Core;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  public interface IGenealogyGraph<T> : INamedItem where T : class {
+    // node/vertex operations
+    bool HasNode(T t); // graph contains specific node?
+    bool Any(Func<KeyValuePair<T, GenealogyGraphNode>, bool> predicate); // graph contains any nodes matching the given predicate?
+    void Clear(); // clear graph
+    void AddNode(T t, double quality = 0.0, string label = "", double rank = 0, bool elite = false, int cutIndex = -1);
+    void RemoveNode(T t); // remove node if contained in the graph
+    GenealogyGraphNode GetNode(T t); // return node corresponding to object t, or null
+    // arc operation
+    void AddArc(T source, T target, int opType = 0);
+    void AddArcs(T[] a, T b, int opType = 0);
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/SymbolicExpressionTreeGenealogyGraph.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/SymbolicExpressionTreeGenealogyGraph.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking/3.4/SymbolicExpressionTreeGenealogyGraph.cs	(revision 7779)
@@ -0,0 +1,118 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+
+namespace HeuristicLab.EvolutionaryTracking {
+  public class SymbolicExpressionTreeGenealogyGraph : GenealogyGraph<ISymbolicExpressionTree> {
+    public enum SimilarityLevel { Exact, High, Relaxed }
+
+    private readonly Dictionary<int, Func<ISymbolicExpressionTreeNode, string>> _dispatcher;
+
+    public delegate string HashFunction(ISymbolicExpressionTreeNode node);
+
+    public SymbolicExpressionTreeGenealogyGraph() {
+      _dispatcher = new Dictionary<int, Func<ISymbolicExpressionTreeNode, string>>();
+      _dispatcher[(int)SimilarityLevel.Exact] = GetExactString;
+      _dispatcher[(int)SimilarityLevel.High] = GetHighLevelString;
+      _dispatcher[(int)SimilarityLevel.Relaxed] = GetRelaxedString;
+    }
+
+    #region Fragment tracing
+    public IEnumerable<ISymbolicExpressionTree> TraceFragment(ISymbolicExpressionTreeNode fragment, int mode = 0) {
+      return Keys.Where(tree => ContainsFragment(tree, fragment, mode) != -1);
+    }
+
+    public static bool CheckSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, int mode) {
+      return FindMatch(t1, t2, mode) == 0;
+    }
+
+    public static int ContainsFragment(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode fragment, int mode) {
+      var nodes = tree.IterateNodesPostfix().ToArray();
+      var fragments = fragment.IterateNodesPostfix().ToArray();
+      return FindMatch(nodes, fragments, mode);
+    }
+
+    // Build a string hash out of all node symbols and parameter values (trimmed to 4 decimal places)
+    private static string GetExactString(ISymbolicExpressionTreeNode node) {
+      if (node is ConstantTreeNode) {
+        var constant = node as ConstantTreeNode;
+        return (constant.Symbol + string.Format("{0:0.0000}", constant.Value));
+      }
+      if (node is VariableTreeNode) {
+        var variable = node as VariableTreeNode;
+        return (variable.Symbol + variable.VariableName + variable.Weight);
+      }
+      return (node.Symbol.ToString());
+    }
+
+    // Build a string hash out of all node symbols in their respective order
+    private static string GetHighLevelString(ISymbolicExpressionTreeNode node) {
+      return (node.Symbol.ToString());
+    }
+
+    // Build a string hash which only considers function symbols and function arities. leaf nodes are taken as "wildcards"
+    private static string GetRelaxedString(ISymbolicExpressionTreeNode node) {
+      if (node.SubtreeCount != 0) /* function node */ {
+        return (node.Symbol + node.SubtreeCount.ToString(CultureInfo.InvariantCulture));
+      }
+      return string.Empty;
+    }
+
+    #endregion
+    public class SymbolicExpressionTreeNodeComparer : IEqualityComparer<ISymbolicExpressionTreeNode> {
+      public SymbolicExpressionTreeNodeComparer(int similarityLevel) { _similarityLevel = similarityLevel; }
+
+      public int GetHashCode(ISymbolicExpressionTreeNode n) { return n.ToString().ToLower().GetHashCode(); }
+
+      public bool Equals(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+        if (a.SubtreeCount != b.SubtreeCount) { return false; }
+        if (a.SubtreeCount > 0) { return a.Symbol.ToString().Equals(b.Symbol.ToString()); }
+        switch (_similarityLevel) {
+          case ((int)SimilarityLevel.Exact):
+            if (a is ConstantTreeNode && b is ConstantTreeNode) { return (a as ConstantTreeNode).Value.Equals((b as ConstantTreeNode).Value); }
+            if (a is VariableTreeNode && b is VariableTreeNode) { return (a as VariableTreeNode).Weight.Equals((b as VariableTreeNode).Weight); }
+            return false;
+          case ((int)SimilarityLevel.High):
+            return (a is ConstantTreeNode && b is ConstantTreeNode) || (a is VariableTreeNode && b is VariableTreeNode);
+          case ((int)SimilarityLevel.Relaxed):
+            return true;
+          default:
+            return false;
+        }
+      }
+      private readonly int _similarityLevel;
+    }
+
+    private static int FindMatch(ISymbolicExpressionTree t0, ISymbolicExpressionTree t1, int mode) {
+      return FindMatch(t0.IterateNodesPostfix().ToArray(), t1.IterateNodesPostfix().ToArray(), mode);
+    }
+
+    private static int FindMatch(ISymbolicExpressionTreeNode t0, ISymbolicExpressionTreeNode t1, int mode) {
+      return FindMatch(t0.IterateNodesPostfix().ToArray(), t1.IterateNodesPostfix().ToArray(), mode);
+    }
+
+    // returns the index in the sequence 'seq', where pattern 'pat' is matched, or -1 for no match
+    // -1 means no match, 0 means perfect match (the sequences overlap, hence the match index is 0)
+    public static int FindMatch(ISymbolicExpressionTreeNode[] seq, ISymbolicExpressionTreeNode[] pat, int mode) {
+      int patlen = pat.Length;
+      int seqlen = seq.Length;
+      if (patlen == 0 || seqlen == 0) return -1;
+      var comparer = new SymbolicExpressionTreeNodeComparer(mode);
+      if (patlen == seqlen) return seq.SequenceEqual(pat, comparer) ? 0 : -1;
+      int i = patlen;
+      while (i <= seqlen) {
+        var ch = seq[i - 1];
+        if (comparer.Equals(ch, pat.Last())) {
+          if (seq.Skip(i - patlen).Take(patlen).SequenceEqual(pat, comparer)) {
+            return i - patlen;
+          }
+        }
+        ++i;
+      }
+      return -1;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/BestSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/BestSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/BestSelector.cs	(revision 7779)
@@ -0,0 +1,81 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A selection operator which considers a single double quality value and selects the best.
+  /// </summary>
+  [Item("BestSelector", "A selection operator which considers a single double quality value and selects the best.")]
+  [StorableClass]
+  public sealed class BestSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
+    public BestSelector() : base() { }
+    [StorableConstructor]
+    private BestSelector(bool deserializing) : base(deserializing) { }
+    private BestSelector(BestSelector original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BestSelector(this, cloner);
+    }
+
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      bool maximization = MaximizationParameter.ActualValue.Value;
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      IScope[] selected = new IScope[count];
+
+      // create a list for each scope that contains the scope's index in the original scope list
+      var temp = qualities.Select((x, index) => new { index, x.Value });
+      if (maximization)
+        temp = temp.OrderByDescending(x => x.Value);
+      else
+        temp = temp.OrderBy(x => x.Value);
+      var list = temp.ToList();
+
+      if (copy) {
+        int j = 0;
+        for (int i = 0; i < count; i++) {
+          selected[i] = (IScope)scopes[list[j].index].Clone();
+          j++;
+          if (j >= list.Count) j = 0;
+        }
+      } else {
+        for (int i = 0; i < count; i++) {
+          selected[i] = scopes[list[0].index];
+          scopes[list[0].index] = null;
+          list.RemoveAt(0);
+        }
+        scopes.RemoveAll(x => x == null);
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ConditionalSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ConditionalSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ConditionalSelector.cs	(revision 7779)
@@ -0,0 +1,81 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("ConditionalSelector", "Selects sub-scopes where a certain boolean variable is true.")]
+  [StorableClass]
+  public class ConditionalSelector : Selector {
+    public ScopeTreeLookupParameter<BoolValue> ConditionParameter {
+      get { return (ScopeTreeLookupParameter<BoolValue>)Parameters["Condition"]; }
+    }
+    protected IValueParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected ConditionalSelector(bool deserializing) : base(deserializing) { }
+    protected ConditionalSelector(ConditionalSelector original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ConditionalSelector(this, cloner);
+    }
+    public ConditionalSelector()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("Condition", "The boolean variable based on which the scopes are selected into a true scope-branch and a false scope-branch."));
+      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "The parameter that decides whether the selected scopes should be copied or moved.", new BoolValue(true)));
+      CopySelectedParameter.Hidden = true;
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      ItemArray<BoolValue> conditions = ConditionParameter.ActualValue;
+      List<IScope> selected = new List<IScope>();
+      if (CopySelected.Value) {
+        for (int i = 0; i < scopes.Count; i++) {
+          if (conditions[i].Value) {
+            selected.Add((IScope)scopes[i].Clone());
+          }
+        }
+      } else {
+        for (int i = 0; i < scopes.Count; i++) {
+          if (conditions[i + selected.Count].Value) {
+            selected.Add(scopes[i]);
+            scopes.RemoveAt(i);
+            i--;
+          }
+        }
+      }
+      return selected.ToArray();
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/CrowdedTournamentSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/CrowdedTournamentSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/CrowdedTournamentSelector.cs	(revision 7779)
@@ -0,0 +1,119 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("CrowdedTournamentSelector", "Selects solutions using tournament selection by using the partial order defined in Deb et al. 2002. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II. IEEE Transactions on Evolutionary Computation, 6(2), pp. 182-197.")]
+  [StorableClass]
+  public class CrowdedTournamentSelector : Selector, IMultiObjectiveSelector, IStochasticOperator {
+    public ILookupParameter<BoolArray> MaximizationParameter {
+      get { return (ILookupParameter<BoolArray>)Parameters["Maximization"]; }
+    }
+    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+    protected IValueParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public ILookupParameter<ItemArray<DoubleArray>> QualitiesParameter {
+      get { return (ILookupParameter<ItemArray<DoubleArray>>)Parameters["Qualities"]; }
+    }
+    public IScopeTreeLookupParameter<IntValue> RankParameter {
+      get { return (IScopeTreeLookupParameter<IntValue>)Parameters["Rank"]; }
+    }
+    public IScopeTreeLookupParameter<DoubleValue> CrowdingDistanceParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["CrowdingDistance"]; }
+    }
+    public IValueLookupParameter<IntValue> GroupSizeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["GroupSize"]; }
+    }
+
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected CrowdedTournamentSelector(bool deserializing) : base(deserializing) { }
+    protected CrowdedTournamentSelector(CrowdedTournamentSelector original, Cloner cloner) : base(original, cloner) { }
+    public CrowdedTournamentSelector()
+      : base() {
+      Parameters.Add(new LookupParameter<BoolArray>("Maximization", "For each objective determines whether it should be maximized or minimized."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes that should be selected."));
+      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected scopes are to be copied (cloned) otherwise they're moved."));
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The solutions' qualities vector."));
+      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Rank", "The solutions' domination rank."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("CrowdingDistance", "The solutions' crowding distance values."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("GroupSize", "The size of the group from which the best will be chosen.", new IntValue(2)));
+      CopySelectedParameter.Hidden = true;
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      IRandom random = RandomParameter.ActualValue;
+      List<int> ranks = RankParameter.ActualValue.Select(x => x.Value).ToList();
+      List<double> crowdingDistance = CrowdingDistanceParameter.ActualValue.Select(x => x.Value).ToList();
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      int groupSize = GroupSizeParameter.ActualValue.Value;
+      bool copy = CopySelected.Value;
+      IScope[] selected = new IScope[count];
+
+      for (int i = 0; i < count; i++) {
+        int best = random.Next(scopes.Count);
+        int index;
+        for (int j = 1; j < groupSize; j++) {
+          index = random.Next(scopes.Count);
+          if (ranks[best] > ranks[index]
+            || ranks[best] == ranks[index]
+              && crowdingDistance[best] < crowdingDistance[index]) {
+            best = index;
+          }
+        }
+
+        if (copy)
+          selected[i] = (IScope)scopes[best].Clone();
+        else {
+          selected[i] = scopes[best];
+          scopes.RemoveAt(best);
+          ranks.RemoveAt(best);
+          crowdingDistance.RemoveAt(best);
+        }
+      }
+
+      return selected;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CrowdedTournamentSelector(this, cloner);
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/GenderSpecificSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/GenderSpecificSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/GenderSpecificSelector.cs	(revision 7779)
@@ -0,0 +1,178 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("GenderSpecificSelection", "Brings two parents together by sampling each with a different selection scheme (Wagner, S. and Affenzeller, M. 2005. SexualGA: Gender-Specific Selection for Genetic Algorithms. Proceedings of the 9th World Multi-Conference on Systemics, Cybernetics and Informatics (WMSCI), pp. 76-81).")]
+  [StorableClass]
+  public class GenderSpecificSelector : AlgorithmOperator, ISingleObjectiveSelector, IStochasticOperator {
+    #region Parameters
+    public IValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
+      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
+    }
+    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+    protected IValueLookupParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public ValueParameter<ISelector> FemaleSelectorParameter {
+      get { return (ValueParameter<ISelector>)Parameters["FemaleSelector"]; }
+    }
+    public ValueParameter<ISelector> MaleSelectorParameter {
+      get { return (ValueParameter<ISelector>)Parameters["MaleSelector"]; }
+    }
+    #endregion
+
+    #region Properties
+    public BoolValue Maximization {
+      get { return MaximizationParameter.Value; }
+      set { MaximizationParameter.Value = value; }
+    }
+    public IntValue NumberOfSelectedSubScopes {
+      get { return NumberOfSelectedSubScopesParameter.Value; }
+      set { NumberOfSelectedSubScopesParameter.Value = value; }
+    }
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+    public ISelector FemaleSelector {
+      get { return FemaleSelectorParameter.Value; }
+      set { FemaleSelectorParameter.Value = value; }
+    }
+    public ISelector MaleSelector {
+      get { return MaleSelectorParameter.Value; }
+      set { MaleSelectorParameter.Value = value; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected GenderSpecificSelector(bool deserializing) : base(deserializing) { }
+    protected GenderSpecificSelector(GenderSpecificSelector original, Cloner cloner)
+      : base(original, cloner) {
+      Initialize();
+    }
+
+    public GenderSpecificSelector()
+      : base() {
+      #region Create parameters
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the solutions."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of scopes that should be selected."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("CopySelected", "True if the scopes should be copied, false if they should be moved.", new BoolValue(true)));
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
+      Parameters.Add(new ValueParameter<ISelector>("FemaleSelector", "The selection operator to select the first parent."));
+      Parameters.Add(new ValueParameter<ISelector>("MaleSelector", "The selection operator to select the second parent."));
+      CopySelectedParameter.Hidden = true;
+      #endregion
+
+      #region Create operators
+      Placeholder femaleSelector = new Placeholder();
+      SubScopesProcessor maleSelection = new SubScopesProcessor();
+      Placeholder maleSelector = new Placeholder();
+      EmptyOperator empty = new EmptyOperator();
+      RightChildReducer rightChildReducer = new RightChildReducer();
+      SubScopesMixer subScopesMixer = new SubScopesMixer();
+
+      femaleSelector.OperatorParameter.ActualName = "FemaleSelector";
+
+      maleSelector.OperatorParameter.ActualName = "MaleSelector";
+
+      subScopesMixer.Partitions = new IntValue(2);
+      #endregion
+
+      #region Create operator graph
+      OperatorGraph.InitialOperator = femaleSelector;
+      femaleSelector.Successor = maleSelection;
+      maleSelection.Operators.Add(maleSelector);
+      maleSelection.Operators.Add(empty);
+      maleSelection.Successor = rightChildReducer;
+      rightChildReducer.Successor = subScopesMixer;
+      #endregion
+
+      Initialize();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GenderSpecificSelector(this, cloner);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      Initialize();
+    }
+
+    /// <summary>
+    /// Sets how many sub-scopes male and female selectors should select.
+    /// </summary>
+    /// <exception cref="InvalidOperationException">Thrown when <see cref="NumberOfSelectedSubScopesParameter"/> returns an odd number.</exception>
+    /// <returns>Returns Apply of <see cref="AlgorithmOperator"/>.</returns>
+    public override IOperation Apply() {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      if (count % 2 > 0) throw new InvalidOperationException(Name + ": There must be an equal number of sub-scopes to be selected.");
+      FemaleSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(count / 2);
+      MaleSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(count / 2);
+      return base.Apply();
+    }
+
+    #region Events
+    private void SelectorParameter_ValueChanged(object sender, EventArgs e) {
+      IValueParameter<ISelector> selectorParam = (sender as IValueParameter<ISelector>);
+      if (selectorParam != null)
+        ParameterizeSelector(selectorParam.Value);
+    }
+    #endregion
+
+    #region Helpers
+    private void Initialize() {
+      FemaleSelectorParameter.ValueChanged += new EventHandler(SelectorParameter_ValueChanged);
+      MaleSelectorParameter.ValueChanged += new EventHandler(SelectorParameter_ValueChanged);
+      if (FemaleSelector == null) FemaleSelector = new ProportionalSelector();
+      if (MaleSelector == null) MaleSelector = new RandomSelector();
+    }
+    private void ParameterizeSelector(ISelector selector) {
+      selector.CopySelected = new BoolValue(true);
+      IStochasticOperator stoOp = (selector as IStochasticOperator);
+      if (stoOp != null) stoOp.RandomParameter.ActualName = RandomParameter.Name;
+      ISingleObjectiveSelector soSelector = (selector as ISingleObjectiveSelector);
+      if (soSelector != null) {
+        soSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+        soSelector.QualityParameter.ActualName = QualityParameter.Name;
+      }
+    }
+    #endregion
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/GeneralizedRankSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/GeneralizedRankSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/GeneralizedRankSelector.cs	(revision 7779)
@@ -0,0 +1,90 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// The generalized rank selection operator selects qualities by rank with a varying focus on better qualities. It is implemented as described in Tate, D. M. and Smith, A. E. 1995. A genetic approach to the quadratic assignment problem. Computers & Operations Research, vol. 22, pp. 73-83.
+  /// </summary>
+  [Item("GeneralizedRankSelector", "The generalized rank selection operator selects qualities by rank with a varying focus on better qualities. It is implemented as described in Tate, D. M. and Smith, A. E. 1995. A genetic approach to the quadratic assignment problem. Computers & Operations Research, vol. 22, pp. 73-83.")]
+  [StorableClass]
+  public sealed class GeneralizedRankSelector : StochasticSingleObjectiveSelector, ISelector {
+
+    public IValueLookupParameter<DoubleValue> PressureParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["Pressure"]; }
+    }
+
+    [StorableConstructor]
+    private GeneralizedRankSelector(bool deserializing) : base(deserializing) { }
+    private GeneralizedRankSelector(GeneralizedRankSelector original, Cloner cloner) : base(original, cloner) { }
+    public GeneralizedRankSelector()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("Pressure", "The selection pressure that is applied, must lie in the interval [1;infinity). A pressure of 1 equals random selection, higher pressure values focus on selecting better qualities.", new DoubleValue(2)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GeneralizedRankSelector(this, cloner);
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IRandom random = RandomParameter.ActualValue;
+      bool maximization = MaximizationParameter.ActualValue.Value;
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      IScope[] selected = new IScope[count];
+      double pressure = PressureParameter.ActualValue.Value;
+
+      var ordered = qualities.Select((x, index) => new KeyValuePair<int, double>(index, x.Value)).OrderBy(x => x.Value).ToList();
+      if (maximization) ordered.Reverse();
+
+      int m = scopes.Count;
+      for (int i = 0; i < count; i++) {
+        double rand = 1 + random.NextDouble() * (Math.Pow(m, 1.0 / pressure) - 1);
+        int selIdx = (int)Math.Floor(Math.Pow(rand, pressure) - 1);
+
+        if (copy) {
+          selected[i] = (IScope)scopes[ordered[selIdx].Key].Clone();
+        } else {
+          int idx = ordered[selIdx].Key;
+          selected[i] = scopes[idx];
+          scopes.RemoveAt(idx);
+          ordered.RemoveAt(selIdx);
+          for (int j = 0; j < ordered.Count; j++) {
+            var o = ordered[j];
+            if (o.Key > idx) ordered[j] = new KeyValuePair<int, double>(o.Key - 1, o.Value);
+          }
+          m--;
+        }
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/HeuristicLab.Selection-3.3.csproj
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/HeuristicLab.Selection-3.3.csproj	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/HeuristicLab.Selection-3.3.csproj	(revision 7779)
@@ -0,0 +1,209 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{2C36CD4F-E5F5-43A4-801A-201EA895FE17}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Selection</RootNamespace>
+    <AssemblyName>HeuristicLab.Selection-3.3</AssemblyName>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <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>..\..\..\..\trunk\sources\bin\</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>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <DocumentationFile>
+    </DocumentationFile>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</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>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</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>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Plugin.cs.frame" />
+    <Compile Include="BestSelector.cs" />
+    <Compile Include="ConditionalSelector.cs" />
+    <Compile Include="CrowdedTournamentSelector.cs" />
+    <Compile Include="GeneralizedRankSelector.cs" />
+    <Compile Include="LeftSelector.cs" />
+    <Compile Include="NoSameMatesSelector.cs" />
+    <Compile Include="Plugin.cs" />
+    <Compile Include="RandomReplacer.cs" />
+    <Compile Include="GenderSpecificSelector.cs" />
+    <Compile Include="OffspringSelector.cs" />
+    <Compile Include="Replacer.cs" />
+    <Compile Include="RightChildReducer.cs" />
+    <Compile Include="RightSelector.cs" />
+    <Compile Include="SingleObjectiveSelector.cs" />
+    <Compile Include="LeftReducer.cs" />
+    <Compile Include="MergingReducer.cs" />
+    <Compile Include="Reducer.cs" />
+    <Compile Include="LinearRankSelector.cs" />
+    <Compile Include="ProportionalSelector.cs" />
+    <Compile Include="RightReducer.cs" />
+    <Compile Include="StochasticSelector.cs" />
+    <Compile Include="RandomSelector.cs" />
+    <Compile Include="StochasticSingleObjectiveSelector.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Selector.cs" />
+    <Compile Include="TournamentSelector.cs" />
+    <Compile Include="WorstReplacer.cs" />
+    <Compile Include="WorstSelector.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="Properties\AssemblyInfo.cs.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="$(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>
+  -->
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LeftReducer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LeftReducer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LeftReducer.cs	(revision 7779)
@@ -0,0 +1,49 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// An operator which reduces to the sub-scopes of the leftmost sub-scope of the current scope.
+  /// </summary>
+  [Item("LeftReducer", "An operator which reduces to the sub-scopes of the leftmost sub-scope of the current scope.")]
+  [StorableClass]
+  public sealed class LeftReducer : Reducer, IReducer {
+    [StorableConstructor]
+    private LeftReducer(bool deserializing) : base(deserializing) { }
+    private LeftReducer(LeftReducer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LeftReducer(this, cloner);
+    }
+    public LeftReducer() : base() { }
+
+    protected override List<IScope> Reduce(List<IScope> scopes) {
+      List<IScope> reduced = new List<IScope>();
+      if (scopes.Count > 0) reduced.AddRange(scopes[0].SubScopes);
+      return reduced;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LeftSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LeftSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LeftSelector.cs	(revision 7779)
@@ -0,0 +1,83 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// An operator which selects sub-scopes from left to right.
+  /// </summary>
+  [Item("LeftSelector", "An operator which selects sub-scopes from left to right.")]
+  [StorableClass]
+  public sealed class LeftSelector : Selector {
+    private IValueParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    private LeftSelector(bool deserializing) : base(deserializing) { }
+    private LeftSelector(LeftSelector original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LeftSelector(this, cloner);
+    }
+
+    public LeftSelector()
+      : base() {
+      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
+      CopySelectedParameter.Hidden = true;
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IScope[] selected = new IScope[count];
+
+      int j = 0;
+      for (int i = 0; i < count; i++) {
+        if (copy) {
+          selected[i] = (IScope)scopes[j].Clone();
+          j++;
+          if (j >= scopes.Count) j = 0;
+        } else {
+          selected[i] = scopes[0];
+          scopes.RemoveAt(0);
+        }
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LinearRankSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LinearRankSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/LinearRankSelector.cs	(revision 7779)
@@ -0,0 +1,85 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A linear rank selection operator which considers the rank based on a single double quality value for selection.
+  /// </summary>
+  [Item("LinearRankSelector", "A linear rank selection operator which considers the rank based on a single double quality value for selection.")]
+  [StorableClass]
+  public sealed class LinearRankSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
+    [StorableConstructor]
+    private LinearRankSelector(bool deserializing) : base(deserializing) { }
+    private LinearRankSelector(LinearRankSelector original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LinearRankSelector(this, cloner);
+    }
+    public LinearRankSelector() : base() { }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IRandom random = RandomParameter.ActualValue;
+      bool maximization = MaximizationParameter.ActualValue.Value;
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      IScope[] selected = new IScope[count];
+
+      // create a list for each scope that contains the scope's index in the original scope list and its lots
+      var temp = qualities.Select((x, index) => new { index, x.Value });
+      if (maximization)
+        temp = temp.OrderBy(x => x.Value);
+      else
+        temp = temp.OrderByDescending(x => x.Value);
+      var list = temp.Select((x, index) => new { x.index, lots = index + 1 }).ToList();
+
+      int lotSum = list.Count * (list.Count + 1) / 2;
+      for (int i = 0; i < count; i++) {
+        int selectedLot = random.Next(lotSum) + 1;
+        int j = 0;
+        int currentLot = list[j].lots;
+        while (currentLot < selectedLot) {
+          j++;
+          currentLot += list[j].lots;
+        }
+        if (copy)
+          selected[i] = (IScope)scopes[list[j].index].Clone();
+        else {
+          selected[i] = scopes[list[j].index];
+          scopes[list[j].index] = null;
+          lotSum -= list[j].lots;
+          list.RemoveAt(j);
+        }
+      }
+      if (!copy) scopes.RemoveAll(x => x == null);
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/MergingReducer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/MergingReducer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/MergingReducer.cs	(revision 7779)
@@ -0,0 +1,52 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// An operator which reduces to the sub-scopes of all sub-scopes of the current scope.
+  /// </summary>
+  [Item("MergingReducer", "An operator which reduces to the sub-scopes of all sub-scopes of the current scope.")]
+  [StorableClass]
+  public sealed class MergingReducer : Reducer, IReducer {
+    [StorableConstructor]
+    private MergingReducer(bool deserializing) : base(deserializing) { }
+    private MergingReducer(MergingReducer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MergingReducer(this, cloner);
+    }
+    public MergingReducer() : base() { }
+
+    protected override List<IScope> Reduce(List<IScope> scopes) {
+      List<IScope> reduced = new List<IScope>();
+      for (int i = 0; i < scopes.Count; i++)
+        reduced.AddRange(scopes[i].SubScopes);
+      return reduced;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/NoSameMatesSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/NoSameMatesSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/NoSameMatesSelector.cs	(revision 7779)
@@ -0,0 +1,243 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A selector which tries to select two parents which differ in quality
+  /// as described in: "S. Gustafson, E. K. Burke, N. Krasnogor, On improving genetic programming for symbolic regression, 
+  /// The 2005 IEEE Congress on Evolutionary Computation, pp. 912-919, 2005."
+  /// </summary>
+  [Item("NoSameMatesSelector", "A selector which tries to select two parents which differ in quality as described in: \"S. Gustafson, E. K. Burke, N. Krasnogor, On improving genetic programming for symbolic regression, The 2005 IEEE Congress on Evolutionary Computation, pp. 912-919, 2005.\"")]
+  [StorableClass]
+  public class NoSameMatesSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
+    private const string SelectorParameterName = "Selector";
+    private const string QualityDifferencePercentageParameterName = "QualityDifferencePercentage";
+    private const string QualityDifferenceMaxAttemptsParameterName = "QualityDifferenceMaxAttempts";
+    private const string QualityDifferenceUseRangeParameterName = "QualityDifferenceUseRange";
+
+    #region Parameters
+    public IValueParameter<ISingleObjectiveSelector> SelectorParameter {
+      get { return (IValueParameter<ISingleObjectiveSelector>)Parameters[SelectorParameterName]; }
+    }
+    public IFixedValueParameter<PercentValue> QualityDifferencePercentageParameter {
+      get { return (IFixedValueParameter<PercentValue>)Parameters[QualityDifferencePercentageParameterName]; }
+    }
+    public IFixedValueParameter<IntValue> QualityDifferenceMaxAttemptsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[QualityDifferenceMaxAttemptsParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> QualityDifferenceUseRangeParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[QualityDifferenceUseRangeParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public ISingleObjectiveSelector Selector {
+      get { return SelectorParameter.Value; }
+      set { SelectorParameter.Value = value; }
+    }
+    public PercentValue QualityDifferencePercentage {
+      get { return QualityDifferencePercentageParameter.Value; }
+    }
+    public IntValue QualityDifferenceMaxAttempts {
+      get { return QualityDifferenceMaxAttemptsParameter.Value; }
+    }
+    public BoolValue QualityDifferenceUseRange {
+      get { return QualityDifferenceUseRangeParameter.Value; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected NoSameMatesSelector(bool deserializing) : base(deserializing) { }
+    protected NoSameMatesSelector(NoSameMatesSelector original, Cloner cloner)
+      : base(original, cloner) {
+      RegisterParameterEventHandlers();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new NoSameMatesSelector(this, cloner);
+    }
+
+    public NoSameMatesSelector()
+      : base() {
+      #region Create parameters
+      Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", new TournamentSelector()));
+      Parameters.Add(new FixedValueParameter<PercentValue>(QualityDifferencePercentageParameterName, "The minimum quality difference from parent1 to parent2 to accept the selection.", new PercentValue(0.05)));
+      Parameters.Add(new FixedValueParameter<IntValue>(QualityDifferenceMaxAttemptsParameterName, "The maximum number of attempts to find parents which differ in quality.", new IntValue(5)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(QualityDifferenceUseRangeParameterName, "Use the range from minimum to maximum quality as basis for QualityDifferencePercentage.", new BoolValue(true)));
+      #endregion
+
+      RegisterParameterEventHandlers();
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      #region conversion of old NSM parameters
+      if (Parameters.ContainsKey(SelectorParameterName)) { // change SelectorParameter type from ISelector to ISingleObjectiveSelector
+        ValueParameter<ISelector> param = Parameters[SelectorParameterName] as ValueParameter<ISelector>;
+        if (param != null) {
+          ISingleObjectiveSelector selector = param.Value as ISingleObjectiveSelector;
+          if (selector == null) selector = new TournamentSelector();
+          Parameters.Remove(SelectorParameterName);
+          Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", selector));
+        }
+      }
+      // FixedValueParameter for quality difference percentage, max attempts, use range
+      if (Parameters.ContainsKey(QualityDifferencePercentageParameterName)) {
+        ValueParameter<PercentValue> param = Parameters[QualityDifferencePercentageParameterName] as ValueParameter<PercentValue>;
+        if (!(param is FixedValueParameter<PercentValue>)) {
+          PercentValue diff = param != null ? param.Value as PercentValue : null;
+          if (diff == null) diff = new PercentValue(0.05);
+          Parameters.Remove(QualityDifferencePercentageParameterName);
+          Parameters.Add(new FixedValueParameter<PercentValue>(QualityDifferencePercentageParameterName, "The minimum quality difference from parent1 to parent2 to accept the selection.", diff));
+        }
+      }
+      if (Parameters.ContainsKey(QualityDifferenceMaxAttemptsParameterName)) {
+        ValueParameter<IntValue> param = Parameters[QualityDifferenceMaxAttemptsParameterName] as ValueParameter<IntValue>;
+        if (!(param is FixedValueParameter<IntValue>)) {
+          IntValue attempts = param != null ? param.Value as IntValue : null;
+          if (attempts == null) attempts = new IntValue(5);
+          Parameters.Remove(QualityDifferenceMaxAttemptsParameterName);
+          Parameters.Add(new FixedValueParameter<IntValue>(QualityDifferenceMaxAttemptsParameterName, "The maximum number of attempts to find parents which differ in quality.", attempts));
+        }
+      }
+      if (Parameters.ContainsKey(QualityDifferenceUseRangeParameterName)) {
+        ValueParameter<BoolValue> param = Parameters[QualityDifferenceUseRangeParameterName] as ValueParameter<BoolValue>;
+        if (!(param is FixedValueParameter<BoolValue>)) {
+          BoolValue range = param != null ? param.Value as BoolValue : null;
+          if (range == null) range = new BoolValue(true);
+          Parameters.Remove(QualityDifferenceUseRangeParameterName);
+          Parameters.Add(new FixedValueParameter<BoolValue>(QualityDifferenceUseRangeParameterName, "Use the range from minimum to maximum quality as basis for QualityDifferencePercentage.", range));
+        }
+      }
+      if (!Parameters.ContainsKey(QualityDifferenceUseRangeParameterName)) // add use range parameter
+        Parameters.Add(new FixedValueParameter<BoolValue>(QualityDifferenceUseRangeParameterName, "Use the range from minimum to maximum quality as basis for QualityDifferencePercentage.", new BoolValue(true)));
+      #endregion
+
+      RegisterParameterEventHandlers();
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int parentsToSelect = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      if (parentsToSelect % 2 > 0) throw new InvalidOperationException(Name + ": There must be an equal number of sub-scopes to be selected.");
+      IScope[] selected = new IScope[parentsToSelect];
+      IScope[] parentsPool = new IScope[parentsToSelect];
+
+      double qualityDifferencePercentage = QualityDifferencePercentage.Value;
+      int qualityDifferenceMaxAttempts = QualityDifferenceMaxAttempts.Value;
+      bool qualityDifferenceUseRange = QualityDifferenceUseRange.Value;
+      string qualityName = QualityParameter.ActualName;
+
+      // calculate quality offsets   
+      double absoluteQualityOffset = 0;
+      double minRelativeQualityOffset = 0;
+      double maxRelativeQualityOffset = 0;
+      if (qualityDifferenceUseRange) {
+        // maximization flag is not needed because only the range is relevant
+        double minQuality = QualityParameter.ActualValue.Min(x => x.Value);
+        double maxQuality = QualityParameter.ActualValue.Max(x => x.Value);
+        absoluteQualityOffset = (maxQuality - minQuality) * qualityDifferencePercentage;
+      } else {
+        maxRelativeQualityOffset = 1.0 + qualityDifferencePercentage;
+        minRelativeQualityOffset = 1.0 - qualityDifferencePercentage;
+      }
+
+      int selectedParents = 0;
+      int poolCount = 0;
+      // repeat until enough parents are selected or max attempts are reached
+      for (int attempts = 1; attempts <= qualityDifferenceMaxAttempts && selectedParents < parentsToSelect - 1; attempts++) {
+        ApplyInnerSelector();
+        ScopeList parents = CurrentScope.SubScopes[1].SubScopes;
+
+        for (int indexParent1 = 0, indexParent2 = 1;
+             indexParent1 < parents.Count - 1 && selectedParents < parentsToSelect - 1;
+             indexParent1 += 2, indexParent2 += 2) {
+          double qualityParent1 = ((DoubleValue)parents[indexParent1].Variables[qualityName].Value).Value;
+          double qualityParent2 = ((DoubleValue)parents[indexParent2].Variables[qualityName].Value).Value;
+
+          bool parentsDifferent;
+          if (qualityDifferenceUseRange) {
+            parentsDifferent = (qualityParent2 > qualityParent1 - absoluteQualityOffset ||
+                                qualityParent2 < qualityParent1 + absoluteQualityOffset);
+          } else {
+            parentsDifferent = (qualityParent2 > qualityParent1 * maxRelativeQualityOffset ||
+                                qualityParent2 < qualityParent1 * minRelativeQualityOffset);
+          }
+
+          if (parentsDifferent) {
+            // inner selector already copied scopes, no cloning necessary here
+            selected[selectedParents++] = parents[indexParent1];
+            selected[selectedParents++] = parents[indexParent2];
+          } else if (attempts == qualityDifferenceMaxAttempts &&
+                     poolCount < parentsToSelect - selectedParents) {
+            // last attempt: save parents to fill remaining positions
+            parentsPool[poolCount++] = parents[indexParent1];
+            parentsPool[poolCount++] = parents[indexParent2];
+          }
+        }
+        // modify scopes
+        ScopeList remaining = CurrentScope.SubScopes[0].SubScopes;
+        CurrentScope.SubScopes.Clear();
+        CurrentScope.SubScopes.AddRange(remaining);
+      }
+      // fill remaining positions with parents which don't meet the difference criterion 
+      if (selectedParents < parentsToSelect - 1) {
+        Array.Copy(parentsPool, 0, selected, selectedParents, parentsToSelect - selectedParents);
+      }
+      return selected;
+    }
+
+    #region Events
+    private void RegisterParameterEventHandlers() {
+      SelectorParameter.ValueChanged += new EventHandler(SelectorParameter_ValueChanged);
+      CopySelected.ValueChanged += new EventHandler(CopySelected_ValueChanged);
+    }
+
+    private void SelectorParameter_ValueChanged(object sender, EventArgs e) {
+      ParameterizeSelector(Selector);
+    }
+
+    private void CopySelected_ValueChanged(object sender, EventArgs e) {
+      if (CopySelected.Value != true) {
+        CopySelected.Value = true;
+      }
+    }
+    #endregion
+
+    #region Helpers
+    private void ParameterizeSelector(ISingleObjectiveSelector selector) {
+      selector.CopySelected = new BoolValue(true); // must always be true
+      selector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      selector.QualityParameter.ActualName = QualityParameter.Name;
+
+      IStochasticOperator stoOp = (selector as IStochasticOperator);
+      if (stoOp != null) stoOp.RandomParameter.ActualName = RandomParameter.Name;
+    }
+
+    private void ApplyInnerSelector() {
+      // necessary for inner GenderSpecificSelector to execute all operations in OperationCollection
+      Stack<IOperation> executionStack = new Stack<IOperation>();
+      executionStack.Push(ExecutionContext.CreateChildOperation(Selector));
+      while (executionStack.Count > 0) {
+        CancellationToken.ThrowIfCancellationRequested();
+        IOperation next = executionStack.Pop();
+        if (next is OperationCollection) {
+          OperationCollection coll = (OperationCollection)next;
+          for (int i = coll.Count - 1; i >= 0; i--)
+            if (coll[i] != null) executionStack.Push(coll[i]);
+        } else if (next is IAtomicOperation) {
+          IAtomicOperation operation = (IAtomicOperation)next;
+          next = operation.Operator.Execute((IExecutionContext)operation, CancellationToken);
+          if (next != null) executionStack.Push(next);
+        }
+      }
+    }
+    #endregion
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/OffspringSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/OffspringSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/OffspringSelector.cs	(revision 7779)
@@ -0,0 +1,176 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("OffspringSelector", "Selects among the offspring population those that are designated successful and discards the unsuccessful offspring, except for some lucky losers. It expects the parent scopes to be below the first sub-scope, and offspring scopes to be below the second sub-scope separated again in two sub-scopes, the first with the failed offspring and the second with successful offspring.")]
+  [StorableClass]
+  public class OffspringSelector : SingleSuccessorOperator {
+    public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
+    }
+    public ValueLookupParameter<DoubleValue> SuccessRatioParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
+    }
+    public LookupParameter<DoubleValue> SelectionPressureParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["SelectionPressure"]; }
+    }
+    public LookupParameter<DoubleValue> CurrentSuccessRatioParameter {
+      get { return (LookupParameter<DoubleValue>)Parameters["CurrentSuccessRatio"]; }
+    }
+    public LookupParameter<ItemList<IScope>> OffspringPopulationParameter {
+      get { return (LookupParameter<ItemList<IScope>>)Parameters["OffspringPopulation"]; }
+    }
+    public LookupParameter<IntValue> OffspringPopulationWinnersParameter {
+      get { return (LookupParameter<IntValue>)Parameters["OffspringPopulationWinners"]; }
+    }
+    public ScopeTreeLookupParameter<BoolValue> SuccessfulOffspringParameter {
+      get { return (ScopeTreeLookupParameter<BoolValue>)Parameters["SuccessfulOffspring"]; }
+    }
+    public OperatorParameter OffspringCreatorParameter {
+      get { return (OperatorParameter)Parameters["OffspringCreator"]; }
+    }
+
+    public IOperator OffspringCreator {
+      get { return OffspringCreatorParameter.Value; }
+      set { OffspringCreatorParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected OffspringSelector(bool deserializing) : base(deserializing) { }
+    protected OffspringSelector(OffspringSelector original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new OffspringSelector(this, cloner);
+    }
+    public OffspringSelector()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure which prematurely terminates the offspring selection step."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful offspring that has to be produced."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("SelectionPressure", "The amount of selection pressure currently necessary to fulfill the success ratio."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio indicates how much of the successful offspring have already been generated."));
+      Parameters.Add(new LookupParameter<ItemList<IScope>>("OffspringPopulation", "Temporary store of the offspring population."));
+      Parameters.Add(new LookupParameter<IntValue>("OffspringPopulationWinners", "Temporary store the number of successful offspring in the offspring population."));
+      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("SuccessfulOffspring", "True if the offspring was more successful than its parents.", 2));
+      Parameters.Add(new OperatorParameter("OffspringCreator", "The operator used to create new offspring."));
+    }
+
+    public override IOperation Apply() {
+      double maxSelPress = MaximumSelectionPressureParameter.ActualValue.Value;
+      double successRatio = SuccessRatioParameter.ActualValue.Value;
+      IScope scope = ExecutionContext.Scope;
+      IScope parents = scope.SubScopes[0];
+      IScope offspring = scope.SubScopes[1];
+      int populationSize = parents.SubScopes.Count;
+
+      // retrieve actual selection pressure and success ratio
+      DoubleValue selectionPressure = SelectionPressureParameter.ActualValue;
+      if (selectionPressure == null) {
+        selectionPressure = new DoubleValue(0);
+        SelectionPressureParameter.ActualValue = selectionPressure;
+      }
+      DoubleValue currentSuccessRatio = CurrentSuccessRatioParameter.ActualValue;
+      if (currentSuccessRatio == null) {
+        currentSuccessRatio = new DoubleValue(0);
+        CurrentSuccessRatioParameter.ActualValue = currentSuccessRatio;
+      }
+
+      // retrieve next population
+      ItemList<IScope> population = OffspringPopulationParameter.ActualValue;
+      IntValue successfulOffspring;
+      if (population == null) {
+        population = new ItemList<IScope>();
+        OffspringPopulationParameter.ActualValue = population;
+        selectionPressure.Value = 0; // initialize selection pressure for this round
+        currentSuccessRatio.Value = 0; // initialize current success ratio for this round
+        successfulOffspring = new IntValue(0);
+        OffspringPopulationWinnersParameter.ActualValue = successfulOffspring;
+      } else successfulOffspring = OffspringPopulationWinnersParameter.ActualValue;
+
+      int worseOffspringNeeded = (int)((1 - successRatio) * populationSize) - (population.Count - successfulOffspring.Value);
+      int successfulOffspringAdded = 0;
+
+      // implement the ActualValue fetch here - otherwise the parent scope would also be included, given that there may be 1000 or more parents, this is quite unnecessary
+      string tname = SuccessfulOffspringParameter.TranslatedName;
+      double tmpSelPress = selectionPressure.Value, tmpSelPressInc = 1.0 / populationSize;
+      for (int i = 0; i < offspring.SubScopes.Count; i++) {
+        // fetch value
+        IVariable tmpVar;
+        if (!offspring.SubScopes[i].Variables.TryGetValue(tname, out tmpVar)) throw new InvalidOperationException(Name + ": Could not determine if an offspring was successful or not.");
+        BoolValue tmp = (tmpVar.Value as BoolValue);
+        if (tmp == null) throw new InvalidOperationException(Name + ": The variable that indicates whether an offspring is successful or not must contain a BoolValue.");
+
+        // add to population
+        if (tmp.Value) {
+          IScope currentOffspring = offspring.SubScopes[i];
+          offspring.SubScopes.Remove(currentOffspring);
+          i--;
+          population.Add(currentOffspring);
+          successfulOffspringAdded++;
+        } else if (worseOffspringNeeded > 0 || tmpSelPress >= maxSelPress) {
+          IScope currentOffspring = offspring.SubScopes[i];
+          offspring.SubScopes.Remove(currentOffspring);
+          i--;
+          population.Add(currentOffspring);
+          worseOffspringNeeded--;
+        }
+        tmpSelPress += tmpSelPressInc;
+        if (population.Count == populationSize) break;
+      }
+      successfulOffspring.Value += successfulOffspringAdded;
+
+      // calculate actual selection pressure and success ratio
+      selectionPressure.Value = tmpSelPress;
+      currentSuccessRatio.Value = successfulOffspring.Value / ((double)populationSize);
+
+      // check if enough children have been generated
+      if (((selectionPressure.Value < maxSelPress) && (currentSuccessRatio.Value < successRatio)) ||
+          (population.Count < populationSize)) {
+        // more children required -> reduce left and start children generation again
+        scope.SubScopes.Remove(parents);
+        scope.SubScopes.Remove(offspring);
+        while (parents.SubScopes.Count > 0) {
+          IScope parent = parents.SubScopes[0];
+          parents.SubScopes.RemoveAt(0);
+          scope.SubScopes.Add(parent);
+        }
+
+        IOperator moreOffspring = OffspringCreatorParameter.ActualValue as IOperator;
+        if (moreOffspring == null) throw new InvalidOperationException(Name + ": More offspring are required, but no operator specified for creating them.");
+        return ExecutionContext.CreateOperation(moreOffspring);
+      } else {
+        // enough children generated
+        offspring.SubScopes.Clear();
+        offspring.SubScopes.AddRange(population);
+
+        scope.Variables.Remove(OffspringPopulationParameter.TranslatedName);
+        scope.Variables.Remove(OffspringPopulationWinnersParameter.TranslatedName);
+        return base.Apply();
+      }
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs	(revision 7779)
@@ -0,0 +1,40 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.PluginInfrastructure;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// Plugin class for HeuristicLab.Selection plugin.
+  /// </summary>
+  [Plugin("HeuristicLab.Selection", "3.3.6.0")]
+  [PluginFile("HeuristicLab.Selection-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  public class HeuristicLabSelectionPlugin : PluginBase {
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs.frame
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs.frame	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Plugin.cs.frame	(revision 7779)
@@ -0,0 +1,40 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.PluginInfrastructure;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// Plugin class for HeuristicLab.Selection plugin.
+  /// </summary>
+  [Plugin("HeuristicLab.Selection", "3.3.6.$WCREV$")]
+  [PluginFile("HeuristicLab.Selection-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  public class HeuristicLabSelectionPlugin : PluginBase {
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Properties/AssemblyInfo.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Properties/AssemblyInfo.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Properties/AssemblyInfo.cs	(revision 7779)
@@ -0,0 +1,56 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Selection")]
+[assembly: AssemblyDescription("HeuristicLab selection operators")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2012 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("ed119c1e-a48f-41de-a797-43352ff4f1a3")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.6.7259")]
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Properties/AssemblyInfo.cs.frame	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Properties/AssemblyInfo.cs.frame	(revision 7779)
@@ -0,0 +1,56 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Selection")]
+[assembly: AssemblyDescription("HeuristicLab selection operators")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2012 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("ed119c1e-a48f-41de-a797-43352ff4f1a3")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.6.$WCREV$")]
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ProportionalSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ProportionalSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/ProportionalSelector.cs	(revision 7779)
@@ -0,0 +1,117 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A quality proportional selection operator which considers a single double quality value for selection.
+  /// </summary>
+  [Item("ProportionalSelector", "A quality proportional selection operator which considers a single double quality value for selection.")]
+  [StorableClass]
+  public sealed class ProportionalSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
+    private ValueParameter<BoolValue> WindowingParameter {
+      get { return (ValueParameter<BoolValue>)Parameters["Windowing"]; }
+    }
+
+    public BoolValue Windowing {
+      get { return WindowingParameter.Value; }
+      set { WindowingParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    private ProportionalSelector(bool deserializing) : base(deserializing) { }
+    private ProportionalSelector(ProportionalSelector original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ProportionalSelector(this, cloner);
+    }
+    public ProportionalSelector()
+      : base() {
+      Parameters.Add(new ValueParameter<BoolValue>("Windowing", "Apply windowing strategy (selection probability is proportional to the quality differences and not to the total quality).", new BoolValue(true)));
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IRandom random = RandomParameter.ActualValue;
+      bool maximization = MaximizationParameter.ActualValue.Value;
+      bool windowing = WindowingParameter.Value.Value;
+      IScope[] selected = new IScope[count];
+
+      // prepare qualities for proportional selection
+      var qualities = QualityParameter.ActualValue.Select(x => x.Value);
+      double minQuality = qualities.Min();
+      double maxQuality = qualities.Max();
+      if (minQuality == maxQuality) {  // all quality values are equal
+        qualities = qualities.Select(x => 1.0);
+      } else {
+        if (windowing) {
+          if (maximization)
+            qualities = qualities.Select(x => x - minQuality);
+          else
+            qualities = qualities.Select(x => maxQuality - x);
+        } else {
+          if (minQuality < 0.0) throw new InvalidOperationException("Proportional selection without windowing does not work with quality values < 0.");
+          if (!maximization) {
+            double limit = Math.Min(maxQuality * 2, double.MaxValue);
+            qualities = qualities.Select(x => limit - x);
+          }
+        }
+      }
+
+      List<double> list = qualities.ToList();
+      double qualitySum = qualities.Sum();
+      for (int i = 0; i < count; i++) {
+        double selectedQuality = random.NextDouble() * qualitySum;
+        int index = 0;
+        double currentQuality = list[index];
+        while (currentQuality < selectedQuality) {
+          index++;
+          currentQuality += list[index];
+        }
+        if (copy) {
+          selected[i] = (IScope)scopes[index].Clone();
+          // map the selected (cloned) tree to the original tree
+          var original = scopes[index].Variables.First().Value;
+          var clone = selected[i].Variables.First().Value; 
+          GlobalCloneMap.Add(clone, original);
+        } else {
+          selected[i] = scopes[index];
+          scopes.RemoveAt(index);
+          qualitySum -= list[index];
+          list.RemoveAt(index);
+        }
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomReplacer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomReplacer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomReplacer.cs	(revision 7779)
@@ -0,0 +1,75 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("RandomReplacer", "Replaces some randomly selected sub-scopes of the remaining scope with all those (or the best if there are more) from the selected scope.")]
+  [StorableClass]
+  public sealed class RandomReplacer : Replacer, IStochasticOperator, ISingleObjectiveReplacer {
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    public override bool CanChangeDescription {
+      get { return false; }
+    }
+
+    public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
+      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
+    }
+    public IValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+
+    [StorableConstructor]
+    private RandomReplacer(bool deserializing) : base(deserializing) { }
+    private RandomReplacer(RandomReplacer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RandomReplacer(this, cloner);
+    }
+    public RandomReplacer()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of a solution."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator to use."));
+
+      RandomSelector randomSelector = new RandomSelector();
+      randomSelector.RandomParameter.ActualName = RandomParameter.Name;
+      ReplacedSelectorParameter.Value = randomSelector;
+      ReplacedSelectorParameter.Hidden = true;
+      BestSelector bestSelector = new BestSelector();
+      bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestSelector.QualityParameter.ActualName = QualityParameter.Name;
+      SelectedSelectorParameter.Value = bestSelector;
+      SelectedSelectorParameter.Hidden = true;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs	(revision 7779)
@@ -0,0 +1,82 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A random selection operator.
+  /// </summary>
+  [Item("RandomSelector", "A random selection operator.")]
+  [StorableClass]
+  public sealed class RandomSelector : StochasticSelector, ISelector {
+    private IValueParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    private RandomSelector(bool deserializing) : base(deserializing) { }
+    private RandomSelector(RandomSelector original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RandomSelector(this, cloner);
+    }
+    public RandomSelector()
+      : base() {
+      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
+      CopySelectedParameter.Hidden = true;
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IRandom random = RandomParameter.ActualValue;
+      IScope[] selected = new IScope[count];
+
+      for (int i = 0; i < count; i++) {
+        if (copy)
+          selected[i] = (IScope)scopes[random.Next(scopes.Count)].Clone();
+        else {
+          int index = random.Next(scopes.Count);
+          selected[i] = scopes[index];
+          scopes.RemoveAt(index);
+        }
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Reducer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Reducer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Reducer.cs	(revision 7779)
@@ -0,0 +1,66 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A base class for reduction operators.
+  /// </summary>
+  [Item("Reducer", "A base class for reduction operators.")]
+  [StorableClass]
+  public abstract class Reducer : SingleSuccessorOperator {
+    protected ScopeParameter CurrentScopeParameter {
+      get { return (ScopeParameter)Parameters["CurrentScope"]; }
+    }
+
+    public IScope CurrentScope {
+      get { return CurrentScopeParameter.ActualValue; }
+    }
+
+    [StorableConstructor]
+    protected Reducer(bool deserializing) : base(deserializing) { }
+    protected Reducer(Reducer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    protected Reducer()
+      : base() {
+      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected."));
+    }
+
+    public sealed override IOperation Apply() {
+      List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes);
+      List<IScope> reduced = Reduce(scopes);
+
+      CurrentScope.SubScopes.Clear();
+      CurrentScope.SubScopes.AddRange(reduced);
+
+      return base.Apply();
+    }
+
+    protected abstract List<IScope> Reduce(List<IScope> scopes);
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Replacer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Replacer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Replacer.cs	(revision 7779)
@@ -0,0 +1,102 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("Replacer", "Generic replacer that replaces sub-scopes of the remaining scope with those from the selected scope.")]
+  [StorableClass]
+  public class Replacer : AlgorithmOperator, IReplacer {
+    public IValueLookupParameter<ISelector> ReplacedSelectorParameter {
+      get { return (IValueLookupParameter<ISelector>)Parameters["ReplacedSelector"]; }
+    }
+    public IValueLookupParameter<ISelector> SelectedSelectorParameter {
+      get { return (IValueLookupParameter<ISelector>)Parameters["SelectedSelector"]; }
+    }
+
+    [StorableConstructor]
+    protected Replacer(bool deserializing) : base(deserializing) { }
+    protected Replacer(Replacer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Replacer(this, cloner);
+    }
+    public Replacer() {
+      Parameters.Add(new ValueLookupParameter<ISelector>("ReplacedSelector", "The selection operator to select those scopes that are to be replaced. If no selection operator is defined, random selection will be applied."));
+      Parameters.Add(new ValueLookupParameter<ISelector>("SelectedSelector", "The selection operator to select those scopes that are replacing the others. If no selection operator is defined, random selection will be applied."));
+
+      SubScopesProcessor ssp = new SubScopesProcessor();
+
+      Placeholder replacedSelector = new Placeholder();
+      replacedSelector.OperatorParameter.ActualName = ReplacedSelectorParameter.Name;
+
+      LeftReducer leftReducer = new LeftReducer();
+
+      Placeholder selectedSelector = new Placeholder();
+      selectedSelector.OperatorParameter.ActualName = SelectedSelectorParameter.Name;
+
+      RightReducer rightReducer = new RightReducer();
+
+      MergingReducer merger = new MergingReducer();
+
+      OperatorGraph.InitialOperator = ssp;
+      ssp.Operators.Add(replacedSelector);
+      ssp.Operators.Add(selectedSelector);
+      ssp.Successor = merger;
+      replacedSelector.Successor = leftReducer;
+      leftReducer.Successor = null;
+      selectedSelector.Successor = rightReducer;
+      rightReducer.Successor = null;
+      merger.Successor = null;
+    }
+
+    public override IOperation Apply() {
+      if (ExecutionContext.Scope.SubScopes.Count != 2) throw new InvalidOperationException(Name + ": There must be two sub-scopes which should be replaced/merged.");
+      int remaining = ExecutionContext.Scope.SubScopes[0].SubScopes.Count;
+      int selected = ExecutionContext.Scope.SubScopes[1].SubScopes.Count;
+
+      ISelector replacedSelector = ReplacedSelectorParameter.ActualValue;
+      ISelector selectedSelector = SelectedSelectorParameter.ActualValue;
+
+      if (replacedSelector == null) {
+        ReplacedSelectorParameter.Value = new RandomSelector();
+        replacedSelector = ReplacedSelectorParameter.Value;
+      }
+      replacedSelector.CopySelected = new BoolValue(false);
+      replacedSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(Math.Min(remaining, selected));
+
+      if (selectedSelector == null) {
+        SelectedSelectorParameter.Value = new RandomSelector();
+        selectedSelector = SelectedSelectorParameter.Value;
+      }
+      selectedSelector.CopySelected = new BoolValue(false);
+      selectedSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(Math.Min(remaining, selected));
+
+      return base.Apply();
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightChildReducer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightChildReducer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightChildReducer.cs	(revision 7779)
@@ -0,0 +1,79 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// Reduces the sub-scopes, so that the selected sub-scope contains all selected leaves (1) and (2)
+  /// and the remaining sub-scope contains the sub-scopes of the bottom-most remaining scope (3).
+  /// <pre>                                                      
+  ///                  scope            scope  
+  ///                   / \             /   \      
+  ///                  R   S(1)   =>   R     S                 
+  ///                 / \     \       /|\   /|\       
+  ///               R(3) S(2)  C     ABCDEF  CDEF      
+  ///               /|\  /|\                              
+  ///             ABCDEF DEF                             
+  /// </pre>
+  /// </summary>
+  [Item("RightChildReducer", "Merges all sub-scopes generated by successively selecting sub-scopes of the remaining part.")]
+  [StorableClass]
+  public class RightChildReducer : Reducer, IReducer {
+    [StorableConstructor]
+    protected RightChildReducer(bool deserializing) : base(deserializing) { }
+    protected RightChildReducer(RightChildReducer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RightChildReducer(this, cloner);
+    }
+    public RightChildReducer() : base() { }
+    /// <summary>
+    ///  Reduces the sub-scopes, so that the selected sub-scope contains all selected leaves
+    /// and the remaining sub-scope contains the sub-scopes of the bottom-most remaining scope.
+    /// </summary>
+    /// <param name="scope">The current scope to reduce.</param>
+    /// <returns>A list of the new reduced sub scopes.</returns>
+    protected override List<IScope> Reduce(List<IScope> scopes) {
+      IScope rightChild = scopes[scopes.Count - 1];
+      IScope leftChild = scopes[0];
+      while (leftChild.SubScopes.Count > 1 && leftChild.SubScopes[0].SubScopes.Count > 0) {
+        IScope leftRightChild = leftChild.SubScopes[leftChild.SubScopes.Count - 1];
+
+        // merge right children
+        while (leftRightChild.SubScopes.Count > 0) {
+          IScope leftRightChildChild = leftRightChild.SubScopes[0];
+          leftRightChild.SubScopes.RemoveAt(0);
+          rightChild.SubScopes.Add(leftRightChildChild);
+        }
+
+        leftChild = leftChild.SubScopes[0];
+      }
+      List<IScope> subScopes = new List<IScope>();
+      subScopes.Add(leftChild);
+      subScopes.Add(rightChild);
+      return subScopes;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightReducer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightReducer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightReducer.cs	(revision 7779)
@@ -0,0 +1,49 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// An operator which reduces to the sub-scopes of the rightmost sub-scope of the current scope.
+  /// </summary>
+  [Item("RightReducer", "An operator which reduces to the sub-scopes of the rightmost sub-scope of the current scope.")]
+  [StorableClass]
+  public sealed class RightReducer : Reducer, IReducer {
+    [StorableConstructor]
+    private RightReducer(bool deserializing) : base(deserializing) { }
+    private RightReducer(RightReducer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RightReducer(this, cloner);
+    }
+    public RightReducer() : base() { }
+
+    protected override List<IScope> Reduce(List<IScope> scopes) {
+      List<IScope> reduced = new List<IScope>();
+      if (scopes.Count > 0) reduced.AddRange(scopes[scopes.Count - 1].SubScopes);
+      return reduced;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RightSelector.cs	(revision 7779)
@@ -0,0 +1,80 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// An operator which selects sub-scopes from right to left.
+  /// </summary>
+  [Item("RightSelector", "An operator which selects sub-scopes from right to left.")]
+  [StorableClass]
+  public sealed class RightSelector : Selector {
+    private IValueParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+    [StorableConstructor]
+    private RightSelector(bool deserializing) : base(deserializing) { }
+    private RightSelector(RightSelector original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RightSelector(this, cloner);
+    }
+
+    public RightSelector()
+      : base() {
+      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
+      CopySelectedParameter.Hidden = true;
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IScope[] selected = new IScope[count];
+
+      int j = scopes.Count - 1;
+      for (int i = 0; i < count; i++) {
+        if (copy) {
+          selected[i] = (IScope)scopes[j].Clone();
+          j--;
+          if (j < 0) j = scopes.Count - 1;
+        } else {
+          selected[i] = scopes[scopes.Count - 1];
+          scopes.RemoveAt(scopes.Count - 1);
+        }
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Selector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Selector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/Selector.cs	(revision 7779)
@@ -0,0 +1,95 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+using CloneMapType = HeuristicLab.Core.ItemDictionary<HeuristicLab.Core.IItem, HeuristicLab.Core.IItem>;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A base class for selection operators.
+  /// </summary>
+  [Item("Selector", "A base class for selection operators.")]
+  [StorableClass]
+  public abstract class Selector : SingleSuccessorOperator {
+    protected const string GlobalCloneMapParameterName = "GlobalCloneMap";
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    protected ScopeParameter CurrentScopeParameter {
+      get { return (ScopeParameter)Parameters["CurrentScope"]; }
+    }
+
+    public IScope CurrentScope {
+      get { return CurrentScopeParameter.ActualValue; }
+    }
+
+    public LookupParameter<CloneMapType> GlobalCloneMapParameter {
+      get { return (LookupParameter<CloneMapType>)Parameters[GlobalCloneMapParameterName]; }
+    }
+
+    public CloneMapType GlobalCloneMap {
+      get { return GlobalCloneMapParameter.ActualValue; }
+    }
+    [StorableConstructor]
+    protected Selector(bool deserializing) : base(deserializing) { }
+    protected Selector(Selector original, Cloner cloner) : base(original, cloner) { }
+
+    protected Selector()
+      : base() {
+      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected."));
+      Parameters.Add(new LookupParameter<CloneMapType>(GlobalCloneMapParameterName, "A global map keeping track of trees and their clones (made during selection)."));
+    }
+
+    public sealed override IOperation Apply() {
+      List<IScope> scopes = new List<IScope>(CurrentScope.SubScopes);
+
+      if (GlobalCloneMap == null) {
+        var gScope = ExecutionContext.Scope;
+        while (gScope.Parent != null) gScope = gScope.Parent;
+        gScope.Variables.Add(new Variable(GlobalCloneMapParameterName, new CloneMapType()));
+      } else {
+        GlobalCloneMap.Clear();
+      }
+
+      IScope[] selected = Select(scopes);
+
+      CurrentScope.SubScopes.Clear();
+      IScope remainingScope = new Scope("Remaining");
+      remainingScope.SubScopes.AddRange(scopes);
+      CurrentScope.SubScopes.Add(remainingScope);
+      IScope selectedScope = new Scope("Selected");
+      selectedScope.SubScopes.AddRange(selected);
+      CurrentScope.SubScopes.Add(selectedScope);
+
+      return base.Apply();
+    }
+
+    protected abstract IScope[] Select(List<IScope> scopes);
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs	(revision 7779)
@@ -0,0 +1,66 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A base class for selection operators which consider a single double quality value for selection.
+  /// </summary>
+  [Item("SingleObjectiveSelector", "A base class for selection operators which consider a single double quality value for selection.")]
+  [StorableClass]
+  public abstract class SingleObjectiveSelector : Selector {
+    protected IValueParameter<BoolValue> CopySelectedParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
+    }
+    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+    public IValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
+      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
+    }
+
+    public BoolValue CopySelected {
+      get { return CopySelectedParameter.Value; }
+      set { CopySelectedParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected SingleObjectiveSelector(bool deserializing) : base(deserializing) { }
+    protected SingleObjectiveSelector(SingleObjectiveSelector original, Cloner cloner) : base(original, cloner) { }
+
+    protected SingleObjectiveSelector()
+      : base() {
+      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the current problem is a maximization problem, otherwise false."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality value contained in each sub-scope which is used for selection."));
+      CopySelectedParameter.Hidden = true;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/StochasticSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/StochasticSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/StochasticSelector.cs	(revision 7779)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A base class for stochastic selection operators.
+  /// </summary>
+  [Item("StochasticSelector", "A base class for stochastic selection operators.")]
+  [StorableClass]
+  public abstract class StochasticSelector : Selector, IStochasticOperator {
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+
+    [StorableConstructor]
+    protected StochasticSelector(bool deserializing) : base(deserializing) { }
+    protected StochasticSelector(StochasticSelector original, Cloner cloner) : base(original, cloner) { }
+    protected StochasticSelector()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator used for stochastic selection."));
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/StochasticSingleObjectiveSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/StochasticSingleObjectiveSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/StochasticSingleObjectiveSelector.cs	(revision 7779)
@@ -0,0 +1,46 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A base class for stochastic selection operators which consider a single double quality value for selection.
+  /// </summary>
+  [Item("StochasticSingleObjectiveSelector", "A base class for stochastic selection operators which consider a single double quality value for selection.")]
+  [StorableClass]
+  public abstract class StochasticSingleObjectiveSelector : SingleObjectiveSelector, IStochasticOperator {
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    [StorableConstructor]
+    protected StochasticSingleObjectiveSelector(bool deserializing) : base(deserializing) { }
+    protected StochasticSingleObjectiveSelector(StochasticSingleObjectiveSelector original, Cloner cloner) : base(original, cloner) { }
+    protected StochasticSingleObjectiveSelector()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator used for stochastic selection."));
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/TournamentSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/TournamentSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/TournamentSelector.cs	(revision 7779)
@@ -0,0 +1,89 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A tournament selection operator which considers a single double quality value for selection.
+  /// </summary>
+  [Item("TournamentSelector", "A tournament selection operator which considers a single double quality value for selection.")]
+  [StorableClass]
+  public sealed class TournamentSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
+    public ValueLookupParameter<IntValue> GroupSizeParameter {
+      get { return (ValueLookupParameter<IntValue>)Parameters["GroupSize"]; }
+    }
+
+    [StorableConstructor]
+    private TournamentSelector(bool deserializing) : base(deserializing) { }
+    private TournamentSelector(TournamentSelector original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TournamentSelector(this, cloner);
+    }
+
+    public TournamentSelector()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<IntValue>("GroupSize", "The size of the tournament group.", new IntValue(2)));
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      IRandom random = RandomParameter.ActualValue;
+      bool maximization = MaximizationParameter.ActualValue.Value;
+      List<double> qualities = QualityParameter.ActualValue.Select(x => x.Value).ToList();
+      int groupSize = GroupSizeParameter.ActualValue.Value;
+      IScope[] selected = new IScope[count];
+
+      for (int i = 0; i < count; i++) {
+        int best = random.Next(scopes.Count);
+        int index;
+        for (int j = 1; j < groupSize; j++) {
+          index = random.Next(scopes.Count);
+          if (((maximization) && (qualities[index] > qualities[best])) ||
+              ((!maximization) && (qualities[index] < qualities[best]))) {
+            best = index;
+          }
+        }
+
+        if (copy) {
+          selected[i] = (IScope)scopes[best].Clone();
+          // map the selected (cloned) tree to the original tree
+          var original = scopes[best].Variables.First().Value;
+          var clone = selected[i].Variables.First().Value;
+          GlobalCloneMap.Add(clone, original);
+        } else {
+          selected[i] = scopes[best];
+          scopes.RemoveAt(best);
+          qualities.RemoveAt(best);
+        }
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/WorstReplacer.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/WorstReplacer.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/WorstReplacer.cs	(revision 7779)
@@ -0,0 +1,70 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  [Item("WorstReplacer", "Replaces the worst sub-scopes of the remaining scope with all those (or the best if there are more) from the selected scope.")]
+  [StorableClass]
+  public sealed class WorstReplacer : Replacer, ISingleObjectiveReplacer {
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    public override bool CanChangeDescription {
+      get { return false; }
+    }
+
+    public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
+      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
+    }
+    public IValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+
+    [StorableConstructor]
+    private WorstReplacer(bool deserializing) : base(deserializing) { }
+    private WorstReplacer(WorstReplacer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new WorstReplacer(this, cloner);
+    }
+    public WorstReplacer()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of a solution."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
+
+      WorstSelector worstSelector = new WorstSelector();
+      worstSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      worstSelector.QualityParameter.ActualName = QualityParameter.Name;
+      ReplacedSelectorParameter.Value = worstSelector;
+      ReplacedSelectorParameter.Hidden = true;
+      BestSelector bestSelector = new BestSelector();
+      bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestSelector.QualityParameter.ActualName = QualityParameter.Name;
+      SelectedSelectorParameter.Value = bestSelector;
+      SelectedSelectorParameter.Hidden = true;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/WorstSelector.cs
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/WorstSelector.cs	(revision 7779)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/WorstSelector.cs	(revision 7779)
@@ -0,0 +1,78 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Selection {
+  /// <summary>
+  /// A selection operator which considers a single double quality value and selects the worst.
+  /// </summary>
+  [Item("WorstSelector", "A selection operator which considers a single double quality value and selects the worst.")]
+  [StorableClass]
+  public sealed class WorstSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
+    [StorableConstructor]
+    private WorstSelector(bool deserializing) : base(deserializing) { }
+    private WorstSelector(WorstSelector original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new WorstSelector(this, cloner);
+    }
+    public WorstSelector() : base() { }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      int count = NumberOfSelectedSubScopesParameter.ActualValue.Value;
+      bool copy = CopySelectedParameter.Value.Value;
+      bool maximization = MaximizationParameter.ActualValue.Value;
+      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
+      IScope[] selected = new IScope[count];
+
+      // create a list for each scope that contains the scope's index in the original scope list
+      var temp = qualities.Select((x, index) => new { index, x.Value });
+      if (maximization)
+        temp = temp.OrderBy(x => x.Value);
+      else
+        temp = temp.OrderByDescending(x => x.Value);
+      var list = temp.ToList();
+
+      if (copy) {
+        int j = 0;
+        for (int i = 0; i < count; i++) {
+          selected[i] = (IScope)scopes[list[j].index].Clone();
+          j++;
+          if (j >= list.Count) j = 0;
+        }
+      } else {
+        for (int i = 0; i < count; i++) {
+          selected[i] = scopes[list[0].index];
+          scopes[list[0].index] = null;
+          list.RemoveAt(0);
+        }
+        scopes.RemoveAll(x => x == null);
+      }
+      return selected;
+    }
+  }
+}
Index: /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Tracking.sln
===================================================================
--- /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Tracking.sln	(revision 7778)
+++ /branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Tracking.sln	(revision 7779)
@@ -13,4 +13,6 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.EvolutionaryTracking-3.4", "HeuristicLab.EvolutionaryTracking\3.4\HeuristicLab.EvolutionaryTracking-3.4.csproj", "{1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.EvolutionaryTracking.Views-3.4", "HeuristicLab.EvolutionaryTracking.Views\3.4\HeuristicLab.EvolutionaryTracking.Views-3.4.csproj", "{318DFE8C-CA23-4F1B-A4AC-62B425060241}"
 EndProject
 Global
@@ -70,4 +72,16 @@
 		{1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|x64.ActiveCfg = Release|Any CPU
 		{1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|x86.ActiveCfg = Release|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|Any CPU.Build.0 = Release|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|x64.ActiveCfg = Release|Any CPU
+		{318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
