Index: branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 9152)
+++ branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 9271)
@@ -41,5 +41,5 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
@@ -50,5 +50,5 @@
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
@@ -58,5 +58,5 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -66,5 +66,5 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -76,5 +76,5 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -84,5 +84,5 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -96,4 +96,64 @@
       <HintPath>..\..\bin\ALGLIB-3.6.0.dll</HintPath>
       <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     </Reference>
     <Reference Include="System" />
@@ -141,4 +201,5 @@
     <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionCrossover.cs" />
     <Compile Include="Interfaces\ISymbolicDataAnalysisImpactValuesCalculator.cs" />
+    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs" />
     <Compile Include="Interpreter\InterpreterState.cs" />
     <Compile Include="Interpreter\OpCodes.cs" />
@@ -250,81 +311,7 @@
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
-      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
-      <Name>HeuristicLab.Analysis-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
-      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
-      <Name>HeuristicLab.Collections-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
-      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
-      <Name>HeuristicLab.Common.Resources-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
-      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
-      <Name>HeuristicLab.Common-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
-      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
-      <Name>HeuristicLab.Core-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
-      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
-      <Name>HeuristicLab.Data-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
       <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
       <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
-      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
-      <Name>HeuristicLab.Operators-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
-      <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>
-      <Name>HeuristicLab.Optimization.Operators-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
-      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
-      <Name>HeuristicLab.Optimization-3.3</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
-      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
-      <Name>HeuristicLab.Parameters-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
-      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
-      <Name>HeuristicLab.Persistence-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
-      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
-      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
-      <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project>
-      <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
-      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
-      <Name>HeuristicLab.Problems.Instances-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
-      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
-      <Name>HeuristicLab.Random-3.3</Name>
       <Private>False</Private>
     </ProjectReference>
