Index: /trunk/sources/HeuristicLab.GP.Interfaces/3.3/HeuristicLab.GP.Interfaces-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.GP.Interfaces/3.3/HeuristicLab.GP.Interfaces-3.3.csproj	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.Interfaces/3.3/HeuristicLab.GP.Interfaces-3.3.csproj	(revision 2235)
@@ -80,7 +80,4 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="IFunctionTreeNameGenerator.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="IFunctionTreeSerializer.cs">
       <SubType>Code</SubType>
Index: /trunk/sources/HeuristicLab.GP.Interfaces/3.3/IFunctionTree.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.Interfaces/3.3/IFunctionTree.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.Interfaces/3.3/IFunctionTree.cs	(revision 2235)
@@ -37,4 +37,5 @@
     void InsertSubTree(int index, IFunctionTree tree);
     void RemoveSubTree(int index);
+    string ToString();
   }
 }
Index: unk/sources/HeuristicLab.GP.Interfaces/3.3/IFunctionTreeNameGenerator.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.Interfaces/3.3/IFunctionTreeNameGenerator.cs	(revision 2234)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using HeuristicLab.Core;
-
-namespace HeuristicLab.GP.Interfaces {
-  public interface IFunctionTreeNameGenerator {
-    string Name { get; }
-    string GetName(IFunctionTree tree);
-  }
-}
Index: unk/sources/HeuristicLab.GP.StructureIdentification/3.3/AlgorithmBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/AlgorithmBase.cs	(revision 2234)
+++ 	(revision )
@@ -1,487 +1,0 @@
-﻿#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.Xml;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.DataAnalysis;
-using HeuristicLab.Evolutionary;
-using HeuristicLab.GP.Interfaces;
-using HeuristicLab.Logging;
-using HeuristicLab.Modeling;
-using HeuristicLab.Operators;
-using HeuristicLab.Random;
-using HeuristicLab.Selection;
-
-namespace HeuristicLab.GP.StructureIdentification {
-  public abstract class AlgorithmBase : ItemBase, IAlgorithm, IStochasticAlgorithm {
-    public virtual string Name { get { return "GP"; } }
-    public virtual string Description { get { return "TODO"; } }
-
-    public abstract Dataset Dataset { get; set; }
-    public abstract int TargetVariable { get; set; }
-
-    public virtual double MutationRate {
-      get { return GetVariableInjector().GetVariable("MutationRate").GetValue<DoubleData>().Data; }
-      set { GetVariableInjector().GetVariable("MutationRate").GetValue<DoubleData>().Data = value; }
-    }
-    public virtual int PopulationSize {
-      get { return GetVariableInjector().GetVariable("PopulationSize").GetValue<IntData>().Data; }
-      set { GetVariableInjector().GetVariable("PopulationSize").GetValue<IntData>().Data = value; }
-    }
-
-    public virtual bool SetSeedRandomly {
-      get { return GetRandomInjector().GetVariable("SetSeedRandomly").GetValue<BoolData>().Data; }
-      set { GetRandomInjector().GetVariable("SetSeedRandomly").GetValue<BoolData>().Data = value; }
-    }
-
-    public virtual int RandomSeed {
-      get { return GetRandomInjector().GetVariable("Seed").GetValue<IntData>().Data; }
-      set { GetRandomInjector().GetVariable("Seed").GetValue<IntData>().Data = value; }
-    }
-
-    public virtual IOperator ProblemInjector {
-      get { return algorithm.SubOperators[1]; }
-      set {
-        value.Name = "ProblemInjector";
-        algorithm.RemoveSubOperator(1);
-        algorithm.AddSubOperator(value, 1);
-      }
-    }
-
-    private IModel model;
-    public virtual IModel Model {
-      get {
-        if (!engine.Terminated) throw new InvalidOperationException("The algorithm is still running. Wait until the algorithm is terminated to retrieve the result.");
-        if (model == null) {
-          IScope bestModelScope = engine.GlobalScope.GetVariableValue<IScope>("BestValidationSolution", false);
-          model = CreateGPModel(bestModelScope);
-        }
-        return model;
-      }
-    }
-
-    public virtual int Elites {
-      get { return GetVariableInjector().GetVariable("Elites").GetValue<IntData>().Data; }
-      set { GetVariableInjector().GetVariable("Elites").GetValue<IntData>().Data = value; }
-    }
-
-    public virtual int MaxTreeSize {
-      get { return GetVariableInjector().GetVariable("MaxTreeSize").GetValue<IntData>().Data; }
-      set { GetVariableInjector().GetVariable("MaxTreeSize").GetValue<IntData>().Data = value; }
-    }
-
-    public virtual int MaxTreeHeight {
-      get { return GetVariableInjector().GetVariable("MaxTreeHeight").GetValue<IntData>().Data; }
-      set { GetVariableInjector().GetVariable("MaxTreeHeight").GetValue<IntData>().Data = value; }
-    }
-
-    public virtual int Parents {
-      get { return GetVariableInjector().GetVariable("Parents").GetValue<IntData>().Data; }
-      set { GetVariableInjector().GetVariable("Parents").GetValue<IntData>().Data = value; }
-    }
-
-    public virtual double PunishmentFactor {
-      get { return GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data; }
-      set { GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data = value; }
-    }
-
-    public virtual bool UseEstimatedTargetValue {
-      get { return GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data; }
-      set { GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data = value; }
-    }
-
-    private IOperator algorithm;
-
-    private SequentialEngine.SequentialEngine engine;
-    public IEngine Engine {
-      get { return engine; }
-      protected set { engine = (SequentialEngine.SequentialEngine)value; }
-    }
-
-    public AlgorithmBase() {
-      engine = new SequentialEngine.SequentialEngine();
-      CombinedOperator algo = CreateAlgorithm();
-      engine.OperatorGraph.AddOperator(algo);
-      engine.OperatorGraph.InitialOperator = algo;
-      SetSeedRandomly = true;
-      Elites = 1;
-      MutationRate = 0.15;
-      PopulationSize = 1000;
-      MaxTreeSize = 100;
-      MaxTreeHeight = 10;
-      Parents = 2000;
-      PunishmentFactor = 10;
-      UseEstimatedTargetValue = false;
-    }
-
-    protected internal virtual CombinedOperator CreateAlgorithm() {
-      CombinedOperator algo = new CombinedOperator();
-      algo.Name = "GP";
-      SequentialProcessor seq = new SequentialProcessor();
-      IOperator problemInjector = CreateProblemInjector();
-
-      RandomInjector randomInjector = new RandomInjector();
-      randomInjector.Name = "Random Injector";
-
-      IOperator globalInjector = CreateGlobalInjector();
-      IOperator initialization = CreateInitialization();
-      IOperator funLibInjector = CreateFunctionLibraryInjector();
-
-      IOperator mainLoop = CreateMainLoop();
-      mainLoop.Name = "Main loop";
-
-      IOperator treeCreator = CreateTreeCreator();
-
-      MeanSquaredErrorEvaluator evaluator = new MeanSquaredErrorEvaluator();
-      evaluator.GetVariableInfo("MSE").ActualName = "Quality";
-      evaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart";
-      evaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd";
-      evaluator.Name = "Evaluator";
-
-      IOperator crossover = CreateCrossover();
-      IOperator manipulator = CreateManipulator();
-
-      IOperator selector = CreateSelector();
-      LeftReducer cleanUp = new LeftReducer();
-
-      seq.AddSubOperator(randomInjector);
-      seq.AddSubOperator(problemInjector);
-      seq.AddSubOperator(globalInjector);
-      seq.AddSubOperator(funLibInjector);
-      seq.AddSubOperator(initialization);
-      seq.AddSubOperator(mainLoop);
-      seq.AddSubOperator(cleanUp);
-
-      initialization.AddSubOperator(treeCreator);
-      initialization.AddSubOperator(evaluator);
-
-      mainLoop.AddSubOperator(selector);
-      mainLoop.AddSubOperator(crossover);
-      mainLoop.AddSubOperator(manipulator);
-      mainLoop.AddSubOperator(evaluator);
-      algo.OperatorGraph.AddOperator(seq);
-      algo.OperatorGraph.InitialOperator = seq;
-      this.algorithm = seq;
-      return algo;
-    }
-
-    protected internal virtual IOperator CreateProblemInjector() {
-      return new EmptyOperator();
-    }
-
-    protected internal abstract IOperator CreateSelector();
-
-    protected internal abstract IOperator CreateCrossover();
-
-    protected internal abstract IOperator CreateTreeCreator();
-
-    protected internal abstract IOperator CreateFunctionLibraryInjector();
-
-    protected internal virtual IOperator CreateGlobalInjector() {
-      VariableInjector injector = new VariableInjector();
-      injector.Name = "Global Injector";
-      injector.AddVariable(new HeuristicLab.Core.Variable("Generations", new IntData(0)));
-      injector.AddVariable(new HeuristicLab.Core.Variable("MutationRate", new DoubleData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("PopulationSize", new IntData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("Elites", new IntData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("Maximization", new BoolData(false)));
-      injector.AddVariable(new HeuristicLab.Core.Variable("MaxTreeHeight", new IntData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("MaxTreeSize", new IntData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("EvaluatedSolutions", new IntData(0)));
-      injector.AddVariable(new HeuristicLab.Core.Variable("TotalEvaluatedNodes", new DoubleData(0)));
-      injector.AddVariable(new HeuristicLab.Core.Variable("Parents", new IntData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("PunishmentFactor", new DoubleData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData()));
-      injector.AddVariable(new HeuristicLab.Core.Variable("TreeEvaluator", new HL2TreeEvaluator()));
-      return injector;
-    }
-
-    protected internal abstract IOperator CreateManipulator();
-
-    protected internal virtual IOperator CreateInitialization() {
-      CombinedOperator init = new CombinedOperator();
-      init.Name = "Initialization";
-      SequentialProcessor seq = new SequentialProcessor();
-      SubScopesCreater subScopesCreater = new SubScopesCreater();
-      subScopesCreater.GetVariableInfo("SubScopes").ActualName = "PopulationSize";
-      UniformSequentialSubScopesProcessor subScopesProc = new UniformSequentialSubScopesProcessor();
-      SequentialProcessor individualSeq = new SequentialProcessor();
-      OperatorExtractor treeCreater = new OperatorExtractor();
-      treeCreater.Name = "Tree generator (extr.)";
-      treeCreater.GetVariableInfo("Operator").ActualName = "Tree generator";
-      OperatorExtractor evaluator = new OperatorExtractor();
-      evaluator.Name = "Evaluator (extr.)";
-      evaluator.GetVariableInfo("Operator").ActualName = "Evaluator";
-      MeanSquaredErrorEvaluator validationEvaluator = new MeanSquaredErrorEvaluator();
-      validationEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality";
-      validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
-      validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
-      Counter evalCounter = new Counter();
-      evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions";
-      Sorter sorter = new Sorter();
-      sorter.GetVariableInfo("Descending").ActualName = "Maximization";
-      sorter.GetVariableInfo("Value").ActualName = "Quality";
-
-      seq.AddSubOperator(subScopesCreater);
-      seq.AddSubOperator(subScopesProc);
-      seq.AddSubOperator(sorter);
-
-      subScopesProc.AddSubOperator(individualSeq);
-      individualSeq.AddSubOperator(treeCreater);
-      individualSeq.AddSubOperator(evaluator);
-      individualSeq.AddSubOperator(validationEvaluator);
-      individualSeq.AddSubOperator(evalCounter);
-
-      init.OperatorGraph.AddOperator(seq);
-      init.OperatorGraph.InitialOperator = seq;
-      return init;
-    }
-
-    protected internal virtual IOperator CreateMainLoop() {
-      CombinedOperator main = new CombinedOperator();
-      SequentialProcessor seq = new SequentialProcessor();
-      IOperator childCreater = CreateChildCreater();
-      IOperator replacement = CreateReplacement();
-
-      BestSolutionStorer solutionStorer = new BestSolutionStorer();
-      solutionStorer.GetVariableInfo("Quality").ActualName = "ValidationQuality";
-      solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution";
-      solutionStorer.AddSubOperator(CreateBestSolutionProcessor());
-
-      BestAverageWorstQualityCalculator qualityCalculator = new BestAverageWorstQualityCalculator();
-      BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator();
-      validationQualityCalculator.Name = "BestAverageWorstValidationQualityCalculator";
-      validationQualityCalculator.GetVariableInfo("Quality").ActualName = "ValidationQuality";
-      validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality";
-      validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality";
-      validationQualityCalculator.GetVariableInfo("WorstQuality").ActualName = "WorstValidationQuality";
-      IOperator loggingOperator = CreateLoggingOperator();
-      Counter counter = new Counter();
-      counter.GetVariableInfo("Value").ActualName = "Generations";
-      IOperator loopCondition = CreateLoopCondition(seq);
-
-      seq.AddSubOperator(childCreater);
-      seq.AddSubOperator(replacement);
-      seq.AddSubOperator(solutionStorer);
-      seq.AddSubOperator(qualityCalculator);
-      seq.AddSubOperator(validationQualityCalculator);
-      seq.AddSubOperator(loggingOperator);
-      seq.AddSubOperator(counter);
-      seq.AddSubOperator(loopCondition);
-
-      main.OperatorGraph.AddOperator(seq);
-      main.OperatorGraph.InitialOperator = seq;
-      return main;
-    }
-
-    protected internal virtual IOperator CreateLoggingOperator() {
-      return new EmptyOperator();
-    }
-
-    protected internal virtual IOperator CreateLoopCondition(IOperator loop) {
-      SequentialProcessor seq = new SequentialProcessor();
-      seq.Name = "Loop Condition";
-      LessThanComparator comparator = new LessThanComparator();
-      comparator.GetVariableInfo("LeftSide").ActualName = "Generations";
-      comparator.GetVariableInfo("RightSide").ActualName = "MaxGenerations";
-      comparator.GetVariableInfo("Result").ActualName = "GenerationsCondition";
-      ConditionalBranch cond = new ConditionalBranch();
-      cond.GetVariableInfo("Condition").ActualName = "GenerationsCondition";
-
-      seq.AddSubOperator(comparator);
-      seq.AddSubOperator(cond);
-
-      cond.AddSubOperator(loop);
-      return seq;
-    }
-
-    protected internal virtual IOperator CreateBestSolutionProcessor() {
-      return new EmptyOperator();
-    }
-
-    protected internal virtual IOperator CreateReplacement() {
-      CombinedOperator replacement = new CombinedOperator();
-      replacement.Name = "Replacement";
-      SequentialProcessor seq = new SequentialProcessor();
-      SequentialSubScopesProcessor seqScopeProc = new SequentialSubScopesProcessor();
-      SequentialProcessor selectedProc = new SequentialProcessor();
-      LeftSelector leftSelector = new LeftSelector();
-      leftSelector.GetVariableInfo("Selected").ActualName = "Elites";
-      RightReducer rightReducer = new RightReducer();
-
-      SequentialProcessor remainingProc = new SequentialProcessor();
-      RightSelector rightSelector = new RightSelector();
-      rightSelector.GetVariableInfo("Selected").ActualName = "Elites";
-      LeftReducer leftReducer = new LeftReducer();
-      MergingReducer mergingReducer = new MergingReducer();
-      Sorter sorter = new Sorter();
-      sorter.GetVariableInfo("Descending").ActualName = "Maximization";
-      sorter.GetVariableInfo("Value").ActualName = "Quality";
-
-      seq.AddSubOperator(seqScopeProc);
-      seqScopeProc.AddSubOperator(selectedProc);
-      selectedProc.AddSubOperator(leftSelector);
-      selectedProc.AddSubOperator(rightReducer);
-
-      seqScopeProc.AddSubOperator(remainingProc);
-      remainingProc.AddSubOperator(rightSelector);
-      remainingProc.AddSubOperator(leftReducer);
-      seq.AddSubOperator(mergingReducer);
-      seq.AddSubOperator(sorter);
-      replacement.OperatorGraph.AddOperator(seq);
-      replacement.OperatorGraph.InitialOperator = seq;
-      return replacement;
-    }
-
-    protected internal virtual IOperator CreateChildCreater() {
-      CombinedOperator childCreater = new CombinedOperator();
-      childCreater.Name = "Create children";
-      SequentialProcessor seq = new SequentialProcessor();
-      OperatorExtractor selector = new OperatorExtractor();
-      selector.Name = "Selector (extr.)";
-      selector.GetVariableInfo("Operator").ActualName = "Selector";
-
-      SequentialSubScopesProcessor seqScopesProc = new SequentialSubScopesProcessor();
-      EmptyOperator emptyOpt = new EmptyOperator();
-      SequentialProcessor selectedProc = new SequentialProcessor();
-      ChildrenInitializer childInitializer = new ChildrenInitializer();
-      ((IntData)childInitializer.GetVariable("ParentsPerChild").Value).Data = 2;
-
-      OperatorExtractor crossover = new OperatorExtractor();
-      crossover.Name = "Crossover (extr.)";
-      crossover.GetVariableInfo("Operator").ActualName = "Crossover";
-      UniformSequentialSubScopesProcessor individualProc = new UniformSequentialSubScopesProcessor();
-      SequentialProcessor individualSeqProc = new SequentialProcessor();
-      StochasticBranch cond = new StochasticBranch();
-      cond.GetVariableInfo("Probability").ActualName = "MutationRate";
-      OperatorExtractor manipulator = new OperatorExtractor();
-      manipulator.Name = "Manipulator (extr.)";
-      manipulator.GetVariableInfo("Operator").ActualName = "Manipulator";
-      OperatorExtractor evaluator = new OperatorExtractor();
-      evaluator.Name = "Evaluator (extr.)";
-      evaluator.GetVariableInfo("Operator").ActualName = "Evaluator";
-      MeanSquaredErrorEvaluator validationEvaluator = new MeanSquaredErrorEvaluator();
-      validationEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality";
-      validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
-      validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
-      Counter evalCounter = new Counter();
-      evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions";
-      SubScopesRemover parentRefRemover = new SubScopesRemover();
-
-      Sorter sorter = new Sorter();
-      sorter.GetVariableInfo("Descending").ActualName = "Maximization";
-      sorter.GetVariableInfo("Value").ActualName = "Quality";
-
-
-      seq.AddSubOperator(selector);
-      seq.AddSubOperator(seqScopesProc);
-      seqScopesProc.AddSubOperator(emptyOpt);
-      seqScopesProc.AddSubOperator(selectedProc);
-      selectedProc.AddSubOperator(childInitializer);
-      selectedProc.AddSubOperator(individualProc);
-      individualProc.AddSubOperator(individualSeqProc);
-      individualSeqProc.AddSubOperator(crossover);
-      individualSeqProc.AddSubOperator(cond);
-      cond.AddSubOperator(manipulator);
-      individualSeqProc.AddSubOperator(evaluator);
-      individualSeqProc.AddSubOperator(validationEvaluator);
-      individualSeqProc.AddSubOperator(evalCounter);
-      individualSeqProc.AddSubOperator(parentRefRemover);
-      selectedProc.AddSubOperator(sorter);
-
-      childCreater.OperatorGraph.AddOperator(seq);
-      childCreater.OperatorGraph.InitialOperator = seq;
-      return childCreater;
-    }
-
-    protected internal virtual Model CreateGPModel(IScope bestModelScope) {
-      Engine.GlobalScope.AddSubScope(bestModelScope);
-      Model model = new Model();
-      Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true);
-      model.Data = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("FunctionTree", false);
-      model.Dataset = ds;
-      model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
-      model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data;
-      model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data;
-      // calculate and set variable impacts
-      VariableEvaluationImpactCalculator evaluationImpactCalculator = new VariableEvaluationImpactCalculator();
-      VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
-
-      evaluationImpactCalculator.Apply(bestModelScope);
-      qualityImpactCalculator.Apply(bestModelScope);
-
-      ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false);
-      ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>("VariableQualityImpacts", false);
-      foreach (ItemList row in evaluationImpacts) {
-        string variableName = ((StringData)row[0]).Data;
-        double impact = ((DoubleData)row[1]).Data;
-        model.SetVariableEvaluationImpact(variableName, impact);
-        model.AddInputVariables(variableName);
-      }
-      foreach (ItemList row in qualityImpacts) {
-        string variableName = ((StringData)row[0]).Data;
-        double impact = ((DoubleData)row[1]).Data;
-        model.SetVariableQualityImpact(variableName, impact);
-        model.AddInputVariables(variableName);
-      }
-      Engine.GlobalScope.RemoveSubScope(bestModelScope);
-      return model;
-    }
-
-    public override object Clone(IDictionary<Guid, object> clonedObjects) {
-      AlgorithmBase clone = (AlgorithmBase)base.Clone(clonedObjects);
-      clonedObjects.Add(Guid, clone);
-      clone.engine = (SequentialEngine.SequentialEngine)Auxiliary.Clone(Engine, clonedObjects);
-      return clone;
-    }
-
-    protected VariableInjector GetVariableInjector() {
-      CombinedOperator co1 = (CombinedOperator)Engine.OperatorGraph.InitialOperator;
-      // SequentialProcessor in GP
-      algorithm = (SequentialProcessor)co1.OperatorGraph.InitialOperator;
-      return (VariableInjector)algorithm.SubOperators[2];
-    }
-
-    protected RandomInjector GetRandomInjector() {
-      CombinedOperator co1 = (CombinedOperator)Engine.OperatorGraph.InitialOperator;
-      // SequentialProcessor in GP
-      algorithm = (SequentialProcessor)co1.OperatorGraph.InitialOperator;
-      return (RandomInjector)algorithm.SubOperators[0];
-    }
-
-    #region Persistence Methods
-    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
-      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
-      node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
-      return node;
-    }
-    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      engine = (SequentialEngine.SequentialEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
-    }
-    #endregion
-
-
-  }
-}
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/AlgorithmBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/AlgorithmBase.cs	(revision 2235)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/AlgorithmBase.cs	(revision 2235)
@@ -0,0 +1,487 @@
+﻿#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.Xml;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.Evolutionary;
+using HeuristicLab.GP.Interfaces;
+using HeuristicLab.Logging;
+using HeuristicLab.Modeling;
+using HeuristicLab.Operators;
+using HeuristicLab.Random;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.GP.StructureIdentification {
+  public abstract class AlgorithmBase : ItemBase, IAlgorithm, IStochasticAlgorithm {
+    public virtual string Name { get { return "GP"; } }
+    public virtual string Description { get { return "TODO"; } }
+
+    public abstract Dataset Dataset { get; set; }
+    public abstract int TargetVariable { get; set; }
+
+    public virtual double MutationRate {
+      get { return GetVariableInjector().GetVariable("MutationRate").GetValue<DoubleData>().Data; }
+      set { GetVariableInjector().GetVariable("MutationRate").GetValue<DoubleData>().Data = value; }
+    }
+    public virtual int PopulationSize {
+      get { return GetVariableInjector().GetVariable("PopulationSize").GetValue<IntData>().Data; }
+      set { GetVariableInjector().GetVariable("PopulationSize").GetValue<IntData>().Data = value; }
+    }
+
+    public virtual bool SetSeedRandomly {
+      get { return GetRandomInjector().GetVariable("SetSeedRandomly").GetValue<BoolData>().Data; }
+      set { GetRandomInjector().GetVariable("SetSeedRandomly").GetValue<BoolData>().Data = value; }
+    }
+
+    public virtual int RandomSeed {
+      get { return GetRandomInjector().GetVariable("Seed").GetValue<IntData>().Data; }
+      set { GetRandomInjector().GetVariable("Seed").GetValue<IntData>().Data = value; }
+    }
+
+    public virtual IOperator ProblemInjector {
+      get { return algorithm.SubOperators[1]; }
+      set {
+        value.Name = "ProblemInjector";
+        algorithm.RemoveSubOperator(1);
+        algorithm.AddSubOperator(value, 1);
+      }
+    }
+
+    private IModel model;
+    public virtual IModel Model {
+      get {
+        if (!engine.Terminated) throw new InvalidOperationException("The algorithm is still running. Wait until the algorithm is terminated to retrieve the result.");
+        if (model == null) {
+          IScope bestModelScope = engine.GlobalScope.GetVariableValue<IScope>("BestValidationSolution", false);
+          model = CreateGPModel(bestModelScope);
+        }
+        return model;
+      }
+    }
+
+    public virtual int Elites {
+      get { return GetVariableInjector().GetVariable("Elites").GetValue<IntData>().Data; }
+      set { GetVariableInjector().GetVariable("Elites").GetValue<IntData>().Data = value; }
+    }
+
+    public virtual int MaxTreeSize {
+      get { return GetVariableInjector().GetVariable("MaxTreeSize").GetValue<IntData>().Data; }
+      set { GetVariableInjector().GetVariable("MaxTreeSize").GetValue<IntData>().Data = value; }
+    }
+
+    public virtual int MaxTreeHeight {
+      get { return GetVariableInjector().GetVariable("MaxTreeHeight").GetValue<IntData>().Data; }
+      set { GetVariableInjector().GetVariable("MaxTreeHeight").GetValue<IntData>().Data = value; }
+    }
+
+    public virtual int Parents {
+      get { return GetVariableInjector().GetVariable("Parents").GetValue<IntData>().Data; }
+      set { GetVariableInjector().GetVariable("Parents").GetValue<IntData>().Data = value; }
+    }
+
+    public virtual double PunishmentFactor {
+      get { return GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data; }
+      set { GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data = value; }
+    }
+
+    public virtual bool UseEstimatedTargetValue {
+      get { return GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data; }
+      set { GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data = value; }
+    }
+
+    private IOperator algorithm;
+
+    private SequentialEngine.SequentialEngine engine;
+    public IEngine Engine {
+      get { return engine; }
+      protected set { engine = (SequentialEngine.SequentialEngine)value; }
+    }
+
+    public AlgorithmBase() {
+      engine = new SequentialEngine.SequentialEngine();
+      CombinedOperator algo = CreateAlgorithm();
+      engine.OperatorGraph.AddOperator(algo);
+      engine.OperatorGraph.InitialOperator = algo;
+      SetSeedRandomly = true;
+      Elites = 1;
+      MutationRate = 0.15;
+      PopulationSize = 1000;
+      MaxTreeSize = 100;
+      MaxTreeHeight = 10;
+      Parents = 2000;
+      PunishmentFactor = 10;
+      UseEstimatedTargetValue = false;
+    }
+
+    protected internal virtual CombinedOperator CreateAlgorithm() {
+      CombinedOperator algo = new CombinedOperator();
+      algo.Name = "GP";
+      SequentialProcessor seq = new SequentialProcessor();
+      IOperator problemInjector = CreateProblemInjector();
+
+      RandomInjector randomInjector = new RandomInjector();
+      randomInjector.Name = "Random Injector";
+
+      IOperator globalInjector = CreateGlobalInjector();
+      IOperator initialization = CreateInitialization();
+      IOperator funLibInjector = CreateFunctionLibraryInjector();
+
+      IOperator mainLoop = CreateMainLoop();
+      mainLoop.Name = "Main loop";
+
+      IOperator treeCreator = CreateTreeCreator();
+
+      MeanSquaredErrorEvaluator evaluator = new MeanSquaredErrorEvaluator();
+      evaluator.GetVariableInfo("MSE").ActualName = "Quality";
+      evaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart";
+      evaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd";
+      evaluator.Name = "Evaluator";
+
+      IOperator crossover = CreateCrossover();
+      IOperator manipulator = CreateManipulator();
+
+      IOperator selector = CreateSelector();
+      LeftReducer cleanUp = new LeftReducer();
+
+      seq.AddSubOperator(randomInjector);
+      seq.AddSubOperator(problemInjector);
+      seq.AddSubOperator(globalInjector);
+      seq.AddSubOperator(funLibInjector);
+      seq.AddSubOperator(initialization);
+      seq.AddSubOperator(mainLoop);
+      seq.AddSubOperator(cleanUp);
+
+      initialization.AddSubOperator(treeCreator);
+      initialization.AddSubOperator(evaluator);
+
+      mainLoop.AddSubOperator(selector);
+      mainLoop.AddSubOperator(crossover);
+      mainLoop.AddSubOperator(manipulator);
+      mainLoop.AddSubOperator(evaluator);
+      algo.OperatorGraph.AddOperator(seq);
+      algo.OperatorGraph.InitialOperator = seq;
+      this.algorithm = seq;
+      return algo;
+    }
+
+    protected internal virtual IOperator CreateProblemInjector() {
+      return new EmptyOperator();
+    }
+
+    protected internal abstract IOperator CreateSelector();
+
+    protected internal abstract IOperator CreateCrossover();
+
+    protected internal abstract IOperator CreateTreeCreator();
+
+    protected internal abstract IOperator CreateFunctionLibraryInjector();
+
+    protected internal virtual IOperator CreateGlobalInjector() {
+      VariableInjector injector = new VariableInjector();
+      injector.Name = "Global Injector";
+      injector.AddVariable(new HeuristicLab.Core.Variable("Generations", new IntData(0)));
+      injector.AddVariable(new HeuristicLab.Core.Variable("MutationRate", new DoubleData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("PopulationSize", new IntData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("Elites", new IntData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("Maximization", new BoolData(false)));
+      injector.AddVariable(new HeuristicLab.Core.Variable("MaxTreeHeight", new IntData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("MaxTreeSize", new IntData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("EvaluatedSolutions", new IntData(0)));
+      injector.AddVariable(new HeuristicLab.Core.Variable("TotalEvaluatedNodes", new DoubleData(0)));
+      injector.AddVariable(new HeuristicLab.Core.Variable("Parents", new IntData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("PunishmentFactor", new DoubleData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData()));
+      injector.AddVariable(new HeuristicLab.Core.Variable("TreeEvaluator", new HL2TreeEvaluator()));
+      return injector;
+    }
+
+    protected internal abstract IOperator CreateManipulator();
+
+    protected internal virtual IOperator CreateInitialization() {
+      CombinedOperator init = new CombinedOperator();
+      init.Name = "Initialization";
+      SequentialProcessor seq = new SequentialProcessor();
+      SubScopesCreater subScopesCreater = new SubScopesCreater();
+      subScopesCreater.GetVariableInfo("SubScopes").ActualName = "PopulationSize";
+      UniformSequentialSubScopesProcessor subScopesProc = new UniformSequentialSubScopesProcessor();
+      SequentialProcessor individualSeq = new SequentialProcessor();
+      OperatorExtractor treeCreater = new OperatorExtractor();
+      treeCreater.Name = "Tree generator (extr.)";
+      treeCreater.GetVariableInfo("Operator").ActualName = "Tree generator";
+      OperatorExtractor evaluator = new OperatorExtractor();
+      evaluator.Name = "Evaluator (extr.)";
+      evaluator.GetVariableInfo("Operator").ActualName = "Evaluator";
+      MeanSquaredErrorEvaluator validationEvaluator = new MeanSquaredErrorEvaluator();
+      validationEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality";
+      validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
+      validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
+      Counter evalCounter = new Counter();
+      evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions";
+      Sorter sorter = new Sorter();
+      sorter.GetVariableInfo("Descending").ActualName = "Maximization";
+      sorter.GetVariableInfo("Value").ActualName = "Quality";
+
+      seq.AddSubOperator(subScopesCreater);
+      seq.AddSubOperator(subScopesProc);
+      seq.AddSubOperator(sorter);
+
+      subScopesProc.AddSubOperator(individualSeq);
+      individualSeq.AddSubOperator(treeCreater);
+      individualSeq.AddSubOperator(evaluator);
+      individualSeq.AddSubOperator(validationEvaluator);
+      individualSeq.AddSubOperator(evalCounter);
+
+      init.OperatorGraph.AddOperator(seq);
+      init.OperatorGraph.InitialOperator = seq;
+      return init;
+    }
+
+    protected internal virtual IOperator CreateMainLoop() {
+      CombinedOperator main = new CombinedOperator();
+      SequentialProcessor seq = new SequentialProcessor();
+      IOperator childCreater = CreateChildCreater();
+      IOperator replacement = CreateReplacement();
+
+      BestSolutionStorer solutionStorer = new BestSolutionStorer();
+      solutionStorer.GetVariableInfo("Quality").ActualName = "ValidationQuality";
+      solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution";
+      solutionStorer.AddSubOperator(CreateBestSolutionProcessor());
+
+      BestAverageWorstQualityCalculator qualityCalculator = new BestAverageWorstQualityCalculator();
+      BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator();
+      validationQualityCalculator.Name = "BestAverageWorstValidationQualityCalculator";
+      validationQualityCalculator.GetVariableInfo("Quality").ActualName = "ValidationQuality";
+      validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality";
+      validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality";
+      validationQualityCalculator.GetVariableInfo("WorstQuality").ActualName = "WorstValidationQuality";
+      IOperator loggingOperator = CreateLoggingOperator();
+      Counter counter = new Counter();
+      counter.GetVariableInfo("Value").ActualName = "Generations";
+      IOperator loopCondition = CreateLoopCondition(seq);
+
+      seq.AddSubOperator(childCreater);
+      seq.AddSubOperator(replacement);
+      seq.AddSubOperator(solutionStorer);
+      seq.AddSubOperator(qualityCalculator);
+      seq.AddSubOperator(validationQualityCalculator);
+      seq.AddSubOperator(loggingOperator);
+      seq.AddSubOperator(counter);
+      seq.AddSubOperator(loopCondition);
+
+      main.OperatorGraph.AddOperator(seq);
+      main.OperatorGraph.InitialOperator = seq;
+      return main;
+    }
+
+    protected internal virtual IOperator CreateLoggingOperator() {
+      return new EmptyOperator();
+    }
+
+    protected internal virtual IOperator CreateLoopCondition(IOperator loop) {
+      SequentialProcessor seq = new SequentialProcessor();
+      seq.Name = "Loop Condition";
+      LessThanComparator comparator = new LessThanComparator();
+      comparator.GetVariableInfo("LeftSide").ActualName = "Generations";
+      comparator.GetVariableInfo("RightSide").ActualName = "MaxGenerations";
+      comparator.GetVariableInfo("Result").ActualName = "GenerationsCondition";
+      ConditionalBranch cond = new ConditionalBranch();
+      cond.GetVariableInfo("Condition").ActualName = "GenerationsCondition";
+
+      seq.AddSubOperator(comparator);
+      seq.AddSubOperator(cond);
+
+      cond.AddSubOperator(loop);
+      return seq;
+    }
+
+    protected internal virtual IOperator CreateBestSolutionProcessor() {
+      return new EmptyOperator();
+    }
+
+    protected internal virtual IOperator CreateReplacement() {
+      CombinedOperator replacement = new CombinedOperator();
+      replacement.Name = "Replacement";
+      SequentialProcessor seq = new SequentialProcessor();
+      SequentialSubScopesProcessor seqScopeProc = new SequentialSubScopesProcessor();
+      SequentialProcessor selectedProc = new SequentialProcessor();
+      LeftSelector leftSelector = new LeftSelector();
+      leftSelector.GetVariableInfo("Selected").ActualName = "Elites";
+      RightReducer rightReducer = new RightReducer();
+
+      SequentialProcessor remainingProc = new SequentialProcessor();
+      RightSelector rightSelector = new RightSelector();
+      rightSelector.GetVariableInfo("Selected").ActualName = "Elites";
+      LeftReducer leftReducer = new LeftReducer();
+      MergingReducer mergingReducer = new MergingReducer();
+      Sorter sorter = new Sorter();
+      sorter.GetVariableInfo("Descending").ActualName = "Maximization";
+      sorter.GetVariableInfo("Value").ActualName = "Quality";
+
+      seq.AddSubOperator(seqScopeProc);
+      seqScopeProc.AddSubOperator(selectedProc);
+      selectedProc.AddSubOperator(leftSelector);
+      selectedProc.AddSubOperator(rightReducer);
+
+      seqScopeProc.AddSubOperator(remainingProc);
+      remainingProc.AddSubOperator(rightSelector);
+      remainingProc.AddSubOperator(leftReducer);
+      seq.AddSubOperator(mergingReducer);
+      seq.AddSubOperator(sorter);
+      replacement.OperatorGraph.AddOperator(seq);
+      replacement.OperatorGraph.InitialOperator = seq;
+      return replacement;
+    }
+
+    protected internal virtual IOperator CreateChildCreater() {
+      CombinedOperator childCreater = new CombinedOperator();
+      childCreater.Name = "Create children";
+      SequentialProcessor seq = new SequentialProcessor();
+      OperatorExtractor selector = new OperatorExtractor();
+      selector.Name = "Selector (extr.)";
+      selector.GetVariableInfo("Operator").ActualName = "Selector";
+
+      SequentialSubScopesProcessor seqScopesProc = new SequentialSubScopesProcessor();
+      EmptyOperator emptyOpt = new EmptyOperator();
+      SequentialProcessor selectedProc = new SequentialProcessor();
+      ChildrenInitializer childInitializer = new ChildrenInitializer();
+      ((IntData)childInitializer.GetVariable("ParentsPerChild").Value).Data = 2;
+
+      OperatorExtractor crossover = new OperatorExtractor();
+      crossover.Name = "Crossover (extr.)";
+      crossover.GetVariableInfo("Operator").ActualName = "Crossover";
+      UniformSequentialSubScopesProcessor individualProc = new UniformSequentialSubScopesProcessor();
+      SequentialProcessor individualSeqProc = new SequentialProcessor();
+      StochasticBranch cond = new StochasticBranch();
+      cond.GetVariableInfo("Probability").ActualName = "MutationRate";
+      OperatorExtractor manipulator = new OperatorExtractor();
+      manipulator.Name = "Manipulator (extr.)";
+      manipulator.GetVariableInfo("Operator").ActualName = "Manipulator";
+      OperatorExtractor evaluator = new OperatorExtractor();
+      evaluator.Name = "Evaluator (extr.)";
+      evaluator.GetVariableInfo("Operator").ActualName = "Evaluator";
+      MeanSquaredErrorEvaluator validationEvaluator = new MeanSquaredErrorEvaluator();
+      validationEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality";
+      validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
+      validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
+      Counter evalCounter = new Counter();
+      evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions";
+      SubScopesRemover parentRefRemover = new SubScopesRemover();
+
+      Sorter sorter = new Sorter();
+      sorter.GetVariableInfo("Descending").ActualName = "Maximization";
+      sorter.GetVariableInfo("Value").ActualName = "Quality";
+
+
+      seq.AddSubOperator(selector);
+      seq.AddSubOperator(seqScopesProc);
+      seqScopesProc.AddSubOperator(emptyOpt);
+      seqScopesProc.AddSubOperator(selectedProc);
+      selectedProc.AddSubOperator(childInitializer);
+      selectedProc.AddSubOperator(individualProc);
+      individualProc.AddSubOperator(individualSeqProc);
+      individualSeqProc.AddSubOperator(crossover);
+      individualSeqProc.AddSubOperator(cond);
+      cond.AddSubOperator(manipulator);
+      individualSeqProc.AddSubOperator(evaluator);
+      individualSeqProc.AddSubOperator(validationEvaluator);
+      individualSeqProc.AddSubOperator(evalCounter);
+      individualSeqProc.AddSubOperator(parentRefRemover);
+      selectedProc.AddSubOperator(sorter);
+
+      childCreater.OperatorGraph.AddOperator(seq);
+      childCreater.OperatorGraph.InitialOperator = seq;
+      return childCreater;
+    }
+
+    protected internal virtual Model CreateGPModel(IScope bestModelScope) {
+      Engine.GlobalScope.AddSubScope(bestModelScope);
+      Model model = new Model();
+      Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true);
+      model.Data = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("FunctionTree", false);
+      model.Dataset = ds;
+      model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
+      model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data;
+      model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data;
+      // calculate and set variable impacts
+      VariableEvaluationImpactCalculator evaluationImpactCalculator = new VariableEvaluationImpactCalculator();
+      VariableQualityImpactCalculator qualityImpactCalculator = new VariableQualityImpactCalculator();
+
+      evaluationImpactCalculator.Apply(bestModelScope);
+      qualityImpactCalculator.Apply(bestModelScope);
+
+      ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false);
+      ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>("VariableQualityImpacts", false);
+      foreach (ItemList row in evaluationImpacts) {
+        string variableName = ((StringData)row[0]).Data;
+        double impact = ((DoubleData)row[1]).Data;
+        model.SetVariableEvaluationImpact(variableName, impact);
+        model.AddInputVariables(variableName);
+      }
+      foreach (ItemList row in qualityImpacts) {
+        string variableName = ((StringData)row[0]).Data;
+        double impact = ((DoubleData)row[1]).Data;
+        model.SetVariableQualityImpact(variableName, impact);
+        model.AddInputVariables(variableName);
+      }
+      Engine.GlobalScope.RemoveSubScope(bestModelScope);
+      return model;
+    }
+
+    public override object Clone(IDictionary<Guid, object> clonedObjects) {
+      AlgorithmBase clone = (AlgorithmBase)base.Clone(clonedObjects);
+      clonedObjects.Add(Guid, clone);
+      clone.engine = (SequentialEngine.SequentialEngine)Auxiliary.Clone(Engine, clonedObjects);
+      return clone;
+    }
+
+    protected VariableInjector GetVariableInjector() {
+      CombinedOperator co1 = (CombinedOperator)Engine.OperatorGraph.InitialOperator;
+      // SequentialProcessor in GP
+      algorithm = (SequentialProcessor)co1.OperatorGraph.InitialOperator;
+      return (VariableInjector)algorithm.SubOperators[2];
+    }
+
+    protected RandomInjector GetRandomInjector() {
+      CombinedOperator co1 = (CombinedOperator)Engine.OperatorGraph.InitialOperator;
+      // SequentialProcessor in GP
+      algorithm = (SequentialProcessor)co1.OperatorGraph.InitialOperator;
+      return (RandomInjector)algorithm.SubOperators[0];
+    }
+
+    #region Persistence Methods
+    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
+      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
+      node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
+      return node;
+    }
+    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(node, restoredObjects);
+      engine = (SequentialEngine.SequentialEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
+    }
+    #endregion
+
+
+  }
+}
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/FunctionTreeBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/FunctionTreeBase.cs	(revision 2235)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/FunctionTreeBase.cs	(revision 2235)
@@ -0,0 +1,41 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.GP.Interfaces;
+using System.Xml;
+
+namespace HeuristicLab.GP.StructureIdentification {
+  public class FunctionTreeBase : HeuristicLab.GP.FunctionTreeBase {
+    public FunctionTreeBase(IFunction function) : base(function) { }
+    public FunctionTreeBase(FunctionTreeBase original) : base(original) { }
+
+    public override object Clone() {
+      return new FunctionTreeBase(this);
+    }
+
+    public override string ToString() {
+      return SymbolicExpressionExporter.GetName(this);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/TreeEvaluatorBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/TreeEvaluatorBase.cs	(revision 2235)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/TreeEvaluatorBase.cs	(revision 2235)
@@ -0,0 +1,121 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.DataAnalysis;
+using HeuristicLab.GP.Interfaces;
+
+namespace HeuristicLab.GP.StructureIdentification {
+  /// <summary>
+  /// Base class for tree evaluators
+  /// </summary>
+  public abstract class TreeEvaluatorBase : ItemBase, ITreeEvaluator {
+    protected const double EPSILON = 1.0e-7;
+    protected double maxValue;
+    protected double minValue;
+
+    protected class Instr {
+      public double d_arg0;
+      public short i_arg0;
+      public short i_arg1;
+      public byte arity;
+      public byte symbol;
+    }
+
+    protected Instr[] codeArr;
+    protected int PC;
+    protected Dataset dataset;
+    protected int sampleIndex;
+
+    public void PrepareForEvaluation(Dataset dataset, int targetVariable, int start, int end, double punishmentFactor, IFunctionTree functionTree) {
+      this.dataset = dataset;
+      // calculate upper and lower bounds for the estimated value (mean +/- punishmentFactor * range)
+      double mean = dataset.GetMean(targetVariable, start, end);
+      double range = dataset.GetRange(targetVariable, start, end);
+      maxValue = mean + punishmentFactor * range;
+      minValue = mean - punishmentFactor * range;
+
+      codeArr = new Instr[functionTree.GetSize()];
+      int i = 0;
+      foreach (IFunctionTree tree in IteratePrefix(functionTree)) {
+        codeArr[i++] = TranslateToInstr(tree);
+      }
+    }
+
+    private IEnumerable<IFunctionTree> IteratePrefix(IFunctionTree functionTree) {
+      List<IFunctionTree> prefixForm = new List<IFunctionTree>();
+      prefixForm.Add(functionTree);
+      foreach (IFunctionTree subTree in functionTree.SubTrees) {
+        prefixForm.AddRange(IteratePrefix(subTree));
+      }
+      return prefixForm;
+    }
+
+    private Instr TranslateToInstr(IFunctionTree tree) {
+      Instr instr = new Instr();
+      instr.arity = (byte)tree.SubTrees.Count;
+      instr.symbol = EvaluatorSymbolTable.MapFunction(tree.Function);
+      switch (instr.symbol) {
+        case EvaluatorSymbolTable.DIFFERENTIAL:
+        case EvaluatorSymbolTable.VARIABLE: {
+            VariableFunctionTree varTree = (VariableFunctionTree)tree;
+            instr.i_arg0 = (short)dataset.GetVariableIndex(varTree.VariableName);
+            instr.d_arg0 = varTree.Weight;
+            instr.i_arg1 = (short)varTree.SampleOffset;
+            break;
+          }
+        case EvaluatorSymbolTable.CONSTANT: {
+            ConstantFunctionTree constTree = (ConstantFunctionTree)tree;
+            instr.d_arg0 = constTree.Value;
+            break;
+          }
+        case EvaluatorSymbolTable.UNKNOWN: {
+            throw new NotSupportedException("Unknown function symbol: " + instr.symbol);
+          }
+      }
+      return instr;
+    }
+
+    public double Evaluate(int sampleIndex) {
+      PC = 0;
+      this.sampleIndex = sampleIndex;
+
+      double estimated = EvaluateBakedCode();
+      if (double.IsNaN(estimated) || double.IsInfinity(estimated)) estimated = maxValue;
+      else if (estimated < minValue) estimated = minValue;
+      else if (estimated > maxValue) estimated = maxValue;
+      return estimated;
+    }
+
+    // skips a whole branch
+    protected void SkipBakedCode() {
+      int i = 1;
+      while (i > 0) {
+        i += codeArr[PC++].arity;
+        i--;
+      }
+    }
+
+    protected abstract double EvaluateBakedCode();
+  }
+}
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj	(revision 2235)
@@ -83,4 +83,5 @@
   <ItemGroup>
     <Compile Include="AlgorithmBase.cs" />
+    <Compile Include="BaseClasses\FunctionTreeBase.cs" />
     <Compile Include="Evaluators\SimpleGPEvaluatorBase.cs" />
     <Compile Include="HL3TreeEvaluator.cs" />
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/ModelAnalyzerExporter.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/ModelAnalyzerExporter.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/ModelAnalyzerExporter.cs	(revision 2235)
@@ -24,5 +24,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public class ModelAnalyzerExporter : IFunctionTreeSerializer, IFunctionTreeNameGenerator {
+  public class ModelAnalyzerExporter : IFunctionTreeSerializer {
     #region IFunctionTreeExporter Members
 
@@ -73,5 +73,5 @@
     #endregion
 
-    private string ExportFunction(IFunction function, IFunctionTree tree) {
+    private static string ExportFunction(IFunction function, IFunctionTree tree) {
       // this is smelly, if there is a cleaner way to have a 'dynamic' visitor 
       // please let me know! (gkronber 14.10.2008)
@@ -103,11 +103,5 @@
     }
 
-    #region IFunctionTreeNameGenerator Members
-
-    string IFunctionTreeNameGenerator.Name {
-      get { return "HL2 Representation"; }
-    }
-
-    public string GetName(IFunctionTree tree) {
+    public static string GetName(IFunctionTree tree) {
       string name = "";
       try {
@@ -118,8 +112,4 @@
       return name;
     }
-
-    #endregion
-
-
   }
 
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs	(revision 2235)
@@ -26,5 +26,5 @@
 
 namespace HeuristicLab.GP.StructureIdentification {
-  public class SymbolicExpressionExporter : IFunctionTreeSerializer, IFunctionTreeNameGenerator {
+  public class SymbolicExpressionExporter : IFunctionTreeSerializer {
     private StringBuilder builder;
     private string currentIndent;
@@ -66,5 +66,5 @@
     }
 
-    private string ExportFunction(IFunction function, IFunctionTree tree) {
+    private static string ExportFunction(IFunction function, IFunctionTree tree) {
       // this is smelly, if there is a cleaner way to have a 'dynamic' visitor 
       // please let me know! (gkronber 14.10.2008)
@@ -99,15 +99,10 @@
     #endregion
 
-    #region IFunctionTreeNameGenerator Members
-
-    string IFunctionTreeNameGenerator.Name {
-      get { return "Symbolic Expression"; }
-    }
-
-    public string GetName(IFunctionTree tree) {
+    public static string GetName(IFunctionTree tree) {
       string name = "";
       try {
         name = ExportFunction(tree.Function, tree);
-      } catch(UnknownFunctionException) {
+      }
+      catch (UnknownFunctionException) {
         name = "N/A";
       }
@@ -115,5 +110,7 @@
     }
 
-    #endregion
+    //public string GetName(IFunctionTree tree) {
+    //  return SymbolicExpressionExporter.GetName(tree);
+    //}
   }
 
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Addition.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Addition.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Addition.cs	(revision 2235)
@@ -38,4 +38,8 @@
       MaxSubTrees = 3;
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/And.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/And.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/And.cs	(revision 2235)
@@ -35,4 +35,8 @@
       MinSubTrees = 2; MaxSubTrees = 3;
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Average.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Average.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Average.cs	(revision 2235)
@@ -33,4 +33,8 @@
       MinSubTrees = 2; MaxSubTrees = 3;
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/ConstantFunctionTree.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/ConstantFunctionTree.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/ConstantFunctionTree.cs	(revision 2235)
@@ -30,8 +30,10 @@
     public double Value { get; set; }
 
-    public ConstantFunctionTree(Constant constant) : base(constant){
+    public ConstantFunctionTree(Constant constant)
+      : base(constant) {
     }
 
-    protected ConstantFunctionTree(ConstantFunctionTree original) : base(original){
+    protected ConstantFunctionTree(ConstantFunctionTree original)
+      : base(original) {
       Value = original.Value;
     }
@@ -57,4 +59,9 @@
     }
 
+    public override string ToString() {
+      return SymbolicExpressionExporter.GetName(this);
+    }
+
+    #region serialization
     public override object Clone() {
       return new ConstantFunctionTree(this);
@@ -73,4 +80,5 @@
       Value = XmlConvert.ToDouble(node.Attributes["Value"].Value);
     }
+    #endregion
 
     private IVariable CreateValueVariable() {
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Cosinus.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Cosinus.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Cosinus.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Division.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Division.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Division.cs	(revision 2235)
@@ -37,4 +37,8 @@
 
     public Division() : base() { }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Equal.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Equal.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Equal.cs	(revision 2235)
@@ -30,4 +30,8 @@
 
     public Equal() : base() { }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Exponential.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Exponential.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Exponential.cs	(revision 2235)
@@ -28,4 +28,8 @@
 
     public Exponential() : base() { }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/GreaterThan.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/GreaterThan.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/GreaterThan.cs	(revision 2235)
@@ -31,4 +31,7 @@
     public GreaterThan() : base() { }
 
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/IfThenElse.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/IfThenElse.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/IfThenElse.cs	(revision 2235)
@@ -34,4 +34,8 @@
       MinSubTrees = 3; MaxSubTrees = 3;
     }
+    
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/LessThan.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/LessThan.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/LessThan.cs	(revision 2235)
@@ -32,4 +32,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Logarithm.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Logarithm.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Logarithm.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Multiplication.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Multiplication.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Multiplication.cs	(revision 2235)
@@ -37,4 +37,8 @@
       MinSubTrees = 2; MaxSubTrees = 3;
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Not.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Not.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Not.cs	(revision 2235)
@@ -31,4 +31,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Or.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Or.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Or.cs	(revision 2235)
@@ -33,4 +33,7 @@
       MinSubTrees = 2; MaxSubTrees = 3;
     }
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Power.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Power.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Power.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Signum.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Signum.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Signum.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Sinus.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Sinus.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Sinus.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Sqrt.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Sqrt.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Sqrt.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Subtraction.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Subtraction.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Subtraction.cs	(revision 2235)
@@ -35,4 +35,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Tangens.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Tangens.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Tangens.cs	(revision 2235)
@@ -30,4 +30,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/VariableFunctionTree.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/VariableFunctionTree.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/VariableFunctionTree.cs	(revision 2235)
@@ -67,4 +67,9 @@
     }
 
+    public override string ToString() {
+      return SymbolicExpressionExporter.GetName(this);
+    }
+
+    #region serialization
     public override object Clone() {
       return new VariableFunctionTree(this);
@@ -91,4 +96,5 @@
       VariableName = node.Attributes["Variable"].Value;
     }
+    #endregion
 
     private IVariable CreateSampleOffsetVariable() {
Index: /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Xor.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Xor.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/Xor.cs	(revision 2235)
@@ -32,4 +32,8 @@
       : base() {
     }
+
+    public override HeuristicLab.GP.Interfaces.IFunctionTree GetTreeNode() {
+      return new FunctionTreeBase(this);
+    }
   }
 }
Index: unk/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs	(revision 2234)
+++ 	(revision )
@@ -1,121 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using HeuristicLab.Core;
-using HeuristicLab.DataAnalysis;
-using HeuristicLab.GP.Interfaces;
-
-namespace HeuristicLab.GP.StructureIdentification {
-  /// <summary>
-  /// Base class for tree evaluators
-  /// </summary>
-  public abstract class TreeEvaluatorBase : ItemBase, ITreeEvaluator {
-    protected const double EPSILON = 1.0e-7;
-    protected double maxValue;
-    protected double minValue;
-
-    protected class Instr {
-      public double d_arg0;
-      public short i_arg0;
-      public short i_arg1;
-      public byte arity;
-      public byte symbol;
-    }
-
-    protected Instr[] codeArr;
-    protected int PC;
-    protected Dataset dataset;
-    protected int sampleIndex;
-
-    public void PrepareForEvaluation(Dataset dataset, int targetVariable, int start, int end, double punishmentFactor, IFunctionTree functionTree) {
-      this.dataset = dataset;
-      // calculate upper and lower bounds for the estimated value (mean +/- punishmentFactor * range)
-      double mean = dataset.GetMean(targetVariable, start, end);
-      double range = dataset.GetRange(targetVariable, start, end);
-      maxValue = mean + punishmentFactor * range;
-      minValue = mean - punishmentFactor * range;
-
-      codeArr = new Instr[functionTree.GetSize()];
-      int i = 0;
-      foreach (IFunctionTree tree in IteratePrefix(functionTree)) {
-        codeArr[i++] = TranslateToInstr(tree);
-      }
-    }
-
-    private IEnumerable<IFunctionTree> IteratePrefix(IFunctionTree functionTree) {
-      List<IFunctionTree> prefixForm = new List<IFunctionTree>();
-      prefixForm.Add(functionTree);
-      foreach (IFunctionTree subTree in functionTree.SubTrees) {
-        prefixForm.AddRange(IteratePrefix(subTree));
-      }
-      return prefixForm;
-    }
-
-    private Instr TranslateToInstr(IFunctionTree tree) {
-      Instr instr = new Instr();
-      instr.arity = (byte)tree.SubTrees.Count;
-      instr.symbol = EvaluatorSymbolTable.MapFunction(tree.Function);
-      switch (instr.symbol) {
-        case EvaluatorSymbolTable.DIFFERENTIAL:
-        case EvaluatorSymbolTable.VARIABLE: {
-            VariableFunctionTree varTree = (VariableFunctionTree)tree;
-            instr.i_arg0 = (short)dataset.GetVariableIndex(varTree.VariableName);
-            instr.d_arg0 = varTree.Weight;
-            instr.i_arg1 = (short)varTree.SampleOffset;
-            break;
-          }
-        case EvaluatorSymbolTable.CONSTANT: {
-            ConstantFunctionTree constTree = (ConstantFunctionTree)tree;
-            instr.d_arg0 = constTree.Value;
-            break;
-          }
-        case EvaluatorSymbolTable.UNKNOWN: {
-            throw new NotSupportedException("Unknown function symbol: " + instr.symbol);
-          }
-      }
-      return instr;
-    }
-
-    public double Evaluate(int sampleIndex) {
-      PC = 0;
-      this.sampleIndex = sampleIndex;
-
-      double estimated = EvaluateBakedCode();
-      if (double.IsNaN(estimated) || double.IsInfinity(estimated)) estimated = maxValue;
-      else if (estimated < minValue) estimated = minValue;
-      else if (estimated > maxValue) estimated = maxValue;
-      return estimated;
-    }
-
-    // skips a whole branch
-    protected void SkipBakedCode() {
-      int i = 1;
-      while (i > 0) {
-        i += codeArr[PC++].arity;
-        i--;
-      }
-    }
-
-    protected abstract double EvaluateBakedCode();
-  }
-}
Index: /trunk/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionTreeBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionTreeBase.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionTreeBase.cs	(revision 2235)
@@ -94,4 +94,8 @@
     }
 
+    public virtual string ToString() {
+      return Function.Name;
+    }
+
     #endregion
 
Index: unk/sources/HeuristicLab.GP/3.3/DefaultFunctionTreeNameGenerator.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP/3.3/DefaultFunctionTreeNameGenerator.cs	(revision 2234)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#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.GP.Interfaces;
-
-namespace HeuristicLab.GP {
-  public class DefaultFunctionTreeNameGenerator : IFunctionTreeNameGenerator {
-    #region IFunctionTreeNameGenerator Members
-    string IFunctionTreeNameGenerator.Name {
-      get { return "Default Representation"; }
-    }
-
-    string IFunctionTreeNameGenerator.GetName(IFunctionTree tree) {
-      return tree.Function.Name;
-    }
-    #endregion
-  }
-}
Index: /trunk/sources/HeuristicLab.GP/3.3/FunctionTreeView.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP/3.3/FunctionTreeView.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP/3.3/FunctionTreeView.cs	(revision 2235)
@@ -30,24 +30,24 @@
     private IFunctionTree functionTree;
     private IFunctionTree selectedBranch;
-    private IFunctionTreeNameGenerator nameGenerator;
-    private IFunctionTreeNameGenerator[] allNameGenerators;
-    private MenuItem representationsMenu;
+    //private IFunctionTreeNameGenerator nameGenerator;
+    //private IFunctionTreeNameGenerator[] allNameGenerators;
+    //private MenuItem representationsMenu;
 
     public FunctionTreeView() {
-      nameGenerator = new DefaultFunctionTreeNameGenerator();
+      //nameGenerator = new DefaultFunctionTreeNameGenerator();
       InitializeComponent();
 
       DiscoveryService discoveryService = new DiscoveryService();
-      allNameGenerators = discoveryService.GetInstances<IFunctionTreeNameGenerator>();
-      representationsMenu = new MenuItem();
-      representationsMenu.Text = "Tree representation";
-      representationsMenu.Name = "Tree representation";
-      foreach (IFunctionTreeNameGenerator generator in allNameGenerators) {
-        MenuItem mi = new MenuItem(generator.Name, MakeNameGeneratorDelegate(generator), Shortcut.None);
-        if (generator is DefaultFunctionTreeNameGenerator) mi.Checked = true;
-        else mi.Checked = false;
-        mi.Tag = generator;
-        representationsMenu.MenuItems.Add(mi);
-      }
+      //allNameGenerators = discoveryService.GetInstances<IFunctionTreeNameGenerator>();
+      //representationsMenu = new MenuItem();
+      //representationsMenu.Text = "Tree representation";
+      //representationsMenu.Name = "Tree representation";
+      //foreach (IFunctionTreeNameGenerator generator in allNameGenerators) {
+      //  MenuItem mi = new MenuItem(generator.Name, MakeNameGeneratorDelegate(generator), Shortcut.None);
+      //  if (generator is DefaultFunctionTreeNameGenerator) mi.Checked = true;
+      //  else mi.Checked = false;
+      //  mi.Tag = generator;
+      //  representationsMenu.MenuItems.Add(mi);
+      //}
     }
 
@@ -61,9 +61,9 @@
       funTreeView.Nodes.Clear();
       TreeNode rootNode = new TreeNode();
-      rootNode.Name = functionTree.Function.Name;
-      rootNode.Text = nameGenerator.GetName(functionTree);
+      rootNode.Name = functionTree.ToString(); // functionTree.Function.Name;
+      rootNode.Text = functionTree.ToString(); // nameGenerator.GetName(functionTree);
       rootNode.Tag = functionTree;
       treeNodeContextMenu.MenuItems.Clear();
-      treeNodeContextMenu.MenuItems.Add(representationsMenu);
+      //treeNodeContextMenu.MenuItems.Add(representationsMenu);
       DiscoveryService discoveryService = new DiscoveryService();
       IFunctionTreeSerializer[] exporters = discoveryService.GetInstances<IFunctionTreeSerializer>();
@@ -91,13 +91,13 @@
     }
 
-    private EventHandler MakeNameGeneratorDelegate(IFunctionTreeNameGenerator generator) {
-      return delegate(object source, EventArgs args) {
-        IFunctionTreeNameGenerator g = (IFunctionTreeNameGenerator)((MenuItem)source).Tag;
-        this.nameGenerator = g;
-        foreach (MenuItem otherMenuItem in representationsMenu.MenuItems) otherMenuItem.Checked = false;
-        ((MenuItem)source).Checked = true;
-        UpdateControls();
-      };
-    }
+    //private EventHandler MakeNameGeneratorDelegate(IFunctionTreeNameGenerator generator) {
+    //  return delegate(object source, EventArgs args) {
+    //    IFunctionTreeNameGenerator g = (IFunctionTreeNameGenerator)((MenuItem)source).Tag;
+    //    this.nameGenerator = g;
+    //    foreach (MenuItem otherMenuItem in representationsMenu.MenuItems) otherMenuItem.Checked = false;
+    //    ((MenuItem)source).Checked = true;
+    //    UpdateControls();
+    //  };
+    //}
 
     private EventHandler MakeExporterDelegate(IFunctionTreeSerializer exporter) {
@@ -111,6 +111,6 @@
     private void CreateTree(TreeNode rootNode, IFunctionTree functionTree) {
       TreeNode node = new TreeNode();
-      node.Name = functionTree.Function.Name;
-      node.Text = nameGenerator.GetName(functionTree);
+      node.Name = functionTree.ToString();
+      node.Text = functionTree.ToString();
       node.Tag = functionTree;
       node.ContextMenu = treeNodeContextMenu;
Index: /trunk/sources/HeuristicLab.GP/3.3/GeneticProgrammingModel.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP/3.3/GeneticProgrammingModel.cs	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP/3.3/GeneticProgrammingModel.cs	(revision 2235)
@@ -47,5 +47,6 @@
     }
 
-    public GeneticProgrammingModel(IFunctionTree tree) : base() {
+    public GeneticProgrammingModel(IFunctionTree tree)
+      : base() {
       FunctionTree = tree;
     }
@@ -87,5 +88,5 @@
       IFunction f = (IFunction)PersistenceManager.Restore(fNode, restoredObjects);
       IFunctionTree tree = f.GetTreeNode();
-      if(fNode.ChildNodes.Count>0) tree.Populate(fNode.ChildNodes[0], restoredObjects);
+      if (fNode.ChildNodes.Count > 0) tree.Populate(fNode.ChildNodes[0], restoredObjects);
       nodeIndex++;
       for (int i = 0; i < subTrees; i++) {
Index: /trunk/sources/HeuristicLab.GP/3.3/HeuristicLab.GP-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.GP/3.3/HeuristicLab.GP-3.3.csproj	(revision 2234)
+++ /trunk/sources/HeuristicLab.GP/3.3/HeuristicLab.GP-3.3.csproj	(revision 2235)
@@ -103,5 +103,4 @@
     </Compile>
     <Compile Include="GeneticProgrammingModel.cs" />
-    <Compile Include="DefaultFunctionTreeNameGenerator.cs" />
     <Compile Include="UnknownFunctionException.cs" />
     <Compile Include="HeuristicLabGPPlugin.cs" />
