Index: /branches/plugins/HeuristicLab.Functions/3.2/Addition.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Addition.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Addition.cs	(revision 649)
@@ -0,0 +1,55 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using System.Linq;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Addition : FunctionBase {
+    public override string Description {
+      get {
+        return @"Returns the sum of all sub-tree results.
+    (+ 3) => 3
+    (+ 2 3) => 5
+    (+ 3 4 5) => 12";
+      }
+    }
+
+    public Addition()
+      : base() {
+      // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/And.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/And.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/And.cs	(revision 649)
@@ -0,0 +1,51 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class And : FunctionBase {
+    public override string Description {
+      get {
+        return @"Logical AND operation. Only defined for sub-tree-results 0.0 and 1.0.
+AND is a special form, sub-trees are evaluated from the first to the last. Evaluation is 
+stopped as soon as one of the sub-trees evaluates to 0.0 (false).";
+      }
+    }
+
+    public And()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Average.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Average.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Average.cs	(revision 649)
@@ -0,0 +1,49 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Constraints;
+
+namespace HeuristicLab.Functions {
+  public sealed class Average : FunctionBase {
+    public override string Description {
+      get {
+        return @"Returns the average (arithmetic mean) of all sub-tree results.";
+      }
+    }
+
+    public Average()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/BakedFunctionTree.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/BakedFunctionTree.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/BakedFunctionTree.cs	(revision 649)
@@ -0,0 +1,353 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Data;
+using System.Xml;
+using System.Globalization;
+
+namespace HeuristicLab.Functions {
+
+  class LightWeightFunction {
+    public int arity = 0;
+    public IFunction functionType;
+    public List<double> data = new List<double>();
+
+    public LightWeightFunction Clone() {
+      LightWeightFunction clone = new LightWeightFunction();
+      clone.arity = arity;
+      clone.functionType = functionType;
+      clone.data.AddRange(data);
+      return clone;
+    }
+  }
+
+  class BakedFunctionTree : ItemBase, IFunctionTree {
+    private List<LightWeightFunction> linearRepresentation;
+    internal List<LightWeightFunction> LinearRepresentation {
+      get {
+        FlattenVariables();
+        FlattenTrees(); 
+        return linearRepresentation;
+      }
+    }
+    private bool treesExpanded = false;
+    private List<IFunctionTree> subTrees;
+    private bool variablesExpanded = false;
+    private List<IVariable> variables;
+    private BakedTreeEvaluator evaluator;
+
+    public BakedFunctionTree() {
+      linearRepresentation = new List<LightWeightFunction>();
+    }
+
+    internal BakedFunctionTree(IFunction function)
+      : this() {
+      LightWeightFunction fun = new LightWeightFunction();
+      fun.functionType = function;
+      linearRepresentation.Add(fun);
+      treesExpanded = true;
+      subTrees = new List<IFunctionTree>();
+      variables = new List<IVariable>();
+      variablesExpanded = true;
+      foreach(IVariableInfo variableInfo in function.VariableInfos) {
+        if(variableInfo.Local) {
+          variables.Add((IVariable)function.GetVariable(variableInfo.FormalName).Clone());
+        }
+      }
+    }
+
+    internal BakedFunctionTree(IFunctionTree tree)
+      : this() {
+      LightWeightFunction fun = new LightWeightFunction();
+      fun.functionType = tree.Function;
+      linearRepresentation.Add(fun);
+      foreach(IVariable variable in tree.LocalVariables) {
+        IItem value = variable.Value;
+        fun.data.Add(GetDoubleValue(value));
+      }
+      foreach(IFunctionTree subTree in tree.SubTrees) {
+        AddSubTree(new BakedFunctionTree(subTree));
+      }
+    }
+
+    private double GetDoubleValue(IItem value) {
+      if(value is DoubleData) {
+        return ((DoubleData)value).Data;
+      } else if(value is ConstrainedDoubleData) {
+        return ((ConstrainedDoubleData)value).Data;
+      } else if(value is IntData) {
+        return ((IntData)value).Data;
+      } else if(value is ConstrainedIntData) {
+        return ((ConstrainedIntData)value).Data;
+      } else throw new NotSupportedException("Invalid datatype of local variable for GP");
+    }
+
+    private int BranchLength(int branchRoot) {
+      int arity = linearRepresentation[branchRoot].arity;
+      int length = 1;
+      for(int i = 0; i < arity; i++) {
+        length += BranchLength(branchRoot + length);
+      }
+      return length;
+    }
+
+    private void FlattenTrees() {
+      if(treesExpanded) {
+        linearRepresentation[0].arity = subTrees.Count;
+        foreach(BakedFunctionTree subTree in subTrees) {
+          subTree.FlattenVariables();
+          subTree.FlattenTrees();
+          linearRepresentation.AddRange(subTree.linearRepresentation);
+        }
+        treesExpanded = false;
+        subTrees = null;
+      }
+    }
+
+    private void FlattenVariables() {
+      if(variablesExpanded) {
+        linearRepresentation[0].data.Clear();
+        foreach(IVariable variable in variables) {
+          linearRepresentation[0].data.Add(GetDoubleValue(variable.Value));
+        }
+        variablesExpanded = false;
+        variables = null;
+      }
+    }
+
+    public int Size {
+      get {
+        if(treesExpanded) {
+          int size = 1;
+          foreach(BakedFunctionTree tree in subTrees) {
+            size += tree.Size;
+          }
+          return size;
+        } else 
+        return linearRepresentation.Count;
+      }
+    }
+
+    public int Height {
+      get {
+        if(treesExpanded) {
+          int height = 0;
+          foreach(IFunctionTree subTree in subTrees) {
+            int curHeight = subTree.Height;
+            if(curHeight > height) height = curHeight;
+          }
+          return height+1;
+        } else {
+          int nextBranchStart;
+          return BranchHeight(0, out nextBranchStart);
+        }
+      }
+    }
+
+    private int BranchHeight(int branchStart, out int nextBranchStart) {
+      LightWeightFunction f = linearRepresentation[branchStart];
+      int height = 0;
+      branchStart++;
+      for(int i = 0; i < f.arity; i++) {
+        int curHeight = BranchHeight(branchStart, out nextBranchStart);
+        if(curHeight > height) height = curHeight;
+        branchStart = nextBranchStart;
+      }
+      nextBranchStart = branchStart;
+      return height + 1;
+    }
+
+    public IList<IFunctionTree> SubTrees {
+      get {
+        if(!treesExpanded) {
+          subTrees = new List<IFunctionTree>();
+          int arity = linearRepresentation[0].arity;
+          int branchIndex = 1;
+          for(int i = 0; i < arity; i++) {
+            BakedFunctionTree subTree = new BakedFunctionTree();
+            int length = BranchLength(branchIndex);
+            for(int j = branchIndex; j < branchIndex + length; j++) {
+              subTree.linearRepresentation.Add(linearRepresentation[j]);
+            }
+            branchIndex += length;
+            subTrees.Add(subTree);
+          }
+          treesExpanded = true;
+          linearRepresentation.RemoveRange(1, linearRepresentation.Count - 1);
+          linearRepresentation[0].arity = 0;
+        }
+        return subTrees;
+      }
+    }
+
+    public ICollection<IVariable> LocalVariables {
+      get {
+        if(!variablesExpanded) {
+          variables = new List<IVariable>();
+          IFunction function = Function;
+          int localVariableIndex = 0;
+          foreach(IVariableInfo variableInfo in function.VariableInfos) {
+            if(variableInfo.Local) {
+              IVariable clone = (IVariable)function.GetVariable(variableInfo.FormalName).Clone();
+              IItem value = clone.Value;
+              if(value is ConstrainedDoubleData) {
+                ((ConstrainedDoubleData)value).Data = linearRepresentation[0].data[localVariableIndex];
+              } else if(value is ConstrainedIntData) {
+                ((ConstrainedIntData)value).Data = (int)linearRepresentation[0].data[localVariableIndex];
+              } else if(value is DoubleData) {
+                ((DoubleData)value).Data = linearRepresentation[0].data[localVariableIndex];
+              } else if(value is IntData) {
+                ((IntData)value).Data = (int)linearRepresentation[0].data[localVariableIndex];
+              } else throw new NotSupportedException("Invalid local variable type for GP.");
+              variables.Add(clone);
+              localVariableIndex++;
+            }
+          }
+          variablesExpanded = true;
+          linearRepresentation[0].data.Clear();
+        }
+        return variables;
+      }
+    }
+
+    public IFunction Function {
+      get { return linearRepresentation[0].functionType; }
+    }
+
+    public IVariable GetLocalVariable(string name) {
+      foreach(IVariable var in LocalVariables) {
+        if(var.Name == name) return var;
+      }
+      return null;
+    }
+
+    public void AddVariable(IVariable variable) {
+      throw new NotSupportedException();
+    }
+
+    public void RemoveVariable(string name) {
+      throw new NotSupportedException();
+    }
+
+    public void AddSubTree(IFunctionTree tree) {
+      if(!treesExpanded) throw new InvalidOperationException();
+      subTrees.Add(tree);
+    }
+
+    public void InsertSubTree(int index, IFunctionTree tree) {
+      if(!treesExpanded) throw new InvalidOperationException();
+      subTrees.Insert(index, tree);
+    }
+
+    public void RemoveSubTree(int index) {
+      // sanity check
+      if(!treesExpanded) throw new InvalidOperationException();
+      subTrees.RemoveAt(index);
+    }
+
+    public IEvaluator CreateEvaluator() {
+      return new BakedTreeEvaluator();
+    }
+
+    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
+      FlattenVariables();
+      FlattenTrees();
+      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
+      XmlNode linearRepresentationNode = document.CreateElement("LinearRepresentation");
+      foreach(LightWeightFunction f in linearRepresentation) {
+        XmlNode entryNode = PersistenceManager.Persist("FunctionType", f.functionType, document, persistedObjects);
+        XmlAttribute arityAttribute = document.CreateAttribute("Arity");
+        arityAttribute.Value = f.arity+"";
+        entryNode.Attributes.Append(arityAttribute);
+        if(f.data.Count > 0) {
+          XmlAttribute dataAttribute = document.CreateAttribute("Data");
+          dataAttribute.Value = GetString(f.data);
+          entryNode.Attributes.Append(dataAttribute);
+        }
+        linearRepresentationNode.AppendChild(entryNode);
+      }
+
+      node.AppendChild(linearRepresentationNode);
+      return node;
+    }
+
+    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(node, restoredObjects);
+      XmlNode linearRepresentationNode = node.SelectSingleNode("LinearRepresentation");
+      foreach(XmlNode entryNode in linearRepresentationNode.ChildNodes) {
+        LightWeightFunction f = new LightWeightFunction();
+        f.arity = int.Parse(entryNode.Attributes["Arity"].Value, CultureInfo.InvariantCulture);
+        if(entryNode.Attributes["Data"]!=null) 
+          f.data = GetList<double>(entryNode.Attributes["Data"].Value, s => double.Parse(s, CultureInfo.InvariantCulture));
+        f.functionType = (IFunction)PersistenceManager.Restore(entryNode, restoredObjects);
+        linearRepresentation.Add(f);
+      }
+      treesExpanded = false;
+      variablesExpanded = false;
+    }
+
+    private string GetString(IEnumerable<double> xs) {
+      StringBuilder builder = new StringBuilder();
+      foreach(double x in xs) {
+        builder.Append(x.ToString("r", CultureInfo.InvariantCulture) + "; ");
+      }
+      if(builder.Length > 0) builder.Remove(builder.Length - 2, 2);
+      return builder.ToString();
+    }
+
+    private List<T> GetList<T>(string s, Converter<string, T> converter) {
+      List<T> result = new List<T>();
+      string[] tokens = s.Split(new char[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries);
+      foreach(string token in tokens) {
+        T x = converter(token.Trim());
+        result.Add(x);
+      }
+      return result;
+    }
+
+    public override object Clone(IDictionary<Guid, object> clonedObjects) {
+      BakedFunctionTree clone = new BakedFunctionTree();
+      // in case the user (de)serialized the tree between evaluation and selection we have to flatten the tree again.
+      if(treesExpanded) FlattenTrees();
+      if(variablesExpanded) FlattenVariables();
+      foreach(LightWeightFunction f in linearRepresentation) {
+        clone.linearRepresentation.Add(f.Clone());
+      }
+      return clone;
+    }
+
+    public override IView CreateView() {
+      return new FunctionTreeView(this);
+    }
+
+    public override string ToString() {
+      SymbolicExpressionExporter exporter = new SymbolicExpressionExporter();
+      exporter.Visit(this);
+      return exporter.GetStringRepresentation();
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/BakedTreeEvaluator.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/BakedTreeEvaluator.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/BakedTreeEvaluator.cs	(revision 649)
@@ -0,0 +1,263 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Core;
+using System.Xml;
+using System.Diagnostics;
+
+namespace HeuristicLab.Functions {
+  internal class BakedTreeEvaluator : IEvaluator {
+    private const int MAX_TREE_SIZE = 4096;
+    private const double EPSILON = 1.0e-7;
+
+    private class Instr {
+      public double d_arg0;
+      public int i_arg0;
+      public int i_arg1;
+      public int arity;
+      public int symbol;
+      public IFunction function;
+    }
+
+    private Instr[] codeArr;
+    private int PC;
+    private Dataset dataset;
+    private int sampleIndex;
+
+
+    public BakedTreeEvaluator() {
+      codeArr = new Instr[MAX_TREE_SIZE];
+      for(int i = 0; i < MAX_TREE_SIZE; i++) {
+        codeArr[i] = new Instr();
+      }
+    }
+
+    public void ResetEvaluator(IFunctionTree functionTree, Dataset dataset) {
+      this.dataset = dataset;
+      List<LightWeightFunction> linearRepresentation = ((BakedFunctionTree)functionTree).LinearRepresentation;
+      int i = 0;
+      foreach(LightWeightFunction f in linearRepresentation) {
+        TranslateToInstr(f, codeArr[i++]);
+      }
+    }
+
+    private Instr TranslateToInstr(LightWeightFunction f, Instr instr) {
+      instr.arity = f.arity;
+      instr.symbol = EvaluatorSymbolTable.MapFunction(f.functionType);
+      switch(instr.symbol) {
+        case EvaluatorSymbolTable.DIFFERENTIAL:
+        case EvaluatorSymbolTable.VARIABLE: {
+            instr.i_arg0 = (int)f.data[0]; // var
+            instr.d_arg0 = f.data[1]; // weight
+            instr.i_arg1 = (int)f.data[2]; // sample-offset
+            break;
+          }
+        case EvaluatorSymbolTable.CONSTANT: {
+            instr.d_arg0 = f.data[0]; // value
+            break;
+          }
+        case EvaluatorSymbolTable.UNKNOWN: {
+            instr.function = f.functionType;
+            break;
+          }
+      }
+      return instr;
+    }
+
+    public double Evaluate(int sampleIndex) {
+      PC = 0;
+      this.sampleIndex = sampleIndex;
+      return EvaluateBakedCode();
+    }
+
+    // skips a whole branch
+    private void SkipBakedCode() {
+      int i = 1;
+      while(i > 0) {
+        i += codeArr[PC++].arity;
+        i--;
+      }
+    }
+
+    private double EvaluateBakedCode() {
+      Instr currInstr = codeArr[PC++];
+      switch(currInstr.symbol) {
+        case EvaluatorSymbolTable.VARIABLE: {
+            int row = sampleIndex + currInstr.i_arg1;
+            if(row < 0 || row >= dataset.Rows) return double.NaN;
+            else return currInstr.d_arg0 * dataset.GetValue(row, currInstr.i_arg0);
+          }
+        case EvaluatorSymbolTable.CONSTANT: {
+            return currInstr.d_arg0;
+          }
+        case EvaluatorSymbolTable.DIFFERENTIAL: {
+            int row = sampleIndex + currInstr.i_arg1;
+            if(row < 1 || row >= dataset.Rows) return double.NaN;
+            else return currInstr.d_arg0 * (dataset.GetValue(row, currInstr.i_arg0) - dataset.GetValue(row - 1, currInstr.i_arg0));
+          }
+        case EvaluatorSymbolTable.MULTIPLICATION: {
+            double result = EvaluateBakedCode();
+            for(int i = 1; i < currInstr.arity; i++) {
+              result *= EvaluateBakedCode();
+            }
+            return result;
+          }
+        case EvaluatorSymbolTable.ADDITION: {
+            double sum = EvaluateBakedCode();
+            for(int i = 1; i < currInstr.arity; i++) {
+              sum += EvaluateBakedCode();
+            }
+            return sum;
+          }
+        case EvaluatorSymbolTable.SUBTRACTION: {
+            if(currInstr.arity == 1) {
+              return -EvaluateBakedCode();
+            } else {
+              double result = EvaluateBakedCode();
+              for(int i = 1; i < currInstr.arity; i++) {
+                result -= EvaluateBakedCode();
+              }
+              return result;
+            }
+          }
+        case EvaluatorSymbolTable.DIVISION: {
+            double result;
+            if(currInstr.arity == 1) {
+              result = 1.0 / EvaluateBakedCode();
+            } else {
+              result = EvaluateBakedCode();
+              for(int i = 1; i < currInstr.arity; i++) {
+                result /= EvaluateBakedCode();
+              }
+            }
+            if(double.IsInfinity(result)) return 0.0;
+            else return result;
+          }
+        case EvaluatorSymbolTable.AVERAGE: {
+            double sum = EvaluateBakedCode();
+            for(int i = 1; i < currInstr.arity; i++) {
+              sum += EvaluateBakedCode();
+            }
+            return sum / currInstr.arity;
+          }
+        case EvaluatorSymbolTable.COSINUS: {
+            return Math.Cos(EvaluateBakedCode());
+          }
+        case EvaluatorSymbolTable.SINUS: {
+            return Math.Sin(EvaluateBakedCode());
+          }
+        case EvaluatorSymbolTable.EXP: {
+            return Math.Exp(EvaluateBakedCode());
+          }
+        case EvaluatorSymbolTable.LOG: {
+            return Math.Log(EvaluateBakedCode());
+          }
+        case EvaluatorSymbolTable.POWER: {
+            double x = EvaluateBakedCode();
+            double p = EvaluateBakedCode();
+            return Math.Pow(x, p);
+          }
+        case EvaluatorSymbolTable.SIGNUM: {
+            double value = EvaluateBakedCode();
+            if(double.IsNaN(value)) return double.NaN;
+            else return Math.Sign(value);
+          }
+        case EvaluatorSymbolTable.SQRT: {
+            return Math.Sqrt(EvaluateBakedCode());
+          }
+        case EvaluatorSymbolTable.TANGENS: {
+            return Math.Tan(EvaluateBakedCode());
+          }
+        case EvaluatorSymbolTable.AND: { // only defined for inputs 1 and 0
+            double result = EvaluateBakedCode();
+            for(int i = 1; i < currInstr.arity; i++) {
+              if(result == 0.0) SkipBakedCode();
+              else {
+                result = EvaluateBakedCode();
+              }
+              Debug.Assert(result == 0.0 || result == 1.0);
+            }
+            return result;
+          }
+        case EvaluatorSymbolTable.EQU: {
+            double x = EvaluateBakedCode();
+            double y = EvaluateBakedCode();
+            if(Math.Abs(x - y) < EPSILON) return 1.0; else return 0.0;
+          }
+        case EvaluatorSymbolTable.GT: {
+            double x = EvaluateBakedCode();
+            double y = EvaluateBakedCode();
+            if(x > y) return 1.0;
+            else return 0.0;
+          }
+        case EvaluatorSymbolTable.IFTE: { // only defined for condition 0 or 1
+            double condition = EvaluateBakedCode();
+            Debug.Assert(condition == 0.0 || condition == 1.0);
+            double result;
+            if(condition == 0.0) {
+              result = EvaluateBakedCode(); SkipBakedCode();
+            } else {
+              SkipBakedCode(); result = EvaluateBakedCode();
+            }
+            return result;
+          }
+        case EvaluatorSymbolTable.LT: {
+            double x = EvaluateBakedCode();
+            double y = EvaluateBakedCode();
+            if(x < y) return 1.0;
+            else return 0.0;
+          }
+        case EvaluatorSymbolTable.NOT: { // only defined for inputs 0 or 1
+            double result = EvaluateBakedCode();
+            Debug.Assert(result == 0.0 || result == 1.0);
+            return Math.Abs(result - 1.0);
+          }
+        case EvaluatorSymbolTable.OR: { // only defined for inputs 0 or 1
+            double result = EvaluateBakedCode();
+            for(int i = 1; i < currInstr.arity; i++) {
+              if(result > 0.0) SkipBakedCode();
+              else {
+                result = EvaluateBakedCode();
+                Debug.Assert(result == 0.0 || result == 1.0);
+              }
+            }
+            return result;
+          }
+        case EvaluatorSymbolTable.XOR: { // only defined for inputs 0 or 1
+            double x = EvaluateBakedCode();
+            double y = EvaluateBakedCode();
+            return Math.Abs(x - y);
+          }
+        case EvaluatorSymbolTable.UNKNOWN: { // evaluate functions which are not statically defined directly
+            return currInstr.function.Apply();
+          }
+        default: {
+            throw new NotImplementedException();
+          }
+      }
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Constant.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Constant.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Constant.cs	(revision 649)
@@ -0,0 +1,97 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Data;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Operators;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Functions {
+  public sealed class Constant : FunctionBase {
+    public const string VALUE = "Value";
+
+    public override string Description {
+      get { return "Returns the value of local variable 'Value'."; }
+    }
+
+    public Constant()
+      : base() {
+      AddVariableInfo(new VariableInfo(VALUE, "The constant value", typeof(ConstrainedDoubleData), VariableKind.None));
+      GetVariableInfo(VALUE).Local = true;
+
+      ConstrainedDoubleData valueData = new ConstrainedDoubleData();
+      // initialize a default range for the contant value
+      valueData.AddConstraint(new DoubleBoundedConstraint(-20.0, 20.0));
+      HeuristicLab.Core.Variable value = new HeuristicLab.Core.Variable(VALUE, valueData);
+      AddVariable(value);
+
+      SetupInitialization();
+      SetupManipulation();
+
+      // constant can't have suboperators
+      AddConstraint(new NumberOfSubOperatorsConstraint(0, 0));
+    }
+
+    private void SetupInitialization() {
+      // initialization operator
+      AddVariableInfo(new VariableInfo(INITIALIZATION, "Initialization operator-graph for constants", typeof(IOperatorGraph), VariableKind.None));
+      GetVariableInfo(INITIALIZATION).Local = false;
+      CombinedOperator combinedOp = new CombinedOperator();
+      SequentialProcessor initSeq = new SequentialProcessor();
+      UniformRandomizer randomizer = new UniformRandomizer();
+      randomizer.Min = -20.0;
+      randomizer.Max = 20.0;
+
+      combinedOp.OperatorGraph.AddOperator(initSeq);
+      combinedOp.OperatorGraph.AddOperator(randomizer);
+      combinedOp.OperatorGraph.InitialOperator = initSeq;
+      initSeq.AddSubOperator(randomizer);
+      AddVariable(new HeuristicLab.Core.Variable(INITIALIZATION, combinedOp));
+    }
+
+    private void SetupManipulation() {
+      // manipulation operator
+      AddVariableInfo(new VariableInfo(MANIPULATION, "Manipulation operator-graph for constants", typeof(IOperatorGraph), VariableKind.None));
+      GetVariableInfo(MANIPULATION).Local = false;
+      CombinedOperator combinedOp = new CombinedOperator();
+      SequentialProcessor manipulationSeq = new SequentialProcessor();
+      NormalRandomAdder valueAdder = new NormalRandomAdder();
+      valueAdder.Mu = 0.0;
+      valueAdder.Sigma = 0.1;
+
+      combinedOp.OperatorGraph.AddOperator(manipulationSeq);
+      combinedOp.OperatorGraph.AddOperator(valueAdder);
+      combinedOp.OperatorGraph.InitialOperator = manipulationSeq;
+      manipulationSeq.AddSubOperator(valueAdder);
+      AddVariable(new HeuristicLab.Core.Variable(MANIPULATION, combinedOp));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Cosinus.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Cosinus.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Cosinus.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Cosinus : FunctionBase {
+    public override string Description {
+      get { return "Returns the cosinus of the first sub-tree."; }
+    }
+
+    public Cosinus()
+      : base() {
+      // must have exactly one subfunction
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Differential.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Differential.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Differential.cs	(revision 649)
@@ -0,0 +1,50 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Data;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Operators;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Functions {
+  public sealed class Differential : Variable {
+
+    public override string Description {
+      get {
+        return @"Differential returns the difference between the value of a variable at t and t-1. The weight is a coefficient that is multiplied to the the difference.";
+      }
+    }
+
+    public Differential()
+      : base() {
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Division.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Division.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Division.cs	(revision 649)
@@ -0,0 +1,61 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using System.Linq;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Division : FunctionBase {
+    private const double EPSILON = 10.0E-20; // if any divisor is < EPSILON return 0
+
+    public override string Description {
+      get {
+        return @"Protected division
+Divides the result of the first sub-tree by the results of the following sub-tree.
+In case one of the divisors is 0 returns 0.
+    (/ 3) => 1/3
+    (/ 2 3) => 2/3
+    (/ 3 4 5) => 3/20
+    (/ 2 0 4) => 0
+";
+      }
+    }
+
+    public Division()
+      : base() {
+      // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Equal.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Equal.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Equal.cs	(revision 649)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Equal : FunctionBase {
+    public override string Description {
+      get {
+        return @"Equal condition. Returns 1.0 if both sub-trees evaluate to the same value and 0.0 if they differ.";
+      }
+    }
+
+    public Equal()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Exponential.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Exponential.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Exponential.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Exponential : FunctionBase {
+    public override string Description {
+      get { return "Returns returns exponential of the first sub-tree (power(e, x))."; }
+    }
+
+    public Exponential()
+      : base() {
+      // must have exactly one sub-operator
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/FunctionBase.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/FunctionBase.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/FunctionBase.cs	(revision 649)
@@ -0,0 +1,162 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Data;
+using HeuristicLab.Core;
+using System.Xml;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Constraints;
+using System.Diagnostics;
+
+namespace HeuristicLab.Functions {
+  /// <summary>
+  /// Functions are like operators except that they do not allow sub-operators and the normal form of evaluation
+  /// is to evaluate all children first.
+  /// </summary>
+  public abstract class FunctionBase : OperatorBase, IFunction {
+    public const string INITIALIZATION = "Initialization";
+    public const string MANIPULATION = "Manipulation";
+    private List<IFunction>[] allowedSubFunctions;
+    private int minArity = -1;
+    private int maxArity = -1;
+
+    public virtual double Apply() {
+      throw new NotImplementedException();
+    }
+
+    public virtual void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+
+    public virtual IFunctionTree GetTreeNode() {
+      return new BakedFunctionTree(this);
+    }
+
+    public int MinArity {
+      get {
+        if(minArity < 0) RefreshArity();
+        return minArity;
+      }
+    }
+
+    public int MaxArity {
+      get {
+        if(maxArity < 0) RefreshArity();
+        return maxArity;
+      }
+    }
+
+    private void RefreshArity() {
+      minArity = 2; maxArity = 2; // default arity is 2
+      foreach(IConstraint constraint in Constraints) {
+        NumberOfSubOperatorsConstraint theConstraint = constraint as NumberOfSubOperatorsConstraint;
+        if(theConstraint != null) {
+          minArity = theConstraint.MinOperators.Data;
+          maxArity = theConstraint.MaxOperators.Data;
+        }
+      }
+    }
+
+    public IList<IFunction> AllowedSubFunctions(int index) {
+      if(allowedSubFunctions == null) {
+        // first time: analyze the constraint and create a cached copy of the allowed sub-functions
+        allowedSubFunctions = new List<IFunction>[MaxArity];
+        for(int i = 0; i < MaxArity; i++) {
+          allowedSubFunctions[i] = GetAllowedSubFunctions(i);
+        }
+      }
+      return allowedSubFunctions[index];
+    }
+
+    private List<IFunction> GetAllowedSubFunctions(int index) {
+      List<IFunction> allowedSubFunctions = new List<IFunction>();
+      foreach(IConstraint constraint in Constraints) {
+        if(constraint is SubOperatorTypeConstraint) {
+          SubOperatorTypeConstraint subOpConstraint = constraint as SubOperatorTypeConstraint;
+          if(subOpConstraint.SubOperatorIndex.Data == index) {
+            foreach(IFunction f in subOpConstraint.AllowedSubOperators) allowedSubFunctions.Add(f);
+            subOpConstraint.Changed += new EventHandler(subOpConstraint_Changed); // register an event-handler to invalidate the cache on constraing changes
+            return allowedSubFunctions;
+          }
+        } else if(constraint is AllSubOperatorsTypeConstraint) {
+          AllSubOperatorsTypeConstraint subOpConstraint = constraint as AllSubOperatorsTypeConstraint;
+          foreach(IFunction f in subOpConstraint.AllowedSubOperators) allowedSubFunctions.Add(f);
+          subOpConstraint.Changed += new EventHandler(subOpConstraint_Changed); // register an event-handler to invalidate the cache on constraint changes
+          return allowedSubFunctions;
+        }
+      }
+      return allowedSubFunctions;
+    }
+
+    private void subOpConstraint_Changed(object sender, EventArgs e) {
+      allowedSubFunctions = null;
+    }
+
+    // operator-tree style evaluation is not supported for functions.
+    public override IOperation Apply(IScope scope) {
+      throw new NotSupportedException();
+    }
+
+    private static readonly List<IOperator> emptySubOperatorList = new List<IOperator>();
+    public override IList<IOperator> SubOperators {
+      get { return emptySubOperatorList; }
+    }
+
+    public override void AddSubOperator(IOperator subOperator) {
+      throw new NotSupportedException();
+    }
+
+    public override bool TryAddSubOperator(IOperator subOperator) {
+      throw new NotSupportedException();
+    }
+
+    public override bool TryAddSubOperator(IOperator subOperator, int index) {
+      throw new NotSupportedException();
+    }
+
+    public override bool TryAddSubOperator(IOperator subOperator, int index, out ICollection<IConstraint> violatedConstraints) {
+      throw new NotSupportedException();
+    }
+
+    public override bool TryAddSubOperator(IOperator subOperator, out ICollection<IConstraint> violatedConstraints) {
+      throw new NotSupportedException();
+    }
+
+    public override void AddSubOperator(IOperator subOperator, int index) {
+      throw new NotSupportedException();
+    }
+
+    public override void RemoveSubOperator(int index) {
+      throw new NotSupportedException();
+    }
+
+    public override bool TryRemoveSubOperator(int index) {
+      throw new NotSupportedException();
+    }
+
+    public override bool TryRemoveSubOperator(int index, out ICollection<IConstraint> violatedConstraints) {
+      throw new NotSupportedException();
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.Designer.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.Designer.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.Designer.cs	(revision 649)
@@ -0,0 +1,223 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+namespace HeuristicLab.Functions {
+  partial class FunctionTreeView {
+    /// <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();
+      }
+      if(selectedVariable != null) {
+        selectedVariable.Value.Changed -= new EventHandler(selectedVariable_ValueChanged);
+      }
+      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.funTreeView = new System.Windows.Forms.TreeView();
+      this.splitContainer = new System.Windows.Forms.SplitContainer();
+      this.variablesGroupBox = new System.Windows.Forms.GroupBox();
+      this.variablesSplitContainer = new System.Windows.Forms.SplitContainer();
+      this.variablesListBox = new System.Windows.Forms.ListBox();
+      this.label1 = new System.Windows.Forms.Label();
+      this.templateTextBox = new System.Windows.Forms.TextBox();
+      this.editButton = new System.Windows.Forms.Button();
+      this.treeNodeContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+      this.copyToClipboardMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.copyToClipboardSExpressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.splitContainer.Panel1.SuspendLayout();
+      this.splitContainer.Panel2.SuspendLayout();
+      this.splitContainer.SuspendLayout();
+      this.variablesGroupBox.SuspendLayout();
+      this.variablesSplitContainer.Panel1.SuspendLayout();
+      this.variablesSplitContainer.SuspendLayout();
+      this.treeNodeContextMenu.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // funTreeView
+      // 
+      this.funTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.funTreeView.HideSelection = false;
+      this.funTreeView.Location = new System.Drawing.Point(0, 0);
+      this.funTreeView.Name = "funTreeView";
+      this.funTreeView.Size = new System.Drawing.Size(182, 532);
+      this.funTreeView.TabIndex = 0;
+      this.funTreeView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.funTreeView_MouseUp);
+      this.funTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.functionTreeView_AfterSelect);
+      // 
+      // splitContainer
+      // 
+      this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.splitContainer.Location = new System.Drawing.Point(0, 0);
+      this.splitContainer.Name = "splitContainer";
+      // 
+      // splitContainer.Panel1
+      // 
+      this.splitContainer.Panel1.Controls.Add(this.funTreeView);
+      // 
+      // splitContainer.Panel2
+      // 
+      this.splitContainer.Panel2.Controls.Add(this.variablesGroupBox);
+      this.splitContainer.Panel2.Controls.Add(this.label1);
+      this.splitContainer.Panel2.Controls.Add(this.templateTextBox);
+      this.splitContainer.Panel2.Controls.Add(this.editButton);
+      this.splitContainer.Size = new System.Drawing.Size(735, 532);
+      this.splitContainer.SplitterDistance = 182;
+      this.splitContainer.TabIndex = 1;
+      // 
+      // variablesGroupBox
+      // 
+      this.variablesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.variablesGroupBox.Controls.Add(this.variablesSplitContainer);
+      this.variablesGroupBox.Location = new System.Drawing.Point(3, 31);
+      this.variablesGroupBox.Name = "variablesGroupBox";
+      this.variablesGroupBox.Size = new System.Drawing.Size(543, 498);
+      this.variablesGroupBox.TabIndex = 5;
+      this.variablesGroupBox.TabStop = false;
+      this.variablesGroupBox.Text = "Local variables";
+      // 
+      // variablesSplitContainer
+      // 
+      this.variablesSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.variablesSplitContainer.Location = new System.Drawing.Point(3, 16);
+      this.variablesSplitContainer.Name = "variablesSplitContainer";
+      // 
+      // variablesSplitContainer.Panel1
+      // 
+      this.variablesSplitContainer.Panel1.Controls.Add(this.variablesListBox);
+      this.variablesSplitContainer.Size = new System.Drawing.Size(537, 479);
+      this.variablesSplitContainer.SplitterDistance = 179;
+      this.variablesSplitContainer.TabIndex = 0;
+      // 
+      // variablesListBox
+      // 
+      this.variablesListBox.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.variablesListBox.FormattingEnabled = true;
+      this.variablesListBox.Location = new System.Drawing.Point(0, 0);
+      this.variablesListBox.Name = "variablesListBox";
+      this.variablesListBox.Size = new System.Drawing.Size(179, 472);
+      this.variablesListBox.TabIndex = 0;
+      this.variablesListBox.SelectedIndexChanged += new System.EventHandler(this.variablesListBox_SelectedIndexChanged);
+      // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Location = new System.Drawing.Point(3, 10);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(96, 13);
+      this.label1.TabIndex = 3;
+      this.label1.Text = "Function definition:";
+      // 
+      // templateTextBox
+      // 
+      this.templateTextBox.Location = new System.Drawing.Point(105, 7);
+      this.templateTextBox.Name = "templateTextBox";
+      this.templateTextBox.ReadOnly = true;
+      this.templateTextBox.Size = new System.Drawing.Size(190, 20);
+      this.templateTextBox.TabIndex = 2;
+      // 
+      // editButton
+      // 
+      this.editButton.Enabled = false;
+      this.editButton.Location = new System.Drawing.Point(301, 5);
+      this.editButton.Name = "editButton";
+      this.editButton.Size = new System.Drawing.Size(49, 23);
+      this.editButton.TabIndex = 1;
+      this.editButton.Text = "Edit...";
+      this.editButton.UseVisualStyleBackColor = true;
+      this.editButton.Click += new System.EventHandler(this.editButton_Click);
+      // 
+      // treeNodeContextMenu
+      // 
+      this.treeNodeContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.copyToClipboardMenuItem,
+            this.copyToClipboardSExpressionToolStripMenuItem});
+      this.treeNodeContextMenu.Name = "treeNodeContextMenu";
+      this.treeNodeContextMenu.Size = new System.Drawing.Size(259, 70);
+      // 
+      // copyToClipboardMenuItem
+      // 
+      this.copyToClipboardMenuItem.Name = "copyToClipboardMenuItem";
+      this.copyToClipboardMenuItem.Size = new System.Drawing.Size(258, 22);
+      this.copyToClipboardMenuItem.Text = "Copy to clip-board (Model-Analyzer)";
+      this.copyToClipboardMenuItem.Click += new System.EventHandler(this.copyToClipboardMenuItem_Click);
+      // 
+      // copyToClipboardSExpressionToolStripMenuItem
+      // 
+      this.copyToClipboardSExpressionToolStripMenuItem.Name = "copyToClipboardSExpressionToolStripMenuItem";
+      this.copyToClipboardSExpressionToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
+      this.copyToClipboardSExpressionToolStripMenuItem.Text = "Copy to clip-board (S-Expression)";
+      this.copyToClipboardSExpressionToolStripMenuItem.Click += new System.EventHandler(this.copyToClipboardSExpressionToolStripMenuItem_Click);
+      // 
+      // FunctionTreeView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.splitContainer);
+      this.Name = "FunctionTreeView";
+      this.Size = new System.Drawing.Size(735, 532);
+      this.splitContainer.Panel1.ResumeLayout(false);
+      this.splitContainer.Panel2.ResumeLayout(false);
+      this.splitContainer.Panel2.PerformLayout();
+      this.splitContainer.ResumeLayout(false);
+      this.variablesGroupBox.ResumeLayout(false);
+      this.variablesSplitContainer.Panel1.ResumeLayout(false);
+      this.variablesSplitContainer.ResumeLayout(false);
+      this.treeNodeContextMenu.ResumeLayout(false);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.TreeView funTreeView;
+    private System.Windows.Forms.SplitContainer splitContainer;
+    private System.Windows.Forms.TextBox templateTextBox;
+    private System.Windows.Forms.Button editButton;
+    private System.Windows.Forms.GroupBox variablesGroupBox;
+    private System.Windows.Forms.SplitContainer variablesSplitContainer;
+    private System.Windows.Forms.ListBox variablesListBox;
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.ContextMenuStrip treeNodeContextMenu;
+    private System.Windows.Forms.ToolStripMenuItem copyToClipboardMenuItem;
+    private System.Windows.Forms.ToolStripMenuItem copyToClipboardSExpressionToolStripMenuItem;
+
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.cs	(revision 649)
@@ -0,0 +1,295 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.Core;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Functions {
+  public partial class FunctionTreeView : ViewBase {
+    private IFunctionTree functionTree;
+
+    private IFunctionTree selectedBranch;
+    private IVariable selectedVariable;
+
+    private FunctionNameVisitor functionNameVisitor;
+    public FunctionTreeView() {
+      InitializeComponent();
+      functionNameVisitor = new FunctionNameVisitor();
+    }
+
+    public FunctionTreeView(IFunctionTree functionTree)
+      : this() {
+      this.functionTree = functionTree;
+      Refresh();
+    }
+
+    protected override void UpdateControls() {
+      funTreeView.Nodes.Clear();
+      functionNameVisitor.Visit(functionTree);
+      TreeNode rootNode = new TreeNode();
+      rootNode.Name = functionTree.Function.Name;
+      rootNode.Text = functionNameVisitor.Name;
+      rootNode.Tag = functionTree;
+      rootNode.ContextMenuStrip = treeNodeContextMenu;
+      funTreeView.Nodes.Add(rootNode);
+
+      foreach(IFunctionTree subTree in functionTree.SubTrees) {
+        CreateTree(rootNode, subTree);
+      }
+      funTreeView.ExpandAll();
+    }
+
+    private void CreateTree(TreeNode rootNode, IFunctionTree functionTree) {
+      TreeNode node = new TreeNode();
+      functionNameVisitor.Visit(functionTree);
+      node.Name = functionTree.Function.Name;
+      node.Text = functionNameVisitor.Name;
+      node.Tag = functionTree;
+      node.ContextMenuStrip = treeNodeContextMenu;
+      rootNode.Nodes.Add(node);
+      foreach(IFunctionTree subTree in functionTree.SubTrees) {
+        CreateTree(node, subTree);
+      }
+    }
+
+    private void functionTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
+      variablesListBox.Items.Clear();
+      variablesSplitContainer.Panel2.Controls.Clear();
+      templateTextBox.Clear();
+      editButton.Enabled = false;
+      if(funTreeView.SelectedNode != null && funTreeView.SelectedNode.Tag != null) {
+        IFunctionTree selectedBranch = (IFunctionTree)funTreeView.SelectedNode.Tag;
+        UpdateVariablesList(selectedBranch);
+        templateTextBox.Text = selectedBranch.Function.Name;
+        this.selectedBranch = selectedBranch;
+        editButton.Enabled = true;
+      }
+    }
+
+    private void UpdateVariablesList(IFunctionTree functionTree) {
+      foreach(IVariable variable in functionTree.LocalVariables) {
+        variablesListBox.Items.Add(variable.Name);
+      }
+    }
+
+    private void variablesListBox_SelectedIndexChanged(object sender, EventArgs e) {
+      // in case we had an event-handler registered for a different variable => unregister the event-handler
+      if(selectedVariable != null) {
+        selectedVariable.Value.Changed -= new EventHandler(selectedVariable_ValueChanged);
+      }
+      if(variablesListBox.SelectedItem != null) {
+        string selectedVariableName = (string)variablesListBox.SelectedItem;
+        selectedVariable = selectedBranch.GetLocalVariable(selectedVariableName);
+        variablesSplitContainer.Panel2.Controls.Clear();
+        Control editor = (Control)selectedVariable.CreateView();
+        variablesSplitContainer.Panel2.Controls.Add(editor);
+        editor.Dock = DockStyle.Fill;
+        // register an event handler that updates the treenode when the value of the variable is changed by the user
+        selectedVariable.Value.Changed += new EventHandler(selectedVariable_ValueChanged);
+      } else {
+        variablesSplitContainer.Panel2.Controls.Clear();
+      }
+    }
+
+    void selectedVariable_ValueChanged(object sender, EventArgs e) {
+      if(funTreeView.SelectedNode != null && funTreeView.SelectedNode.Tag != null) {
+        TreeNode node = funTreeView.SelectedNode;
+        functionNameVisitor.Visit(selectedBranch);
+        node.Text = functionNameVisitor.Name;
+      }
+    }
+
+    protected virtual void editButton_Click(object sender, EventArgs e) {
+      PluginManager.ControlManager.ShowControl(selectedBranch.Function.CreateView());
+    }
+
+    private void copyToClipboardMenuItem_Click(object sender, EventArgs e) {
+      TreeNode node = funTreeView.SelectedNode;
+      if(node == null || node.Tag == null) return;
+
+      ModelAnalyzerExporter visitor = new ModelAnalyzerExporter();
+      visitor.Visit((IFunctionTree)node.Tag);
+      Clipboard.SetText(visitor.ModelAnalyzerPrefix);
+    }
+
+    private void copyToClipboardSExpressionToolStripMenuItem_Click(object sender, EventArgs e) {
+      TreeNode node = funTreeView.SelectedNode;
+      if(node == null || node.Tag == null) return;
+
+      string sexp = ((IFunctionTree)node.Tag).ToString();
+      Clipboard.SetText(sexp);
+    }
+
+    private void funTreeView_MouseUp(object sender, MouseEventArgs e) {
+      if(e.Button == MouseButtons.Right) {
+        // Select the clicked node
+        funTreeView.SelectedNode = funTreeView.GetNodeAt(e.X, e.Y);
+      }
+    }
+
+    private class FunctionNameVisitor : IFunctionVisitor {
+      string name;
+      IFunctionTree currentBranch;
+
+      public string Name {
+        get { return name; }
+      }
+
+      public void Visit(IFunctionTree tree) {
+        currentBranch = tree;
+        tree.Function.Accept(this);
+      }
+
+      #region IFunctionVisitor Members
+      public void Visit(IFunction function) {
+        name = function.Name;
+      }
+
+      public void Visit(Addition addition) {
+        name = "+";
+      }
+
+      public void Visit(Constant constant) {
+        name = ((ConstrainedDoubleData)(currentBranch.GetLocalVariable(HeuristicLab.Functions.Constant.VALUE).Value)).Data + "";
+      }
+
+      public void Visit(Cosinus cosinus) {
+        name = "Sin";
+      }
+
+      public void Visit(Differential diff) {
+        string timeOffset = "";
+        int sampleOffset = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Differential.OFFSET).Value).Data;
+        int variableIndex = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Differential.INDEX).Value).Data;
+        double weight = ((ConstrainedDoubleData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Differential.WEIGHT).Value).Data;
+        if(sampleOffset < 0) {
+          timeOffset = "(t" + sampleOffset + ")";
+        } else if(sampleOffset > 0) {
+          timeOffset = "(t+" + sampleOffset + ")";
+        } else {
+          timeOffset = "";
+        }
+        name = "Diff" + variableIndex + timeOffset + " * " + weight;
+      }
+
+      public void Visit(Division division) {
+        name = "/";
+      }
+
+      public void Visit(Exponential exponential) {
+        name = "Exp";
+      }
+
+      public void Visit(Logarithm logarithm) {
+        name = "Log";
+      }
+
+      public void Visit(Multiplication multiplication) {
+        name = "*";
+      }
+
+      public void Visit(Power power) {
+        name = "Pow";
+      }
+
+      public void Visit(Signum signum) {
+        name = "Sign";
+      }
+
+      public void Visit(Sinus sinus) {
+        name = "Sin";
+      }
+
+      public void Visit(Sqrt sqrt) {
+        name = "Sqrt";
+      }
+
+      public void Visit(Subtraction substraction) {
+        name = "-";
+      }
+
+      public void Visit(Tangens tangens) {
+        name = "Tan";
+      }
+
+      public void Visit(Variable variable) {
+        string timeOffset = "";
+        int sampleOffset = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Variable.OFFSET).Value).Data;
+        int variableIndex = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Variable.INDEX).Value).Data;
+        double weight = ((ConstrainedDoubleData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Variable.WEIGHT).Value).Data;
+        if(sampleOffset < 0) {
+          timeOffset = "(t" + sampleOffset + ")";
+        } else if(sampleOffset > 0) {
+          timeOffset = "(t+" + sampleOffset + ")";
+        } else {
+          timeOffset = "";
+        }
+        name = "Var" + variableIndex + timeOffset + " * " + weight;
+      }
+
+      public void Visit(And and) {
+        name = "And";
+      }
+
+      public void Visit(Average average) {
+        name = "Avg";
+      }
+
+      public void Visit(IfThenElse ifThenElse) {
+        name = "IFTE";
+      }
+
+      public void Visit(Not not) {
+        name = "Not";
+      }
+
+      public void Visit(Or or) {
+        name = "Or";
+      }
+
+      public void Visit(Xor xor) {
+        name = "Xor";
+      }
+
+      public void Visit(Equal equal) {
+        name = "eq?";
+      }
+
+      public void Visit(LessThan lessThan) {
+        name = "<";
+      }
+
+      public void Visit(GreaterThan greaterThan) {
+        name = ">";
+      }
+      #endregion
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.resx
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.resx	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/FunctionView.resx	(revision 649)
@@ -0,0 +1,123 @@
+<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="treeNodeContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>
Index: /branches/plugins/HeuristicLab.Functions/3.2/GreaterThan.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/GreaterThan.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/GreaterThan.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class GreaterThan : FunctionBase {
+    public override string Description {
+      get {
+        return @"Greater-than condition. Returns 1.0 if the value of the first sub-tree is greater than the value of the second sub-tree and 0.0 otherwise.";
+      }
+    }
+
+    public GreaterThan()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+    }
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/HeuristicLab.Functions.csproj
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/HeuristicLab.Functions.csproj	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/HeuristicLab.Functions.csproj	(revision 649)
@@ -0,0 +1,175 @@
+﻿<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{B95CA6E2-34BC-4430-994D-BD6E99375319}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Functions</RootNamespace>
+    <AssemblyName>HeuristicLab.Functions-3.2</AssemblyName>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>bin\Release\HeuristicLab.Functions-3.2.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>bin\Release\HeuristicLab.Functions-3.2.XML</DocumentationFile>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release x64|x86' ">
+    <OutputPath>bin\x86\Release x64\</OutputPath>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Addition.cs" />
+    <Compile Include="And.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Average.cs" />
+    <Compile Include="BakedFunctionTree.cs" />
+    <Compile Include="BakedTreeEvaluator.cs" />
+    <Compile Include="Constant.cs" />
+    <Compile Include="Differential.cs" />
+    <Compile Include="GreaterThan.cs" />
+    <Compile Include="IEvaluator.cs" />
+    <Compile Include="IfThenElse.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="IFunctionTree.cs" />
+    <Compile Include="ModelAnalyzerExporter.cs" />
+    <Compile Include="Or.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Equal.cs" />
+    <Compile Include="FunctionView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="FunctionView.Designer.cs">
+      <DependentUpon>FunctionView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="IFunctionVisitor.cs" />
+    <Compile Include="LessThan.cs" />
+    <Compile Include="Not.cs" />
+    <Compile Include="SymbolicExpressionExporter.cs" />
+    <Compile Include="Signum.cs" />
+    <Compile Include="Logarithm.cs" />
+    <Compile Include="Exponential.cs" />
+    <Compile Include="Sqrt.cs" />
+    <Compile Include="Power.cs" />
+    <Compile Include="Division.cs" />
+    <Compile Include="Subtraction.cs" />
+    <Compile Include="SymbolTable.cs" />
+    <Compile Include="Tangens.cs" />
+    <Compile Include="Cosinus.cs" />
+    <Compile Include="Sinus.cs" />
+    <Compile Include="Multiplication.cs" />
+    <Compile Include="FunctionBase.cs" />
+    <Compile Include="HeuristicLabFunctionsPlugin.cs" />
+    <Compile Include="IFunction.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Variable.cs" />
+    <Compile Include="Xor.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.Constraints\HeuristicLab.Constraints.csproj">
+      <Project>{FCD62C6F-4793-4593-AE9A-0BDCA256EE99}</Project>
+      <Name>HeuristicLab.Constraints</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Core\HeuristicLab.Core.csproj">
+      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
+      <Name>HeuristicLab.Core</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.DataAnalysis\HeuristicLab.DataAnalysis.csproj">
+      <Project>{7DD3A97A-56E9-462F-90E2-A351FE7AF5C2}</Project>
+      <Name>HeuristicLab.DataAnalysis</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Data\HeuristicLab.Data.csproj">
+      <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project>
+      <Name>HeuristicLab.Data</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Operators.Programmable\HeuristicLab.Operators.Programmable.csproj">
+      <Project>{E3CCBFC6-900C-41B6-AFB8-6646DB097435}</Project>
+      <Name>HeuristicLab.Operators.Programmable</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Operators\HeuristicLab.Operators.csproj">
+      <Project>{A9983BA2-B3B2-475E-8E2C-62050B71D1C5}</Project>
+      <Name>HeuristicLab.Operators</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Random\HeuristicLab.Random.csproj">
+      <Project>{47019A74-F7F7-482E-83AA-D3F4F777E879}</Project>
+      <Name>HeuristicLab.Random</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="FunctionView.resx">
+      <DependentUpon>FunctionView.cs</DependentUpon>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </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>cmd /c ""$(SolutionDir)PreBuildEvent.cmd" "$(ProjectDir).""</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /branches/plugins/HeuristicLab.Functions/3.2/HeuristicLabFunctionsPlugin.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/HeuristicLabFunctionsPlugin.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/HeuristicLabFunctionsPlugin.cs	(revision 649)
@@ -0,0 +1,39 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Functions {
+  [ClassInfo(Name = "HeuristicLab.Functions-3.2")]
+  [PluginFile(Filename = "HeuristicLab.Functions-3.2.dll", Filetype = PluginFileType.Assembly)]
+  [Dependency(Dependency = "HeuristicLab.Constraints-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Core-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Data-3.2")]
+  [Dependency(Dependency = "HeuristicLab.DataAnalysis-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Operators-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Operators.Programmable-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Random-3.2")]
+  public class HeuristicLabFunctionsPlugin : PluginBase {
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/IEvaluator.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/IEvaluator.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/IEvaluator.cs	(revision 649)
@@ -0,0 +1,12 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public interface IEvaluator {
+    void ResetEvaluator(IFunctionTree functionTree, Dataset dataset);
+    double Evaluate(int sampleIndex);
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/IFunction.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/IFunction.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/IFunction.cs	(revision 649)
@@ -0,0 +1,37 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public interface IFunction : IOperator {
+    IFunctionTree GetTreeNode();
+    double Apply();
+    void Accept(IFunctionVisitor visitor);
+    IList<IFunction> AllowedSubFunctions(int index);
+    int MinArity { get; }
+    int MaxArity { get; }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/IFunctionTree.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/IFunctionTree.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/IFunctionTree.cs	(revision 649)
@@ -0,0 +1,44 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public interface IFunctionTree : IItem {
+    int Size { get; }
+    int Height { get; }
+    IList<IFunctionTree> SubTrees { get; }
+    ICollection<IVariable> LocalVariables { get; }
+    IFunction Function { get; }
+    IVariable GetLocalVariable(string name);
+    void AddVariable(IVariable variable);
+    void RemoveVariable(string name);
+    void AddSubTree(IFunctionTree tree);
+    void InsertSubTree(int index, IFunctionTree tree);
+    void RemoveSubTree(int index);
+
+    IEvaluator CreateEvaluator();
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/IFunctionVisitor.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/IFunctionVisitor.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/IFunctionVisitor.cs	(revision 649)
@@ -0,0 +1,55 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.Functions {
+  public interface IFunctionVisitor {
+    void Visit(IFunction function);
+    void Visit(Addition addition);
+    void Visit(And and);
+    void Visit(Average average);
+    void Visit(Constant constant);
+    void Visit(Cosinus cosinus);
+    void Visit(Differential differential);
+    void Visit(Division division);
+    void Visit(Equal equal);
+    void Visit(Exponential exponential);
+    void Visit(GreaterThan greaterThan);
+    void Visit(IfThenElse ifThenElse);
+    void Visit(LessThan lessThan);
+    void Visit(Logarithm logarithm);
+    void Visit(Multiplication multiplication);
+    void Visit(Not not);
+    void Visit(Or or);
+    void Visit(Power power);
+    void Visit(Signum signum);
+    void Visit(Sinus sinus);
+    void Visit(Sqrt sqrt);
+    void Visit(Subtraction substraction);
+    void Visit(Tangens tangens);
+    void Visit(Variable variable);
+    void Visit(Xor xor);
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/IfThenElse.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/IfThenElse.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/IfThenElse.cs	(revision 649)
@@ -0,0 +1,50 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class IfThenElse : FunctionBase {
+    public override string Description {
+      get {
+        return @"Returns the result of the second sub-tree if the first sub-tree evaluates to a value < 0.5 and the result
+of the third sub-tree if the first sub-tree evaluates to >= 0.5.";
+      }
+    }
+
+    public IfThenElse()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(3, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/LessThan.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/LessThan.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/LessThan.cs	(revision 649)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class LessThan : FunctionBase {
+    public override string Description {
+      get {
+        return @"Less-than condition. Returns 1.0 if the value of the first sub-tree is less than the value of the second sub-tree and 0.0 otherwise.";
+      }
+    }
+
+    public LessThan()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Logarithm.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Logarithm.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Logarithm.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Logarithm : FunctionBase {
+    public override string Description {
+      get { return "Returns the natural (base e) logarithm of the first sub-tree."; }
+    }
+
+    public Logarithm()
+      : base() {
+      // must have exactly 1 suboperator
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/ModelAnalyzerExporter.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/ModelAnalyzerExporter.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/ModelAnalyzerExporter.cs	(revision 649)
@@ -0,0 +1,169 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Functions {
+  public class ModelAnalyzerExporter : IFunctionVisitor {
+    private string prefix;
+    private string currentIndent = "";
+    private IFunctionTree currentBranch;
+    public string ModelAnalyzerPrefix {
+      get { return prefix; }
+    }
+    public void Reset() {
+      prefix = "";
+    }
+
+    private void VisitFunction(string name, IFunction f) {
+      prefix += currentIndent + "[F]" + name + "(\n";
+    }
+
+    #region IFunctionVisitor Members
+
+    public void Visit(IFunction function) {
+      prefix += function.Name;
+    }
+
+    public void Visit(Addition addition) {
+      VisitFunction("Addition[0]", addition);
+    }
+
+    public void Visit(Constant constant) {
+      double value = ((ConstrainedDoubleData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Constant.VALUE).Value).Data;
+      prefix += currentIndent + "[T]Constant(" + value.ToString("r") + ";0;0)";
+    }
+
+    public void Visit(Cosinus cosinus) {
+      VisitFunction("Trigonometrics[1]", cosinus);
+    }
+
+    public void Visit(Differential differential) {
+      double weight = ((ConstrainedDoubleData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Differential.WEIGHT).Value).Data;
+      double index = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Differential.INDEX).Value).Data;
+      double offset = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Differential.OFFSET).Value).Data;
+
+      prefix += currentIndent + "[T]Differential(" + weight.ToString("r") + ";" + index + ";" + -offset + ")";
+    }
+
+    public void Visit(Division division) {
+      VisitFunction("Division[0]", division);
+    }
+
+    public void Visit(Exponential exponential) {
+      VisitFunction("Exponential[0]", exponential);
+    }
+
+    public void Visit(Logarithm logarithm) {
+      VisitFunction("Logarithm[0]", logarithm);
+    }
+
+    public void Visit(Multiplication multiplication) {
+      VisitFunction("Multiplication[0]", multiplication);
+    }
+
+    public void Visit(Power power) {
+      VisitFunction("Power[0]", power);
+    }
+
+    public void Visit(Signum signum) {
+      VisitFunction("Signum[0]", signum);
+    }
+
+    public void Visit(Sinus sinus) {
+      VisitFunction("Trigonometrics[0]", sinus);
+    }
+
+    public void Visit(Sqrt sqrt) {
+      VisitFunction("Sqrt[0]", sqrt);
+    }
+
+    public void Visit(Subtraction substraction) {
+      VisitFunction("Subtraction[0]", substraction);
+    }
+
+    public void Visit(Tangens tangens) {
+      VisitFunction("Trigonometrics[2]", tangens);
+    }
+
+    public void Visit(HeuristicLab.Functions.Variable variable) {
+      double weight = ((ConstrainedDoubleData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Variable.WEIGHT).Value).Data;
+      double index = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Variable.INDEX).Value).Data;
+      double offset = ((ConstrainedIntData)currentBranch.GetLocalVariable(HeuristicLab.Functions.Variable.OFFSET).Value).Data;
+
+      prefix += currentIndent + "[T]Variable(" + weight.ToString("r") + ";" + index + ";" + -offset + ")";
+    }
+
+    public void Visit(And and) {
+      VisitFunction("Logical[0]", and);
+    }
+
+    public void Visit(Average average) {
+      VisitFunction("N/A (average)", average);
+    }
+
+    public void Visit(IfThenElse ifThenElse) {
+      VisitFunction("Conditional[0]", ifThenElse);
+    }
+
+    public void Visit(Not not) {
+      VisitFunction("Logical[2]", not);
+    }
+
+    public void Visit(Or or) {
+      VisitFunction("Logical[1]", or);
+    }
+
+    public void Visit(Xor xor) {
+      VisitFunction("N/A (xor)", xor);
+    }
+
+    public void Visit(Equal equal) {
+      VisitFunction("Boolean[2]", equal);
+    }
+
+    public void Visit(LessThan lessThan) {
+      VisitFunction("Boolean[0]", lessThan);
+    }
+
+    public void Visit(GreaterThan greaterThan) {
+      VisitFunction("Boolean[4]", greaterThan);
+    }
+    #endregion
+
+    public void Visit(IFunctionTree functionTree) {
+      currentBranch = functionTree;
+      functionTree.Function.Accept(this);
+      currentIndent += "  ";
+      foreach(IFunctionTree subTree in functionTree.SubTrees) {
+        Visit(subTree);
+        prefix += ";\n";
+      }
+      prefix = prefix.TrimEnd(';', '\n');
+      if(functionTree.SubTrees.Count>0) prefix += ")";
+      currentIndent = currentIndent.Remove(0, 2);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Multiplication.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Multiplication.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Multiplication.cs	(revision 649)
@@ -0,0 +1,55 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using System.Linq;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Multiplication : FunctionBase {
+    public override string Description {
+      get {
+        return @"Returns the product of the results of all sub-tree.
+  (* 3) => 3
+  (* 2 3) => 6
+  (* 3 4 5) => 60";
+      }
+    }
+
+    public Multiplication()
+      : base() {
+      // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Not.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Not.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Not.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Not : FunctionBase {
+    public override string Description {
+      get {
+        return @"Logical NOT operation. Only defined for sub-tree-results 0.0 and 1.0.";
+      }
+    }
+
+    public Not()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Or.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Or.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Or.cs	(revision 649)
@@ -0,0 +1,50 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Or : FunctionBase {
+    public override string Description {
+      get {
+        return @"Logical OR operation. Only defined for sub-tree-results 0.0 and 1.0.
+Special form, evaluation stops at first sub-tree that evaluates to 1.0 (true).";
+      }
+    }
+
+    public Or()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Power.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Power.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Power.cs	(revision 649)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Power : FunctionBase {
+    public override string Description {
+      get { return "Returns the result of the first sub-tree to the power of the second sub-tree (power(x, y))."; }
+    }
+
+    public Power()
+      : base() {
+      // must have exactly 2 suboperators base ^ exponent
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Properties/AssemblyInfo.frame
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Properties/AssemblyInfo.frame	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Properties/AssemblyInfo.frame	(revision 649)
@@ -0,0 +1,58 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HeuristicLab.PluginInfrastructure;
+
+// 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.Functions")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2008 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("863021a4-3cde-48be-8af6-dac1077f5fb5")]
+
+// 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.2.0.$WCREV$")]
+[assembly: AssemblyFileVersion("3.2.0.$WCREV$")]
+[assembly: AssemblyBuildDate("$WCNOW$")]
Index: /branches/plugins/HeuristicLab.Functions/3.2/Signum.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Signum.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Signum.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Signum : FunctionBase {
+    public override string Description {
+      get { return "Returns the signum of the first sub-tree."; }
+    }
+
+    public Signum()
+      : base() {
+      // must have exactly 1 suboperator
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Sinus.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Sinus.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Sinus.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Sinus : FunctionBase {
+    public override string Description {
+      get { return "Returns the sinus of the first sub-tree."; }
+    }
+
+    public Sinus()
+      : base() {
+      // must have exactly 1 suboperator
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Sqrt.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Sqrt.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Sqrt.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Sqrt : FunctionBase {
+    public override string Description {
+      get { return "Returns the square root of the first sub-tree."; }
+    }
+
+    public Sqrt()
+      : base() {
+      // must have exactly 1 suboperator
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Subtraction.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Subtraction.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Subtraction.cs	(revision 649)
@@ -0,0 +1,55 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using System.Linq;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Subtraction : FunctionBase {
+    public override string Description {
+      get {
+        return @"Subtracts the results of sub-tree 2..n from the result of the first sub-tree.
+    (- 3) => -3
+    (- 2 3) => -1
+    (- 3 4 5) => -6";
+      }
+    }
+
+    public Subtraction()
+      : base() {
+      // 2 - 3 seems like an reasonable defaut (used for +,-,*,/) (discussion with swinkler and maffenze)
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 3));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+      AddConstraint(new SubOperatorTypeConstraint(2));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/SymbolTable.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/SymbolTable.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/SymbolTable.cs	(revision 649)
@@ -0,0 +1,93 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using System.Xml;
+
+namespace HeuristicLab.Functions {
+  class EvaluatorSymbolTable : StorableBase {
+    public const int ADDITION = 1;
+    public const int AND = 2;
+    public const int AVERAGE = 3;
+    public const int CONSTANT = 4;
+    public const int COSINUS = 5;
+    public const int DIFFERENTIAL = 25;
+    public const int DIVISION = 6;
+    public const int EQU = 7;
+    public const int EXP = 8;
+    public const int GT = 9;
+    public const int IFTE = 10;
+    public const int LT = 11;
+    public const int LOG = 12;
+    public const int MULTIPLICATION = 13;
+    public const int NOT = 14;
+    public const int OR = 15;
+    public const int POWER = 16;
+    public const int SIGNUM = 17;
+    public const int SINUS = 18;
+    public const int SQRT = 19;
+    public const int SUBTRACTION = 20;
+    public const int TANGENS = 21;
+    public const int VARIABLE = 22;
+    public const int XOR = 23;
+    public const int UNKNOWN = 24;
+
+    private static Dictionary<Type, int> staticTypes = new Dictionary<Type, int>();
+
+    // needs to be public for persistence mechanism (Activator.CreateInstance needs empty constructor)
+    static EvaluatorSymbolTable() {
+      staticTypes = new Dictionary<Type, int>();
+      staticTypes[typeof(Addition)] = ADDITION;
+      staticTypes[typeof(And)] = AND;
+      staticTypes[typeof(Average)] = AVERAGE;
+      staticTypes[typeof(Constant)] = CONSTANT;
+      staticTypes[typeof(Cosinus)] = COSINUS;
+      staticTypes[typeof(Division)] = DIVISION;
+      staticTypes[typeof(Equal)] = EQU;
+      staticTypes[typeof(Exponential)] = EXP;
+      staticTypes[typeof(GreaterThan)] = GT;
+      staticTypes[typeof(IfThenElse)] = IFTE;
+      staticTypes[typeof(LessThan)] = LT;
+      staticTypes[typeof(Logarithm)] = LOG;
+      staticTypes[typeof(Multiplication)] = MULTIPLICATION;
+      staticTypes[typeof(Not)] = NOT;
+      staticTypes[typeof(Or)] = OR;
+      staticTypes[typeof(Power)] = POWER;
+      staticTypes[typeof(Signum)] = SIGNUM;
+      staticTypes[typeof(Sinus)] = SINUS;
+      staticTypes[typeof(Sqrt)] = SQRT;
+      staticTypes[typeof(Subtraction)] = SUBTRACTION;
+      staticTypes[typeof(Tangens)] = TANGENS;
+      staticTypes[typeof(Variable)] = VARIABLE;
+      staticTypes[typeof(Xor)] = XOR;
+      staticTypes[typeof(Differential)] = DIFFERENTIAL;
+    }
+
+    internal static int MapFunction(IFunction function) {
+      if(staticTypes.ContainsKey(function.GetType())) return staticTypes[function.GetType()];
+      else return UNKNOWN;
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/SymbolicExpressionExporter.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/SymbolicExpressionExporter.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/SymbolicExpressionExporter.cs	(revision 649)
@@ -0,0 +1,168 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Functions {
+  public class SymbolicExpressionExporter : IFunctionVisitor {
+    private IFunctionTree currentBranch;
+    private StringBuilder builder;
+    private string currentIndent;
+    public SymbolicExpressionExporter() {
+      Reset();
+    }
+
+    public void Reset() {
+      currentIndent = "";
+      builder = new StringBuilder();
+    }
+
+    public string GetStringRepresentation() {
+      return builder.ToString();
+    }
+
+    private void VisitFunction(string name, IFunction f) {
+      builder.Append(currentIndent);
+      builder.Append("(" + name + " ");
+    }
+
+    #region IFunctionVisitor Members
+
+    public void Visit(IFunction function) {
+      builder.Append(function.Name);
+    }
+
+    public void Visit(Addition addition) {
+      VisitFunction("+", addition);
+    }
+
+    public void Visit(Constant constant) {
+      builder.Append(currentIndent+currentBranch.GetLocalVariable(Constant.VALUE).Value);
+    }
+
+    public void Visit(Cosinus cosinus) {
+      VisitFunction("cos", cosinus);
+    }
+
+    public void Visit(Division division) {
+      VisitFunction("/", division);
+    }
+
+    public void Visit(Exponential exponential) {
+      VisitFunction("exp", exponential);
+    }
+
+    public void Visit(Logarithm logarithm) {
+      VisitFunction("log", logarithm);
+    }
+
+    public void Visit(Multiplication multiplication) {
+      VisitFunction("*", multiplication);
+    }
+
+    public void Visit(Power power) {
+      VisitFunction("expt", power);
+    }
+
+    public void Visit(Signum signum) {
+      VisitFunction("sign", signum);
+    }
+
+    public void Visit(Sinus sinus) {
+      VisitFunction("sin", sinus);
+    }
+
+    public void Visit(Sqrt sqrt) {
+      VisitFunction("sqrt", sqrt);
+    }
+
+    public void Visit(Subtraction subtraction) {
+      VisitFunction("-", subtraction);
+    }
+
+    public void Visit(Tangens tangens) {
+      VisitFunction("tan", tangens);
+    }
+
+    public void Visit(Variable variable) {
+      builder.Append(currentIndent + "(variable " + currentBranch.GetLocalVariable(Variable.WEIGHT).Value + " " +
+        currentBranch.GetLocalVariable(Variable.INDEX).Value + " " + currentBranch.GetLocalVariable(Variable.OFFSET).Value + ")");
+    }
+    public void Visit(Differential differential) {
+      builder.Append(currentIndent+"(differential " + currentBranch.GetLocalVariable(Differential.WEIGHT).Value + " "+
+        currentBranch.GetLocalVariable(Differential.INDEX).Value+ " " + currentBranch.GetLocalVariable(Differential.OFFSET).Value+")");
+    }
+
+    public void Visit(And and) {
+      VisitFunction("and", and);
+    }
+
+    public void Visit(Average average) {
+      VisitFunction("mean", average);
+    }
+
+    public void Visit(IfThenElse ifThenElse) {
+      VisitFunction("if", ifThenElse);
+    }
+
+    public void Visit(Not not) {
+      VisitFunction("not", not);
+    }
+
+    public void Visit(Or or) {
+      VisitFunction("or", or);
+    }
+
+    public void Visit(Xor xor) {
+      VisitFunction("xor", xor);
+    }
+
+    public void Visit(Equal equal) {
+      VisitFunction("equ", equal);
+    }
+
+    public void Visit(LessThan lessThan) {
+      VisitFunction("<", lessThan);
+    }
+
+    public void Visit(GreaterThan greaterThan) {
+      VisitFunction(">", greaterThan);
+    }
+    #endregion
+
+    public void Visit(IFunctionTree functionTree) {
+      currentBranch = functionTree;
+      functionTree.Function.Accept(this);
+      currentIndent += "  ";
+
+      foreach(IFunctionTree subTree in functionTree.SubTrees) {
+        builder.Append("\n");
+        Visit(subTree);
+      }
+      if(functionTree.SubTrees.Count > 0) builder.Append(")");
+      currentIndent = currentIndent.Remove(0, 2);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Tangens.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Tangens.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Tangens.cs	(revision 649)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Tangens : FunctionBase {
+    public override string Description {
+      get { return "Returns the tangens of the first sub-tree."; }
+    }
+
+    public Tangens()
+      : base() {
+      // must have exactly one suboperator
+      AddConstraint(new NumberOfSubOperatorsConstraint(1, 1));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Variable.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Variable.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Variable.cs	(revision 649)
@@ -0,0 +1,214 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Diagnostics;
+using HeuristicLab.Data;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Random;
+using HeuristicLab.Operators;
+
+namespace HeuristicLab.Functions {
+  public class Variable : FunctionBase {
+
+    public const string WEIGHT = "Weight";
+    public const string OFFSET = "SampleOffset";
+    public const string INDEX = "Variable";
+
+    private int minIndex;
+    private int maxIndex;
+    private int minOffset;
+    private int maxOffset;
+
+    public override string Description {
+      get {
+        return @"Variable reads a value from a dataset, multiplies that value with a given factor and returns the result.
+The variable 'SampleOffset' can be used to read a value from previous or following rows.
+The index of the row that is actually read is SampleIndex+SampleOffset).";
+      }
+    }
+
+    public Variable()
+      : base() {
+      AddVariableInfo(new VariableInfo(INDEX, "Index of the variable in the dataset representing this feature", typeof(ConstrainedIntData), VariableKind.None));
+      GetVariableInfo(INDEX).Local = true;
+      AddVariableInfo(new VariableInfo(WEIGHT, "Weight is multiplied to the feature value", typeof(ConstrainedDoubleData), VariableKind.None));
+      GetVariableInfo(WEIGHT).Local = true;
+      AddVariableInfo(new VariableInfo(OFFSET, "SampleOffset is added to the sample index", typeof(ConstrainedIntData), VariableKind.None));
+      GetVariableInfo(OFFSET).Local = true;
+      AddVariableInfo(new VariableInfo(INITIALIZATION, "Initialization operator for variables", typeof(CombinedOperator), VariableKind.None));
+      GetVariableInfo(INITIALIZATION).Local = false;
+      AddVariableInfo(new VariableInfo(MANIPULATION, "Manipulation operator for variables", typeof(CombinedOperator), VariableKind.None));
+      GetVariableInfo(MANIPULATION).Local = false;
+
+      ConstrainedDoubleData weight = new ConstrainedDoubleData();
+      // initialize a totally arbitrary range for the weight = [-20.0, 20.0]
+      weight.AddConstraint(new DoubleBoundedConstraint(-20.0, 20.0));
+      AddVariable(new HeuristicLab.Core.Variable(WEIGHT, weight));
+
+      ConstrainedIntData variable = new ConstrainedIntData();
+      AddVariable(new HeuristicLab.Core.Variable(INDEX, variable));
+      minIndex = 0; maxIndex = 100;
+
+      ConstrainedIntData sampleOffset = new ConstrainedIntData();
+      AddVariable(new HeuristicLab.Core.Variable(OFFSET, sampleOffset));
+
+      SetupInitialization();
+      SetupManipulation();
+
+      // variable can't have suboperators
+      AddConstraint(new NumberOfSubOperatorsConstraint(0, 0));
+    }
+
+    private void SetupInitialization() {
+      CombinedOperator combinedOp = new CombinedOperator();
+      SequentialProcessor seq = new SequentialProcessor();
+      UniformRandomizer indexRandomizer = new UniformRandomizer();
+      indexRandomizer.Min = minIndex;
+      indexRandomizer.Max = maxIndex + 1; // uniform randomizer generates numbers in the range [min, max[
+      indexRandomizer.GetVariableInfo("Value").ActualName = INDEX;
+      indexRandomizer.Name = "Index Randomizer";
+      NormalRandomizer weightRandomizer = new NormalRandomizer();
+      weightRandomizer.Mu = 1.0;
+      weightRandomizer.Sigma = 1.0;
+      weightRandomizer.GetVariableInfo("Value").ActualName = WEIGHT;
+      weightRandomizer.Name = "Weight Randomizer";
+      UniformRandomizer offsetRandomizer = new UniformRandomizer();
+      offsetRandomizer.Min = minOffset;
+      offsetRandomizer.Max = maxOffset + 1;
+      offsetRandomizer.GetVariableInfo("Value").ActualName = OFFSET;
+      offsetRandomizer.Name = "Offset Randomizer";
+
+      combinedOp.OperatorGraph.AddOperator(seq);
+      combinedOp.OperatorGraph.AddOperator(indexRandomizer);
+      combinedOp.OperatorGraph.AddOperator(weightRandomizer);
+      combinedOp.OperatorGraph.AddOperator(offsetRandomizer);
+      combinedOp.OperatorGraph.InitialOperator = seq;
+      seq.AddSubOperator(indexRandomizer);
+      seq.AddSubOperator(weightRandomizer);
+      seq.AddSubOperator(offsetRandomizer);
+      HeuristicLab.Core.IVariable initOp = GetVariable(INITIALIZATION);
+      if(initOp == null) {
+        AddVariable(new HeuristicLab.Core.Variable(INITIALIZATION, combinedOp));
+      } else {
+        initOp.Value = combinedOp;
+      }
+    }
+
+    private void SetupManipulation() {
+      // manipulation operator
+      CombinedOperator combinedOp = new CombinedOperator();
+      SequentialProcessor seq = new SequentialProcessor();
+      UniformRandomizer indexRandomizer = new UniformRandomizer();
+      indexRandomizer.Min = minIndex;
+      indexRandomizer.Max = maxIndex + 1;
+      indexRandomizer.GetVariableInfo("Value").ActualName = INDEX;
+      indexRandomizer.Name = "Index Randomizer";
+      NormalRandomAdder weightRandomAdder = new NormalRandomAdder();
+      weightRandomAdder.Mu = 0.0;
+      weightRandomAdder.Sigma = 0.1;
+      weightRandomAdder.GetVariableInfo("Value").ActualName = WEIGHT;
+      weightRandomAdder.Name = "Weight Adder";
+      NormalRandomAdder offsetRandomAdder = new NormalRandomAdder();
+      offsetRandomAdder.Mu = 0.0;
+      offsetRandomAdder.Sigma = 1.0;
+      offsetRandomAdder.GetVariableInfo("Value").ActualName = OFFSET;
+      offsetRandomAdder.Name = "Offset Adder";
+
+      combinedOp.OperatorGraph.AddOperator(seq);
+      combinedOp.OperatorGraph.AddOperator(indexRandomizer);
+      combinedOp.OperatorGraph.AddOperator(weightRandomAdder);
+      combinedOp.OperatorGraph.AddOperator(offsetRandomAdder);
+      combinedOp.OperatorGraph.InitialOperator = seq;
+      seq.AddSubOperator(indexRandomizer);
+      seq.AddSubOperator(weightRandomAdder);
+      seq.AddSubOperator(offsetRandomAdder);
+      HeuristicLab.Core.IVariable manipulationOp = GetVariable(MANIPULATION);
+      if(manipulationOp == null) {
+        AddVariable(new HeuristicLab.Core.Variable(MANIPULATION, combinedOp));
+      } else {
+        manipulationOp.Value = combinedOp;
+      }
+    }
+
+    public void SetConstraints(int[] allowedIndexes, int minSampleOffset, int maxSampleOffset) {
+      ConstrainedIntData offset = GetVariableValue<ConstrainedIntData>(OFFSET, null, false);
+      IntBoundedConstraint rangeConstraint = new IntBoundedConstraint();
+      this.minOffset = minSampleOffset;
+      this.maxOffset = maxSampleOffset;
+      rangeConstraint.LowerBound = minSampleOffset;
+      rangeConstraint.LowerBoundEnabled = true;
+      rangeConstraint.LowerBoundIncluded = true;
+      rangeConstraint.UpperBound = maxSampleOffset;
+      rangeConstraint.UpperBoundEnabled = true;
+      rangeConstraint.UpperBoundIncluded = true;
+      offset.AddConstraint(rangeConstraint);
+
+      ConstrainedIntData index = GetVariableValue<ConstrainedIntData>(INDEX, null, false);
+      Array.Sort(allowedIndexes);
+      minIndex = allowedIndexes[0]; maxIndex = allowedIndexes[allowedIndexes.Length - 1];
+      List<IConstraint> constraints = new List<IConstraint>();
+      int start = allowedIndexes[0];
+      int prev = start;
+      for(int i = 1; i < allowedIndexes.Length; i++) {
+        if(allowedIndexes[i] != prev + 1) {
+          IntBoundedConstraint lastRange = new IntBoundedConstraint();
+          lastRange.LowerBound = start;
+          lastRange.LowerBoundEnabled = true;
+          lastRange.LowerBoundIncluded = true;
+          lastRange.UpperBound = prev;
+          lastRange.UpperBoundEnabled = true;
+          lastRange.UpperBoundIncluded = true;
+          constraints.Add(lastRange);
+          start = allowedIndexes[i];
+          prev = start;
+        }
+        prev = allowedIndexes[i];
+      }
+      IntBoundedConstraint range = new IntBoundedConstraint();
+      range.LowerBound = start;
+      range.LowerBoundEnabled = true;
+      range.LowerBoundIncluded = true;
+      range.UpperBound = prev;
+      range.UpperBoundEnabled = true;
+      range.UpperBoundIncluded = true;
+      constraints.Add(range);
+      if(constraints.Count > 1) {
+        OrConstraint or = new OrConstraint();
+        foreach(IConstraint c in constraints) or.Clauses.Add(c);
+        index.AddConstraint(or);
+      } else {
+        index.AddConstraint(constraints[0]);
+      }
+
+      SetupInitialization();
+      SetupManipulation();
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
Index: /branches/plugins/HeuristicLab.Functions/3.2/Xor.cs
===================================================================
--- /branches/plugins/HeuristicLab.Functions/3.2/Xor.cs	(revision 649)
+++ /branches/plugins/HeuristicLab.Functions/3.2/Xor.cs	(revision 649)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Constraints;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Functions {
+  public sealed class Xor : FunctionBase {
+    public override string Description {
+      get {
+        return @"Logical XOR operation. Only defined for sub-tree-results 0.0 and 1.0.";
+      }
+    }
+
+    public Xor()
+      : base() {
+      AddConstraint(new NumberOfSubOperatorsConstraint(2, 2));
+      AddConstraint(new SubOperatorTypeConstraint(0));
+      AddConstraint(new SubOperatorTypeConstraint(1));
+    }
+
+    public override void Accept(IFunctionVisitor visitor) {
+      visitor.Visit(this);
+    }
+  }
+}