Index: branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 9152)
+++ branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 9271)
@@ -162,5 +162,5 @@
 
     private InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset) {
-      Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
+      Instruction[] code = SymbolicExpressionTreeCompiler.CompilePrefix(tree, OpCodes.MapSymbolToOpCode);
       Dictionary<string, int> doubleVariableNames = dataset.DoubleVariables.Select((x, i) => new { x, i }).ToDictionary(e => e.x, e => e.i);
       int necessaryArgStackSize = 0;
Index: branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 9152)
+++ branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 9271)
@@ -112,5 +112,5 @@
 
     private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset) {
-      Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
+      Instruction[] code = SymbolicExpressionTreeCompiler.CompilePrefix(tree, OpCodes.MapSymbolToOpCode);
       int necessaryArgStackSize = 0;
       foreach (Instruction instr in code) {
Index: branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
===================================================================
--- branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs	(revision 9271)
+++ branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs	(revision 9271)
@@ -0,0 +1,455 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableClass]
+  [Item("SymbolicDataAnalysisExpressionTreeLinearInterpreter", "Interpreter for symbolic expression trees including automatically defined functions.")]
+  public class SymbolicDataAnalysisExpressionTreeLinearInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
+    private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
+    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
+
+    public override bool CanChangeName { get { return false; } }
+    public override bool CanChangeDescription { get { return false; } }
+
+    #region parameter properties
+    public IValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
+      get { return (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
+    }
+
+    public IValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public BoolValue CheckExpressionsWithIntervalArithmetic {
+      get { return CheckExpressionsWithIntervalArithmeticParameter.Value; }
+      set { CheckExpressionsWithIntervalArithmeticParameter.Value = value; }
+    }
+
+    public IntValue EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value; }
+      set { EvaluatedSolutionsParameter.Value = value; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionTreeLinearInterpreter(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionTreeLinearInterpreter(SymbolicDataAnalysisExpressionTreeLinearInterpreter original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionTreeLinearInterpreter(this, cloner);
+    }
+
+    public SymbolicDataAnalysisExpressionTreeLinearInterpreter()
+      : base("SymbolicDataAnalysisExpressionTreeLinearInterpreter", "Interpreter for symbolic expression trees including automatically defined functions.") {
+      Parameters.Add(new ValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.", new BoolValue(false)));
+      Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    protected SymbolicDataAnalysisExpressionTreeLinearInterpreter(string name, string description)
+      : base(name, description) {
+      Parameters.Add(new ValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.", new BoolValue(false)));
+      Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(EvaluatedSolutionsParameterName))
+        Parameters.Add(new ValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    #region IStatefulItem
+    public void InitializeState() {
+      EvaluatedSolutions.Value = 0;
+    }
+
+    public void ClearState() {
+    }
+    #endregion
+
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {
+      if (CheckExpressionsWithIntervalArithmetic.Value)
+        throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
+
+      lock (EvaluatedSolutions) {
+        EvaluatedSolutions.Value++; // increment the evaluated solutions counter
+      }
+
+      Instruction[] code = SymbolicExpressionTreeCompiler.CompilePostfix(tree, OpCodes.MapSymbolToOpCode);
+      foreach (Instruction instr in code) {
+        switch (instr.opCode) {
+          case OpCodes.Variable: {
+              var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
+              instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
+            }
+            break;
+          case OpCodes.LagVariable: {
+              var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
+              instr.iArg0 = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName);
+            }
+            break;
+          case OpCodes.VariableCondition: {
+              var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
+              instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName);
+            }
+            break;
+        }
+      }
+
+      foreach (var rowEnum in rows) {
+        int row = rowEnum;
+        yield return Evaluate(dataset, ref row, code);
+      }
+    }
+
+    protected virtual double Evaluate(Dataset dataset, ref int row, Instruction[] code) {
+      int count = 0;
+      for (int j = 0; j != code.Length; ++j) {
+        Instruction currentInstr = code[j];
+
+        switch (currentInstr.opCode) {
+          case OpCodes.Add: {
+              double s = code[j - currentInstr.nArguments].value;
+              for (int i = j - currentInstr.nArguments + 1; i < j; i++) {
+                s += code[i].value;
+              }
+              currentInstr.value = s;
+            }
+            break;
+          case OpCodes.Sub: {
+              double s = code[j - currentInstr.nArguments].value;
+              for (int i = j - currentInstr.nArguments + 1; i < j; i++) {
+                s -= code[i].value;
+              }
+              if (currentInstr.nArguments == 1) s = -s;
+              currentInstr.value = s;
+            }
+            break;
+          case OpCodes.Mul: {
+              double p = code[j - currentInstr.nArguments].value;
+              for (int i = j - currentInstr.nArguments + 1; i < j; i++) {
+                p *= code[i].value;
+              }
+              currentInstr.value = p;
+            }
+            break;
+          case OpCodes.Div: {
+              double p = code[j - currentInstr.nArguments].value;
+              for (int i = j - currentInstr.nArguments + 1; i < j; i++) {
+                p /= code[i].value;
+              }
+              if (currentInstr.nArguments == 1) p = 1.0 / p;
+              currentInstr.value = p;
+            }
+            break;
+          case OpCodes.Average: {
+              double sum = code[j - currentInstr.nArguments].value;
+              for (int i = j - currentInstr.nArguments + 1; i < j; i++) {
+                sum += code[i].value;
+              }
+              currentInstr.value = sum / currentInstr.nArguments;
+            }
+            break;
+          case OpCodes.Cos: {
+              currentInstr.value = Math.Cos(code[j - 1].value);
+            }
+            break;
+          case OpCodes.Sin: {
+              currentInstr.value = Math.Sin(code[j - 1].value);
+              break;
+            }
+          case OpCodes.Tan: {
+              currentInstr.value = Math.Tan(code[j - 1].value);
+            }
+            break;
+          case OpCodes.Square: {
+              currentInstr.value = Math.Pow(code[j - 1].value, 2);
+            }
+            break;
+          case OpCodes.Power: {
+              double x = code[j - 2].value;
+              double y = Math.Round(code[j - 1].value);
+              currentInstr.value = Math.Pow(x, y);
+            }
+            break;
+          case OpCodes.SquareRoot: {
+              currentInstr.value = Math.Sqrt(code[j - 1].value);
+            }
+            break;
+          case OpCodes.Root: {
+              double x = code[j - 2].value;
+              double y = Math.Round(code[j - 1].value);
+              currentInstr.value = Math.Pow(x, 1 / y);
+            }
+            break;
+          case OpCodes.Exp: {
+              currentInstr.value = Math.Exp(code[j - 1].value);
+            }
+            break;
+          case OpCodes.Log: {
+              currentInstr.value = Math.Log(code[j - 1].value);
+            }
+            break;
+          case OpCodes.Gamma: {
+              currentInstr.value = double.IsNaN(code[j - 1].value) ? double.NaN : alglib.gammafunction(code[j - 1].value);
+            }
+            break;
+          case OpCodes.Psi: {
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else if (x <= 0 && (Math.Floor(x) - x).IsAlmost(0)) currentInstr.value = double.NaN;
+              else currentInstr.value = alglib.psi(x);
+            }
+            break;
+          case OpCodes.Dawson: {
+              var x = code[j - 1].value;
+              currentInstr.value = double.IsNaN(x) ? double.NaN : alglib.dawsonintegral(x);
+            }
+            break;
+          case OpCodes.ExponentialIntegralEi: {
+              var x = code[j - 1].value;
+              currentInstr.value = double.IsNaN(x) ? double.NaN : alglib.exponentialintegralei(x);
+            }
+            break;
+          case OpCodes.SineIntegral: {
+              double si, ci;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.sinecosineintegrals(x, out si, out ci);
+                currentInstr.value = si;
+              }
+            }
+            break;
+          case OpCodes.CosineIntegral: {
+              double si, ci;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.sinecosineintegrals(x, out si, out ci);
+                currentInstr.value = ci;
+              }
+            }
+            break;
+          case OpCodes.HyperbolicSineIntegral: {
+              double shi, chi;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.hyperbolicsinecosineintegrals(x, out shi, out chi);
+                currentInstr.value = shi;
+              }
+            }
+            break;
+          case OpCodes.HyperbolicCosineIntegral: {
+              double shi, chi;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.hyperbolicsinecosineintegrals(x, out shi, out chi);
+                currentInstr.value = chi;
+              }
+            }
+            break;
+          case OpCodes.FresnelCosineIntegral: {
+              double c = 0, s = 0;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.fresnelintegral(x, ref c, ref s);
+                currentInstr.value = c;
+              }
+            }
+            break;
+          case OpCodes.FresnelSineIntegral: {
+              double c = 0, s = 0;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.fresnelintegral(x, ref c, ref s);
+                currentInstr.value = s;
+              }
+            }
+            break;
+          case OpCodes.AiryA: {
+              double ai, aip, bi, bip;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.airy(x, out ai, out aip, out bi, out bip);
+                currentInstr.value = ai;
+              }
+            }
+            break;
+          case OpCodes.AiryB: {
+              double ai, aip, bi, bip;
+              var x = code[j - 1].value;
+              if (double.IsNaN(x)) currentInstr.value = double.NaN;
+              else {
+                alglib.airy(x, out ai, out aip, out bi, out bip);
+                currentInstr.value = bi;
+              }
+            }
+            break;
+          case OpCodes.Norm: {
+              var x = code[j - 1].value;
+              currentInstr.value = double.IsNaN(x) ? double.NaN : alglib.normaldistribution(x);
+            }
+            break;
+          case OpCodes.Erf: {
+              var x = code[j - 1].value;
+              currentInstr.value = double.IsNaN(x) ? double.NaN : alglib.errorfunction(x);
+            }
+            break;
+          case OpCodes.Bessel: {
+              var x = code[j - 1].value;
+              currentInstr.value = double.IsNaN(x) ? double.NaN : alglib.besseli0(x);
+            }
+            break;
+          case OpCodes.IfThenElse: {
+              double condition = code[j - currentInstr.nArguments].value;
+              double result = condition > 0.0 ? code[j - 2].value : code[j - 1].value;
+              currentInstr.value = result;
+            }
+            break;
+          case OpCodes.AND: {
+              double result = code[j - currentInstr.nArguments].value;
+              for (int i = j - currentInstr.nArguments + 1; i < j; i++) {
+                if (result > 0.0) result = code[i].value;
+              }
+              currentInstr.value = result > 0.0 ? 1.0 : -1.0;
+            }
+            break;
+          case OpCodes.OR: {
+              double result = code[j - currentInstr.nArguments].value;
+              for (int i = 1; i < currentInstr.nArguments; i++) {
+                if (result <= 0.0) result = code[i].value; ;
+              }
+              currentInstr.value = result > 0.0 ? 1.0 : -1.0;
+            }
+            break;
+          case OpCodes.NOT: {
+              currentInstr.value = code[j - 1].value > 0.0 ? -1.0 : 1.0;
+            }
+            break;
+          case OpCodes.GT: {
+              double x = code[j - 2].value;
+              double y = code[j - 1].value;
+              currentInstr.value = x > y ? 1.0 : -1.0;
+            }
+            break;
+          case OpCodes.LT: {
+              double x = code[j - 2].value;
+              double y = code[j - 1].value;
+              currentInstr.value = x < y ? 1.0 : -1.0;
+            }
+            break;
+          case OpCodes.TimeLag: {
+              throw new NotSupportedException();
+            }
+          case OpCodes.Integral: {
+              throw new NotSupportedException();
+            }
+
+          //mkommend: derivate calculation taken from: 
+          //http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/
+          //one sided smooth differentiatior, N = 4
+          // y' = 1/8h (f_i + 2f_i-1, -2 f_i-3 - f_i-4)
+          case OpCodes.Derivative: {
+              throw new NotSupportedException();
+            }
+          case OpCodes.Call: {
+              throw new NotSupportedException();
+            }
+          case OpCodes.Arg: {
+              throw new NotSupportedException();
+            }
+          case OpCodes.Variable: {
+              if (row < 0 || row >= dataset.Rows) currentInstr.value = double.NaN;
+              else {
+                var variableTreeNode = (VariableTreeNode)currentInstr.dynamicNode;
+                currentInstr.value = ((IList<double>)currentInstr.iArg0)[row] * variableTreeNode.Weight;
+              }
+            }
+            break;
+          case OpCodes.LagVariable: {
+              var laggedVariableTreeNode = (LaggedVariableTreeNode)currentInstr.dynamicNode;
+              int actualRow = row + laggedVariableTreeNode.Lag;
+              if (actualRow < 0 || actualRow >= dataset.Rows) currentInstr.value = double.NaN;
+              else {
+                currentInstr.value = ((IList<double>)currentInstr.iArg0)[actualRow] * laggedVariableTreeNode.Weight;
+              }
+            }
+            break;
+          case OpCodes.Constant: {
+              var constTreeNode = (ConstantTreeNode)currentInstr.dynamicNode;
+              currentInstr.value = constTreeNode.Value;
+            }
+            break;
+
+          //mkommend: this symbol uses the logistic function f(x) = 1 / (1 + e^(-alpha * x) ) 
+          //to determine the relative amounts of the true and false branch see http://en.wikipedia.org/wiki/Logistic_function
+          case OpCodes.VariableCondition: {
+              if (row < 0 || row >= dataset.Rows) currentInstr.value = double.NaN;
+              else {
+                var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode;
+                double variableValue = ((IList<double>)currentInstr.iArg0)[row];
+                double x = variableValue - variableConditionTreeNode.Threshold;
+                double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
+
+                double trueBranch = code[j - currentInstr.nArguments].value;
+                double falseBranch = code[j - currentInstr.nArguments + 1].value;
+
+                currentInstr.value = trueBranch * p + falseBranch * (1 - p);
+              }
+            }
+            break;
+          default:
+            throw new NotSupportedException();
+        }
+
+        // book-keeping in order to keep all the values correct
+        int narg = currentInstr.nArguments;
+
+        // we count the values before the next function is encountered
+        if (narg == 0) { ++count; continue; }
+
+        if (count > narg) {
+          for (int i = 1; i <= count - narg; ++i)
+            code[j - i].value = code[j - i - narg].value;
+        }
+
+        count -= (narg - 1); // because after being evaluated the current instruction becomes a 'value'
+      }
+
+      return code[code.Length - 1].value;
+    }
+  }
+}
Index: branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionValuesCalculator.cs
===================================================================
--- branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionValuesCalculator.cs	(revision 9271)
+++ branches/HeuristicLab.DataAnalysis.Symbolic.LinearInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionValuesCalculator.cs	(revision 9271)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public abstract class SymbolicDataAnalysisSolutionValuesCalculator {
+    protected readonly ISymbolicExpressionTree tempTree;
+    protected readonly ConstantTreeNode constantNode;
+
+    public SymbolicDataAnalysisSolutionValuesCalculator() {
+      constantNode = ((ConstantTreeNode)new Constant().CreateTreeNode());
+      ISymbolicExpressionTreeNode root = new ProgramRootSymbol().CreateTreeNode();
+      ISymbolicExpressionTreeNode start = new StartSymbol().CreateTreeNode();
+      root.AddSubtree(start);
+      tempTree = new SymbolicExpressionTree(root);
+    }
+
+    // should be moved to an interface, then un-abstract the class
+    public abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData);
+    public abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, double lowerEstimationLimit, double upperEstimationLimit);
+
+    protected void SwitchNode(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode oldBranch, ISymbolicExpressionTreeNode newBranch) {
+      for (int i = 0; i < root.SubtreeCount; i++) {
+        if (root.GetSubtree(i) == oldBranch) {
+          root.RemoveSubtree(i);
+          root.InsertSubtree(i, newBranch);
+          return;
+        }
+      }
+    }
+
+    protected double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData) {
+      // remove old ADFs
+      while (tempTree.Root.SubtreeCount > 1) tempTree.Root.RemoveSubtree(1);
+      // clone ADFs of source tree
+      for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
+        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
+      }
+      var start = tempTree.Root.GetSubtree(0);
+      while (start.SubtreeCount > 0) start.RemoveSubtree(0);
+      start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
+      var rows = problemData.TrainingIndices;
+      return interpreter.GetSymbolicExpressionTreeValues(tempTree, problemData.Dataset, rows).Median();
+    }
+  }
+}
