Index: anches/1837_Sliding Window GP/Build.cmd
===================================================================
--- /branches/1837_Sliding Window GP/Build.cmd	(revision 17686)
+++ 	(revision )
@@ -1,104 +1,0 @@
-@ECHO OFF
-
-SET CLEANBEFOREBUILD=
-
-SET SELECTED=
-SET CONFIGURATION=
-SET PLATFORM=
-
-IF "%~1"=="" GOTO :prompt_solution
-
-SET SELECTED=%1
-IF NOT EXIST %SELECTED% (
-  ECHO Solution file %SELECTED% could not be found.
-  GOTO :end
-)
-ECHO Building solution %SELECTED% ...
-GOTO :config_selection
-
-:prompt_solution
-SET /A COUNT=0
-FOR /F "tokens=*" %%A IN ('dir /B *.sln') DO (
-  CALL :forloopbody "%%A"
-)
-
-IF "%COUNT%"=="1" (
-  SET SELECTED=%SOLUTIONS.1%
-  ECHO Building %SOLUTIONS.1% as it is the only solution that was found ...
-  GOTO :config_selection
-)
-
-ECHO Found the following solutions:
-FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO ECHO %%A = %%B
-ECHO.
-SET /P SOLUTIONINDEX=Which solution to build? Type the number: 
-
-SET SELECTED=""
-FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO (
-  IF "%%A"=="%SOLUTIONINDEX%" SET SELECTED=%%B
-)
-
-IF %SELECTED%=="" GOTO :eof
-
-:config_selection
-IF "%~2"==""  GOTO :prompt_config
-
-SET CONFIGURATION=%~2
-ECHO Building configuration %CONFIGURATION% ...
-GOTO :platform_selection
-
-:prompt_config
-SET /P CONFIGURATION=Which configuration to build [Release]: 
-IF "%CONFIGURATION%"=="" SET CONFIGURATION=Release
-
-:platform_selection
-IF "%~3"=="" GOTO :prompt_platform
-  
-SET PLATFORM=%~3
-ECHO Building platform %PLATFORM% ...
-GOTO :clean
-
-:prompt_platform
-SET /P PLATFORM=Which platform to build [Any CPU]: 
-IF "%PLATFORM%"=="" SET PLATFORM=Any CPU
-
-:clean
-IF "%~4"=="" GOTO :prompt_clean
-
-SET CLEANBEFOREBUILD=%~4
-GOTO :main
-
-:prompt_clean
-SET /P CLEANBEFOREBUILD=Would you like to clean before building [n]: 
-IF "%CLEANBEFOREBUILD%"=="" SET CLEANBEFOREBUILD=n
-
-:main
-REM First find the path to the msbuild.exe by performing a registry query
-FOR /F "tokens=1,3 delims=	 " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"') DO (
-  IF "%%A"=="MSBuildToolsPath" SET MSBUILDPATH=%%B)
-
-REM Then execute msbuild to clean and build the solution
-REM Disable that msbuild creates a cache file of the solution
-SET MSBuildUseNoSolutionCache=1
-REM Run msbuild to clean and then build
-IF "%CLEANBEFOREBUILD%" NEQ "n" (
-  ECHO Cleaning ...
-  %MSBUILDPATH%msbuild.exe %SELECTED% /target:Clean /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly
-)
-ECHO Building ...
-%MSBUILDPATH%msbuild.exe %SELECTED% /target:Build /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly
-
-ECHO.
-ECHO DONE.
-
-:end
-
-PAUSE
-
-GOTO :eof
-
-REM This workaround is necessary so that COUNT gets reevaluated
-:forloopbody
-SET /A COUNT+=1
-SET SOLUTIONS.%COUNT%=%1
-GOTO :eof
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj	(revision 17687)
@@ -11,5 +11,5 @@
     <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification</RootNamespace>
     <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
@@ -41,22 +41,24 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -64,7 +66,8 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -73,8 +76,9 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -82,7 +86,8 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -91,65 +96,70 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="ALGLIB-3.7.0">
-      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Analysis-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Collections-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Common-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Common.Resources-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Core-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Data-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Operators-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Optimization-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Parameters-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Persistence-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.Instances-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     </Reference>
     <Reference Include="System" />
@@ -176,7 +186,10 @@
     <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" />
     <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" />
+    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs" />
+    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs" />
     <Compile Include="Sliding Window\GenerationalClassificationSlidingWindowAnalyzer.cs" />
     <Compile Include="Sliding Window\OffspringSelectionClassificationSlidingWindowAnalyzer.cs" />
     <Compile Include="Sliding Window\SlidingWindowBestClassificationSolutionsCollection.cs" />
+    <Compile Include="SymbolicClassificationPhenotypicDiversityAnalyzer.cs" />
     <Compile Include="SymbolicClassificationPruningAnalyzer.cs" />
     <Compile Include="SymbolicClassificationSolutionImpactValuesCalculator.cs" />
@@ -236,8 +249,14 @@
   </ItemGroup>
   <ItemGroup>
+    <Reference Include="HEAL.Attic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HEAL.Attic.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
-      <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
+      <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project>
       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
-      <Private>False</Private>
     </ProjectReference>
   </ItemGroup>
@@ -265,3 +284,6 @@
 </PreBuildEvent>
   </PropertyGroup>
+  <PropertyGroup>
+    <PreBuildEvent />
+  </PropertyGroup>
 </Project>
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationEvaluator.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,4 +22,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("ee5a6071-4942-4358-ad21-7ba1bd4224ad")]
   public interface ISymbolicClassificationEvaluator : ISymbolicDataAnalysisEvaluator<IClassificationProblemData> {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,5 +21,8 @@
 
 using System.Collections.Generic;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("64a5d560-0657-4022-87a0-9f3210062a84")]
   public interface ISymbolicClassificationModel : IClassificationModel, ISymbolicDataAnalysisModel {
     void RecalculateModelParameters(IClassificationProblemData problemData, IEnumerable<int> rows);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreator.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,8 +23,10 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("a21179da-5417-4e8c-8f8a-6ddc83b16ab1")]
   public interface ISymbolicClassificationModelCreator : IItem {
-    ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
+    ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreatorOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreatorOperator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreatorOperator.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,6 +23,8 @@
 
 using HeuristicLab.Core;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("7d19cbcd-dde9-449e-b6d6-ea3e752638d2")]
   public interface ISymbolicClassificationModelCreatorOperator : IOperator {
     ILookupParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationMultiObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationMultiObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationMultiObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,4 +22,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("715dc79f-e2b9-4586-a66c-abf3a35f0012")]
   public interface ISymbolicClassificationMultiObjectiveEvaluator : ISymbolicClassificationEvaluator, ISymbolicDataAnalysisMultiObjectiveEvaluator<IClassificationProblemData> {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSingleObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSingleObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSingleObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,4 +22,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("18a4eeab-5066-4e52-8f37-992a5f7563f1")]
   public interface ISymbolicClassificationSingleObjectiveEvaluator : ISymbolicClassificationEvaluator, ISymbolicDataAnalysisSingleObjectiveEvaluator<IClassificationProblemData> {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,8 +22,6 @@
 
 
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using System.Collections.Generic;
-using System;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("82ba1ea2-e8e9-4b77-b797-c752c1256840")]
   public interface ISymbolicClassificationSolution : IClassificationSolution, ISymbolicDataAnalysisSolution {
     new ISymbolicClassificationModel Model { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModel.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,4 +22,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("3f2e5443-226c-408a-9121-973d162c590b")]
   public interface ISymbolicDiscriminantFunctionClassificationModel : IDiscriminantFunctionClassificationModel, ISymbolicClassificationModel {
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModelCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModelCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModelCreator.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,8 +22,10 @@
 #endregion
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("fc2ba966-c965-462b-8c5d-8c40998548a7")]
   public interface ISymbolicDiscriminantFunctionClassificationModelCreator : ISymbolicClassificationModelCreator {
-    ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
+    ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/AccuracyMaximizingThresholdsModelCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/AccuracyMaximizingThresholdsModelCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/AccuracyMaximizingThresholdsModelCreator.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,8 +25,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
+  [StorableType("5D9D21D0-F9A8-4145-80CF-2EE9FC0D884C")]
   [Item("AccuracyMaximizingThresholdsModelCreator", "")]
   public sealed class AccuracyMaximizingThresholdsModelCreator : Item, ISymbolicDiscriminantFunctionClassificationModelCreator {
@@ -38,5 +38,5 @@
     }
     [StorableConstructor]
-    private AccuracyMaximizingThresholdsModelCreator(bool deserializing) : base(deserializing) { }
+    private AccuracyMaximizingThresholdsModelCreator(StorableConstructorFlag _) : base(_) { }
     private AccuracyMaximizingThresholdsModelCreator(AccuracyMaximizingThresholdsModelCreator original, Cloner cloner) : base(original, cloner) { }
     public AccuracyMaximizingThresholdsModelCreator() : base() { }
@@ -45,9 +45,9 @@
 
 
-    public ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      return CreateSymbolicDiscriminantFunctionClassificationModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
+    public ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
+      return CreateSymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     }
-    public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      return new SymbolicDiscriminantFunctionClassificationModel(tree, interpreter, new AccuracyMaximizationThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
+    public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
+      return new SymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, new AccuracyMaximizationThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NearestNeighborModelCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NearestNeighborModelCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NearestNeighborModelCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,8 +26,8 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
+  [StorableType("B96EB322-8027-48F7-AB5B-4E22546B74DD")]
   [Item("NearestNeighborModelCreator", "")]
   public sealed class NearestNeighborModelCreator : ParameterizedNamedItem, ISymbolicClassificationModelCreator {
@@ -44,5 +44,5 @@
 
     [StorableConstructor]
-    private NearestNeighborModelCreator(bool deserializing) : base(deserializing) { }
+    private NearestNeighborModelCreator(StorableConstructorFlag _) : base(_) { }
     private NearestNeighborModelCreator(NearestNeighborModelCreator original, Cloner cloner) : base(original, cloner) { }
     public NearestNeighborModelCreator()
@@ -54,6 +54,6 @@
 
 
-    public ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      return new SymbolicNearestNeighbourClassificationModel(KParameter.Value.Value, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
+    public ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
+      return new SymbolicNearestNeighbourClassificationModel(targetVariable, KParameter.Value.Value, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NormalDistributedThresholdsModelCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NormalDistributedThresholdsModelCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NormalDistributedThresholdsModelCreator.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,8 +26,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
+  [StorableType("87C4FF17-FC59-4D0F-80F5-2C84499E1222")]
   [Item("NormalDistributedThresholdsModelCreator", "")]
   public sealed class NormalDistributedThresholdsModelCreator : Item, ISymbolicDiscriminantFunctionClassificationModelCreator {
@@ -39,5 +39,5 @@
     }
     [StorableConstructor]
-    private NormalDistributedThresholdsModelCreator(bool deserializing) : base(deserializing) { }
+    private NormalDistributedThresholdsModelCreator(StorableConstructorFlag _) : base(_) { }
     private NormalDistributedThresholdsModelCreator(NormalDistributedThresholdsModelCreator original, Cloner cloner) : base(original, cloner) { }
     public NormalDistributedThresholdsModelCreator() : base() { }
@@ -46,9 +46,9 @@
 
 
-    public ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      return CreateSymbolicDiscriminantFunctionClassificationModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
+    public ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
+      return CreateSymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     }
-    public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      return new SymbolicDiscriminantFunctionClassificationModel(tree, interpreter, new NormalDistributionCutPointsThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
+    public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
+      return new SymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, new NormalDistributionCutPointsThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,10 +21,11 @@
 
 using HeuristicLab.Common;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [StorableType("5AC365B5-2F64-4F10-8BD3-E98790E8F3C4")]
   public abstract class SymbolicClassificationMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IClassificationProblemData>, ISymbolicClassificationMultiObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationMultiObjectiveEvaluator(SymbolicClassificationMultiObjectiveEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,12 +25,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("Mean squared error & Tree size Evaluator", "Calculates the mean squared error and the tree size of a symbolic classification solution.")]
-  [StorableClass]
+  [StorableType("1D1693A0-6479-45D1-990F-125FFCEC430E")]
   public class SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator : SymbolicClassificationMultiObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,12 +25,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("Pearson R² & Tree size Evaluator", "Calculates the Pearson R² and the tree size of a symbolic classification solution.")]
-  [StorableClass]
+  [StorableType("3131A57B-5F87-4CAD-A0BE-E1E03D6D8276")]
   public class SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator : SymbolicClassificationMultiObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator original, Cloner cloner)
       : base(original, cloner) {
@@ -57,17 +57,17 @@
       OnlineCalculatorError errorState;
 
-      double r2;
+      double r;
       if (applyLinearScaling) {
-        var r2Calculator = new OnlinePearsonsRSquaredCalculator();
-        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r2Calculator, problemData.Dataset.Rows);
-        errorState = r2Calculator.ErrorState;
-        r2 = r2Calculator.RSquared;
+        var rCalculator = new OnlinePearsonsRCalculator();
+        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, rCalculator, problemData.Dataset.Rows);
+        errorState = rCalculator.ErrorState;
+        r = rCalculator.R;
       } else {
         IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
-        r2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
+        r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
       }
 
-      if (errorState != OnlineCalculatorError.None) r2 = double.NaN;
-      return new double[2] { r2, solution.Length };
+      if (errorState != OnlineCalculatorError.None) r = double.NaN;
+      return new double[2] { r*r, solution.Length };
 
     }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,11 +23,12 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [Item("Symbolic Classification Problem (multi objective)", "Represents a multi objective symbolic classfication problem.")]
-  [StorableClass]
-  [Creatable("Problems")]
+  [Item("Symbolic Classification Problem (multi-objective)", "Represents a multi objective symbolic classfication problem.")]
+  [StorableType("3CD66D22-59F2-43BA-A357-AA84C403EE61")]
+  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 130)]
   public class SymbolicClassificationMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IClassificationProblemData, ISymbolicClassificationMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IClassificationProblem {
     private const double PunishmentFactor = 10;
@@ -56,5 +57,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicClassificationMultiObjectiveProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationMultiObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationMultiObjectiveProblem(SymbolicClassificationMultiObjectiveProblem original, Cloner cloner)
       : base(original, cloner) {
@@ -105,4 +106,6 @@
       Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer());
       Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer());
+      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
+      Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()));
       ParameterizeOperators();
     }
@@ -135,4 +138,15 @@
           op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
       }
+
+      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
+        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        op.QualityVariableName = Evaluator.QualitiesParameter.ActualName;
+
+        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
+          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
+          phenotypicSimilarityCalculator.ProblemData = ProblemData;
+          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
+        }
+      }
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,9 +20,14 @@
 #endregion
 
+using System.Collections.Generic;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +36,5 @@
   /// </summary>
   [Item("SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for multi objective symbolic classification problems.")]
-  [StorableClass]
+  [StorableType("EC30DC99-A5A8-43B0-81C1-BA9016A0A74C")]
   public sealed class SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>,
     ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
@@ -38,4 +43,7 @@
     private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
     private const string EstimationLimitsParameterName = "EstimationLimits";
+    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
+    private const string ValidationPartitionParameterName = "ValidationPartition";
+    private const string AnalyzeTestErrorParameterName = "Analyze Test Error";
 
     #region parameter properties
@@ -55,8 +63,21 @@
       get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
     }
+    public ILookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
+    }
+    public IValueLookupParameter<IntRange> ValidationPartitionParameter {
+      get { return (IValueLookupParameter<IntRange>)Parameters[ValidationPartitionParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> AnalyzeTestErrorParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[AnalyzeTestErrorParameterName]; }
+    }
+    public bool AnalyzeTestError {
+      get { return AnalyzeTestErrorParameter.Value.Value; }
+      set { AnalyzeTestErrorParameter.Value.Value = value; }
+    }
     #endregion
 
     [StorableConstructor]
-    private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer()
@@ -66,4 +87,8 @@
       Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
       Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model."));
+      Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
+      Parameters.Add(new FixedValueParameter<BoolValue>(AnalyzeTestErrorParameterName, "Flag whether the test error should be displayed in the Pareto-Front", new BoolValue(false)));
+
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -81,5 +106,5 @@
 
     protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
 
@@ -87,4 +112,67 @@
       return model.CreateClassificationSolution((IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
     }
+
+    public override IOperation Apply() {
+      var operation = base.Apply();
+      var paretoFront = TrainingBestSolutionsParameter.ActualValue;
+
+      IResult result;
+      ScatterPlot qualityToTreeSize;
+      if (!ResultCollection.TryGetValue("Pareto Front Analysis", out result)) {
+        qualityToTreeSize = new ScatterPlot("Quality vs Tree Size", "");
+        qualityToTreeSize.VisualProperties.XAxisMinimumAuto = false;
+        qualityToTreeSize.VisualProperties.XAxisMaximumAuto = false;
+        qualityToTreeSize.VisualProperties.YAxisMinimumAuto = false;
+        qualityToTreeSize.VisualProperties.YAxisMaximumAuto = false;
+
+        qualityToTreeSize.VisualProperties.XAxisMinimumFixedValue = 0;
+        qualityToTreeSize.VisualProperties.XAxisMaximumFixedValue = MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value;
+        qualityToTreeSize.VisualProperties.YAxisMinimumFixedValue = 0;
+        qualityToTreeSize.VisualProperties.YAxisMaximumFixedValue = 1;
+        ResultCollection.Add(new Result("Pareto Front Analysis", qualityToTreeSize));
+      } else {
+        qualityToTreeSize = (ScatterPlot)result.Value;
+      }
+
+      int previousTreeLength = -1;
+      var sizeParetoFront = new LinkedList<ISymbolicClassificationSolution>();
+      foreach (var solution in paretoFront.OrderBy(s => s.Model.SymbolicExpressionTree.Length)) {
+        int treeLength = solution.Model.SymbolicExpressionTree.Length;
+        if (!sizeParetoFront.Any()) sizeParetoFront.AddLast(solution);
+        if (solution.TrainingAccuracy > sizeParetoFront.Last.Value.TrainingAccuracy) {
+          if (treeLength == previousTreeLength)
+            sizeParetoFront.RemoveLast();
+          sizeParetoFront.AddLast(solution);
+        }
+        previousTreeLength = treeLength;
+      }
+
+      qualityToTreeSize.Rows.Clear();
+      var trainingRow = new ScatterPlotDataRow("Training Accuracy", "", sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TrainingAccuracy, x)));
+      trainingRow.VisualProperties.PointSize = 8;
+      qualityToTreeSize.Rows.Add(trainingRow);
+
+      if (AnalyzeTestError) {
+        var testRow = new ScatterPlotDataRow("Test Accuracy", "",
+          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TestAccuracy, x)));
+        testRow.VisualProperties.PointSize = 8;
+        qualityToTreeSize.Rows.Add(testRow);
+      }
+
+      var validationPartition = ValidationPartitionParameter.ActualValue;
+      if (validationPartition.Size != 0) {
+        var problemData = ProblemDataParameter.ActualValue;
+        var validationIndizes = Enumerable.Range(validationPartition.Start, validationPartition.Size).ToList();
+        var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, validationIndizes).ToList();
+        OnlineCalculatorError error;
+        var validationRow = new ScatterPlotDataRow("Validation Accuracy", "",
+          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length,
+          OnlineAccuracyCalculator.Calculate(targetValues, x.GetEstimatedClassValues(validationIndizes), out error))));
+        validationRow.VisualProperties.PointSize = 7;
+        qualityToTreeSize.Rows.Add(validationRow);
+      }
+
+      return operation;
+    }
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for multi objective symbolic classification problems.")]
-  [StorableClass]
+  [StorableType("223AECFF-0EA7-4271-A342-9F2E5BF3EDC0")]
   public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData>,
   ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
@@ -50,5 +50,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer()
@@ -71,5 +71,5 @@
 
     protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQualities) {
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Plugin.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Plugin.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Plugin.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification","Provides classes to perform symbolic classification (single- or multiobjective).", "3.4.5.$WCREV$")]
+  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification","Provides classes to perform symbolic classification (single- or multiobjective).", "3.4.12.$WCREV$")]
   [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
@@ -39,5 +39,5 @@
   [PluginDependency("HeuristicLab.Optimization", "3.3")]
   [PluginDependency("HeuristicLab.Parameters", "3.3")]
-  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Attic", "1.0")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Properties/AssemblyInfo.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Properties/AssemblyInfo.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,5 +31,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
+[assembly: AssemblyCopyright("(c) HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -53,3 +53,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.5.$WCREV$")]
+[assembly: AssemblyFileVersion("3.4.12.$WCREV$")]
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,12 +27,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.SingleObjective {
   [Item("Bounded Mean squared error Evaluator", "Calculates the bounded mean squared error of a symbolic classification solution (estimations above or below the class values are only penaltilized linearly.")]
-  [StorableClass]
+  [StorableType("3C4C86ED-3F6A-464F-B7B6-326A220085EC")]
   public class SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,11 +21,11 @@
 
 using HeuristicLab.Common;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
+  [StorableType("48C7BDD3-9EED-4D61-AF72-A895556052A7")]
   public abstract class SymbolicClassificationSingleObjectiveEvaluator : SymbolicDataAnalysisSingleObjectiveEvaluator<IClassificationProblemData>, ISymbolicClassificationSingleObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationSingleObjectiveEvaluator(SymbolicClassificationSingleObjectiveEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,12 +26,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("Mean squared error Evaluator", "Calculates the mean squared error of a symbolic classification solution.")]
-  [StorableClass]
+  [StorableType("E738C902-4293-4B2C-BBAC-1EE79381657D")]
   public class SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -28,9 +28,9 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("SymbolicClassificationSingleObjectiveOverfittingAnalyzer", "Calculates and tracks correlation of training and validation fitness of symbolic classification models.")]
-  [StorableClass]
+  [StorableType("551DB3E3-56F8-4E92-B538-D453DBA23D77")]
   public sealed class SymbolicClassificationSingleObjectiveOverfittingAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData> {
     private const string TrainingValidationCorrelationParameterName = "Training and validation fitness correlation";
@@ -59,5 +59,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(SymbolicClassificationSingleObjectiveOverfittingAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationSingleObjectiveOverfittingAnalyzer()
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,12 +25,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("Pearson R² evaluator", "Calculates the square of the pearson correlation coefficient (also known as coefficient of determination) of a symbolic classification solution.")]
-  [StorableClass]
+  [StorableType("F6F480F9-21DC-4D22-9D5C-5951906BEB79")]
   public class SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator original, Cloner cloner)
       : base(original, cloner) {
@@ -57,16 +57,16 @@
       OnlineCalculatorError errorState;
 
-      double r2;
+      double r;
       if (applyLinearScaling) {
-        var r2Calculator = new OnlinePearsonsRSquaredCalculator();
-        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r2Calculator, problemData.Dataset.Rows);
-        errorState = r2Calculator.ErrorState;
-        r2 = r2Calculator.RSquared;
+        var rCalculator = new OnlinePearsonsRCalculator();
+        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, rCalculator, problemData.Dataset.Rows);
+        errorState = rCalculator.ErrorState;
+        r = rCalculator.R;
       } else {
         IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
-        r2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
+        r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
       }
       if (errorState != OnlineCalculatorError.None) return double.NaN;
-      return r2;
+      return r*r;
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePenaltyScoreEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePenaltyScoreEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePenaltyScoreEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,9 +26,9 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("Penalty Score Evaluator", "Calculates the penalty score of a symbolic classification solution.")]
-  [StorableClass]
+  [StorableType("59D79396-2CBD-4033-9752-52A44243D554")]
   public class SymbolicClassificationSingleObjectivePenaltyScoreEvaluator : SymbolicClassificationSingleObjectiveEvaluator, ISymbolicClassificationModelCreatorOperator {
     private const string ModelCreatorParameterName = "ModelCreator";
@@ -43,5 +43,5 @@
 
     [StorableConstructor]
-    protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(SymbolicClassificationSingleObjectivePenaltyScoreEvaluator original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationSingleObjectivePenaltyScoreEvaluator()
@@ -91,5 +91,5 @@
       ApplyLinearScalingParameter.ExecutionContext = context;
 
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(tree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(problemData.TargetVariable, tree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(problemData);
       model.RecalculateModelParameters(problemData, rows);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,11 +22,12 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [Item("Symbolic Classification Problem (single objective)", "Represents a single objective symbolic classfication problem.")]
-  [StorableClass]
-  [Creatable("Problems")]
+  [Item("Symbolic Classification Problem (single-objective)", "Represents a single objective symbolic classfication problem.")]
+  [StorableType("9C6166E7-9F34-403B-8654-22FFC77A2CAE")]
+  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 120)]
   public class SymbolicClassificationSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IClassificationProblemData, ISymbolicClassificationSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IClassificationProblem {
     private const double PunishmentFactor = 10;
@@ -54,5 +55,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicClassificationSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     protected SymbolicClassificationSingleObjectiveProblem(SymbolicClassificationSingleObjectiveProblem original, Cloner cloner)
       : base(original, cloner) {
@@ -115,4 +116,6 @@
       Operators.Add(new SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer());
       Operators.Add(new SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer());
+      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
+      Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()));
       ParameterizeOperators();
     }
@@ -145,4 +148,15 @@
           op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
       }
+
+      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
+        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
+
+        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
+          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
+          phenotypicSimilarityCalculator.ProblemData = ProblemData;
+          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
+        }
+      }
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for single objective symbolic classification problems.")]
-  [StorableClass]
+  [StorableType("1E179E22-DD6C-4914-8FAA-AB8F7F9B7F7F")]
   public sealed class SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>,
     ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
@@ -58,5 +58,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer()
@@ -81,5 +81,5 @@
 
     protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that collects the training Pareto-best symbolic classification solutions for single objective symbolic classification problems.")]
-  [StorableClass]
+  [StorableType("881573CA-7246-4203-B5C9-10793325A008")]
   public sealed class SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<IClassificationProblemData, ISymbolicClassificationSolution>, ISymbolicClassificationModelCreatorOperator {
     private const string ModelCreatorParameterName = "ModelCreator";
@@ -44,5 +44,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer()
@@ -64,5 +64,5 @@
 
     protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree) {
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for single objective symbolic classification problems.")]
-  [StorableClass]
+  [StorableType("4BEB7C5A-0B3A-4276-95C6-689F8BA8E0E6")]
   public sealed class SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>,
   ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
@@ -50,5 +50,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer()
@@ -71,5 +71,5 @@
 
     protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that collects the validation Pareto-best symbolic classification solutions for single objective symbolic classification problems.")]
-  [StorableClass]
+  [StorableType("DCD4AFE1-B6E5-4A97-BEB3-1BF3E336DD78")]
   public sealed class SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>, ISymbolicClassificationModelCreatorOperator {
     private const string ModelCreatorParameterName = "ModelCreator";
@@ -44,5 +44,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer()
@@ -64,5 +64,5 @@
 
     protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree) {
-      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs	(revision 17687)
@@ -0,0 +1,158 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [NonDiscoverableType]
+  [Item("Weighted Performance Measures Evaluator", "Calculates the quality of a symbolic classification solution based on three weighted measures(normalized mean squared error, false negative rate(1-sensitivity) and false positve rate(1-specificity)).")]
+  [StorableType("0772F316-5E12-4153-857E-8625069B4677")]
+  public class SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
+    private const string NormalizedMeanSquaredErrorWeightingFactorParameterName = "NormalizedMeanSquaredErrorWeightingFactor";
+    private const string FalseNegativeRateWeightingFactorParameterName = "FalseNegativeRateWeightingFactor";
+    private const string FalsePositiveRateWeightingFactorParameterName = "FalsePositiveRateWeightingFactor";
+    private const string ModelCreatorParameterName = "ModelCreator";
+
+    public override bool Maximization { get { return false; } }
+
+    #region parameter properties
+    public IFixedValueParameter<DoubleValue> NormalizedMeanSquaredErrorWeightingFactorParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[NormalizedMeanSquaredErrorWeightingFactorParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> FalseNegativeRateWeightingFactorParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[FalseNegativeRateWeightingFactorParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> FalsePositiveRateWeightingFactorParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[FalsePositiveRateWeightingFactorParameterName]; }
+    }
+    public IValueLookupParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter {
+      get { return (IValueLookupParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
+    }
+    #endregion
+
+    public double NormalizedMeanSquaredErrorWeightingFactor {
+      get { return NormalizedMeanSquaredErrorWeightingFactorParameter.Value.Value; }
+    }
+    public double FalseNegativeRateWeightingFactor {
+      get { return FalseNegativeRateWeightingFactorParameter.Value.Value; }
+    }
+    public double FalsePositiveRateWeightingFactor {
+      get { return FalsePositiveRateWeightingFactorParameter.Value.Value; }
+    }
+
+    [StorableConstructor]
+    protected SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator(SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator(this, cloner);
+    }
+
+    public SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator()
+      : base() {
+      Parameters.Add(new FixedValueParameter<DoubleValue>(NormalizedMeanSquaredErrorWeightingFactorParameterName, "The weighting factor of the normalized mean squared error.", new DoubleValue(1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(FalseNegativeRateWeightingFactorParameterName, "The weighting factor of the false negative rate (1-sensitivity).", new DoubleValue(1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(FalsePositiveRateWeightingFactorParameterName, "The weighting factor of the false positive rate (1-specificity).", new DoubleValue(1)));
+      Parameters.Add(new ValueLookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName, "The model creator which is used during the evaluations."));
+    }
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var tree = SymbolicExpressionTreeParameter.ActualValue;
+      var creator = ModelCreatorParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+
+      double quality = Calculate(interpreter, tree, estimationLimits.Lower, estimationLimits.Upper,
+              ProblemDataParameter.ActualValue, rows, applyLinearScaling, creator, NormalizedMeanSquaredErrorWeightingFactor, FalseNegativeRateWeightingFactor, FalsePositiveRateWeightingFactor);
+      QualityParameter.ActualValue = new DoubleValue(quality);
+      return base.InstrumentedApply();
+    }
+
+    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData problemData,
+                IEnumerable<int> rows, bool applyLinearScaling, ISymbolicClassificationModelCreator modelCreator, double normalizedMeanSquaredErrorWeightingFactor, double falseNegativeRateWeightingFactor, double falsePositiveRateWeightingFactor) {
+      var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, rows);
+      var targetClassValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      var boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit).ToArray();
+      OnlineCalculatorError errorState;
+      double nmse;
+
+      //calculate performance measures
+      string positiveClassName = problemData.PositiveClass;
+      double[] classValues, thresholds;
+      IEnumerable<double> estimatedClassValues = null;
+      ISymbolicDiscriminantFunctionClassificationModel m;
+
+      var model = modelCreator.CreateSymbolicClassificationModel(problemData.TargetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
+      if ((m = model as ISymbolicDiscriminantFunctionClassificationModel) != null) {
+        m.ThresholdCalculator.Calculate(problemData, boundedEstimatedValues, targetClassValues, out classValues, out thresholds);
+        m.SetThresholdsAndClassValues(thresholds, classValues);
+        estimatedClassValues = m.GetEstimatedClassValues(boundedEstimatedValues);
+      } else {
+        model.RecalculateModelParameters(problemData, rows);
+        estimatedClassValues = model.GetEstimatedClassValues(problemData.Dataset, rows);
+      }
+
+      var performanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassName, problemData.GetClassValue(positiveClassName));
+      performanceCalculator.Calculate(targetClassValues, estimatedClassValues);
+      if (performanceCalculator.ErrorState != OnlineCalculatorError.None)
+        return Double.NaN;
+      double falseNegativeRate = 1 - performanceCalculator.TruePositiveRate;
+      double falsePositiveRate = performanceCalculator.FalsePositiveRate;
+
+      if (applyLinearScaling) {
+        throw new NotSupportedException("The Weighted Performance Measures Evaluator does not suppport linear scaling!");
+      }
+      nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetClassValues, boundedEstimatedValues, out errorState);
+      if (errorState != OnlineCalculatorError.None) return Double.NaN;
+      return normalizedMeanSquaredErrorWeightingFactor * nmse + falseNegativeRateWeightingFactor * falseNegativeRate + falsePositiveRateWeightingFactor * falsePositiveRate;
+    }
+
+    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+      ModelCreatorParameter.ExecutionContext = context;
+
+      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper,
+                                      problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, ModelCreatorParameter.ActualValue, NormalizedMeanSquaredErrorWeightingFactorParameter.Value.Value, FalseNegativeRateWeightingFactor, FalsePositiveRateWeightingFactor);
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+      ModelCreatorParameter.ExecutionContext = null;
+
+      return quality;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs	(revision 17687)
@@ -0,0 +1,141 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [NonDiscoverableType]
+  [Item("Weighted Residuals Mean Squared Error Evaluator", @"A modified mean squared error evaluator that enables the possibility to weight residuals differently.
+The first residual category belongs to estimated values which definitely belong to a specific class because the estimated value is located above the maximum or below the minimum of all the class values (DefiniteResidualsWeight).
+The second residual category represents residuals which belong to the positive class whereby the estimated value is located between the positive and a negative class (PositiveClassResidualsWeight).
+All other cases are represented by the third category (NegativeClassesResidualsWeight).
+The weight gets multiplied to the squared error. Note that the Evaluator acts like a normal MSE-Evaluator if all the weights are set to 1.")]
+  [StorableType("A3193296-1A0F-46E2-8F43-22E2ED9CFFC5")]
+  public sealed class SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
+    private const string DefiniteResidualsWeightParameterName = "DefiniteResidualsWeight";
+    private const string PositiveClassResidualsWeightParameterName = "PositiveClassResidualsWeight";
+    private const string NegativeClassesResidualsWeightParameterName = "NegativeClassesResidualsWeight";
+    [StorableConstructor]
+    private SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { }
+    private SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(this, cloner);
+    }
+
+    public SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator()
+      : base() {
+      Parameters.Add(new FixedValueParameter<DoubleValue>(DefiniteResidualsWeightParameterName, "Weight of residuals which definitely belong to a specific class because the estimated values is located above the maximum or below the minimum of all the class values.", new DoubleValue(1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(PositiveClassResidualsWeightParameterName, "Weight of residuals which belong to the positive class whereby the estimated value is located between the positive and a negative class.", new DoubleValue(1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(NegativeClassesResidualsWeightParameterName, "Weight of residuals which are not covered by the DefiniteResidualsWeight or the PositiveClassResidualsWeight.", new DoubleValue(1)));
+    }
+
+    #region parameter properties
+    public IFixedValueParameter<DoubleValue> DefiniteResidualsWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[DefiniteResidualsWeightParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> PositiveClassResidualsWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[PositiveClassResidualsWeightParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> NegativeClassesResidualsWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[NegativeClassesResidualsWeightParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public override bool Maximization { get { return false; } }
+
+    public double DefiniteResidualsWeight {
+      get { return DefiniteResidualsWeightParameter.Value.Value; }
+    }
+    public double PositiveClassResidualsWeight {
+      get { return PositiveClassResidualsWeightParameter.Value.Value; }
+    }
+    public double NegativeClassesResidualsWeight {
+      get { return NegativeClassesResidualsWeightParameter.Value.Value; }
+    }
+    #endregion
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value,
+        DefiniteResidualsWeight, PositiveClassResidualsWeight, NegativeClassesResidualsWeight);
+      QualityParameter.ActualValue = new DoubleValue(quality);
+      return base.InstrumentedApply();
+    }
+
+    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling,
+      double definiteResidualsWeight, double positiveClassResidualsWeight, double negativeClassesResidualsWeight) {
+      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, rows);
+      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      OnlineCalculatorError errorState;
+
+      double positiveClassValue = problemData.GetClassValue(problemData.PositiveClass);
+      //get class values min/max
+      double classValuesMin = problemData.ClassValues.ElementAtOrDefault(0);
+      double classValuesMax = classValuesMin;
+      foreach (double classValue in problemData.ClassValues) {
+        if (classValuesMin > classValue) classValuesMin = classValue;
+        if (classValuesMax < classValue) classValuesMax = classValue;
+      }
+
+      double quality;
+      if (applyLinearScaling) {
+        var calculator = new OnlineWeightedClassificationMeanSquaredErrorCalculator(positiveClassValue, classValuesMax, classValuesMin,
+          definiteResidualsWeight, positiveClassResidualsWeight, negativeClassesResidualsWeight);
+        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, calculator, problemData.Dataset.Rows);
+        errorState = calculator.ErrorState;
+        quality = calculator.WeightedResidualsMeanSquaredError;
+      } else {
+        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
+        quality = OnlineWeightedClassificationMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, positiveClassValue, classValuesMax,
+          classValuesMin, definiteResidualsWeight, positiveClassResidualsWeight, negativeClassesResidualsWeight, out errorState);
+      }
+      if (errorState != OnlineCalculatorError.None) return Double.NaN;
+      return quality;
+    }
+
+    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+
+      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DefiniteResidualsWeight, PositiveClassResidualsWeight, NegativeClassesResidualsWeight);
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+
+      return quality;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/GenerationalClassificationSlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/GenerationalClassificationSlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/GenerationalClassificationSlidingWindowAnalyzer.cs	(revision 17687)
@@ -24,9 +24,9 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
   [Item("Generational Classification Sliding Window Analyzer", "")]
+  [StorableType("62291FAE-D74F-41FC-98D0-A5B23450B39F")]
   public class GenerationalClassificationSlidingWindowAnalyzer : GenerationalSlidingWindowAnalyzer {
     private const string ModelCreatorParameterName = "ModelCreator";
@@ -43,5 +43,5 @@
     #endregion
     [StorableConstructor]
-    protected GenerationalClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected GenerationalClassificationSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/OffspringSelectionClassificationSlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/OffspringSelectionClassificationSlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/OffspringSelectionClassificationSlidingWindowAnalyzer.cs	(revision 17687)
@@ -25,8 +25,9 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
   [Item("Offspring Selection Classification Sliding Window Analyzer", "")]
+  [StorableType("D9D8C0D5-47D2-4FDF-B480-1A17D5D21EB1")]
   public class OffspringSelectionClassificationSlidingWindowAnalyzer : OffspringSelectionSlidingWindowAnalyzer {
     private const string ModelCreatorParameterName = "ModelCreator";
@@ -43,5 +44,5 @@
     #endregion
     [StorableConstructor]
-    protected OffspringSelectionClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected OffspringSelectionClassificationSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/SlidingWindowBestClassificationSolutionsCollection.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/SlidingWindowBestClassificationSolutionsCollection.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/SlidingWindowBestClassificationSolutionsCollection.cs	(revision 17687)
@@ -23,9 +23,9 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
   [Item("Sliding Window Best Classification Solutions Collection", "A collection of best sliding window solutions for symbolic classification.")]
+  [StorableType("65F9CF37-643A-4236-AA36-8721BA03B006")]
   public class SlidingWindowBestClassificationSolutionsCollection : SlidingWindowBestSolutionsCollection {
     public new IClassificationProblemData ProblemData {
@@ -35,5 +35,5 @@
     public ISymbolicClassificationModelCreator ModelCreator { get; set; }
     [StorableConstructor]
-    protected SlidingWindowBestClassificationSolutionsCollection(bool deserializing) : base(deserializing) { }
+    protected SlidingWindowBestClassificationSolutionsCollection(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
@@ -47,5 +47,5 @@
     public override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
       double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      var model = ModelCreator.CreateSymbolicClassificationModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
+      var model = ModelCreator.CreateSymbolicClassificationModel(ProblemData.TargetVariable,tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
       model.RecalculateModelParameters(ProblemData, ProblemData.TrainingIndices);
       return model;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,9 +20,10 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -30,16 +31,34 @@
   /// Represents a symbolic classification model
   /// </summary>
-  [StorableClass]
+  [StorableType("8AEAF4A5-839D-4070-A348-440E79110C74")]
   [Item(Name = "SymbolicClassificationModel", Description = "Represents a symbolic classification model.")]
   public abstract class SymbolicClassificationModel : SymbolicDataAnalysisModel, ISymbolicClassificationModel {
+    [Storable]
+    private string targetVariable;
+    public string TargetVariable {
+      get { return targetVariable; }
+      set {
+        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
+        targetVariable = value;
+        OnTargetVariableChanged(this, EventArgs.Empty);
+      }
+    }
 
     [StorableConstructor]
-    protected SymbolicClassificationModel(bool deserializing) : base(deserializing) { }
-    protected SymbolicClassificationModel(SymbolicClassificationModel original, Cloner cloner) : base(original, cloner) { }
-    protected SymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
-      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
-      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) { }
+    protected SymbolicClassificationModel(StorableConstructorFlag _) : base(_) {
+      targetVariable = string.Empty;
+    }
 
-    public abstract IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows);
+    protected SymbolicClassificationModel(SymbolicClassificationModel original, Cloner cloner)
+      : base(original, cloner) {
+      targetVariable = original.targetVariable;
+    }
+
+    protected SymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
+      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
+      this.targetVariable = targetVariable;
+    }
+
+    public abstract IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows);
     public abstract void RecalculateModelParameters(IClassificationProblemData problemData, IEnumerable<int> rows);
 
@@ -53,4 +72,25 @@
       Scale(problemData, problemData.TargetVariable);
     }
+
+    public virtual bool IsProblemDataCompatible(IClassificationProblemData problemData, out string errorMessage) {
+      return ClassificationModel.IsProblemDataCompatible(this, problemData, out errorMessage);
+    }
+
+    public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {
+      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
+      var classificationProblemData = problemData as IClassificationProblemData;
+      if (classificationProblemData == null)
+        throw new ArgumentException("The problem data is not compatible with this classification model. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
+      return IsProblemDataCompatible(classificationProblemData, out errorMessage);
+    }
+
+    #region events
+    public event EventHandler TargetVariableChanged;
+    private void OnTargetVariableChanged(object sender, EventArgs args) {
+      var changed = TargetVariableChanged;
+      if (changed != null)
+        changed(sender, args);
+    }
+    #endregion
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPhenotypicDiversityAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPhenotypicDiversityAnalyzer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPhenotypicDiversityAnalyzer.cs	(revision 17687)
@@ -0,0 +1,136 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [Item("SymbolicClassificationPhenotypicDiversityAnalyzer", "An analyzer which calculates diversity based on the phenotypic distance between trees")]
+  [StorableType("D09C1CC5-2BFB-4B5C-A496-F8EA98741C37")]
+  public class SymbolicClassificationPhenotypicDiversityAnalyzer : PopulationSimilarityAnalyzer,
+    ISymbolicDataAnalysisBoundedOperator, ISymbolicDataAnalysisInterpreterOperator, ISymbolicExpressionTreeAnalyzer {
+    #region parameter names
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string EvaluatedValuesParameterName = "EstimatedValues";
+    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
+    private const string ProblemDataParameterName = "ProblemData";
+    private const string ModelCreatorParameterName = "ModelCreator";
+    private const string EstimationLimitsParameterName = "EstimationLimits";
+    private const string UseClassValuesParameterName = "UseClassValues";
+    #endregion
+
+    #region parameter properties
+    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    private IScopeTreeLookupParameter<DoubleArray> EvaluatedValuesParameter {
+      get { return (IScopeTreeLookupParameter<DoubleArray>)Parameters[EvaluatedValuesParameterName]; }
+    }
+    public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
+      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
+    }
+    public ILookupParameter<ISymbolicDiscriminantFunctionClassificationModelCreator> ModelCreatorParameter {
+      get { return (ILookupParameter<ISymbolicDiscriminantFunctionClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
+    }
+    public IValueLookupParameter<IClassificationProblemData> ProblemDataParameter {
+      get { return (IValueLookupParameter<IClassificationProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
+      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> UseClassValuesParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[UseClassValuesParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public bool UseClassValues {
+      get { return UseClassValuesParameter.Value.Value; }
+      set { UseClassValuesParameter.Value.Value = value; }
+    }
+    #endregion
+
+    public SymbolicClassificationPhenotypicDiversityAnalyzer(IEnumerable<ISolutionSimilarityCalculator> validSimilarityCalculators)
+      : base(validSimilarityCalculators) {
+      #region add parameters
+      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>(EvaluatedValuesParameterName, "Intermediate estimated values to be saved in the scopes."));
+      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
+      Parameters.Add(new ValueLookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
+      Parameters.Add(new LookupParameter<ISymbolicDiscriminantFunctionClassificationModelCreator>(ModelCreatorParameterName, "The model creator for creating discriminant function classification models."));
+      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees."));
+      Parameters.Add(new FixedValueParameter<BoolValue>(UseClassValuesParameterName, "Specifies whether the raw estimated values of the tree or the corresponding class values should be used for similarity calculation.", new BoolValue(false)));
+      #endregion
+
+      UpdateCounterParameter.ActualName = "PhenotypicDiversityAnalyzerUpdateCounter";
+      DiversityResultName = "Phenotypic Similarity";
+    }
+
+    [StorableConstructor]
+    protected SymbolicClassificationPhenotypicDiversityAnalyzer(StorableConstructorFlag _) : base(_) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicClassificationPhenotypicDiversityAnalyzer(this, cloner);
+    }
+
+    protected SymbolicClassificationPhenotypicDiversityAnalyzer(SymbolicClassificationPhenotypicDiversityAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IOperation Apply() {
+      int updateInterval = UpdateIntervalParameter.Value.Value;
+      IntValue updateCounter = UpdateCounterParameter.ActualValue;
+
+      if (updateCounter == null) {
+        updateCounter = new IntValue(updateInterval);
+        UpdateCounterParameter.ActualValue = updateCounter;
+      }
+
+      if (updateCounter.Value == updateInterval) {
+        var trees = SymbolicExpressionTreeParameter.ActualValue;
+        var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+        var problemData = ProblemDataParameter.ActualValue;
+        var ds = ProblemDataParameter.ActualValue.Dataset;
+        var rows = ProblemDataParameter.ActualValue.TrainingIndices;
+        var modelCreator = ModelCreatorParameter.ActualValue;
+        var estimationLimits = EstimationLimitsParameter.ActualValue;
+        var evaluatedValues = new ItemArray<DoubleArray>(trees.Length);
+        for (int i = 0; i < trees.Length; ++i) {
+          var model = (IDiscriminantFunctionClassificationModel)modelCreator.CreateSymbolicDiscriminantFunctionClassificationModel(problemData.TargetVariable, trees[i], interpreter, estimationLimits.Lower, estimationLimits.Upper);
+          model.RecalculateModelParameters(problemData, rows);
+          var values = UseClassValues ? model.GetEstimatedClassValues(ds, rows) : model.GetEstimatedValues(ds, rows);
+          evaluatedValues[i] = new DoubleArray(values.ToArray());
+        }
+        EvaluatedValuesParameter.ActualValue = evaluatedValues;
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,26 +22,60 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
   [Item("SymbolicClassificationPruningAnalyzer", "An analyzer that prunes introns from the population.")]
-  [StorableClass]
+  [StorableType("26701D59-DEB6-4CBF-89DC-C5C3F310B634")]
   public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer {
-    private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
     private const string PruningOperatorParameterName = "PruningOperator";
-    private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)
-      : base(original, cloner) {
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new SymbolicClassificationPruningAnalyzer(this, cloner);
+    public IValueParameter<SymbolicClassificationPruningOperator> PruningOperatorParameter {
+      get { return (IValueParameter<SymbolicClassificationPruningOperator>)Parameters[PruningOperatorParameterName]; }
     }
 
+    protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator {
+      get { return PruningOperatorParameter.Value; }
+    }
+
+    private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningAnalyzer(this, cloner); }
+
     [StorableConstructor]
-    private SymbolicClassificationPruningAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationPruningAnalyzer(StorableConstructorFlag _) : base(_) { }
 
     public SymbolicClassificationPruningAnalyzer() {
-      Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicClassificationSolutionImpactValuesCalculator()));
-      Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator()));
+      Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+
+      #region Backwards compatible code, remove with 3.4
+      if (Parameters.ContainsKey(PruningOperatorParameterName)) {
+        var oldParam = Parameters[PruningOperatorParameterName] as ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>;
+        if (oldParam != null) {
+          Parameters.Remove(oldParam);
+          Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
+        }
+      } else {
+        // not yet contained
+        Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
+      }
+
+      if (Parameters.ContainsKey("PruneOnlyZeroImpactNodes")) {
+        PruningOperator.PruneOnlyZeroImpactNodes = ((IFixedValueParameter<BoolValue>)Parameters["PruneOnlyZeroImpactNodes"]).Value.Value;
+        Parameters.Remove(Parameters["PruneOnlyZeroImpactNodes"]);
+      }
+      if (Parameters.ContainsKey("ImpactThreshold")) {
+        PruningOperator.NodeImpactThreshold = ((IFixedValueParameter<DoubleValue>)Parameters["ImpactThreshold"]).Value.Value;
+        Parameters.Remove(Parameters["ImpactThreshold"]);
+      }
+      if (Parameters.ContainsKey("ImpactValuesCalculator")) {
+        PruningOperator.ImpactValuesCalculator = ((ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>)Parameters["ImpactValuesCalculator"]).Value;
+        Parameters.Remove(Parameters["ImpactValuesCalculator"]);
+      }
+      #endregion
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs	(revision 17687)
@@ -1,16 +1,39 @@
-﻿using System.Linq;
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
+  [StorableType("F213025F-ACE7-4E43-A149-70C3AD824D19")]
   [Item("SymbolicClassificationPruningOperator", "An operator which prunes symbolic classificaton trees.")]
   public class SymbolicClassificationPruningOperator : SymbolicDataAnalysisExpressionPruningOperator {
-    private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
     private const string ModelCreatorParameterName = "ModelCreator";
-    private const string ApplyLinearScalingParmameterName = "ApplyLinearScaling";
+    private const string EvaluatorParameterName = "Evaluator";
 
     #region parameter properties
@@ -19,47 +42,80 @@
     }
 
-    public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
-      get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParmameterName]; }
+    public ILookupParameter<ISymbolicClassificationSingleObjectiveEvaluator> EvaluatorParameter {
+      get {
+        return (ILookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>)Parameters[EvaluatorParameterName];
+      }
     }
     #endregion
-    #region properties
-    private ISymbolicClassificationModelCreator ModelCreator { get { return ModelCreatorParameter.ActualValue; } }
-    private BoolValue ApplyLinearScaling { get { return ApplyLinearScalingParameter.ActualValue; } }
-    #endregion
 
-    protected SymbolicClassificationPruningOperator(SymbolicClassificationPruningOperator 
-      original, Cloner cloner)
-      : base(original, cloner) {
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new SymbolicClassificationPruningOperator(this, cloner);
+    protected SymbolicClassificationPruningOperator(SymbolicClassificationPruningOperator original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningOperator(this, cloner); }
+
+    [StorableConstructor]
+    protected SymbolicClassificationPruningOperator(StorableConstructorFlag _) : base(_) { }
+
+    public SymbolicClassificationPruningOperator(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactValuesCalculator)
+      : base(impactValuesCalculator) {
+      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
+      Parameters.Add(new LookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>(EvaluatorParameterName));
     }
 
-    [StorableConstructor]
-    protected SymbolicClassificationPruningOperator(bool deserializing) : base(deserializing) { }
-
-    public SymbolicClassificationPruningOperator() {
-      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, new SymbolicClassificationSolutionImpactValuesCalculator()));
-      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      base.ImpactValuesCalculator = new SymbolicClassificationSolutionImpactValuesCalculator();
+      if (!Parameters.ContainsKey(EvaluatorParameterName)) {
+        Parameters.Add(new LookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>(EvaluatorParameterName));
+      }
+      #endregion
     }
 
-    protected override ISymbolicDataAnalysisModel CreateModel() {
-      var model = ModelCreator.CreateSymbolicClassificationModel(SymbolicExpressionTree, Interpreter, EstimationLimits.Lower, EstimationLimits.Upper);
-      var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);
-      var problemData = (IClassificationProblemData)ProblemData;
-      model.RecalculateModelParameters(problemData, rows);
+    protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) {
+      var classificationProblemData = (IClassificationProblemData)problemData;
+      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(classificationProblemData.TargetVariable, tree, interpreter, estimationLimits.Lower, estimationLimits.Upper);
+
+      var rows = classificationProblemData.TrainingIndices;
+      model.RecalculateModelParameters(classificationProblemData, rows);
       return model;
     }
 
     protected override double Evaluate(IDataAnalysisModel model) {
-      var classificationModel = (IClassificationModel)model;
-      var classificationProblemData = (IClassificationProblemData)ProblemData;
-      var trainingIndices = ProblemData.TrainingIndices.ToList();
-      var estimatedValues = classificationModel.GetEstimatedClassValues(ProblemData.Dataset, trainingIndices);
-      var targetValues = ProblemData.Dataset.GetDoubleValues(classificationProblemData.TargetVariable, trainingIndices);
-      OnlineCalculatorError errorState;
-      var quality = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, estimatedValues, out errorState);
-      if (errorState != OnlineCalculatorError.None) return double.NaN;
-      return quality;
+      var evaluator = EvaluatorParameter.ActualValue;
+      var classificationModel = (ISymbolicClassificationModel)model;
+      var classificationProblemData = (IClassificationProblemData)ProblemDataParameter.ActualValue;
+      var rows = Enumerable.Range(FitnessCalculationPartitionParameter.ActualValue.Start, FitnessCalculationPartitionParameter.ActualValue.Size);
+      return evaluator.Evaluate(this.ExecutionContext, classificationModel.SymbolicExpressionTree, classificationProblemData, rows);
+    }
+
+    public static ISymbolicExpressionTree Prune(ISymbolicExpressionTree tree, ISymbolicClassificationModelCreator modelCreator,
+      SymbolicClassificationSolutionImpactValuesCalculator impactValuesCalculator, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
+      IClassificationProblemData problemData, DoubleLimit estimationLimits, IEnumerable<int> rows,
+      double nodeImpactThreshold = 0.0, bool pruneOnlyZeroImpactNodes = false) {
+      var clonedTree = (ISymbolicExpressionTree)tree.Clone();
+      var model = modelCreator.CreateSymbolicClassificationModel(problemData.TargetVariable, clonedTree, interpreter, estimationLimits.Lower, estimationLimits.Upper);
+
+      var nodes = clonedTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList();
+      double qualityForImpactsCalculation = double.NaN;
+
+      for (int i = 0; i < nodes.Count; ++i) {
+        var node = nodes[i];
+        if (node is ConstantTreeNode) continue;
+
+        double impactValue, replacementValue, newQualityForImpactsCalculation;
+        impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, out newQualityForImpactsCalculation, qualityForImpactsCalculation);
+
+        if (pruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue;
+        if (!pruneOnlyZeroImpactNodes && impactValue > nodeImpactThreshold) continue;
+
+        var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();
+        constantNode.Value = replacementValue;
+
+        ReplaceWithConstant(node, constantNode);
+        i += node.GetLength() - 1; // skip subtrees under the node that was folded
+
+        qualityForImpactsCalculation = newQualityForImpactsCalculation;
+      }
+      return model.SymbolicExpressionTree;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,9 +20,11 @@
 #endregion
 
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -30,5 +32,5 @@
   /// Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity
   /// </summary>
-  [StorableClass]
+  [StorableType("C2829CEB-8D34-4FAB-B9AE-23937071B53F")]
   [Item(Name = "SymbolicClassificationSolution", Description = "Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity.")]
   public sealed class SymbolicClassificationSolution : ClassificationSolution, ISymbolicClassificationSolution {
@@ -55,5 +57,5 @@
 
     [StorableConstructor]
-    private SymbolicClassificationSolution(bool deserializing) : base(deserializing) { }
+    private SymbolicClassificationSolution(StorableConstructorFlag _) : base(_) { }
     private SymbolicClassificationSolution(SymbolicClassificationSolution original, Cloner cloner)
       : base(original, cloner) {
@@ -61,4 +63,7 @@
     public SymbolicClassificationSolution(ISymbolicClassificationModel model, IClassificationProblemData problemData)
       : base(model, problemData) {
+      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
+        node.SetGrammar(null);
+
       Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue()));
       Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue()));
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolutionImpactValuesCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolutionImpactValuesCalculator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolutionImpactValuesCalculator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,13 +20,11 @@
 #endregion
 
-using System;
 using System.Collections.Generic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
-  [StorableClass]
+  [StorableType("54D82779-7A37-43E4-AFD6-0C3E8D24F6EE")]
   [Item("SymbolicClassificationSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for classification problems.")]
   public class SymbolicClassificationSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator {
@@ -38,52 +36,17 @@
     }
     [StorableConstructor]
-    protected SymbolicClassificationSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSolutionImpactValuesCalculator(StorableConstructorFlag _) : base(_) { }
 
-    public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
+    protected override double CalculateQualityForImpacts(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
       var classificationModel = (ISymbolicClassificationModel)model;
       var classificationProblemData = (IClassificationProblemData)problemData;
-
-      return CalculateReplacementValue(node, classificationModel.SymbolicExpressionTree, classificationModel.Interpreter, classificationProblemData.Dataset, rows);
-    }
-
-    public override double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN) {
-      double impactValue, replacementValue;
-      CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, originalQuality);
-      return impactValue;
-    }
-
-    public override void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node,
-      IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue,
-      double originalQuality = Double.NaN) {
-      var classificationModel = (ISymbolicClassificationModel)model;
-      var classificationProblemData = (IClassificationProblemData)problemData;
-
-      var dataset = classificationProblemData.Dataset;
+      OnlineCalculatorError errorState;
+      var dataset = problemData.Dataset;
+      classificationModel.RecalculateModelParameters(classificationProblemData, rows);
       var targetClassValues = dataset.GetDoubleValues(classificationProblemData.TargetVariable, rows);
-
-      OnlineCalculatorError errorState;
-      if (double.IsNaN(originalQuality)) {
-        var originalClassValues = classificationModel.GetEstimatedClassValues(dataset, rows);
-        originalQuality = OnlineAccuracyCalculator.Calculate(targetClassValues, originalClassValues, out errorState);
-        if (errorState != OnlineCalculatorError.None) originalQuality = 0.0;
-      }
-
-      replacementValue = CalculateReplacementValue(classificationModel, node, classificationProblemData, rows);
-      var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
-
-      var cloner = new Cloner();
-      var tempModel = cloner.Clone(classificationModel);
-      var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node);
-
-      var tempModelParentNode = tempModelNode.Parent;
-      int i = tempModelParentNode.IndexOfSubtree(tempModelNode);
-      tempModelParentNode.RemoveSubtree(i);
-      tempModelParentNode.InsertSubtree(i, constantNode);
-
-      var estimatedClassValues = tempModel.GetEstimatedClassValues(dataset, rows);
-      double newQuality = OnlineAccuracyCalculator.Calculate(targetClassValues, estimatedClassValues, out errorState);
-      if (errorState != OnlineCalculatorError.None) newQuality = 0.0;
-
-      impactValue = originalQuality - newQuality;
+      var originalClassValues = classificationModel.GetEstimatedClassValues(dataset, rows);
+      var qualityForImpactsCalculation = OnlineAccuracyCalculator.Calculate(targetClassValues, originalClassValues, out errorState);
+      if (errorState != OnlineCalculatorError.None) qualityForImpactsCalculation = 0.0;
+      return qualityForImpactsCalculation;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -32,5 +32,5 @@
   /// Represents a symbolic classification model
   /// </summary>
-  [StorableClass]
+  [StorableType("99332204-4097-496A-AB05-4DB9478DB159")]
   [Item(Name = "SymbolicDiscriminantFunctionClassificationModel", Description = "Represents a symbolic classification model unsing a discriminant function.")]
   public class SymbolicDiscriminantFunctionClassificationModel : SymbolicClassificationModel, ISymbolicDiscriminantFunctionClassificationModel {
@@ -58,5 +58,5 @@
 
     [StorableConstructor]
-    protected SymbolicDiscriminantFunctionClassificationModel(bool deserializing) : base(deserializing) { }
+    protected SymbolicDiscriminantFunctionClassificationModel(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDiscriminantFunctionClassificationModel(SymbolicDiscriminantFunctionClassificationModel original, Cloner cloner)
       : base(original, cloner) {
@@ -65,7 +65,7 @@
       thresholdCalculator = cloner.Clone(original.thresholdCalculator);
     }
-    public SymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDiscriminantFunctionThresholdCalculator thresholdCalculator,
+    public SymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDiscriminantFunctionThresholdCalculator thresholdCalculator,
       double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
-      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
+      : base(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
       this.thresholds = new double[0];
       this.classValues = new double[0];
@@ -88,7 +88,7 @@
       var classValuesArr = classValues.ToArray();
       var thresholdsArr = thresholds.ToArray();
-      if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1) 
+      if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1)
         throw new ArgumentException();
-      if (!double.IsNegativeInfinity(thresholds.First())) 
+      if (!double.IsNegativeInfinity(thresholds.First()))
         throw new ArgumentException();
 
@@ -107,11 +107,15 @@
     }
 
-    public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
+    public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
       return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows).LimitToRange(LowerEstimationLimit, UpperEstimationLimit);
     }
 
-    public override IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
+    public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
+      var estimatedValues = GetEstimatedValues(dataset, rows);
+      return GetEstimatedClassValues(estimatedValues);
+    }
+    public IEnumerable<double> GetEstimatedClassValues(IEnumerable<double> estimatedValues) {
       if (!Thresholds.Any() && !ClassValues.Any()) throw new ArgumentException("No thresholds and class values were set for the current symbolic classification model.");
-      foreach (var x in GetEstimatedValues(dataset, rows)) {
+      foreach (var x in estimatedValues) {
         int classIndex = 0;
         // find first threshold value which is larger than x => class index = threshold index + 1
@@ -123,5 +127,4 @@
       }
     }
-
 
     public override ISymbolicClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,6 +24,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -31,5 +32,5 @@
   /// Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity
   /// </summary>
-  [StorableClass]
+  [StorableType("83BEB8F0-DEF7-4E51-876D-9819BA10F2E8")]
   [Item(Name = "SymbolicDiscriminantFunctionClassificationSolution", Description = "Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity.")]
   public sealed class SymbolicDiscriminantFunctionClassificationSolution : DiscriminantFunctionClassificationSolution, ISymbolicClassificationSolution {
@@ -101,5 +102,5 @@
 
     [StorableConstructor]
-    private SymbolicDiscriminantFunctionClassificationSolution(bool deserializing) : base(deserializing) { }
+    private SymbolicDiscriminantFunctionClassificationSolution(StorableConstructorFlag _) : base(_) { }
     private SymbolicDiscriminantFunctionClassificationSolution(SymbolicDiscriminantFunctionClassificationSolution original, Cloner cloner)
       : base(original, cloner) {
@@ -107,7 +108,9 @@
     public SymbolicDiscriminantFunctionClassificationSolution(ISymbolicDiscriminantFunctionClassificationModel model, IClassificationProblemData problemData)
       : base(model, problemData) {
+      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
+        node.SetGrammar(null);
+
       Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue()));
       Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue()));
-
 
       ResultCollection estimationLimitResults = new ResultCollection();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicNearestNeighbourClassificationModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicNearestNeighbourClassificationModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicNearestNeighbourClassificationModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
@@ -32,5 +32,5 @@
   /// Represents a nearest neighbour model for regression and classification
   /// </summary>
-  [StorableClass]
+  [StorableType("B9F8A753-B102-4356-8821-76E31634A0C6")]
   [Item("SymbolicNearestNeighbourClassificationModel", "Represents a nearest neighbour model for symbolic classification.")]
   public sealed class SymbolicNearestNeighbourClassificationModel : SymbolicClassificationModel {
@@ -47,5 +47,5 @@
 
     [StorableConstructor]
-    private SymbolicNearestNeighbourClassificationModel(bool deserializing) : base(deserializing) { }
+    private SymbolicNearestNeighbourClassificationModel(StorableConstructorFlag _) : base(_) { }
     private SymbolicNearestNeighbourClassificationModel(SymbolicNearestNeighbourClassificationModel original, Cloner cloner)
       : base(original, cloner) {
@@ -55,6 +55,6 @@
       trainedClasses = new List<double>(original.trainedClasses);
     }
-    public SymbolicNearestNeighbourClassificationModel(int k, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
-      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
+    public SymbolicNearestNeighbourClassificationModel(string targetVariable, int k, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
+      : base(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
       this.k = k;
       frequencyComparer = new ClassFrequencyComparer();
@@ -66,5 +66,5 @@
     }
 
-    public override IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
+    public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
       var estimatedValues = Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows)
                                        .LimitToRange(LowerEstimationLimit, UpperEstimationLimit);
@@ -143,5 +143,5 @@
   }
 
-  [StorableClass]
+  [StorableType("523AFB5D-3758-4547-BD6E-1181A01A02B4")]
   internal sealed class ClassFrequencyComparer : IComparer<double> {
     [Storable]
@@ -149,5 +149,5 @@
 
     [StorableConstructor]
-    private ClassFrequencyComparer(bool deserializing) { }
+    private ClassFrequencyComparer(StorableConstructorFlag _) { }
     public ClassFrequencyComparer() {
       classFrequencies = new Dictionary<double, int>();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj	(revision 17687)
@@ -11,5 +11,5 @@
     <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic.Regression</RootNamespace>
     <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
@@ -41,22 +41,24 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -64,7 +66,8 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -73,8 +76,9 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -82,7 +86,8 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -91,70 +96,71 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="ALGLIB-3.7.0">
-      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\ALGLIB-3.7.0.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="AutoDiff-1.0">
-      <HintPath>..\..\..\..\trunk\sources\bin\AutoDiff-1.0.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Analysis-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Collections-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Common-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Common.Resources-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="HEAL.Attic, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HEAL.Attic.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Data-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Operators-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Optimization-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Parameters-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Persistence-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.Instances-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
-      <Private>False</Private>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     </Reference>
     <Reference Include="System" />
@@ -173,4 +179,8 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="MultiObjective\PearsonRSquaredNestedTreeSizeEvaluator.cs" />
+    <Compile Include="MultiObjective\PearsonRSquaredNumberOfVariablesEvaluator.cs" />
+    <Compile Include="MultiObjective\PearsonRSquaredAverageSimilarityEvaluator.cs" />
+    <Compile Include="MultiObjective\PearsonRSquaredTreeComplexityEvaluator.cs" />
     <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" />
     <Compile Include="Plugin.cs" />
@@ -181,4 +191,5 @@
     <Compile Include="SlidingWindow\OffspringSelectionRegressionSlidingWindowAnalyzer.cs" />
     <Compile Include="SlidingWindow\SlidingWindowBestRegressionSolutionsCollection.cs" />
+    <Compile Include="SymbolicRegressionPhenotypicDiversityAnalyzer.cs" />
     <Compile Include="SymbolicRegressionPruningAnalyzer.cs" />
     <Compile Include="SingleObjective\Evaluators\SymbolicRegressionLogResidualEvaluator.cs" />
@@ -233,7 +244,6 @@
   <ItemGroup>
     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
-      <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
+      <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project>
       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
-      <Private>False</Private>
     </ProjectReference>
   </ItemGroup>
@@ -261,3 +271,6 @@
 </PreBuildEvent>
   </PropertyGroup>
+  <PropertyGroup>
+    <PreBuildEvent />
+  </PropertyGroup>
 </Project>
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -19,7 +19,8 @@
  */
 #endregion
-
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("a8ef5d93-c9e3-46f6-8fd6-323dee5a406b")]
   public interface ISymbolicRegressionEvaluator : ISymbolicDataAnalysisEvaluator<IRegressionProblemData> {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,5 +20,8 @@
 #endregion
 
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("a411e2b5-f926-41a6-b55b-1aef862db2fb")]
   public interface ISymbolicRegressionModel : IRegressionModel, ISymbolicDataAnalysisModel {
     void Scale(IRegressionProblemData problemData);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionMultiObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionMultiObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionMultiObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,4 +22,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("75e2b69d-b610-4694-aad9-601b9c242f89")]
   public interface ISymbolicRegressionMultiObjectiveEvaluator : ISymbolicRegressionEvaluator, ISymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData> {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSingleObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSingleObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSingleObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,4 +22,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("5dd2601a-b884-48c0-85bc-bc1f437187a3")]
   public interface ISymbolicRegressionSingleObjectiveEvaluator : ISymbolicRegressionEvaluator, ISymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData> {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSolution.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSolution.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Interfaces/ISymbolicRegressionSolution.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,6 +22,7 @@
 
 
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("dff1a450-e958-454f-bf8e-6b763fdcaff3")]
   public interface ISymbolicRegressionSolution : IRegressionSolution, ISymbolicDataAnalysisSolution {
     new ISymbolicRegressionModel Model { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredAverageSimilarityEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredAverageSimilarityEvaluator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredAverageSimilarityEvaluator.cs	(revision 17687)
@@ -0,0 +1,127 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [Item("Pearson R² & Average Similarity Evaluator", "Calculates the Pearson R² and the average similarity of a symbolic regression solution candidate.")]
+  [StorableType("FE514989-E619-48B8-AC8E-9A2202708F65")]
+  public class PearsonRSquaredAverageSimilarityEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
+    private const string StrictSimilarityParameterName = "StrictSimilarity";
+    private const string AverageSimilarityParameterName = "AverageSimilarity";
+
+    private readonly object locker = new object();
+
+    private readonly SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator SimilarityCalculator = new SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator();
+
+    public IFixedValueParameter<BoolValue> StrictSimilarityParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[StrictSimilarityParameterName]; }
+    }
+
+    public ILookupParameter<DoubleValue> AverageSimilarityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[AverageSimilarityParameterName]; }
+    }
+
+    public bool StrictSimilarity {
+      get { return StrictSimilarityParameter.Value.Value; }
+    }
+
+    [StorableConstructor]
+    protected PearsonRSquaredAverageSimilarityEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected PearsonRSquaredAverageSimilarityEvaluator(PearsonRSquaredAverageSimilarityEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PearsonRSquaredAverageSimilarityEvaluator(this, cloner);
+    }
+
+    public PearsonRSquaredAverageSimilarityEvaluator() : base() {
+      Parameters.Add(new FixedValueParameter<BoolValue>(StrictSimilarityParameterName, "Use strict similarity calculation.", new BoolValue(false)));
+      Parameters.Add(new LookupParameter<DoubleValue>(AverageSimilarityParameterName));
+    }
+
+    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } // maximize R² and minimize average similarity 
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      var problemData = ProblemDataParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      if (UseConstantOptimization) {
+        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, updateVariableWeights: ConstantOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
+      }
+
+      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling);
+
+      if (DecimalPlaces >= 0)
+        r2 = Math.Round(r2, DecimalPlaces);
+
+      lock (locker) {
+        if (AverageSimilarityParameter.ActualValue == null) {
+          var context = new ExecutionContext(null, SimilarityCalculator, ExecutionContext.Scope.Parent);
+          SimilarityCalculator.StrictSimilarity = StrictSimilarity;
+          SimilarityCalculator.Execute(context, CancellationToken);
+        }
+      }
+      var avgSimilarity = AverageSimilarityParameter.ActualValue.Value;
+
+      QualitiesParameter.ActualValue = new DoubleArray(new[] { r2, avgSimilarity });
+      return base.InstrumentedApply();
+    }
+
+    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      AverageSimilarityParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling);
+
+      lock (locker) {
+        if (AverageSimilarityParameter.ActualValue == null) {
+          var ctx = new ExecutionContext(null, SimilarityCalculator, context.Scope.Parent);
+          SimilarityCalculator.StrictSimilarity = StrictSimilarity;
+          SimilarityCalculator.Execute(context, CancellationToken);
+        }
+      }
+      var avgSimilarity = AverageSimilarityParameter.ActualValue.Value;
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+
+      return new[] { r2, avgSimilarity };
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs	(revision 17687)
@@ -0,0 +1,87 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [Item("Pearson R² & Nested Tree size Evaluator", "Calculates the Pearson R² and the nested tree size of a symbolic regression solution.")]
+  [StorableType("37486F27-9BA0-4C89-BB2F-6823E4FB317A")]
+  public class PearsonRSquaredNestedTreeSizeEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
+    [StorableConstructor]
+    protected PearsonRSquaredNestedTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected PearsonRSquaredNestedTreeSizeEvaluator(PearsonRSquaredNestedTreeSizeEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PearsonRSquaredNestedTreeSizeEvaluator(this, cloner);
+    }
+
+    public PearsonRSquaredNestedTreeSizeEvaluator() : base() { }
+
+    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } // maximize R² & minimize nested tree size
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      var problemData = ProblemDataParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      if (UseConstantOptimization) {
+        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, updateVariableWeights: ConstantOptimizationUpdateVariableWeights,lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
+      }
+
+      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
+      QualitiesParameter.ActualValue = new DoubleArray(qualities);
+      return base.InstrumentedApply();
+    }
+
+    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
+      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
+      if (decimalPlaces >= 0)
+        r2 = Math.Round(r2, decimalPlaces);
+      return new double[2] { r2, solution.IterateNodesPostfix().Sum(n => n.GetLength()) }; // sum of the length of the whole sub-tree for each node 
+    }
+
+    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+      // DecimalPlaces parameter is a FixedValueParameter and doesn't need the context.
+
+      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces); 
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+
+      return quality;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs	(revision 17687)
@@ -0,0 +1,86 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [Item("Pearson R² & Number of Variables Evaluator", "Calculates the Pearson R² and the number of used variables of a symbolic regression solution.")]
+  [StorableType("DF68BE26-D76C-4CB7-BB38-CBBB4391FE86")]
+  public class PearsonRSquaredNumberOfVariablesEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
+    [StorableConstructor]
+    protected PearsonRSquaredNumberOfVariablesEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected PearsonRSquaredNumberOfVariablesEvaluator(PearsonRSquaredNumberOfVariablesEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PearsonRSquaredNumberOfVariablesEvaluator(this, cloner);
+    }
+
+    public PearsonRSquaredNumberOfVariablesEvaluator() : base() { }
+
+    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } // maximize R² and minimize the number of variables
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      var problemData = ProblemDataParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      if (UseConstantOptimization) {
+        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, updateVariableWeights: ConstantOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
+      }
+      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
+      QualitiesParameter.ActualValue = new DoubleArray(qualities);
+      return base.InstrumentedApply();
+    }
+
+    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
+      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
+      if (decimalPlaces >= 0)
+        r2 = Math.Round(r2, decimalPlaces);
+      return new double[2] { r2, solution.IterateNodesPostfix().OfType<IVariableTreeNode>().Count() }; // count the number of variables
+    }
+
+    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+      // DecimalPlaces parameter is a FixedValueParameter and doesn't need the context.
+
+      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+
+      return quality;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs	(revision 17687)
@@ -0,0 +1,85 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [Item("Pearson R² & Tree Complexity Evaluator", "Calculates the Pearson R² and the tree complexity of a symbolic regression solution.")]
+  [StorableType("FD8705F5-1CFE-4410-A013-48E193EFADC9")]
+  public class PearsonRSquaredTreeComplexityEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
+    [StorableConstructor]
+    protected PearsonRSquaredTreeComplexityEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected PearsonRSquaredTreeComplexityEvaluator(PearsonRSquaredTreeComplexityEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PearsonRSquaredTreeComplexityEvaluator(this, cloner);
+    }
+
+    public PearsonRSquaredTreeComplexityEvaluator() : base() { }
+
+    public override IEnumerable<bool> Maximization { get { return new bool[2] { true, false }; } } // maximize R² and minimize model complexity 
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      var problemData = ProblemDataParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      if (UseConstantOptimization) {
+        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, updateVariableWeights: ConstantOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
+      }
+      double[] qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling, DecimalPlaces);
+      QualitiesParameter.ActualValue = new DoubleArray(qualities);
+      return base.InstrumentedApply();
+    }
+
+    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
+      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
+      if (decimalPlaces >= 0)
+        r2 = Math.Round(r2, decimalPlaces);
+      return new double[2] { r2, SymbolicDataAnalysisModelComplexityCalculator.CalculateComplexity(solution) };
+    }
+
+    public override double[] Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+      // DecimalPlaces parameter is a FixedValueParameter and doesn't need the context.
+
+      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+
+      return quality;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,14 +22,80 @@
 
 using HeuristicLab.Common;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("1BEEE472-95E7-45C3-BD47-883B5E3A672D")]
   public abstract class SymbolicRegressionMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionMultiObjectiveEvaluator {
+    private const string DecimalPlacesParameterName = "Decimal Places";
+    private const string UseConstantOptimizationParameterName = "Use constant optimization";
+    private const string ConstantOptimizationIterationsParameterName = "Constant optimization iterations";
+
+    private const string ConstantOptimizationUpdateVariableWeightsParameterName =
+      "Constant optimization update variable weights";
+
+    public IFixedValueParameter<IntValue> DecimalPlacesParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[DecimalPlacesParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[UseConstantOptimizationParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptimizationIterationsParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> ConstantOptimizationUpdateVariableWeightsParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[ConstantOptimizationUpdateVariableWeightsParameterName]; }
+    }
+
+    public int DecimalPlaces {
+      get { return DecimalPlacesParameter.Value.Value; }
+      set { DecimalPlacesParameter.Value.Value = value; }
+    }
+    public bool UseConstantOptimization {
+      get { return UseConstantOptimizationParameter.Value.Value; }
+      set { UseConstantOptimizationParameter.Value.Value = value; }
+    }
+    public int ConstantOptimizationIterations {
+      get { return ConstantOptimizationIterationsParameter.Value.Value; }
+      set { ConstantOptimizationIterationsParameter.Value.Value = value; }
+    }
+    public bool ConstantOptimizationUpdateVariableWeights {
+      get { return ConstantOptimizationUpdateVariableWeightsParameter.Value.Value; }
+      set { ConstantOptimizationUpdateVariableWeightsParameter.Value.Value = value; }
+    }
+
     [StorableConstructor]
-    protected SymbolicRegressionMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionMultiObjectiveEvaluator(SymbolicRegressionMultiObjectiveEvaluator original, Cloner cloner)
       : base(original, cloner) {
     }
 
-    protected SymbolicRegressionMultiObjectiveEvaluator() : base() { }
+    protected SymbolicRegressionMultiObjectiveEvaluator()
+      : base() {
+      Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(5)) { Hidden = true });
+      Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)) { Hidden = true });
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(UseConstantOptimizationParameterName)) {
+        Parameters.Add(new FixedValueParameter<BoolValue>(UseConstantOptimizationParameterName, "", new BoolValue(false)));
+      }
+      if (!Parameters.ContainsKey(DecimalPlacesParameterName)) {
+        Parameters.Add(new FixedValueParameter<IntValue>(DecimalPlacesParameterName, "The number of decimal places used for rounding the quality values.", new IntValue(-1)) { Hidden = true });
+      }
+      if (!Parameters.ContainsKey(ConstantOptimizationIterationsParameterName)) {
+        Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "The number of iterations constant optimization should be applied.", new IntValue(5)));
+      }
+      if (!Parameters.ContainsKey(ConstantOptimizationUpdateVariableWeightsParameterName)) {
+        Parameters.Add(new FixedValueParameter<BoolValue>(ConstantOptimizationUpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized during constant optimization.", new BoolValue(true)));
+      }
+    }
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using HeuristicLab.Common;
@@ -25,12 +26,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Mean squared error & Tree size Evaluator", "Calculates the mean squared error and the tree size of a symbolic regression solution.")]
-  [StorableClass]
+  [StorableType("B1EFB303-9C37-4CBB-8269-BDBC223D9086")]
   public class SymbolicRegressionMultiObjectiveMeanSquaredErrorSolutionSizeEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicRegressionMultiObjectiveMeanSquaredErrorSolutionSizeEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionMultiObjectiveMeanSquaredErrorSolutionSizeEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionMultiObjectiveMeanSquaredErrorSolutionSizeEvaluator(SymbolicRegressionMultiObjectiveMeanSquaredErrorSolutionSizeEvaluator original, Cloner cloner)
       : base(original, cloner) {
@@ -47,25 +48,25 @@
       IEnumerable<int> rows = GenerateRowsToEvaluate();
       var solution = SymbolicExpressionTreeParameter.ActualValue;
-      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value);
+      var problemData = ProblemDataParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      if (UseConstantOptimization) {
+        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, updateVariableWeights: ConstantOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
+      }
+
+      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
       QualitiesParameter.ActualValue = new DoubleArray(qualities);
       return base.InstrumentedApply();
     }
 
-    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling) {
-      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
-      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
-      OnlineCalculatorError errorState;
+    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
+      var mse = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(interpreter, solution, lowerEstimationLimit,
+        upperEstimationLimit, problemData, rows, applyLinearScaling);
 
-      double mse;
-      if (applyLinearScaling) {
-        var mseCalculator = new OnlineMeanSquaredErrorCalculator();
-        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, mseCalculator, problemData.Dataset.Rows);
-        errorState = mseCalculator.ErrorState;
-        mse = mseCalculator.MeanSquaredError;
-      } else {
-        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
-        mse = OnlineMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
-      }
-      if (errorState != OnlineCalculatorError.None) mse = double.NaN;
+      if (decimalPlaces >= 0)
+        mse = Math.Round(mse, decimalPlaces);
+
       return new double[2] { mse, solution.Length };
     }
@@ -76,5 +77,5 @@
       ApplyLinearScalingParameter.ExecutionContext = context;
 
-      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value);
+      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
 
       SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using HeuristicLab.Common;
@@ -25,12 +26,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Pearson R² & Tree size Evaluator", "Calculates the Pearson R² and the tree size of a symbolic regression solution.")]
-  [StorableClass]
+  [StorableType("58008433-3406-4374-9BF1-1C5EF944350A")]
   public class SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator : SymbolicRegressionMultiObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator(SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator original, Cloner cloner)
       : base(original, cloner) {
@@ -47,26 +48,21 @@
       IEnumerable<int> rows = GenerateRowsToEvaluate();
       var solution = SymbolicExpressionTreeParameter.ActualValue;
-      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value);
+      var problemData = ProblemDataParameter.ActualValue;
+      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
+
+      if (UseConstantOptimization) {
+        SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, applyLinearScaling, ConstantOptimizationIterations, updateVariableWeights: ConstantOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
+      }
+      double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
       QualitiesParameter.ActualValue = new DoubleArray(qualities);
       return base.InstrumentedApply();
     }
 
-    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling) {
-      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
-      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
-      OnlineCalculatorError errorState;
-
-      double r2;
-      if (applyLinearScaling) {
-        var r2Calculator = new OnlinePearsonsRSquaredCalculator();
-        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r2Calculator, problemData.Dataset.Rows);
-        errorState = r2Calculator.ErrorState;
-        r2 = r2Calculator.RSquared;
-      } else {
-        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
-        r2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
-      }
-
-      if (errorState != OnlineCalculatorError.None) r2 = double.NaN;
+    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
+      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
+      if (decimalPlaces >= 0)
+        r2 = Math.Round(r2, decimalPlaces);
       return new double[2] { r2, solution.Length };
     }
@@ -77,5 +73,5 @@
       ApplyLinearScalingParameter.ExecutionContext = context;
 
-      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value);
+      double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
 
       SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,11 +24,12 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [Item("Symbolic Regression Problem (multi objective)", "Represents a multi objective symbolic regression problem.")]
-  [StorableClass]
-  [Creatable("Problems")]
+  [Item("Symbolic Regression Problem (multi-objective)", "Represents a multi objective symbolic regression problem.")]
+  [StorableType("4A8D3658-66B3-48B4-B983-D46409045DBE")]
+  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 110)]
   public class SymbolicRegressionMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IRegressionProblemData, ISymbolicRegressionMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem {
     private const double PunishmentFactor = 10;
@@ -52,5 +53,5 @@
 
     [StorableConstructor]
-    protected SymbolicRegressionMultiObjectiveProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionMultiObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionMultiObjectiveProblem(SymbolicRegressionMultiObjectiveProblem original, Cloner cloner)
       : base(original, cloner) {
@@ -93,4 +94,6 @@
       Operators.Add(new SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer());
       Operators.Add(new SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer());
+      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
+      Operators.Add(new SymbolicRegressionPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()));
       ParameterizeOperators();
     }
@@ -122,4 +125,15 @@
         }
       }
+
+      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
+        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        op.QualityVariableName = Evaluator.QualitiesParameter.ActualName;
+
+        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
+          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
+          phenotypicSimilarityCalculator.ProblemData = ProblemData;
+          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
+        }
+      }
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,9 +20,14 @@
 #endregion
 
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -31,5 +36,5 @@
   /// </summary>
   [Item("SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic regression solution for multi objective symbolic regression problems.")]
-  [StorableClass]
+  [StorableType("431B0046-3115-493F-BD15-E3DA98E3E9C7")]
   public sealed class SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<ISymbolicRegressionSolution>,
     ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator {
@@ -37,4 +42,8 @@
     private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
     private const string EstimationLimitsParameterName = "EstimationLimits";
+    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
+    private const string ValidationPartitionParameterName = "ValidationPartition";
+    private const string AnalyzeTestErrorParameterName = "Analyze Test Error";
+
     #region parameter properties
     public ILookupParameter<IRegressionProblemData> ProblemDataParameter {
@@ -47,14 +56,43 @@
       get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
     }
+    public ILookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
+    }
+
+    public IValueLookupParameter<IntRange> ValidationPartitionParameter {
+      get { return (IValueLookupParameter<IntRange>)Parameters[ValidationPartitionParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> AnalyzeTestErrorParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[AnalyzeTestErrorParameterName]; }
+    }
     #endregion
 
+    public bool AnalyzeTestError {
+      get { return AnalyzeTestErrorParameter.Value.Value; }
+      set { AnalyzeTestErrorParameter.Value.Value = value; }
+    }
+
     [StorableConstructor]
-    private SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer(SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionMultiObjectiveTrainingBestSolutionAnalyzer()
       : base() {
-      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution."));
-      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
-      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
+      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution.") { Hidden = true });
+      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model.") { Hidden = true });
+      Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
+      Parameters.Add(new FixedValueParameter<BoolValue>(AnalyzeTestErrorParameterName, "Flag whether the test error should be displayed in the Pareto-Front", new BoolValue(false)));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(MaximumSymbolicExpressionTreeLengthParameterName))
+        Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression.") { Hidden = true });
+      if (!Parameters.ContainsKey(ValidationPartitionParameterName))
+        Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
+      if (!Parameters.ContainsKey(AnalyzeTestErrorParameterName))
+        Parameters.Add(new FixedValueParameter<BoolValue>(AnalyzeTestErrorParameterName, "Flag whether the test error should be displayed in the Pareto-Front", new BoolValue(false)));
     }
 
@@ -64,8 +102,73 @@
 
     protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
-      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
       return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
     }
+
+    public override IOperation Apply() {
+      var operation = base.Apply();
+      var paretoFront = TrainingBestSolutionsParameter.ActualValue;
+
+      IResult result;
+      ScatterPlot qualityToTreeSize;
+      if (!ResultCollection.TryGetValue("Pareto Front Analysis", out result)) {
+        qualityToTreeSize = new ScatterPlot("Quality vs Tree Size", "");
+        qualityToTreeSize.VisualProperties.XAxisMinimumAuto = false;
+        qualityToTreeSize.VisualProperties.XAxisMaximumAuto = false;
+        qualityToTreeSize.VisualProperties.YAxisMinimumAuto = false;
+        qualityToTreeSize.VisualProperties.YAxisMaximumAuto = false;
+
+        qualityToTreeSize.VisualProperties.XAxisMinimumFixedValue = 0;
+        qualityToTreeSize.VisualProperties.XAxisMaximumFixedValue = MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value;
+        qualityToTreeSize.VisualProperties.YAxisMinimumFixedValue = 0;
+        qualityToTreeSize.VisualProperties.YAxisMaximumFixedValue = 2;
+        ResultCollection.Add(new Result("Pareto Front Analysis", qualityToTreeSize));
+      } else {
+        qualityToTreeSize = (ScatterPlot)result.Value;
+      }
+
+
+      int previousTreeLength = -1;
+      var sizeParetoFront = new LinkedList<ISymbolicRegressionSolution>();
+      foreach (var solution in paretoFront.OrderBy(s => s.Model.SymbolicExpressionTree.Length)) {
+        int treeLength = solution.Model.SymbolicExpressionTree.Length;
+        if (!sizeParetoFront.Any()) sizeParetoFront.AddLast(solution);
+        if (solution.TrainingNormalizedMeanSquaredError < sizeParetoFront.Last.Value.TrainingNormalizedMeanSquaredError) {
+          if (treeLength == previousTreeLength)
+            sizeParetoFront.RemoveLast();
+          sizeParetoFront.AddLast(solution);
+        }
+        previousTreeLength = treeLength;
+      }
+
+      qualityToTreeSize.Rows.Clear();
+      var trainingRow = new ScatterPlotDataRow("Training NMSE", "", sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TrainingNormalizedMeanSquaredError, x)));
+      trainingRow.VisualProperties.PointSize = 8;
+      qualityToTreeSize.Rows.Add(trainingRow);
+
+      if (AnalyzeTestError) {
+        var testRow = new ScatterPlotDataRow("Test NMSE", "",
+          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TestNormalizedMeanSquaredError, x)));
+        testRow.VisualProperties.PointSize = 8;
+        qualityToTreeSize.Rows.Add(testRow);
+      }
+
+      var validationPartition = ValidationPartitionParameter.ActualValue;
+      if (validationPartition.Size != 0) {
+        var problemData = ProblemDataParameter.ActualValue;
+        var validationIndizes = Enumerable.Range(validationPartition.Start, validationPartition.Size).ToList();
+        var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, validationIndizes).ToList();
+        OnlineCalculatorError error;
+        var validationRow = new ScatterPlotDataRow("Validation NMSE", "",
+          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length,
+          OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, x.GetEstimatedValues(validationIndizes), out error))));
+        validationRow.VisualProperties.PointSize = 7;
+        qualityToTreeSize.Rows.Add(validationRow);
+      }
+
+      return operation;
+    }
+
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for multi objective symbolic regression problems.")]
-  [StorableClass]
+  [StorableType("64084F75-38B9-4501-BF2D-BB342B49F732")]
   public sealed class SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionMultiObjectiveEvaluator, IRegressionProblemData>,
     ISymbolicDataAnalysisBoundedOperator {
@@ -43,5 +43,5 @@
 
     [StorableConstructor]
-    private SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer(SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer()
@@ -54,5 +54,5 @@
 
     protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
-      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
       return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Plugin.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Plugin.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Plugin.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,8 +26,7 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression","Provides classes to perform symbolic regression (single- or multiobjective).", "3.4.5.$WCREV$")]
+  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression","Provides classes to perform symbolic regression (single- or multiobjective).", "3.4.12.$WCREV$")]
   [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
-  [PluginDependency("HeuristicLab.AutoDiff", "1.0")]
   [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
@@ -39,5 +38,5 @@
   [PluginDependency("HeuristicLab.Optimization", "3.3")]
   [PluginDependency("HeuristicLab.Parameters", "3.3")]
-  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Attic", "1.0")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Properties/AssemblyInfo.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/Properties/AssemblyInfo.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,5 +31,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
+[assembly: AssemblyCopyright("(c) HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -53,3 +53,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.5.$WCREV$")]
+[assembly: AssemblyFileVersion("3.4.12.$WCREV$")]
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/ConstantOptimizationAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/ConstantOptimizationAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/ConstantOptimizationAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -28,5 +28,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -35,5 +35,5 @@
   /// </summary>
   [Item("ConstantOptimizationAnalyzer", "An operator that performs a constant optimization on the best symbolic expression trees.")]
-  [StorableClass]
+  [StorableType("9FB87E7B-A9E2-49DD-A92A-78BD9FC17916")]
   public sealed class ConstantOptimizationAnalyzer : SymbolicDataAnalysisSingleObjectiveAnalyzer, IStatefulItem {
     private const string PercentageOfBestSolutionsParameterName = "PercentageOfBestSolutions";
@@ -87,5 +87,5 @@
 
     [StorableConstructor]
-    private ConstantOptimizationAnalyzer(bool deserializing) : base(deserializing) { }
+    private ConstantOptimizationAnalyzer(StorableConstructorFlag _) : base(_) { }
     private ConstantOptimizationAnalyzer(ConstantOptimizationAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new ConstantOptimizationAnalyzer(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,15 +23,15 @@
 using System.Collections.Generic;
 using System.Linq;
-using AutoDiff;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Constant Optimization Evaluator", "Calculates Pearson R² of a symbolic regression solution and optimizes the constant used.")]
-  [StorableClass]
+  [StorableType("24B68851-036D-4446-BD6F-3823E9028FF4")]
   public class SymbolicRegressionConstantOptimizationEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     private const string ConstantOptimizationIterationsParameterName = "ConstantOptimizationIterations";
@@ -40,4 +40,9 @@
     private const string ConstantOptimizationRowsPercentageParameterName = "ConstantOptimizationRowsPercentage";
     private const string UpdateConstantsInTreeParameterName = "UpdateConstantsInSymbolicExpressionTree";
+    private const string UpdateVariableWeightsParameterName = "Update Variable Weights";
+
+    private const string FunctionEvaluationsResultParameterName = "Constants Optimization Function Evaluations";
+    private const string GradientEvaluationsResultParameterName = "Constants Optimization Gradient Evaluations";
+    private const string CountEvaluationsParameterName = "Count Function and Gradient Evaluations";
 
     public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
@@ -56,4 +61,18 @@
       get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateConstantsInTreeParameterName]; }
     }
+    public IFixedValueParameter<BoolValue> UpdateVariableWeightsParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateVariableWeightsParameterName]; }
+    }
+
+    public IResultParameter<IntValue> FunctionEvaluationsResultParameter {
+      get { return (IResultParameter<IntValue>)Parameters[FunctionEvaluationsResultParameterName]; }
+    }
+    public IResultParameter<IntValue> GradientEvaluationsResultParameter {
+      get { return (IResultParameter<IntValue>)Parameters[GradientEvaluationsResultParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> CountEvaluationsParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[CountEvaluationsParameterName]; }
+    }
+
 
     public IntValue ConstantOptimizationIterations {
@@ -74,4 +93,14 @@
     }
 
+    public bool UpdateVariableWeights {
+      get { return UpdateVariableWeightsParameter.Value.Value; }
+      set { UpdateVariableWeightsParameter.Value.Value = value; }
+    }
+
+    public bool CountEvaluations {
+      get { return CountEvaluationsParameter.Value.Value; }
+      set { CountEvaluationsParameter.Value.Value = value; }
+    }
+
     public override bool Maximization {
       get { return true; }
@@ -79,5 +108,5 @@
 
     [StorableConstructor]
-    protected SymbolicRegressionConstantOptimizationEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionConstantOptimizationEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionConstantOptimizationEvaluator(SymbolicRegressionConstantOptimizationEvaluator original, Cloner cloner)
       : base(original, cloner) {
@@ -85,9 +114,14 @@
     public SymbolicRegressionConstantOptimizationEvaluator()
       : base() {
-      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10), true));
-      Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0), true));
-      Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1), true));
-      Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1), true));
-      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0)) { Hidden = true });
+      Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1)));
+      Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true)) { Hidden = true });
+      Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be  optimized.", new BoolValue(true)) { Hidden = true });
+
+      Parameters.Add(new FixedValueParameter<BoolValue>(CountEvaluationsParameterName, "Determines if function and gradient evaluation should be counted.", new BoolValue(false)));
+      Parameters.Add(new ResultParameter<IntValue>(FunctionEvaluationsResultParameterName, "The number of function evaluations performed by the constants optimization evaluator", "Results", new IntValue()));
+      Parameters.Add(new ResultParameter<IntValue>(GradientEvaluationsResultParameterName, "The number of gradient evaluations performed by the constants optimization evaluator", "Results", new IntValue()));
     }
 
@@ -100,6 +134,17 @@
       if (!Parameters.ContainsKey(UpdateConstantsInTreeParameterName))
         Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true)));
-    }
-
+      if (!Parameters.ContainsKey(UpdateVariableWeightsParameterName))
+        Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be  optimized.", new BoolValue(true)));
+
+      if (!Parameters.ContainsKey(CountEvaluationsParameterName))
+        Parameters.Add(new FixedValueParameter<BoolValue>(CountEvaluationsParameterName, "Determines if function and gradient evaluation should be counted.", new BoolValue(false)));
+
+      if (!Parameters.ContainsKey(FunctionEvaluationsResultParameterName))
+        Parameters.Add(new ResultParameter<IntValue>(FunctionEvaluationsResultParameterName, "The number of function evaluations performed by the constants optimization evaluator", "Results", new IntValue()));
+      if (!Parameters.ContainsKey(GradientEvaluationsResultParameterName))
+        Parameters.Add(new ResultParameter<IntValue>(GradientEvaluationsResultParameterName, "The number of gradient evaluations performed by the constants optimization evaluator", "Results", new IntValue()));
+    }
+
+    private static readonly object locker = new object();
     public override IOperation InstrumentedApply() {
       var solution = SymbolicExpressionTreeParameter.ActualValue;
@@ -107,7 +152,7 @@
       if (RandomParameter.ActualValue.NextDouble() < ConstantOptimizationProbability.Value) {
         IEnumerable<int> constantOptimizationRows = GenerateRowsToEvaluate(ConstantOptimizationRowsPercentage.Value);
+        var counter = new EvaluationsCounter();
         quality = OptimizeConstants(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, ProblemDataParameter.ActualValue,
-           constantOptimizationRows, ApplyLinearScalingParameter.ActualValue.Value, ConstantOptimizationIterations.Value,
-           EstimationLimitsParameter.ActualValue.Upper, EstimationLimitsParameter.ActualValue.Lower, UpdateConstantsInTree);
+           constantOptimizationRows, ApplyLinearScalingParameter.ActualValue.Value, ConstantOptimizationIterations.Value, updateVariableWeights: UpdateVariableWeights, lowerEstimationLimit: EstimationLimitsParameter.ActualValue.Lower, upperEstimationLimit: EstimationLimitsParameter.ActualValue.Upper, updateConstantsInTree: UpdateConstantsInTree, counter: counter);
 
         if (ConstantOptimizationRowsPercentage.Value != RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value) {
@@ -115,4 +160,12 @@
           quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, evaluationRows, ApplyLinearScalingParameter.ActualValue.Value);
         }
+
+        if (CountEvaluations) {
+          lock (locker) {
+            FunctionEvaluationsResultParameter.ActualValue.Value += counter.FunctionEvaluations;
+            GradientEvaluationsResultParameter.ActualValue.Value += counter.GradientEvaluations;
+          }
+        }
+
       } else {
         var evaluationRows = GenerateRowsToEvaluate();
@@ -128,4 +181,6 @@
       EstimationLimitsParameter.ExecutionContext = context;
       ApplyLinearScalingParameter.ExecutionContext = context;
+      FunctionEvaluationsResultParameter.ExecutionContext = context;
+      GradientEvaluationsResultParameter.ExecutionContext = context;
 
       // Pearson R² evaluator is used on purpose instead of the const-opt evaluator, 
@@ -137,78 +192,68 @@
       EstimationLimitsParameter.ExecutionContext = null;
       ApplyLinearScalingParameter.ExecutionContext = null;
+      FunctionEvaluationsResultParameter.ExecutionContext = null;
+      GradientEvaluationsResultParameter.ExecutionContext = null;
 
       return r2;
     }
 
-    #region derivations of functions
-    // create function factory for arctangent
-    private readonly Func<Term, UnaryFunc> arctan = UnaryFunc.Factory(
-      eval: Math.Atan,
-      diff: x => 1 / (1 + x * x));
-    private static readonly Func<Term, UnaryFunc> sin = UnaryFunc.Factory(
-      eval: Math.Sin,
-      diff: Math.Cos);
-    private static readonly Func<Term, UnaryFunc> cos = UnaryFunc.Factory(
-       eval: Math.Cos,
-       diff: x => -Math.Sin(x));
-    private static readonly Func<Term, UnaryFunc> tan = UnaryFunc.Factory(
-      eval: Math.Tan,
-      diff: x => 1 + Math.Tan(x) * Math.Tan(x));
-    private static readonly Func<Term, UnaryFunc> square = UnaryFunc.Factory(
-       eval: x => x * x,
-       diff: x => 2 * x);
-    private static readonly Func<Term, UnaryFunc> erf = UnaryFunc.Factory(
-      eval: alglib.errorfunction,
-      diff: x => 2.0 * Math.Exp(-(x * x)) / Math.Sqrt(Math.PI));
-    private static readonly Func<Term, UnaryFunc> norm = UnaryFunc.Factory(
-      eval: alglib.normaldistribution,
-      diff: x => -(Math.Exp(-(x * x)) * Math.Sqrt(Math.Exp(x * x)) * x) / Math.Sqrt(2 * Math.PI));
-    #endregion
-
-
-    public static double OptimizeConstants(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, IRegressionProblemData problemData,
-      IEnumerable<int> rows, bool applyLinearScaling, int maxIterations, double upperEstimationLimit = double.MaxValue, double lowerEstimationLimit = double.MinValue, bool updateConstantsInTree = true) {
-
-      List<AutoDiff.Variable> variables = new List<AutoDiff.Variable>();
-      List<AutoDiff.Variable> parameters = new List<AutoDiff.Variable>();
-      List<string> variableNames = new List<string>();
-
-      AutoDiff.Term func;
-      if (!TryTransformToAutoDiff(tree.Root.GetSubtree(0), variables, parameters, variableNames, out func))
+    public class EvaluationsCounter {
+      public int FunctionEvaluations = 0;
+      public int GradientEvaluations = 0;
+    }
+
+    public static double OptimizeConstants(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
+      ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling,
+      int maxIterations, bool updateVariableWeights = true,
+      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue,
+      bool updateConstantsInTree = true, Action<double[], double, object> iterationCallback = null, EvaluationsCounter counter = null) {
+
+      // numeric constants in the tree become variables for constant opt
+      // variables in the tree become parameters (fixed values) for constant opt
+      // for each parameter (variable in the original tree) we store the 
+      // variable name, variable value (for factor vars) and lag as a DataForVariable object.
+      // A dictionary is used to find parameters
+      double[] initialConstants;
+      var parameters = new List<TreeToAutoDiffTermConverter.DataForVariable>();
+
+      TreeToAutoDiffTermConverter.ParametricFunction func;
+      TreeToAutoDiffTermConverter.ParametricFunctionGradient func_grad;
+      if (!TreeToAutoDiffTermConverter.TryConvertToAutoDiff(tree, updateVariableWeights, applyLinearScaling, out parameters, out initialConstants, out func, out func_grad))
         throw new NotSupportedException("Could not optimize constants of symbolic expression tree due to not supported symbols used in the tree.");
-      if (variableNames.Count == 0) return 0.0;
-
-      AutoDiff.IParametricCompiledTerm compiledFunc = AutoDiff.TermUtils.Compile(func, variables.ToArray(), parameters.ToArray());
-
-      List<SymbolicExpressionTreeTerminalNode> terminalNodes = tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>().ToList();
-      double[] c = new double[variables.Count];
-
-      {
+      if (parameters.Count == 0) return 0.0; // gkronber: constant expressions always have a R² of 0.0 
+      var parameterEntries = parameters.ToArray(); // order of entries must be the same for x
+
+      //extract inital constants
+      double[] c;
+      if (applyLinearScaling) {
+        c = new double[initialConstants.Length + 2];
         c[0] = 0.0;
         c[1] = 1.0;
-        //extract inital constants
-        int i = 2;
-        foreach (var node in terminalNodes) {
-          ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
-          VariableTreeNode variableTreeNode = node as VariableTreeNode;
-          if (constantTreeNode != null)
-            c[i++] = constantTreeNode.Value;
-          else if (variableTreeNode != null)
-            c[i++] = variableTreeNode.Weight;
-        }
-      }
-      double[] originalConstants = (double[])c.Clone();
+        Array.Copy(initialConstants, 0, c, 2, initialConstants.Length);
+      } else {
+        c = (double[])initialConstants.Clone();
+      }
+
       double originalQuality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
+
+      if (counter == null) counter = new EvaluationsCounter();
+      var rowEvaluationsCounter = new EvaluationsCounter();
 
       alglib.lsfitstate state;
       alglib.lsfitreport rep;
-      int info;
-
-      Dataset ds = problemData.Dataset;
-      double[,] x = new double[rows.Count(), variableNames.Count];
+      int retVal;
+
+      IDataset ds = problemData.Dataset;
+      double[,] x = new double[rows.Count(), parameters.Count];
       int row = 0;
       foreach (var r in rows) {
-        for (int col = 0; col < variableNames.Count; col++) {
-          x[row, col] = ds.GetDoubleValue(variableNames[col], r);
+        int col = 0;
+        foreach (var info in parameterEntries) {
+          if (ds.VariableHasType<double>(info.variableName)) {
+            x[row, col] = ds.GetDoubleValue(info.variableName, r + info.lag);
+          } else if (ds.VariableHasType<string>(info.variableName)) {
+            x[row, col] = ds.GetStringValue(info.variableName, r) == info.variableValue ? 1 : 0;
+          } else throw new InvalidProgramException("found a variable of unknown type");
+          col++;
         }
         row++;
@@ -219,28 +264,38 @@
       int k = c.Length;
 
-      alglib.ndimensional_pfunc function_cx_1_func = CreatePFunc(compiledFunc);
-      alglib.ndimensional_pgrad function_cx_1_grad = CreatePGrad(compiledFunc);
+      alglib.ndimensional_pfunc function_cx_1_func = CreatePFunc(func);
+      alglib.ndimensional_pgrad function_cx_1_grad = CreatePGrad(func_grad);
+      alglib.ndimensional_rep xrep = (p, f, obj) => iterationCallback(p, f, obj);
 
       try {
         alglib.lsfitcreatefg(x, y, c, n, m, k, false, out state);
         alglib.lsfitsetcond(state, 0.0, 0.0, maxIterations);
+        alglib.lsfitsetxrep(state, iterationCallback != null);
         //alglib.lsfitsetgradientcheck(state, 0.001);
-        alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, null, null);
-        alglib.lsfitresults(state, out info, out c, out rep);
-      }
-      catch (ArithmeticException) {
+        alglib.lsfitfit(state, function_cx_1_func, function_cx_1_grad, xrep, rowEvaluationsCounter);
+        alglib.lsfitresults(state, out retVal, out c, out rep);
+      } catch (ArithmeticException) {
         return originalQuality;
-      }
-      catch (alglib.alglibexception) {
+      } catch (alglib.alglibexception) {
         return originalQuality;
       }
 
-      //info == -7  => constant optimization failed due to wrong gradient
-      if (info != -7) UpdateConstants(tree, c.Skip(2).ToArray());
+      counter.FunctionEvaluations += rowEvaluationsCounter.FunctionEvaluations / n;
+      counter.GradientEvaluations += rowEvaluationsCounter.GradientEvaluations / n;
+
+      //retVal == -7  => constant optimization failed due to wrong gradient
+      if (retVal != -7) {
+        if (applyLinearScaling) {
+          var tmp = new double[c.Length - 2];
+          Array.Copy(c, 2, tmp, 0, tmp.Length);
+          UpdateConstants(tree, tmp, updateVariableWeights);
+        } else UpdateConstants(tree, c, updateVariableWeights);
+      }
       var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
 
-      if (!updateConstantsInTree) UpdateConstants(tree, originalConstants.Skip(2).ToArray());
+      if (!updateConstantsInTree) UpdateConstants(tree, initialConstants, updateVariableWeights);
+
       if (originalQuality - quality > 0.001 || double.IsNaN(quality)) {
-        UpdateConstants(tree, originalConstants.Skip(2).ToArray());
+        UpdateConstants(tree, initialConstants, updateVariableWeights);
         return originalQuality;
       }
@@ -248,230 +303,40 @@
     }
 
-    private static void UpdateConstants(ISymbolicExpressionTree tree, double[] constants) {
+    private static void UpdateConstants(ISymbolicExpressionTree tree, double[] constants, bool updateVariableWeights) {
       int i = 0;
       foreach (var node in tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>()) {
         ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
-        VariableTreeNode variableTreeNode = node as VariableTreeNode;
+        VariableTreeNodeBase variableTreeNodeBase = node as VariableTreeNodeBase;
+        FactorVariableTreeNode factorVarTreeNode = node as FactorVariableTreeNode;
         if (constantTreeNode != null)
           constantTreeNode.Value = constants[i++];
-        else if (variableTreeNode != null)
-          variableTreeNode.Weight = constants[i++];
-      }
-    }
-
-    private static alglib.ndimensional_pfunc CreatePFunc(AutoDiff.IParametricCompiledTerm compiledFunc) {
-      return (double[] c, double[] x, ref double func, object o) => {
-        func = compiledFunc.Evaluate(c, x);
+        else if (updateVariableWeights && variableTreeNodeBase != null)
+          variableTreeNodeBase.Weight = constants[i++];
+        else if (factorVarTreeNode != null) {
+          for (int j = 0; j < factorVarTreeNode.Weights.Length; j++)
+            factorVarTreeNode.Weights[j] = constants[i++];
+        }
+      }
+    }
+
+    private static alglib.ndimensional_pfunc CreatePFunc(TreeToAutoDiffTermConverter.ParametricFunction func) {
+      return (double[] c, double[] x, ref double fx, object o) => {
+        fx = func(c, x);
+        var counter = (EvaluationsCounter)o;
+        counter.FunctionEvaluations++;
       };
     }
 
-    private static alglib.ndimensional_pgrad CreatePGrad(AutoDiff.IParametricCompiledTerm compiledFunc) {
-      return (double[] c, double[] x, ref double func, double[] grad, object o) => {
-        var tupel = compiledFunc.Differentiate(c, x);
-        func = tupel.Item2;
-        Array.Copy(tupel.Item1, grad, grad.Length);
+    private static alglib.ndimensional_pgrad CreatePGrad(TreeToAutoDiffTermConverter.ParametricFunctionGradient func_grad) {
+      return (double[] c, double[] x, ref double fx, double[] grad, object o) => {
+        var tuple = func_grad(c, x);
+        fx = tuple.Item2;
+        Array.Copy(tuple.Item1, grad, grad.Length);
+        var counter = (EvaluationsCounter)o;
+        counter.GradientEvaluations++;
       };
     }
-
-    private static bool TryTransformToAutoDiff(ISymbolicExpressionTreeNode node, List<AutoDiff.Variable> variables, List<AutoDiff.Variable> parameters, List<string> variableNames, out AutoDiff.Term term) {
-      if (node.Symbol is Constant) {
-        var var = new AutoDiff.Variable();
-        variables.Add(var);
-        term = var;
-        return true;
-      }
-      if (node.Symbol is Variable) {
-        var varNode = node as VariableTreeNode;
-        var par = new AutoDiff.Variable();
-        parameters.Add(par);
-        variableNames.Add(varNode.VariableName);
-        var w = new AutoDiff.Variable();
-        variables.Add(w);
-        term = AutoDiff.TermBuilder.Product(w, par);
-        return true;
-      }
-      if (node.Symbol is Addition) {
-        List<AutoDiff.Term> terms = new List<Term>();
-        foreach (var subTree in node.Subtrees) {
-          AutoDiff.Term t;
-          if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, out t)) {
-            term = null;
-            return false;
-          }
-          terms.Add(t);
-        }
-        term = AutoDiff.TermBuilder.Sum(terms);
-        return true;
-      }
-      if (node.Symbol is Subtraction) {
-        List<AutoDiff.Term> terms = new List<Term>();
-        for (int i = 0; i < node.SubtreeCount; i++) {
-          AutoDiff.Term t;
-          if (!TryTransformToAutoDiff(node.GetSubtree(i), variables, parameters, variableNames, out t)) {
-            term = null;
-            return false;
-          }
-          if (i > 0) t = -t;
-          terms.Add(t);
-        }
-        term = AutoDiff.TermBuilder.Sum(terms);
-        return true;
-      }
-      if (node.Symbol is Multiplication) {
-        AutoDiff.Term a, b;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out a) ||
-          !TryTransformToAutoDiff(node.GetSubtree(1), variables, parameters, variableNames, out b)) {
-          term = null;
-          return false;
-        } else {
-          List<AutoDiff.Term> factors = new List<Term>();
-          foreach (var subTree in node.Subtrees.Skip(2)) {
-            AutoDiff.Term f;
-            if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, out f)) {
-              term = null;
-              return false;
-            }
-            factors.Add(f);
-          }
-          term = AutoDiff.TermBuilder.Product(a, b, factors.ToArray());
-          return true;
-        }
-      }
-      if (node.Symbol is Division) {
-        // only works for at least two subtrees
-        AutoDiff.Term a, b;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out a) ||
-          !TryTransformToAutoDiff(node.GetSubtree(1), variables, parameters, variableNames, out b)) {
-          term = null;
-          return false;
-        } else {
-          List<AutoDiff.Term> factors = new List<Term>();
-          foreach (var subTree in node.Subtrees.Skip(2)) {
-            AutoDiff.Term f;
-            if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, out f)) {
-              term = null;
-              return false;
-            }
-            factors.Add(1.0 / f);
-          }
-          term = AutoDiff.TermBuilder.Product(a, 1.0 / b, factors.ToArray());
-          return true;
-        }
-      }
-      if (node.Symbol is Logarithm) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = AutoDiff.TermBuilder.Log(t);
-          return true;
-        }
-      }
-      if (node.Symbol is Exponential) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = AutoDiff.TermBuilder.Exp(t);
-          return true;
-        }
-      } if (node.Symbol is Sine) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = sin(t);
-          return true;
-        }
-      } if (node.Symbol is Cosine) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = cos(t);
-          return true;
-        }
-      } if (node.Symbol is Tangent) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = tan(t);
-          return true;
-        }
-      }
-      if (node.Symbol is Square) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = square(t);
-          return true;
-        }
-      } if (node.Symbol is Erf) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = erf(t);
-          return true;
-        }
-      } if (node.Symbol is Norm) {
-        AutoDiff.Term t;
-        if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {
-          term = null;
-          return false;
-        } else {
-          term = norm(t);
-          return true;
-        }
-      }
-      if (node.Symbol is StartSymbol) {
-        var alpha = new AutoDiff.Variable();
-        var beta = new AutoDiff.Variable();
-        variables.Add(beta);
-        variables.Add(alpha);
-        AutoDiff.Term branchTerm;
-        if (TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out branchTerm)) {
-          term = branchTerm * alpha + beta;
-          return true;
-        } else {
-          term = null;
-          return false;
-        }
-      }
-      term = null;
-      return false;
-    }
-
     public static bool CanOptimizeConstants(ISymbolicExpressionTree tree) {
-      var containsUnknownSymbol = (
-        from n in tree.Root.GetSubtree(0).IterateNodesPrefix()
-        where
-         !(n.Symbol is Variable) &&
-         !(n.Symbol is Constant) &&
-         !(n.Symbol is Addition) &&
-         !(n.Symbol is Subtraction) &&
-         !(n.Symbol is Multiplication) &&
-         !(n.Symbol is Division) &&
-         !(n.Symbol is Logarithm) &&
-         !(n.Symbol is Exponential) &&
-         !(n.Symbol is Sine) &&
-         !(n.Symbol is Cosine) &&
-         !(n.Symbol is Tangent) &&
-         !(n.Symbol is Square) &&
-         !(n.Symbol is Erf) &&
-         !(n.Symbol is Norm) &&
-         !(n.Symbol is StartSymbol)
-        select n).
-      Any();
-      return !containsUnknownSymbol;
+      return TreeToAutoDiffTermConverter.IsCompatible(tree);
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionLogResidualEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionLogResidualEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionLogResidualEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,5 +27,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -38,8 +38,8 @@
                                   "This effects GP convergence because functional fragments which are necessary to explain small variations are also more likely" +
                                   " to stay in the population. This is useful even when the actual objective function is mean of squared errors.")]
-  [StorableClass]
+  [StorableType("8CEA1A56-167D-481B-9167-C1DED8E06680")]
   public class SymbolicRegressionLogResidualEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicRegressionLogResidualEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionLogResidualEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionLogResidualEvaluator(SymbolicRegressionLogResidualEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionMeanRelativeErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionMeanRelativeErrorEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionMeanRelativeErrorEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,5 +27,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -33,9 +33,9 @@
                                          "The +1 is necessary to handle data with the value of 0.0 correctly. " +
                                          "Notice: Linear scaling is ignored for this evaluator.")]
-  [StorableClass]
+  [StorableType("8A5AAF93-5338-4E11-B3B2-3D9274329E5F")]
   public class SymbolicRegressionMeanRelativeErrorEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     public override bool Maximization { get { return false; } }
     [StorableConstructor]
-    protected SymbolicRegressionMeanRelativeErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionMeanRelativeErrorEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionMeanRelativeErrorEvaluator(SymbolicRegressionMeanRelativeErrorEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,17 +20,11 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
 using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [StorableClass]
+  [StorableType("7EB90F03-4385-474F-BDE7-3B133E8FEAAB")]
   public abstract class SymbolicRegressionSingleObjectiveEvaluator : SymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>, ISymbolicRegressionSingleObjectiveEvaluator {  
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSingleObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSingleObjectiveEvaluator(SymbolicRegressionSingleObjectiveEvaluator original, Cloner cloner) : base(original, cloner) { }
     protected SymbolicRegressionSingleObjectiveEvaluator(): base() {}    
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,13 +25,13 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Maximum absolute error Evaluator", "Calculates the maximum squared error of a symbolic regression solution.")]
-  [StorableClass]
+  [StorableType("256A6405-D1EE-4D8D-963A-42C56FEE8571")]
   public class SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     public override bool Maximization { get { return false; } }
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator(SymbolicRegressionSingleObjectiveMaxAbsoluteErrorEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,13 +25,13 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Mean absolute error Evaluator", "Calculates the mean absolute error of a symbolic regression solution.")]
-  [StorableClass]
+  [StorableType("8ABB1AC3-0ACE-43AB-8E6B-B0FC925429DC")]
   public class SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     public override bool Maximization { get { return false; } }
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator(SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,13 +25,13 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Mean squared error Evaluator", "Calculates the mean squared error of a symbolic regression solution.")]
-  [StorableClass]
+  [StorableType("8D4B5243-1635-46A6-AEF9-18C9BCB725DD")]
   public class SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     public override bool Maximization { get { return false; } }
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator(SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,12 +25,12 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("Pearson R² Evaluator", "Calculates the square of the pearson correlation coefficient (also known as coefficient of determination) of a symbolic regression solution.")]
-  [StorableClass]
+  [StorableType("6FAEC6C2-C747-452A-A60D-29AE37898A90")]
   public class SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator(SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator original, Cloner cloner)
       : base(original, cloner) {
@@ -59,16 +59,16 @@
       OnlineCalculatorError errorState;
 
-      double r2;
+      double r;
       if (applyLinearScaling) {
-        var r2Calculator = new OnlinePearsonsRSquaredCalculator();
-        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r2Calculator, problemData.Dataset.Rows);
-        errorState = r2Calculator.ErrorState;
-        r2 = r2Calculator.RSquared;
+        var rCalculator = new OnlinePearsonsRCalculator();
+        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, rCalculator, problemData.Dataset.Rows);
+        errorState = rCalculator.ErrorState;
+        r = rCalculator.R;
       } else {
         IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
-        r2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
+        r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
       }
       if (errorState != OnlineCalculatorError.None) return double.NaN;
-      return r2;
+      return r*r;
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -28,9 +28,9 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("SymbolicRegressionSingleObjectiveOverfittingAnalyzer", "Calculates and tracks correlation of training and validation fitness of symbolic regression models.")]
-  [StorableClass]
+  [StorableType("AE1F0A23-BEB1-47AF-8ECF-DBCFD32AA5A9")]
   public sealed class SymbolicRegressionSingleObjectiveOverfittingAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData> {
     private const string TrainingValidationCorrelationParameterName = "Training and validation fitness correlation";
@@ -59,5 +59,5 @@
 
     [StorableConstructor]
-    private SymbolicRegressionSingleObjectiveOverfittingAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionSingleObjectiveOverfittingAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionSingleObjectiveOverfittingAnalyzer(SymbolicRegressionSingleObjectiveOverfittingAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionSingleObjectiveOverfittingAnalyzer()
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,11 +23,12 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [Item("Symbolic Regression Problem (single objective)", "Represents a single objective symbolic regression problem.")]
-  [StorableClass]
-  [Creatable("Problems")]
+  [Item("Symbolic Regression Problem (single-objective)", "Represents a single objective symbolic regression problem.")]
+  [StorableType("7DDCF683-96FC-4F70-BF4F-FE3A0B0DE6E0")]
+  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 100)]
   public class SymbolicRegressionSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IRegressionProblemData, ISymbolicRegressionSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem {
     private const double PunishmentFactor = 10;
@@ -48,5 +49,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicRegressionSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSingleObjectiveProblem(SymbolicRegressionSingleObjectiveProblem original, Cloner cloner)
       : base(original, cloner) {
@@ -111,5 +112,6 @@
       Operators.Add(new SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer());
       Operators.Add(new SymbolicRegressionSolutionsAnalyzer());
-
+      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
+      Operators.Add(new SymbolicRegressionPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()) { DiversityResultName = "Phenotypic Diversity" });
       ParameterizeOperators();
     }
@@ -141,4 +143,15 @@
         }
       }
+
+      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
+        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
+
+        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
+          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
+          phenotypicSimilarityCalculator.ProblemData = ProblemData;
+          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
+        }
+      }
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic regression solution for single objective symbolic regression problems.")]
-  [StorableClass]
+  [StorableType("85786F8E-F84D-4909-9A66-620668B0C7FB")]
   public sealed class SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicRegressionSolution>,
   ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator {
@@ -50,5 +50,5 @@
 
     [StorableConstructor]
-    private SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer(SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer()
@@ -63,5 +63,5 @@
 
     protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
-      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
       return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,5 +23,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -30,9 +30,9 @@
   /// </summary>
   [Item("SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that collects the training Pareto-best symbolic regression solutions for single objective symbolic regression problems.")]
-  [StorableClass]
+  [StorableType("8FDF5528-8E95-44D6-AFFD-433B4AA55559")]
   public sealed class SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<IRegressionProblemData, ISymbolicRegressionSolution> {
 
     [StorableConstructor]
-    private SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer() : base() { }
@@ -42,5 +42,5 @@
 
     protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree) {
-      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
       return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -31,5 +31,5 @@
   /// </summary>
   [Item("SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic regression solution for single objective symbolic regression problems.")]
-  [StorableClass]
+  [StorableType("75E2AFFF-95B2-4FA4-8544-CF2025B65820")]
   public sealed class SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData>,
     ISymbolicDataAnalysisBoundedOperator {
@@ -43,5 +43,5 @@
 
     [StorableConstructor]
-    private SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer(SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer()
@@ -55,5 +55,5 @@
 
     protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
-      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
       return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,5 +23,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -30,8 +30,8 @@
   /// </summary>
   [Item("SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that collects the validation Pareto-best symbolic regression solutions for single objective symbolic regression problems.")]
-  [StorableClass]
+  [StorableType("B58782FE-FAC0-4B03-9210-CAE5CF74357B")]
   public sealed class SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData> {
     [StorableConstructor]
-    private SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer(SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer() : base() { }
@@ -42,5 +42,5 @@
 
     protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree) {
-      var model = new SymbolicRegressionModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
+      var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
       if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
       return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSolutionsAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSolutionsAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSolutionsAnalyzer.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,21 +22,30 @@
 #endregion
 
-using System;
 using System.Linq;
 using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Operators;
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [StorableType("789E0217-6DDC-44E8-85CC-A51A976A8FB8")]
   public class SymbolicRegressionSolutionsAnalyzer : SingleSuccessorOperator, IAnalyzer {
     private const string ResultCollectionParameterName = "Results";
     private const string RegressionSolutionQualitiesResultName = "Regression Solution Qualities";
+    private const string TrainingQualityParameterName = "TrainingRSquared";
+    private const string TestQualityParameterName = "TestRSquared";
 
     public ILookupParameter<ResultCollection> ResultCollectionParameter {
       get { return (ILookupParameter<ResultCollection>)Parameters[ResultCollectionParameterName]; }
+    }
+    public ILookupParameter<DoubleValue> TrainingQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[TrainingQualityParameterName]; }
+    }
+    public ILookupParameter<DoubleValue> TestQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[TestQualityParameterName]; }
     }
 
@@ -46,5 +55,5 @@
 
     [StorableConstructor]
-    protected SymbolicRegressionSolutionsAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionSolutionsAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicRegressionSolutionsAnalyzer(SymbolicRegressionSolutionsAnalyzer original, Cloner cloner)
       : base(original, cloner) { }
@@ -55,4 +64,18 @@
     public SymbolicRegressionSolutionsAnalyzer() {
       Parameters.Add(new LookupParameter<ResultCollection>(ResultCollectionParameterName, "The result collection to store the analysis results."));
+      Parameters.Add(new LookupParameter<DoubleValue>(TrainingQualityParameterName));
+      Parameters.Add(new LookupParameter<DoubleValue>(TestQualityParameterName));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+
+      #region Backwards compatible code, remove with 3.4
+      if (!Parameters.ContainsKey(TrainingQualityParameterName))
+        Parameters.Add(new LookupParameter<DoubleValue>(TrainingQualityParameterName));
+      if (!Parameters.ContainsKey(TestQualityParameterName))
+        Parameters.Add(new LookupParameter<DoubleValue>(TestQualityParameterName));
+      #endregion
     }
 
@@ -66,18 +89,37 @@
 
       var dataTable = (DataTable)results[RegressionSolutionQualitiesResultName].Value;
+
+      // only if the parameters are available (not available in old persisted code)
+      ILookupParameter<DoubleValue> trainingQualityParam = null;
+      ILookupParameter<DoubleValue> testQualityParam = null;
+      // store actual names of parameter because it is changed below
+      trainingQualityParam = TrainingQualityParameter;
+      string prevTrainingQualityParamName = trainingQualityParam.ActualName;
+      testQualityParam = TestQualityParameter;
+      string prevTestQualityParamName = testQualityParam.ActualName;
       foreach (var result in results.Where(r => r.Value is IRegressionSolution)) {
         var solution = (IRegressionSolution)result.Value;
 
-        var trainingR2 = result.Name + Environment.NewLine + "Training R²";
-        if (!dataTable.Rows.ContainsKey(trainingR2))
-          dataTable.Rows.Add(new DataRow(trainingR2));
+        var trainingR2Name = result.Name + " Training R²";
+        if (!dataTable.Rows.ContainsKey(trainingR2Name))
+          dataTable.Rows.Add(new DataRow(trainingR2Name));
 
-        var testR2 = result.Name + Environment.NewLine + " Test R²";
-        if (!dataTable.Rows.ContainsKey(testR2))
-          dataTable.Rows.Add(new DataRow(testR2));
+        var testR2Name = result.Name + " Test R²";
+        if (!dataTable.Rows.ContainsKey(testR2Name))
+          dataTable.Rows.Add(new DataRow(testR2Name));
 
-        dataTable.Rows[trainingR2].Values.Add(solution.TrainingRSquared);
-        dataTable.Rows[testR2].Values.Add(solution.TestRSquared);
+        dataTable.Rows[trainingR2Name].Values.Add(solution.TrainingRSquared);
+        dataTable.Rows[testR2Name].Values.Add(solution.TestRSquared);
+
+        // also add training and test R² to the scope using the parameters
+        // HACK: we change the ActualName of the parameter to write two variables for each solution in the results collection
+        trainingQualityParam.ActualName = trainingR2Name;
+        trainingQualityParam.ActualValue = new DoubleValue(solution.TrainingRSquared);
+        testQualityParam.ActualName = testR2Name;
+        testQualityParam.ActualValue = new DoubleValue(solution.TestRSquared);
       }
+
+      trainingQualityParam.ActualName = prevTrainingQualityParamName;
+      testQualityParam.ActualName = prevTestQualityParamName;
 
       return base.Apply();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/GenerationalRegressionSlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/GenerationalRegressionSlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/GenerationalRegressionSlidingWindowAnalyzer.cs	(revision 17687)
@@ -23,12 +23,12 @@
 using HeuristicLab.Core;
 using HeuristicLab.Optimization;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [StorableClass]
   [Item("Generational Regression Sliding Window Analyzer", "")]
+  [StorableType("9157AEF9-838B-48EC-9E0B-CE75F8A1FF8D")]
   public class GenerationalRegressionSlidingWindowAnalyzer : GenerationalSlidingWindowAnalyzer {
     [StorableConstructor]
-    protected GenerationalRegressionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected GenerationalRegressionSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/OffspringSelectionRegressionSlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/OffspringSelectionRegressionSlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/OffspringSelectionRegressionSlidingWindowAnalyzer.cs	(revision 17687)
@@ -24,11 +24,12 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [StorableClass]
   [Item("OffspringSelectionRegressionSlidingWindowAnalyzer", "")]
+  [StorableType("821B7755-1914-416A-AF83-55B0BF74E26A")]
   public class OffspringSelectionRegressionSlidingWindowAnalyzer : OffspringSelectionSlidingWindowAnalyzer {
     [StorableConstructor]
-    protected OffspringSelectionRegressionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected OffspringSelectionRegressionSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/SlidingWindowBestRegressionSolutionsCollection.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/SlidingWindowBestRegressionSolutionsCollection.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SlidingWindow/SlidingWindowBestRegressionSolutionsCollection.cs	(revision 17687)
@@ -24,8 +24,9 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [StorableClass]
   [Item("SlidingWindowBestRegressionSolutionsCollection", "A collection of best sliding window solutions for symbolic regression.")]
+  [StorableType("8F78030E-16F3-42CD-ABE7-0526E4738676")]
   public class SlidingWindowBestRegressionSolutionsCollection : SlidingWindowBestSolutionsCollection {
     public new IRegressionProblemData ProblemData {
@@ -34,5 +35,5 @@
     }
     [StorableConstructor]
-    protected SlidingWindowBestRegressionSolutionsCollection(bool deserializing) : base(deserializing) { }
+    protected SlidingWindowBestRegressionSolutionsCollection(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
@@ -46,5 +47,5 @@
     public override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
       double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
-      return new SymbolicRegressionModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
+      return new SymbolicRegressionModel(ProblemData.TargetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     }
     public override ISymbolicDataAnalysisSolution CreateSolution(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,9 +20,10 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -30,16 +31,34 @@
   /// Represents a symbolic regression model
   /// </summary>
-  [StorableClass]
+  [StorableType("2739C33E-4DDB-4285-9DFB-C056D900B2F2")]
   [Item(Name = "Symbolic Regression Model", Description = "Represents a symbolic regression model.")]
   public class SymbolicRegressionModel : SymbolicDataAnalysisModel, ISymbolicRegressionModel {
-
+    [Storable]
+    private string targetVariable;
+    public string TargetVariable {
+      get { return targetVariable; }
+      set {
+        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
+        targetVariable = value;
+        OnTargetVariableChanged(this, EventArgs.Empty);
+      }
+    }
 
     [StorableConstructor]
-    protected SymbolicRegressionModel(bool deserializing) : base(deserializing) { }
-    protected SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner) : base(original, cloner) { }
+    protected SymbolicRegressionModel(StorableConstructorFlag _) : base(_) {
+      targetVariable = string.Empty;
+    }
 
-    public SymbolicRegressionModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
+    protected SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner)
+      : base(original, cloner) {
+      this.targetVariable = original.targetVariable;
+    }
+
+    public SymbolicRegressionModel(string targetVariable, ISymbolicExpressionTree tree,
+      ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
       double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
-      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) { }
+      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
+      this.targetVariable = targetVariable;
+    }
 
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -47,5 +66,5 @@
     }
 
-    public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
+    public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
       return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows)
         .LimitToRange(LowerEstimationLimit, UpperEstimationLimit);
@@ -62,4 +81,25 @@
       Scale(problemData, problemData.TargetVariable);
     }
+
+    public virtual bool IsProblemDataCompatible(IRegressionProblemData problemData, out string errorMessage) {
+      return RegressionModel.IsProblemDataCompatible(this, problemData, out errorMessage);
+    }
+
+    public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {
+      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
+      var regressionProblemData = problemData as IRegressionProblemData;
+      if (regressionProblemData == null)
+        throw new ArgumentException("The problem data is not compatible with this symbolic regression model. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
+      return IsProblemDataCompatible(regressionProblemData, out errorMessage);
+    }
+
+    #region events
+    public event EventHandler TargetVariableChanged;
+    private void OnTargetVariableChanged(object sender, EventArgs args) {
+      var changed = TargetVariableChanged;
+      if (changed != null)
+        changed(sender, args);
+    }
+    #endregion
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPhenotypicDiversityAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPhenotypicDiversityAnalyzer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPhenotypicDiversityAnalyzer.cs	(revision 17687)
@@ -0,0 +1,111 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
+  [Item("SymbolicRegressionPhenotypicDiversityAnalyzer", "An analyzer which calculates diversity based on the phenotypic distance between trees")]
+  [StorableType("A72624D2-6628-45E6-8EBF-4AAD88CC01F5")]
+  public class SymbolicRegressionPhenotypicDiversityAnalyzer : PopulationSimilarityAnalyzer,
+    ISymbolicDataAnalysisBoundedOperator, ISymbolicDataAnalysisInterpreterOperator, ISymbolicExpressionTreeAnalyzer {
+    #region parameter names
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string EvaluatedValuesParameterName = "EstimatedValues";
+    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
+    private const string ProblemDataParameterName = "ProblemData";
+    private const string EstimationLimitsParameterName = "EstimationLimits";
+    #endregion
+
+    #region parameter properties
+    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+    private IScopeTreeLookupParameter<DoubleArray> EvaluatedValuesParameter {
+      get { return (IScopeTreeLookupParameter<DoubleArray>)Parameters[EvaluatedValuesParameterName]; }
+    }
+    public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
+      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
+    }
+    public IValueLookupParameter<IRegressionProblemData> ProblemDataParameter {
+      get { return (IValueLookupParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
+      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
+    }
+    #endregion
+
+    public SymbolicRegressionPhenotypicDiversityAnalyzer(IEnumerable<ISolutionSimilarityCalculator> validSimilarityCalculators)
+      : base(validSimilarityCalculators) {
+      #region add parameters
+      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>(EvaluatedValuesParameterName, "Intermediate estimated values to be saved in the scopes."));
+      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
+      Parameters.Add(new ValueLookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
+      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees."));
+      #endregion
+
+      UpdateCounterParameter.ActualName = "PhenotypicDiversityAnalyzerUpdateCounter";
+      DiversityResultName = "Phenotypic Diversity";
+    }
+
+    [StorableConstructor]
+    protected SymbolicRegressionPhenotypicDiversityAnalyzer(StorableConstructorFlag _) : base(_) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicRegressionPhenotypicDiversityAnalyzer(this, cloner);
+    }
+
+    protected SymbolicRegressionPhenotypicDiversityAnalyzer(SymbolicRegressionPhenotypicDiversityAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IOperation Apply() {
+      int updateInterval = UpdateIntervalParameter.Value.Value;
+      IntValue updateCounter = UpdateCounterParameter.ActualValue;
+
+      if (updateCounter == null) {
+        updateCounter = new IntValue(updateInterval);
+        UpdateCounterParameter.ActualValue = updateCounter;
+      }
+
+      if (updateCounter.Value == updateInterval) {
+        var trees = SymbolicExpressionTreeParameter.ActualValue;
+        var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
+        var ds = ProblemDataParameter.ActualValue.Dataset;
+        var rows = ProblemDataParameter.ActualValue.TrainingIndices;
+
+        var evaluatedValues = new ItemArray<DoubleArray>(trees.Select(t => new DoubleArray(interpreter.GetSymbolicExpressionTreeValues(t, ds, rows).ToArray())));
+        EvaluatedValuesParameter.ActualValue = evaluatedValues;
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,26 +24,62 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
   [Item("SymbolicRegressionPruningAnalyzer", "An analyzer that prunes introns from the population.")]
-  [StorableClass]
+  [StorableType("F1180389-1393-4102-9EEC-E4F183A017F2")]
   public sealed class SymbolicRegressionPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer {
-    private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
     private const string PruningOperatorParameterName = "PruningOperator";
-    private SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner)
-      : base(original, cloner) {
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new SymbolicRegressionPruningAnalyzer(this, cloner);
+    public IValueParameter<SymbolicRegressionPruningOperator> PruningOperatorParameter {
+      get { return (IValueParameter<SymbolicRegressionPruningOperator>)Parameters[PruningOperatorParameterName]; }
     }
 
+    protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator {
+      get { return PruningOperatorParameter.Value; }
+    }
+
+    private SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicRegressionPruningAnalyzer(this, cloner); }
+
     [StorableConstructor]
-    private SymbolicRegressionPruningAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionPruningAnalyzer(StorableConstructorFlag _) : base(_) { }
 
     public SymbolicRegressionPruningAnalyzer() {
-      Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicRegressionSolutionImpactValuesCalculator()));
-      Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator()));
+      Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator())));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+
+      #region Backwards compatible code, remove with 3.4
+      if (Parameters.ContainsKey(PruningOperatorParameterName)) {
+        var oldParam = Parameters[PruningOperatorParameterName] as ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>;
+        if (oldParam != null) {
+          Parameters.Remove(oldParam);
+          Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator())));
+        }
+      } else {
+        // not yet contained
+        Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator())));
+      }
+
+
+      if (Parameters.ContainsKey("PruneOnlyZeroImpactNodes")) {
+        PruningOperator.PruneOnlyZeroImpactNodes = ((IFixedValueParameter<BoolValue>)Parameters["PruneOnlyZeroImpactNodes"]).Value.Value;
+        Parameters.Remove(Parameters["PruneOnlyZeroImpactNodes"]);
+      }
+      if (Parameters.ContainsKey("ImpactThreshold")) {
+        PruningOperator.NodeImpactThreshold = ((IFixedValueParameter<DoubleValue>)Parameters["ImpactThreshold"]).Value.Value;
+        Parameters.Remove(Parameters["ImpactThreshold"]);
+      }
+      if (Parameters.ContainsKey("ImpactValuesCalculator")) {
+        PruningOperator.ImpactValuesCalculator = ((ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>)Parameters["ImpactValuesCalculator"]).Value;
+        Parameters.Remove(Parameters["ImpactValuesCalculator"]);
+      }
+
+      #endregion
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs	(revision 17687)
@@ -1,20 +1,44 @@
-﻿using System.Linq;
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [StorableClass]
+  [StorableType("75843B4E-C69C-423A-87BD-A64619D380BB")]
   [Item("SymbolicRegressionPruningOperator", "An operator which prunes symbolic regression trees.")]
   public class SymbolicRegressionPruningOperator : SymbolicDataAnalysisExpressionPruningOperator {
-    private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
-    private const string ImpactValuesCalculatorParameterDescription = "The impact values calculator to be used for figuring out the node impacts.";
-
     private const string EvaluatorParameterName = "Evaluator";
 
+    #region parameter properties
     public ILookupParameter<ISymbolicRegressionSingleObjectiveEvaluator> EvaluatorParameter {
       get { return (ILookupParameter<ISymbolicRegressionSingleObjectiveEvaluator>)Parameters[EvaluatorParameterName]; }
     }
+    #endregion
 
     protected SymbolicRegressionPruningOperator(SymbolicRegressionPruningOperator original, Cloner cloner)
@@ -26,26 +50,63 @@
 
     [StorableConstructor]
-    protected SymbolicRegressionPruningOperator(bool deserializing) : base(deserializing) { }
+    protected SymbolicRegressionPruningOperator(StorableConstructorFlag _) : base(_) { }
 
-    public SymbolicRegressionPruningOperator() {
-      var impactValuesCalculator = new SymbolicRegressionSolutionImpactValuesCalculator();
-      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, ImpactValuesCalculatorParameterDescription, impactValuesCalculator));
+    public SymbolicRegressionPruningOperator(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactValuesCalculator)
+      : base(impactValuesCalculator) {
       Parameters.Add(new LookupParameter<ISymbolicRegressionSingleObjectiveEvaluator>(EvaluatorParameterName));
     }
 
-    protected override ISymbolicDataAnalysisModel CreateModel() {
-      return new SymbolicRegressionModel(SymbolicExpressionTree, Interpreter, EstimationLimits.Lower, EstimationLimits.Upper);
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      base.ImpactValuesCalculator = new SymbolicRegressionSolutionImpactValuesCalculator();
+      if (!Parameters.ContainsKey(EvaluatorParameterName)) {
+        Parameters.Add(new LookupParameter<ISymbolicRegressionSingleObjectiveEvaluator>(EvaluatorParameterName));
+      }
+      #endregion
+    }
+
+    protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) {
+      var regressionProblemData = (IRegressionProblemData)problemData;
+      return new SymbolicRegressionModel(regressionProblemData.TargetVariable, tree, interpreter, estimationLimits.Lower, estimationLimits.Upper);
     }
 
     protected override double Evaluate(IDataAnalysisModel model) {
-      var regressionModel = (IRegressionModel)model;
-      var regressionProblemData = (IRegressionProblemData)ProblemData;
-      var trainingIndices = ProblemData.TrainingIndices.ToList();
-      var estimatedValues = regressionModel.GetEstimatedValues(ProblemData.Dataset, trainingIndices); // also bounds the values
-      var targetValues = ProblemData.Dataset.GetDoubleValues(regressionProblemData.TargetVariable, trainingIndices);
-      OnlineCalculatorError errorState;
-      var quality = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, estimatedValues, out errorState);
-      if (errorState != OnlineCalculatorError.None) return double.NaN;
-      return quality;
+      var regressionModel = (ISymbolicRegressionModel)model;
+      var regressionProblemData = (IRegressionProblemData)ProblemDataParameter.ActualValue;
+      var evaluator = EvaluatorParameter.ActualValue;
+      var fitnessEvaluationPartition = FitnessCalculationPartitionParameter.ActualValue;
+      var rows = Enumerable.Range(fitnessEvaluationPartition.Start, fitnessEvaluationPartition.Size);
+      return evaluator.Evaluate(this.ExecutionContext, regressionModel.SymbolicExpressionTree, regressionProblemData, rows);
+    }
+
+    public static ISymbolicExpressionTree Prune(ISymbolicExpressionTree tree, SymbolicRegressionSolutionImpactValuesCalculator impactValuesCalculator, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IRegressionProblemData problemData, DoubleLimit estimationLimits, IEnumerable<int> rows, double nodeImpactThreshold = 0.0, bool pruneOnlyZeroImpactNodes = false) {
+      var clonedTree = (ISymbolicExpressionTree)tree.Clone();
+      var model = new SymbolicRegressionModel(problemData.TargetVariable, clonedTree, interpreter, estimationLimits.Lower, estimationLimits.Upper);
+      var nodes = clonedTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); // skip the nodes corresponding to the ProgramRootSymbol and the StartSymbol
+
+      double qualityForImpactsCalculation = double.NaN; // pass a NaN value initially so the impact calculator will calculate the quality
+
+      for (int i = 0; i < nodes.Count; ++i) {
+        var node = nodes[i];
+        if (node is ConstantTreeNode) continue;
+
+        double impactValue, replacementValue;
+        double newQualityForImpactsCalculation;
+        impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, out newQualityForImpactsCalculation, qualityForImpactsCalculation);
+
+        if (pruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue;
+        if (!pruneOnlyZeroImpactNodes && impactValue > nodeImpactThreshold) continue;
+
+        var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();
+        constantNode.Value = replacementValue;
+
+        ReplaceWithConstant(node, constantNode);
+        i += node.GetLength() - 1; // skip subtrees under the node that was folded
+
+        qualityForImpactsCalculation = newQualityForImpactsCalculation;
+      }
+      return model.SymbolicExpressionTree;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs	(revision 17687)
@@ -1,5 +1,5 @@
-#region License Information
+﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,9 +21,10 @@
 
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
@@ -31,5 +32,5 @@
   /// Represents a symbolic regression solution (model + data) and attributes of the solution like accuracy and complexity
   /// </summary>
-  [StorableClass]
+  [StorableType("88E56AF9-AD72-47E4-A613-8875703BD927")]
   [Item(Name = "SymbolicRegressionSolution", Description = "Represents a symbolic regression solution (model + data) and attributes of the solution like accuracy and complexity.")]
   public sealed class SymbolicRegressionSolution : RegressionSolution, ISymbolicRegressionSolution {
@@ -46,4 +47,6 @@
     private const string TestNaNEvaluationsResultName = "Test NaN Evaluations";
 
+    private const string ModelBoundsResultName = "Model Bounds";
+
     public new ISymbolicRegressionModel Model {
       get { return (ISymbolicRegressionModel)base.Model; }
@@ -95,6 +98,23 @@
     }
 
+    public IntervalCollection ModelBoundsCollection {
+      get {
+        if (!ContainsKey(ModelBoundsResultName)) return null;
+        return (IntervalCollection)this[ModelBoundsResultName].Value;
+      }
+      private set {
+        if (ContainsKey(ModelBoundsResultName)) {
+          this[ModelBoundsResultName].Value = value;
+        } else {
+          Add(new Result(ModelBoundsResultName, "Results concerning the derivation of symbolic regression solution", value));
+        }
+
+      }
+    }
+
+
+
     [StorableConstructor]
-    private SymbolicRegressionSolution(bool deserializing) : base(deserializing) { }
+    private SymbolicRegressionSolution(StorableConstructorFlag _) : base(_) { }
     private SymbolicRegressionSolution(SymbolicRegressionSolution original, Cloner cloner)
       : base(original, cloner) {
@@ -102,4 +122,7 @@
     public SymbolicRegressionSolution(ISymbolicRegressionModel model, IRegressionProblemData problemData)
       : base(model, problemData) {
+      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
+        node.SetGrammar(null);
+
       Add(new Result(ModelLengthResultName, "Length of the symbolic regression model.", new IntValue()));
       Add(new Result(ModelDepthResultName, "Depth of the symbolic regression model.", new IntValue()));
@@ -114,4 +137,7 @@
       estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue()));
       Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults));
+
+      if (IntervalInterpreter.IsCompatible(Model.SymbolicExpressionTree))
+        Add(new Result(ModelBoundsResultName, "Results concerning the derivation of symbolic regression solution", new IntervalCollection()));
 
       RecalculateResults();
@@ -136,4 +162,11 @@
         CalculateResults();
       }
+
+      if (!ContainsKey(ModelBoundsResultName)) {
+        if (IntervalInterpreter.IsCompatible(Model.SymbolicExpressionTree)) {
+          Add(new Result(ModelBoundsResultName, "Results concerning the derivation of symbolic regression solution", new IntervalCollection()));
+          CalculateResults();
+        }
+      }
     }
 
@@ -156,4 +189,30 @@
       TrainingNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TrainingIndices).Count(double.IsNaN);
       TestNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TestIndices).Count(double.IsNaN);
+
+      //Check if the tree contains unknown symbols for the interval calculation
+      if (IntervalInterpreter.IsCompatible(Model.SymbolicExpressionTree))
+        ModelBoundsCollection = CalculateModelIntervals(this);
+    }
+
+    private static IntervalCollection CalculateModelIntervals(ISymbolicRegressionSolution solution) {
+      var intervalEvaluation = new IntervalCollection();
+      var interpreter = new IntervalInterpreter();
+      var problemData = solution.ProblemData;
+      var model = solution.Model;
+      var variableRanges = problemData.VariableRanges.GetReadonlyDictionary();
+
+      intervalEvaluation.AddInterval($"Target {problemData.TargetVariable}", new Interval(variableRanges[problemData.TargetVariable].LowerBound, variableRanges[problemData.TargetVariable].UpperBound));
+      intervalEvaluation.AddInterval("Model", interpreter.GetSymbolicExpressionTreeInterval(model.SymbolicExpressionTree, variableRanges));
+
+      if (DerivativeCalculator.IsCompatible(model.SymbolicExpressionTree)) {
+        foreach (var inputVariable in model.VariablesUsedForPrediction.OrderBy(v => v, new NaturalStringComparer())) {
+          var derivedModel = DerivativeCalculator.Derive(model.SymbolicExpressionTree, inputVariable);
+          var derivedResultInterval = interpreter.GetSymbolicExpressionTreeInterval(derivedModel, variableRanges);
+
+          intervalEvaluation.AddInterval(" ∂f/∂" + inputVariable, new Interval(derivedResultInterval.LowerBound, derivedResultInterval.UpperBound));
+        }
+      }
+
+      return intervalEvaluation;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,17 +20,14 @@
 #endregion
 
-using System;
 using System.Collections.Generic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
-  [StorableClass]
+  [StorableType("927C21BD-8913-406F-ADEA-DA4FED3FE4A2")]
   [Item("SymbolicRegressionSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for regression problems.")]
   public class SymbolicRegressionSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator {
     public SymbolicRegressionSolutionImpactValuesCalculator() { }
-
     protected SymbolicRegressionSolutionImpactValuesCalculator(SymbolicRegressionSolutionImpactValuesCalculator original, Cloner cloner)
       : base(original, cloner) { }
@@ -38,53 +35,17 @@
       return new SymbolicRegressionSolutionImpactValuesCalculator(this, cloner);
     }
+    [StorableConstructor]
+    protected SymbolicRegressionSolutionImpactValuesCalculator(StorableConstructorFlag _) : base(_) { }
 
-    [StorableConstructor]
-    protected SymbolicRegressionSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { }
-    public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
+    protected override double CalculateQualityForImpacts(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
       var regressionModel = (ISymbolicRegressionModel)model;
       var regressionProblemData = (IRegressionProblemData)problemData;
-
-      return CalculateReplacementValue(node, regressionModel.SymbolicExpressionTree, regressionModel.Interpreter, regressionProblemData.Dataset, rows);
-    }
-
-    public override double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN) {
-      double impactValue, replacementValue;
-      CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, originalQuality);
-      return impactValue;
-    }
-
-    public override void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node,
-      IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue,
-      double originalQuality = Double.NaN) {
-      var regressionModel = (ISymbolicRegressionModel)model;
-      var regressionProblemData = (IRegressionProblemData)problemData;
-
-      var dataset = regressionProblemData.Dataset;
-      var targetValues = dataset.GetDoubleValues(regressionProblemData.TargetVariable, rows);
-
+      var estimatedValues = regressionModel.GetEstimatedValues(problemData.Dataset, rows); // also bounds the values
+      var targetValues = problemData.Dataset.GetDoubleValues(regressionProblemData.TargetVariable, rows);
       OnlineCalculatorError errorState;
-      if (double.IsNaN(originalQuality)) {
-        var originalValues = regressionModel.GetEstimatedValues(dataset, rows);
-        originalQuality = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, originalValues, out errorState);
-        if (errorState != OnlineCalculatorError.None) originalQuality = 0.0;
-      }
-
-      replacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows);
-      var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
-
-      var cloner = new Cloner();
-      var tempModel = cloner.Clone(regressionModel);
-      var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node);
-
-      var tempModelParentNode = tempModelNode.Parent;
-      int i = tempModelParentNode.IndexOfSubtree(tempModelNode);
-      tempModelParentNode.RemoveSubtree(i);
-      tempModelParentNode.InsertSubtree(i, constantNode);
-
-      var estimatedValues = tempModel.GetEstimatedValues(dataset, rows);
-      double newQuality = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, estimatedValues, out errorState);
-      if (errorState != OnlineCalculatorError.None) newQuality = 0.0;
-
-      impactValue = originalQuality - newQuality;
+      var r = OnlinePearsonsRCalculator.Calculate(targetValues, estimatedValues, out errorState);
+      var quality = r * r;
+      if (errorState != OnlineCalculatorError.None) return double.NaN;
+      return quality;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -30,8 +30,8 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
   public class SymbolicSolutionExcelExporter : IDataAnalysisSolutionExporter {
-    private const string TRAININGSTART = "TrainingStart";
-    private const string TRAININGEND = "TrainingEnd";
-    private const string TESTSTART = "TestStart";
-    private const string TESTEND = "TestEnd";
+    protected const string TRAININGSTART = "TrainingStart";
+    protected const string TRAININGEND = "TrainingEnd";
+    protected const string TESTSTART = "TestStart";
+    protected const string TESTEND = "TestEnd";
 
 
@@ -44,5 +44,5 @@
     }
 
-    public void Export(IDataAnalysisSolution solution, string fileName) {
+    public virtual void Export(IDataAnalysisSolution solution, string fileName) {
       var symbSolution = solution as ISymbolicDataAnalysisSolution;
       if (symbSolution == null) throw new NotSupportedException("This solution cannot be exported to Excel");
@@ -216,5 +216,5 @@
     }
 
-    private string Indirect(string column, bool training) {
+    protected string Indirect(string column, bool training) {
       if (training) {
         return string.Format("INDIRECT(\"'Estimated Values'!{0}\"&{1}+2&\":{0}\"&{2}+1)", column, TRAININGSTART, TRAININGEND);
@@ -260,5 +260,5 @@
     }
 
-    private void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {
+    protected void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {
       SymbolicExpressionTreeChart modelTreePicture = new SymbolicExpressionTreeChart();
       modelTreePicture.Tree = model.SymbolicExpressionTree;
@@ -289,9 +289,10 @@
       estimatedWorksheet.Cells[1, 1, 1, 10].AutoFitColumns();
 
+      // fill in id, target variable and unbounded estimated values
       int targetIndex = solution.ProblemData.Dataset.VariableNames.ToList().FindIndex(x => x.Equals(solution.ProblemData.TargetVariable)) + 1;
       for (int i = 0; i < rows; i++) {
-        estimatedWorksheet.Cells[i + 2, 1].Value = i;
-        estimatedWorksheet.Cells[i + 2, 2].Formula = datasetWorksheet.Cells[i + 2, targetIndex].FullAddress;
-        estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2);
+        estimatedWorksheet.Cells[i + 2, 1].Value = i; // id
+        estimatedWorksheet.Cells[i + 2, 2].Formula = datasetWorksheet.Cells[i + 2, targetIndex].FullAddress; // target variable
+        estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2); // unbounded estimated values
       }
       estimatedWorksheet.Cells["B2:B" + (rows + 1)].Style.Numberformat.Format = "0.000";
@@ -313,5 +314,5 @@
     }
 
-    private string PrepareFormula(string[] formulaParts) {
+    protected string PrepareFormula(string[] formulaParts) {
       string preparedFormula = formulaParts[0];
       foreach (var part in formulaParts.Skip(2)) {
@@ -323,5 +324,5 @@
     }
 
-    private void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, Dataset dataset) {
+    protected void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, IDataset dataset) {
       //remark the performance of EPPlus drops dramatically 
       //if the data is not written row wise (from left to right) due the internal indices used.
@@ -337,8 +338,8 @@
     }
 
-    private void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {
+    protected void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {
       //remark the performance of EPPlus drops dramatically 
       //if the data is not written row wise (from left to right) due the internal indices used.
-      Dataset dataset = problemData.Dataset;
+      IDataset dataset = problemData.Dataset;
       var variableNames = dataset.VariableNames.ToList();
       var doubleVariables = new HashSet<string>(dataset.DoubleVariables);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 17687)
@@ -11,5 +11,5 @@
     <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic.Views</RootNamespace>
     <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
@@ -41,18 +41,20 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
@@ -64,4 +66,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -73,4 +76,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -82,4 +86,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
@@ -91,99 +96,85 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="ALGLIB-3.7.0">
-      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\bin\ALGLIB-3.7.0.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="EPPlus-3.1.3, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\EPPlus-3.1.3.dll</HintPath>
+    <Reference Include="EPPlus-4.0.3, Version=4.0.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Analysis-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Analysis.Views-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
-      <Private>False</Private>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Core.Views-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Data.Views-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.MainForm-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Optimization.Views-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Optimizer-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimizer-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.Parameters.Views-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters.Views-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
-      <Private>False</Private>
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
     </Reference>
     <Reference Include="System" />
@@ -194,14 +185,7 @@
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms.DataVisualization" />
-    <Reference Include="System.Xml.Linq">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Data.DataSetExtensions">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Exporters\SymbolicSolutionExcelExporter.cs" />
     <Compile Include="InteractiveSymbolicExpressionTreeChart.cs">
       <SubType>UserControl</SubType>
@@ -210,11 +194,4 @@
       <DependentUpon>InteractiveSymbolicExpressionTreeChart.cs</DependentUpon>
     </Compile>
-    <Compile Include="MathSymbolicDataAnalysisModelView.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
-    <Compile Include="MathSymbolicDataAnalysisModelView.designer.cs">
-      <DependentUpon>MathSymbolicDataAnalysisModelView.cs</DependentUpon>
-    </Compile>
-    <Compile Include="Plugin.cs" />
     <Compile Include="SlidingWindow\SlidingWindowBestSolutionsCollectionHeatMapControl.cs">
       <SubType>UserControl</SubType>
@@ -241,4 +218,11 @@
       <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
     </Compile>
+    <Compile Include="SymbolicDataAnalysisModelMathView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SymbolicDataAnalysisModelMathView.designer.cs">
+      <DependentUpon>SymbolicDataAnalysisModelMathView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Plugin.cs" />
     <Compile Include="TextualSymbolicDataAnalysisModelView.cs">
       <SubType>UserControl</SubType>
@@ -317,11 +301,4 @@
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
-      <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
-      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
-      <Private>False</Private>
-    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
@@ -348,5 +325,8 @@
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Exporters\" />
+    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
+      <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project>
+      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -373,3 +353,6 @@
 </PreBuildEvent>
   </PropertyGroup>
+  <PropertyGroup>
+    <PreBuildEvent />
+  </PropertyGroup>
 </Project>
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -47,4 +47,5 @@
     private void InitializeComponent() {
       this.components = new System.ComponentModel.Container();
+      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InteractiveSymbolicDataAnalysisSolutionSimplifierView));
       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
       this.splitContainer = new System.Windows.Forms.SplitContainer();
@@ -52,9 +53,9 @@
       this.treeStatusValue = new System.Windows.Forms.Label();
       this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+      this.btnSimplify = new System.Windows.Forms.Button();
       this.btnOptimizeConstants = new System.Windows.Forms.Button();
-      this.btnSimplify = new System.Windows.Forms.Button();
-      this.treeStatusLabel = new System.Windows.Forms.Label();
-      this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
       this.grpViewHost = new System.Windows.Forms.GroupBox();
+      this.treeChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart();
+      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
       this.splitContainer.Panel1.SuspendLayout();
@@ -104,5 +105,4 @@
       this.grpSimplify.Controls.Add(this.treeStatusValue);
       this.grpSimplify.Controls.Add(this.flowLayoutPanel);
-      this.grpSimplify.Controls.Add(this.treeStatusLabel);
       this.grpSimplify.Controls.Add(this.treeChart);
       this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -116,12 +116,14 @@
       // treeStatusValue
       // 
+      this.treeStatusValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
       this.treeStatusValue.AutoSize = true;
-      this.treeStatusValue.BackColor = System.Drawing.Color.Transparent;
-      this.treeStatusValue.ForeColor = System.Drawing.Color.Green;
-      this.treeStatusValue.Location = new System.Drawing.Point(72, 16);
+      this.treeStatusValue.BackColor = System.Drawing.Color.White;
+      this.treeStatusValue.ForeColor = System.Drawing.Color.Red;
+      this.treeStatusValue.Location = new System.Drawing.Point(6, 351);
       this.treeStatusValue.Name = "treeStatusValue";
-      this.treeStatusValue.Size = new System.Drawing.Size(30, 13);
+      this.treeStatusValue.Size = new System.Drawing.Size(63, 13);
       this.treeStatusValue.TabIndex = 3;
-      this.treeStatusValue.Text = "Valid";
+      this.treeStatusValue.Text = "Invalid Tree";
+      this.treeStatusValue.Visible = false;
       // 
       // flowLayoutPanel
@@ -137,26 +139,8 @@
       this.flowLayoutPanel.WrapContents = false;
       // 
-      // btnOptimizeConstants
-      //       
-      this.btnOptimizeConstants.AutoSize = true;
-      this.btnOptimizeConstants.Enabled = false;
-      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
-      this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
-      this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3);
-      this.btnOptimizeConstants.Name = "btnOptimizeConstants";
-      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
-      this.btnOptimizeConstants.TabIndex = 2;
-      this.btnOptimizeConstants.Text = "Optimize";
-      this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
-      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
-      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
-      // 
       // btnSimplify
       // 
       this.btnSimplify.AutoSize = true;
-      this.btnSimplify.Enabled = true;
       this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator;
-      this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
       this.btnSimplify.Location = new System.Drawing.Point(3, 3);
       this.btnSimplify.Name = "btnSimplify";
@@ -164,35 +148,24 @@
       this.btnSimplify.TabIndex = 1;
       this.btnSimplify.Text = "Simplify";
-      this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
       this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+      this.toolTip.SetToolTip(this.btnSimplify, "Simplifies the model structure based on mathematical simplification rules.");
       this.btnSimplify.UseVisualStyleBackColor = true;
       this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);
       // 
-      // treeStatusLabel
-      // 
-      this.treeStatusLabel.AutoSize = true;
-      this.treeStatusLabel.BackColor = System.Drawing.Color.Transparent;
-      this.treeStatusLabel.Location = new System.Drawing.Point(6, 16);
-      this.treeStatusLabel.Name = "treeStatusLabel";
-      this.treeStatusLabel.Size = new System.Drawing.Size(68, 13);
-      this.treeStatusLabel.TabIndex = 2;
-      this.treeStatusLabel.Text = "Tree Status: ";
-      // 
-      // treeChart
-      // 
-      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-            | System.Windows.Forms.AnchorStyles.Left)
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.treeChart.BackgroundColor = System.Drawing.Color.White;
-      this.treeChart.LineColor = System.Drawing.Color.Black;
-      this.treeChart.Location = new System.Drawing.Point(6, 32);
-      this.treeChart.Name = "treeChart";
-      this.treeChart.Size = new System.Drawing.Size(201, 332);
-      this.treeChart.Spacing = 5;
-      this.treeChart.SuspendRepaint = false;
-      this.treeChart.TabIndex = 0;
-      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
-      this.treeChart.Tree = null;
-      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
+      // btnOptimizeConstants
+      // 
+      this.btnOptimizeConstants.AutoSize = true;
+      this.btnOptimizeConstants.Enabled = false;
+      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
+      this.btnOptimizeConstants.Location = new System.Drawing.Point(89, 3);
+      this.btnOptimizeConstants.Name = "btnOptimizeConstants";
+      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
+      this.btnOptimizeConstants.TabIndex = 2;
+      this.btnOptimizeConstants.Text = "Optimize";
+      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
+      this.toolTip.SetToolTip(this.btnOptimizeConstants, "Optimizes the numerical constants of the model. \r\nIf the algorithm converges, opt" +
+        "imization is stopped.");
+      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
+      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
       // 
       // grpViewHost
@@ -206,4 +179,21 @@
       this.grpViewHost.TabStop = false;
       this.grpViewHost.Text = "Details";
+      // 
+      // treeChart
+      // 
+      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.treeChart.BackgroundColor = System.Drawing.Color.White;
+      this.treeChart.LineColor = System.Drawing.Color.Black;
+      this.treeChart.Location = new System.Drawing.Point(6, 16);
+      this.treeChart.ModifyTree = null;
+      this.treeChart.Name = "treeChart";
+      this.treeChart.Size = new System.Drawing.Size(201, 348);
+      this.treeChart.SuspendRepaint = false;
+      this.treeChart.TabIndex = 0;
+      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
+      this.treeChart.Tree = null;
+      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
       // 
       // InteractiveSymbolicDataAnalysisSolutionSimplifierView
@@ -223,4 +213,5 @@
       this.grpSimplify.PerformLayout();
       this.flowLayoutPanel.ResumeLayout(false);
+      this.flowLayoutPanel.PerformLayout();
       this.grpViewHost.ResumeLayout(false);
       this.ResumeLayout(false);
@@ -230,5 +221,5 @@
     #endregion
 
-    private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;
+    private HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart treeChart;
     private System.Windows.Forms.SplitContainer splitContainer;
     private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
@@ -239,5 +230,5 @@
     protected System.Windows.Forms.Button btnOptimizeConstants;
     private System.Windows.Forms.Label treeStatusValue;
-    private System.Windows.Forms.Label treeStatusLabel;
+    private System.Windows.Forms.ToolTip toolTip;
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,21 +24,120 @@
 using System.Drawing;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using System.Windows.Forms;
 using HeuristicLab.Common;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
+using HeuristicLab.MainForm;
 using HeuristicLab.MainForm.WindowsForms;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
   public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView {
-    private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes;
-    private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
+    private readonly Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
+    private readonly Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
+    private readonly Dictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
+    private readonly Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
+
+    private readonly ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator;
+
+    private readonly Progress progress = new Progress();
+    private CancellationTokenSource cancellationTokenSource;
+
     private enum TreeState { Valid, Invalid }
-
-    public InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
+    private TreeState treeState;
+
+    protected InteractiveSymbolicDataAnalysisSolutionSimplifierView(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator) {
       InitializeComponent();
-      foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
-      nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
       this.Caption = "Interactive Solution Simplifier";
+      this.impactCalculator = impactCalculator;
+
+      // initialize the tree modifier that will be used to perform edit operations over the tree
+      treeChart.ModifyTree = Modify;
+    }
+
+    /// <summary>
+    /// Remove, Replace or Insert subtrees
+    /// </summary>
+    /// <param name="tree">The symbolic expression tree</param>
+    /// <param name="parent">The insertion point (ie, the parent node who will receive a new child)</param>
+    /// <param name="oldChild">The subtree to be replaced</param>
+    /// <param name="newChild">The replacement subtree</param>
+    /// <param name="removeSubtree">Flag used to indicate if whole subtrees should be removed (default behavior), or just the subtree root</param>
+    private void Modify(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode parent,
+      ISymbolicExpressionTreeNode oldChild, ISymbolicExpressionTreeNode newChild, bool removeSubtree = true) {
+      if (oldChild == null && newChild == null)
+        throw new ArgumentNullException("Cannot deduce operation type from the arguments. Please provide non null operands.");
+      if (oldChild == null) {
+        // insertion operation
+        parent.AddSubtree(newChild);
+        newChild.Parent = parent;
+      } else if (newChild == null) {
+        // removal operation
+        parent.RemoveSubtree(parent.IndexOfSubtree(oldChild));
+        if (!removeSubtree) {
+          for (int i = oldChild.SubtreeCount - 1; i >= 0; --i) {
+            var subtree = oldChild.GetSubtree(i);
+            oldChild.RemoveSubtree(i);
+            parent.AddSubtree(subtree);
+          }
+        }
+      } else {
+        // replacement operation
+        var replacementIndex = parent.IndexOfSubtree(oldChild);
+        parent.RemoveSubtree(replacementIndex);
+        parent.InsertSubtree(replacementIndex, newChild);
+        newChild.Parent = parent;
+        if (changedNodes.ContainsKey(oldChild)) {
+          changedNodes.Add(newChild, changedNodes[oldChild]); // so that on double click the original node is restored
+          changedNodes.Remove(oldChild);
+        } else {
+          changedNodes.Add(newChild, oldChild);
+        }
+      }
+      treeState = IsValid(tree) ? TreeState.Valid : TreeState.Invalid;
+      switch (treeState) {
+        case TreeState.Valid:
+          this.grpViewHost.Enabled = true;
+          UpdateModel(Content.Model.SymbolicExpressionTree);
+          break;
+        case TreeState.Invalid:
+          this.grpViewHost.Enabled = false;
+          break;
+      }
+    }
+
+    // the optimizer always assumes 2 children for multiplication and addition nodes
+    // thus, we enforce that the tree stays valid so that the constant optimization won't throw an exception
+    // by returning 2 as the minimum allowed arity for addition and multiplication symbols
+    private readonly Func<ISymbol, int> GetMinArity = symbol => {
+      var min = symbol.MinimumArity;
+      if (symbol is Multiplication || symbol is Division) return Math.Max(2, min);
+      return min;
+    };
+    private bool IsValid(ISymbolicExpressionTree tree) {
+      treeChart.Tree = tree;
+      treeChart.Repaint();
+      // check if all nodes have a legal arity
+      var nodes = tree.IterateNodesPostfix().ToList();
+      bool valid = !nodes.Any(node => node.SubtreeCount < GetMinArity(node.Symbol) || node.SubtreeCount > node.Symbol.MaximumArity);
+
+      if (valid) {
+        // check if all variables are contained in the dataset
+        var variables = new HashSet<string>(Content.ProblemData.Dataset.DoubleVariables);
+        valid = nodes.OfType<VariableTreeNode>().All(x => variables.Contains(x.VariableName));
+      }
+
+      if (valid) {
+        btnOptimizeConstants.Enabled = true;
+        btnSimplify.Enabled = true;
+        treeStatusValue.Visible = false;
+      } else {
+        btnOptimizeConstants.Enabled = false;
+        btnSimplify.Enabled = false;
+        treeStatusValue.Visible = true;
+      }
+      this.Refresh();
+      return valid;
     }
 
@@ -53,4 +152,6 @@
       Content.ProblemDataChanged += Content_Changed;
       treeChart.Repainted += treeChart_Repainted;
+      Progress.ShowOnControl(grpSimplify, progress);
+      progress.StopRequested += progress_StopRequested;
     }
     protected override void DeregisterContentEvents() {
@@ -59,13 +160,19 @@
       Content.ProblemDataChanged -= Content_Changed;
       treeChart.Repainted -= treeChart_Repainted;
+      Progress.HideFromControl(grpSimplify, false);
+      progress.StopRequested -= progress_StopRequested;
     }
 
     private void Content_Changed(object sender, EventArgs e) {
       UpdateView();
+      SetEnabledStateOfControls();
     }
 
     protected override void OnContentChanged() {
       base.OnContentChanged();
-      foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
+      foldedNodes.Clear();
+      changedNodes.Clear();
+      nodeIntervals.Clear();
+      nodeImpacts.Clear();
       UpdateView();
       viewHost.Content = this.Content;
@@ -77,22 +184,69 @@
     }
 
-    private void UpdateView() {
+    private void progress_StopRequested(object sender, EventArgs e) {
+      cancellationTokenSource.Cancel();
+    }
+
+    private async void UpdateView() {
       if (Content == null || Content.Model == null || Content.ProblemData == null) return;
       var tree = Content.Model.SymbolicExpressionTree;
       treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
 
-      var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree);
-      nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
-      var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
-      foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
-        foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
-      }
+      progress.Start("Calculate Impact and Replacement Values ...");
+      cancellationTokenSource = new CancellationTokenSource();
+      progress.CanBeStopped = true;
+      try {
+        var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
+        try {
+          await Task.Delay(300, cancellationTokenSource.Token); // wait for progressbar to finish animation
+        } catch (OperationCanceledException) { }
+
+        var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
+        foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
+          foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
+        }
+        
+        foreach (var pair in impactAndReplacementValues) {
+          nodeImpacts[pair.Key] = pair.Value.Item1;
+        }
+
+        if (IntervalInterpreter.IsCompatible(tree)) { 
+          var regressionProblemData = Content.ProblemData as IRegressionProblemData;
+          if (regressionProblemData != null) {
+            var interpreter = new IntervalInterpreter();
+            var variableRanges = regressionProblemData.VariableRanges.GetReadonlyDictionary();
+            IDictionary<ISymbolicExpressionTreeNode, Interval> intervals;
+            interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals);
+            foreach (var kvp in intervals) {
+              nodeIntervals[kvp.Key] = kvp.Value;
+            }
+          }
+        }
+      } finally {
+        progress.Finish();
+      }
+
+      progress.CanBeStopped = false;
       PaintNodeImpacts();
     }
 
-    protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree);
-    protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree);
-    protected abstract Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree);
+    protected virtual Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) {
+      var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>();
+      foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
+        if (progress.ProgressState == ProgressState.StopRequested) continue;
+        double impactValue, replacementValue, newQualityForImpactsCalculation;
+        impactCalculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);
+        double newProgressValue = progress.ProgressValue + 1.0 / (tree.Length - 2);
+        progress.ProgressValue = Math.Min(newProgressValue, 1);
+        impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue));
+      }
+      return impactAndReplacementValues;
+    }
+
     protected abstract void UpdateModel(ISymbolicExpressionTree tree);
+
+    protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) {
+      return tree;
+    }
 
     private static ConstantTreeNode MakeConstantTreeNode(double value) {
@@ -104,11 +258,18 @@
 
     private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
+      if (treeState == TreeState.Invalid) return;
       var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender;
+      if (visualNode.Content == null) { throw new Exception("VisualNode content cannot be null."); }
       var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content;
-      if (symbExprTreeNode == null) return;
       var tree = Content.Model.SymbolicExpressionTree;
       var parent = symbExprTreeNode.Parent;
       int indexOfSubtree = parent.IndexOfSubtree(symbExprTreeNode);
-      if (foldedNodes.ContainsKey(symbExprTreeNode)) {
+      if (changedNodes.ContainsKey(symbExprTreeNode)) {
+        // undo node change
+        parent.RemoveSubtree(indexOfSubtree);
+        var originalNode = changedNodes[symbExprTreeNode];
+        parent.InsertSubtree(indexOfSubtree, originalNode);
+        changedNodes.Remove(symbExprTreeNode);
+      } else if (foldedNodes.ContainsKey(symbExprTreeNode)) {
         // undo node folding
         SwitchNodeWithReplacementNode(parent, indexOfSubtree);
@@ -119,6 +280,6 @@
     private void SwitchNodeWithReplacementNode(ISymbolicExpressionTreeNode parent, int subTreeIndex) {
       ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex);
-      parent.RemoveSubtree(subTreeIndex);
       if (foldedNodes.ContainsKey(subTree)) {
+        parent.RemoveSubtree(subTreeIndex);
         var replacementNode = foldedNodes[subTree];
         parent.InsertSubtree(subTreeIndex, replacementNode);
@@ -133,8 +294,9 @@
       double max = impacts.Max();
       double min = impacts.Min();
-      foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
+      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
         VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
 
         if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
+          visualTree.ToolTip = visualTree.Content.ToString();
           double impact = nodeImpacts[treeNode];
 
@@ -157,8 +319,13 @@
           }
         }
-        if (visualTree != null)
-          if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) {
+        if (visualTree != null) {
+          if (nodeIntervals.ContainsKey(treeNode))
+            visualTree.ToolTip += String.Format($"{Environment.NewLine}Intervals: [{nodeIntervals[treeNode].LowerBound:G5} ... {nodeIntervals[treeNode].UpperBound:G5}]");
+          if (changedNodes.ContainsKey(treeNode)) {
+            visualTree.LineColor = Color.DodgerBlue;
+          } else if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) {
             visualTree.LineColor = Color.DarkOrange;
           }
+        }
       }
       treeChart.RepaintNodes();
@@ -166,10 +333,24 @@
 
     private void btnSimplify_Click(object sender, EventArgs e) {
-      var simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
-      var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);
+      var simplifiedExpressionTree = TreeSimplifier.Simplify(Content.Model.SymbolicExpressionTree);
       UpdateModel(simplifiedExpressionTree);
     }
 
-    protected abstract void btnOptimizeConstants_Click(object sender, EventArgs e);
+    private async void btnOptimizeConstants_Click(object sender, EventArgs e) {
+      progress.Start("Optimizing Constants ...");
+      cancellationTokenSource = new CancellationTokenSource();
+      progress.CanBeStopped = true;
+      try {
+        var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
+
+        var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
+        try {
+          await Task.Delay(300, cancellationTokenSource.Token); // wait for progressbar to finish animation
+        } catch (OperationCanceledException) { }
+        UpdateModel(newTree); // triggers progress.Finish after calculating the node impacts when model is changed
+      } catch {
+        progress.Finish();
+      }
+    }
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -56,4 +56,6 @@
       this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
       this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+      this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
       this.SuspendLayout();
       // 
@@ -61,5 +63,5 @@
       // 
       this.insertNodeToolStripMenuItem.Name = "insertNodeToolStripMenuItem";
-      this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+      this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
       this.insertNodeToolStripMenuItem.Text = "Insert Node";
       this.insertNodeToolStripMenuItem.Click += new System.EventHandler(this.insertNodeToolStripMenuItem_Click);
@@ -68,5 +70,5 @@
       // 
       this.changeNodeToolStripMenuItem.Name = "changeNodeToolStripMenuItem";
-      this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+      this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
       this.changeNodeToolStripMenuItem.Text = "Change Node";
       this.changeNodeToolStripMenuItem.Click += new System.EventHandler(this.changeNodeToolStripMenuItem_Click);
@@ -75,6 +77,6 @@
       // 
       this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
-      this.cutToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
-      this.cutToolStripMenuItem.Text = "Cut";
+      this.cutToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.cutToolStripMenuItem.Text = "Cut Subtree";
       this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
       // 
@@ -85,5 +87,5 @@
             this.removeSubtreeToolStripMenuItem});
       this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
-      this.removeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+      this.removeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
       this.removeToolStripMenuItem.Text = "Remove";
       this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeSubtreeToolStripMenuItem_Click);
@@ -106,6 +108,6 @@
       // 
       this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
-      this.pasteToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
-      this.pasteToolStripMenuItem.Text = "Paste";
+      this.pasteToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.pasteToolStripMenuItem.Text = "Paste Subtree";
       this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Clicked);
       // 
@@ -118,16 +120,28 @@
       // 
       this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
-      this.copyToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
-      this.copyToolStripMenuItem.Text = "Copy";
+      this.copyToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+      this.copyToolStripMenuItem.Text = "Copy Subtree";
       this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
+      // 
+      // toolStripSeparator1
+      // 
+      this.toolStripSeparator1.Name = "toolStripSeparator1";
+      this.toolStripSeparator1.Size = new System.Drawing.Size(162, 6);
+      // 
+      // toolStripSeparator2
+      // 
+      this.toolStripSeparator2.Name = "toolStripSeparator2";
+      this.toolStripSeparator2.Size = new System.Drawing.Size(162, 6);
       //
       // contextMenuStrip
       //
       this.contextMenuStrip.Opened += this.contextMenuStrip_Opened;
-      this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { insertNodeToolStripMenuItem, 
+      this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { toolStripSeparator1,
+                                                                 insertNodeToolStripMenuItem, 
+                                                                 removeToolStripMenuItem, 
                                                                  changeNodeToolStripMenuItem, 
+                                                                 toolStripSeparator2,
                                                                  copyToolStripMenuItem, 
                                                                  cutToolStripMenuItem, 
-                                                                 removeToolStripMenuItem, 
                                                                  pasteToolStripMenuItem });
       // 
@@ -139,5 +153,4 @@
       this.Name = "InteractiveSymbolicExpressionTreeChart";
       this.ResumeLayout(false);
-
     }
 
@@ -154,4 +167,6 @@
     private ToolStripSeparator toolStripSeparator;
     private ToolStripMenuItem copyToolStripMenuItem;
+    private ToolStripSeparator toolStripSeparator1;
+    private ToolStripSeparator toolStripSeparator2;
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -76,6 +76,6 @@
         pasteToolStripMenuItem.Visible = true;
         pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled
-                                                          && !(lastOp == EditOp.CutSubtree
-                                                               && tempNode.IterateNodesBreadth().Contains(currSelected.Content));
+                                                          && !(lastOp == EditOp.CutSubtree && tempNode.IterateNodesBreadth().Contains(node))
+                                                          && node.SubtreeCount < node.Symbol.MaximumArity;
       }
     }
@@ -83,19 +83,7 @@
     protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
       currSelected = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; ;
-      if (currSelected != null) {
-        currSelected.LineColor = Color.FromArgb(130, currSelected.LineColor);
-        RepaintNode(currSelected);
-      }
       base.OnSymbolicExpressionTreeNodeClicked(sender, e);
     }
 
-    protected override void SymbolicExpressionTreeChart_MouseClick(object sender, MouseEventArgs e) {
-      if (currSelected != null) {
-        currSelected.LineColor = Color.FromArgb(255, currSelected.LineColor);
-        RepaintNode(currSelected);
-      }
-      base.SymbolicExpressionTreeChart_MouseClick(sender, e);
-    }
-
     protected override void OnSymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
       currSelected = null;
@@ -103,4 +91,6 @@
     }
 
+
+    private static readonly ISymbolicExpressionGrammar grammar = new TypeCoherentExpressionGrammar();
     private void insertNodeToolStripMenuItem_Click(object sender, EventArgs e) {
       if (currSelected == null || currSelected.Content is SymbolicExpressionTreeTerminalNode) return;
@@ -108,9 +98,9 @@
 
       using (var dialog = new InsertNodeDialog()) {
-        dialog.SetAllowedSymbols(parent.Grammar.AllowedSymbols.Where(s => s.Enabled && s.InitialFrequency > 0.0 && !(s is ProgramRootSymbol || s is StartSymbol || s is Defun)));
+        dialog.SetAllowedSymbols(grammar.Symbols.Where(s => !(s is ProgramRootSymbol || s is StartSymbol || s is Defun || s is GroupSymbol))); // allow everything
         dialog.ShowDialog(this);
         if (dialog.DialogResult != DialogResult.OK) return;
 
-        var symbol = dialog.SelectedSymbol();
+        var symbol = dialog.SelectedSymbol;
         var node = symbol.CreateTreeNode();
         if (node is ConstantTreeNode) {
@@ -120,5 +110,5 @@
           var variable = node as VariableTreeNode;
           variable.Weight = double.Parse(dialog.variableWeightTextBox.Text);
-          variable.VariableName = dialog.variableNamesCombo.Text;
+          variable.VariableName = dialog.SelectedVariableName;
         } else if (node.Symbol.MinimumArity <= parent.SubtreeCount && node.Symbol.MaximumArity >= parent.SubtreeCount) {
           for (int i = parent.SubtreeCount - 1; i >= 0; --i) {
@@ -172,9 +162,9 @@
         foreach (var subtree in tempNode.IterateNodesPostfix()) {
           var visualNode = GetVisualSymbolicExpressionTreeNode(subtree);
-          visualNode.LineColor = Color.FromArgb(255, visualNode.LineColor); // reset the alpha value to 255
-          visualNode.TextColor = Color.FromArgb(255, visualNode.TextColor);
+          visualNode.LineColor = Color.Black;
+          visualNode.TextColor = Color.Black;
           if (subtree.Parent != null) {
             var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(subtree.Parent, subtree);
-            visualLine.LineColor = Color.FromArgb(255, visualLine.LineColor);
+            visualLine.LineColor = Color.Black;
           }
         }
@@ -183,13 +173,13 @@
       foreach (var node in tempNode.IterateNodesPostfix()) {
         var visualNode = GetVisualSymbolicExpressionTreeNode(node);
-        visualNode.LineColor = Color.FromArgb(100, visualNode.LineColor);
-        visualNode.TextColor = Color.FromArgb(100, visualNode.TextColor);
+        visualNode.LineColor = Color.LightGray;
+        visualNode.TextColor = Color.LightGray;
         foreach (var subtree in node.Subtrees) {
           var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(node, subtree);
-          visualLine.LineColor = Color.FromArgb(100, visualLine.LineColor);
-        }
-      }
-      currSelected = null;
-      Repaint();
+          visualLine.LineColor = Color.LightGray;
+        }
+      }
+      currSelected = null;
+      RepaintNodes(); // no need to redo the layout and repaint everything since this operation does not change the tree
     }
     private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) {
Index: anches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MathSymbolicDataAnalysisModelView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MathSymbolicDataAnalysisModelView.cs	(revision 17686)
+++ 	(revision )
@@ -1,70 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 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.IO;
-using System.Windows.Forms;
-using HeuristicLab.MainForm;
-using HeuristicLab.MainForm.WindowsForms;
-
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
-  [View("Mathematical Representation")]
-  [Content(typeof(ISymbolicDataAnalysisModel))]
-  public partial class MathSymbolicDataAnalysisModelView : AsynchronousContentView {
-    private SymbolicDataAnalysisExpressionLatexFormatter formatter = new SymbolicDataAnalysisExpressionLatexFormatter();
-    public MathSymbolicDataAnalysisModelView()
-      : base() {
-      InitializeComponent();
-      webBrowser.ScrollBarsEnabled = true;
-      webBrowser.ScriptErrorsSuppressed = false;
-
-      // update for the first time after page has loaded
-      webBrowser.DocumentCompleted += (sender, args) => RefreshHtmlPage();
-
-      string hlDir = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory);
-      webBrowser.Navigate("file://" + Path.Combine(hlDir, "displayModelFrame.html"));
-    }
-
-    public new ISymbolicDataAnalysisModel Content {
-      get { return (ISymbolicDataAnalysisModel)base.Content; }
-      set { base.Content = value; }
-    }
-
-    protected override void OnContentChanged() {
-      base.OnContentChanged();
-      RefreshHtmlPage();
-    }
-
-    private void RefreshHtmlPage() {
-      // only update if the page has loaded already
-      if (webBrowser.Document == null || webBrowser.Document.Body == null) return;
-
-      if (Content != null) {
-        HtmlElement newElement = webBrowser.Document.GetElementById("model");
-        newElement.InnerText = formatter.Format(Content.SymbolicExpressionTree);
-      } else {
-        HtmlElement newElement = webBrowser.Document.GetElementById("model");
-        newElement.InnerText = string.Empty;
-      }
-      webBrowser.Document.InvokeScript("refreshModel");
-    }
-  }
-}
Index: anches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MathSymbolicDataAnalysisModelView.designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MathSymbolicDataAnalysisModelView.designer.cs	(revision 17686)
+++ 	(revision )
@@ -1,81 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
-  partial class MathSymbolicDataAnalysisModelView {
-    /// <summary> 
-    /// Required designer variable.
-    /// </summary>
-    private System.ComponentModel.IContainer components = null;
-
-    /// <summary> 
-    /// Clean up any resources being used.
-    /// </summary>
-    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-    protected override void Dispose(bool disposing) {
-      if (disposing && (components != null)) {
-        webBrowser.Dispose();
-        components.Dispose();
-      }
-      base.Dispose(disposing);
-    }
-
-    #region Component Designer generated code
-
-    /// <summary> 
-    /// Required method for Designer support - do not modify 
-    /// the contents of this method with the code editor.
-    /// </summary>
-    private void InitializeComponent() {
-      this.webBrowser = new System.Windows.Forms.WebBrowser();
-      this.SuspendLayout();
-      // 
-      // webBrowser
-      // 
-      this.webBrowser.AllowNavigation = false;
-      this.webBrowser.AllowWebBrowserDrop = false;
-      this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.webBrowser.IsWebBrowserContextMenuEnabled = false;
-      this.webBrowser.Location = new System.Drawing.Point(0, 0);
-      this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
-      this.webBrowser.Name = "webBrowser";
-      this.webBrowser.Size = new System.Drawing.Size(352, 413);
-      this.webBrowser.TabIndex = 0;
-      this.webBrowser.WebBrowserShortcutsEnabled = false;
-      // 
-      // MathSymbolicDataAnalysisModelView
-      // 
-      this.AllowDrop = true;
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
-      this.Controls.Add(this.webBrowser);
-      this.Name = "MathSymbolicDataAnalysisModelView";
-      this.Size = new System.Drawing.Size(352, 413);
-      this.ResumeLayout(false);
-
-    }
-
-    #endregion
-
-    private System.Windows.Forms.WebBrowser webBrowser;
-
-  }
-}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,7 +24,9 @@
 using System.Text;
 using HeuristicLab.PluginInfrastructure;
+using System.Runtime.InteropServices;
+using System.IO;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
-  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4.5.$WCREV$")]
+  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4.12.$WCREV$")]
   [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll", PluginFileType.Assembly)]
   [PluginFile("displayModelFrame.html", PluginFileType.Data)]
@@ -37,14 +39,30 @@
   [PluginDependency("HeuristicLab.Data", "3.3")]
   [PluginDependency("HeuristicLab.Data.Views", "3.3")]
-  [PluginDependency("HeuristicLab.EPPlus", "3.1")]
+  [PluginDependency("HeuristicLab.EPPlus", "4.0.3")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.4")]
   [PluginDependency("HeuristicLab.MainForm", "3.3")]
   [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
-  [PluginDependency("HeuristicLab.MathJax", "1.1")]
+  [PluginDependency("HeuristicLab.MathJax", "1.2")]
   [PluginDependency("HeuristicLab.Optimization","3.3")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
   public class HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin : PluginBase {
+    // HeuristicLab is marked with zone identifier 'Internet' after download.
+    // This propagates to all extracted files and can be checked in the file properties.
+    // IE prevents execution of MathJax JavaScript inside of untrusted html
+    // Therefore we need to programmatically unblock the displayModelFrame.html file before extracting.
+    // see http://engram404.net/programmatically-unblocking-downloaded-files/
+
+    // for removing the Zone.Identifier alternative NTFS stream (effectively unblocking the file)
+    [DllImport("kernel32.dll", SetLastError = true)]
+    private static extern bool DeleteFile(string lpFileName);
+
+    public override void OnLoad() {
+      base.OnLoad();
+
+      // unblock mathjax.zip () 
+      DeleteFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "displayModelFrame.html:Zone.Identifier"));
+    }
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,5 +31,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
+[assembly: AssemblyCopyright("(c) HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -53,3 +53,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.5.$WCREV$")]
+[assembly: AssemblyFileVersion("3.4.12.$WCREV$")]
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,4 +22,5 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Drawing;
 using System.Linq;
@@ -66,9 +67,9 @@
     private void RegisterRunEvents(IEnumerable<IRun> runs) {
       foreach (IRun run in runs)
-        run.Changed += Run_Changed;
+        run.PropertyChanged += Run_PropertyChanged;
     }
     private void DeregisterRunEvents(IEnumerable<IRun> runs) {
       foreach (IRun run in runs)
-        run.Changed -= Run_Changed;
+        run.PropertyChanged -= Run_PropertyChanged;
     }
     private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
@@ -88,6 +89,7 @@
       if (!Content.UpdateOfRunsInProgress) UpdateData();
     }
-    private void Run_Changed(object sender, EventArgs e) {
-      if (!Content.UpdateOfRunsInProgress) UpdateData();
+    private void Run_PropertyChanged(object sender, PropertyChangedEventArgs e) {
+      if (!Content.UpdateOfRunsInProgress && e.PropertyName == "Visible")
+        UpdateData();
     }
     #endregion
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionHeatMapControl.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionHeatMapControl.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionHeatMapControl.cs	(revision 17687)
@@ -64,5 +64,5 @@
       InitializeComponent();
       progress = new Progress();
-      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);
+      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();//.AddOperationProgressToView(this, progress);
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionView.cs	(revision 17687)
@@ -84,5 +84,5 @@
       InitializeComponent();
       progress = new Progress();
-      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);
+      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();//.AddOperationProgressToView(this, progress);
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.cs	(revision 17687)
@@ -0,0 +1,74 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.IO;
+using System.Windows.Forms;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  [View("Mathematical Representation")]
+  [Content(typeof(ISymbolicDataAnalysisModel))]
+  public partial class SymbolicDataAnalysisModelMathView : AsynchronousContentView {
+    protected readonly SymbolicDataAnalysisExpressionLatexFormatter Formatter = new SymbolicDataAnalysisExpressionLatexFormatter();
+    public SymbolicDataAnalysisModelMathView()
+      : base() {
+      InitializeComponent();
+      webBrowser.ScrollBarsEnabled = true;
+      webBrowser.ScriptErrorsSuppressed = false;
+
+      // update for the first time after page has loaded
+      webBrowser.DocumentCompleted += (sender, args) => RefreshHtmlPage();
+
+      string hlDir = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory);
+      webBrowser.Navigate("file://" + Path.Combine(hlDir, "displayModelFrame.html"));
+    }
+
+    public new ISymbolicDataAnalysisModel Content {
+      get { return (ISymbolicDataAnalysisModel)base.Content; }
+      set { base.Content = value; }
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      RefreshHtmlPage();
+    }
+
+    private void RefreshHtmlPage() {
+      // only update if the page has loaded already
+      if (webBrowser.Document == null || webBrowser.Document.Body == null) return;
+
+      if (Content != null) {
+        HtmlElement newElement = webBrowser.Document.GetElementById("model");
+        newElement.InnerText = GetFormattedTree();
+        webBrowser.Document.InvokeScript("refreshModel");
+      } else {
+        HtmlElement newElement = webBrowser.Document.GetElementById("model");
+        newElement.InnerText = string.Empty;
+      }
+    }
+
+    protected virtual string GetFormattedTree() {
+      return Formatter.Format(Content.SymbolicExpressionTree);
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.designer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.designer.cs	(revision 17687)
@@ -0,0 +1,81 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
+  partial class SymbolicDataAnalysisModelMathView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        webBrowser.Dispose();
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.webBrowser = new System.Windows.Forms.WebBrowser();
+      this.SuspendLayout();
+      // 
+      // webBrowser
+      // 
+      this.webBrowser.AllowNavigation = false;
+      this.webBrowser.AllowWebBrowserDrop = false;
+      this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.webBrowser.IsWebBrowserContextMenuEnabled = false;
+      this.webBrowser.Location = new System.Drawing.Point(0, 0);
+      this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
+      this.webBrowser.Name = "webBrowser";
+      this.webBrowser.Size = new System.Drawing.Size(352, 413);
+      this.webBrowser.TabIndex = 0;
+      this.webBrowser.WebBrowserShortcutsEnabled = false;
+      // 
+      // MathSymbolicDataAnalysisModelView
+      // 
+      this.AllowDrop = true;
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+      this.Controls.Add(this.webBrowser);
+      this.Name = "MathSymbolicDataAnalysisModelView";
+      this.Size = new System.Drawing.Size(352, 413);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.WebBrowser webBrowser;
+
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -63,4 +63,5 @@
       // weightInitializationMuTextBox
       // 
+      this.weightInitializationMuTextBox.Size = new System.Drawing.Size(293, 20);
       this.toolTip.SetToolTip(this.weightInitializationMuTextBox, "The mu (mean) parameter of the normal distribution from which to sample the initi" +
         "al weights.");
@@ -69,5 +70,5 @@
       // 
       this.initializationGroupBox.Location = new System.Drawing.Point(6, 7);
-      this.initializationGroupBox.Size = new System.Drawing.Size(379, 73);
+      this.initializationGroupBox.Size = new System.Drawing.Size(391, 73);
       // 
       // weightSigmaLabel
@@ -77,4 +78,5 @@
       // weightInitializationSigmaTextBox
       // 
+      this.weightInitializationSigmaTextBox.Size = new System.Drawing.Size(293, 20);
       this.toolTip.SetToolTip(this.weightInitializationSigmaTextBox, "The sigma parameter for the normal distribution from which to sample the initial " +
         "weights.");
@@ -83,8 +85,9 @@
       // 
       this.mutationGroupBox.Location = new System.Drawing.Point(6, 86);
-      this.mutationGroupBox.Size = new System.Drawing.Size(379, 73);
+      this.mutationGroupBox.Size = new System.Drawing.Size(391, 95);
       // 
       // multiplicativeWeightChangeLabel
       // 
+      this.multiplicativeWeightChangeLabel.TabIndex = 4;
       this.toolTip.SetToolTip(this.multiplicativeWeightChangeLabel, "The sigma parameter for the normal distribution to use to sample a multiplicative" +
         " change in weight.");
@@ -92,4 +95,5 @@
       // multiplicativeWeightChangeSigmaTextBox
       // 
+      this.multiplicativeWeightChangeSigmaTextBox.TabIndex = 5;
       this.toolTip.SetToolTip(this.multiplicativeWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample a multiplica" +
         "tive change in weight.");
@@ -97,4 +101,5 @@
       // additiveWeightChangeLabel
       // 
+      this.additiveWeightChangeLabel.TabIndex = 2;
       this.toolTip.SetToolTip(this.additiveWeightChangeLabel, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
         "change in weight.");
@@ -102,4 +107,5 @@
       // additiveWeightChangeSigmaTextBox
       // 
+      this.additiveWeightChangeSigmaTextBox.TabIndex = 3;
       this.toolTip.SetToolTip(this.additiveWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
         "change in weight.");
@@ -111,14 +117,27 @@
       // parametersTabPage
       // 
-      this.parametersTabPage.Size = new System.Drawing.Size(400, 149);
+      this.parametersTabPage.Size = new System.Drawing.Size(412, 208);
       // 
       // tabControl
       // 
       this.tabControl.Location = new System.Drawing.Point(0, 179);
-      this.tabControl.Size = new System.Drawing.Size(408, 175);
-      this.tabControl.TabIndex = 9;
+      this.tabControl.Size = new System.Drawing.Size(420, 234);
+      this.tabControl.TabIndex = 13;
+      // 
+      // varChangeProbTextBox
+      // 
+      this.varChangeProbTextBox.TabIndex = 1;
+      this.toolTip.SetToolTip(this.varChangeProbTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
+        "change in weight.");
+      // 
+      // varChangeProbLabel
+      // 
+      this.varChangeProbLabel.TabIndex = 0;
+      this.toolTip.SetToolTip(this.varChangeProbLabel, "The probability of changing the referenced variable in [0..1]. Variable reference" +
+        "s are sampled uniformly.");
       // 
       // initialFrequencyLabel
       // 
+      this.initialFrequencyLabel.TabIndex = 2;
       this.toolTip.SetToolTip(this.initialFrequencyLabel, "Relative frequency of the symbol in randomly created trees");
       // 
@@ -126,14 +145,30 @@
       // 
       this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.initialFrequencyTextBox.Size = new System.Drawing.Size(323, 20);
+      this.initialFrequencyTextBox.TabIndex = 3;
+      // 
+      // enabledCheckBox
+      // 
+      this.enabledCheckBox.TabIndex = 8;
+      // 
+      // minimumArityLabel
+      // 
+      this.minimumArityLabel.TabIndex = 4;
+      this.toolTip.SetToolTip(this.minimumArityLabel, "The minimum arity of the symbol");
+      // 
+      // maximumArityLabel
+      // 
+      this.toolTip.SetToolTip(this.maximumArityLabel, "The maximum arity of the symbol");
       // 
       // minimumArityTextBox
       // 
       this.errorProvider.SetIconAlignment(this.minimumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.minimumArityTextBox.Size = new System.Drawing.Size(315, 20);
+      this.minimumArityTextBox.Size = new System.Drawing.Size(327, 20);
+      this.minimumArityTextBox.TabIndex = 5;
       // 
       // maximumArityTextBox
       // 
       this.errorProvider.SetIconAlignment(this.maximumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.maximumArityTextBox.Size = new System.Drawing.Size(315, 20);
+      this.maximumArityTextBox.Size = new System.Drawing.Size(327, 20);
       // 
       // nameTextBox
@@ -141,4 +176,9 @@
       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      this.nameTextBox.Size = new System.Drawing.Size(302, 20);
+      // 
+      // infoLabel
+      // 
+      this.infoLabel.Location = new System.Drawing.Point(401, 3);
       // 
       // minTimeOffsetLabel
@@ -148,5 +188,5 @@
       this.minTimeOffsetLabel.Name = "minTimeOffsetLabel";
       this.minTimeOffsetLabel.Size = new System.Drawing.Size(81, 13);
-      this.minTimeOffsetLabel.TabIndex = 5;
+      this.minTimeOffsetLabel.TabIndex = 9;
       this.minTimeOffsetLabel.Text = "Min. time offset:";
       // 
@@ -157,30 +197,29 @@
       this.maxTimeOffsetLabel.Name = "maxTimeOffsetLabel";
       this.maxTimeOffsetLabel.Size = new System.Drawing.Size(84, 13);
-      this.maxTimeOffsetLabel.TabIndex = 7;
+      this.maxTimeOffsetLabel.TabIndex = 11;
       this.maxTimeOffsetLabel.Text = "Max. time offset:";
       // 
       // minTimeOffsetTextBox
       // 
-      this.minTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+      this.minTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
       this.minTimeOffsetTextBox.Location = new System.Drawing.Point(93, 127);
       this.minTimeOffsetTextBox.Name = "minTimeOffsetTextBox";
-      this.minTimeOffsetTextBox.Size = new System.Drawing.Size(315, 20);
-      this.minTimeOffsetTextBox.TabIndex = 6;
+      this.minTimeOffsetTextBox.Size = new System.Drawing.Size(327, 20);
+      this.minTimeOffsetTextBox.TabIndex = 10;
       this.minTimeOffsetTextBox.TextChanged += new System.EventHandler(this.minTimeOffsetTextBox_TextChanged);
       // 
       // maxTimeOffsetTextBox
       // 
-      this.maxTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+      this.maxTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
       this.maxTimeOffsetTextBox.Location = new System.Drawing.Point(93, 153);
       this.maxTimeOffsetTextBox.Name = "maxTimeOffsetTextBox";
-      this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(315, 20);
-      this.maxTimeOffsetTextBox.TabIndex = 8;
+      this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(327, 20);
+      this.maxTimeOffsetTextBox.TabIndex = 12;
       this.maxTimeOffsetTextBox.TextChanged += new System.EventHandler(this.maxTimeOffsetTextBox_TextChanged);
       // 
       // LaggedVariableView
       // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
       this.Controls.Add(this.minTimeOffsetTextBox);
@@ -189,5 +228,6 @@
       this.Controls.Add(this.maxTimeOffsetTextBox);
       this.Name = "LaggedVariableView";
-      this.Size = new System.Drawing.Size(408, 352);
+      this.Size = new System.Drawing.Size(420, 411);
+      this.Controls.SetChildIndex(this.enabledCheckBox, 0);
       this.Controls.SetChildIndex(this.maxTimeOffsetTextBox, 0);
       this.Controls.SetChildIndex(this.minTimeOffsetLabel, 0);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -237,4 +237,5 @@
       // variableNamesTabPage
       // 
+      this.variableNamesTabPage.BackColor = System.Drawing.SystemColors.Window;
       this.variableNamesTabPage.Location = new System.Drawing.Point(4, 22);
       this.variableNamesTabPage.Name = "variableNamesTabPage";
@@ -243,8 +244,8 @@
       this.variableNamesTabPage.TabIndex = 0;
       this.variableNamesTabPage.Text = "Variable Names";
-      this.variableNamesTabPage.UseVisualStyleBackColor = true;
       // 
       // parametersTabPage
       // 
+      this.parametersTabPage.BackColor = System.Drawing.SystemColors.Window;
       this.parametersTabPage.Controls.Add(this.initializationGroupBox);
       this.parametersTabPage.Controls.Add(this.mutationGroupBox);
@@ -255,5 +256,4 @@
       this.parametersTabPage.TabIndex = 1;
       this.parametersTabPage.Text = "Parameters";
-      this.parametersTabPage.UseVisualStyleBackColor = true;
       // 
       // initializationGroupBox
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -54,5 +54,5 @@
     private void RegisterVariableNamesViewContentEvents() {
       variableNamesView.Content.ItemsAdded += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
-      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
+      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
       variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
       variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
@@ -64,5 +64,5 @@
     private void DeregisterVariableNamesViewContentEvents() {
       variableNamesView.Content.ItemsAdded -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
-      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
+      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
       variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
       variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
@@ -153,4 +153,10 @@
     }
 
+    private void VariableNames_Removed(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
+      foreach (var newVar in e.Items)
+        newVar.ValueChanged -= new EventHandler(Variable_ValueChanged);
+      UpdateContent();
+    }
+
     private void Variable_ValueChanged(object sender, EventArgs e) {
       UpdateContent();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -51,4 +51,6 @@
       this.weightInitializationSigmaTextBox = new System.Windows.Forms.TextBox();
       this.mutationGroupBox = new System.Windows.Forms.GroupBox();
+      this.varChangeProbTextBox = new System.Windows.Forms.TextBox();
+      this.varChangeProbLabel = new System.Windows.Forms.Label();
       this.multiplicativeWeightChangeLabel = new System.Windows.Forms.Label();
       this.multiplicativeWeightChangeSigmaTextBox = new System.Windows.Forms.TextBox();
@@ -67,4 +69,5 @@
       // initialFrequencyLabel
       // 
+      this.initialFrequencyLabel.TabIndex = 2;
       this.toolTip.SetToolTip(this.initialFrequencyLabel, "Relative frequency of the symbol in randomly created trees");
       // 
@@ -73,7 +76,13 @@
       this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
       this.initialFrequencyTextBox.Size = new System.Drawing.Size(311, 20);
+      this.initialFrequencyTextBox.TabIndex = 3;
+      // 
+      // enabledCheckBox
+      // 
+      this.enabledCheckBox.TabIndex = 8;
       // 
       // minimumArityLabel
       // 
+      this.minimumArityLabel.TabIndex = 4;
       this.toolTip.SetToolTip(this.minimumArityLabel, "The minimum arity of the symbol");
       // 
@@ -86,4 +95,5 @@
       this.errorProvider.SetIconAlignment(this.minimumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
       this.minimumArityTextBox.Size = new System.Drawing.Size(311, 20);
+      this.minimumArityTextBox.TabIndex = 5;
       // 
       // maximumArityTextBox
@@ -114,5 +124,5 @@
       // weightInitializationMuTextBox
       // 
-      this.weightInitializationMuTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+      this.weightInitializationMuTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
       this.weightInitializationMuTextBox.Location = new System.Drawing.Point(92, 19);
@@ -126,5 +136,5 @@
       // initializationGroupBox
       // 
-      this.initializationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+      this.initializationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
       this.initializationGroupBox.Controls.Add(this.weightSigmaLabel);
@@ -151,5 +161,5 @@
       // weightInitializationSigmaTextBox
       // 
-      this.weightInitializationSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+      this.weightInitializationSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
       this.weightInitializationSigmaTextBox.Location = new System.Drawing.Point(92, 45);
@@ -163,6 +173,8 @@
       // mutationGroupBox
       // 
-      this.mutationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
+      this.mutationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.mutationGroupBox.Controls.Add(this.varChangeProbTextBox);
+      this.mutationGroupBox.Controls.Add(this.varChangeProbLabel);
       this.mutationGroupBox.Controls.Add(this.multiplicativeWeightChangeLabel);
       this.mutationGroupBox.Controls.Add(this.multiplicativeWeightChangeSigmaTextBox);
@@ -171,16 +183,39 @@
       this.mutationGroupBox.Location = new System.Drawing.Point(6, 85);
       this.mutationGroupBox.Name = "mutationGroupBox";
-      this.mutationGroupBox.Size = new System.Drawing.Size(391, 73);
+      this.mutationGroupBox.Size = new System.Drawing.Size(391, 97);
       this.mutationGroupBox.TabIndex = 1;
       this.mutationGroupBox.TabStop = false;
       this.mutationGroupBox.Text = "Mutation";
       // 
+      // varChangeProbTextBox
+      // 
+      this.varChangeProbTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.varChangeProbTextBox.Location = new System.Drawing.Point(201, 13);
+      this.varChangeProbTextBox.Name = "varChangeProbTextBox";
+      this.varChangeProbTextBox.Size = new System.Drawing.Size(184, 20);
+      this.varChangeProbTextBox.TabIndex = 1;
+      this.toolTip.SetToolTip(this.varChangeProbTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
+        "change in weight.");
+      this.varChangeProbTextBox.TextChanged += new System.EventHandler(this.VarProbTextBox_TextChanged);
+      // 
+      // varChangeProbLabel
+      // 
+      this.varChangeProbLabel.AutoSize = true;
+      this.varChangeProbLabel.Location = new System.Drawing.Point(6, 16);
+      this.varChangeProbLabel.Name = "varChangeProbLabel";
+      this.varChangeProbLabel.Size = new System.Drawing.Size(134, 13);
+      this.varChangeProbLabel.TabIndex = 0;
+      this.varChangeProbLabel.Text = "Variable change probability";
+      this.toolTip.SetToolTip(this.varChangeProbLabel, "The probability of changing the referenced variable in [0..1]. Variable reference" +
+        "s are sampled uniformly.");
+      // 
       // multiplicativeWeightChangeLabel
       // 
       this.multiplicativeWeightChangeLabel.AutoSize = true;
-      this.multiplicativeWeightChangeLabel.Location = new System.Drawing.Point(6, 48);
+      this.multiplicativeWeightChangeLabel.Location = new System.Drawing.Point(6, 68);
       this.multiplicativeWeightChangeLabel.Name = "multiplicativeWeightChangeLabel";
       this.multiplicativeWeightChangeLabel.Size = new System.Drawing.Size(180, 13);
-      this.multiplicativeWeightChangeLabel.TabIndex = 2;
+      this.multiplicativeWeightChangeLabel.TabIndex = 4;
       this.multiplicativeWeightChangeLabel.Text = "Multiplicative weight change (sigma):";
       this.toolTip.SetToolTip(this.multiplicativeWeightChangeLabel, "The sigma parameter for the normal distribution to use to sample a multiplicative" +
@@ -189,10 +224,10 @@
       // multiplicativeWeightChangeSigmaTextBox
       // 
-      this.multiplicativeWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.multiplicativeWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 45);
+      this.multiplicativeWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.multiplicativeWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 65);
       this.multiplicativeWeightChangeSigmaTextBox.Name = "multiplicativeWeightChangeSigmaTextBox";
       this.multiplicativeWeightChangeSigmaTextBox.Size = new System.Drawing.Size(184, 20);
-      this.multiplicativeWeightChangeSigmaTextBox.TabIndex = 3;
+      this.multiplicativeWeightChangeSigmaTextBox.TabIndex = 5;
       this.toolTip.SetToolTip(this.multiplicativeWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample a multiplica" +
         "tive change in weight.");
@@ -202,8 +237,8 @@
       // 
       this.additiveWeightChangeLabel.AutoSize = true;
-      this.additiveWeightChangeLabel.Location = new System.Drawing.Point(6, 22);
+      this.additiveWeightChangeLabel.Location = new System.Drawing.Point(6, 42);
       this.additiveWeightChangeLabel.Name = "additiveWeightChangeLabel";
       this.additiveWeightChangeLabel.Size = new System.Drawing.Size(157, 13);
-      this.additiveWeightChangeLabel.TabIndex = 0;
+      this.additiveWeightChangeLabel.TabIndex = 2;
       this.additiveWeightChangeLabel.Text = "Additive weight change (sigma):";
       this.toolTip.SetToolTip(this.additiveWeightChangeLabel, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
@@ -212,10 +247,10 @@
       // additiveWeightChangeSigmaTextBox
       // 
-      this.additiveWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.additiveWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 19);
+      this.additiveWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.additiveWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 39);
       this.additiveWeightChangeSigmaTextBox.Name = "additiveWeightChangeSigmaTextBox";
       this.additiveWeightChangeSigmaTextBox.Size = new System.Drawing.Size(184, 20);
-      this.additiveWeightChangeSigmaTextBox.TabIndex = 1;
+      this.additiveWeightChangeSigmaTextBox.TabIndex = 3;
       this.toolTip.SetToolTip(this.additiveWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
         "change in weight.");
@@ -224,6 +259,6 @@
       // tabControl
       // 
-      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
+      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
             | System.Windows.Forms.AnchorStyles.Right)));
       this.tabControl.Controls.Add(this.variableNamesTabPage);
@@ -232,19 +267,20 @@
       this.tabControl.Name = "tabControl";
       this.tabControl.SelectedIndex = 0;
-      this.tabControl.Size = new System.Drawing.Size(408, 190);
-      this.tabControl.TabIndex = 5;
+      this.tabControl.Size = new System.Drawing.Size(408, 216);
+      this.tabControl.TabIndex = 9;
       // 
       // variableNamesTabPage
       // 
+      this.variableNamesTabPage.BackColor = System.Drawing.SystemColors.Window;
       this.variableNamesTabPage.Location = new System.Drawing.Point(4, 22);
       this.variableNamesTabPage.Name = "variableNamesTabPage";
       this.variableNamesTabPage.Padding = new System.Windows.Forms.Padding(3);
-      this.variableNamesTabPage.Size = new System.Drawing.Size(400, 164);
+      this.variableNamesTabPage.Size = new System.Drawing.Size(400, 190);
       this.variableNamesTabPage.TabIndex = 0;
       this.variableNamesTabPage.Text = "Variable Names";
-      this.variableNamesTabPage.UseVisualStyleBackColor = true;
       // 
       // parametersTabPage
       // 
+      this.parametersTabPage.BackColor = System.Drawing.SystemColors.Window;
       this.parametersTabPage.Controls.Add(this.mutationGroupBox);
       this.parametersTabPage.Controls.Add(this.initializationGroupBox);
@@ -252,16 +288,15 @@
       this.parametersTabPage.Name = "parametersTabPage";
       this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
-      this.parametersTabPage.Size = new System.Drawing.Size(400, 164);
+      this.parametersTabPage.Size = new System.Drawing.Size(400, 190);
       this.parametersTabPage.TabIndex = 1;
       this.parametersTabPage.Text = "Parameters";
-      this.parametersTabPage.UseVisualStyleBackColor = true;
       // 
       // VariableView
       // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
       this.Controls.Add(this.tabControl);
       this.Name = "VariableView";
-      this.Size = new System.Drawing.Size(408, 317);
+      this.Size = new System.Drawing.Size(408, 346);
+      this.Controls.SetChildIndex(this.enabledCheckBox, 0);
       this.Controls.SetChildIndex(this.maximumArityLabel, 0);
       this.Controls.SetChildIndex(this.maximumArityTextBox, 0);
@@ -301,4 +336,6 @@
     protected System.Windows.Forms.TabPage parametersTabPage;
     protected System.Windows.Forms.TabControl tabControl;
+    protected System.Windows.Forms.TextBox varChangeProbTextBox;
+    protected System.Windows.Forms.Label varChangeProbLabel;
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,15 +29,14 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
 using HeuristicLab.MainForm;
-using HeuristicLab.MainForm.WindowsForms;
 
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
   [View("Variable View")]
-  [Content(typeof(Variable), true)]
+  [Content(typeof(VariableBase), true)]
   public partial class VariableView : SymbolView {
     private CheckedItemCollectionView<StringValue> variableNamesView;
 
-    public new Variable Content {
-      get { return (Variable)base.Content; }
+    public new VariableBase Content {
+      get { return (VariableBase)base.Content; }
       set { base.Content = value; }
     }
@@ -55,5 +54,5 @@
     private void RegisterVariableNamesViewContentEvents() {
       variableNamesView.Content.ItemsAdded += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
-      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
+      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
       variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
       variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
@@ -66,5 +65,5 @@
     private void DeregisterVariableNamesViewContentEvents() {
       variableNamesView.Content.ItemsAdded -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
-      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
+      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
       variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
       variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
@@ -101,4 +100,6 @@
       multiplicativeWeightChangeSigmaTextBox.Enabled = Content != null;
       multiplicativeWeightChangeSigmaTextBox.ReadOnly = ReadOnly;
+      varChangeProbTextBox.Enabled = Content != null;
+      varChangeProbTextBox.ReadOnly = ReadOnly;
     }
 
@@ -118,4 +119,10 @@
     }
 
+    private void VariableNames_Removed(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
+      foreach (var newVar in e.Items)
+        newVar.ValueChanged -= new EventHandler(Variable_ValueChanged);
+      UpdateContent();
+    }
+
     private void Variable_ValueChanged(object sender, EventArgs e) {
       UpdateContent();
@@ -126,5 +133,6 @@
         Content.Fixed = true;
         DeregisterContentEvents();
-        Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value).ToList();
+        Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value);
+        Content.AllVariableNames = variableNamesView.Content.Select(x => x.Value);
         RegisterContentEvents();
       }
@@ -166,4 +174,14 @@
       } else {
         errorProvider.SetError(multiplicativeWeightChangeSigmaTextBox, "Invalid value");
+      }
+    }
+
+    private void VarProbTextBox_TextChanged(object sender, EventArgs e) {
+      double prob;
+      if (double.TryParse(varChangeProbTextBox.Text, out prob) && prob >= 0.0 && prob <= 1.0) {
+        Content.VariableChangeProbability = prob;
+        errorProvider.SetError(varChangeProbTextBox, string.Empty);
+      } else {
+        errorProvider.SetError(varChangeProbTextBox, "Invalid value");
       }
     }
@@ -177,4 +195,5 @@
         additiveWeightChangeSigmaTextBox.Text = string.Empty;
         multiplicativeWeightChangeSigmaTextBox.Text = string.Empty;
+        varChangeProbTextBox.Text = string.Empty;
         // temporarily deregister to prevent circular calling of events
         DeregisterVariableNamesViewContentEvents();
@@ -194,8 +213,10 @@
         additiveWeightChangeSigmaTextBox.Text = Content.WeightManipulatorSigma.ToString();
         multiplicativeWeightChangeSigmaTextBox.Text = Content.MultiplicativeWeightManipulatorSigma.ToString();
+        varChangeProbTextBox.Text = Content.VariableChangeProbability.ToString();
       }
       SetEnabledStateOfControls();
     }
     #endregion
+
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -54,5 +54,4 @@
       this.symbolicExpressionTreeView.Content = null;
       this.symbolicExpressionTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.symbolicExpressionTreeView.Font = new System.Drawing.Font("Consolas", 8.25F);
       this.symbolicExpressionTreeView.Location = new System.Drawing.Point(0, 0);
       this.symbolicExpressionTreeView.Name = "symbolicExpressionTreeView";
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -67,5 +67,5 @@
       // oldValueTextBox
       // 
-      this.oldValueTextBox.Location = new System.Drawing.Point(123, 6);
+      this.oldValueTextBox.Location = new System.Drawing.Point(106, 6);
       this.oldValueTextBox.Name = "oldValueTextBox";
       this.oldValueTextBox.ReadOnly = true;
@@ -75,5 +75,5 @@
       // newValueTextBox
       // 
-      this.newValueTextBox.Location = new System.Drawing.Point(123, 42);
+      this.newValueTextBox.Location = new System.Drawing.Point(106, 32);
       this.newValueTextBox.Name = "newValueTextBox";
       this.newValueTextBox.Size = new System.Drawing.Size(131, 20);
@@ -86,5 +86,5 @@
       // 
       this.newValueLabel.AutoSize = true;
-      this.newValueLabel.Location = new System.Drawing.Point(12, 45);
+      this.newValueLabel.Location = new System.Drawing.Point(12, 35);
       this.newValueLabel.Name = "newValueLabel";
       this.newValueLabel.Size = new System.Drawing.Size(59, 13);
@@ -101,5 +101,5 @@
       // 
       this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-      this.okButton.Location = new System.Drawing.Point(15, 79);
+      this.okButton.Location = new System.Drawing.Point(81, 66);
       this.okButton.Name = "okButton";
       this.okButton.Size = new System.Drawing.Size(75, 23);
@@ -113,5 +113,5 @@
       this.cancelButton.CausesValidation = false;
       this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-      this.cancelButton.Location = new System.Drawing.Point(179, 79);
+      this.cancelButton.Location = new System.Drawing.Point(162, 66);
       this.cancelButton.Name = "cancelButton";
       this.cancelButton.Size = new System.Drawing.Size(75, 23);
@@ -127,5 +127,5 @@
       this.AutoSize = true;
       this.CancelButton = this.cancelButton;
-      this.ClientSize = new System.Drawing.Size(269, 116);
+      this.ClientSize = new System.Drawing.Size(248, 101);
       this.ControlBox = false;
       this.Controls.Add(this.cancelButton);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -57,4 +57,5 @@
       this.okButton = new System.Windows.Forms.Button();
       this.cancelButton = new System.Windows.Forms.Button();
+      this.variableNameTextBox = new System.Windows.Forms.TextBox();
       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
       this.SuspendLayout();
@@ -63,5 +64,5 @@
       // 
       this.nodeSymbolLabel.AutoSize = true;
-      this.nodeSymbolLabel.Location = new System.Drawing.Point(13, 13);
+      this.nodeSymbolLabel.Location = new System.Drawing.Point(19, 13);
       this.nodeSymbolLabel.Name = "nodeSymbolLabel";
       this.nodeSymbolLabel.Size = new System.Drawing.Size(41, 13);
@@ -73,7 +74,7 @@
       this.allowedSymbolsCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.allowedSymbolsCombo.FormattingEnabled = true;
-      this.allowedSymbolsCombo.Location = new System.Drawing.Point(120, 10);
+      this.allowedSymbolsCombo.Location = new System.Drawing.Point(101, 10);
       this.allowedSymbolsCombo.Name = "allowedSymbolsCombo";
-      this.allowedSymbolsCombo.Size = new System.Drawing.Size(108, 21);
+      this.allowedSymbolsCombo.Size = new System.Drawing.Size(127, 21);
       this.allowedSymbolsCombo.TabIndex = 1;
       this.allowedSymbolsCombo.SelectedIndexChanged += new System.EventHandler(this.allowedSymbolsCombo_SelectedIndexChanged);
@@ -83,5 +84,5 @@
       // 
       this.variableWeightLabel.AutoSize = true;
-      this.variableWeightLabel.Location = new System.Drawing.Point(13, 44);
+      this.variableWeightLabel.Location = new System.Drawing.Point(19, 40);
       this.variableWeightLabel.Name = "variableWeightLabel";
       this.variableWeightLabel.Size = new System.Drawing.Size(41, 13);
@@ -93,5 +94,5 @@
       // 
       this.variableNameLabel.AutoSize = true;
-      this.variableNameLabel.Location = new System.Drawing.Point(13, 74);
+      this.variableNameLabel.Location = new System.Drawing.Point(19, 66);
       this.variableNameLabel.Name = "variableNameLabel";
       this.variableNameLabel.Size = new System.Drawing.Size(35, 13);
@@ -104,7 +105,7 @@
       this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.variableNamesCombo.FormattingEnabled = true;
-      this.variableNamesCombo.Location = new System.Drawing.Point(120, 71);
+      this.variableNamesCombo.Location = new System.Drawing.Point(101, 63);
       this.variableNamesCombo.Name = "variableNamesCombo";
-      this.variableNamesCombo.Size = new System.Drawing.Size(108, 21);
+      this.variableNamesCombo.Size = new System.Drawing.Size(127, 21);
       this.variableNamesCombo.TabIndex = 5;
       this.variableNamesCombo.Visible = false;
@@ -112,7 +113,7 @@
       // variableWeightTextBox
       // 
-      this.variableWeightTextBox.Location = new System.Drawing.Point(120, 41);
+      this.variableWeightTextBox.Location = new System.Drawing.Point(101, 37);
       this.variableWeightTextBox.Name = "variableWeightTextBox";
-      this.variableWeightTextBox.Size = new System.Drawing.Size(108, 20);
+      this.variableWeightTextBox.Size = new System.Drawing.Size(127, 20);
       this.variableWeightTextBox.TabIndex = 6;
       this.variableWeightTextBox.Text = "0.0";
@@ -122,7 +123,7 @@
       // constantValueTextBox
       // 
-      this.constantValueTextBox.Location = new System.Drawing.Point(120, 41);
+      this.constantValueTextBox.Location = new System.Drawing.Point(101, 37);
       this.constantValueTextBox.Name = "constantValueTextBox";
-      this.constantValueTextBox.Size = new System.Drawing.Size(108, 20);
+      this.constantValueTextBox.Size = new System.Drawing.Size(127, 20);
       this.constantValueTextBox.TabIndex = 7;
       this.constantValueTextBox.Text = "0.0";
@@ -133,5 +134,5 @@
       // 
       this.constantValueLabel.AutoSize = true;
-      this.constantValueLabel.Location = new System.Drawing.Point(13, 44);
+      this.constantValueLabel.Location = new System.Drawing.Point(19, 40);
       this.constantValueLabel.Name = "constantValueLabel";
       this.constantValueLabel.Size = new System.Drawing.Size(34, 13);
@@ -149,5 +150,5 @@
       // 
       this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-      this.okButton.Location = new System.Drawing.Point(12, 112);
+      this.okButton.Location = new System.Drawing.Point(72, 98);
       this.okButton.Name = "okButton";
       this.okButton.Size = new System.Drawing.Size(75, 23);
@@ -160,5 +161,5 @@
       // 
       this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-      this.cancelButton.Location = new System.Drawing.Point(153, 112);
+      this.cancelButton.Location = new System.Drawing.Point(153, 98);
       this.cancelButton.Name = "cancelButton";
       this.cancelButton.Size = new System.Drawing.Size(75, 23);
@@ -168,4 +169,12 @@
       this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
       // 
+      // variableNameTextBox
+      // 
+      this.variableNameTextBox.Location = new System.Drawing.Point(101, 63);
+      this.variableNameTextBox.Name = "variableNameTextBox";
+      this.variableNameTextBox.Size = new System.Drawing.Size(127, 20);
+      this.variableNameTextBox.TabIndex = 11;
+      this.variableNameTextBox.Visible = false;
+      // 
       // InsertNodeDialog
       // 
@@ -173,6 +182,7 @@
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.CancelButton = this.cancelButton;
-      this.ClientSize = new System.Drawing.Size(240, 147);
+      this.ClientSize = new System.Drawing.Size(241, 133);
       this.ControlBox = false;
+      this.Controls.Add(this.variableNameTextBox);
       this.Controls.Add(this.cancelButton);
       this.Controls.Add(this.okButton);
@@ -208,4 +218,5 @@
     private System.Windows.Forms.Button cancelButton;
     private System.Windows.Forms.Button okButton;
+    private System.Windows.Forms.TextBox variableNameTextBox;
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Linq;
 using System.Text;
 using System.Windows.Forms;
@@ -30,4 +31,13 @@
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
   public partial class InsertNodeDialog : Form {
+    public string SelectedVariableName {
+      get {
+        var variable = SelectedSymbol as Variable;
+        if (variable == null)
+          return string.Empty;
+        return variable.VariableNames.Any() ? variableNamesCombo.Text : variableNameTextBox.Text;
+      }
+    }
+
     public InsertNodeDialog() {
       InitializeComponent();
@@ -40,6 +50,6 @@
     }
 
-    public ISymbol SelectedSymbol() {
-      return (ISymbol)allowedSymbolsCombo.SelectedItem;
+    public ISymbol SelectedSymbol {
+      get { return (ISymbol)allowedSymbolsCombo.SelectedItem; }
     }
 
@@ -55,10 +65,17 @@
         constantValueLabel.Visible = true;
         constantValueTextBox.Visible = true;
-      } else if (symbol is Variable) {
-        var variable = (Variable)symbol;
-        foreach (var name in variable.VariableNames) variableNamesCombo.Items.Add(name);
-        variableNamesCombo.SelectedIndex = 0;
+      } else if (symbol is VariableBase) {
+        var variableSymbol = (VariableBase)symbol;
+        if (variableSymbol.VariableNames.Any()) {
+          foreach (var name in variableSymbol.VariableNames)
+            variableNamesCombo.Items.Add(name);
+          variableNamesCombo.SelectedIndex = 0;
+          variableNamesCombo.Visible = true;
+          variableNameTextBox.Visible = false;
+        } else {
+          variableNamesCombo.Visible = false;
+          variableNameTextBox.Visible = true;
+        }
         variableNameLabel.Visible = true;
-        variableNamesCombo.Visible = true;
         variableWeightLabel.Visible = true;
         variableWeightTextBox.Visible = true;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -55,4 +55,5 @@
       this.okButton = new System.Windows.Forms.Button();
       this.cancelButton = new System.Windows.Forms.Button();
+      this.variableNameTextBox = new System.Windows.Forms.TextBox();
       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
       this.SuspendLayout();
@@ -61,5 +62,5 @@
       // 
       this.originalValueLabel.AutoSize = true;
-      this.originalValueLabel.Location = new System.Drawing.Point(12, 48);
+      this.originalValueLabel.Location = new System.Drawing.Point(6, 42);
       this.originalValueLabel.Name = "originalValueLabel";
       this.originalValueLabel.Size = new System.Drawing.Size(72, 13);
@@ -69,5 +70,5 @@
       // oldValueTextBox
       // 
-      this.oldValueTextBox.Location = new System.Drawing.Point(123, 45);
+      this.oldValueTextBox.Location = new System.Drawing.Point(101, 39);
       this.oldValueTextBox.Name = "oldValueTextBox";
       this.oldValueTextBox.ReadOnly = true;
@@ -77,5 +78,5 @@
       // newValueTextBox
       // 
-      this.newValueTextBox.Location = new System.Drawing.Point(123, 82);
+      this.newValueTextBox.Location = new System.Drawing.Point(101, 65);
       this.newValueTextBox.Name = "newValueTextBox";
       this.newValueTextBox.Size = new System.Drawing.Size(131, 20);
@@ -88,5 +89,5 @@
       // 
       this.newValueLabel.AutoSize = true;
-      this.newValueLabel.Location = new System.Drawing.Point(12, 85);
+      this.newValueLabel.Location = new System.Drawing.Point(6, 68);
       this.newValueLabel.Name = "newValueLabel";
       this.newValueLabel.Size = new System.Drawing.Size(59, 13);
@@ -103,5 +104,5 @@
       // 
       this.variableNameLabel.AutoSize = true;
-      this.variableNameLabel.Location = new System.Drawing.Point(12, 12);
+      this.variableNameLabel.Location = new System.Drawing.Point(6, 15);
       this.variableNameLabel.Name = "variableNameLabel";
       this.variableNameLabel.Size = new System.Drawing.Size(76, 13);
@@ -114,5 +115,5 @@
       this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.variableNamesCombo.FormattingEnabled = true;
-      this.variableNamesCombo.Location = new System.Drawing.Point(123, 9);
+      this.variableNamesCombo.Location = new System.Drawing.Point(101, 12);
       this.variableNamesCombo.Name = "variableNamesCombo";
       this.variableNamesCombo.Size = new System.Drawing.Size(131, 21);
@@ -126,5 +127,5 @@
       // 
       this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
-      this.okButton.Location = new System.Drawing.Point(15, 119);
+      this.okButton.Location = new System.Drawing.Point(75, 98);
       this.okButton.Name = "okButton";
       this.okButton.Size = new System.Drawing.Size(75, 23);
@@ -138,5 +139,5 @@
       this.cancelButton.CausesValidation = false;
       this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-      this.cancelButton.Location = new System.Drawing.Point(179, 119);
+      this.cancelButton.Location = new System.Drawing.Point(156, 98);
       this.cancelButton.Name = "cancelButton";
       this.cancelButton.Size = new System.Drawing.Size(75, 23);
@@ -146,4 +147,12 @@
       this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
       // 
+      // variableNameTextBox
+      // 
+      this.variableNameTextBox.Location = new System.Drawing.Point(101, 12);
+      this.variableNameTextBox.Name = "variableNameTextBox";
+      this.variableNameTextBox.Size = new System.Drawing.Size(131, 20);
+      this.variableNameTextBox.TabIndex = 12;
+      this.variableNameTextBox.Visible = false;
+      // 
       // VariableNodeEditDialog
       // 
@@ -152,6 +161,7 @@
       this.AutoSize = true;
       this.CancelButton = this.cancelButton;
-      this.ClientSize = new System.Drawing.Size(269, 154);
+      this.ClientSize = new System.Drawing.Size(244, 134);
       this.ControlBox = false;
+      this.Controls.Add(this.variableNameTextBox);
       this.Controls.Add(this.cancelButton);
       this.Controls.Add(this.okButton);
@@ -188,4 +198,5 @@
     public System.Windows.Forms.TextBox newValueTextBox;
     public System.Windows.Forms.ComboBox variableNamesCombo;
+    private System.Windows.Forms.TextBox variableNameTextBox;
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,4 +22,5 @@
 using System;
 using System.ComponentModel;
+using System.Linq;
 using System.Text;
 using System.Windows.Forms;
@@ -33,9 +34,19 @@
       get { return variableTreeNode; }
       set {
-        if (InvokeRequired)
-          Invoke(new Action<SymbolicExpressionTreeNode>(x => variableTreeNode = (VariableTreeNode)x), value);
-        else
+        if (InvokeRequired) {
+          Invoke(new Action<SymbolicExpressionTreeNode>(x =>
+          {
+            variableTreeNode = (VariableTreeNode) x;
+            variableNameTextBox.Text = variableTreeNode.VariableName;
+          }), value);
+        } else {
           variableTreeNode = value;
+          variableNameTextBox.Text = variableTreeNode.VariableName;
+        }
       }
+    }
+
+    public string SelectedVariableName {
+      get { return variableNamesCombo.Visible ? variableNamesCombo.Text : variableNameTextBox.Text; }
     }
 
@@ -43,5 +54,4 @@
       InitializeComponent();
       oldValueTextBox.TabStop = false; // cannot receive focus using tab key
-
       NewNode = (VariableTreeNode)node; // will throw an invalid cast exception if node is not of the correct type
       InitializeFields();
@@ -57,6 +67,14 @@
         variableNameLabel.Visible = true;
         variableNamesCombo.Visible = true;
-        foreach (var name in variableTreeNode.Symbol.VariableNames) variableNamesCombo.Items.Add(name);
-        variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName);
+        if (variableTreeNode.Symbol.VariableNames.Any()) {
+          foreach (var name in variableTreeNode.Symbol.VariableNames)
+            variableNamesCombo.Items.Add(name);
+          variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName);
+          variableNamesCombo.Visible = true;
+          variableNameTextBox.Visible = false;
+        } else {
+          variableNamesCombo.Visible = false;
+          variableNameTextBox.Visible = true;
+        }
       }
     }
@@ -93,4 +111,5 @@
     #region combo box validation and events
     private void variableNamesCombo_Validating(object sender, CancelEventArgs e) {
+      if (variableNamesCombo.Items.Count == 0) return;
       if (variableNamesCombo.Items.Contains(variableNamesCombo.SelectedItem)) return;
       e.Cancel = true;
@@ -119,6 +138,6 @@
     private void OnDialogValidated(object sender, EventArgs e) {
       double weight = double.Parse(newValueTextBox.Text);
-      var variableName = (string)variableNamesCombo.SelectedItem;
       // we impose an extra validation condition: that the weight/value be different than the original ones
+      var variableName = SelectedVariableName;
       if (variableTreeNode.Weight.Equals(weight) && variableTreeNode.VariableName.Equals(variableName)) return;
       variableTreeNode.Weight = weight;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/displayModelFrame.html
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/displayModelFrame.html	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/displayModelFrame.html	(revision 17687)
@@ -1,53 +1,51 @@
-﻿<!-- this file is derived from sample.html from the MathJax distribution -->
-<!-- Copyright (c) 2009-2011 Design Science, Inc. -->
+﻿<!-- this file is derived from sample_tex.html from the MathJax distribution -->
+<!-- Copyright (c) 2010-2015 The MathJax Consortium -->
 <!-- adapted by HEAL for HeuristicLab-->
 <!DOCTYPE html>
 <html>
 <head>
-  <!-- title change by HEAL -->
-  <title>Symbolic Expression Tree</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
-  <script type="text/x-mathjax-config">
-  MathJax.Hub.Config({
-    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
-    jax: ["input/TeX","output/HTML-CSS"],
-    tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
-    imageFont: null
-  });
-  
-</script>
-  <script type="text/javascript" src="./MathJax.js"></script>
-  <!-- begin changes by HEAL -->
-  <script type="text/javascript">
-  function refreshModel() {
-    var model = document.getElementById("model");
-    MathJax.Hub.Queue(["Typeset",MathJax.Hub,model]);
-  }
-</script>
-  <!-- end changes by HEAL -->
-  <style>
-h1 {text-align:center}
-h2 {
-  font-weight: bold;
-  background-color: #DDDDDD;
-  padding: .2em .5em;
-  margin-top: 1.5em;
-  border-top: 3px solid #666666;
-  border-bottom: 2px solid #999999;
-}
-</style>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+
+    <!-- title change by HEAL -->
+    <title>Symbolic Expression Tree</title>
+
+    <script type="text/x-mathjax-config">
+        MathJax.Hub.Config({
+        extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
+        jax: ["input/TeX","output/SVG"],
+        tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
+        "HTML-CSS": {preferredFont: "STIX-Web"},
+        MathMenu: { showLocale:false},
+        imageFont: null
+        });
+    </script>
+
+    <script type="text/javascript" async
+            src="./MathJax/MathJax.js?config=TeX-AMS_SVG&locale=en">
+    </script>
+    <script type="text/javascript">
+        <!-- necessary to re-typeset when the model is changed-->
+        function refreshModel() {
+            var model = document.getElementById("model");
+            <!-- see https://docs.mathjax.org/en/v1.1-latest/typeset.html -->
+            MathJax.Hub.Queue(["Typeset",MathJax.Hub,model]);
+        }
+    </script> 
 </head>
 <body id="body">
-  <noscript>
-    <div style="color: #CC0000; text-align: center">
-      <b>Warning: <a href="http://www.mathjax.org/">MathJax</a> requires JavaScript to process
-        the mathematics on this page.<br />
-        If your browser supports JavaScript, be sure it is enabled.</b>
-    </div>
-    <hr>
-  </noscript>
-  <p id="model">
-  </p>
+    <noscript>
+        <div style="color: #CC0000; text-align: center">
+            <b>
+                Warning: <a href="http://www.mathjax.org/">MathJax</a> requires JavaScript to process
+                the mathematics on this page.<br />
+                If your browser supports JavaScript, be sure it is enabled.
+            </b>
+        </div>
+        <hr>
+    </noscript>
+    <p id="model">$\cos(x^2)$
+    </p>
 </body>
 </html>
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,9 +29,9 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [Item("SymbolicDataAnalysisAlleleFrequencyAnalyzer", "")]
-  [StorableClass]
+  [StorableType("36383269-BEEF-4B2C-A95E-5A3DCE6B2DB8")]
   public sealed class SymbolicDataAnalysisAlleleFrequencyAnalyzer : AlleleFrequencyAnalyzer<ISymbolicExpressionTree>, ISymbolicDataAnalysisAnalyzer {
     private const string AlleleTreeDepthParameterName = "AlleleTreeDepth";
@@ -58,5 +58,5 @@
 
     [StorableConstructor]
-    private SymbolicDataAnalysisAlleleFrequencyAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisAlleleFrequencyAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisAlleleFrequencyAnalyzer(SymbolicDataAnalysisAlleleFrequencyAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisAlleleFrequencyAnalyzer()
@@ -89,6 +89,12 @@
       var varTreeNode = tree as VariableTreeNode;
       var constTreeNode = tree as ConstantTreeNode;
+      var factorVarTreeNode = tree as FactorVariableTreeNode;
+      var binFactorVarTreeNode = tree as BinaryFactorVariableTreeNode;
       if (varTreeNode != null) {
         builder.Append("(var " + varTreeNode.VariableName);
+      } else if (factorVarTreeNode != null) {
+        builder.Append("(factor " + factorVarTreeNode.VariableName);
+      } else if (binFactorVarTreeNode != null) {
+        builder.Append("(factor " + binFactorVarTreeNode.VariableName + "=" + binFactorVarTreeNode.VariableValue);
       } else if (constTreeNode != null) {
         builder.Append("(const");
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -32,5 +32,5 @@
   /// Abstract base class for symbolic data analysis analyzers.
   /// </summary>
-  [StorableClass]
+  [StorableType("A88BA918-D933-449E-9816-8C2A509CC0C4")]
   public abstract class SymbolicDataAnalysisAnalyzer : SingleSuccessorOperator, ISymbolicDataAnalysisAnalyzer {
     private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
@@ -57,5 +57,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicDataAnalysisAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisAnalyzer(SymbolicDataAnalysisAnalyzer original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs	(revision 17687)
@@ -0,0 +1,48 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SymbolicDataAnalysisBottomUpDiversityAnalyzer", "A diversity analyzer based on the bottom-up distance between trees.")]
+  [StorableType("822FB7E4-3CFF-4413-90EB-96E90CE1D1D4")]
+  public class SymbolicDataAnalysisBottomUpDiversityAnalyzer : PopulationSimilarityAnalyzer {
+    [StorableConstructor]
+    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(StorableConstructorFlag _) : base(_) { }
+
+    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(SymbolicDataAnalysisBottomUpDiversityAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisBottomUpDiversityAnalyzer(this, cloner);
+    }
+
+    public SymbolicDataAnalysisBottomUpDiversityAnalyzer(SymbolicExpressionTreeBottomUpSimilarityCalculator similarityCalculator)
+      : base(new[] { similarityCalculator }) {
+      DiversityResultName = "Genotypic Diversity";
+      UpdateCounterParameter.ActualName = "GenotypicDiversityAnalyzerUpdateCounter";
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -30,5 +30,5 @@
   /// Abstract base class for multi objective symbolic data analysis analyzers.
   /// </summary>
-  [StorableClass]
+  [StorableType("C9896773-7A11-4D68-86EC-DB04AE075637")]
   public abstract class SymbolicDataAnalysisMultiObjectiveAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicDataAnalysisMultiObjectiveAnalyzer {
     private const string QualitiesParameterName = "Qualities";
@@ -55,5 +55,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicDataAnalysisMultiObjectiveAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisMultiObjectiveAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisMultiObjectiveAnalyzer(SymbolicDataAnalysisMultiObjectiveAnalyzer original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,5 +20,4 @@
 #endregion
 
-using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -29,5 +28,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -36,5 +35,5 @@
   /// </summary>
   [Item("SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic data analysis solution for multi objective symbolic data analysis problems.")]
-  [StorableClass]
+  [StorableType("D43D38D1-EEA8-4DEF-AA95-6E941194D708")]
   public abstract class SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisMultiObjectiveAnalyzer
     where T : class, ISymbolicDataAnalysisSolution {
@@ -42,4 +41,5 @@
     private const string TrainingBestSolutionQualitiesParameterName = "Best training solution qualities";
     private const string UpdateAlwaysParameterName = "Always update best solutions";
+    private const string TrainingBestSolutionParameterName = "Best training solution";
 
     #region parameter properties
@@ -55,19 +55,20 @@
     #endregion
     #region properties
-    public ItemList<T> TrainingBestSolutions {
+    private ItemList<T> TrainingBestSolutions {
       get { return TrainingBestSolutionsParameter.ActualValue; }
       set { TrainingBestSolutionsParameter.ActualValue = value; }
     }
-    public ItemList<DoubleArray> TrainingBestSolutionQualities {
+    private ItemList<DoubleArray> TrainingBestSolutionQualities {
       get { return TrainingBestSolutionQualitiesParameter.ActualValue; }
       set { TrainingBestSolutionQualitiesParameter.ActualValue = value; }
     }
-    public BoolValue UpdateAlways {
-      get { return UpdateAlwaysParameter.Value; }
+    public bool UpdateAlways {
+      get { return UpdateAlwaysParameter.Value.Value; }
+      set { UpdateAlwaysParameter.Value.Value = value; }
     }
     #endregion
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer(SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<T> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer()
@@ -97,7 +98,11 @@
       }
 
+      if (!results.ContainsKey(TrainingBestSolutionParameterName)) {
+        results.Add(new Result(TrainingBestSolutionParameterName, "", typeof(ISymbolicDataAnalysisSolution)));
+      }
+
       //if the pareto front of best solutions shall be updated regardless of the quality, the list initialized empty to discard old solutions
-      IList<double[]> trainingBestQualities;
-      if (UpdateAlways.Value) {
+      List<double[]> trainingBestQualities;
+      if (UpdateAlways) {
         trainingBestQualities = new List<double[]>();
       } else {
@@ -105,42 +110,46 @@
       }
 
-      #region find best trees
-      IList<int> nonDominatedIndexes = new List<int>();
-      ISymbolicExpressionTree[] tree = SymbolicExpressionTree.ToArray();
+      ISymbolicExpressionTree[] trees = SymbolicExpressionTree.ToArray();
       List<double[]> qualities = Qualities.Select(x => x.ToArray()).ToList();
       bool[] maximization = Maximization.ToArray();
-      List<double[]> newNonDominatedQualities = new List<double[]>();
-      for (int i = 0; i < tree.Length; i++) {
-        if (IsNonDominated(qualities[i], trainingBestQualities, maximization) &&
-          IsNonDominated(qualities[i], qualities, maximization)) {
-          if (!newNonDominatedQualities.Contains(qualities[i], new DoubleArrayComparer())) {
-            newNonDominatedQualities.Add(qualities[i]);
-            nonDominatedIndexes.Add(i);
+
+      var nonDominatedIndividuals = new[] { new { Tree = default(ISymbolicExpressionTree), Qualities = default(double[]) } }.ToList();
+      nonDominatedIndividuals.Clear();
+
+      // build list of new non-dominated solutions
+      for (int i = 0; i < trees.Length; i++) {
+        if (IsNonDominated(qualities[i], nonDominatedIndividuals.Select(ind => ind.Qualities), maximization) &&
+            IsNonDominated(qualities[i], trainingBestQualities, maximization)) {
+          for (int j = nonDominatedIndividuals.Count - 1; j >= 0; j--) {
+            if (IsBetterOrEqual(qualities[i], nonDominatedIndividuals[j].Qualities, maximization)) {
+              nonDominatedIndividuals.RemoveAt(j);
+            }
           }
+          nonDominatedIndividuals.Add(new { Tree = trees[i], Qualities = qualities[i] });
         }
       }
-      #endregion
+
+      var nonDominatedSolutions = nonDominatedIndividuals.Select(x => new { Solution = CreateSolution(x.Tree, x.Qualities), Qualities = x.Qualities }).ToList();
+      nonDominatedSolutions.ForEach(s => s.Solution.Name = string.Join(",", s.Qualities.Select(q => q.ToString())));
+
       #region update Pareto-optimal solution archive
-      if (nonDominatedIndexes.Count > 0) {
-        ItemList<DoubleArray> nonDominatedQualities = new ItemList<DoubleArray>();
-        ItemList<T> nonDominatedSolutions = new ItemList<T>();
-        // add all new non-dominated solutions to the archive
-        foreach (var index in nonDominatedIndexes) {
-          T solution = CreateSolution(tree[index], qualities[index]);
-          nonDominatedSolutions.Add(solution);
-          nonDominatedQualities.Add(new DoubleArray(qualities[index]));
-        }
-        // add old non-dominated solutions only if they are not dominated by one of the new solutions
+      if (nonDominatedSolutions.Count > 0) {
+        //add old non-dominated solutions only if they are not dominated by one of the new solutions
         for (int i = 0; i < trainingBestQualities.Count; i++) {
-          if (IsNonDominated(trainingBestQualities[i], newNonDominatedQualities, maximization)) {
-            if (!newNonDominatedQualities.Contains(trainingBestQualities[i], new DoubleArrayComparer())) {
-              nonDominatedSolutions.Add(TrainingBestSolutions[i]);
-              nonDominatedQualities.Add(TrainingBestSolutionQualities[i]);
-            }
+          if (IsNonDominated(trainingBestQualities[i], nonDominatedSolutions.Select(x => x.Qualities), maximization)) {
+            nonDominatedSolutions.Add(new { Solution = TrainingBestSolutions[i], Qualities = TrainingBestSolutionQualities[i].ToArray() });
           }
         }
 
-        results[TrainingBestSolutionsParameter.Name].Value = nonDominatedSolutions;
-        results[TrainingBestSolutionQualitiesParameter.Name].Value = nonDominatedQualities;
+        //assumes the the first objective is always the accuracy
+        var sortedNonDominatedSolutions = maximization[0]
+          ? nonDominatedSolutions.OrderByDescending(x => x.Qualities[0])
+          : nonDominatedSolutions.OrderBy(x => x.Qualities[0]);
+        var trainingBestSolution = sortedNonDominatedSolutions.Select(s => s.Solution).First();
+        results[TrainingBestSolutionParameterName].Value = trainingBestSolution;
+        TrainingBestSolutions = new ItemList<T>(sortedNonDominatedSolutions.Select(x => x.Solution));
+        results[TrainingBestSolutionsParameter.Name].Value = TrainingBestSolutions;
+        TrainingBestSolutionQualities = new ItemList<DoubleArray>(sortedNonDominatedSolutions.Select(x => new DoubleArray(x.Qualities)));
+        results[TrainingBestSolutionQualitiesParameter.Name].Value = TrainingBestSolutionQualities;
       }
       #endregion
@@ -148,36 +157,25 @@
     }
 
-    private class DoubleArrayComparer : IEqualityComparer<double[]> {
-      public bool Equals(double[] x, double[] y) {
-        if (y.Length != x.Length) throw new ArgumentException();
-        for (int i = 0; i < x.Length; i++) {
-          if (!x[i].IsAlmost(y[i])) return false;
-        }
-        return true;
-      }
-
-      public int GetHashCode(double[] obj) {
-        int c = obj.Length;
-        for (int i = 0; i < obj.Length; i++)
-          c ^= obj[i].GetHashCode();
-        return c;
-      }
-    }
-
     protected abstract T CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality);
 
-    private bool IsNonDominated(double[] point, IList<double[]> points, bool[] maximization) {
+    private bool IsNonDominated(double[] point, IEnumerable<double[]> points, bool[] maximization) {
       foreach (var refPoint in points) {
-        bool refPointDominatesPoint = true;
-        for (int i = 0; i < point.Length; i++) {
-          refPointDominatesPoint &= IsBetterOrEqual(refPoint[i], point[i], maximization[i]);
-        }
+        bool refPointDominatesPoint = IsBetterOrEqual(refPoint, point, maximization);
         if (refPointDominatesPoint) return false;
       }
       return true;
     }
+
+    private bool IsBetterOrEqual(double[] lhs, double[] rhs, bool[] maximization) {
+      for (int i = 0; i < lhs.Length; i++) {
+        var result = IsBetterOrEqual(lhs[i], rhs[i], maximization[i]);
+        if (!result) return false;
+      }
+      return true;
+    }
+
     private bool IsBetterOrEqual(double lhs, double rhs, bool maximization) {
-      if (maximization) return lhs > rhs;
-      else return lhs < rhs;
+      if (maximization) return lhs >= rhs;
+      else return lhs <= rhs;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,5 +27,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.Random;
 
@@ -34,5 +34,5 @@
   /// Abstract base class for symbolic data analysis analyzers that validate a solution on a separate data partition using the evaluator.
   /// </summary>
-  [StorableClass]
+  [StorableType("506B8D0E-891C-453B-842C-18CB33F5CE32")]
   public abstract class SymbolicDataAnalysisMultiObjectiveValidationAnalyzer<T, U> : SymbolicDataAnalysisMultiObjectiveAnalyzer,
     ISymbolicDataAnalysisValidationAnalyzer<T, U>
@@ -68,5 +68,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisMultiObjectiveValidationAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisMultiObjectiveValidationAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisMultiObjectiveValidationAnalyzer(SymbolicDataAnalysisMultiObjectiveValidationAnalyzer<T, U> original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,5 +29,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -36,5 +36,5 @@
   /// </summary>
   [Item("SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic data analysis solution for multi objective symbolic data analysis problems.")]
-  [StorableClass]
+  [StorableType("ABDCE5CB-E177-4382-B478-90372FE6D47F")]
   public abstract class SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisMultiObjectiveValidationAnalyzer<T, U>,
     ISymbolicDataAnalysisMultiObjectiveAnalyzer
@@ -72,5 +72,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer(SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<S, T, U> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer()
@@ -177,4 +177,5 @@
     }
 
+    [StorableType("69cfeefe-8654-4d07-93f1-fdca6fe02338")]
     private class DoubleArrayComparer : IEqualityComparer<double[]> {
       public bool Equals(double[] x, double[] y) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -30,5 +30,5 @@
   /// Abstract base class for single objective symbolic data analysis analyzers.
   /// </summary>
-  [StorableClass]
+  [StorableType("D5972132-2908-4878-97C5-C423164FCF65")]
   public abstract class SymbolicDataAnalysisSingleObjectiveAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicDataAnalysisSingleObjectiveAnalyzer {
     private const string QualityParameterName = "Quality";
@@ -56,5 +56,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveAnalyzer(SymbolicDataAnalysisSingleObjectiveAnalyzer original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs	(revision 17687)
@@ -1,3 +1,26 @@
-﻿using System;
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System;
 using System.Linq;
 using HeuristicLab.Analysis;
@@ -8,8 +31,8 @@
 using HeuristicLab.Optimization.Operators;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("83603E95-3CBD-476C-B11F-B30C80ACD0D3")]
   [Item("SymbolicDataAnalysisSingleObjectivePruningAnalyzer", "An analyzer that prunes introns from trees in single objective symbolic data analysis problems.")]
   public abstract class SymbolicDataAnalysisSingleObjectivePruningAnalyzer : SymbolicDataAnalysisSingleObjectiveAnalyzer {
@@ -22,72 +45,82 @@
     private const string TotalNumberOfPrunedSubtreesParameterName = "Number of pruned subtrees";
     private const string TotalNumberOfPrunedTreesParameterName = "Number of pruned trees";
+    private const string TotalNumberOfPrunedNodesParameterName = "Number of pruned nodes";
     private const string RandomParameterName = "Random";
-    private const string PruneOnlyZeroImpactNodesParameterName = "PruneOnlyZeroImpactNodes";
-    private const string NodeImpactThresholdParameterName = "ImpactThreshold";
-    private const string PruningOperatorParameterName = "PruningOperator";
     private const string ResultsParameterName = "Results";
-    #endregion
+    private const string PopulationSizeParameterName = "PopulationSize";
+    #endregion
+
     #region private members
+    private DataReducer prunedNodesReducer;
     private DataReducer prunedSubtreesReducer;
     private DataReducer prunedTreesReducer;
     private DataTableValuesCollector valuesCollector;
     private ResultsCollector resultsCollector;
-    private EmptyOperator emptyOp;
-    #endregion
+    #endregion
+
     #region parameter properties
-    public IValueParameter<SymbolicDataAnalysisExpressionPruningOperator> PruningOperatorParameter {
-      get { return (IValueParameter<SymbolicDataAnalysisExpressionPruningOperator>)Parameters[PruningOperatorParameterName]; }
-    }
-    public IFixedValueParameter<BoolValue> PruneOnlyZeroImpactNodesParameter {
-      get { return (IFixedValueParameter<BoolValue>)Parameters[PruneOnlyZeroImpactNodesParameterName]; }
-    }
-    public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter {
-      get { return (IFixedValueParameter<DoubleValue>)Parameters[NodeImpactThresholdParameterName]; }
-    }
     public ILookupParameter<IRandom> RandomParameter {
       get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; }
     }
-    private ILookupParameter<IDataAnalysisProblemData> ProblemDataParameter {
-      get { return (ILookupParameter<IDataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
-    }
-    public IValueParameter<IntValue> UpdateIntervalParameter {
-      get { return (IValueParameter<IntValue>)Parameters[UpdateIntervalParameterName]; }
-    }
-    public IValueParameter<IntValue> UpdateCounterParameter {
-      get { return (IValueParameter<IntValue>)Parameters[UpdateCounterParameterName]; }
-    }
-    public IValueParameter<DoubleRange> PopulationSliceParameter {
-      get { return (IValueParameter<DoubleRange>)Parameters[PopulationSliceParameterName]; }
-    }
-    public IValueParameter<DoubleValue> PruningProbabilityParameter {
-      get { return (IValueParameter<DoubleValue>)Parameters[PruningProbabilityParameterName]; }
-    }
-    #endregion
+    public IFixedValueParameter<IntValue> UpdateIntervalParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[UpdateIntervalParameterName]; }
+    }
+    public IFixedValueParameter<IntValue> UpdateCounterParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[UpdateCounterParameterName]; }
+    }
+    public IFixedValueParameter<DoubleRange> PopulationSliceParameter {
+      get { return (IFixedValueParameter<DoubleRange>)Parameters[PopulationSliceParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> PruningProbabilityParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[PruningProbabilityParameterName]; }
+    }
+    public ILookupParameter<IntValue> PopulationSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[PopulationSizeParameterName]; }
+    }
+    #endregion
+
     #region properties
-    protected SymbolicDataAnalysisExpressionPruningOperator PruningOperator { get { return PruningOperatorParameter.Value; } }
-    protected IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } }
-    protected IntValue UpdateInterval { get { return UpdateIntervalParameter.Value; } }
-    protected IntValue UpdateCounter { get { return UpdateCounterParameter.Value; } }
-    protected DoubleRange PopulationSlice { get { return PopulationSliceParameter.Value; } }
-    protected DoubleValue PruningProbability { get { return PruningProbabilityParameter.Value; } }
-    protected IRandom Random { get { return RandomParameter.ActualValue; } }
-    protected DoubleValue NodeImpactThreshold { get { return NodeImpactThresholdParameter.Value; } }
-    protected BoolValue PruneOnlyZeroImpactNodes { get { return PruneOnlyZeroImpactNodesParameter.Value; } }
-    #endregion
+    protected abstract SymbolicDataAnalysisExpressionPruningOperator PruningOperator { get; }
+    protected int UpdateInterval { get { return UpdateIntervalParameter.Value.Value; } }
+
+    protected int UpdateCounter {
+      get { return UpdateCounterParameter.Value.Value; }
+      set { UpdateCounterParameter.Value.Value = value; }
+    }
+
+    protected double PopulationSliceStart {
+      get { return PopulationSliceParameter.Value.Start; }
+      set { PopulationSliceParameter.Value.Start = value; }
+    }
+
+    protected double PopulationSliceEnd {
+      get { return PopulationSliceParameter.Value.End; }
+      set { PopulationSliceParameter.Value.End = value; }
+    }
+
+    protected double PruningProbability {
+      get { return PruningProbabilityParameter.Value.Value; }
+      set { PruningProbabilityParameter.Value.Value = value; }
+    }
+    #endregion
+
     #region IStatefulItem members
     public override void InitializeState() {
       base.InitializeState();
-      UpdateCounter.Value = 0;
+      UpdateCounter = 0;
     }
     public override void ClearState() {
       base.ClearState();
-      UpdateCounter.Value = 0;
+      UpdateCounter = 0;
     }
     #endregion
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(StorableConstructorFlag _) : base(_) { }
+
     protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(SymbolicDataAnalysisSingleObjectivePruningAnalyzer original, Cloner cloner)
       : base(original, cloner) {
+      if (original.prunedNodesReducer != null)
+        this.prunedNodesReducer = (DataReducer)original.prunedNodesReducer.Clone();
       if (original.prunedSubtreesReducer != null)
         this.prunedSubtreesReducer = (DataReducer)original.prunedSubtreesReducer.Clone();
@@ -99,40 +132,54 @@
         this.resultsCollector = (ResultsCollector)original.resultsCollector.Clone();
     }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(PopulationSizeParameterName)) {
+        Parameters.Add(new LookupParameter<IntValue>(PopulationSizeParameterName, "The population of individuals."));
+      }
+      if (Parameters.ContainsKey(UpdateCounterParameterName)) {
+        var fixedValueParameter = Parameters[UpdateCounterParameterName] as FixedValueParameter<IntValue>;
+        if (fixedValueParameter == null) {
+          var valueParameter = (ValueParameter<IntValue>)Parameters[UpdateCounterParameterName];
+          Parameters.Remove(UpdateCounterParameterName);
+          Parameters.Add(new FixedValueParameter<IntValue>(UpdateCounterParameterName, valueParameter.Value));
+        }
+      }
+      if (Parameters.ContainsKey(UpdateIntervalParameterName)) {
+        var fixedValueParameter = Parameters[UpdateIntervalParameterName] as FixedValueParameter<IntValue>;
+        if (fixedValueParameter == null) {
+          var valueParameter = (ValueParameter<IntValue>)Parameters[UpdateIntervalParameterName];
+          Parameters.Remove(UpdateIntervalParameterName);
+          Parameters.Add(new FixedValueParameter<IntValue>(UpdateIntervalParameterName, valueParameter.Value));
+        }
+      }
+      if (Parameters.ContainsKey(PopulationSliceParameterName)) {
+        var fixedValueParameter = Parameters[PopulationSliceParameterName] as FixedValueParameter<DoubleRange>;
+        if (fixedValueParameter == null) {
+          var valueParameter = (ValueParameter<DoubleRange>)Parameters[PopulationSliceParameterName];
+          Parameters.Remove(PopulationSliceParameterName);
+          Parameters.Add(new FixedValueParameter<DoubleRange>(PopulationSliceParameterName, valueParameter.Value));
+        }
+      }
+      if (Parameters.ContainsKey(PruningProbabilityParameterName)) {
+        var fixedValueParameter = Parameters[PruningProbabilityParameterName] as FixedValueParameter<DoubleValue>;
+        if (fixedValueParameter == null) {
+          var valueParameter = (ValueParameter<DoubleValue>)Parameters[PruningProbabilityParameterName];
+          Parameters.Remove(PruningProbabilityParameterName);
+          Parameters.Add(new FixedValueParameter<DoubleValue>(PruningProbabilityParameterName, valueParameter.Value));
+        }
+      }
+    }
+
     protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer() {
       #region add parameters
-      Parameters.Add(new ValueParameter<DoubleRange>(PopulationSliceParameterName, new DoubleRange(0.75, 1)));
-      Parameters.Add(new ValueParameter<DoubleValue>(PruningProbabilityParameterName, new DoubleValue(0.5)));
-      Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
-      Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called", new IntValue(0)));
-      Parameters.Add(new LookupParameter<IRandom>(RandomParameterName));
-      Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName));
-      Parameters.Add(new FixedValueParameter<DoubleValue>(NodeImpactThresholdParameterName, new DoubleValue(0.0)));
-      Parameters.Add(new FixedValueParameter<BoolValue>(PruneOnlyZeroImpactNodesParameterName, new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<DoubleRange>(PopulationSliceParameterName, "The slice of the population where pruning should be applied.", new DoubleRange(0.75, 1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(PruningProbabilityParameterName, "The probability for pruning an individual.", new DoubleValue(0.5)));
+      Parameters.Add(new FixedValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
+      Parameters.Add(new FixedValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called", new IntValue(0)));
+      Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The random number generator."));
+      Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The problem data."));
+      Parameters.Add(new LookupParameter<IntValue>(PopulationSizeParameterName, "The population of individuals."));
       #endregion
-    }
-
-    private void InitializeOperators() {
-      prunedSubtreesReducer = new DataReducer();
-      prunedSubtreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedSubtreesParameter.ActualName;
-      prunedSubtreesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); // sum all the pruned subtrees parameter values
-      prunedSubtreesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); // asign the sum to the target parameter
-      prunedSubtreesReducer.TargetParameter.ActualName = TotalNumberOfPrunedSubtreesParameterName;
-
-      prunedTreesReducer = new DataReducer();
-      prunedTreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedTreesParameter.ActualName;
-      prunedTreesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
-      prunedTreesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
-      prunedTreesReducer.TargetParameter.ActualName = TotalNumberOfPrunedTreesParameterName;
-
-      valuesCollector = new DataTableValuesCollector();
-      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedSubtreesParameterName));
-      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedTreesParameterName));
-      valuesCollector.DataTableParameter.ActualName = "Population pruning";
-
-      resultsCollector = new ResultsCollector();
-      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Population pruning"));
-      resultsCollector.ResultsParameter.ActualName = ResultsParameterName;
-
-      emptyOp = new EmptyOperator();
     }
 
@@ -143,7 +190,9 @@
     /// <returns>Returns an int range [start, end]</returns>
     private IntRange GetSliceBounds() {
-      var count = ExecutionContext.Scope.SubScopes.Count;
-      var start = (int)Math.Round(PopulationSlice.Start * count);
-      var end = (int)Math.Round(PopulationSlice.End * count);
+      if (PopulationSliceStart < 0 || PopulationSliceEnd < 0) throw new ArgumentOutOfRangeException("The slice bounds cannot be negative.");
+      if (PopulationSliceStart > 1 || PopulationSliceEnd > 1) throw new ArgumentOutOfRangeException("The slice bounds should be expressed as unit percentages.");
+      var count = PopulationSizeParameter.ActualValue.Value;
+      var start = (int)Math.Round(PopulationSliceStart * count);
+      var end = (int)Math.Round(PopulationSliceEnd * count);
       if (end > count) end = count;
 
@@ -153,33 +202,38 @@
 
     private IOperation CreatePruningOperation() {
-      var oc = new OperationCollection { Parallel = true };
+      var operations = new OperationCollection { Parallel = true };
       var range = GetSliceBounds();
       var qualities = Quality.Select(x => x.Value).ToArray();
       var indices = Enumerable.Range(0, qualities.Length).ToArray();
-      Array.Sort(qualities, indices);
+      indices.StableSort((a, b) => qualities[a].CompareTo(qualities[b]));
+
       if (!Maximization.Value) Array.Reverse(indices);
 
       var subscopes = ExecutionContext.Scope.SubScopes;
-
-      for (int i = 0; i < subscopes.Count; ++i) {
-        IOperator op;
-        if (range.Start <= i && i < range.End && Random.NextDouble() <= PruningProbability.Value)
-          op = PruningOperator;
-        else op = emptyOp;
+      var random = RandomParameter.ActualValue;
+
+      var empty = new EmptyOperator();
+
+      for (int i = 0; i < indices.Length; ++i) {
+        IOperator @operator;
+        if (range.Start <= i && i < range.End && random.NextDouble() <= PruningProbability)
+          @operator = PruningOperator;
+        else @operator = empty;
         var index = indices[i];
         var subscope = subscopes[index];
-        oc.Add(ExecutionContext.CreateChildOperation(op, subscope));
-      }
-      return oc;
+        operations.Add(ExecutionContext.CreateChildOperation(@operator, subscope));
+      }
+      return operations;
     }
 
     public override IOperation Apply() {
-      UpdateCounter.Value++;
-      if (UpdateCounter.Value != UpdateInterval.Value) return base.Apply();
-      UpdateCounter.Value = 0;
-
-      if (prunedSubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); }
+      UpdateCounter++;
+      if (UpdateCounter != UpdateInterval) return base.Apply();
+      UpdateCounter = 0;
+
+      if (prunedNodesReducer == null || prunedSubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); }
 
       var prune = CreatePruningOperation();
+      var reducePrunedNodes = ExecutionContext.CreateChildOperation(prunedNodesReducer);
       var reducePrunedSubtrees = ExecutionContext.CreateChildOperation(prunedSubtreesReducer);
       var reducePrunedTrees = ExecutionContext.CreateChildOperation(prunedTreesReducer);
@@ -187,5 +241,35 @@
       var collectResults = ExecutionContext.CreateChildOperation(resultsCollector);
 
-      return new OperationCollection { prune, reducePrunedSubtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() };
+      return new OperationCollection { prune, reducePrunedNodes, reducePrunedSubtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() };
+    }
+
+    private void InitializeOperators() {
+      prunedNodesReducer = new DataReducer();
+      prunedNodesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedNodesParameter.ActualName;
+      prunedNodesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); // sum all the pruned subtrees parameter values
+      prunedNodesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); // asign the sum to the target parameter
+      prunedNodesReducer.TargetParameter.ActualName = TotalNumberOfPrunedNodesParameterName;
+
+      prunedSubtreesReducer = new DataReducer();
+      prunedSubtreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedSubtreesParameter.ActualName;
+      prunedSubtreesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); // sum all the pruned subtrees parameter values
+      prunedSubtreesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); // asign the sum to the target parameter
+      prunedSubtreesReducer.TargetParameter.ActualName = TotalNumberOfPrunedSubtreesParameterName;
+
+      prunedTreesReducer = new DataReducer();
+      prunedTreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedTreesParameter.ActualName;
+      prunedTreesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
+      prunedTreesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
+      prunedTreesReducer.TargetParameter.ActualName = TotalNumberOfPrunedTreesParameterName;
+
+      valuesCollector = new DataTableValuesCollector();
+      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedNodesParameterName));
+      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedSubtreesParameterName));
+      valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedTreesParameterName));
+      valuesCollector.DataTableParameter.ActualName = "Population pruning";
+
+      resultsCollector = new ResultsCollector();
+      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Population pruning"));
+      resultsCollector.ResultsParameter.ActualName = ResultsParameterName;
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,5 +27,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -34,14 +34,14 @@
   /// </summary>
   [Item("SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic data analysis solution for single objective symbolic data analysis problems.")]
-  [StorableClass]
-  public abstract class SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer, IIterationBasedOperator
-
-    where T : class, ISymbolicDataAnalysisSolution {
+  [StorableType("DD82C026-CF68-40D7-A898-77EA6A872DE9")]
+  public abstract class SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> : SymbolicDataAnalysisSingleObjectiveAnalyzer, IIterationBasedOperator where T : class, ISymbolicDataAnalysisSolution {
     private const string TrainingBestSolutionParameterName = "Best training solution";
     private const string TrainingBestSolutionQualityParameterName = "Best training solution quality";
     private const string TrainingBestSolutionGenerationParameterName = "Best training solution generation";
+    private const string TrainingBestSolutionsHistoryParameterName = "Best training solutions history";
     private const string UpdateAlwaysParameterName = "Always update best solution";
     private const string IterationsParameterName = "Iterations";
     private const string MaximumIterationsParameterName = "Maximum Iterations";
+    private const string StoreHistoryParameterName = "Store History";
 
     #region parameter properties
@@ -55,4 +55,7 @@
       get { return (ILookupParameter<IntValue>)Parameters[TrainingBestSolutionGenerationParameterName]; }
     }
+    public ILookupParameter<ItemList<T>> TrainingBestSolutionsHistoryParameter {
+      get { return (ILookupParameter<ItemList<T>>)Parameters[TrainingBestSolutionsHistoryParameterName]; }
+    }
     public IFixedValueParameter<BoolValue> UpdateAlwaysParameter {
       get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateAlwaysParameterName]; }
@@ -63,4 +66,8 @@
     public IValueLookupParameter<IntValue> MaximumIterationsParameter {
       get { return (IValueLookupParameter<IntValue>)Parameters[MaximumIterationsParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> StoreHistoryParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[StoreHistoryParameterName]; }
     }
     #endregion
@@ -74,15 +81,22 @@
       set { TrainingBestSolutionQualityParameter.ActualValue = value; }
     }
-    public BoolValue UpdateAlways {
-      get { return UpdateAlwaysParameter.Value; }
+    public bool UpdateAlways {
+      get { return UpdateAlwaysParameter.Value.Value; }
+      set { UpdateAlwaysParameter.Value.Value = value; }
+    }
+
+    public bool StoreHistory {
+      get { return StoreHistoryParameter.Value.Value; }
+      set { StoreHistoryParameter.Value.Value = value; }
     }
     #endregion
 
+
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer(SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<T> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer()
       : base() {
-      Parameters.Add(new LookupParameter<T>(TrainingBestSolutionParameterName, "The training best symbolic data analyis solution."));
+      Parameters.Add(new LookupParameter<T>(TrainingBestSolutionParameterName, "The best training symbolic data analyis solution."));
       Parameters.Add(new LookupParameter<DoubleValue>(TrainingBestSolutionQualityParameterName, "The quality of the training best symbolic data analysis solution."));
       Parameters.Add(new LookupParameter<IntValue>(TrainingBestSolutionGenerationParameterName, "The generation in which the best training solution was found."));
@@ -90,4 +104,6 @@
       Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The number of performed iterations."));
       Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true });
+      Parameters.Add(new FixedValueParameter<BoolValue>(StoreHistoryParameterName, "Flag that determines whether all encountered best solutions should be stored as results.", new BoolValue(false)));
+      Parameters.Add(new LookupParameter<ItemList<T>>(TrainingBestSolutionsHistoryParameterName, "The history of the best training symbolic data analysis solutions."));
       UpdateAlwaysParameter.Hidden = true;
     }
@@ -105,7 +121,27 @@
       if (!Parameters.ContainsKey(MaximumIterationsParameterName))
         Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "The maximum number of performed iterations.") { Hidden = true });
+      if (!Parameters.ContainsKey(StoreHistoryParameterName))
+        Parameters.Add(new FixedValueParameter<BoolValue>(StoreHistoryParameterName, "Flag that determines whether all encountered best solutions should be stored as results.", new BoolValue(false)));
+      if (!Parameters.ContainsKey(TrainingBestSolutionsHistoryParameterName))
+        Parameters.Add(new LookupParameter<ItemList<T>>(TrainingBestSolutionsHistoryParameterName, "The history of the best training symbolic data analysis solutions."));
     }
 
     public override IOperation Apply() {
+      var results = ResultCollection;
+      #region create results
+      if (!results.ContainsKey(TrainingBestSolutionParameter.Name))
+        results.Add(new Result(TrainingBestSolutionParameter.Name, TrainingBestSolutionParameter.Description, typeof(T)));
+      if (!results.ContainsKey(TrainingBestSolutionQualityParameter.Name))
+        results.Add(new Result(TrainingBestSolutionQualityParameter.Name, TrainingBestSolutionQualityParameter.Description, typeof(DoubleValue)));
+      if (!results.ContainsKey(TrainingBestSolutionGenerationParameter.Name) && IterationsParameter.ActualValue != null)
+        results.Add(new Result(TrainingBestSolutionGenerationParameter.Name, TrainingBestSolutionGenerationParameter.Description, typeof(IntValue)));
+      if (StoreHistory && !results.ContainsKey(TrainingBestSolutionsHistoryParameter.Name)) {
+
+        results.Add(new Result(TrainingBestSolutionsHistoryParameter.Name, TrainingBestSolutionsHistoryParameter.Description, typeof(ItemList<T>)));
+        TrainingBestSolutionsHistoryParameter.ActualValue = new ItemList<T>();
+        results[TrainingBestSolutionsHistoryParameter.Name].Value = TrainingBestSolutionsHistoryParameter.ActualValue;
+      }
+      #endregion
+
       #region find best tree
       double bestQuality = Maximization.Value ? double.NegativeInfinity : double.PositiveInfinity;
@@ -121,6 +157,5 @@
       #endregion
 
-      var results = ResultCollection;
-      if (bestTree != null && (UpdateAlways.Value || TrainingBestSolutionQuality == null ||
+      if (bestTree != null && (UpdateAlways || TrainingBestSolutionQuality == null ||
         IsBetter(bestQuality, TrainingBestSolutionQuality.Value, Maximization.Value))) {
         TrainingBestSolution = CreateSolution(bestTree, bestQuality);
@@ -129,15 +164,11 @@
           TrainingBestSolutionGenerationParameter.ActualValue = new IntValue(IterationsParameter.ActualValue.Value);
 
-        if (!results.ContainsKey(TrainingBestSolutionParameter.Name)) {
-          results.Add(new Result(TrainingBestSolutionParameter.Name, TrainingBestSolutionParameter.Description, TrainingBestSolution));
-          results.Add(new Result(TrainingBestSolutionQualityParameter.Name, TrainingBestSolutionQualityParameter.Description, TrainingBestSolutionQuality));
-          if (TrainingBestSolutionGenerationParameter.ActualValue != null)
-            results.Add(new Result(TrainingBestSolutionGenerationParameter.Name, TrainingBestSolutionGenerationParameter.Description, TrainingBestSolutionGenerationParameter.ActualValue));
-        } else {
-          results[TrainingBestSolutionParameter.Name].Value = TrainingBestSolution;
-          results[TrainingBestSolutionQualityParameter.Name].Value = TrainingBestSolutionQuality;
-          if (TrainingBestSolutionGenerationParameter.ActualValue != null)
-            results[TrainingBestSolutionGenerationParameter.Name].Value = TrainingBestSolutionGenerationParameter.ActualValue;
+        results[TrainingBestSolutionParameter.Name].Value = TrainingBestSolution;
+        results[TrainingBestSolutionQualityParameter.Name].Value = TrainingBestSolutionQuality;
+        if (TrainingBestSolutionGenerationParameter.ActualValue != null)
+          results[TrainingBestSolutionGenerationParameter.Name].Value = TrainingBestSolutionGenerationParameter.ActualValue;
 
+        if (StoreHistory) {
+          TrainingBestSolutionsHistoryParameter.ActualValue.Add(TrainingBestSolution);
         }
       }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,5 +29,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -36,5 +36,5 @@
   /// </summary>
   [Item("SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that analyzes the Pareto-best symbolic data analysis solution for single objective symbolic data analysis problems.")]
-  [StorableClass]
+  [StorableType("0C0557F2-DCBC-4699-9BA9-3E82C858605E")]
   public abstract class SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<S, T> : SymbolicDataAnalysisSingleObjectiveAnalyzer, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator
     where T : class, ISymbolicDataAnalysisSolution
@@ -83,5 +83,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<S, T> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer()
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,6 +26,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.Random;
 
@@ -34,7 +35,7 @@
   /// Abstract base class for symbolic data analysis analyzers that validate a solution on a separate data partition using the evaluator.
   /// </summary>
-  [StorableClass]
+  [StorableType("B1A1F3CC-5C21-42F4-BED0-831E0D4AD1F6")]
   public abstract class SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U> : SymbolicDataAnalysisSingleObjectiveAnalyzer,
-    ISymbolicDataAnalysisValidationAnalyzer<T, U>
+    ISymbolicDataAnalysisValidationAnalyzer<T, U>, IStochasticOperator
     where T : class, ISymbolicDataAnalysisSingleObjectiveEvaluator<U>
     where U : class, IDataAnalysisProblemData {
@@ -72,5 +73,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveValidationAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveValidationAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveValidationAnalyzer(SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U> original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,5 +29,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -36,5 +36,5 @@
   /// </summary>
   [Item("SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic data analysis solution for single objective symbolic data analysis problems.")]
-  [StorableClass]
+  [StorableType("6A84F46D-0CC3-400D-BC3B-D7C6A86D958D")]
   public abstract class SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, IIterationBasedOperator
     where S : class, ISymbolicDataAnalysisSolution
@@ -83,5 +83,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer(SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<S, T, U> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer()
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,5 +29,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -36,5 +36,5 @@
   /// </summary>
   [Item("SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that analyzes the Pareto-best symbolic data analysis solution for single objective symbolic data analysis problems.")]
-  [StorableClass]
+  [StorableType("892CE424-FAB0-4E78-8BC2-40BFD1F4A78A")]
   public abstract class SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<S, T, U> : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<T, U>, ISymbolicDataAnalysisBoundedOperator
     where S : class, ISymbolicDataAnalysisSolution
@@ -77,5 +77,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer(SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<S, T, U> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer()
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -30,5 +30,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -37,8 +37,9 @@
   /// </summary>
   [Item("SymbolicDataAnalysisVariableFrequencyAnalyzer", "Calculates the accumulated frequencies of variable-symbols over all trees in the population.")]
-  [StorableClass]
+  [StorableType("C7E9B375-6375-478F-8590-473BA567BA90")]
   public sealed class SymbolicDataAnalysisVariableFrequencyAnalyzer : SymbolicDataAnalysisAnalyzer {
     private const string VariableFrequenciesParameterName = "VariableFrequencies";
     private const string AggregateLaggedVariablesParameterName = "AggregateLaggedVariables";
+    private const string AggregateFactorVariablesParameterName = "AggregateFactorVariables";
     private const string VariableImpactsParameterName = "VariableImpacts";
 
@@ -52,4 +53,7 @@
     public IValueLookupParameter<BoolValue> AggregateLaggedVariablesParameter {
       get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateLaggedVariablesParameterName]; }
+    }
+    public IValueLookupParameter<BoolValue> AggregateFactorVariablesParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateFactorVariablesParameterName]; }
     }
     #endregion
@@ -59,7 +63,11 @@
       set { AggregateLaggedVariablesParameter.Value = value; }
     }
+    public BoolValue AggregateFactorVariables {
+      get { return AggregateFactorVariablesParameter.ActualValue; }
+      set { AggregateFactorVariablesParameter.Value = value; }
+    }
     #endregion
     [StorableConstructor]
-    private SymbolicDataAnalysisVariableFrequencyAnalyzer(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisVariableFrequencyAnalyzer(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisVariableFrequencyAnalyzer(SymbolicDataAnalysisVariableFrequencyAnalyzer original, Cloner cloner)
       : base(original, cloner) {
@@ -70,4 +78,15 @@
       Parameters.Add(new LookupParameter<DoubleMatrix>(VariableImpactsParameterName, "The relative variable relevance calculated as the average relative variable frequency over the whole run."));
       Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateLaggedVariablesParameterName, "Switch that determines whether all references to a variable should be aggregated regardless of time-offsets. Turn off to analyze all variable references with different time offsets separately.", new BoolValue(true)));
+      Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateFactorVariablesParameterName, "Switch that determines whether all references to factor variables should be aggregated regardless of the value. Turn off to analyze all factor variable references with different values separately.", new BoolValue(true)));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      if (!Parameters.ContainsKey(AggregateFactorVariablesParameterName)) {
+        Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateFactorVariablesParameterName, "Switch that determines whether all references to factor variables should be aggregated regardless of the value. Turn off to analyze all factor variable references with different values separately.", new BoolValue(true)));
+      }
+      #endregion
     }
 
@@ -93,5 +112,5 @@
       int numberOfValues = datatable.Rows.Select(r => r.Values.Count).DefaultIfEmpty().First();
 
-      foreach (var pair in SymbolicDataAnalysisVariableFrequencyAnalyzer.CalculateVariableFrequencies(expressions, AggregateLaggedVariables.Value)) {
+      foreach (var pair in CalculateVariableFrequencies(expressions, AggregateLaggedVariables.Value, AggregateFactorVariables.Value)) {
         if (!datatable.Rows.ContainsKey(pair.Key)) {
           // initialize a new row for the variable and pad with zeros
@@ -128,8 +147,9 @@
     }
 
-    public static IEnumerable<KeyValuePair<string, double>> CalculateVariableFrequencies(IEnumerable<ISymbolicExpressionTree> trees, bool aggregateLaggedVariables = true) {
+    public static IEnumerable<KeyValuePair<string, double>> CalculateVariableFrequencies(IEnumerable<ISymbolicExpressionTree> trees,
+      bool aggregateLaggedVariables = true, bool aggregateFactorVariables = true) {
 
       var variableFrequencies = trees
-        .SelectMany(t => GetVariableReferences(t, aggregateLaggedVariables))
+        .SelectMany(t => GetVariableReferences(t, aggregateLaggedVariables, aggregateFactorVariables))
         .GroupBy(pair => pair.Key, pair => pair.Value)
         .ToDictionary(g => g.Key, g => (double)g.Sum());
@@ -141,49 +161,61 @@
     }
 
-    private static IEnumerable<KeyValuePair<string, int>> GetVariableReferences(ISymbolicExpressionTree tree, bool aggregateLaggedVariables = true) {
+    private static IEnumerable<KeyValuePair<string, int>> GetVariableReferences(ISymbolicExpressionTree tree,
+      bool aggregateLaggedVariables = true, bool aggregateFactorVariables = true) {
       Dictionary<string, int> references = new Dictionary<string, int>();
       if (aggregateLaggedVariables) {
         tree.Root.ForEachNodePrefix(node => {
-          if (node.Symbol is Variable) {
-            var varNode = node as VariableTreeNode;
-            IncReferenceCount(references, varNode.VariableName);
-          } else if (node.Symbol is VariableCondition) {
-            var varCondNode = node as VariableConditionTreeNode;
-            IncReferenceCount(references, varCondNode.VariableName);
+          if (node is IVariableTreeNode) {
+            var factorNode = node as BinaryFactorVariableTreeNode;
+            if (factorNode != null && !aggregateFactorVariables) {
+              IncReferenceCount(references, factorNode.VariableName + "=" + factorNode.VariableValue);
+            } else {
+              var varNode = node as IVariableTreeNode;
+              IncReferenceCount(references, varNode.VariableName);
+            }
           }
         });
       } else {
-        GetVariableReferences(references, tree.Root, 0);
+        GetVariableReferences(references, tree.Root, 0, aggregateFactorVariables);
       }
       return references;
     }
 
-    private static void GetVariableReferences(Dictionary<string, int> references, ISymbolicExpressionTreeNode node, int currentLag) {
-      if (node.Symbol is LaggedVariable) {
-        var laggedVarNode = node as LaggedVariableTreeNode;
-        IncReferenceCount(references, laggedVarNode.VariableName, currentLag + laggedVarNode.Lag);
-      } else if (node.Symbol is Variable) {
-        var varNode = node as VariableTreeNode;
-        IncReferenceCount(references, varNode.VariableName, currentLag);
-      } else if (node.Symbol is VariableCondition) {
-        var varCondNode = node as VariableConditionTreeNode;
-        IncReferenceCount(references, varCondNode.VariableName, currentLag);
-        GetVariableReferences(references, node.GetSubtree(0), currentLag);
-        GetVariableReferences(references, node.GetSubtree(1), currentLag);
+    private static void GetVariableReferences(Dictionary<string, int> references, ISymbolicExpressionTreeNode node, int currentLag, bool aggregateFactorVariables) {
+      if (node is IVariableTreeNode) {
+        var laggedVarTreeNode = node as LaggedVariableTreeNode;
+        var binFactorVariableTreeNode = node as BinaryFactorVariableTreeNode;
+        var varConditionTreeNode = node as VariableConditionTreeNode;
+        if (laggedVarTreeNode != null) {
+          IncReferenceCount(references, laggedVarTreeNode.VariableName, currentLag + laggedVarTreeNode.Lag);
+        } else if (binFactorVariableTreeNode != null) {
+          if (aggregateFactorVariables) {
+            IncReferenceCount(references, binFactorVariableTreeNode.VariableName, currentLag);
+          } else {
+            IncReferenceCount(references, binFactorVariableTreeNode.VariableName + "=" + binFactorVariableTreeNode.VariableValue, currentLag);
+          }
+        } else if (varConditionTreeNode != null) {
+          IncReferenceCount(references, varConditionTreeNode.VariableName, currentLag);
+          GetVariableReferences(references, node.GetSubtree(0), currentLag, aggregateFactorVariables);
+          GetVariableReferences(references, node.GetSubtree(1), currentLag, aggregateFactorVariables);
+        } else {
+          var varNode = node as IVariableTreeNode;
+          IncReferenceCount(references, varNode.VariableName, currentLag);
+        }
       } else if (node.Symbol is Integral) {
         var laggedNode = node as LaggedTreeNode;
         for (int l = laggedNode.Lag; l <= 0; l++) {
-          GetVariableReferences(references, node.GetSubtree(0), currentLag + l);
+          GetVariableReferences(references, node.GetSubtree(0), currentLag + l, aggregateFactorVariables);
         }
       } else if (node.Symbol is Derivative) {
         for (int l = -4; l <= 0; l++) {
-          GetVariableReferences(references, node.GetSubtree(0), currentLag + l);
+          GetVariableReferences(references, node.GetSubtree(0), currentLag + l, aggregateFactorVariables);
         }
       } else if (node.Symbol is TimeLag) {
         var laggedNode = node as LaggedTreeNode;
-        GetVariableReferences(references, node.GetSubtree(0), currentLag + laggedNode.Lag);
+        GetVariableReferences(references, node.GetSubtree(0), currentLag + laggedNode.Lag, aggregateFactorVariables);
       } else {
         foreach (var subtree in node.Subtrees) {
-          GetVariableReferences(references, subtree, currentLag);
+          GetVariableReferences(references, subtree, currentLag, aggregateFactorVariables);
         }
       }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs	(revision 17687)
@@ -0,0 +1,275 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class DerivativeCalculator {
+    public static ISymbolicExpressionTree Derive(ISymbolicExpressionTree tree, string variableName) {
+      if (tree.Root.SubtreeCount != 1)
+        throw new NotImplementedException("Derive is not implemented for symbolic expressions with automatically defined functions (ADF)");
+      if (tree.Root.GetSubtree(0).SubtreeCount != 1)
+        throw new NotImplementedException("Derive is not implemented for multi-variate symbolic expressions");
+      var mainBranch = tree.Root.GetSubtree(0).GetSubtree(0);
+      var root = new ProgramRootSymbol().CreateTreeNode();
+      root.AddSubtree(new StartSymbol().CreateTreeNode());
+      var dTree = TreeSimplifier.GetSimplifiedTree(Derive(mainBranch, variableName));
+      //var dTree = Derive(mainBranch, variableName);
+      root.GetSubtree(0).AddSubtree(dTree);
+      return new SymbolicExpressionTree(root);
+    }
+
+    private static readonly Constant constantSy = new Constant();
+    private static readonly Addition addSy = new Addition();
+    private static readonly Subtraction subSy = new Subtraction();
+    private static readonly Multiplication mulSy = new Multiplication();
+    private static readonly Division divSy = new Division();
+    private static readonly Cosine cosSy = new Cosine();
+    private static readonly Square sqrSy = new Square();
+    private static readonly Absolute absSy = new Absolute();
+    private static readonly SquareRoot sqrtSy = new SquareRoot();
+
+    public static ISymbolicExpressionTreeNode Derive(ISymbolicExpressionTreeNode branch, string variableName) {
+      if (branch.Symbol is Constant) {
+        return CreateConstant(0.0);
+      }
+      if (branch.Symbol is Variable) {
+        var varNode = branch as VariableTreeNode;
+        if (varNode.VariableName == variableName) {
+          return CreateConstant(varNode.Weight);
+        } else {
+          return CreateConstant(0.0);
+        }
+      }
+      if (branch.Symbol is Addition) {
+        var sum = addSy.CreateTreeNode();
+        foreach (var subTree in branch.Subtrees) {
+          sum.AddSubtree(Derive(subTree, variableName));
+        }
+        return sum;
+      }
+      if (branch.Symbol is Subtraction) {
+        var sum = subSy.CreateTreeNode();
+        foreach (var subTree in branch.Subtrees) {
+          sum.AddSubtree(Derive(subTree, variableName));
+        }
+        return sum;
+      }
+      if (branch.Symbol is Multiplication) {
+        // (f * g)' = f'*g + f*g'
+        // for multiple factors: (f * g * h)' = ((f*g) * h)' = (f*g)' * h + (f*g) * h' 
+
+        if (branch.SubtreeCount >= 2) {
+          var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+          var fprime = Derive(f, variableName);
+          for (int i = 1; i < branch.SubtreeCount; i++) {
+            var g = (ISymbolicExpressionTreeNode)branch.GetSubtree(i).Clone();
+            var fg = Product((ISymbolicExpressionTreeNode)f.Clone(), (ISymbolicExpressionTreeNode)g.Clone());
+            var gPrime = Derive(g, variableName);
+            var fgPrime = Sum(Product(fprime, g), Product(gPrime, f));
+            // prepare for next iteration
+            f = fg;
+            fprime = fgPrime;
+          }
+          return fprime;
+        } else
+          // multiplication with only one argument has no effect -> derive the argument
+          return Derive(branch.GetSubtree(0), variableName);
+      }
+      if (branch.Symbol is Division) {
+        // (f/g)' = (f'g - g'f) / g²
+        if (branch.SubtreeCount == 1) {
+          var g = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+          var gPrime = Product(CreateConstant(-1.0), Derive(g, variableName));
+          var sqrNode = new Square().CreateTreeNode();
+          sqrNode.AddSubtree(g);
+          return Div(gPrime, sqrNode);
+        } else {
+          // for two subtrees:
+          // (f/g)' = (f'g - fg')/g²
+
+          // if there are more than 2 subtrees
+          // div(x,y,z) is interpretered as (x/y)/z
+          // which is the same as x / (y*z)
+
+          // --> make a product of all but the first subtree and differentiate as for the 2-argument case above
+          var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+          var g = Product(branch.Subtrees.Skip(1).Select(n => (ISymbolicExpressionTreeNode)n.Clone()));
+          var fprime = Derive(f, variableName);
+          var gprime = Derive(g, variableName);
+          var gSqr = Square(g);
+          return Div(Subtract(Product(fprime, g), Product(f, gprime)), gSqr);
+        }
+      }
+      if (branch.Symbol is Logarithm) {
+        var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        return Product(Div(CreateConstant(1.0), f), Derive(f, variableName));
+      }
+      if (branch.Symbol is Exponential) {
+        var f = (ISymbolicExpressionTreeNode)branch.Clone();
+        return Product(f, Derive(branch.GetSubtree(0), variableName));
+      }
+      if (branch.Symbol is Square) {
+        var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        return Product(Product(CreateConstant(2.0), f), Derive(f, variableName));
+      }
+      if (branch.Symbol is SquareRoot) {
+        var f = (ISymbolicExpressionTreeNode)branch.Clone();
+        var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        return Product(Div(CreateConstant(1.0), Product(CreateConstant(2.0), f)), Derive(u, variableName));
+      }
+      if (branch.Symbol is CubeRoot) {
+        var f = (ISymbolicExpressionTreeNode)branch.Clone();
+        var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        return Product(Div(CreateConstant(1.0), Product(CreateConstant(3.0), Square(f))), Derive(u, variableName));  // 1/3 1/cbrt(f(x))^2 d/dx f(x)
+      }
+      if (branch.Symbol is Cube) {
+        var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        return Product(Product(CreateConstant(3.0), Square(f)), Derive(f, variableName));
+      }
+      if (branch.Symbol is Absolute) {
+        var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        var absf = Abs((ISymbolicExpressionTreeNode)f.Clone());
+        return Product(Div(f, absf), Derive(f, variableName));
+      }
+      if (branch.Symbol is AnalyticQuotient) {
+        // aq(a(x), b(x)) = a(x) / sqrt(b(x)²+1)
+        var a = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        var b = (ISymbolicExpressionTreeNode)branch.GetSubtree(1).Clone();
+
+        var definition = Div(a, SquareRoot(Sum(Square(b), CreateConstant(1.0))));
+        return Derive(definition, variableName);
+      }
+      if (branch.Symbol is Sine) {
+        var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        var cos = (new Cosine()).CreateTreeNode();
+        cos.AddSubtree(u);
+        return Product(cos, Derive(u, variableName));
+      }
+      if (branch.Symbol is Cosine) {
+        var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        var sin = (new Sine()).CreateTreeNode();
+        sin.AddSubtree(u);
+        return Product(CreateConstant(-1.0), Product(sin, Derive(u, variableName)));
+      }
+      if (branch.Symbol is Tangent) {
+        // tan(x)' = 1 / cos²(x)
+        var fxp = Derive(branch.GetSubtree(0), variableName);
+        var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone();
+        return Div(fxp, Square(Cosine(u)));
+      }
+      if (branch.Symbol is HyperbolicTangent) {
+        // tanh(f(x))' = f(x)'sech²(f(x)) = f(x)'(1 - tanh²(f(x)))
+        var fxp = Derive(branch.GetSubtree(0), variableName);
+        var tanh = (ISymbolicExpressionTreeNode)branch.Clone();
+        return Product(fxp, Subtract(CreateConstant(1.0), Square(tanh)));
+      }
+      throw new NotSupportedException(string.Format("Symbol {0} is not supported.", branch.Symbol));
+    }
+
+
+    private static ISymbolicExpressionTreeNode Product(ISymbolicExpressionTreeNode f, ISymbolicExpressionTreeNode g) {
+      var product = mulSy.CreateTreeNode();
+      product.AddSubtree(f);
+      product.AddSubtree(g);
+      return product;
+    }
+    private static ISymbolicExpressionTreeNode Product(IEnumerable<ISymbolicExpressionTreeNode> fs) {
+      var product = mulSy.CreateTreeNode();
+      foreach (var f in fs) product.AddSubtree(f);
+      return product;
+    }
+    private static ISymbolicExpressionTreeNode Div(ISymbolicExpressionTreeNode f, ISymbolicExpressionTreeNode g) {
+      var div = divSy.CreateTreeNode();
+      div.AddSubtree(f);
+      div.AddSubtree(g);
+      return div;
+    }
+
+    private static ISymbolicExpressionTreeNode Sum(ISymbolicExpressionTreeNode f, ISymbolicExpressionTreeNode g) {
+      var sum = addSy.CreateTreeNode();
+      sum.AddSubtree(f);
+      sum.AddSubtree(g);
+      return sum;
+    }
+    private static ISymbolicExpressionTreeNode Subtract(ISymbolicExpressionTreeNode f, ISymbolicExpressionTreeNode g) {
+      var sum = subSy.CreateTreeNode();
+      sum.AddSubtree(f);
+      sum.AddSubtree(g);
+      return sum;
+    }
+    private static ISymbolicExpressionTreeNode Cosine(ISymbolicExpressionTreeNode f) {
+      var cos = cosSy.CreateTreeNode();
+      cos.AddSubtree(f);
+      return cos;
+    }
+    private static ISymbolicExpressionTreeNode Abs(ISymbolicExpressionTreeNode f) {
+      var abs = absSy.CreateTreeNode();
+      abs.AddSubtree(f);
+      return abs;
+    }
+    private static ISymbolicExpressionTreeNode Square(ISymbolicExpressionTreeNode f) {
+      var sqr = sqrSy.CreateTreeNode();
+      sqr.AddSubtree(f);
+      return sqr;
+    }
+    private static ISymbolicExpressionTreeNode SquareRoot(ISymbolicExpressionTreeNode f) {
+      var sqrt = sqrtSy.CreateTreeNode();
+      sqrt.AddSubtree(f);
+      return sqrt;
+    }
+
+    private static ISymbolicExpressionTreeNode CreateConstant(double v) {
+      var constNode = (ConstantTreeNode)constantSy.CreateTreeNode();
+      constNode.Value = v;
+      return constNode;
+    }
+
+    public static bool IsCompatible(ISymbolicExpressionTree tree) {
+      var containsUnknownSymbol = (
+        from n in tree.Root.GetSubtree(0).IterateNodesPrefix()
+        where
+          !(n.Symbol is Variable) &&
+          !(n.Symbol is Constant) &&
+          !(n.Symbol is Addition) &&
+          !(n.Symbol is Subtraction) &&
+          !(n.Symbol is Multiplication) &&
+          !(n.Symbol is Division) &&
+          !(n.Symbol is Logarithm) &&
+          !(n.Symbol is Exponential) &&
+          !(n.Symbol is Square) &&
+          !(n.Symbol is SquareRoot) &&
+          !(n.Symbol is Cube) &&
+          !(n.Symbol is CubeRoot) &&
+          !(n.Symbol is Absolute) &&
+          !(n.Symbol is AnalyticQuotient) &&
+          !(n.Symbol is Sine) &&
+          !(n.Symbol is Cosine) &&
+          !(n.Symbol is Tangent) &&
+          !(n.Symbol is StartSymbol)
+        select n).Any();
+      return !containsUnknownSymbol;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs	(revision 17687)
@@ -0,0 +1,139 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class LinearModelToTreeConverter {
+    public static ISymbolicExpressionTree CreateTree(string[] variableNames, double[] coefficients,
+      double @const = 0) {
+      return CreateTree(variableNames, new int[variableNames.Length], coefficients, @const);
+    }
+
+    public static ISymbolicExpressionTree CreateTree(
+      IEnumerable<KeyValuePair<string, IEnumerable<string>>> factors, double[] factorCoefficients,
+      string[] variableNames, double[] coefficients,
+      double @const = 0) {
+
+      if (factorCoefficients.Length == 0 && coefficients.Length == 0 && @const==0) throw new ArgumentException();
+
+      // Combine both trees
+      ISymbolicExpressionTreeNode add = (new Addition()).CreateTreeNode();
+
+      // Create tree for double variables
+      if (coefficients.Length > 0) {
+        var varTree = CreateTree(variableNames, new int[variableNames.Length], coefficients);
+        foreach (var varNode in varTree.IterateNodesPrefix().OfType<VariableTreeNode>())
+          add.AddSubtree(varNode);
+      }
+
+      // Create tree for string variables
+      if (factorCoefficients.Length > 0) {
+        var factorTree = CreateTree(factors, factorCoefficients);
+        foreach (var binFactorNode in factorTree.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>())
+          add.AddSubtree(binFactorNode);
+      }
+
+      if (@const!=0.0) {
+        ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();
+        cNode.Value = @const;
+        add.AddSubtree(cNode);
+      }
+
+      ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
+      ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
+      tree.Root.AddSubtree(startNode);
+      startNode.AddSubtree(add);
+      return tree;
+    }
+
+    public static ISymbolicExpressionTree CreateTree(string[] variableNames, int[] lags, double[] coefficients,
+      double @const = 0) {
+      if (variableNames.Length == 0 ||
+        variableNames.Length != coefficients.Length ||
+        variableNames.Length != lags.Length)
+        throw new ArgumentException("The length of the variable names, lags, and coefficients vectors must match");
+
+      ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
+      ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
+      tree.Root.AddSubtree(startNode);
+      ISymbolicExpressionTreeNode addition = new Addition().CreateTreeNode();
+      startNode.AddSubtree(addition);
+
+      for (int i = 0; i < variableNames.Length; i++) {
+        if (lags[i] == 0) {
+          VariableTreeNode vNode = (VariableTreeNode)new Variable().CreateTreeNode();
+          vNode.VariableName = variableNames[i];
+          vNode.Weight = coefficients[i];
+          addition.AddSubtree(vNode);
+        } else {
+          LaggedVariableTreeNode vNode = (LaggedVariableTreeNode)new LaggedVariable().CreateTreeNode();
+          vNode.VariableName = variableNames[i];
+          vNode.Weight = coefficients[i];
+          vNode.Lag = lags[i];
+          addition.AddSubtree(vNode);
+        }
+      }
+
+      if (!@const.IsAlmost(0.0)) {
+        ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();
+        cNode.Value = @const;
+        addition.AddSubtree(cNode);
+      }
+      return tree;
+    }
+
+    public static ISymbolicExpressionTree CreateTree(IEnumerable<KeyValuePair<string, IEnumerable<string>>> factors,
+      double[] factorCoefficients,
+      double @const = 0) {
+
+      ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
+      ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
+      tree.Root.AddSubtree(startNode);
+      ISymbolicExpressionTreeNode addition = new Addition().CreateTreeNode();
+      startNode.AddSubtree(addition);
+
+      int i = 0;
+      foreach (var factor in factors) {
+        var varName = factor.Key;
+        foreach (var factorValue in factor.Value) {
+          var node = (BinaryFactorVariableTreeNode)new BinaryFactorVariable().CreateTreeNode();
+          node.VariableValue = factorValue;
+          node.VariableName = varName;
+          node.Weight = factorCoefficients[i];
+          addition.AddSubtree(node);
+          i++;
+        }
+      }
+
+      if (!@const.IsAlmost(0.0)) {
+        ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();
+        cNode.Value = @const;
+        addition.AddSubtree(cNode);
+      }
+      return tree;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeSimplifier.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeSimplifier.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeSimplifier.cs	(revision 17687)
@@ -0,0 +1,1507 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  /// <summary>
+  /// Simplifier for symbolic expressions
+  /// </summary>
+  public class TreeSimplifier {
+    private static readonly Addition addSymbol = new Addition();
+    private static readonly Multiplication mulSymbol = new Multiplication();
+    private static readonly Division divSymbol = new Division();
+    private static readonly Constant constSymbol = new Constant();
+    private static readonly Absolute absSymbol = new Absolute();
+    private static readonly Logarithm logSymbol = new Logarithm();
+    private static readonly Exponential expSymbol = new Exponential();
+    private static readonly Root rootSymbol = new Root();
+    private static readonly Square sqrSymbol = new Square();
+    private static readonly SquareRoot sqrtSymbol = new SquareRoot();
+    private static readonly AnalyticQuotient aqSymbol = new AnalyticQuotient();
+    private static readonly Cube cubeSymbol = new Cube();
+    private static readonly CubeRoot cubeRootSymbol = new CubeRoot();
+    private static readonly Power powSymbol = new Power();
+    private static readonly Sine sineSymbol = new Sine();
+    private static readonly Cosine cosineSymbol = new Cosine();
+    private static readonly Tangent tanSymbol = new Tangent();
+    private static readonly IfThenElse ifThenElseSymbol = new IfThenElse();
+    private static readonly And andSymbol = new And();
+    private static readonly Or orSymbol = new Or();
+    private static readonly Not notSymbol = new Not();
+    private static readonly GreaterThan gtSymbol = new GreaterThan();
+    private static readonly LessThan ltSymbol = new LessThan();
+    private static readonly Integral integralSymbol = new Integral();
+    private static readonly LaggedVariable laggedVariableSymbol = new LaggedVariable();
+    private static readonly TimeLag timeLagSymbol = new TimeLag();
+
+    [Obsolete("Use static method TreeSimplifier.Simplify instead")]
+    public TreeSimplifier() { }
+
+    public static ISymbolicExpressionTree Simplify(ISymbolicExpressionTree originalTree) {
+      var clone = (ISymbolicExpressionTreeNode)originalTree.Root.Clone();
+      // macro expand (initially no argument trees)
+      var macroExpandedTree = MacroExpand(clone, clone.GetSubtree(0), new List<ISymbolicExpressionTreeNode>());
+      ISymbolicExpressionTreeNode rootNode = (new ProgramRootSymbol()).CreateTreeNode();
+      rootNode.AddSubtree(GetSimplifiedTree(macroExpandedTree));
+
+#if DEBUG
+      // check that each node is only referenced once
+      var nodes = rootNode.IterateNodesPrefix().ToArray();
+      foreach (var n in nodes) if (nodes.Count(ni => ni == n) > 1) throw new InvalidOperationException();
+#endif
+      return new SymbolicExpressionTree(rootNode);
+    }
+
+    // the argumentTrees list contains already expanded trees used as arguments for invocations
+    private static ISymbolicExpressionTreeNode MacroExpand(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode node,
+      IList<ISymbolicExpressionTreeNode> argumentTrees) {
+      List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(node.Subtrees);
+      while (node.SubtreeCount > 0) node.RemoveSubtree(0);
+      if (node.Symbol is InvokeFunction) {
+        var invokeSym = node.Symbol as InvokeFunction;
+        var defunNode = FindFunctionDefinition(root, invokeSym.FunctionName);
+        var macroExpandedArguments = new List<ISymbolicExpressionTreeNode>();
+        foreach (var subtree in subtrees) {
+          macroExpandedArguments.Add(MacroExpand(root, subtree, argumentTrees));
+        }
+        return MacroExpand(root, defunNode, macroExpandedArguments);
+      } else if (node.Symbol is Argument) {
+        var argSym = node.Symbol as Argument;
+        // return the correct argument sub-tree (already macro-expanded)
+        return (SymbolicExpressionTreeNode)argumentTrees[argSym.ArgumentIndex].Clone();
+      } else {
+        // recursive application
+        foreach (var subtree in subtrees) {
+          node.AddSubtree(MacroExpand(root, subtree, argumentTrees));
+        }
+        return node;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode FindFunctionDefinition(ISymbolicExpressionTreeNode root, string functionName) {
+      foreach (var subtree in root.Subtrees.OfType<DefunTreeNode>()) {
+        if (subtree.FunctionName == functionName) return subtree.GetSubtree(0);
+      }
+
+      throw new ArgumentException("Definition of function " + functionName + " not found.");
+    }
+
+    #region symbol predicates
+
+    // arithmetic
+    private static bool IsDivision(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Division;
+    }
+
+    private static bool IsMultiplication(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Multiplication;
+    }
+
+    private static bool IsSubtraction(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Subtraction;
+    }
+
+    private static bool IsAddition(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Addition;
+    }
+
+    private static bool IsAverage(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Average;
+    }
+
+    private static bool IsAbsolute(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Absolute;
+    }
+
+    // exponential
+    private static bool IsLog(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Logarithm;
+    }
+
+    private static bool IsExp(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Exponential;
+    }
+
+    private static bool IsRoot(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Root;
+    }
+
+    private static bool IsSquare(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Square;
+    }
+
+    private static bool IsSquareRoot(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is SquareRoot;
+    }
+
+    private static bool IsCube(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Cube;
+    }
+
+    private static bool IsCubeRoot(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is CubeRoot;
+    }
+
+    private static bool IsPower(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Power;
+    }
+
+    // trigonometric
+    private static bool IsSine(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Sine;
+    }
+
+    private static bool IsCosine(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Cosine;
+    }
+
+    private static bool IsTangent(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Tangent;
+    }
+
+    private static bool IsAnalyticalQuotient(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is AnalyticQuotient;
+    }
+
+    // boolean
+    private static bool IsIfThenElse(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is IfThenElse;
+    }
+
+    private static bool IsAnd(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is And;
+    }
+
+    private static bool IsOr(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Or;
+    }
+
+    private static bool IsNot(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Not;
+    }
+
+    // comparison
+    private static bool IsGreaterThan(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is GreaterThan;
+    }
+
+    private static bool IsLessThan(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is LessThan;
+    }
+
+    private static bool IsBoolean(ISymbolicExpressionTreeNode node) {
+      return
+        node.Symbol is GreaterThan ||
+        node.Symbol is LessThan ||
+        node.Symbol is And ||
+        node.Symbol is Or;
+    }
+
+    // terminals
+    private static bool IsVariable(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Variable;
+    }
+
+    private static bool IsVariableBase(ISymbolicExpressionTreeNode node) {
+      return node is VariableTreeNodeBase;
+    }
+
+    private static bool IsFactor(ISymbolicExpressionTreeNode node) {
+      return node is FactorVariableTreeNode;
+    }
+
+    private static bool IsBinFactor(ISymbolicExpressionTreeNode node) {
+      return node is BinaryFactorVariableTreeNode;
+    }
+
+    private static bool IsConstant(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Constant;
+    }
+
+    // dynamic
+    private static bool IsTimeLag(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is TimeLag;
+    }
+
+    private static bool IsIntegral(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Integral;
+    }
+
+    #endregion
+
+    /// <summary>
+    /// Creates a new simplified tree
+    /// </summary>
+    /// <param name="original"></param>
+    /// <returns></returns>
+    public static ISymbolicExpressionTreeNode GetSimplifiedTree(ISymbolicExpressionTreeNode original) {
+      if (IsConstant(original) || IsVariableBase(original)) {
+        return (ISymbolicExpressionTreeNode)original.Clone();
+      } else if (IsAbsolute(original)) {
+        return SimplifyAbsolute(original);
+      } else if (IsAddition(original)) {
+        return SimplifyAddition(original);
+      } else if (IsSubtraction(original)) {
+        return SimplifySubtraction(original);
+      } else if (IsMultiplication(original)) {
+        return SimplifyMultiplication(original);
+      } else if (IsDivision(original)) {
+        return SimplifyDivision(original);
+      } else if (IsAverage(original)) {
+        return SimplifyAverage(original);
+      } else if (IsLog(original)) {
+        return SimplifyLog(original);
+      } else if (IsExp(original)) {
+        return SimplifyExp(original);
+      } else if (IsSquare(original)) {
+        return SimplifySquare(original);
+      } else if (IsSquareRoot(original)) {
+        return SimplifySquareRoot(original);
+      } else if (IsCube(original)) {
+        return SimplifyCube(original);
+      } else if (IsCubeRoot(original)) {
+        return SimplifyCubeRoot(original);
+      } else if (IsPower(original)) {
+        return SimplifyPower(original);
+      } else if (IsRoot(original)) {
+        return SimplifyRoot(original);
+      } else if (IsSine(original)) {
+        return SimplifySine(original);
+      } else if (IsCosine(original)) {
+        return SimplifyCosine(original);
+      } else if (IsTangent(original)) {
+        return SimplifyTangent(original);
+      } else if (IsAnalyticalQuotient(original)) {
+        return SimplifyAnalyticalQuotient(original);
+      } else if (IsIfThenElse(original)) {
+        return SimplifyIfThenElse(original);
+      } else if (IsGreaterThan(original)) {
+        return SimplifyGreaterThan(original);
+      } else if (IsLessThan(original)) {
+        return SimplifyLessThan(original);
+      } else if (IsAnd(original)) {
+        return SimplifyAnd(original);
+      } else if (IsOr(original)) {
+        return SimplifyOr(original);
+      } else if (IsNot(original)) {
+        return SimplifyNot(original);
+      } else if (IsTimeLag(original)) {
+        return SimplifyTimeLag(original);
+      } else if (IsIntegral(original)) {
+        return SimplifyIntegral(original);
+      } else {
+        return SimplifyAny(original);
+      }
+    }
+
+    #region specific simplification routines
+
+    private static ISymbolicExpressionTreeNode SimplifyAny(ISymbolicExpressionTreeNode original) {
+      // can't simplify this function but simplify all subtrees 
+      List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(original.Subtrees);
+      while (original.Subtrees.Count() > 0) original.RemoveSubtree(0);
+      var clone = (SymbolicExpressionTreeNode)original.Clone();
+      List<ISymbolicExpressionTreeNode> simplifiedSubtrees = new List<ISymbolicExpressionTreeNode>();
+      foreach (var subtree in subtrees) {
+        simplifiedSubtrees.Add(GetSimplifiedTree(subtree));
+        original.AddSubtree(subtree);
+      }
+      foreach (var simplifiedSubtree in simplifiedSubtrees) {
+        clone.AddSubtree(simplifiedSubtree);
+      }
+      if (simplifiedSubtrees.TrueForAll(t => IsConstant(t))) {
+        SimplifyConstantExpression(clone);
+      }
+      return clone;
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyConstantExpression(ISymbolicExpressionTreeNode original) {
+      // not yet implemented
+      return original;
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyAverage(ISymbolicExpressionTreeNode original) {
+      if (original.Subtrees.Count() == 1) {
+        return GetSimplifiedTree(original.GetSubtree(0));
+      } else {
+        // simplify expressions x0..xn
+        // make sum(x0..xn) / n
+        var sum = original.Subtrees
+          .Select(GetSimplifiedTree)
+          .Aggregate(MakeSum);
+        return MakeFraction(sum, MakeConstant(original.Subtrees.Count()));
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyDivision(ISymbolicExpressionTreeNode original) {
+      if (original.Subtrees.Count() == 1) {
+        return Invert(GetSimplifiedTree(original.GetSubtree(0)));
+      } else {
+        // simplify expressions x0..xn
+        // make multiplication (x0 * 1/(x1 * x1 * .. * xn))
+        var first = original.GetSubtree(0);
+        var second = original.GetSubtree(1);
+        var remaining = original.Subtrees.Skip(2);
+        return
+          MakeProduct(GetSimplifiedTree(first),
+            Invert(remaining.Aggregate(GetSimplifiedTree(second), (a, b) => MakeProduct(a, GetSimplifiedTree(b)))));
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyMultiplication(ISymbolicExpressionTreeNode original) {
+      if (original.Subtrees.Count() == 1) {
+        return GetSimplifiedTree(original.GetSubtree(0));
+      } else {
+        return original.Subtrees
+          .Select(GetSimplifiedTree)
+          .Aggregate(MakeProduct);
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifySubtraction(ISymbolicExpressionTreeNode original) {
+      if (original.Subtrees.Count() == 1) {
+        return Negate(GetSimplifiedTree(original.GetSubtree(0)));
+      } else {
+        // simplify expressions x0..xn
+        // make addition (x0,-x1..-xn)
+        var first = original.Subtrees.First();
+        var remaining = original.Subtrees.Skip(1);
+        return remaining.Aggregate(GetSimplifiedTree(first), (a, b) => MakeSum(a, Negate(GetSimplifiedTree(b))));
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyAddition(ISymbolicExpressionTreeNode original) {
+      if (original.Subtrees.Count() == 1) {
+        return GetSimplifiedTree(original.GetSubtree(0));
+      } else {
+        // simplify expression x0..xn
+        // make addition (x0..xn)
+        return original.Subtrees
+          .Select(GetSimplifiedTree)
+          .Aggregate(MakeSum);
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyAbsolute(ISymbolicExpressionTreeNode original) {
+      return MakeAbs(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyNot(ISymbolicExpressionTreeNode original) {
+      return MakeNot(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyOr(ISymbolicExpressionTreeNode original) {
+      return original.Subtrees
+        .Select(GetSimplifiedTree)
+        .Aggregate(MakeOr);
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyAnd(ISymbolicExpressionTreeNode original) {
+      return original.Subtrees
+        .Select(GetSimplifiedTree)
+        .Aggregate(MakeAnd);
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyLessThan(ISymbolicExpressionTreeNode original) {
+      return MakeLessThan(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyGreaterThan(ISymbolicExpressionTreeNode original) {
+      return MakeGreaterThan(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyIfThenElse(ISymbolicExpressionTreeNode original) {
+      return MakeIfThenElse(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)),
+        GetSimplifiedTree(original.GetSubtree(2)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyTangent(ISymbolicExpressionTreeNode original) {
+      return MakeTangent(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyCosine(ISymbolicExpressionTreeNode original) {
+      return MakeCosine(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifySine(ISymbolicExpressionTreeNode original) {
+      return MakeSine(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyExp(ISymbolicExpressionTreeNode original) {
+      return MakeExp(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifySquare(ISymbolicExpressionTreeNode original) {
+      return MakeSquare(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifySquareRoot(ISymbolicExpressionTreeNode original) {
+      return MakeSquareRoot(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+    private static ISymbolicExpressionTreeNode SimplifyCube(ISymbolicExpressionTreeNode original) {
+      return MakeCube(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyCubeRoot(ISymbolicExpressionTreeNode original) {
+      return MakeCubeRoot(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyLog(ISymbolicExpressionTreeNode original) {
+      return MakeLog(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyRoot(ISymbolicExpressionTreeNode original) {
+      return MakeRoot(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyPower(ISymbolicExpressionTreeNode original) {
+      return MakePower(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyAnalyticalQuotient(ISymbolicExpressionTreeNode original) {
+      return MakeAnalyticalQuotient(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyTimeLag(ISymbolicExpressionTreeNode original) {
+      var laggedTreeNode = original as ILaggedTreeNode;
+      var simplifiedSubtree = GetSimplifiedTree(original.GetSubtree(0));
+      if (!ContainsVariableCondition(simplifiedSubtree)) {
+        return AddLagToDynamicNodes(simplifiedSubtree, laggedTreeNode.Lag);
+      } else {
+        return MakeTimeLag(simplifiedSubtree, laggedTreeNode.Lag);
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode SimplifyIntegral(ISymbolicExpressionTreeNode original) {
+      var laggedTreeNode = original as ILaggedTreeNode;
+      var simplifiedSubtree = GetSimplifiedTree(original.GetSubtree(0));
+      if (IsConstant(simplifiedSubtree)) {
+        return GetSimplifiedTree(MakeProduct(simplifiedSubtree, MakeConstant(-laggedTreeNode.Lag)));
+      } else {
+        return MakeIntegral(simplifiedSubtree, laggedTreeNode.Lag);
+      }
+    }
+
+    #endregion
+
+    #region low level tree restructuring
+
+    private static ISymbolicExpressionTreeNode MakeTimeLag(ISymbolicExpressionTreeNode subtree, int lag) {
+      if (lag == 0) return subtree;
+      if (IsConstant(subtree)) return subtree;
+      var lagNode = (LaggedTreeNode)timeLagSymbol.CreateTreeNode();
+      lagNode.Lag = lag;
+      lagNode.AddSubtree(subtree);
+      return lagNode;
+    }
+
+    private static ISymbolicExpressionTreeNode MakeIntegral(ISymbolicExpressionTreeNode subtree, int lag) {
+      if (lag == 0) return subtree;
+      else if (lag == -1 || lag == 1) {
+        return MakeSum(subtree, AddLagToDynamicNodes((ISymbolicExpressionTreeNode)subtree.Clone(), lag));
+      } else {
+        var node = (LaggedTreeNode)integralSymbol.CreateTreeNode();
+        node.Lag = lag;
+        node.AddSubtree(subtree);
+        return node;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeNot(ISymbolicExpressionTreeNode t) {
+      if (IsConstant(t)) {
+        var constNode = t as ConstantTreeNode;
+        if (constNode.Value > 0) return MakeConstant(-1.0);
+        else return MakeConstant(1.0);
+      } else if (IsNot(t)) {
+        return t.GetSubtree(0);
+      } else if (!IsBoolean(t)) {
+        var gtNode = gtSymbol.CreateTreeNode();
+        gtNode.AddSubtree(t);
+        gtNode.AddSubtree(MakeConstant(0.0));
+        var notNode = notSymbol.CreateTreeNode();
+        notNode.AddSubtree(gtNode);
+        return notNode;
+      } else {
+        var notNode = notSymbol.CreateTreeNode();
+        notNode.AddSubtree(t);
+        return notNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeOr(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        var constA = a as ConstantTreeNode;
+        var constB = b as ConstantTreeNode;
+        if (constA.Value > 0.0 || constB.Value > 0.0) {
+          return MakeConstant(1.0);
+        } else {
+          return MakeConstant(-1.0);
+        }
+      } else if (IsConstant(a)) {
+        return MakeOr(b, a);
+      } else if (IsConstant(b)) {
+        var constT = b as ConstantTreeNode;
+        if (constT.Value > 0.0) {
+          // boolean expression is necessarily true
+          return MakeConstant(1.0);
+        } else {
+          // the constant value has no effect on the result of the boolean condition so we can drop the constant term
+          var orNode = orSymbol.CreateTreeNode();
+          orNode.AddSubtree(a);
+          return orNode;
+        }
+      } else {
+        var orNode = orSymbol.CreateTreeNode();
+        orNode.AddSubtree(a);
+        orNode.AddSubtree(b);
+        return orNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeAnd(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        var constA = a as ConstantTreeNode;
+        var constB = b as ConstantTreeNode;
+        if (constA.Value > 0.0 && constB.Value > 0.0) {
+          return MakeConstant(1.0);
+        } else {
+          return MakeConstant(-1.0);
+        }
+      } else if (IsConstant(a)) {
+        return MakeAnd(b, a);
+      } else if (IsConstant(b)) {
+        var constB = b as ConstantTreeNode;
+        if (constB.Value > 0.0) {
+          // the constant value has no effect on the result of the boolean condition so we can drop the constant term
+          var andNode = andSymbol.CreateTreeNode();
+          andNode.AddSubtree(a);
+          return andNode;
+        } else {
+          // boolean expression is necessarily false
+          return MakeConstant(-1.0);
+        }
+      } else {
+        var andNode = andSymbol.CreateTreeNode();
+        andNode.AddSubtree(a);
+        andNode.AddSubtree(b);
+        return andNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeLessThan(ISymbolicExpressionTreeNode leftSide,
+      ISymbolicExpressionTreeNode rightSide) {
+      if (IsConstant(leftSide) && IsConstant(rightSide)) {
+        var lsConst = leftSide as ConstantTreeNode;
+        var rsConst = rightSide as ConstantTreeNode;
+        if (lsConst.Value < rsConst.Value) return MakeConstant(1.0);
+        else return MakeConstant(-1.0);
+      } else {
+        var ltNode = ltSymbol.CreateTreeNode();
+        ltNode.AddSubtree(leftSide);
+        ltNode.AddSubtree(rightSide);
+        return ltNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeGreaterThan(ISymbolicExpressionTreeNode leftSide,
+      ISymbolicExpressionTreeNode rightSide) {
+      if (IsConstant(leftSide) && IsConstant(rightSide)) {
+        var lsConst = leftSide as ConstantTreeNode;
+        var rsConst = rightSide as ConstantTreeNode;
+        if (lsConst.Value > rsConst.Value) return MakeConstant(1.0);
+        else return MakeConstant(-1.0);
+      } else {
+        var gtNode = gtSymbol.CreateTreeNode();
+        gtNode.AddSubtree(leftSide);
+        gtNode.AddSubtree(rightSide);
+        return gtNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeIfThenElse(ISymbolicExpressionTreeNode condition,
+      ISymbolicExpressionTreeNode trueBranch, ISymbolicExpressionTreeNode falseBranch) {
+      if (IsConstant(condition)) {
+        var constT = condition as ConstantTreeNode;
+        if (constT.Value > 0.0) return trueBranch;
+        else return falseBranch;
+      } else {
+        var ifNode = ifThenElseSymbol.CreateTreeNode();
+        if (IsBoolean(condition)) {
+          ifNode.AddSubtree(condition);
+        } else {
+          var gtNode = gtSymbol.CreateTreeNode();
+          gtNode.AddSubtree(condition);
+          gtNode.AddSubtree(MakeConstant(0.0));
+          ifNode.AddSubtree(gtNode);
+        }
+        ifNode.AddSubtree(trueBranch);
+        ifNode.AddSubtree(falseBranch);
+        return ifNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeSine(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Sin(constT.Value));
+      } else if (IsFactor(node)) {
+        var factor = node as FactorVariableTreeNode;
+        return MakeFactor(factor.Symbol, factor.VariableName, factor.Weights.Select(Math.Sin));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Sin(binFactor.Weight));
+      } else {
+        var sineNode = sineSymbol.CreateTreeNode();
+        sineNode.AddSubtree(node);
+        return sineNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeTangent(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Tan(constT.Value));
+      } else if (IsFactor(node)) {
+        var factor = node as FactorVariableTreeNode;
+        return MakeFactor(factor.Symbol, factor.VariableName, factor.Weights.Select(Math.Tan));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Tan(binFactor.Weight));
+      } else {
+        var tanNode = tanSymbol.CreateTreeNode();
+        tanNode.AddSubtree(node);
+        return tanNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeCosine(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Cos(constT.Value));
+      } else if (IsFactor(node)) {
+        var factor = node as FactorVariableTreeNode;
+        return MakeFactor(factor.Symbol, factor.VariableName, factor.Weights.Select(Math.Cos));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        // cos(0) = 1 see similar case for Exp(binfactor)
+        return MakeSum(MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Cos(binFactor.Weight) - 1),
+          MakeConstant(1.0));
+      } else {
+        var cosNode = cosineSymbol.CreateTreeNode();
+        cosNode.AddSubtree(node);
+        return cosNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeExp(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Exp(constT.Value));
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Exp(w)));
+      } else if (IsBinFactor(node)) {
+        // exp( binfactor w val=a) = if(val=a) exp(w) else exp(0) = binfactor( (exp(w) - 1) val a) + 1
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return
+          MakeSum(MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Exp(binFactor.Weight) - 1), MakeConstant(1.0));
+      } else if (IsLog(node)) {
+        return node.GetSubtree(0);
+      } else if (IsAddition(node)) {
+        return node.Subtrees.Select(s => MakeExp(s)).Aggregate((s, t) => MakeProduct(s, t));
+      } else if (IsSubtraction(node)) {
+        return node.Subtrees.Select(s => MakeExp(s)).Aggregate((s, t) => MakeProduct(s, Negate(t)));
+      } else {
+        var expNode = expSymbol.CreateTreeNode();
+        expNode.AddSubtree(node);
+        return expNode;
+      }
+    }
+    private static ISymbolicExpressionTreeNode MakeLog(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Log(constT.Value));
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Log(w)));
+      } else if (IsExp(node)) {
+        return node.GetSubtree(0);
+      } else if (IsSquareRoot(node)) {
+        return MakeFraction(MakeLog(node.GetSubtree(0)), MakeConstant(2.0));
+      } else {
+        var logNode = logSymbol.CreateTreeNode();
+        logNode.AddSubtree(node);
+        return logNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeSquare(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(constT.Value * constT.Value);
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => w * w));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, binFactor.Weight * binFactor.Weight);
+      } else if (IsSquareRoot(node)) {
+        return node.GetSubtree(0);
+      } else if (IsMultiplication(node)) {
+        // sqr( x * y ) = sqr(x) * sqr(y)
+        var mulNode = mulSymbol.CreateTreeNode();
+        foreach (var subtree in node.Subtrees) {
+          mulNode.AddSubtree(MakeSquare(subtree));
+        }
+        return mulNode;
+      } else if (IsAbsolute(node)) {
+        return MakeSquare(node.GetSubtree(0)); // sqr(abs(x)) = sqr(x)
+      } else if (IsExp(node)) {
+        return MakeExp(MakeProduct(node.GetSubtree(0), MakeConstant(2.0))); // sqr(exp(x)) = exp(2x)
+      } else if (IsCube(node)) {
+        return MakePower(node.GetSubtree(0), MakeConstant(6));
+      } else {
+        var sqrNode = sqrSymbol.CreateTreeNode();
+        sqrNode.AddSubtree(node);
+        return sqrNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeCube(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(constT.Value * constT.Value * constT.Value);
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => w * w * w));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, binFactor.Weight * binFactor.Weight * binFactor.Weight);
+      } else if (IsCubeRoot(node)) {
+        return node.GetSubtree(0); // NOTE: not really accurate because cuberoot(x) with negative x is evaluated to NaN and after this simplification we evaluate as x
+      } else if (IsExp(node)) {
+        return MakeExp(MakeProduct(node.GetSubtree(0), MakeConstant(3)));
+      } else if (IsSquare(node)) {
+        return MakePower(node.GetSubtree(0), MakeConstant(6));
+      } else {
+        var cubeNode = cubeSymbol.CreateTreeNode();
+        cubeNode.AddSubtree(node);
+        return cubeNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeAbs(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Abs(constT.Value));
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Abs(w)));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Abs(binFactor.Weight));
+      } else if (IsSquare(node) || IsExp(node) || IsSquareRoot(node) || IsCubeRoot(node)) {
+        return node; // abs(sqr(x)) = sqr(x), abs(exp(x)) = exp(x) ...
+      } else if (IsMultiplication(node)) {
+        var mul = mulSymbol.CreateTreeNode();
+        foreach (var st in node.Subtrees) {
+          mul.AddSubtree(MakeAbs(st));
+        }
+        return mul;
+      } else if (IsDivision(node)) {
+        var div = divSymbol.CreateTreeNode();
+        foreach (var st in node.Subtrees) {
+          div.AddSubtree(MakeAbs(st));
+        }
+        return div;
+      } else {
+        var absNode = absSymbol.CreateTreeNode();
+        absNode.AddSubtree(node);
+        return absNode;
+      }
+    }
+
+    // constant folding only
+    private static ISymbolicExpressionTreeNode MakeAnalyticalQuotient(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(b)) {
+        var c = b as ConstantTreeNode;
+        return MakeFraction(a, MakeConstant(Math.Sqrt(1.0 + c.Value * c.Value)));
+      } else if (IsFactor(b)) {
+        var factNode = b as FactorVariableTreeNode;
+        return MakeFraction(a, MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Sqrt(1.0 + w * w))));
+      } else if (IsBinFactor(b)) {
+        var binFactor = b as BinaryFactorVariableTreeNode;
+        return MakeFraction(a, MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Sqrt(1.0 + binFactor.Weight * binFactor.Weight)));
+      } else {
+        var aqNode = aqSymbol.CreateTreeNode();
+        aqNode.AddSubtree(a);
+        aqNode.AddSubtree(b);
+        return aqNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeSquareRoot(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Sqrt(constT.Value));
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Sqrt(w)));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Sqrt(binFactor.Weight));
+      } else if (IsSquare(node)) {
+        return node.GetSubtree(0); // NOTE: not really accurate because sqrt(x) with negative x is evaluated to NaN and after this simplification we evaluate as x
+      } else {
+        var sqrtNode = sqrtSymbol.CreateTreeNode();
+        sqrtNode.AddSubtree(node);
+        return sqrtNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeCubeRoot(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Pow(constT.Value, 1.0 / 3.0));
+      } else if (IsFactor(node)) {
+        var factNode = node as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Pow(w, 1.0 / 3.0)));
+      } else if (IsBinFactor(node)) {
+        var binFactor = node as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Sqrt(Math.Pow(binFactor.Weight, 1.0 / 3.0)));
+      } else if (IsCube(node)) {
+        return node.GetSubtree(0);
+      } else {
+        var cubeRootNode = cubeRootSymbol.CreateTreeNode();
+        cubeRootNode.AddSubtree(node);
+        return cubeRootNode;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeRoot(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        var constA = a as ConstantTreeNode;
+        var constB = b as ConstantTreeNode;
+        return MakeConstant(Math.Pow(constA.Value, 1.0 / Math.Round(constB.Value)));
+      } else if (IsFactor(a) && IsConstant(b)) {
+        var factNode = a as FactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName,
+          factNode.Weights.Select(w => Math.Pow(w, 1.0 / Math.Round(constNode.Value))));
+      } else if (IsBinFactor(a) && IsConstant(b)) {
+        var binFactor = a as BinaryFactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Pow(binFactor.Weight, 1.0 / Math.Round(constNode.Value)));
+      } else if (IsConstant(a) && IsFactor(b)) {
+        var constNode = a as ConstantTreeNode;
+        var factNode = b as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Pow(constNode.Value, 1.0 / Math.Round(w))));
+      } else if (IsConstant(a) && IsBinFactor(b)) {
+        var constNode = a as ConstantTreeNode;
+        var factNode = b as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(factNode.Symbol, factNode.VariableName, factNode.VariableValue, Math.Pow(constNode.Value, 1.0 / Math.Round(factNode.Weight)));
+      } else if (IsFactor(a) && IsFactor(b) && AreSameTypeAndVariable(a, b)) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as FactorVariableTreeNode;
+        return MakeFactor(node0.Symbol, node0.VariableName, node0.Weights.Zip(node1.Weights, (u, v) => Math.Pow(u, 1.0 / Math.Round(v))));
+      } else if (IsConstant(b)) {
+        var constB = b as ConstantTreeNode;
+        var constBValue = Math.Round(constB.Value);
+        if (constBValue.IsAlmost(1.0)) {
+          return a;
+        } else if (constBValue.IsAlmost(0.0)) {
+          return MakeConstant(1.0);
+        } else if (constBValue.IsAlmost(-1.0)) {
+          return MakeFraction(MakeConstant(1.0), a);
+        } else if (constBValue < 0) {
+          var rootNode = rootSymbol.CreateTreeNode();
+          rootNode.AddSubtree(a);
+          rootNode.AddSubtree(MakeConstant(-1.0 * constBValue));
+          return MakeFraction(MakeConstant(1.0), rootNode);
+        } else {
+          var rootNode = rootSymbol.CreateTreeNode();
+          rootNode.AddSubtree(a);
+          rootNode.AddSubtree(MakeConstant(constBValue));
+          return rootNode;
+        }
+      } else {
+        var rootNode = rootSymbol.CreateTreeNode();
+        rootNode.AddSubtree(a);
+        rootNode.AddSubtree(b);
+        return rootNode;
+      }
+    }
+
+
+    private static ISymbolicExpressionTreeNode MakePower(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        var constA = a as ConstantTreeNode;
+        var constB = b as ConstantTreeNode;
+        return MakeConstant(Math.Pow(constA.Value, Math.Round(constB.Value)));
+      } else if (IsFactor(a) && IsConstant(b)) {
+        var factNode = a as FactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Pow(w, Math.Round(constNode.Value))));
+      } else if (IsBinFactor(a) && IsConstant(b)) {
+        var binFactor = a as BinaryFactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeBinFactor(binFactor.Symbol, binFactor.VariableName, binFactor.VariableValue, Math.Pow(binFactor.Weight, Math.Round(constNode.Value)));
+      } else if (IsConstant(a) && IsFactor(b)) {
+        var constNode = a as ConstantTreeNode;
+        var factNode = b as FactorVariableTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => Math.Pow(constNode.Value, Math.Round(w))));
+      } else if (IsConstant(a) && IsBinFactor(b)) {
+        var constNode = a as ConstantTreeNode;
+        var factNode = b as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(factNode.Symbol, factNode.VariableName, factNode.VariableValue, Math.Pow(constNode.Value, Math.Round(factNode.Weight)));
+      } else if (IsFactor(a) && IsFactor(b) && AreSameTypeAndVariable(a, b)) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as FactorVariableTreeNode;
+        return MakeFactor(node0.Symbol, node0.VariableName, node0.Weights.Zip(node1.Weights, (u, v) => Math.Pow(u, Math.Round(v))));
+      } else if (IsConstant(b)) {
+        var constB = b as ConstantTreeNode;
+        double exponent = Math.Round(constB.Value);
+        if (exponent.IsAlmost(0.0)) {
+          return MakeConstant(1.0);
+        } else if (exponent.IsAlmost(1.0)) {
+          return a;
+        } else if (exponent.IsAlmost(-1.0)) {
+          return MakeFraction(MakeConstant(1.0), a);
+        } else if (exponent < 0) {
+          var powNode = powSymbol.CreateTreeNode();
+          powNode.AddSubtree(a);
+          powNode.AddSubtree(MakeConstant(-1.0 * exponent));
+          return MakeFraction(MakeConstant(1.0), powNode);
+        } else {
+          var powNode = powSymbol.CreateTreeNode();
+          powNode.AddSubtree(a);
+          powNode.AddSubtree(MakeConstant(exponent));
+          return powNode;
+        }
+      } else {
+        var powNode = powSymbol.CreateTreeNode();
+        powNode.AddSubtree(a);
+        powNode.AddSubtree(b);
+        return powNode;
+      }
+    }
+
+
+    // MakeFraction, MakeProduct and MakeSum take two already simplified trees and create a new simplified tree
+    private static ISymbolicExpressionTreeNode MakeFraction(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        // fold constants
+        return MakeConstant(((ConstantTreeNode)a).Value / ((ConstantTreeNode)b).Value);
+      } else if ((IsConstant(a) && !((ConstantTreeNode)a).Value.IsAlmost(1.0))) {
+        return MakeFraction(MakeConstant(1.0), MakeProduct(b, Invert(a)));
+      } else if (IsVariableBase(a) && IsConstant(b)) {
+        // merge constant values into variable weights
+        var constB = ((ConstantTreeNode)b).Value;
+        ((VariableTreeNodeBase)a).Weight /= constB;
+        return a;
+      } else if (IsFactor(a) && IsConstant(b)) {
+        var factNode = a as FactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select(w => w / constNode.Value));
+      } else if (IsBinFactor(a) && IsConstant(b)) {
+        var factNode = a as BinaryFactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeBinFactor(factNode.Symbol, factNode.VariableName, factNode.VariableValue, factNode.Weight / constNode.Value);
+      } else if (IsFactor(a) && IsFactor(b) && AreSameTypeAndVariable(a, b)) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as FactorVariableTreeNode;
+        return MakeFactor(node0.Symbol, node0.VariableName, node0.Weights.Zip(node1.Weights, (u, v) => u / v));
+      } else if (IsFactor(a) && IsBinFactor(b) && ((IVariableTreeNode)a).VariableName == ((IVariableTreeNode)b).VariableName) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as BinaryFactorVariableTreeNode;
+        var varValues = node0.Symbol.GetVariableValues(node0.VariableName).ToArray();
+        var wi = Array.IndexOf(varValues, node1.VariableValue);
+        if (wi < 0) throw new ArgumentException();
+        var newWeighs = new double[varValues.Length];
+        node0.Weights.CopyTo(newWeighs, 0);
+        for (int i = 0; i < newWeighs.Length; i++)
+          if (wi == i) newWeighs[i] /= node1.Weight;
+          else newWeighs[i] /= 0.0;
+        return MakeFactor(node0.Symbol, node0.VariableName, newWeighs);
+      } else if (IsFactor(a)) {
+        return MakeFraction(MakeConstant(1.0), MakeProduct(b, Invert(a)));
+      } else if (IsVariableBase(a) && IsVariableBase(b) && AreSameTypeAndVariable(a, b) && !IsBinFactor(b)) {
+        // cancel variables (not allowed for bin factors because of division by zero)
+        var aVar = a as VariableTreeNode;
+        var bVar = b as VariableTreeNode;
+        return MakeConstant(aVar.Weight / bVar.Weight);
+      } else if (IsAddition(a) && IsConstant(b)) {
+        return a.Subtrees
+          .Select(x => GetSimplifiedTree(x))
+          .Select(x => MakeFraction(x, GetSimplifiedTree(b)))
+          .Aggregate((c, d) => MakeSum(c, d));
+      } else if (IsMultiplication(a) && IsConstant(b)) {
+        return MakeProduct(a, Invert(b));
+      } else if (IsDivision(a) && IsConstant(b)) {
+        // (a1 / a2) / c => (a1 / (a2 * c))
+        return MakeFraction(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
+      } else if (IsDivision(a) && IsDivision(b)) {
+        // (a1 / a2) / (b1 / b2) => 
+        return MakeFraction(MakeProduct(a.GetSubtree(0), b.GetSubtree(1)), MakeProduct(a.GetSubtree(1), b.GetSubtree(0)));
+      } else if (IsDivision(a)) {
+        // (a1 / a2) / b => (a1 / (a2 * b))
+        return MakeFraction(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
+      } else if (IsDivision(b)) {
+        // a / (b1 / b2) => (a * b2) / b1
+        return MakeFraction(MakeProduct(a, b.GetSubtree(1)), b.GetSubtree(0));
+      } else if (IsAnalyticalQuotient(a)) {
+        return MakeAnalyticalQuotient(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
+      } else {
+        var div = divSymbol.CreateTreeNode();
+        div.AddSubtree(a);
+        div.AddSubtree(b);
+        return div;
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeSum(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        // fold constants
+        ((ConstantTreeNode)a).Value += ((ConstantTreeNode)b).Value;
+        return a;
+      } else if (IsConstant(a)) {
+        // c + x => x + c
+        // b is not constant => make sure constant is on the right
+        return MakeSum(b, a);
+      } else if (IsConstant(b) && ((ConstantTreeNode)b).Value.IsAlmost(0.0)) {
+        // x + 0 => x
+        return a;
+      } else if (IsFactor(a) && IsConstant(b)) {
+        var factNode = a as FactorVariableTreeNode;
+        var constNode = b as ConstantTreeNode;
+        return MakeFactor(factNode.Symbol, factNode.VariableName, factNode.Weights.Select((w) => w + constNode.Value));
+      } else if (IsFactor(a) && IsFactor(b) && AreSameTypeAndVariable(a, b)) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as FactorVariableTreeNode;
+        return MakeFactor(node0.Symbol, node0.VariableName, node0.Weights.Zip(node1.Weights, (u, v) => u + v));
+      } else if (IsBinFactor(a) && IsFactor(b)) {
+        return MakeSum(b, a);
+      } else if (IsFactor(a) && IsBinFactor(b) &&
+        ((IVariableTreeNode)a).VariableName == ((IVariableTreeNode)b).VariableName) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as BinaryFactorVariableTreeNode;
+        var varValues = node0.Symbol.GetVariableValues(node0.VariableName).ToArray();
+        var wi = Array.IndexOf(varValues, node1.VariableValue);
+        if (wi < 0) throw new ArgumentException();
+        var newWeighs = new double[varValues.Length];
+        node0.Weights.CopyTo(newWeighs, 0);
+        newWeighs[wi] += node1.Weight;
+        return MakeFactor(node0.Symbol, node0.VariableName, newWeighs);
+      } else if (IsAddition(a) && IsAddition(b)) {
+        // merge additions
+        var add = addSymbol.CreateTreeNode();
+        // add all sub trees except for the last
+        for (int i = 0; i < a.Subtrees.Count() - 1; i++) add.AddSubtree(a.GetSubtree(i));
+        for (int i = 0; i < b.Subtrees.Count() - 1; i++) add.AddSubtree(b.GetSubtree(i));
+        if (IsConstant(a.Subtrees.Last()) && IsConstant(b.Subtrees.Last())) {
+          add.AddSubtree(MakeSum(a.Subtrees.Last(), b.Subtrees.Last()));
+        } else if (IsConstant(a.Subtrees.Last())) {
+          add.AddSubtree(b.Subtrees.Last());
+          add.AddSubtree(a.Subtrees.Last());
+        } else {
+          add.AddSubtree(a.Subtrees.Last());
+          add.AddSubtree(b.Subtrees.Last());
+        }
+        MergeVariablesInSum(add);
+        if (add.Subtrees.Count() == 1) {
+          return add.GetSubtree(0);
+        } else {
+          return add;
+        }
+      } else if (IsAddition(b)) {
+        return MakeSum(b, a);
+      } else if (IsAddition(a) && IsConstant(b)) {
+        // a is an addition and b is a constant => append b to a and make sure the constants are merged
+        var add = addSymbol.CreateTreeNode();
+        // add all sub trees except for the last
+        for (int i = 0; i < a.Subtrees.Count() - 1; i++) add.AddSubtree(a.GetSubtree(i));
+        if (IsConstant(a.Subtrees.Last()))
+          add.AddSubtree(MakeSum(a.Subtrees.Last(), b));
+        else {
+          add.AddSubtree(a.Subtrees.Last());
+          add.AddSubtree(b);
+        }
+        return add;
+      } else if (IsAddition(a)) {
+        // a is already an addition => append b
+        var add = addSymbol.CreateTreeNode();
+        add.AddSubtree(b);
+        foreach (var subtree in a.Subtrees) {
+          add.AddSubtree(subtree);
+        }
+        MergeVariablesInSum(add);
+        if (add.Subtrees.Count() == 1) {
+          return add.GetSubtree(0);
+        } else {
+          return add;
+        }
+      } else {
+        var add = addSymbol.CreateTreeNode();
+        add.AddSubtree(a);
+        add.AddSubtree(b);
+        MergeVariablesInSum(add);
+        if (add.Subtrees.Count() == 1) {
+          return add.GetSubtree(0);
+        } else {
+          return add;
+        }
+      }
+    }
+
+    // makes sure variable symbols in sums are combined
+    private static void MergeVariablesInSum(ISymbolicExpressionTreeNode sum) {
+      var subtrees = new List<ISymbolicExpressionTreeNode>(sum.Subtrees);
+      while (sum.Subtrees.Any()) sum.RemoveSubtree(0);
+      var groupedVarNodes = from node in subtrees.OfType<IVariableTreeNode>()
+                            where node.SubtreeCount == 0
+                            group node by GroupId(node) into g
+                            select g;
+      var constant = (from node in subtrees.OfType<ConstantTreeNode>()
+                      select node.Value).DefaultIfEmpty(0.0).Sum();
+      var unchangedSubtrees = subtrees.Where(t => t.SubtreeCount > 0 || !(t is IVariableTreeNode) && !(t is ConstantTreeNode));
+
+      foreach (var variableNodeGroup in groupedVarNodes) {
+        var firstNode = variableNodeGroup.First();
+        if (firstNode is VariableTreeNodeBase) {
+          var representative = firstNode as VariableTreeNodeBase;
+          var weightSum = variableNodeGroup.Cast<VariableTreeNodeBase>().Select(t => t.Weight).Sum();
+          representative.Weight = weightSum;
+          sum.AddSubtree(representative);
+        } else if (firstNode is FactorVariableTreeNode) {
+          var representative = firstNode as FactorVariableTreeNode;
+          foreach (var node in variableNodeGroup.Skip(1).Cast<FactorVariableTreeNode>()) {
+            for (int j = 0; j < representative.Weights.Length; j++) {
+              representative.Weights[j] += node.Weights[j];
+            }
+          }
+          sum.AddSubtree(representative);
+        }
+      }
+      foreach (var unchangedSubtree in unchangedSubtrees)
+        sum.AddSubtree(unchangedSubtree);
+      if (!constant.IsAlmost(0.0)) {
+        sum.AddSubtree(MakeConstant(constant));
+      }
+    }
+
+    // nodes referencing variables can be grouped if they have
+    private static string GroupId(IVariableTreeNode node) {
+      var binaryFactorNode = node as BinaryFactorVariableTreeNode;
+      var factorNode = node as FactorVariableTreeNode;
+      var variableNode = node as VariableTreeNode;
+      var laggedVarNode = node as LaggedVariableTreeNode;
+      if (variableNode != null) {
+        return "var " + variableNode.VariableName;
+      } else if (binaryFactorNode != null) {
+        return "binfactor " + binaryFactorNode.VariableName + " " + binaryFactorNode.VariableValue;
+      } else if (factorNode != null) {
+        return "factor " + factorNode.VariableName;
+      } else if (laggedVarNode != null) {
+        return "lagged " + laggedVarNode.VariableName + " " + laggedVarNode.Lag;
+      } else {
+        throw new NotSupportedException();
+      }
+    }
+
+
+    private static ISymbolicExpressionTreeNode MakeProduct(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (IsConstant(a) && IsConstant(b)) {
+        // fold constants
+        return MakeConstant(((ConstantTreeNode)a).Value * ((ConstantTreeNode)b).Value);
+      } else if (IsConstant(a)) {
+        // a * $ => $ * a
+        return MakeProduct(b, a);
+      } else if (IsFactor(a) && IsFactor(b) && AreSameTypeAndVariable(a, b)) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as FactorVariableTreeNode;
+        return MakeFactor(node0.Symbol, node0.VariableName, node0.Weights.Zip(node1.Weights, (u, v) => u * v));
+      } else if (IsBinFactor(a) && IsBinFactor(b) && AreSameTypeAndVariable(a, b)) {
+        var node0 = a as BinaryFactorVariableTreeNode;
+        var node1 = b as BinaryFactorVariableTreeNode;
+        return MakeBinFactor(node0.Symbol, node0.VariableName, node0.VariableValue, node0.Weight * node1.Weight);
+      } else if (IsFactor(a) && IsConstant(b)) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as ConstantTreeNode;
+        return MakeFactor(node0.Symbol, node0.VariableName, node0.Weights.Select(w => w * node1.Value));
+      } else if (IsBinFactor(a) && IsConstant(b)) {
+        var node0 = a as BinaryFactorVariableTreeNode;
+        var node1 = b as ConstantTreeNode;
+        return MakeBinFactor(node0.Symbol, node0.VariableName, node0.VariableValue, node0.Weight * node1.Value);
+      } else if (IsBinFactor(a) && IsFactor(b)) {
+        return MakeProduct(b, a);
+      } else if (IsFactor(a) && IsBinFactor(b) &&
+        ((IVariableTreeNode)a).VariableName == ((IVariableTreeNode)b).VariableName) {
+        var node0 = a as FactorVariableTreeNode;
+        var node1 = b as BinaryFactorVariableTreeNode;
+        var varValues = node0.Symbol.GetVariableValues(node0.VariableName).ToArray();
+        var wi = Array.IndexOf(varValues, node1.VariableValue);
+        if (wi < 0) throw new ArgumentException();
+        return MakeBinFactor(node1.Symbol, node1.VariableName, node1.VariableValue, node1.Weight * node0.Weights[wi]);
+      } else if (IsConstant(b) && ((ConstantTreeNode)b).Value.IsAlmost(1.0)) {
+        // $ * 1.0 => $
+        return a;
+      } else if (IsConstant(b) && ((ConstantTreeNode)b).Value.IsAlmost(0.0)) {
+        return MakeConstant(0);
+      } else if (IsConstant(b) && IsVariableBase(a)) {
+        // multiply constants into variables weights
+        ((VariableTreeNodeBase)a).Weight *= ((ConstantTreeNode)b).Value;
+        return a;
+      } else if (IsConstant(b) && IsAddition(a) ||
+          IsFactor(b) && IsAddition(a) ||
+          IsBinFactor(b) && IsAddition(a)) {
+        // multiply constants into additions
+        return a.Subtrees.Select(x => MakeProduct(GetSimplifiedTree(x), GetSimplifiedTree(b))).Aggregate((c, d) => MakeSum(c, d));
+      } else if (IsDivision(a) && IsDivision(b)) {
+        // (a1 / a2) * (b1 / b2) => (a1 * b1) / (a2 * b2)
+        return MakeFraction(MakeProduct(a.GetSubtree(0), b.GetSubtree(0)), MakeProduct(a.GetSubtree(1), b.GetSubtree(1)));
+      } else if (IsDivision(a)) {
+        // (a1 / a2) * b => (a1 * b) / a2
+        return MakeFraction(MakeProduct(a.GetSubtree(0), b), a.GetSubtree(1));
+      } else if (IsDivision(b)) {
+        // a * (b1 / b2) => (b1 * a) / b2
+        return MakeFraction(MakeProduct(b.GetSubtree(0), a), b.GetSubtree(1));
+      } else if (IsMultiplication(a) && IsMultiplication(b)) {
+        // merge multiplications (make sure constants are merged)
+        var mul = mulSymbol.CreateTreeNode();
+        for (int i = 0; i < a.Subtrees.Count(); i++) mul.AddSubtree(a.GetSubtree(i));
+        for (int i = 0; i < b.Subtrees.Count(); i++) mul.AddSubtree(b.GetSubtree(i));
+        MergeVariablesAndConstantsInProduct(mul);
+        return mul;
+      } else if (IsMultiplication(b)) {
+        return MakeProduct(b, a);
+      } else if (IsMultiplication(a)) {
+        // a is already an multiplication => append b
+        a.AddSubtree(GetSimplifiedTree(b));
+        MergeVariablesAndConstantsInProduct(a);
+        return a;
+      } else if (IsAbsolute(a) && IsAbsolute(b)) {
+        return MakeAbs(MakeProduct(a.GetSubtree(0), b.GetSubtree(0)));
+      } else if (IsAbsolute(a) && IsConstant(b)) {
+        var constNode = b as ConstantTreeNode;
+        var posF = Math.Abs(constNode.Value);
+        if (constNode.Value > 0) {
+          return MakeAbs(MakeProduct(a.GetSubtree(0), MakeConstant(posF)));
+        } else {
+          var mul = mulSymbol.CreateTreeNode();
+          mul.AddSubtree(MakeAbs(MakeProduct(a.GetSubtree(0), MakeConstant(posF))));
+          mul.AddSubtree(MakeConstant(-1.0));
+          return mul;
+        }
+      } else if (IsAnalyticalQuotient(a)) {
+        return MakeAnalyticalQuotient(MakeProduct(a.GetSubtree(0), b), a.GetSubtree(1));
+      } else {
+        var mul = mulSymbol.CreateTreeNode();
+        mul.AddSubtree(a);
+        mul.AddSubtree(b);
+        MergeVariablesAndConstantsInProduct(mul);
+        return mul;
+      }
+    }
+
+    #endregion
+
+    #region helper functions
+
+    private static bool ContainsVariableCondition(ISymbolicExpressionTreeNode node) {
+      if (node.Symbol is VariableCondition) return true;
+      foreach (var subtree in node.Subtrees)
+        if (ContainsVariableCondition(subtree)) return true;
+      return false;
+    }
+
+    private static ISymbolicExpressionTreeNode AddLagToDynamicNodes(ISymbolicExpressionTreeNode node, int lag) {
+      var laggedTreeNode = node as ILaggedTreeNode;
+      var variableNode = node as VariableTreeNode;
+      var variableConditionNode = node as VariableConditionTreeNode;
+      if (laggedTreeNode != null)
+        laggedTreeNode.Lag += lag;
+      else if (variableNode != null) {
+        var laggedVariableNode = (LaggedVariableTreeNode)laggedVariableSymbol.CreateTreeNode();
+        laggedVariableNode.Lag = lag;
+        laggedVariableNode.VariableName = variableNode.VariableName;
+        return laggedVariableNode;
+      } else if (variableConditionNode != null) {
+        throw new NotSupportedException("Removal of time lags around variable condition symbols is not allowed.");
+      }
+      var subtrees = new List<ISymbolicExpressionTreeNode>(node.Subtrees);
+      while (node.SubtreeCount > 0) node.RemoveSubtree(0);
+      foreach (var subtree in subtrees) {
+        node.AddSubtree(AddLagToDynamicNodes(subtree, lag));
+      }
+      return node;
+    }
+
+    private static bool AreSameTypeAndVariable(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      return GroupId((IVariableTreeNode)a) == GroupId((IVariableTreeNode)b);
+    }
+
+    // helper to combine the constant factors in products and to combine variables (powers of 2, 3...)
+    private static void MergeVariablesAndConstantsInProduct(ISymbolicExpressionTreeNode prod) {
+      var subtrees = new List<ISymbolicExpressionTreeNode>(prod.Subtrees);
+      while (prod.Subtrees.Any()) prod.RemoveSubtree(0);
+      var groupedVarNodes = from node in subtrees.OfType<IVariableTreeNode>()
+                            where node.SubtreeCount == 0
+                            group node by GroupId(node) into g
+                            orderby g.Count()
+                            select g;
+      var constantProduct = (from node in subtrees.OfType<VariableTreeNodeBase>()
+                             select node.Weight)
+        .Concat(from node in subtrees.OfType<ConstantTreeNode>()
+                select node.Value)
+        .DefaultIfEmpty(1.0)
+        .Aggregate((c1, c2) => c1 * c2);
+
+      var unchangedSubtrees = from tree in subtrees
+                              where tree.SubtreeCount > 0 || !(tree is IVariableTreeNode) && !(tree is ConstantTreeNode)
+                              select tree;
+
+      foreach (var variableNodeGroup in groupedVarNodes) {
+        var firstNode = variableNodeGroup.First();
+        if (firstNode is VariableTreeNodeBase) {
+          var representative = (VariableTreeNodeBase)firstNode;
+          representative.Weight = 1.0;
+          if (variableNodeGroup.Count() > 1) {
+            var poly = mulSymbol.CreateTreeNode();
+            for (int p = 0; p < variableNodeGroup.Count(); p++) {
+              poly.AddSubtree((ISymbolicExpressionTreeNode)representative.Clone());
+            }
+            prod.AddSubtree(poly);
+          } else {
+            prod.AddSubtree(representative);
+          }
+        } else if (firstNode is FactorVariableTreeNode) {
+          var representative = (FactorVariableTreeNode)firstNode;
+          foreach (var node in variableNodeGroup.Skip(1).Cast<FactorVariableTreeNode>()) {
+            for (int j = 0; j < representative.Weights.Length; j++) {
+              representative.Weights[j] *= node.Weights[j];
+            }
+          }
+          for (int j = 0; j < representative.Weights.Length; j++) {
+            representative.Weights[j] *= constantProduct;
+          }
+          constantProduct = 1.0;
+          // if the product already contains a factor it is not necessary to multiply a constant below
+          prod.AddSubtree(representative);
+        }
+      }
+
+      foreach (var unchangedSubtree in unchangedSubtrees)
+        prod.AddSubtree(unchangedSubtree);
+
+      if (!constantProduct.IsAlmost(1.0)) {
+        prod.AddSubtree(MakeConstant(constantProduct));
+      }
+    }
+
+
+    /// <summary>
+    /// x => x * -1
+    /// Is only used in cases where it is not necessary to create new tree nodes. Manipulates x directly.
+    /// </summary>
+    /// <param name="x"></param>
+    /// <returns>-x</returns>
+    private static ISymbolicExpressionTreeNode Negate(ISymbolicExpressionTreeNode x) {
+      if (IsConstant(x)) {
+        ((ConstantTreeNode)x).Value *= -1;
+      } else if (IsVariableBase(x)) {
+        var variableTree = (VariableTreeNodeBase)x;
+        variableTree.Weight *= -1.0;
+      } else if (IsFactor(x)) {
+        var factorNode = (FactorVariableTreeNode)x;
+        for (int i = 0; i < factorNode.Weights.Length; i++) factorNode.Weights[i] *= -1;
+      } else if (IsBinFactor(x)) {
+        var factorNode = (BinaryFactorVariableTreeNode)x;
+        factorNode.Weight *= -1;
+      } else if (IsAddition(x)) {
+        // (x0 + x1 + .. + xn) * -1 => (-x0 + -x1 + .. + -xn)        
+        var subtrees = new List<ISymbolicExpressionTreeNode>(x.Subtrees);
+        while (x.Subtrees.Any()) x.RemoveSubtree(0);
+        foreach (var subtree in subtrees) {
+          x.AddSubtree(Negate(subtree));
+        }
+      } else if (IsMultiplication(x) || IsDivision(x)) {
+        // x0 * x1 * .. * xn * -1 => x0 * x1 * .. * -xn
+        var lastSubTree = x.Subtrees.Last();
+        x.RemoveSubtree(x.SubtreeCount - 1);
+        x.AddSubtree(Negate(lastSubTree)); // last is maybe a constant, prefer to negate the constant
+      } else {
+        // any other function
+        return MakeProduct(x, MakeConstant(-1));
+      }
+      return x;
+    }
+
+    /// <summary>
+    /// x => 1/x
+    /// Must create new tree nodes
+    /// </summary>
+    /// <param name="x"></param>
+    /// <returns></returns>
+    private static ISymbolicExpressionTreeNode Invert(ISymbolicExpressionTreeNode x) {
+      if (IsConstant(x)) {
+        return MakeConstant(1.0 / ((ConstantTreeNode)x).Value);
+      } else if (IsFactor(x)) {
+        var factorNode = (FactorVariableTreeNode)x;
+        return MakeFactor(factorNode.Symbol, factorNode.VariableName, factorNode.Weights.Select(w => 1.0 / w));
+      } else if (IsDivision(x)) {
+        return MakeFraction(x.GetSubtree(1), x.GetSubtree(0));
+      } else {
+        // any other function
+        return MakeFraction(MakeConstant(1), x);
+      }
+    }
+
+    private static ISymbolicExpressionTreeNode MakeConstant(double value) {
+      ConstantTreeNode constantTreeNode = (ConstantTreeNode)(constSymbol.CreateTreeNode());
+      constantTreeNode.Value = value;
+      return constantTreeNode;
+    }
+
+    private static ISymbolicExpressionTreeNode MakeFactor(FactorVariable sy, string variableName, IEnumerable<double> weights) {
+      var tree = (FactorVariableTreeNode)sy.CreateTreeNode();
+      tree.VariableName = variableName;
+      tree.Weights = weights.ToArray();
+      return tree;
+    }
+    private static ISymbolicExpressionTreeNode MakeBinFactor(BinaryFactorVariable sy, string variableName, string variableValue, double weight) {
+      var tree = (BinaryFactorVariableTreeNode)sy.CreateTreeNode();
+      tree.VariableName = variableName;
+      tree.VariableValue = variableValue;
+      tree.Weight = weight;
+      return tree;
+    }
+
+
+    #endregion
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs	(revision 17687)
@@ -0,0 +1,366 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using AutoDiff;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class TreeToAutoDiffTermConverter {
+    public delegate double ParametricFunction(double[] vars, double[] @params);
+
+    public delegate Tuple<double[], double> ParametricFunctionGradient(double[] vars, double[] @params);
+
+    #region helper class
+    public class DataForVariable {
+      public readonly string variableName;
+      public readonly string variableValue; // for factor vars
+      public readonly int lag;
+
+      public DataForVariable(string varName, string varValue, int lag) {
+        this.variableName = varName;
+        this.variableValue = varValue;
+        this.lag = lag;
+      }
+
+      public override bool Equals(object obj) {
+        var other = obj as DataForVariable;
+        if (other == null) return false;
+        return other.variableName.Equals(this.variableName) &&
+               other.variableValue.Equals(this.variableValue) &&
+               other.lag == this.lag;
+      }
+
+      public override int GetHashCode() {
+        return variableName.GetHashCode() ^ variableValue.GetHashCode() ^ lag;
+      }
+    }
+    #endregion
+
+    #region derivations of functions
+    // create function factory for arctangent
+    private static readonly Func<Term, UnaryFunc> arctan = UnaryFunc.Factory(
+      eval: Math.Atan,
+      diff: x => 1 / (1 + x * x));
+
+    private static readonly Func<Term, UnaryFunc> sin = UnaryFunc.Factory(
+      eval: Math.Sin,
+      diff: Math.Cos);
+
+    private static readonly Func<Term, UnaryFunc> cos = UnaryFunc.Factory(
+      eval: Math.Cos,
+      diff: x => -Math.Sin(x));
+
+    private static readonly Func<Term, UnaryFunc> tan = UnaryFunc.Factory(
+      eval: Math.Tan,
+      diff: x => 1 + Math.Tan(x) * Math.Tan(x));
+    private static readonly Func<Term, UnaryFunc> tanh = UnaryFunc.Factory(
+      eval: Math.Tanh,
+      diff: x => 1 - Math.Tanh(x) * Math.Tanh(x));
+    private static readonly Func<Term, UnaryFunc> erf = UnaryFunc.Factory(
+      eval: alglib.errorfunction,
+      diff: x => 2.0 * Math.Exp(-(x * x)) / Math.Sqrt(Math.PI));
+
+    private static readonly Func<Term, UnaryFunc> norm = UnaryFunc.Factory(
+      eval: alglib.normaldistribution,
+      diff: x => -(Math.Exp(-(x * x)) * Math.Sqrt(Math.Exp(x * x)) * x) / Math.Sqrt(2 * Math.PI));
+
+    private static readonly Func<Term, UnaryFunc> abs = UnaryFunc.Factory(
+      eval: Math.Abs,
+      diff: x => Math.Sign(x)
+      );
+
+    private static readonly Func<Term, UnaryFunc> cbrt = UnaryFunc.Factory(
+      eval: x => x < 0 ? -Math.Pow(-x, 1.0 / 3) : Math.Pow(x, 1.0 / 3),
+      diff: x => { var cbrt_x = x < 0 ? -Math.Pow(-x, 1.0 / 3) : Math.Pow(x, 1.0 / 3); return 1.0 / (3 * cbrt_x * cbrt_x); }
+      );
+
+
+
+    #endregion
+
+    public static bool TryConvertToAutoDiff(ISymbolicExpressionTree tree, bool makeVariableWeightsVariable, bool addLinearScalingTerms,
+      out List<DataForVariable> parameters, out double[] initialConstants,
+      out ParametricFunction func,
+      out ParametricFunctionGradient func_grad) {
+
+      // use a transformator object which holds the state (variable list, parameter list, ...) for recursive transformation of the tree
+      var transformator = new TreeToAutoDiffTermConverter(makeVariableWeightsVariable, addLinearScalingTerms);
+      AutoDiff.Term term;
+      try {
+        term = transformator.ConvertToAutoDiff(tree.Root.GetSubtree(0));
+        var parameterEntries = transformator.parameters.ToArray(); // guarantee same order for keys and values
+        var compiledTerm = term.Compile(transformator.variables.ToArray(),
+          parameterEntries.Select(kvp => kvp.Value).ToArray());
+        parameters = new List<DataForVariable>(parameterEntries.Select(kvp => kvp.Key));
+        initialConstants = transformator.initialConstants.ToArray();
+        func = (vars, @params) => compiledTerm.Evaluate(vars, @params);
+        func_grad = (vars, @params) => compiledTerm.Differentiate(vars, @params);
+        return true;
+      } catch (ConversionException) {
+        func = null;
+        func_grad = null;
+        parameters = null;
+        initialConstants = null;
+      }
+      return false;
+    }
+
+    // state for recursive transformation of trees 
+    private readonly
+    List<double> initialConstants;
+    private readonly Dictionary<DataForVariable, AutoDiff.Variable> parameters;
+    private readonly List<AutoDiff.Variable> variables;
+    private readonly bool makeVariableWeightsVariable;
+    private readonly bool addLinearScalingTerms;
+
+    private TreeToAutoDiffTermConverter(bool makeVariableWeightsVariable, bool addLinearScalingTerms) {
+      this.makeVariableWeightsVariable = makeVariableWeightsVariable;
+      this.addLinearScalingTerms = addLinearScalingTerms;
+      this.initialConstants = new List<double>();
+      this.parameters = new Dictionary<DataForVariable, AutoDiff.Variable>();
+      this.variables = new List<AutoDiff.Variable>();
+    }
+
+    private AutoDiff.Term ConvertToAutoDiff(ISymbolicExpressionTreeNode node) {
+      if (node.Symbol is Constant) {
+        initialConstants.Add(((ConstantTreeNode)node).Value);
+        var var = new AutoDiff.Variable();
+        variables.Add(var);
+        return var;
+      }
+      if (node.Symbol is Variable || node.Symbol is BinaryFactorVariable) {
+        var varNode = node as VariableTreeNodeBase;
+        var factorVarNode = node as BinaryFactorVariableTreeNode;
+        // factor variable values are only 0 or 1 and set in x accordingly
+        var varValue = factorVarNode != null ? factorVarNode.VariableValue : string.Empty;
+        var par = FindOrCreateParameter(parameters, varNode.VariableName, varValue);
+
+        if (makeVariableWeightsVariable) {
+          initialConstants.Add(varNode.Weight);
+          var w = new AutoDiff.Variable();
+          variables.Add(w);
+          return AutoDiff.TermBuilder.Product(w, par);
+        } else {
+          return varNode.Weight * par;
+        }
+      }
+      if (node.Symbol is FactorVariable) {
+        var factorVarNode = node as FactorVariableTreeNode;
+        var products = new List<Term>();
+        foreach (var variableValue in factorVarNode.Symbol.GetVariableValues(factorVarNode.VariableName)) {
+          var par = FindOrCreateParameter(parameters, factorVarNode.VariableName, variableValue);
+
+          initialConstants.Add(factorVarNode.GetValue(variableValue));
+          var wVar = new AutoDiff.Variable();
+          variables.Add(wVar);
+
+          products.Add(AutoDiff.TermBuilder.Product(wVar, par));
+        }
+        return AutoDiff.TermBuilder.Sum(products);
+      }
+      if (node.Symbol is LaggedVariable) {
+        var varNode = node as LaggedVariableTreeNode;
+        var par = FindOrCreateParameter(parameters, varNode.VariableName, string.Empty, varNode.Lag);
+
+        if (makeVariableWeightsVariable) {
+          initialConstants.Add(varNode.Weight);
+          var w = new AutoDiff.Variable();
+          variables.Add(w);
+          return AutoDiff.TermBuilder.Product(w, par);
+        } else {
+          return varNode.Weight * par;
+        }
+      }
+      if (node.Symbol is Addition) {
+        List<AutoDiff.Term> terms = new List<Term>();
+        foreach (var subTree in node.Subtrees) {
+          terms.Add(ConvertToAutoDiff(subTree));
+        }
+        return AutoDiff.TermBuilder.Sum(terms);
+      }
+      if (node.Symbol is Subtraction) {
+        List<AutoDiff.Term> terms = new List<Term>();
+        for (int i = 0; i < node.SubtreeCount; i++) {
+          AutoDiff.Term t = ConvertToAutoDiff(node.GetSubtree(i));
+          if (i > 0) t = -t;
+          terms.Add(t);
+        }
+        if (terms.Count == 1) return -terms[0];
+        else return AutoDiff.TermBuilder.Sum(terms);
+      }
+      if (node.Symbol is Multiplication) {
+        List<AutoDiff.Term> terms = new List<Term>();
+        foreach (var subTree in node.Subtrees) {
+          terms.Add(ConvertToAutoDiff(subTree));
+        }
+        if (terms.Count == 1) return terms[0];
+        else return terms.Aggregate((a, b) => new AutoDiff.Product(a, b));
+      }
+      if (node.Symbol is Division) {
+        List<AutoDiff.Term> terms = new List<Term>();
+        foreach (var subTree in node.Subtrees) {
+          terms.Add(ConvertToAutoDiff(subTree));
+        }
+        if (terms.Count == 1) return 1.0 / terms[0];
+        else return terms.Aggregate((a, b) => new AutoDiff.Product(a, 1.0 / b));
+      }
+      if (node.Symbol is Absolute) {
+        var x1 = ConvertToAutoDiff(node.GetSubtree(0));
+        return abs(x1);
+      }
+      if (node.Symbol is AnalyticQuotient) {
+        var x1 = ConvertToAutoDiff(node.GetSubtree(0));
+        var x2 = ConvertToAutoDiff(node.GetSubtree(1));
+        return x1 / (TermBuilder.Power(1 + x2 * x2, 0.5));
+      }
+      if (node.Symbol is Logarithm) {
+        return AutoDiff.TermBuilder.Log(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Exponential) {
+        return AutoDiff.TermBuilder.Exp(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Square) {
+        return AutoDiff.TermBuilder.Power(
+          ConvertToAutoDiff(node.GetSubtree(0)), 2.0);
+      }
+      if (node.Symbol is SquareRoot) {
+        return AutoDiff.TermBuilder.Power(
+          ConvertToAutoDiff(node.GetSubtree(0)), 0.5);
+      }
+      if (node.Symbol is Cube) {
+        return AutoDiff.TermBuilder.Power(
+          ConvertToAutoDiff(node.GetSubtree(0)), 3.0);
+      }
+      if (node.Symbol is CubeRoot) {
+        return cbrt(ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Sine) {
+        return sin(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Cosine) {
+        return cos(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Tangent) {
+        return tan(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is HyperbolicTangent) {
+        return tanh(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Erf) {
+        return erf(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is Norm) {
+        return norm(
+          ConvertToAutoDiff(node.GetSubtree(0)));
+      }
+      if (node.Symbol is StartSymbol) {
+        if (addLinearScalingTerms) {
+          // scaling variables α, β are given at the beginning of the parameter vector
+          var alpha = new AutoDiff.Variable();
+          var beta = new AutoDiff.Variable();
+          variables.Add(beta);
+          variables.Add(alpha);
+          var t = ConvertToAutoDiff(node.GetSubtree(0));
+          return t * alpha + beta;
+        } else return ConvertToAutoDiff(node.GetSubtree(0));
+      }
+      throw new ConversionException();
+    }
+
+
+    // for each factor variable value we need a parameter which represents a binary indicator for that variable & value combination
+    // each binary indicator is only necessary once. So we only create a parameter if this combination is not yet available
+    private static Term FindOrCreateParameter(Dictionary<DataForVariable, AutoDiff.Variable> parameters,
+      string varName, string varValue = "", int lag = 0) {
+      var data = new DataForVariable(varName, varValue, lag);
+
+      AutoDiff.Variable par = null;
+      if (!parameters.TryGetValue(data, out par)) {
+        // not found -> create new parameter and entries in names and values lists
+        par = new AutoDiff.Variable();
+        parameters.Add(data, par);
+      }
+      return par;
+    }
+
+    public static bool IsCompatible(ISymbolicExpressionTree tree) {
+      var containsUnknownSymbol = (
+        from n in tree.Root.GetSubtree(0).IterateNodesPrefix()
+        where
+          !(n.Symbol is Variable) &&
+          !(n.Symbol is BinaryFactorVariable) &&
+          !(n.Symbol is FactorVariable) &&
+          !(n.Symbol is LaggedVariable) &&
+          !(n.Symbol is Constant) &&
+          !(n.Symbol is Addition) &&
+          !(n.Symbol is Subtraction) &&
+          !(n.Symbol is Multiplication) &&
+          !(n.Symbol is Division) &&
+          !(n.Symbol is Logarithm) &&
+          !(n.Symbol is Exponential) &&
+          !(n.Symbol is SquareRoot) &&
+          !(n.Symbol is Square) &&
+          !(n.Symbol is Sine) &&
+          !(n.Symbol is Cosine) &&
+          !(n.Symbol is Tangent) &&
+          !(n.Symbol is HyperbolicTangent) &&
+          !(n.Symbol is Erf) &&
+          !(n.Symbol is Norm) &&
+          !(n.Symbol is StartSymbol) &&
+          !(n.Symbol is Absolute) &&
+          !(n.Symbol is AnalyticQuotient) &&
+          !(n.Symbol is Cube) &&
+          !(n.Symbol is CubeRoot)
+        select n).Any();
+      return !containsUnknownSymbol;
+    }
+    #region exception class
+    [Serializable]
+    public class ConversionException : Exception {
+
+      public ConversionException() {
+      }
+
+      public ConversionException(string message) : base(message) {
+      }
+
+      public ConversionException(string message, Exception inner) : base(message, inner) {
+      }
+
+      protected ConversionException(
+        SerializationInfo info,
+        StreamingContext context) : base(info, context) {
+      }
+    }
+    #endregion
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/MultiSymbolicDataAnalysisExpressionCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/MultiSymbolicDataAnalysisExpressionCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/MultiSymbolicDataAnalysisExpressionCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,8 +31,9 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Creators {
+  [StorableType("8E932C08-6D00-4055-9525-DBF28420DAB0")]
   public class MultiSymbolicDataAnalysisExpressionCreator : StochasticMultiBranch<ISymbolicDataAnalysisSolutionCreator>,
     ISymbolicDataAnalysisSolutionCreator,
@@ -71,5 +72,5 @@
 
     [StorableConstructor]
-    protected MultiSymbolicDataAnalysisExpressionCreator(bool deserializing) : base(deserializing) { }
+    protected MultiSymbolicDataAnalysisExpressionCreator(StorableConstructorFlag _) : base(_) { }
     protected MultiSymbolicDataAnalysisExpressionCreator(MultiSymbolicDataAnalysisExpressionCreator original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new MultiSymbolicDataAnalysisExpressionCreator(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionBalancedTreeCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionBalancedTreeCreator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionBalancedTreeCreator.cs	(revision 17687)
@@ -0,0 +1,38 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("BalancedTreeCreator", "An operator that creates new symbolic expression trees using the 'Balanced' method")]
+  [StorableType("E268BE19-BBEB-46EF-9632-1799A43D01F9")]
+  public class SymbolicDataAnalysisExpressionBalancedTreeCreator : BalancedTreeCreator, ISymbolicDataAnalysisSolutionCreator {
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionBalancedTreeCreator(StorableConstructorFlag _) : base(_) { }
+    protected SymbolicDataAnalysisExpressionBalancedTreeCreator(SymbolicDataAnalysisExpressionBalancedTreeCreator original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionBalancedTreeCreator(this, cloner); }
+
+    public SymbolicDataAnalysisExpressionBalancedTreeCreator() : base() { }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionFullTreeCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionFullTreeCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionFullTreeCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,17 +20,15 @@
 #endregion
 
-using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("71F54D2D-F409-4B56-9C67-43715ABD58FA")]
   [Item("FullTreeCreator", "An operator that creates new symbolic expression trees using the 'Full' method")]
   public class SymbolicDataAnalysisExpressionFullTreeCreator : FullTreeCreator, ISymbolicDataAnalysisSolutionCreator {
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionFullTreeCreator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionFullTreeCreator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisExpressionFullTreeCreator(SymbolicDataAnalysisExpressionFullTreeCreator original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionFullTreeCreator(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionGrowTreeCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionGrowTreeCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionGrowTreeCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,14 +23,12 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
-using System;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("161E4580-A31A-4DD5-926E-38B22E82D65F")]
   [Item("GrowTreeCreator", "An operator that creates new symbolic expression trees using the 'Grow' method")]
   public class SymbolicDataAnalysisExpressionGrowTreeCreator : GrowTreeCreator, ISymbolicDataAnalysisSolutionCreator {
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionGrowTreeCreator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionGrowTreeCreator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisExpressionGrowTreeCreator(SymbolicDataAnalysisExpressionGrowTreeCreator original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionGrowTreeCreator(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,14 +23,12 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
-using System;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("B23F1763-F849-425A-B5E5-B71D95206FA0")]
   [Item("RampedHalfAndHalfTreeCreator", "An operator that creates new symbolic expression trees in an alternate way: half the trees are created usign the 'Grow' method while the other half are created using the 'Full' method")]
   public class SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator : RampedHalfAndHalfTreeCreator, ISymbolicDataAnalysisSolutionCreator {
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator(SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionTreeCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionTreeCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Creators/SymbolicDataAnalysisExpressionTreeCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,12 +23,12 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("1BE06FE4-1D7B-478E-961B-7D9424366658")]
   [Item("ProbabilisticTreeCreator", "An operator that creates new symbolic expression trees with uniformly distributed length")]
   public class SymbolicDataAnalysisExpressionTreeCreator : ProbabilisticTreeCreator, ISymbolicDataAnalysisSolutionCreator {
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionTreeCreator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionTreeCreator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisExpressionTreeCreator(SymbolicDataAnalysisExpressionTreeCreator original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionTreeCreator(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -30,13 +30,14 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [Item("MultiSymbolicDataAnalysisExpressionCrossover", "Randomly selects and applies one of its crossovers every time it is called.")]
+  [StorableType("AD80D64F-64E6-42F7-B1D3-AFDE6AF96EC4")]
   public class MultiSymbolicDataAnalysisExpressionCrossover<T> : StochasticMultiBranch<ISymbolicExpressionTreeCrossover>,
     ISymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
     private const string ParentsParameterName = "Parents";
-    private const string ChildParameterName = "Child";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
     private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
@@ -62,6 +63,6 @@
       get { return (ScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[ParentsParameterName]; }
     }
-    public ILookupParameter<ISymbolicExpressionTree> ChildParameter {
-      get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[ChildParameterName]; }
+    public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
     }
     public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
@@ -86,5 +87,5 @@
 
     [StorableConstructor]
-    protected MultiSymbolicDataAnalysisExpressionCrossover(bool deserializing) : base(deserializing) { }
+    protected MultiSymbolicDataAnalysisExpressionCrossover(StorableConstructorFlag _) : base(_) { }
     protected MultiSymbolicDataAnalysisExpressionCrossover(MultiSymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new MultiSymbolicDataAnalysisExpressionCrossover<T>(this, cloner); }
@@ -99,5 +100,5 @@
       Parameters.Add(new ValueLookupParameter<IntRange>(SymbolicDataAnalysisEvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated."));
       Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed."));
-      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover."));
+      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The child symbolic expression tree resulting from the crossover."));
 
       EvaluatorParameter.Hidden = true;
@@ -111,4 +112,13 @@
 
       SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      if (!Parameters.ContainsKey(SymbolicExpressionTreeParameterName))
+        Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied."));
+      #endregion
     }
 
@@ -155,5 +165,5 @@
     private void ParameterizeCrossovers() {
       foreach (ISymbolicExpressionTreeCrossover op in Operators) {
-        op.ChildParameter.ActualName = ChildParameter.Name;
+        op.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
         op.ParentsParameter.ActualName = ParentsParameter.Name;
       }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,6 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -33,7 +34,8 @@
                                  "- Randomly choose a node N from P1\n" +
                                  "- Test all crossover points from P0 to determine the best location for N to be inserted")]
+  [StorableType("D4D1995A-6C51-4B41-AE08-43029AC9CF72")]
   public sealed class SymbolicDataAnalysisExpressionContextAwareCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionContextAwareCrossover(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionContextAwareCrossover(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionContextAwareCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner)
       : base(original, cloner) {
@@ -68,5 +70,6 @@
           possibleChildren.Add(n);
       });
-      var selectedChild = possibleChildren.SelectRandom(random);
+
+      var selectedChild = possibleChildren.SampleRandom(random);
       var crossoverPoints = new List<CutPoint>();
       var qualities = new List<Tuple<CutPoint, double>>();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -28,8 +28,9 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("B53649DF-A760-4087-A496-BFD3F13DA31C")]
   public abstract class SymbolicDataAnalysisExpressionCrossover<T> : SymbolicExpressionTreeCrossover, ISymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
     private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
@@ -75,5 +76,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionCrossover(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionCrossover(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisExpressionCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -28,5 +28,6 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -35,6 +36,8 @@
                                      "- Standard (mid 50% of the tree)\n" +
                                      "- LowLevel (lower 25% of the tree)")]
+  [StorableType("E48D1FEB-8D3F-4394-9AD4-7C4A24116FD4")]
   public sealed class SymbolicDataAnalysisExpressionDepthConstrainedCrossover<T> :
     SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
+    [StorableType("24941bf7-da85-44e9-9e01-44c285ac41c3")]
     private enum Ranges { HighLevel, Standard, LowLevel };
     private const string DepthRangeParameterName = "DepthRange";
@@ -53,5 +56,5 @@
 
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionDepthConstrainedCrossover(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionDepthConstrainedCrossover(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionDepthConstrainedCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner)
       : base(original, cloner) { }
@@ -115,6 +118,5 @@
         throw new Exception("No crossover points available in the first parent");
 
-      var crossoverPoint0 = crossoverPoints0.SelectRandom(random);
-
+      var crossoverPoint0 = crossoverPoints0.SampleRandom(random);
       int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
       int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
@@ -126,5 +128,6 @@
                              select s).ToList();
       if (allowedBranches.Count == 0) return parent0;
-      var selectedBranch = allowedBranches.SelectRandom(random);
+
+      var selectedBranch = allowedBranches.SampleRandom(random);
       Swap(crossoverPoint0, selectedBranch);
       return parent0;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,6 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -33,7 +34,8 @@
                                       "- Randomly choose a crossover point C from P0\n" +
                                       "- Test all nodes from P1 to determine the one that produces the best child when inserted at place C in P0")]
+  [StorableType("BC019C69-AA9D-4E98-B366-274EFD7922C4")]
   public sealed class SymbolicDataAnalysisExpressionDeterministicBestCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionDeterministicBestCrossover(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionDeterministicBestCrossover(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionDeterministicBestCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner)
       : base(original, cloner) {
@@ -67,5 +69,6 @@
           crossoverPoints0.Add(new CutPoint(n.Parent, n));
       });
-      CutPoint crossoverPoint0 = crossoverPoints0.SelectRandom(random);
+
+      CutPoint crossoverPoint0 = crossoverPoints0.SampleRandom(random);
       int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
       int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs	(revision 17687)
@@ -0,0 +1,180 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Random;
+using static HeuristicLab.Problems.DataAnalysis.Symbolic.SymbolicExpressionHashExtensions;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("DiversityCrossover", "Simple crossover operator preventing swap between subtrees with the same hash value.")]
+  [StorableType("ED35B0D9-9704-4D32-B10B-8F9870E76781")]
+  public sealed class SymbolicDataAnalysisExpressionDiversityPreservingCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
+
+    private const string InternalCrossoverPointProbabilityParameterName = "InternalCrossoverPointProbability";
+    private const string WindowingParameterName = "Windowing";
+    private const string ProportionalSamplingParameterName = "ProportionalSampling";
+    private const string StrictHashingParameterName = "StrictHashing";
+
+    private static readonly Func<byte[], ulong> hashFunction = HashUtil.DJBHash;
+
+    #region Parameter Properties
+    public IValueLookupParameter<PercentValue> InternalCrossoverPointProbabilityParameter {
+      get { return (IValueLookupParameter<PercentValue>)Parameters[InternalCrossoverPointProbabilityParameterName]; }
+    }
+
+    public IValueLookupParameter<BoolValue> WindowingParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters[WindowingParameterName]; }
+    }
+
+    public IValueLookupParameter<BoolValue> ProportionalSamplingParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters[ProportionalSamplingParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> StrictHashingParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[StrictHashingParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public PercentValue InternalCrossoverPointProbability {
+      get { return InternalCrossoverPointProbabilityParameter.ActualValue; }
+    }
+
+    public BoolValue Windowing {
+      get { return WindowingParameter.ActualValue; }
+    }
+
+    public BoolValue ProportionalSampling {
+      get { return ProportionalSamplingParameter.ActualValue; }
+    }
+
+    bool StrictHashing {
+      get { return StrictHashingParameter.Value.Value; }
+    }
+    #endregion
+
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(StrictHashingParameterName)) {
+        Parameters.Add(new FixedValueParameter<BoolValue>(StrictHashingParameterName, "Use strict hashing when calculating subtree hash values."));
+      }
+    }
+
+    public SymbolicDataAnalysisExpressionDiversityPreservingCrossover() : base() {
+      Parameters.Add(new ValueLookupParameter<PercentValue>(InternalCrossoverPointProbabilityParameterName, "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9)));
+      Parameters.Add(new ValueLookupParameter<BoolValue>(WindowingParameterName, "Use proportional sampling with windowing for cutpoint selection.", new BoolValue(false)));
+      Parameters.Add(new ValueLookupParameter<BoolValue>(ProportionalSamplingParameterName, "Select cutpoints proportionally using probabilities as weights instead of randomly.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(StrictHashingParameterName, "Use strict hashing when calculating subtree hash values."));
+    }
+
+    private SymbolicDataAnalysisExpressionDiversityPreservingCrossover(SymbolicDataAnalysisExpressionDiversityPreservingCrossover<T> original, Cloner cloner) : base(original, cloner) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionDiversityPreservingCrossover<T>(this, cloner);
+    }
+
+    [StorableConstructor]
+    private SymbolicDataAnalysisExpressionDiversityPreservingCrossover(StorableConstructorFlag _) : base(_) { }
+
+    private static ISymbolicExpressionTreeNode ActualRoot(ISymbolicExpressionTree tree) {
+      return tree.Root.GetSubtree(0).GetSubtree(0);
+    }
+
+    public static ISymbolicExpressionTree Cross(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1, double internalCrossoverPointProbability, int maxLength, int maxDepth, bool windowing, bool proportionalSampling = false, bool strictHashing = false) {
+      var nodes0 = ActualRoot(parent0).MakeNodes(strictHashing).Sort(hashFunction);
+      var nodes1 = ActualRoot(parent1).MakeNodes(strictHashing).Sort(hashFunction);
+
+      IList<HashNode<ISymbolicExpressionTreeNode>> sampled0;
+      IList<HashNode<ISymbolicExpressionTreeNode>> sampled1;
+
+      if (proportionalSampling) {
+        var p = internalCrossoverPointProbability;
+        var weights0 = nodes0.Select(x => x.IsLeaf ? 1 - p : p);
+        sampled0 = nodes0.SampleProportionalWithoutRepetition(random, nodes0.Length, weights0, windowing: windowing).ToArray();
+
+        var weights1 = nodes1.Select(x => x.IsLeaf ? 1 - p : p);
+        sampled1 = nodes1.SampleProportionalWithoutRepetition(random, nodes1.Length, weights1, windowing: windowing).ToArray();
+      } else {
+        sampled0 = ChooseNodes(random, nodes0, internalCrossoverPointProbability).ShuffleInPlace(random);
+        sampled1 = ChooseNodes(random, nodes1, internalCrossoverPointProbability).ShuffleInPlace(random);
+      }
+
+      foreach (var selected in sampled0) {
+        var cutpoint = new CutPoint(selected.Data.Parent, selected.Data);
+
+        var maxAllowedDepth = maxDepth - parent0.Root.GetBranchLevel(selected.Data);
+        var maxAllowedLength = maxLength - (parent0.Length - selected.Data.GetLength());
+
+        foreach (var candidate in sampled1) {
+          if (candidate.CalculatedHashValue == selected.CalculatedHashValue
+            || candidate.Data.GetDepth() > maxAllowedDepth
+            || candidate.Data.GetLength() > maxAllowedLength
+            || !cutpoint.IsMatchingPointType(candidate.Data)) {
+            continue;
+          }
+
+          Swap(cutpoint, candidate.Data);
+          return parent0;
+        }
+      }
+      return parent0;
+    }
+
+    public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
+      if (this.ExecutionContext == null) {
+        throw new InvalidOperationException("ExecutionContext not set.");
+      }
+
+      var maxDepth = MaximumSymbolicExpressionTreeDepth.Value;
+      var maxLength = MaximumSymbolicExpressionTreeLength.Value;
+
+      var internalCrossoverPointProbability = InternalCrossoverPointProbability.Value;
+      var windowing = Windowing.Value;
+      var proportionalSampling = ProportionalSampling.Value;
+
+      return Cross(random, parent0, parent1, internalCrossoverPointProbability, maxLength, maxDepth, windowing, proportionalSampling, StrictHashing);
+    }
+
+    private static List<HashNode<ISymbolicExpressionTreeNode>> ChooseNodes(IRandom random, IEnumerable<HashNode<ISymbolicExpressionTreeNode>> nodes, double internalCrossoverPointProbability) {
+      var list = new List<HashNode<ISymbolicExpressionTreeNode>>();
+
+      var chooseInternal = random.NextDouble() < internalCrossoverPointProbability;
+
+      if (chooseInternal) {
+        list.AddRange(nodes.Where(x => !x.IsLeaf && x.Data.Parent != null));
+      }
+      if (!chooseInternal || list.Count == 0) {
+        list.AddRange(nodes.Where(x => x.IsLeaf && x.Data.Parent != null));
+      }
+
+      return list;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,5 +26,6 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -35,7 +36,8 @@
                                             "\t\tD(N,M) = 0.5 * ( abs(max(N) - max(M)) + abs(min(N) - min(M)) )\n" +
                                             "- Make a probabilistic weighted choice of node M from P1, based on the inversed and normalized behavioral distance")]
+  [StorableType("EC1901B8-689B-4FC9-A79E-2778B3D0609E")]
   public sealed class SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner)
       : base(original, cloner) { }
@@ -69,5 +71,6 @@
         }
       });
-      var crossoverPoint0 = crossoverPoints0.SelectRandom(random);
+
+      var crossoverPoint0 = crossoverPoints0.SampleRandom(random);
       int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
       int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
@@ -137,5 +140,7 @@
           weights[i] /= sum;
 
+#pragma warning disable 612, 618
         selectedBranch = allowedBranches.SelectRandom(weights, random);
+#pragma warning restore 612, 618
       }
       Swap(crossoverPoint0, selectedBranch);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,5 +27,6 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
+using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -36,4 +37,5 @@
                                        "- Find the first node M that satisfies the semantic similarity criteria\n" +
                                        "- Swap N for M and return P0")]
+  [StorableType("8AB40F60-5664-42AB-9DD9-78707476C1B2")]
   public sealed class SymbolicDataAnalysisExpressionSemanticSimilarityCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
     private const string SemanticSimilarityRangeParameterName = "SemanticSimilarityRange";
@@ -52,5 +54,5 @@
 
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionSemanticSimilarityCrossover(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionSemanticSimilarityCrossover(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionSemanticSimilarityCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisExpressionSemanticSimilarityCrossover()
@@ -81,5 +83,6 @@
           crossoverPoints0.Add(new CutPoint(n.Parent, n));
       });
-      var crossoverPoint0 = crossoverPoints0.SelectRandom(random);
+
+      var crossoverPoint0 = crossoverPoints0.SampleRandom(random);
       int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
       int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
Index: anches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSizefairCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSizefairCrossover.cs	(revision 17686)
+++ 	(revision )
@@ -1,46 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Crossovers {
-  [Item("SizeFairCrossover", "An operator which performs subtree swapping crossover.")]
-  class SymbolicDataAnalysisExpressionSizefairCrossover<T> : SubtreeCrossover, ISymbolicDataAnalysisExpressionCrossover<T> {
-    [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionSizefairCrossover(bool deserializing) : base(deserializing) { }
-    protected SymbolicDataAnalysisExpressionSizefairCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { }
-    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionSizefairCrossover<T>(this, cloner); }
-
-    public override bool CanChangeName {
-      get { return true; }
-    }
-
-    public SymbolicDataAnalysisExpressionSizefairCrossover()
-      : base() {
-      SymbolicDataAnalysisEvaluationPartitionParameter.Hidden = true;
-      Name = "SizeFairCrossover";
-    }
-  }
-}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -30,9 +30,9 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("61CB69D9-959B-4759-94EB-A969A519DDBB")]
   public abstract class SymbolicDataAnalysisEvaluator<T> : InstrumentedOperator,
     ISymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, IStochasticOperator
@@ -87,5 +87,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisEvaluator(SymbolicDataAnalysisEvaluator<T> original, Cloner cloner)
       : base(original, cloner) {
@@ -93,13 +93,13 @@
     public SymbolicDataAnalysisEvaluator()
       : base() {
-      Parameters.Add(new ValueLookupParameter<IRandom>(RandomParameterName, "The random generator to use."));
-      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
-      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic data analysis solution encoded as a symbolic expression tree."));
-      Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
-      Parameters.Add(new ValueLookupParameter<IntRange>(EvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated."));
-      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees."));
-      Parameters.Add(new ValueLookupParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index."));
-      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating."));
-      Parameters.Add(new ValueLookupParameter<StringValue>(ValidRowIndicatorParameterName, "An indicator variable in the data set that specifies which rows should be evaluated (those for which the indicator <> 0) (optional)."));
+      Parameters.Add(new ValueLookupParameter<IRandom>(RandomParameterName, "The random generator to use.") { Hidden = true });
+      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree.") { Hidden = true });
+      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic data analysis solution encoded as a symbolic expression tree.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<IntRange>(EvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The upper and lower limit that should be used as cut off value for the output values of symbolic data analysis trees.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index.") { Hidden = true });
+      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the individual should be linearly scaled before evaluating.") { Hidden = true });
+      Parameters.Add(new ValueLookupParameter<StringValue>(ValidRowIndicatorParameterName, "An indicator variable in the data set that specifies which rows should be evaluated (those for which the indicator <> 0) (optional).") { Hidden = true });
     }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisMultiObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisMultiObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisMultiObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,9 +24,10 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("52726BA1-6041-4D61-9266-3EB128A04057")]
   public abstract class SymbolicDataAnalysisMultiObjectiveEvaluator<T> : SymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisMultiObjectiveEvaluator<T>
    where T : class, IDataAnalysisProblemData {
@@ -39,5 +40,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisMultiObjectiveEvaluator(SymbolicDataAnalysisMultiObjectiveEvaluator<T> original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisSingleObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisSingleObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisSingleObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,15 +20,14 @@
 #endregion
 
-using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using System.Collections.Generic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("0547D067-792A-462C-90B9-BE09E91CE255")]
   public abstract class SymbolicDataAnalysisSingleObjectiveEvaluator<T> : SymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisSingleObjectiveEvaluator<T>
    where T : class, IDataAnalysisProblemData {
@@ -43,5 +42,5 @@
     #endregion
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveEvaluator(SymbolicDataAnalysisSingleObjectiveEvaluator<T> original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs	(revision 17687)
@@ -0,0 +1,268 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+using System.Linq;
+using System.Text;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class BaseInfixExpressionFormatter {
+    public static void FormatRecursively(ISymbolicExpressionTreeNode node, StringBuilder strBuilder,
+                                          NumberFormatInfo numberFormat, string formatString, List<KeyValuePair<string, double>> constants = null) {
+      if (node.SubtreeCount > 1) {
+        var token = GetToken(node.Symbol);
+        // operators
+        if (token == "+" || token == "-" || token == "OR" || token == "XOR" ||
+            token == "*" || token == "/" || token == "AND" ||
+            token == "^") {
+          strBuilder.Append("(");
+          FormatRecursively(node.Subtrees.First(), strBuilder, numberFormat, formatString, constants);
+
+          foreach (var subtree in node.Subtrees.Skip(1)) {
+            strBuilder.Append(" ").Append(token).Append(" ");
+            FormatRecursively(subtree, strBuilder, numberFormat, formatString, constants);
+          }
+
+          strBuilder.Append(")");
+        } else {
+          // function with multiple arguments
+          strBuilder.Append(token).Append("(");
+          FormatRecursively(node.Subtrees.First(), strBuilder, numberFormat, formatString, constants);
+          foreach (var subtree in node.Subtrees.Skip(1)) {
+            strBuilder.Append(", ");
+            FormatRecursively(subtree, strBuilder, numberFormat, formatString, constants);
+          }
+
+          strBuilder.Append(")");
+        }
+      } else if (node.SubtreeCount == 1) {
+        var token = GetToken(node.Symbol);
+        if (token == "-" || token == "NOT") {
+          strBuilder.Append("(").Append(token).Append("(");
+          FormatRecursively(node.GetSubtree(0), strBuilder, numberFormat, formatString, constants);
+          strBuilder.Append("))");
+        } else if (token == "/") {
+          strBuilder.Append("1/");
+          FormatRecursively(node.GetSubtree(0), strBuilder, numberFormat, formatString, constants);
+        } else if (token == "+" || token == "*") {
+          FormatRecursively(node.GetSubtree(0), strBuilder, numberFormat, formatString, constants);
+        } else {
+          // function with only one argument
+          strBuilder.Append(token).Append("(");
+          FormatRecursively(node.GetSubtree(0), strBuilder, numberFormat, formatString, constants);
+          strBuilder.Append(")");
+        }
+      } else {
+        // no subtrees
+        if (node.Symbol is LaggedVariable) {
+          var varNode = node as LaggedVariableTreeNode;
+          if (!varNode.Weight.IsAlmost(1.0)) {
+            strBuilder.Append("(");
+            if (constants != null) {
+              strBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}", varNode.Weight);
+            } else {
+              strBuilder.Append(varNode.Weight.ToString(formatString, numberFormat));
+            }
+            strBuilder.Append("*");
+          }
+
+          strBuilder.Append("LAG(");
+          if (varNode.VariableName.Contains("'"))
+            strBuilder.AppendFormat("\"{0}\"", varNode.VariableName);
+          else
+            strBuilder.AppendFormat("'{0}'", varNode.VariableName);
+
+          strBuilder.Append(", ")
+                    .AppendFormat(numberFormat, "{0}", varNode.Lag)
+                    .Append(")");
+        } else if (node.Symbol is Variable) {
+          var varNode = node as VariableTreeNode;
+          if (!varNode.Weight.IsAlmost(1.0)) {
+            strBuilder.Append("(");
+            if (constants != null) {
+              string constantKey = $"c_{constants.Count}";
+              strBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}", constantKey);
+              constants.Add(new KeyValuePair<string, double>(constantKey, varNode.Weight));
+            } else {
+              strBuilder.Append(varNode.Weight.ToString(formatString, numberFormat));
+            }
+
+            strBuilder.Append("*");
+          }
+
+          if (varNode.VariableName.Contains("'"))
+            strBuilder.AppendFormat("\"{0}\"", varNode.VariableName);
+          else
+            strBuilder.AppendFormat("'{0}'", varNode.VariableName);
+
+          if (!varNode.Weight.IsAlmost(1.0)) strBuilder.Append(")");
+        } else if (node.Symbol is FactorVariable) {
+          var factorNode = node as FactorVariableTreeNode;
+          if (factorNode.VariableName.Contains("'"))
+            strBuilder.AppendFormat("\"{0}\"", factorNode.VariableName);
+          else
+            strBuilder.AppendFormat("'{0}'", factorNode.VariableName);
+
+          strBuilder.AppendFormat("[{0}]",
+            string.Join(", ", factorNode.Weights.Select(w => w.ToString(formatString, numberFormat))));
+        } else if (node.Symbol is BinaryFactorVariable) {
+          var factorNode = node as BinaryFactorVariableTreeNode;
+          if (!factorNode.Weight.IsAlmost(1.0)) {
+            strBuilder.Append("(");
+            if (constants != null) {
+              strBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}", factorNode.Weight);
+            } else {
+              strBuilder.Append(factorNode.Weight.ToString(formatString, numberFormat));
+            }
+
+            strBuilder.Append("*");
+          }
+
+          if (factorNode.VariableName.Contains("'"))
+            strBuilder.AppendFormat("\"{0}\"", factorNode.VariableName);
+          else
+            strBuilder.AppendFormat("'{0}'", factorNode.VariableName);
+
+          strBuilder.Append(" = ");
+          if (factorNode.VariableValue.Contains("'"))
+            strBuilder.AppendFormat("\"{0}\"", factorNode.VariableValue);
+          else
+            strBuilder.AppendFormat("'{0}'", factorNode.VariableValue);
+
+          if (!factorNode.Weight.IsAlmost(1.0)) strBuilder.Append(")");
+        } else if (node.Symbol is Constant) {
+          var constNode = node as ConstantTreeNode;
+          if (constants != null) {
+            string constantKey = $"c_{constants.Count}";
+
+            strBuilder.AppendFormat(CultureInfo.InvariantCulture, constantKey);
+            constants.Add(new KeyValuePair<string, double>(constantKey, constNode.Value));
+          } else {
+            if (constNode.Value >= 0.0)
+              strBuilder.Append(constNode.Value.ToString(formatString, numberFormat));
+            else
+              strBuilder.Append("(").Append(constNode.Value.ToString(formatString, numberFormat))
+                        .Append(")"); // (-1
+          }
+        }
+      }
+    }
+
+    private static string GetToken(ISymbol symbol) {
+      var tok = InfixExpressionParser.knownSymbols.GetBySecond(symbol).FirstOrDefault();
+      if (tok == null)
+        throw new ArgumentException(string.Format("Unknown symbol {0} found.", symbol.Name));
+      return tok;
+    }
+  }
+
+  /// <summary>
+  /// Formats mathematical expressions in infix form. E.g. x1 * (3.0 * x2 + x3)
+  /// </summary>
+  [StorableType("6FE2C83D-A594-4ABF-B101-5AEAEA6D3E3D")]
+  [Item("Infix Symbolic Expression Tree Formatter",
+    "A string formatter that converts symbolic expression trees to infix expressions.")]
+  public sealed class InfixExpressionFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [StorableConstructor]
+    private InfixExpressionFormatter(StorableConstructorFlag _) : base(_) { }
+
+    private InfixExpressionFormatter(InfixExpressionFormatter original, Cloner cloner) : base(original, cloner) { }
+
+    public InfixExpressionFormatter()
+      : base() {
+      Name = ItemName;
+      Description = ItemDescription;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new InfixExpressionFormatter(this, cloner);
+    }
+
+    /// <summary>
+    /// Produces an infix expression for a given expression tree.
+    /// </summary>
+    /// <param name="symbolicExpressionTree">The tree representation of the expression.</param>
+    /// <param name="numberFormat">Number format that should be used for numeric parameters (e.g. NumberFormatInfo.InvariantInfo (default)).</param>
+    /// <param name="formatString">The format string for numeric parameters (e.g. \"G4\" to limit to 4 digits, default is \"G\")</param>
+    /// <returns>Infix expression</returns>
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree, NumberFormatInfo numberFormat,
+                         string formatString = "G") {
+      // skip root and start symbols
+      StringBuilder strBuilder = new StringBuilder();
+      BaseInfixExpressionFormatter.FormatRecursively(symbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0),
+        strBuilder, numberFormat, formatString);
+      return strBuilder.ToString();
+    }
+
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      return Format(symbolicExpressionTree, NumberFormatInfo.InvariantInfo);
+    }
+  }
+
+  [StorableType("54D917E8-134E-4066-9A60-2737C12D81DC")]
+  [Item("Infix String Formater", "Formatter for symbolic expressions, which produces an infix expression " +
+                                 "as well as a list of all coefficient values")]
+  public sealed class InfixExpressionStringFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [StorableConstructor]
+    private InfixExpressionStringFormatter(StorableConstructorFlag _) : base(_) { }
+
+    private InfixExpressionStringFormatter(InfixExpressionStringFormatter original, Cloner cloner) : base(original, cloner) { }
+
+    public InfixExpressionStringFormatter() : base() {
+      Name = ItemName;
+      Description = ItemDescription;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new InfixExpressionStringFormatter(this, cloner);
+    }
+
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      StringBuilder strBuilder = new StringBuilder();
+      var constants = new List<KeyValuePair<string, double>>();
+      BaseInfixExpressionFormatter.FormatRecursively(symbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0),
+        strBuilder, NumberFormatInfo.InvariantInfo, "G", constants);
+      strBuilder.Append($"{Environment.NewLine}{Environment.NewLine}");
+
+      int maxDigits = GetDigits(constants.Count);
+      int padding = constants.Max(x => x.Value.ToString("F12", CultureInfo.InvariantCulture).Length);
+      foreach (var constant in constants) {
+        int digits = GetDigits(Int32.Parse(constant.Key.Substring(2)));
+        strBuilder.Append($"{constant.Key}{new String(' ', maxDigits - digits)} = " +
+                          string.Format($"{{0,{padding}:F12}}", constant.Value, CultureInfo.InvariantCulture) +
+                          Environment.NewLine);
+      }
+
+      return strBuilder.ToString();
+    }
+
+    private int GetDigits(int x) {
+      if (x == 0) return 1;
+      return (int)Math.Floor(Math.Log10(x) + 1);
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs	(revision 17687)
@@ -0,0 +1,327 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("C# Symbolic Expression Tree Formatter", "A string formatter that converts symbolic expression trees to C# code.")]
+  [StorableType("88298836-6087-405A-9354-D4E6864887EB")]
+  public sealed class CSharpSymbolicExpressionTreeStringFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [StorableConstructor]
+    private CSharpSymbolicExpressionTreeStringFormatter(StorableConstructorFlag _) : base(_) { }
+    private CSharpSymbolicExpressionTreeStringFormatter(CSharpSymbolicExpressionTreeStringFormatter original, Cloner cloner) : base(original, cloner) { }
+    public CSharpSymbolicExpressionTreeStringFormatter()
+      : base() {
+      Name = ItemName;
+      Description = ItemDescription;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CSharpSymbolicExpressionTreeStringFormatter(this, cloner);
+    }
+
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      // skip root and start symbols
+      StringBuilder strBuilder = new StringBuilder();
+      GenerateHeader(strBuilder, symbolicExpressionTree);
+      FormatRecursively(symbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0), strBuilder);
+      GenerateFooter(strBuilder);
+      return strBuilder.ToString();
+    }
+
+    private string VariableName2Identifier(string name) {
+      /*
+       * identifier-start-character:
+       *    letter-character
+       *    _ (the underscore character U+005F)
+       *  identifier-part-characters:
+       *    identifier-part-character
+       *    identifier-part-characters   identifier-part-character
+       *  identifier-part-character:
+       *    letter-character
+       *    decimal-digit-character
+       *    connecting-character
+       *    combining-character
+       *    formatting-character
+       *  letter-character:
+       *    A Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl 
+       *    A unicode-escape-sequence representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl
+       *  combining-character:
+       *    A Unicode character of classes Mn or Mc 
+       *    A unicode-escape-sequence representing a character of classes Mn or Mc
+       *  decimal-digit-character:
+       *    A Unicode character of the class Nd 
+       *    A unicode-escape-sequence representing a character of the class Nd
+       *  connecting-character:
+       *    A Unicode character of the class Pc 
+       *    A unicode-escape-sequence representing a character of the class Pc
+       *  formatting-character:
+       *    A Unicode character of the class Cf 
+       *    A unicode-escape-sequence representing a character of the class Cf
+       */
+
+      var invalidIdentifierStarts = new Regex(@"[^_\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}]");
+      var invalidIdentifierParts = new Regex(@"[^\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\p{Cf}]");
+      return "@" +
+        (invalidIdentifierStarts.IsMatch(name.Substring(0, 1)) ? "_" : "") + // prepend '_' if necessary
+        invalidIdentifierParts.Replace(name, "_");
+    }
+
+    private void FormatRecursively(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      // TODO: adapt to interpreter semantics. The HL interpreter also allows Boolean operations on reals
+      if (node.Subtrees.Any()) {
+        if (node.Symbol is Addition) {
+          FormatOperator(node, "+", strBuilder);
+        } else if (node.Symbol is And) {
+          FormatOperator(node, "&&", strBuilder);
+        } else if (node.Symbol is Average) {
+          FormatFunction(node, "Average", strBuilder);
+        } else if (node.Symbol is Cosine) {
+          FormatFunction(node, "Math.Cos", strBuilder);
+        } else if (node.Symbol is Division) {
+          FormatDivision(node, strBuilder);
+        } else if (node.Symbol is Exponential) {
+          FormatFunction(node, "Math.Exp", strBuilder);
+        } else if (node.Symbol is GreaterThan) {
+          FormatOperator(node, ">", strBuilder);
+        } else if (node.Symbol is IfThenElse) {
+          FormatFunction(node, "EvaluateIf", strBuilder);
+        } else if (node.Symbol is LessThan) {
+          FormatOperator(node, "<", strBuilder);
+        } else if (node.Symbol is Logarithm) {
+          FormatFunction(node, "Math.Log", strBuilder);
+        } else if (node.Symbol is Multiplication) {
+          FormatOperator(node, "*", strBuilder);
+        } else if (node.Symbol is Not) {
+          FormatOperator(node, "!", strBuilder);
+        } else if (node.Symbol is Or) {
+          FormatOperator(node, "||", strBuilder);
+        } else if (node.Symbol is Xor) {
+          FormatOperator(node, "^", strBuilder);
+        } else if (node.Symbol is Sine) {
+          FormatFunction(node, "Math.Sin", strBuilder);
+        } else if (node.Symbol is Subtraction) {
+          FormatSubtraction(node, strBuilder);
+        } else if (node.Symbol is Tangent) {
+          FormatFunction(node, "Math.Tan", strBuilder);
+        } else if (node.Symbol is HyperbolicTangent) {
+          FormatFunction(node, "Math.Tanh", strBuilder);
+        } else if (node.Symbol is Square) {
+          FormatSquare(node, strBuilder);
+        } else if (node.Symbol is SquareRoot) {
+          FormatFunction(node, "Math.Sqrt", strBuilder);
+        } else if (node.Symbol is Cube) {
+          FormatPower(node, strBuilder, "3");
+        } else if (node.Symbol is CubeRoot) {
+          strBuilder.Append("Cbrt(");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append(")");
+        } else if (node.Symbol is Power) {
+          FormatFunction(node, "Math.Pow", strBuilder);
+        } else if (node.Symbol is Root) {
+          FormatRoot(node, strBuilder);
+        } else if (node.Symbol is Absolute) {
+          FormatFunction(node, "Math.Abs", strBuilder);
+        } else if (node.Symbol is AnalyticQuotient) {
+          strBuilder.Append("(");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append(" / Math.Sqrt(1 + Math.Pow(");
+          FormatRecursively(node.GetSubtree(1), strBuilder);
+          strBuilder.Append(" , 2) ) )");
+        } else {
+          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for C# symbolic expression tree formatter.");
+        }
+      } else {
+        if (node is VariableTreeNode) {
+          var varNode = node as VariableTreeNode;
+          strBuilder.AppendFormat("{0} * {1}", VariableName2Identifier(varNode.VariableName), varNode.Weight.ToString("g17", CultureInfo.InvariantCulture));
+        } else if (node is ConstantTreeNode) {
+          var constNode = node as ConstantTreeNode;
+          strBuilder.Append(constNode.Value.ToString("g17", CultureInfo.InvariantCulture));
+        } else if (node.Symbol is FactorVariable) {
+          var factorNode = node as FactorVariableTreeNode;
+          FormatFactor(factorNode, strBuilder);
+        } else if (node.Symbol is BinaryFactorVariable) {
+          var binFactorNode = node as BinaryFactorVariableTreeNode;
+          FormatBinaryFactor(binFactorNode, strBuilder);
+        } else {
+          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for C# symbolic expression tree formatter.");
+        }
+      }
+    }
+
+    private void FormatFactor(FactorVariableTreeNode node, StringBuilder strBuilder) {
+      strBuilder.AppendFormat("EvaluateFactor({0}, new [] {{ {1} }}, new [] {{ {2} }})", VariableName2Identifier(node.VariableName),
+        string.Join(",", node.Symbol.GetVariableValues(node.VariableName).Select(name => "\"" + name + "\"")), string.Join(",", node.Weights.Select(v => v.ToString(CultureInfo.InvariantCulture))));
+    }
+
+    private void FormatBinaryFactor(BinaryFactorVariableTreeNode node, StringBuilder strBuilder) {
+      strBuilder.AppendFormat(CultureInfo.InvariantCulture, "EvaluateBinaryFactor({0}, \"{1}\", {2})", VariableName2Identifier(node.VariableName), node.VariableValue, node.Weight);
+    }
+
+    private void FormatSquare(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      FormatPower(node, strBuilder, "2");
+    }
+    private void FormatPower(ISymbolicExpressionTreeNode node, StringBuilder strBuilder, string exponent) {
+      strBuilder.Append("Math.Pow(");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      strBuilder.Append($", {exponent})");
+    }
+
+    private void FormatRoot(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("Math.Pow(");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      strBuilder.Append(", 1.0 / (");
+      FormatRecursively(node.GetSubtree(1), strBuilder);
+      strBuilder.Append("))");
+    }
+
+    private void FormatDivision(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.SubtreeCount == 1) {
+        strBuilder.Append("1.0 / ");
+        FormatRecursively(node.GetSubtree(0), strBuilder);
+      } else {
+        FormatRecursively(node.GetSubtree(0), strBuilder);
+        strBuilder.Append("/ (");
+        for (int i = 1; i < node.SubtreeCount; i++) {
+          if (i > 1) strBuilder.Append(" * ");
+          FormatRecursively(node.GetSubtree(i), strBuilder);
+        }
+        strBuilder.Append(")");
+      }
+    }
+
+    private void FormatSubtraction(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.SubtreeCount == 1) {
+        strBuilder.Append("-");
+        FormatRecursively(node.GetSubtree(0), strBuilder);
+        return;
+      }
+      //Default case: more than 1 child
+      FormatOperator(node, "-", strBuilder);
+    }
+
+    private void FormatOperator(ISymbolicExpressionTreeNode node, string symbol, StringBuilder strBuilder) {
+      strBuilder.Append("(");
+      foreach (var child in node.Subtrees) {
+        FormatRecursively(child, strBuilder);
+        if (child != node.Subtrees.Last())
+          strBuilder.Append(" " + symbol + " ");
+      }
+      strBuilder.Append(")");
+    }
+
+    private void FormatFunction(ISymbolicExpressionTreeNode node, string function, StringBuilder strBuilder) {
+      strBuilder.Append(function + "(");
+      foreach (var child in node.Subtrees) {
+        FormatRecursively(child, strBuilder);
+        if (child != node.Subtrees.Last())
+          strBuilder.Append(", ");
+      }
+      strBuilder.Append(")");
+    }
+
+    private void GenerateHeader(StringBuilder strBuilder, ISymbolicExpressionTree symbolicExpressionTree) {
+      strBuilder.AppendLine("using System;");
+      strBuilder.AppendLine("using System.Linq;" + Environment.NewLine);
+      strBuilder.AppendLine("namespace HeuristicLab.Models {");
+      strBuilder.AppendLine("public static class Model {");
+      GenerateAverageSource(strBuilder);
+      GenerateCbrtSource(strBuilder);
+      GenerateIfThenElseSource(strBuilder);
+      GenerateFactorSource(strBuilder);
+      GenerateBinaryFactorSource(strBuilder);
+      strBuilder.Append(Environment.NewLine + "public static double Evaluate (");
+
+      // here we don't have access to problemData to determine the type for each variable (double/string) therefore we must distinguish based on the symbol type
+      HashSet<string> doubleVarNames = new HashSet<string>();
+      foreach (var node in symbolicExpressionTree.IterateNodesPostfix().Where(x => x is VariableTreeNode || x is VariableConditionTreeNode)) {
+        doubleVarNames.Add(((IVariableTreeNode)node).VariableName);
+      }
+
+      HashSet<string> stringVarNames = new HashSet<string>();
+      foreach (var node in symbolicExpressionTree.IterateNodesPostfix().Where(x => x is BinaryFactorVariableTreeNode || x is FactorVariableTreeNode)) {
+        stringVarNames.Add(((IVariableTreeNode)node).VariableName);
+      }
+
+      var orderedNames = stringVarNames.OrderBy(n => n, new NaturalStringComparer()).Select(n => "string " + VariableName2Identifier(n) + " /* " + n + " */");
+      strBuilder.Append(string.Join(", ", orderedNames));
+
+      if (stringVarNames.Any() && doubleVarNames.Any())
+        strBuilder.AppendLine(",");
+      orderedNames = doubleVarNames.OrderBy(n => n, new NaturalStringComparer()).Select(n => "double " + VariableName2Identifier(n) + " /* " + n + " */");
+      strBuilder.Append(string.Join(", ", orderedNames));
+
+
+      strBuilder.AppendLine(") {");
+      strBuilder.Append("double result = ");
+    }
+
+    private void GenerateFooter(StringBuilder strBuilder) {
+      strBuilder.AppendLine(";");
+
+      strBuilder.AppendLine("return result;");
+      strBuilder.AppendLine("}");
+      strBuilder.AppendLine("}");
+      strBuilder.AppendLine("}");
+    }
+
+    private void GenerateAverageSource(StringBuilder strBuilder) {
+      strBuilder.AppendLine("private static double Average(params double[] values) {");
+      strBuilder.AppendLine("  return values.Average();");
+      strBuilder.AppendLine("}");
+    }
+    private void GenerateCbrtSource(StringBuilder strBuilder) {
+      strBuilder.AppendLine("private static double Cbrt(double x) {");
+      strBuilder.AppendLine("  return x < 0 ? -Math.Pow(-x, 1.0 / 3.0) : Math.Pow(x, 1.0 / 3.0);");
+      strBuilder.AppendLine("}");
+    }
+
+    private void GenerateIfThenElseSource(StringBuilder strBuilder) {
+      strBuilder.AppendLine("private static double EvaluateIf(bool condition, double then, double @else) {");
+      strBuilder.AppendLine("   return condition ? then : @else;");
+      strBuilder.AppendLine("}");
+    }
+
+    private void GenerateFactorSource(StringBuilder strBuilder) {
+      strBuilder.AppendLine("private static double EvaluateFactor(string factorValue, string[] factorValues, double[] constants) {");
+      strBuilder.AppendLine("   for(int i=0;i<factorValues.Length;i++) " +
+                            "      if(factorValues[i] == factorValue) return constants[i];" +
+                            "   throw new ArgumentException();");
+      strBuilder.AppendLine("}");
+    }
+
+    private void GenerateBinaryFactorSource(StringBuilder strBuilder) {
+      strBuilder.AppendLine("private static double EvaluateBinaryFactor(string factorValue, string targetValue, double weight) {");
+      strBuilder.AppendLine("  return factorValue == targetValue ? weight : 0.0;");
+      strBuilder.AppendLine("}");
+    }
+
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,15 +25,15 @@
 using System.Linq;
 using System.Text;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [Item("Excel String Formatter", "String formatter for string representations of symbolic data analysis expressions in Excel syntax.")]
-  [StorableClass]
+  [StorableType("46C46897-9C92-4CF1-81C9-700732700DD3")]
   public sealed class SymbolicDataAnalysisExpressionExcelFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionExcelFormatter(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionExcelFormatter(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionExcelFormatter(SymbolicDataAnalysisExpressionExcelFormatter original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisExpressionExcelFormatter()
@@ -51,5 +51,5 @@
       while (dividend > 0) {
         int modulo = (dividend - 1) % 26;
-        columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
+        columnName = System.Convert.ToChar(65 + modulo) + columnName;
         dividend = (int)((dividend - modulo) / 26);
       }
@@ -60,10 +60,10 @@
     private readonly Dictionary<string, string> variableNameMapping = new Dictionary<string, string>();
     private int currentVariableIndex = 0;
-    private string GetColumnToVariableName(string variabelName) {
-      if (!variableNameMapping.ContainsKey(variabelName)) {
+    private string GetColumnToVariableName(string varName) {
+      if (!variableNameMapping.ContainsKey(varName)) {
         currentVariableIndex++;
-        variableNameMapping.Add(variabelName, GetExcelColumnName(currentVariableIndex));
-      }
-      return string.Format("${0}1", variableNameMapping[variabelName]);
+        variableNameMapping.Add(varName, GetExcelColumnName(currentVariableIndex));
+      }
+      return string.Format("${0}1", variableNameMapping[varName]);
     }
     public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
@@ -71,12 +71,19 @@
     }
 
-    public string Format(ISymbolicExpressionTree symbolicExpressionTree, Dataset dataset) {
+
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree, IDataset dataset) {
+      if (dataset != null)
+        return FormatWithMapping(symbolicExpressionTree, CalculateVariableMapping(symbolicExpressionTree, dataset));
+      else return FormatWithMapping(symbolicExpressionTree, new Dictionary<string, string>());
+    }
+
+    public string FormatWithMapping(ISymbolicExpressionTree symbolicExpressionTree, Dictionary<string, string> variableNameMapping) {
+      foreach (var kvp in variableNameMapping) this.variableNameMapping.Add(kvp.Key, kvp.Value);
       var stringBuilder = new StringBuilder();
-      if (dataset != null) CalculateVariableMapping(symbolicExpressionTree, dataset);
 
       stringBuilder.Append("=");
       stringBuilder.Append(FormatRecursively(symbolicExpressionTree.Root));
 
-      foreach (var variable in variableNameMapping) {
+      foreach (var variable in this.variableNameMapping) {
         stringBuilder.AppendLine();
         stringBuilder.Append(variable.Key + " = " + variable.Value);
@@ -85,14 +92,14 @@
     }
 
-    private void CalculateVariableMapping(ISymbolicExpressionTree tree, Dataset dataset) {
-      int columnIndex = 0;
+    private Dictionary<string, string> CalculateVariableMapping(ISymbolicExpressionTree tree, IDataset dataset) {
+      var mapping = new Dictionary<string, string>();
       int inputIndex = 0;
-      var usedVariables = tree.IterateNodesPrefix().OfType<VariableTreeNode>().Select(v => v.VariableName).Distinct();
+      var usedVariables = tree.IterateNodesPrefix().OfType<IVariableTreeNode>().Select(v => v.VariableName).Distinct().ToArray();
       foreach (var variable in dataset.VariableNames) {
-        columnIndex++;
         if (!usedVariables.Contains(variable)) continue;
         inputIndex++;
-        variableNameMapping[variable] = GetExcelColumnName(inputIndex);
-      }
+        mapping[variable] = GetExcelColumnName(inputIndex);
+      }
+      return mapping;
     }
 
@@ -112,6 +119,10 @@
         }
         stringBuilder.Append(")");
+      } else if (symbol is Absolute) {
+        stringBuilder.Append($"ABS({FormatRecursively(node.GetSubtree(0))})");
+      } else if (symbol is AnalyticQuotient) {
+        stringBuilder.Append($"({FormatRecursively(node.GetSubtree(0))}) / SQRT(1 + POWER({FormatRecursively(node.GetSubtree(1))}, 2))");
       } else if (symbol is Average) {
-        stringBuilder.Append("(1/");
+        stringBuilder.Append("(1/(");
         stringBuilder.Append(node.SubtreeCount);
         stringBuilder.Append(")*(");
@@ -122,5 +133,5 @@
           stringBuilder.Append(")");
         }
-        stringBuilder.Append(")");
+        stringBuilder.Append("))");
       } else if (symbol is Constant) {
         ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
@@ -130,8 +141,14 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(")");
+      } else if (symbol is Cube) {
+        stringBuilder.Append($"POWER({FormatRecursively(node.GetSubtree(0))}, 3)");
+      } else if (symbol is CubeRoot) {
+        var arg_expr = FormatRecursively(node.GetSubtree(0));
+        stringBuilder.Append($"IF({arg_expr} < 0, -POWER(-{arg_expr}, 1/3), POWER({arg_expr}, 1/3))");
       } else if (symbol is Division) {
         if (node.SubtreeCount == 1) {
-          stringBuilder.Append("1/");
-          stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+          stringBuilder.Append("1/(");
+          stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+          stringBuilder.Append(")");
         } else {
           stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
@@ -185,10 +202,33 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(")");
-
+      } else if (symbol is HyperbolicTangent) {
+        stringBuilder.Append("TANH(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(")");
       } else if (symbol is Variable) {
         VariableTreeNode variableTreeNode = node as VariableTreeNode;
         stringBuilder.Append(variableTreeNode.Weight.ToString(CultureInfo.InvariantCulture));
         stringBuilder.Append("*");
-        stringBuilder.Append(GetColumnToVariableName(variableTreeNode.VariableName));// + LagToString(currentLag));
+        stringBuilder.Append(GetColumnToVariableName(variableTreeNode.VariableName));
+      } else if (symbol is BinaryFactorVariable) {
+        var binFactorNode = node as BinaryFactorVariableTreeNode;
+        stringBuilder.AppendFormat("IF({0}=\"{1}\", {2}, 0)",
+          GetColumnToVariableName(binFactorNode.VariableName),
+          binFactorNode.VariableValue,
+          binFactorNode.Weight.ToString(CultureInfo.InvariantCulture)
+          );
+      } else if (symbol is FactorVariable) {
+        var factorNode = node as FactorVariableTreeNode;
+        var values = factorNode.Symbol.GetVariableValues(factorNode.VariableName).ToArray();
+        var w = factorNode.Weights;
+        // create nested if
+        for (int i = 0; i < values.Length; i++) {
+          stringBuilder.AppendFormat("IF({0}=\"{1}\", {2}, ",
+            GetColumnToVariableName(factorNode.VariableName),
+            values[i],
+            w[i].ToString(CultureInfo.InvariantCulture));
+        }
+        stringBuilder.Append("\"\""); // return empty string on unknown value
+        stringBuilder.Append(')', values.Length); // add closing parenthesis
       } else if (symbol is Power) {
         stringBuilder.Append("POWER(");
@@ -203,4 +243,71 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(1)));
         stringBuilder.Append(",0))");
+      } else if (symbol is IfThenElse) {
+        stringBuilder.Append("IF(");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(0)) + " ) > 0");
+        stringBuilder.Append(",");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(1)));
+        stringBuilder.Append(",");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(2)));
+        stringBuilder.Append(")");
+      } else if (symbol is VariableCondition) {
+        VariableConditionTreeNode variableConditionTreeNode = node as VariableConditionTreeNode;
+        if (!variableConditionTreeNode.Symbol.IgnoreSlope) {
+          double threshold = variableConditionTreeNode.Threshold;
+          double slope = variableConditionTreeNode.Slope;
+          string p = "(1 / (1 + EXP(-" + slope.ToString(CultureInfo.InvariantCulture) + " * (" +
+                     GetColumnToVariableName(variableConditionTreeNode.VariableName) + "-" +
+                     threshold.ToString(CultureInfo.InvariantCulture) + "))))";
+          stringBuilder.Append("((");
+          stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+          stringBuilder.Append("*");
+          stringBuilder.Append(p);
+          stringBuilder.Append(") + (");
+          stringBuilder.Append(FormatRecursively(node.GetSubtree(1)));
+          stringBuilder.Append("*(");
+          stringBuilder.Append("1 - " + p + ")");
+          stringBuilder.Append("))");
+        } else {
+          stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "(IF({0} <= {1}, {2}, {3}))",
+            GetColumnToVariableName(variableConditionTreeNode.VariableName),
+            variableConditionTreeNode.Threshold,
+            FormatRecursively(node.GetSubtree(0)),
+            FormatRecursively(node.GetSubtree(1))
+            );
+        }
+      } else if (symbol is Xor) {
+        stringBuilder.Append("IF(");
+        stringBuilder.Append("XOR(");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(0)) + ") > 0,");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(1)) + ") > 0");
+        stringBuilder.Append("), 1.0, -1.0)");
+      } else if (symbol is Or) {
+        stringBuilder.Append("IF(");
+        stringBuilder.Append("OR(");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(0)) + ") > 0,");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(1)) + ") > 0");
+        stringBuilder.Append("), 1.0, -1.0)");
+      } else if (symbol is And) {
+        stringBuilder.Append("IF(");
+        stringBuilder.Append("AND(");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(0)) + ") > 0,");
+        stringBuilder.Append("(" + FormatRecursively(node.GetSubtree(1)) + ") > 0");
+        stringBuilder.Append("), 1.0, -1.0)");
+      } else if (symbol is Not) {
+        stringBuilder.Append("IF(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(" > 0, -1.0, 1.0)");
+      } else if (symbol is GreaterThan) {
+        stringBuilder.Append("IF((");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(") > (");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(1)));
+        stringBuilder.Append("), 1.0, -1.0)");
+      } else if (symbol is LessThan) {
+        stringBuilder.Append("IF((");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(") < (");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(1)));
+        stringBuilder.Append("), 1.0, -1.0)");
       } else {
         throw new NotImplementedException("Excel export of " + node.Symbol + " is not implemented.");
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,22 +24,28 @@
 using System.Linq;
 using System.Text;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [Item("LaTeX String Formatter", "Formatter for symbolic expression trees for import into LaTeX documents.")]
-  [StorableClass]
+  [StorableType("D7186DFF-1596-4A58-B27D-974DF0D93E4F")]
   public sealed class SymbolicDataAnalysisExpressionLatexFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
-    private readonly List<double> constants;
+    private readonly List<KeyValuePair<string, double>> constants;
+    private int constIndex;
     private int targetCount;
     private int currentLag;
+    private string targetVariable;
+    private bool containsTimeSeriesSymbol;
 
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionLatexFormatter(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionLatexFormatter(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionLatexFormatter(SymbolicDataAnalysisExpressionLatexFormatter original, Cloner cloner)
       : base(original, cloner) {
-      constants = new List<double>(original.constants);
+      constants = new List<KeyValuePair<string, double>>(original.constants);
+      constIndex = original.constIndex;
+      currentLag = original.currentLag;
+      targetCount = original.targetCount;
     }
     public SymbolicDataAnalysisExpressionLatexFormatter()
@@ -47,5 +53,5 @@
       Name = ItemName;
       Description = ItemDescription;
-      constants = new List<double>();
+      constants = new List<KeyValuePair<string, double>>();
     }
 
@@ -55,13 +61,21 @@
 
     public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      return Format(symbolicExpressionTree, null);
+    }
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree, string targetVariable) {
       try {
         StringBuilder strBuilder = new StringBuilder();
         constants.Clear();
+        constIndex = 0;
+        this.targetVariable = targetVariable;
+        containsTimeSeriesSymbol = symbolicExpressionTree.IterateNodesBreadth().Any(n => IsTimeSeriesSymbol(n.Symbol));
         strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root));
         return strBuilder.ToString();
-      }
-      catch (NotImplementedException ex) {
+      } catch (NotImplementedException ex) {
         return ex.Message + Environment.NewLine + ex.StackTrace;
       }
+    }
+    static bool IsTimeSeriesSymbol(ISymbol s) {
+      return s is TimeLag || s is Integral || s is Derivative || s is LaggedVariable;
     }
 
@@ -75,5 +89,5 @@
       }
       int i = 1;
-      foreach (SymbolicExpressionTreeNode subTree in node.Subtrees.Skip(1)) {
+      foreach (var subTree in node.Subtrees.Skip(1)) {
         FormatSep(node, strBuilder, i);
         // format the whole subtree
@@ -99,8 +113,12 @@
       } else if (node.Symbol is Division) {
         if (node.SubtreeCount == 1) {
-          strBuilder.Append(@" \cfrac{1");
+          strBuilder.Append(@" \cfrac{1}{");
         } else {
           strBuilder.Append(@" \cfrac{ ");
         }
+      } else if (node.Symbol is Absolute) {
+        strBuilder.Append(@"\operatorname{abs} \left( ");
+      } else if (node.Symbol is AnalyticQuotient) {
+        strBuilder.Append(@" \frac { ");
       } else if (node.Symbol is Average) {
         // skip output of (1/1) if only one subtree
@@ -117,4 +135,8 @@
       } else if (node.Symbol is SquareRoot) {
         strBuilder.Append(@"\sqrt{");
+      } else if (node.Symbol is Cube) {
+        strBuilder.Append(@"\left(");
+      } else if (node.Symbol is CubeRoot) {
+        strBuilder.Append(@"\operatorname{cbrt}\left(");
       } else if (node.Symbol is Sine) {
         strBuilder.Append(@"\sin \left( ");
@@ -123,4 +145,6 @@
       } else if (node.Symbol is Tangent) {
         strBuilder.Append(@"\tan \left( ");
+      } else if (node.Symbol is HyperbolicTangent) {
+        strBuilder.Append(@"\tanh \left( ");
       } else if (node.Symbol is AiryA) {
         strBuilder.Append(@"\operatorname{airy}_a \left( ");
@@ -166,12 +190,41 @@
         strBuilder.Append(@" \operatorname{if}  \left( ");
       } else if (node.Symbol is Constant) {
-        strBuilder.Append("c_{" + constants.Count + "} ");
+        var constName = "c_{" + constIndex + "}";
+        constIndex++;
         var constNode = node as ConstantTreeNode;
-        constants.Add(constNode.Value);
+        if (constNode.Value.IsAlmost(1.0)) {
+          strBuilder.Append("1 ");
+        } else {
+          strBuilder.Append(constName);
+          constants.Add(new KeyValuePair<string, double>(constName, constNode.Value));
+        }
+
+      } else if (node.Symbol is FactorVariable) {
+        var factorNode = node as FactorVariableTreeNode;
+        var constName = "c_{" + constIndex + "}";
+        strBuilder.Append(constName + " ");
+        foreach (var e in factorNode.Symbol.GetVariableValues(factorNode.VariableName)
+          .Zip(factorNode.Weights, Tuple.Create)) {
+          constants.Add(new KeyValuePair<string, double>("c_{" + constIndex + ", " + EscapeLatexString(factorNode.VariableName) + "=" + EscapeLatexString(e.Item1) + "}", e.Item2));
+        }
+        constIndex++;
+      } else if (node.Symbol is BinaryFactorVariable) {
+        var binFactorNode = node as BinaryFactorVariableTreeNode;
+        if (!binFactorNode.Weight.IsAlmost((1.0))) {
+          var constName = "c_{" + constIndex + "}";
+          strBuilder.Append(constName + "  \\cdot");
+          constants.Add(new KeyValuePair<string, double>(constName, binFactorNode.Weight));
+          constIndex++;
+        }
+        strBuilder.Append("(" + EscapeLatexString(binFactorNode.VariableName));
+        strBuilder.Append(LagToString(currentLag));
+        strBuilder.Append(" = " + EscapeLatexString(binFactorNode.VariableValue) + " )");
       } else if (node.Symbol is LaggedVariable) {
         var laggedVarNode = node as LaggedVariableTreeNode;
         if (!laggedVarNode.Weight.IsAlmost(1.0)) {
-          strBuilder.Append("c_{" + constants.Count + "} \\cdot ");
-          constants.Add(laggedVarNode.Weight);
+          var constName = "c_{" + constIndex + "}";
+          strBuilder.Append(constName + "  \\cdot");
+          constants.Add(new KeyValuePair<string, double>(constName, laggedVarNode.Weight));
+          constIndex++;
         }
         strBuilder.Append(EscapeLatexString(laggedVarNode.VariableName));
@@ -181,6 +234,8 @@
         var varNode = node as VariableTreeNode;
         if (!varNode.Weight.IsAlmost((1.0))) {
-          strBuilder.Append("c_{" + constants.Count + "} \\cdot ");
-          constants.Add(varNode.Weight);
+          var constName = "c_{" + constIndex + "}";
+          strBuilder.Append(constName + "  \\cdot");
+          constants.Add(new KeyValuePair<string, double>(constName, varNode.Weight));
+          constIndex++;
         }
         strBuilder.Append(EscapeLatexString(varNode.VariableName));
@@ -197,5 +252,5 @@
         strBuilder.Append(invokeNode.Symbol.FunctionName + @" \left( ");
       } else if (node.Symbol is StartSymbol) {
-        strBuilder.Append("target_" + (targetCount++) + "(t) & = ");
+        FormatStartSymbol(strBuilder);
       } else if (node.Symbol is Argument) {
         var argSym = node.Symbol as Argument;
@@ -216,8 +271,12 @@
       } else if (node.Symbol is VariableCondition) {
         var conditionTreeNode = node as VariableConditionTreeNode;
-        string p = @"1 /  1 + \exp  - c_{" + constants.Count + "} ";
-        constants.Add(conditionTreeNode.Slope);
-        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"}   ";
-        constants.Add(conditionTreeNode.Threshold);
+        var constName = "c_{" + constants.Count + "}";
+        string p = @"1 /  1 + \exp  - " + constName + " ";
+        constants.Add(new KeyValuePair<string, double>(constName, conditionTreeNode.Slope));
+        constIndex++;
+        var const2Name = "c_{" + constants.Count + @"}";
+        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - " + const2Name + "   ";
+        constants.Add(new KeyValuePair<string, double>(const2Name, conditionTreeNode.Threshold));
+        constIndex++;
         strBuilder.Append(@" \left( " + p + @"\cdot ");
       } else {
@@ -238,4 +297,8 @@
         else
           strBuilder.Append(@" }{ \cfrac{ ");
+      } else if (node.Symbol is Absolute) {
+        throw new InvalidOperationException();
+      } else if (node.Symbol is AnalyticQuotient) {
+        strBuilder.Append(@"}{\sqrt{1 + \left( ");
       } else if (node.Symbol is Average) {
         strBuilder.Append(@" + ");
@@ -248,4 +311,8 @@
       } else if (node.Symbol is SquareRoot) {
         throw new InvalidOperationException();
+      } else if (node.Symbol is Cube) {
+        throw new InvalidOperationException();
+      } else if (node.Symbol is CubeRoot) {
+        throw new InvalidOperationException();
       } else if (node.Symbol is Sine) {
         throw new InvalidOperationException();
@@ -253,4 +320,6 @@
         throw new InvalidOperationException();
       } else if (node.Symbol is Tangent) {
+        throw new InvalidOperationException();
+      } else if (node.Symbol is HyperbolicTangent) {
         throw new InvalidOperationException();
       } else if (node.Symbol is AiryA) {
@@ -303,5 +372,5 @@
       } else if (node.Symbol is StartSymbol) {
         strBuilder.Append(@"\\" + Environment.NewLine);
-        strBuilder.Append("target_" + (targetCount++) + "(t) & = ");
+        FormatStartSymbol(strBuilder);
       } else if (node.Symbol is Power) {
         strBuilder.Append(@"\right) ^ { \operatorname{round} \left(");
@@ -310,8 +379,12 @@
       } else if (node.Symbol is VariableCondition) {
         var conditionTreeNode = node as VariableConditionTreeNode;
-        string p = @"1 / \left( 1 + \exp \left( - c_{" + constants.Count + "} ";
-        constants.Add(conditionTreeNode.Slope);
-        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)   ";
-        constants.Add(conditionTreeNode.Threshold);
+        var const1Name = "c_{" + constants.Count + "}";
+        string p = @"1 / \left( 1 + \exp \left( - " + const1Name + " ";
+        constants.Add(new KeyValuePair<string, double>(const1Name, conditionTreeNode.Slope));
+        constIndex++;
+        var const2Name = "c_{" + constants.Count + "}";
+        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - " + const2Name + " \right) \right) \right)   ";
+        constants.Add(new KeyValuePair<string, double>(const2Name, conditionTreeNode.Threshold));
+        constIndex++;
         strBuilder.Append(@" +  \left( 1 - " + p + @" \right) \cdot ");
       } else {
@@ -330,4 +403,8 @@
         for (int i = 2; i < node.SubtreeCount; i++)
           strBuilder.Append(" } ");
+      } else if (node.Symbol is Absolute) {
+        strBuilder.Append(@" \right)");
+      } else if (node.Symbol is AnalyticQuotient) {
+        strBuilder.Append(@" \right)^2}}");
       } else if (node.Symbol is Average) {
         strBuilder.Append(@" \right) ");
@@ -340,4 +417,8 @@
       } else if (node.Symbol is SquareRoot) {
         strBuilder.Append(@"}");
+      } else if (node.Symbol is Cube) {
+        strBuilder.Append(@"\right)^3");
+      } else if (node.Symbol is CubeRoot) {
+        strBuilder.Append(@"\right)");
       } else if (node.Symbol is Sine) {
         strBuilder.Append(@" \right) ");
@@ -345,4 +426,6 @@
         strBuilder.Append(@" \right) ");
       } else if (node.Symbol is Tangent) {
+        strBuilder.Append(@" \right) ");
+      } else if (node.Symbol is HyperbolicTangent) {
         strBuilder.Append(@" \right) ");
       } else if (node.Symbol is AiryA) {
@@ -391,4 +474,6 @@
       } else if (node.Symbol is LaggedVariable) {
       } else if (node.Symbol is Variable) {
+      } else if (node.Symbol is FactorVariable) {
+      } else if (node.Symbol is BinaryFactorVariable) {
       } else if (node.Symbol is ProgramRootSymbol) {
         strBuilder
@@ -398,13 +483,11 @@
         // output all constant values
         if (constants.Count > 0) {
-          int i = 0;
           foreach (var constant in constants) {
             // replace "." with ".&" to align decimal points
-            var constStr = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{0:G5}", constant);
+            var constStr = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "{0:G5}", constant.Value);
             if (!constStr.Contains(".")) constStr = constStr + ".0";
-            constStr = constStr.Replace(".", "\\negthickspace&.");  // fix problem in rendering of aligned expressions
-            strBuilder.Append("c_{" + i + "}& = & " + constStr);
+            constStr = constStr.Replace(".", "&.");  // fix problem in rendering of aligned expressions
+            strBuilder.Append(constant.Key + "& = & " + constStr);
             strBuilder.Append(@"\\");
-            i++;
           }
         }
@@ -433,4 +516,11 @@
     }
 
+    private void FormatStartSymbol(StringBuilder strBuilder) {
+      strBuilder.Append(targetVariable ?? "target_" + (targetCount++));
+      if (containsTimeSeriesSymbol)
+        strBuilder.Append("(t)");
+      strBuilder.Append(" & = ");
+    }
+
     private string LagToString(int lag) {
       if (lag < 0) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,19 +21,20 @@
 
 using System.Globalization;
+using System.Linq;
 using System.Text;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
 
   [Item("MATLAB String Formatter", "String formatter for string representations of symbolic data analysis expressions in MATLAB syntax.")]
-  [StorableClass]
+  [StorableType("ADFB0A37-412D-4DD4-A174-F0103ADD7972")]
   public sealed class SymbolicDataAnalysisExpressionMATLABFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
     private int currentLag;
 
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionMATLABFormatter(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionMATLABFormatter(StorableConstructorFlag _) : base(_) { }
     private SymbolicDataAnalysisExpressionMATLABFormatter(SymbolicDataAnalysisExpressionMATLABFormatter original, Cloner cloner) : base(original, cloner) { }
     public SymbolicDataAnalysisExpressionMATLABFormatter()
@@ -77,4 +78,26 @@
       stringBuilder.AppendLine("  y = (f0 + 2*f1 - 2*f3 - f4) / 8;");
       stringBuilder.AppendLine("end");
+
+      var factorVariableNames =
+        symbolicExpressionTree.IterateNodesPostfix()
+          .OfType<FactorVariableTreeNode>()
+          .Select(n => n.VariableName)
+          .Distinct();
+
+      foreach (var factorVarName in factorVariableNames) {
+        var factorSymb = symbolicExpressionTree.IterateNodesPostfix()
+          .OfType<FactorVariableTreeNode>()
+          .First(n => n.VariableName == factorVarName)
+          .Symbol;
+        stringBuilder.AppendFormat("function y = switch_{0}(val, v)", factorVarName).AppendLine();
+        var values = factorSymb.GetVariableValues(factorVarName).ToArray();
+        stringBuilder.AppendLine("switch val");
+        for (int i = 0; i < values.Length; i++) {
+          stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "  case \"{0}\" y = v({1})", values[i], i).AppendLine();
+        }
+        stringBuilder.AppendLine("end");
+        stringBuilder.AppendLine();
+      }
+
       return stringBuilder.ToString();
     }
@@ -103,4 +126,8 @@
         }
         stringBuilder.Append(")");
+      } else if (symbol is Absolute) {
+        stringBuilder.Append($"abs({FormatRecursively(node.GetSubtree(0))})");
+      } else if (symbol is AnalyticQuotient) {
+        stringBuilder.Append($"({FormatRecursively(node.GetSubtree(0))}) / sqrt(1 + ({FormatRecursively(node.GetSubtree(1))}).^2)");
       } else if (symbol is And) {
         stringBuilder.Append("((");
@@ -156,4 +183,12 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(")");
+      } else if (symbol is Cube) {
+        stringBuilder.Append("(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(").^3");
+      } else if (symbol is CubeRoot) {
+        stringBuilder.Append("NTHROOT(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(", 3)");
       } else if (symbol is GreaterThan) {
         stringBuilder.Append("((");
@@ -231,4 +266,8 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(")");
+      } else if (symbol is HyperbolicTangent) {
+        stringBuilder.Append("tanh(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(")");
       } else if (node.Symbol is AiryA) {
         stringBuilder.Append("airy(");
@@ -296,4 +335,14 @@
         stringBuilder.Append("*");
         stringBuilder.Append(variableTreeNode.VariableName + LagToString(currentLag));
+      } else if (symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.FactorVariable) {
+        var factorNode = node as FactorVariableTreeNode;
+        var weights = string.Join(" ", factorNode.Weights.Select(w => w.ToString("G17", CultureInfo.InvariantCulture)));
+        stringBuilder.AppendFormat("switch_{0}(\"{1}\",[{2}])",
+          factorNode.VariableName, factorNode.VariableName, weights)
+          .AppendLine();
+      } else if (symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.BinaryFactorVariable) {
+        var factorNode = node as BinaryFactorVariableTreeNode;
+        stringBuilder.AppendFormat(CultureInfo.InvariantCulture,
+          "((strcmp({0},\"{1}\")==1) * {2:G17})", factorNode.VariableName, factorNode.VariableValue, factorNode.Weight);
       } else if (symbol is Power) {
         stringBuilder.Append("(");
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs	(revision 17687)
@@ -0,0 +1,266 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+using System.Linq;
+using System.Text;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("Mathematica Symbolic Expression Tree Formatter", "A string formatter that converts symbolic expression trees to Mathematica expressions.")]
+  [StorableType("818A9294-FA95-41F6-A5F0-D7D050BDD076")]
+  public sealed class SymbolicDataAnalysisExpressionMathematicaFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [StorableConstructor]
+    private SymbolicDataAnalysisExpressionMathematicaFormatter(StorableConstructorFlag _) : base(_) { }
+    private SymbolicDataAnalysisExpressionMathematicaFormatter(SymbolicDataAnalysisExpressionMathematicaFormatter original, Cloner cloner) : base(original, cloner) { }
+    public SymbolicDataAnalysisExpressionMathematicaFormatter()
+      : base() {
+      Name = ItemName;
+      Description = ItemDescription;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionMathematicaFormatter(this, cloner);
+    }
+
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      // skip root and start symbols
+      StringBuilder strBuilder = new StringBuilder();
+      FormatRecursively(symbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0), strBuilder);
+      return strBuilder.ToString();
+    }
+
+    private void FormatRecursively(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.Subtrees.Any()) {
+        if (node.Symbol is Addition) {
+          FormatFunction(node, "Plus", strBuilder);
+        } else if (node.Symbol is Absolute) {
+          FormatFunction(node, "Abs", strBuilder);
+        } else if (node.Symbol is AnalyticQuotient) {
+          strBuilder.Append("[");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append("]/Sqrt[ 1 + Power[");
+          FormatRecursively(node.GetSubtree(1), strBuilder);
+          strBuilder.Append(", 2]]");
+        } else if (node.Symbol is Average) {
+          FormatAverage(node, strBuilder);
+        } else if (node.Symbol is Multiplication) {
+          FormatFunction(node, "Times", strBuilder);
+        } else if (node.Symbol is Subtraction) {
+          FormatSubtraction(node, strBuilder);
+        } else if (node.Symbol is Division) {
+          FormatDivision(node, strBuilder);
+        } else if (node.Symbol is Sine) {
+          FormatFunction(node, "Sin", strBuilder);
+        } else if (node.Symbol is Cosine) {
+          FormatFunction(node, "Cos", strBuilder);
+        } else if (node.Symbol is Tangent) {
+          FormatFunction(node, "Tan", strBuilder);
+        } else if (node.Symbol is HyperbolicTangent) {
+          FormatFunction(node, "Tanh", strBuilder);
+        } else if (node.Symbol is Exponential) {
+          FormatFunction(node, "Exp", strBuilder);
+        } else if (node.Symbol is Logarithm) {
+          FormatFunction(node, "Log", strBuilder);
+        } else if (node.Symbol is IfThenElse) {
+          FormatIf(node, strBuilder);
+        } else if (node.Symbol is GreaterThan) {
+          strBuilder.Append("If[Greater[");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append(",");
+          FormatRecursively(node.GetSubtree(1), strBuilder);
+          strBuilder.Append("], 1, -1]");
+        } else if (node.Symbol is LessThan) {
+          strBuilder.Append("If[Less[");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append(",");
+          FormatRecursively(node.GetSubtree(1), strBuilder);
+          strBuilder.Append("], 1, -1]");
+        } else if (node.Symbol is And) {
+          FormatAnd(node, strBuilder);
+        } else if (node.Symbol is Not) {
+          strBuilder.Append("If[Greater[");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append(", 0], -1, 1]");
+        } else if (node.Symbol is Or) {
+          FormatOr(node, strBuilder);
+        } else if (node.Symbol is Xor) {
+          FormatXor(node, strBuilder);
+        } else if (node.Symbol is Square) {
+          FormatSquare(node, strBuilder);
+        } else if (node.Symbol is SquareRoot) {
+          FormatFunction(node, "Sqrt", strBuilder);
+        } else if (node.Symbol is Cube) {
+          FormatPower(node, strBuilder, "3");
+        } else if (node.Symbol is CubeRoot) {
+          strBuilder.Append("CubeRoot[");
+          FormatRecursively(node.GetSubtree(0), strBuilder);
+          strBuilder.Append("]");
+        } else if (node.Symbol is Power) {
+          FormatFunction(node, "Power", strBuilder);
+        } else if (node.Symbol is Root) {
+          FormatRoot(node, strBuilder);
+        } else {
+          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " is not supported.");
+        }
+      } else {
+        // terminals
+        if (node.Symbol is Variable) {
+          var varNode = node as VariableTreeNode;
+          strBuilder.AppendFormat("Times[{0}, {1}]", varNode.VariableName, varNode.Weight.ToString("G17", CultureInfo.InvariantCulture));
+        } else if (node.Symbol is Constant) {
+          var constNode = node as ConstantTreeNode;
+          strBuilder.Append(constNode.Value.ToString("G17", CultureInfo.InvariantCulture));
+        } else if (node.Symbol is FactorVariable) {
+          var factorNode = node as FactorVariableTreeNode;
+          strBuilder.AppendFormat("Switch[{0},", factorNode.VariableName);
+          var varValues = factorNode.Symbol.GetVariableValues(factorNode.VariableName).ToArray();
+          var weights = varValues.Select(factorNode.GetValue).ToArray();
+
+          var weightStr = string.Join(", ",
+            varValues.Zip(weights, (s, d) => string.Format(CultureInfo.InvariantCulture, "\"{0}\", {1:G17}", s, d)));
+          strBuilder.Append(weightStr);
+          strBuilder.Append("]");
+        } else if (node.Symbol is BinaryFactorVariable) {
+          var factorNode = node as BinaryFactorVariableTreeNode;
+          strBuilder.AppendFormat(CultureInfo.InvariantCulture, "If[{0}==\"{1}\",{2:G17},0.0]",
+            factorNode.VariableName, factorNode.VariableValue, factorNode.Weight);
+        } else {
+          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " is not supported.");
+        }
+      }
+    }
+
+    private void FormatXor(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("If[Xor[");
+      foreach (var t in node.Subtrees) {
+        strBuilder.Append("Greater[");
+        FormatRecursively(t, strBuilder);
+        strBuilder.Append(", 0]");
+        if (t != node.Subtrees.Last()) strBuilder.Append(",");
+      }
+      strBuilder.Append("], 1, -1]");
+    }
+
+    private void FormatOr(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("If[Or[");
+      foreach (var t in node.Subtrees) {
+        strBuilder.Append("Greater[");
+        FormatRecursively(t, strBuilder);
+        strBuilder.Append(", 0]");
+        if (t != node.Subtrees.Last()) strBuilder.Append(",");
+      }
+      strBuilder.Append("], 1, -1]");
+    }
+
+    private void FormatAnd(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("If[And[");
+      foreach (var t in node.Subtrees) {
+        strBuilder.Append("Greater[");
+        FormatRecursively(t, strBuilder);
+        strBuilder.Append(", 0]");
+        if (t != node.Subtrees.Last()) strBuilder.Append(",");
+      }
+      strBuilder.Append("], 1, -1]");
+    }
+
+    private void FormatIf(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("If[Greater[");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      strBuilder.Append(", 0], ");
+      FormatRecursively(node.GetSubtree(1), strBuilder);
+      strBuilder.Append(", ");
+      FormatRecursively(node.GetSubtree(2), strBuilder);
+      strBuilder.Append("]");
+    }
+
+    private void FormatAverage(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      // mean function needs a list of values
+      strBuilder.Append("Mean[{");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      for (int i = 1; i < node.SubtreeCount; i++) {
+        strBuilder.Append(",");
+        FormatRecursively(node.GetSubtree(i), strBuilder);
+      }
+      strBuilder.Append("}]");
+    }
+
+    private void FormatSubtraction(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("Subtract[");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      strBuilder.Append(", Times[-1");
+      foreach (var t in node.Subtrees) {
+        strBuilder.Append(",");
+        FormatRecursively(t, strBuilder);
+      }
+      strBuilder.Append("]]");
+    }
+
+    private void FormatSquare(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      FormatPower(node, strBuilder, "2");
+    }
+
+    private void FormatPower(ISymbolicExpressionTreeNode node, StringBuilder strBuilder, string exponent) {
+      strBuilder.Append("Power[");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      strBuilder.Append($", {exponent}]");
+    }
+
+    private void FormatRoot(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("Power[");
+      FormatRecursively(node.GetSubtree(0), strBuilder);
+      strBuilder.Append(", Divide[1,");
+      FormatRecursively(node.GetSubtree(1), strBuilder);
+      strBuilder.Append("]]");
+    }
+
+    private void FormatDivision(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.SubtreeCount == 1) {
+        strBuilder.Append("Divide[1, ");
+        FormatRecursively(node.GetSubtree(0), strBuilder);
+        strBuilder.Append("]");
+      } else {
+        strBuilder.Append("Divide[");
+        FormatRecursively(node.GetSubtree(0), strBuilder);
+        strBuilder.Append(", Times[");
+        FormatRecursively(node.GetSubtree(1), strBuilder);
+        for (int i = 2; i < node.SubtreeCount; i++) {
+          strBuilder.Append(",");
+          FormatRecursively(node.GetSubtree(i), strBuilder);
+        }
+        strBuilder.Append("]]");
+      }
+    }
+
+    private void FormatFunction(ISymbolicExpressionTreeNode node, string function, StringBuilder strBuilder) {
+      strBuilder.Append(function + "[");
+      foreach (var child in node.Subtrees) {
+        FormatRecursively(child, strBuilder);
+        if (child != node.Subtrees.Last())
+          strBuilder.Append(", ");
+      }
+      strBuilder.Append("]");
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using System.Globalization;
 using System.Text;
@@ -69,4 +70,8 @@
         }
         stringBuilder.Append(") ifTrue:[1] ifFalse:[-1]");
+      } else if (symbol is Absolute) {
+        stringBuilder.Append($"({FormatRecursively(node.GetSubtree(0))}) abs");
+      } else if (symbol is AnalyticQuotient) {
+        stringBuilder.Append($"({FormatRecursively(node.GetSubtree(0))}) / (1 + ({FormatPower(node.GetSubtree(1), "2")})) sqrt");
       } else if (symbol is Average) {
         stringBuilder.Append("(1/");
@@ -84,4 +89,9 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(" cos");
+      } else if (symbol is Cube) {
+        stringBuilder.Append(FormatPower(node.GetSubtree(0), "3"));
+      } else if (symbol is CubeRoot) {
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(" cbrt");
       } else if (symbol is Division) {
         if (node.SubtreeCount == 1) {
@@ -115,5 +125,5 @@
         stringBuilder.Append("]");
       } else if (symbol is LaggedVariable) {
-        stringBuilder.Append("lagged variable not implemented");
+        stringBuilder.Append("lagged variables are not supported");
       } else if (symbol is LessThan) {
         stringBuilder.Append("(");
@@ -146,4 +156,8 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(" sin");
+      } else if (symbol is Square) {
+        stringBuilder.Append(FormatPower(node.GetSubtree(0), "2"));
+      } else if (symbol is SquareRoot) {
+        stringBuilder.Append(FormatPower(node.GetSubtree(0), "(1/2)"));
       } else if (symbol is Subtraction) {
         if (node.SubtreeCount == 1) {
@@ -160,4 +174,7 @@
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(" tan");
+      } else if (symbol is HyperbolicTangent) {
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(" tanh");
       } else if (symbol is Variable) {
         VariableTreeNode variableTreeNode = node as VariableTreeNode;
@@ -165,4 +182,6 @@
         stringBuilder.Append("*");
         stringBuilder.Append(variableTreeNode.VariableName);
+      } else if (symbol is BinaryFactorVariable || symbol is FactorVariable) {
+        stringBuilder.Append("factor variables are not supported");
       } else {
         stringBuilder.Append("(");
@@ -179,4 +198,8 @@
     }
 
+    private string FormatPower(ISymbolicExpressionTreeNode node, string exponent) {
+      return $"(({FormatRecursively(node)}) log * {exponent}) exp ";
+    }
+
     public override IDeepCloneable Clone(Cloner cloner) {
       return new SymbolicDataAnalysisExpressionSmalltalkFormatter(this, cloner);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/TSQLExpressionFormatter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/TSQLExpressionFormatter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/TSQLExpressionFormatter.cs	(revision 17687)
@@ -0,0 +1,278 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  internal static class StringBuilderExtensions {
+    internal static void AppendIndented(this StringBuilder strBuilder, int level, string text) {
+      strBuilder.Append(new string(' ', level * 2));
+      strBuilder.Append(text);
+    }
+    internal static void AppendLineIndented(this StringBuilder strBuilder, int level, string text) {
+      strBuilder.Append(new string(' ', level * 2));
+      strBuilder.AppendLine(text);
+    }
+  }
+
+  [Item("TSQL String Formatter", "String formatter for string representations of symbolic data analysis expressions in TSQL syntax.")]
+  [StorableType("549808A5-A062-4972-9DDB-E4B5CD392470")]
+  public sealed class TSQLExpressionFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [StorableConstructor]
+    private TSQLExpressionFormatter(StorableConstructorFlag _) : base(_) { }
+    private TSQLExpressionFormatter(TSQLExpressionFormatter original, Cloner cloner) : base(original, cloner) { }
+    public TSQLExpressionFormatter()
+      : base() {
+      Name = ItemName;
+      Description = ItemDescription;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TSQLExpressionFormatter(this, cloner);
+    }
+
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree) {
+      // skip root and start symbols
+      StringBuilder strBuilder = new StringBuilder();
+      GenerateHeader(strBuilder, symbolicExpressionTree);
+
+      //generate function body
+      FormatRecursively(1, symbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0), strBuilder);
+
+      GenerateFooter(strBuilder);
+      return strBuilder.ToString();
+    }
+
+    private void GenerateHeader(StringBuilder strBuilder, ISymbolicExpressionTree symbolicExpressionTree) {
+      HashSet<string> floatVarNames = new HashSet<string>();
+      foreach (var node in symbolicExpressionTree.IterateNodesPostfix().Where(x => x is VariableTreeNode || x is VariableConditionTreeNode)) {
+        floatVarNames.Add(((IVariableTreeNode)node).VariableName);
+      }
+      var sortedFloatIdentifiers = floatVarNames.OrderBy(n => n, new NaturalStringComparer()).Select(n => VariableName2Identifier(n)).ToList();
+
+      HashSet<string> varcharVarNames = new HashSet<string>();
+      foreach (var node in symbolicExpressionTree.IterateNodesPostfix().Where(x => x is BinaryFactorVariableTreeNode || x is FactorVariableTreeNode)) {
+        varcharVarNames.Add(((IVariableTreeNode)node).VariableName);
+      }
+      var sortedVarcharIdentifiers = varcharVarNames.OrderBy(n => n, new NaturalStringComparer()).Select(n => VariableName2Identifier(n)).ToList();
+
+      //Generate comment and instructions
+      strBuilder.Append("-- generated. created function can be used like 'SELECT dbo.REGRESSIONMODEL(");
+      strBuilder.Append(string.Join(", ", sortedVarcharIdentifiers));
+      if (varcharVarNames.Any() && floatVarNames.Any())
+        strBuilder.Append(",");
+      strBuilder.Append(string.Join(", ", sortedFloatIdentifiers));
+      strBuilder.AppendLine(")'");
+      strBuilder.AppendLine("-- use the expression after the RETURN statement if you want to incorporate the model in a query without creating a function.");
+
+      //Generate function header
+      strBuilder.Append("CREATE FUNCTION dbo.REGRESSIONMODEL(");
+      strBuilder.Append(string.Join(", ", sortedVarcharIdentifiers.Select(n => string.Format("{0} NVARCHAR(max)",n))));
+      if (varcharVarNames.Any() && floatVarNames.Any())
+        strBuilder.Append(",");
+      strBuilder.Append(string.Join(", ", sortedFloatIdentifiers.Select(n => string.Format("{0} FLOAT",n))));
+      strBuilder.AppendLine(")");
+
+      //start function body
+      strBuilder.AppendLine("RETURNS FLOAT");
+      strBuilder.AppendLine("BEGIN");
+
+      //add variable declaration for convenience
+      strBuilder.AppendLineIndented(1, "-- added variable declaration for convenience");
+      foreach (var name in sortedVarcharIdentifiers)
+        strBuilder.AppendLineIndented(1, string.Format("-- DECLARE {0} NVARCHAR(max) = ''", name));
+      foreach (var name in sortedFloatIdentifiers)
+        strBuilder.AppendLineIndented(1, string.Format("-- DECLARE {0} FLOAT = 0.0", name));
+      strBuilder.AppendLineIndented(1, "-- SELECT");
+      strBuilder.AppendLine("RETURN ");
+    }
+
+    private void FormatRecursively(int level, ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.Subtrees.Any()) {
+        if (node.Symbol is Addition) {
+          FormatOperator(level, node, "+", strBuilder);
+        } else if (node.Symbol is And) {
+          FormatOperator(level, node, "AND", strBuilder);
+        } else if (node.Symbol is Average) {
+          FormatAverage(level, node, strBuilder);
+        } else if (node.Symbol is Cosine) {
+          FormatFunction(level, node, "COS", strBuilder);
+        } else if (node.Symbol is Division) {
+          FormatDivision(level, node, strBuilder);
+        } else if (node.Symbol is Exponential) {
+          FormatFunction(level, node, "EXP", strBuilder);
+        } else if (node.Symbol is GreaterThan) {
+          FormatOperator(level, node, ">", strBuilder);
+        } else if (node.Symbol is IfThenElse) {
+          FormatIfThenElse(level, node, strBuilder);
+        } else if (node.Symbol is LessThan) {
+          FormatOperator(level, node, "<", strBuilder);
+        } else if (node.Symbol is Logarithm) {
+          FormatFunction(level, node, "LOG", strBuilder);
+        } else if (node.Symbol is Multiplication) {
+          FormatOperator(level, node, "*", strBuilder);
+        } else if (node.Symbol is Not) {
+          FormatOperator(level, node, "NOT LIKE", strBuilder);
+        } else if (node.Symbol is Or) {
+          FormatOperator(level, node, "OR", strBuilder);
+        } else if (node.Symbol is Xor) {
+          throw new NotSupportedException(string.Format("Symbol {0} not yet supported.", node.Symbol.GetType().Name));
+        } else if (node.Symbol is Sine) {
+          FormatFunction(level, node, "SIN", strBuilder);
+        } else if (node.Symbol is Subtraction) {
+          FormatSubtraction(level, node, strBuilder);
+        } else if (node.Symbol is Tangent) {
+          FormatFunction(level, node, "TAN", strBuilder);
+        } else if (node.Symbol is Square) {
+          FormatFunction(level, node, "SQUARE", strBuilder);
+        } else if (node.Symbol is SquareRoot) {
+          FormatFunction(level, node, "SQRT", strBuilder);
+        } else if (node.Symbol is Power) {
+          FormatFunction(level, node, "POWER", strBuilder);
+        } else if (node.Symbol is Root) {
+          FormatRoot(level, node, strBuilder);
+        } else {
+          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for TSQL symbolic expression tree formatter.");
+        }
+      } else {
+        if (node is VariableTreeNode) {
+          var varNode = node as VariableTreeNode;
+          strBuilder.AppendFormat("{0} * {1}", VariableName2Identifier(varNode.VariableName), varNode.Weight.ToString("g17", CultureInfo.InvariantCulture));
+        } else if (node is ConstantTreeNode) {
+          var constNode = node as ConstantTreeNode;
+          strBuilder.Append(constNode.Value.ToString("g17", CultureInfo.InvariantCulture));
+        } else if (node.Symbol is FactorVariable) {
+          var factorNode = node as FactorVariableTreeNode;
+          FormatFactor(level, factorNode, strBuilder);
+        } else if (node.Symbol is BinaryFactorVariable) {
+          var binFactorNode = node as BinaryFactorVariableTreeNode;
+          throw new NotSupportedException(string.Format("Symbol {0} not yet supported.", node.Symbol.GetType().Name));
+        } else {
+          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for TSQL symbolic expression tree formatter.");
+        }
+      }
+    }
+
+    private void FormatIfThenElse(int level, ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("CASE ISNULL((SELECT 1 WHERE");
+      FormatRecursively(level,node.GetSubtree(0), strBuilder);
+      strBuilder.AppendLine("),0)");
+      strBuilder.AppendIndented(level,"WHEN 1 THEN ");
+      FormatRecursively(level, node.GetSubtree(1), strBuilder);
+      strBuilder.AppendLine();
+      strBuilder.AppendIndented(level, "WHEN 0 THEN ");
+      FormatRecursively(level, node.GetSubtree(2), strBuilder);
+      strBuilder.AppendLine();
+      strBuilder.AppendIndented(level, "END");
+    }
+
+    private void FormatAverage(int level, ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.Append("(");
+      foreach (var child in node.Subtrees) {
+        FormatRecursively(level, child, strBuilder);
+        if (child != node.Subtrees.Last())
+          strBuilder.Append(" + ");
+      }
+      strBuilder.AppendFormat(") / {0}", node.Subtrees.Count());
+    }
+
+    private string VariableName2Identifier(string variableName) {
+      return "@"+variableName.Replace(' ', '_');
+    }
+
+    private void GenerateFooter(StringBuilder strBuilder) {
+      strBuilder.Append(Environment.NewLine);
+      strBuilder.AppendLine("END");
+    }
+
+
+    private void FormatOperator(int level, ISymbolicExpressionTreeNode node, string symbol, StringBuilder strBuilder) {
+      strBuilder.Append("(");
+      foreach (var child in node.Subtrees) {
+        FormatRecursively(level, child, strBuilder);
+        if (child != node.Subtrees.Last())
+          strBuilder.Append(" " + symbol + " ");
+      }
+      strBuilder.Append(")");
+    }
+
+    private void FormatFunction(int level, ISymbolicExpressionTreeNode node, string function, StringBuilder strBuilder) {
+      strBuilder.Append(function + "(");
+      foreach (var child in node.Subtrees) {
+        FormatRecursively(level++, child, strBuilder);
+        if (child != node.Subtrees.Last())
+          strBuilder.Append(", ");
+      }
+      strBuilder.Append(")");
+    }
+
+    private void FormatDivision(int level, ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.SubtreeCount == 1) {
+        strBuilder.Append("1.0 / ");
+        FormatRecursively(level, node.GetSubtree(0), strBuilder);
+      } else {
+        FormatRecursively(level, node.GetSubtree(0), strBuilder);
+        strBuilder.Append("/ (");
+        for (int i = 1; i < node.SubtreeCount; i++) {
+          if (i > 1) strBuilder.Append(" * ");
+          FormatRecursively(level, node.GetSubtree(i), strBuilder);
+        }
+        strBuilder.Append(")");
+      }
+    }
+
+    private void FormatSubtraction(int level, ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.SubtreeCount == 1) {
+        strBuilder.Append("-");
+        FormatRecursively(level, node.GetSubtree(0), strBuilder);
+        return;
+      }
+      //Default case: more than 1 child
+      FormatOperator(level, node, "-", strBuilder);
+    }
+
+    private void FormatRoot(int level, ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      strBuilder.AppendLine("POWER(");
+      FormatRecursively(level, node.GetSubtree(0), strBuilder);
+      strBuilder.AppendLineIndented(level, " , 1.0 / (");
+      FormatRecursively(level, node.GetSubtree(1), strBuilder);
+      strBuilder.AppendLineIndented(level, "))");
+    }
+
+    private void FormatFactor(int level, FactorVariableTreeNode node, StringBuilder strBuilder) {
+      strBuilder.AppendLine("( ");
+      strBuilder.AppendLineIndented(level + 1, string.Format("CASE {0}", VariableName2Identifier(node.VariableName)));
+      foreach (var name in node.Symbol.GetVariableValues(node.VariableName)) {
+        strBuilder.AppendLineIndented(level + 2, string.Format("WHEN '{0}' THEN {1}", name, node.GetValue(name).ToString(CultureInfo.InvariantCulture)));
+      }
+      strBuilder.AppendLineIndented(level + 1, "ELSE NULL END");
+      strBuilder.AppendIndented(level, ")");
+    }
+
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,18 +21,18 @@
 
 using System.Collections.Generic;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [NonDiscoverableType]
-  [StorableClass]
+  [StorableType("FCBA02B7-5D29-42F5-A64C-A60AD8EA475D")]
   [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")]
-  public class ArithmeticExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
+  public class ArithmeticExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
 
     [StorableConstructor]
-    protected ArithmeticExpressionGrammar(bool deserializing) : base(deserializing) { }
+    protected ArithmeticExpressionGrammar(StorableConstructorFlag _) : base(_) { }
     protected ArithmeticExpressionGrammar(ArithmeticExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
     public ArithmeticExpressionGrammar()
@@ -53,6 +53,8 @@
       constant.MaxValue = 20;
       var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
+      var binFactorVariableSymbol = new BinaryFactorVariable();
+      var factorVariableSymbol = new FactorVariable();
 
-      var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol };
+      var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol, binFactorVariableSymbol, factorVariableSymbol };
       var functionSymbols = new List<Symbol>() { add, sub, mul, div };
 
@@ -65,4 +67,6 @@
       SetSubtreeCount(constant, 0, 0);
       SetSubtreeCount(variableSymbol, 0, 0);
+      SetSubtreeCount(binFactorVariableSymbol, 0, 0);
+      SetSubtreeCount(factorVariableSymbol, 0, 0);
 
       // allow each symbol as child of the start symbol
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/DataAnalysisGrammar.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/DataAnalysisGrammar.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/DataAnalysisGrammar.cs	(revision 17687)
@@ -0,0 +1,68 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+
+  [StorableType("B91038EA-338E-40BB-99D2-738B96C66D81")]
+  public abstract class DataAnalysisGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
+    [StorableConstructor]
+    protected DataAnalysisGrammar(StorableConstructorFlag _) : base(_) { }
+    protected DataAnalysisGrammar(DataAnalysisGrammar original, Cloner cloner) : base(original, cloner) { }
+    protected DataAnalysisGrammar(string name, string description) : base(name, description) { }
+
+    public void ConfigureVariableSymbols(IDataAnalysisProblemData problemData) {
+      var dataset = problemData.Dataset;
+      foreach (var varSymbol in Symbols.OfType<VariableBase>()) {
+        if (!varSymbol.Fixed) {
+          varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<double>(x));
+          varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<double>(x));
+        }
+      }
+      foreach (var factorSymbol in Symbols.OfType<BinaryFactorVariable>()) {
+        if (!factorSymbol.Fixed) {
+          factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<string>(x));
+          factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<string>(x));
+          factorSymbol.VariableValues = factorSymbol.VariableNames
+            .ToDictionary(varName => varName, varName => dataset.GetStringValues(varName).Distinct().ToList());
+        }
+      }
+      foreach (var factorSymbol in Symbols.OfType<FactorVariable>()) {
+        if (!factorSymbol.Fixed) {
+          factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => dataset.VariableHasType<string>(x));
+          factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => dataset.VariableHasType<string>(x));
+          factorSymbol.VariableValues = factorSymbol.VariableNames
+            .ToDictionary(varName => varName,
+            varName => dataset.GetStringValues(varName).Distinct()
+            .Select((n, i) => Tuple.Create(n, i))
+            .ToDictionary(tup => tup.Item1, tup => tup.Item2));
+        }
+      }
+    }
+
+
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,15 +22,15 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("44B0829C-1CB5-4BE9-9514-BBA54FAB2912")]
   [Item("FullFunctionalExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")]
-  public class FullFunctionalExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
+  public class FullFunctionalExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
     [StorableConstructor]
-    protected FullFunctionalExpressionGrammar(bool deserializing) : base(deserializing) { }
+    protected FullFunctionalExpressionGrammar(StorableConstructorFlag _) : base(_) { }
     protected FullFunctionalExpressionGrammar(FullFunctionalExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
     public FullFunctionalExpressionGrammar()
@@ -48,4 +48,5 @@
       var mul = new Multiplication();
       var div = new Division();
+      var aq = new AnalyticQuotient();
       var mean = new Average();
       var sin = new Sine();
@@ -53,12 +54,18 @@
       var tan = new Tangent();
       var log = new Logarithm();
+      var abs = new Absolute();
+      var tanh = new HyperbolicTangent();
       var pow = new Power();
       pow.InitialFrequency = 0.0;
       var square = new Square();
       square.InitialFrequency = 0.0;
+      var cube = new Cube();
+      cube.InitialFrequency = 0.0;
       var root = new Root();
       root.InitialFrequency = 0.0;
       var sqrt = new SquareRoot();
       sqrt.InitialFrequency = 0.0;
+      var cubeRoot = new CubeRoot();
+      cubeRoot.InitialFrequency = 0.0;
       var airyA = new AiryA();
       airyA.InitialFrequency = 0.0;
@@ -99,4 +106,5 @@
       var or = new Or();
       var not = new Not();
+      var xor = new Xor();
 
       var timeLag = new TimeLag();
@@ -114,4 +122,6 @@
       constant.MaxValue = 20;
       var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
+      var binFactorVariable = new BinaryFactorVariable();
+      var factorVariable = new FactorVariable();
       var laggedVariable = new LaggedVariable();
       laggedVariable.InitialFrequency = 0.0;
@@ -120,14 +130,14 @@
       autoregressiveVariable.Enabled = false;
 
-      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, square, pow, sqrt, root, exp,
+      var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, abs, sin, cos, tan, log, square, cube, pow, sqrt, cubeRoot, root, exp, tanh,
         airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral,
-        @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable,autoregressiveVariable, variableCondition };
-      var unaryFunctionSymbols = new List<Symbol>() { square, sqrt, sin, cos, tan, log, exp, not, timeLag, integral, derivative,
+        @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition };
+      var unaryFunctionSymbols = new List<Symbol>() { abs, square, sqrt, cube, cubeRoot, sin, cos, tan, log, exp, tanh, not, timeLag, integral, derivative,
         airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral
       };
 
-      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, variableCondition };
-      var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
-      var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable, autoregressiveVariable };
+      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, aq, variableCondition };
+      var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or, xor };
+      var terminalSymbols = new List<Symbol>() { variableSymbol, binFactorVariable, factorVariable, constant, laggedVariable, autoregressiveVariable };
 
       foreach (var symb in allSymbols)
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,12 +22,12 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("36A22322-0627-4E25-A468-F2A788AF6D46")]
   [Item("TypeCoherentExpressionGrammar", "Represents a grammar for functional expressions in which special syntactic constraints are enforced so that boolean and real-valued expressions are not mixed.")]
-  public class TypeCoherentExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
+  public class TypeCoherentExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
     private const string ArithmeticFunctionsName = "Arithmetic Functions";
     private const string TrigonometricFunctionsName = "Trigonometric Functions";
@@ -44,5 +44,5 @@
 
     [StorableConstructor]
-    protected TypeCoherentExpressionGrammar(bool deserializing) : base(deserializing) { }
+    protected TypeCoherentExpressionGrammar(StorableConstructorFlag _) : base(_) { }
     protected TypeCoherentExpressionGrammar(TypeCoherentExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
     public TypeCoherentExpressionGrammar()
@@ -69,5 +69,8 @@
       var root = new Root();
       var sqrt = new SquareRoot();
+      var cube = new Cube();
+      var cubeRoot = new CubeRoot();
       var exp = new Exponential();
+      var abs = new Absolute();
 
       var airyA = new AiryA();
@@ -82,8 +85,10 @@
       var gamma = new Gamma();
       var hypCosineIntegral = new HyperbolicCosineIntegral();
+      var tanh = new HyperbolicTangent();
       var hypSineIntegral = new HyperbolicSineIntegral();
       var norm = new Norm();
       var psi = new Psi();
       var sineIntegral = new SineIntegral();
+      var analyticalQuotient = new AnalyticQuotient();
 
       var @if = new IfThenElse();
@@ -93,4 +98,5 @@
       var or = new Or();
       var not = new Not();
+      var xor = new Xor();
       var variableCondition = new VariableCondition();
 
@@ -103,4 +109,6 @@
       constant.MaxValue = 20;
       var variableSymbol = new Variable();
+      var binFactorVariable = new BinaryFactorVariable();
+      var factorVariable = new FactorVariable();
       var laggedVariable = new LaggedVariable();
       var autoregressiveVariable = new AutoregressiveTargetVariable();
@@ -109,16 +117,16 @@
       #region group symbol declaration
       var arithmeticSymbols = new GroupSymbol(ArithmeticFunctionsName, new List<ISymbol>() { add, sub, mul, div, mean });
-      var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan });
+      var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan, tanh });
       var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log });
-      var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, 
-        fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral});
-      var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, variableSymbol });
+      var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { abs, airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi,
+        fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral, analyticalQuotient});
+      var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, variableSymbol, binFactorVariable, factorVariable });
       var realValuedSymbols = new GroupSymbol(RealValuedSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, specialFunctions, terminalSymbols });
 
-      var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { square, pow, sqrt, root });
+      var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { square, pow, sqrt, root, cube, cubeRoot });
 
       var conditionSymbols = new GroupSymbol(ConditionsName, new List<ISymbol> { @if, variableCondition });
       var comparisonSymbols = new GroupSymbol(ComparisonsName, new List<ISymbol> { gt, lt });
-      var booleanOperationSymbols = new GroupSymbol(BooleanOperatorsName, new List<ISymbol> { and, or, not });
+      var booleanOperationSymbols = new GroupSymbol(BooleanOperatorsName, new List<ISymbol> { and, or, not, xor });
       var conditionalSymbols = new GroupSymbol(ConditionalSymbolsName, new List<ISymbol> { conditionSymbols, comparisonSymbols, booleanOperationSymbols });
 
@@ -137,7 +145,13 @@
       SetSubtreeCount(root, 2, 2);
       SetSubtreeCount(square, 1, 1);
+      SetSubtreeCount(cube, 1, 1);
       SetSubtreeCount(sqrt, 1, 1);
+      SetSubtreeCount(cubeRoot, 1, 1);
       SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1);
-      SetSubtreeCount(specialFunctions, 1, 1);
+      foreach (var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient })) {
+        SetSubtreeCount(sy, 1, 1);
+      }
+      SetSubtreeCount(analyticalQuotient, 2, 2);
+
       SetSubtreeCount(terminalSymbols, 0, 0);
 
@@ -148,4 +162,5 @@
       SetSubtreeCount(or, 2, 2);
       SetSubtreeCount(not, 1, 1);
+      SetSubtreeCount(xor, 2, 2);
 
       SetSubtreeCount(timeLag, 1, 1);
@@ -227,4 +242,6 @@
     public void ConfigureAsDefaultRegressionGrammar() {
       Symbols.First(s => s is Average).Enabled = false;
+      Symbols.First(s => s is Absolute).Enabled = false;
+      Symbols.First(s => s is HyperbolicTangent).Enabled = false;
       Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false;
       Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false;
@@ -237,4 +254,7 @@
       Symbols.First(s => s is Average).Enabled = false;
       Symbols.First(s => s is VariableCondition).Enabled = false;
+      Symbols.First(s => s is Xor).Enabled = false;
+      Symbols.First(s => s is Absolute).Enabled = false;
+      Symbols.First(s => s is HyperbolicTangent).Enabled = false;
       Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false;
       Symbols.First(s => s.Name == ExponentialFunctionsName).Enabled = false;
@@ -246,4 +266,6 @@
     public void ConfigureAsDefaultTimeSeriesPrognosisGrammar() {
       Symbols.First(s => s is Average).Enabled = false;
+      Symbols.First(s => s is Absolute).Enabled = false;
+      Symbols.First(s => s is HyperbolicTangent).Enabled = false;
       Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false;
       Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false;
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashExtensions.cs	(revision 17687)
@@ -0,0 +1,238 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class SymbolicExpressionHashExtensions {
+    /// <summary>
+    /// Holds data that is necessary to handle tree nodes in hashing / simplification.
+    /// </summary>
+    /// <typeparam name="T">The tree node type</typeparam>
+    public sealed class HashNode<T> : IComparable<HashNode<T>>, IEquatable<HashNode<T>> where T : class {
+      public T Data;
+      public int Arity;
+      public int Size;
+      public bool IsCommutative;
+
+      public bool Enabled;
+      public ulong HashValue;           // the initial (fixed) hash value for this individual node/data
+      public ulong CalculatedHashValue; // the calculated hash value (taking into account the children hash values)
+
+      public delegate void SimplifyAction(ref HashNode<T>[] nodes, int i);
+      public SimplifyAction Simplify;
+
+      public bool IsLeaf => Arity == 0;
+
+      public int CompareTo(HashNode<T> other) {
+        var res = HashValue.CompareTo(other.HashValue);
+        return res == 0 ? CalculatedHashValue.CompareTo(other.CalculatedHashValue) : res;
+      }
+
+      public override string ToString() {
+        return $"{Data} {Arity} {Size} {CalculatedHashValue} {Enabled}";
+      }
+
+      public bool Equals(HashNode<T> other) {
+        return CalculatedHashValue.Equals(other.CalculatedHashValue);
+      }
+
+      public override bool Equals(object obj) {
+        var other = obj as HashNode<T>;
+        if (other != null)
+          return Equals(other);
+        return base.Equals(obj);
+      }
+
+      public override int GetHashCode() {
+        return (int)CalculatedHashValue;
+      }
+
+      public static bool operator ==(HashNode<T> a, HashNode<T> b) {
+        return a.Equals(b);
+      }
+
+      public static bool operator !=(HashNode<T> a, HashNode<T> b) {
+        return !a.Equals(b);
+      }
+    }
+
+    public static ulong ComputeHash<T>(this HashNode<T>[] nodes, int i, Func<byte[], ulong> hashFunction) where T : class {
+      var node = nodes[i];
+      const int size = sizeof(ulong);
+      var hashes = new ulong[node.Arity + 1];
+      var bytes = new byte[(node.Arity + 1) * size];
+
+      for (int j = i - 1, k = 0; k < node.Arity; ++k, j -= 1 + nodes[j].Size) {
+        hashes[k] = nodes[j].CalculatedHashValue;
+      }
+      hashes[node.Arity] = node.HashValue;
+      Buffer.BlockCopy(hashes, 0, bytes, 0, bytes.Length);
+      return hashFunction(bytes);
+    }
+
+    // set the enabled state for the whole subtree rooted at this node 
+    public static void SetEnabled<T>(this HashNode<T>[] nodes, int i, bool enabled) where T : class {
+      nodes[i].Enabled = enabled;
+      for (int j = i - nodes[i].Size; j < i; ++j)
+        nodes[j].Enabled = enabled;
+    }
+
+    public static HashNode<T>[] Simplify<T>(this HashNode<T>[] nodes, Func<byte[], ulong> hashFunction) where T : class {
+      bool simplified = false;
+      nodes = nodes.UpdateNodeSizes().Reduce().Sort(hashFunction);
+      do {
+        if (simplified) {
+          simplified = false;
+          nodes = nodes.Where(x => x.Enabled).ToArray().UpdateNodeSizes().Reduce().Sort(hashFunction);
+        }
+
+        for (int i = 0; i < nodes.Length; ++i) {
+          var node = nodes[i];
+          if (node.IsLeaf) {
+            continue;
+          }
+          node.Simplify?.Invoke(ref nodes, i);
+          for (int j = i - node.Size; j <= i; ++j) {
+            // detect if anything was simplified
+            if (!nodes[j].Enabled) {
+              simplified = true;
+              break;
+            }
+          }
+        }
+      } while (simplified);
+      return nodes.UpdateNodeSizes().Sort(hashFunction);
+    }
+
+    public static HashNode<T>[] Sort<T>(this HashNode<T>[] nodes, Func<byte[], ulong> hashFunction) where T : class {
+      int sort(int a, int b) => nodes[a].CompareTo(nodes[b]);
+
+      for (int i = 0; i < nodes.Length; ++i) {
+        var node = nodes[i];
+
+        if (node.IsLeaf) {
+          continue;
+        }
+
+        if (node.IsCommutative) { // only sort when the argument order does not matter
+          var arity = node.Arity;
+          var size = node.Size;
+
+          if (arity == size) { // all child nodes are terminals
+            Array.Sort(nodes, i - size, size);
+          } else { // i have some non-terminal children
+            var sorted = new HashNode<T>[size];
+            var indices = new int[node.Arity];
+            for (int j = i - 1, k = 0; k < node.Arity; j -= 1 + nodes[j].Size, ++k) {
+              indices[k] = j;
+            }
+            Array.Sort(indices, sort);
+
+            int idx = 0;
+            foreach (var j in indices) {
+              var child = nodes[j];
+              if (!child.IsLeaf) { // must copy complete subtree
+                Array.Copy(nodes, j - child.Size, sorted, idx, child.Size);
+                idx += child.Size;
+              }
+              sorted[idx++] = nodes[j];
+            }
+            Array.Copy(sorted, 0, nodes, i - size, size);
+          }
+        }
+        node.CalculatedHashValue = nodes.ComputeHash(i, hashFunction);
+      }
+      return nodes;
+    }
+
+    /// <summary>
+    /// Get a function node's child indices
+    /// </summary>
+    /// <typeparam name="T">The data type encapsulated by a hash node</typeparam>
+    /// <param name="nodes">An array of hash nodes with up-to-date node sizes (see UpdateNodeSizes)</param>
+    /// <param name="i">The index in the array of hash nodes of the node whose children we want to iterate</param>
+    /// <returns>An array containing child indices</returns>
+    public static int[] IterateChildren<T>(this HashNode<T>[] nodes, int i) where T : class {
+      var node = nodes[i];
+      var arity = node.Arity;
+      var children = new int[arity];
+      var idx = i - 1;
+      for (int j = 0; j < arity; ++j) {
+        children[j] = idx;
+        idx -= 1 + nodes[idx].Size;
+      }
+      return children;
+    }
+
+    /// <summary>
+    /// Determines size of each branch and sets the results for each node.
+    /// </summary>
+    /// <typeparam name="T">The data type encapsulated by a hash node</typeparam>
+    /// <param name="nodes">An array of hash nodes in postfix order.</param>
+    /// <returns>The array with updated node sizes. The array is not copied.</returns>
+    public static HashNode<T>[] UpdateNodeSizes<T>(this HashNode<T>[] nodes) where T : class {
+      for (int i = 0; i < nodes.Length; ++i) {
+        var node = nodes[i];
+        if (node.IsLeaf) {
+          node.Size = 0;
+          continue;
+        }
+        node.Size = node.Arity;
+        // visit all children and sum up their size (assumes postfix order).
+        for (int j = i - 1, k = 0; k < node.Arity; j -= 1 + nodes[j].Size, ++k) {
+          node.Size += nodes[j].Size;
+        }
+      }
+      return nodes;
+    }
+
+    // disables duplicate branches and removes the disabled nodes
+    public static HashNode<T>[] Reduce<T>(this HashNode<T>[] nodes) where T : class {
+      int count = 0;
+      for (int i = 0; i < nodes.Length; ++i) {
+        var node = nodes[i];
+        if (node.IsLeaf || !node.IsCommutative) {
+          continue;
+        }
+
+        var arity = node.Arity;
+        for (int j = i - 1, k = 0; k < arity; j -= 1 + nodes[j].Size, ++k) {
+          if (node.HashValue == nodes[j].HashValue) {
+            nodes[j].Enabled = false;
+            node.Arity += nodes[j].Arity - 1;
+            ++count;
+          }
+        }
+      }
+      if (count == 0)
+        return nodes;
+
+      var reduced = new HashNode<T>[nodes.Length - count];
+      var idx = 0;
+      foreach (var node in nodes) {
+        if (node.Enabled) { reduced[idx++] = node; }
+      }
+      return reduced.UpdateNodeSizes();
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashUtil.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashUtil.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/HashUtil.cs	(revision 17687)
@@ -0,0 +1,92 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Security.Cryptography;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class HashUtil {
+    // This class contains some hash functions adapted from http://partow.net/programming/hashfunctions/index.html#AvailableHashFunctions
+
+    // A simple hash function from Robert Sedgwicks Algorithms in C book.I've added some simple optimizations to the algorithm in order to speed up its hashing process. 
+    public static ulong RSHash(byte[] input) {
+      const int b = 378551;
+      ulong a = 63689;
+      ulong hash = 0;
+
+      foreach (var v in input) {
+        hash = (hash * a) + v;
+        a *= b;
+      }
+      return hash;
+    }
+
+    // A bitwise hash function written by Justin Sobel
+    public static ulong JSHash(byte[] input) {
+      ulong hash = 1315423911;
+      for (int i = 0; i < input.Length; ++i)
+        hash ^= (hash << 5) + input[i] + (hash >> 2);
+      return hash;
+    }
+
+    // This hash function comes from Brian Kernighan and Dennis Ritchie's book "The C Programming Language". It is a simple hash function using a strange set of possible seeds which all constitute a pattern of 31....31...31 etc, it seems to be very similar to the DJB hash function. 
+    public static ulong BKDRHash(byte[] input) {
+      ulong seed = 131;
+      ulong hash = 0;
+      foreach (var v in input) {
+        hash = (hash * seed) + v;
+      }
+      return hash;
+    }
+
+    // This is the algorithm of choice which is used in the open source SDBM project. The hash function seems to have a good over-all distribution for many different data sets. It seems to work well in situations where there is a high variance in the MSBs of the elements in a data set. 
+    public static ulong SDBMHash(byte[] input) {
+      ulong hash = 0;
+      foreach (var v in input) {
+        hash = v + (hash << 6) + (hash << 16) - hash;
+      }
+      return hash;
+    }
+
+    // An algorithm produced by Professor Daniel J. Bernstein and shown first to the world on the usenet newsgroup comp.lang.c. It is one of the most efficient hash functions ever published. 
+    public static ulong DJBHash(byte[] input) {
+      ulong hash = 5381;
+      foreach (var v in input) {
+        hash = (hash << 5) + hash + v;
+      }
+      return hash;
+    }
+
+    // An algorithm proposed by Donald E.Knuth in The Art Of Computer Programming Volume 3, under the topic of sorting and search chapter 6.4. 
+    public static ulong DEKHash(byte[] input) {
+      ulong hash = (ulong)input.Length;
+      foreach (var v in input) {
+        hash = (hash << 5) ^ (hash >> 27) ^ v;
+      }
+      return hash;
+    }
+
+    public static ulong CryptoHash(HashAlgorithm ha, byte[] input) {
+      return BitConverter.ToUInt64(ha.ComputeHash(input), 0);
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Hashing/SymbolicExpressionTreeHash.cs	(revision 17687)
@@ -0,0 +1,404 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using static HeuristicLab.Problems.DataAnalysis.Symbolic.SymbolicExpressionHashExtensions;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class SymbolicExpressionTreeHash {
+    private static readonly Addition add = new Addition();
+    private static readonly Subtraction sub = new Subtraction();
+    private static readonly Multiplication mul = new Multiplication();
+    private static readonly Division div = new Division();
+    private static readonly Logarithm log = new Logarithm();
+    private static readonly Exponential exp = new Exponential();
+    private static readonly Sine sin = new Sine();
+    private static readonly Cosine cos = new Cosine();
+    private static readonly Constant constant = new Constant();
+
+    private static ISymbolicExpressionTreeNode ActualRoot(this ISymbolicExpressionTree tree) => tree.Root.GetSubtree(0).GetSubtree(0);
+    public static ulong HashFunction(byte[] input) => HashUtil.DJBHash(input);
+
+    #region tree hashing
+    public static ulong[] Hash(this ISymbolicExpressionTree tree, bool simplify = false, bool strict = false) {
+      return tree.ActualRoot().Hash(simplify, strict);
+    }
+
+    public static ulong[] Hash(this ISymbolicExpressionTreeNode node, bool simplify = false, bool strict = false) {
+      var hashNodes = simplify ? node.MakeNodes(strict).Simplify(HashFunction) : node.MakeNodes(strict).Sort(HashFunction);
+      var hashes = new ulong[hashNodes.Length];
+      for (int i = 0; i < hashes.Length; ++i) {
+        hashes[i] = hashNodes[i].CalculatedHashValue;
+      }
+      return hashes;
+    }
+
+    public static ulong ComputeHash(this ISymbolicExpressionTree tree, bool simplify = false, bool strict = false) {
+      return ComputeHash(tree.ActualRoot(), simplify, strict);
+    }
+
+    public static ulong ComputeHash(this ISymbolicExpressionTreeNode treeNode, bool simplify = false, bool strict = false) {
+      return treeNode.Hash(simplify, strict).Last();
+    }
+
+    public static HashNode<ISymbolicExpressionTreeNode> ToHashNode(this ISymbolicExpressionTreeNode node, bool strict = false) {
+      var symbol = node.Symbol;
+      var name = symbol.Name;
+      if (node is ConstantTreeNode constantNode) {
+        name = strict ? constantNode.Value.ToString() : symbol.Name;
+      } else if (node is VariableTreeNode variableNode) {
+        name = strict ? variableNode.Weight.ToString() + variableNode.VariableName : variableNode.VariableName;
+      }
+      var hash = (ulong)name.GetHashCode();
+      var hashNode = new HashNode<ISymbolicExpressionTreeNode> {
+        Data = node,
+        Arity = node.SubtreeCount,
+        Size = node.SubtreeCount,
+        IsCommutative = node.Symbol is Addition || node.Symbol is Multiplication,
+        Enabled = true,
+        HashValue = hash,
+        CalculatedHashValue = hash
+      };
+      if (symbol is Addition) {
+        hashNode.Simplify = SimplifyAddition;
+      } else if (symbol is Multiplication) {
+        hashNode.Simplify = SimplifyMultiplication;
+      } else if (symbol is Division) {
+        hashNode.Simplify = SimplifyDivision;
+      } else if (symbol is Logarithm || symbol is Exponential || symbol is Sine || symbol is Cosine) {
+        hashNode.Simplify = SimplifyUnaryNode;
+      } else if (symbol is Subtraction) {
+        hashNode.Simplify = SimplifyBinaryNode;
+      }
+      return hashNode;
+    }
+
+    public static HashNode<ISymbolicExpressionTreeNode>[] MakeNodes(this ISymbolicExpressionTree tree, bool strict = false) {
+      return MakeNodes(tree.ActualRoot(), strict);
+    }
+
+    public static HashNode<ISymbolicExpressionTreeNode>[] MakeNodes(this ISymbolicExpressionTreeNode node, bool strict = false) {
+      return node.IterateNodesPostfix().Select(x => x.ToHashNode(strict)).ToArray().UpdateNodeSizes();
+    }
+    #endregion
+
+    #region tree similarity
+    public static double ComputeSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, bool simplify = false, bool strict = false) {
+      return ComputeSimilarity(t1.ActualRoot(), t2.ActualRoot(), simplify, strict);
+    }
+
+    public static double ComputeSimilarity(ISymbolicExpressionTreeNode t1, ISymbolicExpressionTreeNode t2, bool simplify = false, bool strict = false) {
+      var lh = t1.Hash(simplify, strict);
+      var rh = t2.Hash(simplify, strict);
+
+      Array.Sort(lh);
+      Array.Sort(rh);
+
+      return ComputeSimilarity(lh, rh);
+    }
+
+    // requires lhs and rhs to be sorted
+    public static int IntersectCount(this ulong[] lh, ulong[] rh) {
+      int count = 0;
+      for (int i = 0, j = 0; i < lh.Length && j < rh.Length;) {
+        var h1 = lh[i];
+        var h2 = rh[j];
+        if (h1 == h2) {
+          ++count;
+          ++i;
+          ++j;
+        } else if (h1 < h2) {
+          ++i;
+        } else if (h1 > h2) {
+          ++j;
+        }
+      }
+      return count;
+    }
+
+    public static IEnumerable<ulong> Intersect(this ulong[] lh, ulong[] rh) {
+      for (int i = 0, j = 0; i < lh.Length && j < rh.Length;) {
+        var h1 = lh[i];
+        var h2 = rh[j];
+        if (h1 == h2) {
+          yield return h1;
+          ++i;
+          ++j;
+        } else if (h1 < h2) {
+          ++i;
+        } else if (h1 > h2) {
+          ++j;
+        }
+      }
+    }
+
+    // this will only work if lh and rh are sorted
+    public static double ComputeSimilarity(ulong[] lh, ulong[] rh) {
+      return 2d * IntersectCount(lh, rh) / (lh.Length + rh.Length);
+    }
+
+    public static double ComputeAverageSimilarity(IList<ISymbolicExpressionTree> trees, bool simplify = false, bool strict = false) {
+      var total = trees.Count * (trees.Count - 1) / 2;
+      double avg = 0;
+      var hashes = new ulong[trees.Count][];
+      // build hash arrays
+      for (int i = 0; i < trees.Count; ++i) {
+        var nodes = trees[i].MakeNodes(strict);
+        hashes[i] = (simplify ? nodes.Simplify(HashFunction) : nodes.Sort(HashFunction)).Select(x => x.CalculatedHashValue).ToArray();
+        Array.Sort(hashes[i]);
+      }
+      // compute similarity matrix
+      for (int i = 0; i < trees.Count - 1; ++i) {
+        for (int j = i + 1; j < trees.Count; ++j) {
+          avg += ComputeSimilarity(hashes[i], hashes[j]);
+        }
+      }
+      return avg / total;
+    }
+
+    public static double[,] ComputeSimilarityMatrix(IList<ulong[]> hashes) {
+      // compute similarity matrix
+      var n = hashes.Count;
+      var sim = new double[n, n];
+      for (int i = 0; i < n - 1; ++i) {
+        for (int j = i + 1; j < n; ++j) {
+          sim[i, j] = sim[j, i] = ComputeSimilarity(hashes[i], hashes[j]);
+        }
+      }
+      return sim;
+    }
+
+    public static double[,] ComputeSimilarityMatrix(IList<ISymbolicExpressionTree> trees, bool simplify = false, bool strict = false) {
+      var hashes = new ulong[trees.Count][];
+      // build hash arrays
+      for (int i = 0; i < trees.Count; ++i) {
+        var nodes = trees[i].MakeNodes(strict);
+        hashes[i] = (simplify ? nodes.Simplify(HashFunction) : nodes.Sort(HashFunction)).Select(x => x.CalculatedHashValue).ToArray();
+        Array.Sort(hashes[i]);
+      }
+      return ComputeSimilarityMatrix(hashes);
+    }
+    #endregion
+
+    #region parse a nodes array back into a tree
+    public static ISymbolicExpressionTree ToTree(this HashNode<ISymbolicExpressionTreeNode>[] nodes) {
+      var root = new ProgramRootSymbol().CreateTreeNode();
+      var start = new StartSymbol().CreateTreeNode();
+      root.AddSubtree(start);
+      start.AddSubtree(nodes.ToSubtree());
+      return new SymbolicExpressionTree(root);
+    }
+
+    public static ISymbolicExpressionTreeNode ToSubtree(this HashNode<ISymbolicExpressionTreeNode>[] nodes) {
+      var treeNodes = nodes.Select(x => x.Data.Symbol.CreateTreeNode()).ToArray();
+
+      for (int i = nodes.Length - 1; i >= 0; --i) {
+        var node = nodes[i];
+
+        if (node.IsLeaf) {
+          if (node.Data is VariableTreeNode variable) {
+            var variableTreeNode = (VariableTreeNode)treeNodes[i];
+            variableTreeNode.VariableName = variable.VariableName;
+            variableTreeNode.Weight = variable.Weight;
+          } else if (node.Data is ConstantTreeNode @const) {
+            var constantTreeNode = (ConstantTreeNode)treeNodes[i];
+            constantTreeNode.Value = @const.Value;
+          }
+          continue;
+        }
+
+        var treeNode = treeNodes[i];
+
+        foreach (var j in nodes.IterateChildren(i)) {
+          treeNode.AddSubtree(treeNodes[j]);
+        }
+      }
+
+      return treeNodes.Last();
+    }
+
+    private static T CreateTreeNode<T>(this ISymbol symbol) where T : class, ISymbolicExpressionTreeNode {
+      return (T)symbol.CreateTreeNode();
+    }
+    #endregion
+
+    #region tree simplification
+    // these simplification methods rely on the assumption that child nodes of the current node have already been simplified
+    // (in other words simplification should be applied in a bottom-up fashion)
+    public static ISymbolicExpressionTree Simplify(ISymbolicExpressionTree tree) {
+      return tree.MakeNodes().Simplify(HashFunction).ToTree();
+    }
+
+    public static void SimplifyAddition(ref HashNode<ISymbolicExpressionTreeNode>[] nodes, int i) {
+      // simplify additions of terms by eliminating terms with the same symbol and hash
+      var children = nodes.IterateChildren(i);
+
+      // we always assume the child nodes are sorted
+      var curr = children[0];
+      var node = nodes[i];
+
+      foreach (var j in children.Skip(1)) {
+        if (nodes[j] == nodes[curr]) {
+          nodes.SetEnabled(j, false);
+          node.Arity--;
+        } else {
+          curr = j;
+        }
+      }
+      if (node.Arity == 1) { // if the arity is 1 we don't need the addition node at all
+        node.Enabled = false;
+      }
+    }
+
+    // simplify multiplications by reducing constants and div terms
+    public static void SimplifyMultiplication(ref HashNode<ISymbolicExpressionTreeNode>[] nodes, int i) {
+      var node = nodes[i];
+      var children = nodes.IterateChildren(i);
+
+      for (int j = 0; j < children.Length; ++j) {
+        var c = children[j];
+        var child = nodes[c];
+
+        if (!child.Enabled)
+          continue;
+
+        var symbol = child.Data.Symbol;
+        if (child.Data is ConstantTreeNode firstConst) {
+          // fold sibling constant nodes into the first constant
+          for (int k = j + 1; k < children.Length; ++k) {
+            var sibling = nodes[children[k]];
+            if (sibling.Data is ConstantTreeNode otherConst) {
+              sibling.Enabled = false;
+              node.Arity--;
+              firstConst.Value *= otherConst.Value;
+            } else {
+              break;
+            }
+          }
+        } else if (child.Data is VariableTreeNode variable) {
+          // fold sibling constant nodes into the variable weight
+          for (int k = j + 1; k < children.Length; ++k) {
+            var sibling = nodes[children[k]];
+            if (sibling.Data is ConstantTreeNode constantNode) {
+              sibling.Enabled = false;
+              node.Arity--;
+              variable.Weight *= constantNode.Value;
+            } else {
+              break;
+            }
+          }
+        } else if (symbol is Division) {
+          // 1/x is expressed as div(x) (with a single child)
+          // we assume division always has arity 1 or 2
+          var d = child.Arity == 1 ? c - 1 : c - nodes[c - 1].Size - 2;
+          var denominator = nodes[d];
+
+          // iterate children of node i to see if any of them matches the denominator of div node c
+          for (int k = 0; k < children.Length; ++k) {
+            var sibling = nodes[children[k]];
+            if (sibling.Enabled && sibling == denominator) {
+              nodes.SetEnabled(children[j], false); // disable the div subtree
+              nodes.SetEnabled(children[k], false); // disable the sibling matching the denominator
+
+              node.Arity -= 2; // matching child + division node
+              break;
+            }
+          }
+        }
+
+        if (node.Arity == 0) { // if everything is simplified this node becomes constant
+          var constantTreeNode = constant.CreateTreeNode<ConstantTreeNode>();
+          constantTreeNode.Value = 1;
+          nodes[i] = constantTreeNode.ToHashNode();
+        } else if (node.Arity == 1) { // when i have only 1 arg left i can skip this node
+          node.Enabled = false;
+        }
+      }
+    }
+
+    public static void SimplifyDivision(ref HashNode<ISymbolicExpressionTreeNode>[] nodes, int i) {
+      var node = nodes[i];
+      var children = nodes.IterateChildren(i);
+
+      var tmp = nodes;
+
+      if (children.All(x => tmp[x].Data.Symbol is Constant)) {
+        var v = ((ConstantTreeNode)nodes[children.First()].Data).Value;
+        if (node.Arity == 1) {
+          v = 1 / v;
+        } else if (node.Arity > 1) {
+          foreach (var j in children.Skip(1)) {
+            v /= ((ConstantTreeNode)nodes[j].Data).Value;
+          }
+        }
+        var constantTreeNode = constant.CreateTreeNode<ConstantTreeNode>();
+        constantTreeNode.Value = v;
+        nodes[i] = constantTreeNode.ToHashNode();
+        return;
+      }
+
+      var nominator = nodes[children[0]];
+      foreach (var j in children.Skip(1)) {
+        var denominator = nodes[j];
+        if (nominator == denominator) {
+          // disable all the children of the division node (nominator and children + denominator and children)
+          nominator.Enabled = denominator.Enabled = false;
+          node.Arity -= 2; // nominator + denominator
+        }
+        if (node.Arity == 0) {
+          var constantTreeNode = constant.CreateTreeNode<ConstantTreeNode>();
+          constantTreeNode.Value = 1; // x / x = 1
+          nodes[i] = constantTreeNode.ToHashNode();
+        }
+      }
+    }
+
+    public static void SimplifyUnaryNode(ref HashNode<ISymbolicExpressionTreeNode>[] nodes, int i) {
+      // check if the child of the unary node is a constant, then the whole node can be simplified
+      var parent = nodes[i];
+      var child = nodes[i - 1];
+
+      var parentSymbol = parent.Data.Symbol;
+      var childSymbol = child.Data.Symbol;
+
+      if (childSymbol is Constant) {
+        nodes[i].Enabled = false;
+      } else if ((parentSymbol is Exponential && childSymbol is Logarithm) || (parentSymbol is Logarithm && childSymbol is Exponential)) {
+        child.Enabled = parent.Enabled = false;
+      }
+    }
+
+    public static void SimplifyBinaryNode(ref HashNode<ISymbolicExpressionTreeNode>[] nodes, int i) {
+      var children = nodes.IterateChildren(i);
+      var tmp = nodes;
+      if (children.All(x => tmp[x].Data.Symbol is Constant)) {
+        foreach (var j in children) {
+          nodes[j].Enabled = false;
+        }
+        nodes[i] = constant.CreateTreeNode().ToHashNode();
+      }
+    }
+    #endregion
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 17687)
@@ -11,5 +11,5 @@
     <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic</RootNamespace>
     <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
@@ -41,22 +41,24 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -64,7 +66,8 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -73,8 +76,9 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
@@ -82,7 +86,8 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
@@ -91,58 +96,91 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
+      <HintPath>..\..\..\..\trunk\bin\ALGLIB-3.7.0.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Analysis-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Collections-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Common-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Common.Resources-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Core-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Data-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    <Reference Include="AutoDiff-1.0, Version=1.0.0.14388, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\bin\AutoDiff-1.0.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HEAL.Attic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HEAL.Attic.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Operators-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Optimization-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.NativeInterpreter-0.1, Version=0.0.0.1, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.NativeInterpreter-0.1.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Parameters-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Persistence-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
-      <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=MSIL" />
-    <Reference Include="HeuristicLab.Random-3.3">
-      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\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=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Selection-3.3.dll</HintPath>
     </Reference>
     <Reference Include="System" />
@@ -161,12 +199,6 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Analyzers\SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs" />
-    <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" />
-    <Compile Include="SlidingWindow\SlidingWindowBestSolutionsCollection.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="SlidingWindow\SlidingWindowData.cs" />
-    <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" />
-    <Compile Include="SlidingWindow\SlidingWindowAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" />
@@ -182,10 +214,42 @@
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Matching\SymbolicExpressionTreeCanonicalSorter.cs" />
-    <Compile Include="Matching\SymbolicExpressionTreeEqualityComparer.cs" />
-    <Compile Include="Matching\SymbolicExpressionTreeMatching.cs" />
-    <Compile Include="Matching\SymbolicExpressionTreeMaxCommonSequenceCalculator.cs" />
-    <Compile Include="Matching\SymbolicExpressionTreeNodeComparer.cs" />
-    <Compile Include="Matching\SymbolicExpressionTreeNodeSimilarityComparer.cs" />
+    <Compile Include="Converters\LinearModelToTreeConverter.cs" />
+    <Compile Include="Converters\TreeSimplifier.cs" />
+    <Compile Include="Converters\DerivativeCalculator.cs" />
+    <Compile Include="Converters\TreeToAutoDiffTermConverter.cs" />
+    <Compile Include="Creators\SymbolicDataAnalysisExpressionBalancedTreeCreator.cs" />
+    <Compile Include="Crossovers\SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs" />
+    <Compile Include="Formatters\InfixExpressionFormatter.cs" />
+    <Compile Include="Formatters\TSQLExpressionFormatter.cs" />
+    <Compile Include="Formatters\SymbolicDataAnalysisExpressionMathematicaFormatter.cs" />
+    <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" />
+    <Compile Include="Grammars\DataAnalysisGrammar.cs" />
+    <Compile Include="Hashing\HashExtensions.cs" />
+    <Compile Include="Hashing\HashUtil.cs" />
+    <Compile Include="Hashing\SymbolicExpressionTreeHash.cs" />
+    <Compile Include="Importer\InfixExpressionParser.cs" />
+    <Compile Include="Importer\SymbolicExpressionImporter.cs" />
+    <Compile Include="Importer\Token.cs" />
+    <Compile Include="Interfaces\IModelBacktransformator.cs" />
+    <Compile Include="Interfaces\IVariableTreeNode.cs" />
+    <Compile Include="Interfaces\IVariableSymbol.cs" />
+    <Compile Include="Interpreter\BatchInstruction.cs" />
+    <Compile Include="Interpreter\BatchOperations.cs" />
+    <Compile Include="Interpreter\IntervalInterpreter.cs" />
+    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs" />
+    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs" />
+    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs" />
+    <Compile Include="Selectors\DiversitySelector.cs" />
+    <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" />
+    <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" />
+    <Compile Include="SlidingWindow\SlidingWindowAnalyzer.cs" />
+    <Compile Include="SlidingWindow\SlidingWindowBestSolutionsCollection.cs" />
+    <Compile Include="SlidingWindow\SlidingWindowData.cs" />
+    <Compile Include="SlidingWindow\SlidingWindowQualitiesAnalyzer.cs" />
+    <Compile Include="SlidingWindow\SlidingWindowVisualizer.cs" />
+    <Compile Include="SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator.cs" />
+    <Compile Include="SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs" />
+    <Compile Include="SymbolicDataAnalysisModelComplexityCalculator.cs" />
+    <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisVariableFrequencyAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs" />
@@ -217,7 +281,4 @@
     <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionTreeInterpreter.cs" />
     <Compile Include="Interfaces\ISymbolicDataAnalysisProblem.cs" />
-    <Compile Include="SlidingWindow\SlidingWindowQualitiesAnalyzer.cs" />
-    <Compile Include="SlidingWindow\SlidingWindowVisualizer.cs" />
-    <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
     <Compile Include="SymbolicDataAnalysisModel.cs">
       <SubType>Code</SubType>
@@ -232,8 +293,8 @@
     <Compile Include="Interfaces\ISymbolicDataAnalysisAnalyzer.cs" />
     <Compile Include="SymbolicDataAnalysisSingleObjectiveProblem.cs" />
-    <Compile Include="SymbolicDataAnalysisExpressionTreeSimplifier.cs" />
     <Compile Include="SymbolicDataAnalysisProblem.cs" />
     <Compile Include="SymbolicDataAnalysisSolutionImpactValuesCalculator.cs" />
     <Compile Include="Symbols\Addition.cs" />
+    <Compile Include="Symbols\AnalyticQuotient.cs" />
     <Compile Include="Symbols\And.cs" />
     <Compile Include="Symbols\AutoregressiveVariable.cs" />
@@ -244,4 +305,15 @@
     <Compile Include="Symbols\AiryB.cs" />
     <Compile Include="Symbols\Bessel.cs" />
+    <Compile Include="Symbols\BinaryFactorVariable.cs" />
+    <Compile Include="Symbols\BinaryFactorVariableTreeNode.cs" />
+    <Compile Include="Symbols\Cube.cs" />
+    <Compile Include="Symbols\FactorVariableTreeNode.cs" />
+    <Compile Include="Symbols\FactorVariable.cs" />
+    <Compile Include="Symbols\Absolute.cs" />
+    <Compile Include="Symbols\CubeRoot.cs" />
+    <Compile Include="Symbols\HyperbolicTangent.cs" />
+    <Compile Include="Symbols\VariableBase.cs" />
+    <Compile Include="Symbols\VariableTreeNodeBase.cs" />
+    <Compile Include="Symbols\Xor.cs" />
     <Compile Include="Symbols\Erf.cs" />
     <Compile Include="Symbols\Norm.cs" />
@@ -285,4 +357,14 @@
     <Compile Include="Symbols\VariableConditionTreeNode.cs" />
     <Compile Include="Symbols\VariableTreeNode.cs" />
+    <Compile Include="Transformations\SymbolicExpressionTreeBacktransformator.cs" />
+    <Compile Include="Transformations\TransformationToSymbolicTreeMapper.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeBottomUpSimilarityCalculator.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeCanonicalSorter.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeEqualityComparer.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeMatching.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeNodeComparer.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreeNodeEqualityComparer.cs" />
+    <Compile Include="TreeMatching\SymbolicExpressionTreePhenotypicSimilarityCalculator.cs" />
     <None Include="HeuristicLab.snk" />
     <None Include="Plugin.cs.frame" />
@@ -318,5 +400,4 @@
     </BootstrapperPackage>
   </ItemGroup>
-  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
@@ -342,3 +423,6 @@
 </PreBuildEvent>
   </PropertyGroup>
+  <PropertyGroup>
+    <PreBuildEvent />
+  </PropertyGroup>
 </Project>
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs	(revision 17687)
@@ -0,0 +1,548 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  /// <summary>
+  /// Parses mathematical expressions in infix form. E.g. x1 * (3.0 * x2 + x3)
+  /// Identifier format (functions or variables): '_' | letter { '_' | letter | digit }
+  /// Variables names and variable values can be set under quotes "" or '' because variable names might contain spaces. 
+  ///   Variable = ident | " ident " | ' ident ' 
+  /// It is also possible to use functions e.g. log("x1") or real-valued constants e.g. 3.1415 . 
+  /// Variable names are case sensitive. Function names are not case sensitive.
+  /// 
+  /// 
+  /// S             = Expr EOF
+  /// Expr          = ['-' | '+'] Term { '+' Term | '-' Term }
+  /// Term          = Fact { '*' Fact | '/' Fact }
+  /// Fact          = SimpleFact [ '^' SimpleFact ]
+  /// SimpleFact    = '(' Expr ')'
+  ///                 | '{' Expr '}'
+  ///                 | 'LAG' '(' varId ',' ['+' | '-' ] number ')
+  ///                 | funcId '(' ArgList ')'
+  ///                 | VarExpr
+  ///                 | number
+  /// ArgList       = Expr { ',' Expr }
+  /// VarExpr       = varId OptFactorPart
+  /// OptFactorPart = [ ('=' varVal | '[' ['+' | '-' ] number {',' ['+' | '-' ] number } ']' ) ]
+  /// varId         =  ident | ' ident ' | " ident "
+  /// varVal        =  ident | ' ident ' | " ident "
+  /// ident         =  '_' | letter { '_' | letter | digit }
+  /// </summary>
+  public sealed class InfixExpressionParser {
+    private enum TokenType { Operator, Identifier, Number, LeftPar, RightPar, LeftBracket, RightBracket, Comma, Eq, End, NA };
+    private class Token {
+      internal double doubleVal;
+      internal string strVal;
+      internal TokenType TokenType;
+    }
+
+    private class SymbolNameComparer : IEqualityComparer<ISymbol>, IComparer<ISymbol> {
+      public int Compare(ISymbol x, ISymbol y) {
+        return x.Name.CompareTo(y.Name);
+      }
+
+      public bool Equals(ISymbol x, ISymbol y) {
+        return Compare(x, y) == 0;
+      }
+
+      public int GetHashCode(ISymbol obj) {
+        return obj.Name.GetHashCode();
+      }
+    }
+    // format name <-> symbol 
+    // the lookup table is also used in the corresponding formatter
+    internal static readonly BidirectionalLookup<string, ISymbol>
+      knownSymbols = new BidirectionalLookup<string, ISymbol>(StringComparer.InvariantCulture, new SymbolNameComparer());
+
+    private Constant constant = new Constant();
+    private Variable variable = new Variable();
+    private BinaryFactorVariable binaryFactorVar = new BinaryFactorVariable();
+    private FactorVariable factorVar = new FactorVariable();
+
+    private ProgramRootSymbol programRootSymbol = new ProgramRootSymbol();
+    private StartSymbol startSymbol = new StartSymbol();
+
+    static InfixExpressionParser() {
+      // populate bidirectional lookup
+      var dict = new Dictionary<string, ISymbol>
+      {
+        { "+", new Addition()},
+        { "/", new Division()},
+        { "*", new Multiplication()},
+        { "-", new Subtraction()},
+        { "^", new Power() },
+        { "ABS", new Absolute() },
+        { "EXP", new Exponential()},
+        { "LOG", new Logarithm()},
+        { "POW", new Power() },
+        { "ROOT", new Root()},
+        { "SQR", new Square() },
+        { "SQRT", new SquareRoot() },
+        { "CUBE", new Cube() },
+        { "CUBEROOT", new CubeRoot() },
+        { "SIN",new Sine()},
+        { "COS", new Cosine()},
+        { "TAN", new Tangent()},
+        { "TANH", new HyperbolicTangent()},
+        { "AIRYA", new AiryA()},
+        { "AIRYB", new AiryB()},
+        { "BESSEL", new Bessel()},
+        { "COSINT", new CosineIntegral()},
+        { "SININT", new SineIntegral()},
+        { "HYPCOSINT", new HyperbolicCosineIntegral()},
+        { "HYPSININT", new HyperbolicSineIntegral()},
+        { "FRESNELSININT", new FresnelSineIntegral()},
+        { "FRESNELCOSINT", new FresnelCosineIntegral()},
+        { "NORM", new Norm()},
+        { "ERF", new Erf()},
+        { "GAMMA", new Gamma()},
+        { "PSI", new Psi()},
+        { "DAWSON", new Dawson()},
+        { "EXPINT", new ExponentialIntegralEi()},
+        { "AQ", new AnalyticQuotient() },
+        { "MEAN", new Average()},
+        { "IF", new IfThenElse()},
+        { "GT", new GreaterThan()},
+        { "LT", new LessThan()},
+        { "AND", new And()},
+        { "OR", new Or()},
+        { "NOT", new Not()},
+        { "XOR", new Xor()},
+        { "DIFF", new Derivative()},
+        { "LAG", new LaggedVariable() },
+      };
+
+
+      foreach (var kvp in dict) {
+        knownSymbols.Add(kvp.Key, kvp.Value);
+      }
+    }
+
+    public ISymbolicExpressionTree Parse(string str) {
+      ISymbolicExpressionTreeNode root = programRootSymbol.CreateTreeNode();
+      ISymbolicExpressionTreeNode start = startSymbol.CreateTreeNode();
+      var allTokens = GetAllTokens(str).ToArray();
+      ISymbolicExpressionTreeNode mainBranch = ParseS(new Queue<Token>(allTokens));
+
+      // only a main branch was given => insert the main branch into the default tree template
+      root.AddSubtree(start);
+      start.AddSubtree(mainBranch);
+      return new SymbolicExpressionTree(root);
+    }
+
+    private IEnumerable<Token> GetAllTokens(string str) {
+      int pos = 0;
+      while (true) {
+        while (pos < str.Length && Char.IsWhiteSpace(str[pos])) pos++;
+        if (pos >= str.Length) {
+          yield return new Token { TokenType = TokenType.End, strVal = "" };
+          yield break;
+        }
+        if (char.IsDigit(str[pos])) {
+          // read number (=> read until white space or operator or comma)
+          var sb = new StringBuilder();
+          sb.Append(str[pos]);
+          pos++;
+          while (pos < str.Length && !char.IsWhiteSpace(str[pos])
+            && (str[pos] != '+' || str[pos - 1] == 'e' || str[pos - 1] == 'E')     // continue reading exponents
+            && (str[pos] != '-' || str[pos - 1] == 'e' || str[pos - 1] == 'E')
+            && str[pos] != '*'
+            && str[pos] != '/'
+            && str[pos] != '^'
+            && str[pos] != ')'
+            && str[pos] != ']'
+            && str[pos] != '}'
+            && str[pos] != ',') {
+            sb.Append(str[pos]);
+            pos++;
+          }
+          double dblVal;
+          if (double.TryParse(sb.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out dblVal))
+            yield return new Token { TokenType = TokenType.Number, strVal = sb.ToString(), doubleVal = dblVal };
+          else yield return new Token { TokenType = TokenType.NA, strVal = sb.ToString() };
+        } else if (char.IsLetter(str[pos]) || str[pos] == '_') {
+          // read ident
+          var sb = new StringBuilder();
+          sb.Append(str[pos]);
+          pos++;
+          while (pos < str.Length &&
+            (char.IsLetter(str[pos]) || str[pos] == '_' || char.IsDigit(str[pos]))) {
+            sb.Append(str[pos]);
+            pos++;
+          }
+          yield return new Token { TokenType = TokenType.Identifier, strVal = sb.ToString() };
+        } else if (str[pos] == '"') {
+          // read to next " 
+          pos++;
+          var sb = new StringBuilder();
+          while (pos < str.Length && str[pos] != '"') {
+            sb.Append(str[pos]);
+            pos++;
+          }
+          if (pos < str.Length && str[pos] == '"') {
+            pos++; // skip "
+            yield return new Token { TokenType = TokenType.Identifier, strVal = sb.ToString() };
+          } else
+            yield return new Token { TokenType = TokenType.NA };
+
+        } else if (str[pos] == '\'') {
+          // read to next '
+          pos++;
+          var sb = new StringBuilder();
+          while (pos < str.Length && str[pos] != '\'') {
+            sb.Append(str[pos]);
+            pos++;
+          }
+          if (pos < str.Length && str[pos] == '\'') {
+            pos++; // skip '
+            yield return new Token { TokenType = TokenType.Identifier, strVal = sb.ToString() };
+          } else
+            yield return new Token { TokenType = TokenType.NA };
+        } else if (str[pos] == '+') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Operator, strVal = "+" };
+        } else if (str[pos] == '-') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Operator, strVal = "-" };
+        } else if (str[pos] == '/') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Operator, strVal = "/" };
+        } else if (str[pos] == '*') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Operator, strVal = "*" };
+        } else if (str[pos] == '^') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Operator, strVal = "^" };
+        } else if (str[pos] == '(') {
+          pos++;
+          yield return new Token { TokenType = TokenType.LeftPar, strVal = "(" };
+        } else if (str[pos] == ')') {
+          pos++;
+          yield return new Token { TokenType = TokenType.RightPar, strVal = ")" };
+        } else if (str[pos] == '[') {
+          pos++;
+          yield return new Token { TokenType = TokenType.LeftBracket, strVal = "[" };
+        } else if (str[pos] == ']') {
+          pos++;
+          yield return new Token { TokenType = TokenType.RightBracket, strVal = "]" };
+        } else if (str[pos] == '{') {
+          pos++;
+          yield return new Token { TokenType = TokenType.LeftPar, strVal = "{" };
+        } else if (str[pos] == '}') {
+          pos++;
+          yield return new Token { TokenType = TokenType.RightPar, strVal = "}" };
+        } else if (str[pos] == '=') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Eq, strVal = "=" };
+        } else if (str[pos] == ',') {
+          pos++;
+          yield return new Token { TokenType = TokenType.Comma, strVal = "," };
+        } else {
+          throw new ArgumentException("Invalid character: " + str[pos]);
+        }
+      }
+    }
+    /// S             = Expr EOF
+    private ISymbolicExpressionTreeNode ParseS(Queue<Token> tokens) {
+      var expr = ParseExpr(tokens);
+
+      var endTok = tokens.Dequeue();
+      if (endTok.TokenType != TokenType.End)
+        throw new ArgumentException(string.Format("Expected end of expression (got {0})", endTok.strVal));
+
+      return expr;
+    }
+
+    /// Expr          = ['-' | '+'] Term { '+' Term | '-' Term }
+    private ISymbolicExpressionTreeNode ParseExpr(Queue<Token> tokens) {
+      var next = tokens.Peek();
+      var posTerms = new List<ISymbolicExpressionTreeNode>();
+      var negTerms = new List<ISymbolicExpressionTreeNode>();
+      bool negateFirstTerm = false;
+      if (next.TokenType == TokenType.Operator && (next.strVal == "+" || next.strVal == "-")) {
+        tokens.Dequeue();
+        if (next.strVal == "-")
+          negateFirstTerm = true;
+      }
+      var t = ParseTerm(tokens);
+      if (negateFirstTerm) negTerms.Add(t);
+      else posTerms.Add(t);
+
+      next = tokens.Peek();
+      while (next.strVal == "+" || next.strVal == "-") {
+        switch (next.strVal) {
+          case "+": {
+              tokens.Dequeue();
+              var term = ParseTerm(tokens);
+              posTerms.Add(term);
+              break;
+            }
+          case "-": {
+              tokens.Dequeue();
+              var term = ParseTerm(tokens);
+              negTerms.Add(term);
+              break;
+            }
+        }
+        next = tokens.Peek();
+      }
+
+      var sum = GetSymbol("+").CreateTreeNode();
+      foreach (var posTerm in posTerms) sum.AddSubtree(posTerm);
+      if (negTerms.Any()) {
+        if (negTerms.Count == 1) {
+          var sub = GetSymbol("-").CreateTreeNode();
+          sub.AddSubtree(negTerms.Single());
+          sum.AddSubtree(sub);
+        } else {
+          var sumNeg = GetSymbol("+").CreateTreeNode();
+          foreach (var negTerm in negTerms) sumNeg.AddSubtree(negTerm);
+
+          var constNode = (ConstantTreeNode)constant.CreateTreeNode();
+          constNode.Value = -1.0;
+          var prod = GetSymbol("*").CreateTreeNode();
+          prod.AddSubtree(constNode);
+          prod.AddSubtree(sumNeg);
+
+          sum.AddSubtree(prod);
+        }
+      }
+      if (sum.SubtreeCount == 1) return sum.Subtrees.First();
+      else return sum;
+    }
+
+    private ISymbol GetSymbol(string tok) {
+      var symb = knownSymbols.GetByFirst(tok).FirstOrDefault();
+      if (symb == null) throw new ArgumentException(string.Format("Unknown token {0} found.", tok));
+      return symb;
+    }
+
+    /// Term          = Fact { '*' Fact | '/' Fact }
+    private ISymbolicExpressionTreeNode ParseTerm(Queue<Token> tokens) {
+      var factors = new List<ISymbolicExpressionTreeNode>();
+      var firstFactor = ParseFact(tokens);
+      factors.Add(firstFactor);
+
+      var next = tokens.Peek();
+      while (next.strVal == "*" || next.strVal == "/") {
+        switch (next.strVal) {
+          case "*": {
+              tokens.Dequeue();
+              var fact = ParseFact(tokens);
+              factors.Add(fact);
+              break;
+            }
+          case "/": {
+              tokens.Dequeue();
+              var invFact = ParseFact(tokens);
+              var divNode = GetSymbol("/").CreateTreeNode(); // 1/x
+              divNode.AddSubtree(invFact);
+              factors.Add(divNode);
+              break;
+            }
+        }
+
+        next = tokens.Peek();
+      }
+      if (factors.Count == 1) return factors.First();
+      else {
+        var prod = GetSymbol("*").CreateTreeNode();
+        foreach (var f in factors) prod.AddSubtree(f);
+        return prod;
+      }
+    }
+
+    // Fact = SimpleFact ['^' SimpleFact]
+    private ISymbolicExpressionTreeNode ParseFact(Queue<Token> tokens) {
+      var expr = ParseSimpleFact(tokens);
+      var next = tokens.Peek();
+      if (next.TokenType == TokenType.Operator && next.strVal == "^") {
+        tokens.Dequeue(); // skip;
+
+        var p = GetSymbol("^").CreateTreeNode();
+        p.AddSubtree(expr);
+        p.AddSubtree(ParseSimpleFact(tokens));
+        expr = p;
+      }
+      return expr;
+    }
+
+
+    /// SimpleFact   = '(' Expr ')' 
+    ///                 | '{' Expr '}'
+    ///                 | 'LAG' '(' varId ',' ['+' | '-' ] number ')'
+    ///                 | funcId '(' ArgList ')
+    ///                 | VarExpr
+    ///                 | number
+    /// ArgList       = Expr { ',' Expr }
+    /// VarExpr       = varId OptFactorPart
+    /// OptFactorPart = [ ('=' varVal | '[' ['+' | '-' ] number {',' ['+' | '-' ] number } ']' ) ]
+    /// varId         =  ident | ' ident ' | " ident "
+    /// varVal        =  ident | ' ident ' | " ident "
+    /// ident         =  '_' | letter { '_' | letter | digit }
+    private ISymbolicExpressionTreeNode ParseSimpleFact(Queue<Token> tokens) {
+      var next = tokens.Peek();
+      if (next.TokenType == TokenType.LeftPar) {
+        var initPar = tokens.Dequeue(); // match par type
+        var expr = ParseExpr(tokens);
+        var rPar = tokens.Dequeue();
+        if (rPar.TokenType != TokenType.RightPar)
+          throw new ArgumentException("expected closing parenthesis");
+        if (initPar.strVal == "(" && rPar.strVal == "}")
+          throw new ArgumentException("expected closing )");
+        if (initPar.strVal == "{" && rPar.strVal == ")")
+          throw new ArgumentException("expected closing }");
+        return expr;
+      } else if (next.TokenType == TokenType.Identifier) {
+        var idTok = tokens.Dequeue();
+        if (tokens.Peek().TokenType == TokenType.LeftPar) {
+          // function identifier or LAG
+          var funcId = idTok.strVal.ToUpperInvariant();
+
+          var funcNode = GetSymbol(funcId).CreateTreeNode();
+          var lPar = tokens.Dequeue();
+          if (lPar.TokenType != TokenType.LeftPar)
+            throw new ArgumentException("expected (");
+
+          // handle 'lag' specifically
+          if (funcNode.Symbol is LaggedVariable) {
+            var varId = tokens.Dequeue();
+            if (varId.TokenType != TokenType.Identifier) throw new ArgumentException("Identifier expected. Format for lagged variables: \"lag(x, -1)\"");
+            var comma = tokens.Dequeue();
+            if (comma.TokenType != TokenType.Comma) throw new ArgumentException("',' expected, Format for lagged variables: \"lag(x, -1)\"");
+            double sign = 1.0;
+            if (tokens.Peek().strVal == "+" || tokens.Peek().strVal == "-") {
+              // read sign
+              var signTok = tokens.Dequeue();
+              if (signTok.strVal == "-") sign = -1.0;
+            }
+            var lagToken = tokens.Dequeue();
+            if (lagToken.TokenType != TokenType.Number) throw new ArgumentException("Number expected, Format for lagged variables: \"lag(x, -1)\"");
+            if (!lagToken.doubleVal.IsAlmost(Math.Round(lagToken.doubleVal)))
+              throw new ArgumentException("Time lags must be integer values");
+            var laggedVarNode = funcNode as LaggedVariableTreeNode;
+            laggedVarNode.VariableName = varId.strVal;
+            laggedVarNode.Lag = (int)Math.Round(sign * lagToken.doubleVal);
+            laggedVarNode.Weight = 1.0;
+          } else {
+            // functions
+            var args = ParseArgList(tokens);
+            // check number of arguments
+            if (funcNode.Symbol.MinimumArity > args.Length || funcNode.Symbol.MaximumArity < args.Length) {
+              throw new ArgumentException(string.Format("Symbol {0} requires between {1} and  {2} arguments.", funcId,
+                funcNode.Symbol.MinimumArity, funcNode.Symbol.MaximumArity));
+            }
+            foreach (var arg in args) funcNode.AddSubtree(arg);
+          }
+
+          var rPar = tokens.Dequeue();
+          if (rPar.TokenType != TokenType.RightPar)
+            throw new ArgumentException("expected )");
+
+
+          return funcNode;
+        } else {
+          // variable
+          if (tokens.Peek().TokenType == TokenType.Eq) {
+            // binary factor
+            tokens.Dequeue(); // skip Eq
+            var valTok = tokens.Dequeue();
+            if (valTok.TokenType != TokenType.Identifier) throw new ArgumentException("expected identifier");
+            var binFactorNode = (BinaryFactorVariableTreeNode)binaryFactorVar.CreateTreeNode();
+            binFactorNode.Weight = 1.0;
+            binFactorNode.VariableName = idTok.strVal;
+            binFactorNode.VariableValue = valTok.strVal;
+            return binFactorNode;
+          } else if (tokens.Peek().TokenType == TokenType.LeftBracket) {
+            // factor variable
+            var factorVariableNode = (FactorVariableTreeNode)factorVar.CreateTreeNode();
+            factorVariableNode.VariableName = idTok.strVal;
+
+            tokens.Dequeue(); // skip [
+            var weights = new List<double>();
+            // at least one weight is necessary
+            var sign = 1.0;
+            if (tokens.Peek().TokenType == TokenType.Operator) {
+              var opToken = tokens.Dequeue();
+              if (opToken.strVal == "+") sign = 1.0;
+              else if (opToken.strVal == "-") sign = -1.0;
+              else throw new ArgumentException();
+            }
+            if (tokens.Peek().TokenType != TokenType.Number) throw new ArgumentException("number expected");
+            var weightTok = tokens.Dequeue();
+            weights.Add(sign * weightTok.doubleVal);
+            while (tokens.Peek().TokenType == TokenType.Comma) {
+              // skip comma
+              tokens.Dequeue();
+              if (tokens.Peek().TokenType == TokenType.Operator) {
+                var opToken = tokens.Dequeue();
+                if (opToken.strVal == "+") sign = 1.0;
+                else if (opToken.strVal == "-") sign = -1.0;
+                else throw new ArgumentException();
+              }
+              weightTok = tokens.Dequeue();
+              if (weightTok.TokenType != TokenType.Number) throw new ArgumentException("number expected");
+              weights.Add(sign * weightTok.doubleVal);
+            }
+            var rightBracketToken = tokens.Dequeue();
+            if (rightBracketToken.TokenType != TokenType.RightBracket) throw new ArgumentException("closing bracket ] expected");
+            factorVariableNode.Weights = weights.ToArray();
+            return factorVariableNode;
+          } else {
+            // variable
+            var varNode = (VariableTreeNode)variable.CreateTreeNode();
+            varNode.Weight = 1.0;
+            varNode.VariableName = idTok.strVal;
+            return varNode;
+          }
+        }
+      } else if (next.TokenType == TokenType.Number) {
+        var numTok = tokens.Dequeue();
+        var constNode = (ConstantTreeNode)constant.CreateTreeNode();
+        constNode.Value = numTok.doubleVal;
+        return constNode;
+      } else {
+        throw new ArgumentException(string.Format("unexpected token in expression {0}", next.strVal));
+      }
+    }
+
+    // ArgList = Expr { ',' Expr }
+    private ISymbolicExpressionTreeNode[] ParseArgList(Queue<Token> tokens) {
+      var exprList = new List<ISymbolicExpressionTreeNode>();
+      exprList.Add(ParseExpr(tokens));
+      while (tokens.Peek().TokenType != TokenType.RightPar) {
+        var comma = tokens.Dequeue();
+        if (comma.TokenType != TokenType.Comma) throw new ArgumentException("expected ',' ");
+        exprList.Add(ParseExpr(tokens));
+      }
+      return exprList.ToArray();
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs	(revision 17687)
@@ -0,0 +1,282 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class SymbolicExpressionImporter {
+    private const string VARSTART = "VAR";
+    private const string LAGGEDVARSTART = "LAGVARIABLE";
+    private const string INTEGRALSTART = "INTEG";
+    private const string DEFUNSTART = "DEFUN";
+    private const string ARGSTART = "ARG";
+    private const string INVOKESTART = "CALL";
+    private const string TIMELAGSTART = "LAG";
+    private Dictionary<string, Symbol> knownSymbols = new Dictionary<string, Symbol>()
+      {
+        {"+", new Addition()},
+        {"/", new Division()},
+        {"*", new Multiplication()},
+        {"-", new Subtraction()},
+        {"ABS", new Absolute() },
+        {"EXP", new Exponential()},
+        {"LOG", new Logarithm()},
+        {"POW", new Power()},
+        {"ROOT", new Root()},
+        {"SQR", new Square()},
+        {"SQRT", new SquareRoot()},
+        {"CUBE", new Cube()},
+        {"CUBEROOT", new CubeRoot()},
+        {"SIN",new Sine()},
+        {"COS", new Cosine()},
+        {"TAN", new Tangent()},
+        {"TANH", new HyperbolicTangent ()},
+        {"AIRYA", new AiryA()},
+        {"AIRYB", new AiryB()},
+        {"BESSEL", new Bessel()},
+        {"COSINT", new CosineIntegral()},
+        {"SININT", new SineIntegral()},
+        {"HYPCOSINT", new HyperbolicCosineIntegral()},
+        {"HYPSININT", new HyperbolicSineIntegral()},
+        {"FRESNELSININT", new FresnelSineIntegral()},
+        {"FRESNELCOSINT", new FresnelCosineIntegral()},
+        {"NORM", new Norm()},
+        {"ERF", new Erf()},
+        {"GAMMA", new Gamma()},
+        {"PSI", new Psi()},
+        {"DAWSON", new Dawson()},
+        {"EXPINT", new ExponentialIntegralEi()},
+        {"AQ", new AnalyticQuotient() },
+        {"MEAN", new Average()},
+        {"IF", new IfThenElse()},
+        {">", new GreaterThan()},
+        {"<", new LessThan()},
+        {"AND", new And()},
+        {"OR", new Or()},
+        {"NOT", new Not()},
+        {"XOR", new Xor()},
+        {"DIFF", new Derivative()},
+        {"PROG", new ProgramRootSymbol()},
+        {"MAIN", new StartSymbol()},
+        {"FACTOR", new FactorVariable() },
+        {"BINFACTOR", new BinaryFactorVariable()}
+      };
+
+    Constant constant = new Constant();
+    Variable variable = new Variable();
+    LaggedVariable laggedVariable = new LaggedVariable();
+    Defun defun = new Defun();
+    TimeLag timeLag = new TimeLag();
+    Integral integral = new Integral();
+    FactorVariable factorVar = new FactorVariable();
+    BinaryFactorVariable binFactorVar = new BinaryFactorVariable();
+
+    ProgramRootSymbol programRootSymbol = new ProgramRootSymbol();
+    StartSymbol startSymbol = new StartSymbol();
+
+    public ISymbolicExpressionTree Import(string str) {
+      str = str.Replace("(", " ( ").Replace(")", " ) ");
+      ISymbolicExpressionTreeNode root = programRootSymbol.CreateTreeNode();
+      ISymbolicExpressionTreeNode start = startSymbol.CreateTreeNode();
+      ISymbolicExpressionTreeNode mainBranch = ParseSexp(new Queue<Token>(GetTokenStream(str)));
+      if (mainBranch.Symbol is ProgramRootSymbol) {
+        // when a root symbol was parsed => use main branch as root
+        root = mainBranch;
+      } else {
+        // only a main branch was given => insert the main branch into the default tree template
+        root.AddSubtree(start);
+        start.AddSubtree(mainBranch);
+      }
+      return new SymbolicExpressionTree(root);
+    }
+
+    private IEnumerable<Token> GetTokenStream(string str) {
+      return
+             from strToken in str.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).AsEnumerable()
+             let t = Token.Parse(strToken)
+             where t != null
+             select t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseSexp(Queue<Token> tokens) {
+      if (tokens.Peek().Symbol == TokenSymbol.LPAR) {
+        ISymbolicExpressionTreeNode tree;
+        Expect(Token.LPAR, tokens);
+        if (tokens.Peek().StringValue.StartsWith(VARSTART)) {
+          tree = ParseVariable(tokens);
+        } else if (tokens.Peek().StringValue.StartsWith(LAGGEDVARSTART)) {
+          tree = ParseLaggedVariable(tokens);
+        } else if (tokens.Peek().StringValue.StartsWith(TIMELAGSTART)) {
+          tree = ParseTimeLag(tokens);
+          tree.AddSubtree(ParseSexp(tokens));
+        } else if (tokens.Peek().StringValue.StartsWith(INTEGRALSTART)) {
+          tree = ParseIntegral(tokens);
+          tree.AddSubtree(ParseSexp(tokens));
+        } else if (tokens.Peek().StringValue.StartsWith(DEFUNSTART)) {
+          tree = ParseDefun(tokens);
+          while (!tokens.Peek().Equals(Token.RPAR)) {
+            tree.AddSubtree(ParseSexp(tokens));
+          }
+        } else if (tokens.Peek().StringValue.StartsWith(ARGSTART)) {
+          tree = ParseArgument(tokens);
+        } else if (tokens.Peek().StringValue.StartsWith(INVOKESTART)) {
+          tree = ParseInvoke(tokens);
+          while (!tokens.Peek().Equals(Token.RPAR)) {
+            tree.AddSubtree(ParseSexp(tokens));
+          }
+        } else if (tokens.Peek().StringValue.StartsWith("FACTOR")) {
+          tree = ParseFactor(tokens);
+        } else if (tokens.Peek().StringValue.StartsWith("BINFACTOR")) {
+          tree = ParseBinaryFactor(tokens);
+        } else {
+          Token curToken = tokens.Dequeue();
+          tree = CreateTree(curToken);
+          while (!tokens.Peek().Equals(Token.RPAR)) {
+            tree.AddSubtree(ParseSexp(tokens));
+          }
+        }
+        Expect(Token.RPAR, tokens);
+        return tree;
+      } else if (tokens.Peek().Symbol == TokenSymbol.NUMBER) {
+        ConstantTreeNode t = (ConstantTreeNode)constant.CreateTreeNode();
+        t.Value = tokens.Dequeue().DoubleValue;
+        return t;
+      } else throw new FormatException("Expected function or constant symbol");
+    }
+
+    private ISymbolicExpressionTreeNode ParseInvoke(Queue<Token> tokens) {
+      Token invokeTok = tokens.Dequeue();
+      Debug.Assert(invokeTok.StringValue == "CALL");
+      InvokeFunction invokeSym = new InvokeFunction(tokens.Dequeue().StringValue);
+      ISymbolicExpressionTreeNode invokeNode = invokeSym.CreateTreeNode();
+      return invokeNode;
+    }
+
+    private ISymbolicExpressionTreeNode ParseArgument(Queue<Token> tokens) {
+      Token argTok = tokens.Dequeue();
+      Debug.Assert(argTok.StringValue == "ARG");
+      Argument argument = new Argument((int)tokens.Dequeue().DoubleValue);
+      ISymbolicExpressionTreeNode argNode = argument.CreateTreeNode();
+      return argNode;
+    }
+
+    private ISymbolicExpressionTreeNode ParseDefun(Queue<Token> tokens) {
+      Token defTok = tokens.Dequeue();
+      Debug.Assert(defTok.StringValue == "DEFUN");
+      DefunTreeNode t = (DefunTreeNode)defun.CreateTreeNode();
+      t.FunctionName = tokens.Dequeue().StringValue;
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseTimeLag(Queue<Token> tokens) {
+      Token varTok = tokens.Dequeue();
+      Debug.Assert(varTok.StringValue == "LAG");
+      LaggedTreeNode t = (LaggedTreeNode)timeLag.CreateTreeNode();
+      t.Lag = (int)tokens.Dequeue().DoubleValue;
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseIntegral(Queue<Token> tokens) {
+      Token varTok = tokens.Dequeue();
+      Debug.Assert(varTok.StringValue == "INTEGRAL");
+      LaggedTreeNode t = (LaggedTreeNode)integral.CreateTreeNode();
+      t.Lag = (int)tokens.Dequeue().DoubleValue;
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseVariable(Queue<Token> tokens) {
+      Token varTok = tokens.Dequeue();
+      Debug.Assert(varTok.StringValue == "VARIABLE");
+      VariableTreeNode t = (VariableTreeNode)variable.CreateTreeNode();
+      t.Weight = tokens.Dequeue().DoubleValue;
+      t.VariableName = tokens.Dequeue().StringValue;
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseFactor(Queue<Token> tokens) {
+      Token tok = tokens.Dequeue();
+      Debug.Assert(tok.StringValue == "FACTOR");
+      FactorVariableTreeNode t = (FactorVariableTreeNode)(new FactorVariable()).CreateTreeNode(); // create a new symbol each time on purpose
+      var varNameTok = tokens.Dequeue();
+      Debug.Assert(tok.Symbol == TokenSymbol.SYMB);
+      t.VariableName = varNameTok.StringValue;
+
+      var weights = new List<double>();
+      while (tokens.Peek().Symbol == TokenSymbol.NUMBER) {
+        weights.Add(tokens.Dequeue().DoubleValue);
+      }
+
+      t.Weights = weights.ToArray();
+
+      // create a set of (virtual) values to match the number of weights
+      t.Symbol.VariableNames = new string[] { t.VariableName };
+      t.Symbol.VariableValues = new[]
+      { new KeyValuePair<string, Dictionary<string,int>>(
+        t.VariableName,
+        weights.Select((_, i) => Tuple.Create(_,i)).ToDictionary(tup=>"X" + tup.Item2, tup=>tup.Item2)) };
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode ParseBinaryFactor(Queue<Token> tokens) {
+      Token tok = tokens.Dequeue();
+      Debug.Assert(tok.StringValue == "BINFACTOR");
+      var t = (BinaryFactorVariableTreeNode)binFactorVar.CreateTreeNode();
+      var varNameTok = tokens.Dequeue();
+      Debug.Assert(varNameTok.Symbol == TokenSymbol.SYMB);
+      t.VariableName = varNameTok.StringValue;
+
+      var varValTok = tokens.Dequeue();
+      Debug.Assert(varValTok.Symbol == TokenSymbol.SYMB);
+      t.VariableValue = varValTok.StringValue;
+
+      var weightTok = tokens.Dequeue();
+      Debug.Assert(weightTok.Symbol == TokenSymbol.NUMBER);
+      t.Weight = weightTok.DoubleValue;
+
+      return t;
+    }
+
+
+    private ISymbolicExpressionTreeNode ParseLaggedVariable(Queue<Token> tokens) {
+      Token varTok = tokens.Dequeue();
+      Debug.Assert(varTok.StringValue == "LAGVARIABLE");
+      LaggedVariableTreeNode t = (LaggedVariableTreeNode)laggedVariable.CreateTreeNode();
+      t.Weight = tokens.Dequeue().DoubleValue;
+      t.VariableName = tokens.Dequeue().StringValue;
+      t.Lag = (int)tokens.Dequeue().DoubleValue;
+      return t;
+    }
+
+    private ISymbolicExpressionTreeNode CreateTree(Token token) {
+      if (token.Symbol != TokenSymbol.SYMB) throw new FormatException("Expected function symbol, but got: " + token.StringValue);
+      return knownSymbols[token.StringValue].CreateTreeNode();
+    }
+
+    private void Expect(Token token, Queue<Token> tokens) {
+      Token cur = tokens.Dequeue();
+      if (!token.Equals(cur)) throw new FormatException("Expected: " + token.StringValue + ", but got: " + cur.StringValue);
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/Token.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/Token.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/Token.cs	(revision 17687)
@@ -0,0 +1,67 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  internal enum TokenSymbol { LPAR, RPAR, SYMB, NUMBER };
+  internal class Token {
+    public static readonly Token LPAR = Token.Parse("(");
+    public static readonly Token RPAR = Token.Parse(")");
+
+    public TokenSymbol Symbol { get; set; }
+    public string StringValue { get; set; }
+    public double DoubleValue { get; set; }
+    public Token() { }
+
+    public override bool Equals(object obj) {
+      Token other = (obj as Token);
+      if (other == null) return false;
+      if (other.Symbol != Symbol) return false;
+      return other.StringValue == this.StringValue;
+    }
+
+    public override int GetHashCode() {
+      return Symbol.GetHashCode() & StringValue.GetHashCode();
+    }
+
+    public static Token Parse(string strToken) {
+      strToken = strToken.Trim();
+      Token t = new Token();
+      t.StringValue = strToken.Trim();
+      double temp;
+      if (strToken == "") {
+        t = null;
+      } else if (strToken == "(") {
+        t.Symbol = TokenSymbol.LPAR;
+      } else if (strToken == ")") {
+        t.Symbol = TokenSymbol.RPAR;
+      } else if (double.TryParse(strToken, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out temp)) {
+        t.Symbol = TokenSymbol.NUMBER;
+        t.DoubleValue = double.Parse(strToken, CultureInfo.InvariantCulture.NumberFormat);
+      } else {
+        t.Symbol = TokenSymbol.SYMB;
+        t.StringValue = t.StringValue.ToUpper();
+      }
+      return t;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IModelBacktransformator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IModelBacktransformator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IModelBacktransformator.cs	(revision 17687)
@@ -0,0 +1,30 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("4efb3867-0439-4b87-b479-f7daab7fc00c")]
+  public interface IModelBacktransformator {
+    ISymbolicDataAnalysisModel Backtransform(ISymbolicDataAnalysisModel model, IEnumerable<ITransformation> transformations, string targetVariable);
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,9 +20,10 @@
 #endregion
 using HeuristicLab.Core;
-using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("fe8b44e0-da46-4b1e-bbb2-b0b9cd7eff1d")]
   public interface ISymbolicDataAnalysisAnalyzer : IAnalyzer {
     IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisBoundedOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisBoundedOperator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisBoundedOperator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,5 +21,8 @@
 
 using HeuristicLab.Core;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("907f1d0c-32a1-483a-9cdc-210e4d02383b")]
   public interface ISymbolicDataAnalysisBoundedOperator : IOperator {
     IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,5 +23,8 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("2b2905bb-f628-4e13-9927-2828d6604aed")]
   public interface ISymbolicDataAnalysisEvaluator<T> : IEvaluator
   where T : class,IDataAnalysisProblemData {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionCrossover.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionCrossover.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionCrossover.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,6 +23,8 @@
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("0cf78789-b5e9-40b4-ba6a-461a16c802f1")]
   public interface ISymbolicDataAnalysisExpressionCrossover<T> : ISymbolicExpressionTreeCrossover,
     ISymbolicExpressionTreeSizeConstraintOperator, ISymbolicDataAnalysisInterpreterOperator
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionTreeInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,11 +22,12 @@
 using System.Collections.Generic;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("6877d63a-8e79-4fea-a2d2-73574ee274c6")]
   public interface ISymbolicDataAnalysisExpressionTreeInterpreter : INamedItem, IStatefulItem {
-    IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows);
-    IntValue EvaluatedSolutions { get; set; }
+    IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows);
+    int EvaluatedSolutions { get; set; }
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisGrammar.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisGrammar.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisGrammar.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,8 +20,11 @@
 #endregion
 
+using HEAL.Attic;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("5b0720d7-b1f0-4c2f-893e-cd2549e20e9e")]
   public interface ISymbolicDataAnalysisGrammar : ISymbolicExpressionGrammar {
+    void ConfigureVariableSymbols(IDataAnalysisProblemData problemData);
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisImpactValuesCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisImpactValuesCalculator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisImpactValuesCalculator.cs	(revision 17687)
@@ -2,11 +2,11 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("b00d5149-fa66-4096-ba46-3258cbd1f42b")]
   public interface ISymbolicDataAnalysisSolutionImpactValuesCalculator : IItem {
-    double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows);
-    double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN);
     void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData,
-      IEnumerable<int> rows, out double impactValue, out double replacementValue, double originalQuality = double.NaN);
+      IEnumerable<int> rows, out double impactValue, out double replacementValue, out double newQualityForImpactsCalculation, double qualityForImpactsCalculation = double.NaN);
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisInterpreterOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisInterpreterOperator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisInterpreterOperator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,6 +21,8 @@
 
 using HeuristicLab.Core;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("56f4827e-3ebf-4638-a79e-bf6814a58d60")]
   public interface ISymbolicDataAnalysisInterpreterOperator : IOperator {
     ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,5 +21,8 @@
 
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("62aff7f8-5ae1-4e58-966e-92e388cb067f")]
   public interface ISymbolicDataAnalysisModel : IDataAnalysisModel {
     ISymbolicExpressionTree SymbolicExpressionTree { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,5 +21,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("46b43be7-4607-4e1a-83f0-f51da9338de6")]
   public interface ISymbolicDataAnalysisMultiObjectiveAnalyzer : ISymbolicDataAnalysisAnalyzer {
     IScopeTreeLookupParameter<DoubleArray> QualitiesParameter { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisMultiObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,6 +25,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("43c3d78e-6ece-4955-80cd-68595c78cd03")]
   public interface ISymbolicDataAnalysisMultiObjectiveEvaluator<T> : ISymbolicDataAnalysisEvaluator<T>, IMultiObjectiveEvaluator
   where T : class,IDataAnalysisProblemData {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,6 +23,8 @@
 using HeuristicLab.Data;
 using HeuristicLab.Optimization;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("17dc51c4-499c-49dc-b3ac-72364358f7e7")]
   public interface ISymbolicDataAnalysisProblem : IDataAnalysisProblem, IHeuristicOptimizationProblem {
     IValueParameter<ISymbolicDataAnalysisGrammar> SymbolicExpressionTreeGrammarParameter { get; }
@@ -47,5 +49,8 @@
   }
 
+  [StorableType("07b08ca0-40cb-433e-8aed-72df06a87d62")]
   public interface ISymbolicDataAnalysisSingleObjectiveProblem : ISymbolicDataAnalysisProblem, ISingleObjectiveHeuristicOptimizationProblem { }
+
+  [StorableType("1c5a0cf4-1286-45d8-b126-a6f5ddccf7bf")]
   public interface ISymbolicDataAnalysisMultiObjectiveProblem : ISymbolicDataAnalysisProblem, IMultiObjectiveHeuristicOptimizationProblem { }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,8 +21,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("f2c0ca54-a2a9-49b8-9f5f-734368000f68")]
   public interface ISymbolicDataAnalysisSingleObjectiveAnalyzer : ISymbolicDataAnalysisAnalyzer {
     IScopeTreeLookupParameter<DoubleValue> QualityParameter { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveEvaluator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveEvaluator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSingleObjectiveEvaluator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,5 +24,8 @@
 using System.Collections.Generic;
 using HeuristicLab.Core;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("2564fc97-080d-4153-8f3a-db764bd06d09")]
   public interface ISymbolicDataAnalysisSingleObjectiveEvaluator<T> : ISymbolicDataAnalysisEvaluator<T>, ISingleObjectiveEvaluator
     where T : class,IDataAnalysisProblemData {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSolution.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSolution.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSolution.cs	(revision 17687)
@@ -1,5 +1,6 @@
-﻿#region License Information
+﻿using HEAL.Attic;
+#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,4 +23,5 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("8a9461b9-bc39-4fe5-8cab-12ce45977564")]
   public interface ISymbolicDataAnalysisSolution : IDataAnalysisSolution {
     new ISymbolicDataAnalysisModel Model { get; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSolutionCreator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSolutionCreator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisSolutionCreator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,5 +22,8 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("8d1af4bf-dc4b-45cd-abdc-894b8c353fc5")]
   public interface ISymbolicDataAnalysisSolutionCreator : ISymbolicExpressionTreeCreator, ISolutionCreator {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisValidationAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisValidationAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisValidationAnalyzer.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,5 +21,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("c758eecc-12c0-46d8-839e-5c59af7ff095")]
   public interface ISymbolicDataAnalysisValidationAnalyzer<T, U> : ISymbolicDataAnalysisAnalyzer, ISymbolicDataAnalysisInterpreterOperator
     where T : class,ISymbolicDataAnalysisEvaluator<U>
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IVariableSymbol.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IVariableSymbol.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IVariableSymbol.cs	(revision 17687)
@@ -0,0 +1,32 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("3b28c671-df09-4f2c-9292-b3510b593c5f")]
+  /// <summary>
+  /// Any symbol that references a variable (includes terminal as well as non-terminal symbols)
+  /// </summary>
+  public interface IVariableSymbol : ISymbol {
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IVariableTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IVariableTreeNode.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/IVariableTreeNode.cs	(revision 17687)
@@ -0,0 +1,33 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("cc5c792d-09a8-4351-8438-bd8482d8aa03")]
+  /// <summary>
+  /// Any tree node that references a variable 
+  /// </summary>
+  public interface IVariableTreeNode : ISymbolicExpressionTreeNode {
+    string VariableName { get; }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchInstruction.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchInstruction.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchInstruction.cs	(revision 17687)
@@ -0,0 +1,12 @@
+﻿namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public struct BatchInstruction {
+    public byte opcode;
+    public ushort narg;
+    public int childIndex;
+
+    public double value; // for constants
+    public double weight; // for variables
+    public double[] buf;
+    public double[] data; // to hold dataset data
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs	(revision 17687)
@@ -0,0 +1,116 @@
+﻿using System;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class BatchOperations {
+    public const int BATCHSIZE = 64;
+
+    public static void Load(double[] a, double[] b) {
+      Array.Copy(b, a, BATCHSIZE);
+    }
+
+    public static void Add(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i) {
+        a[i] += b[i];
+      }
+    }
+
+    public static void Sub(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i) {
+        a[i] -= b[i];
+      }
+    }
+
+    public static void Div(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i) {
+        a[i] /= b[i];
+      }
+    }
+
+    public static void Mul(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i) {
+        a[i] *= b[i];
+      }
+    }
+
+    public static void Neg(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i) {
+        a[i] = -b[i];
+      }
+    }
+
+    public static void Inv(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i) {
+        a[i] = 1 / b[i];
+      }
+    }
+
+    public static void Log(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Log(b[i]);
+    }
+
+    public static void Exp(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Exp(b[i]);
+    }
+
+    public static void Sin(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Sin(b[i]);
+    }
+
+    public static void Cos(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Cos(b[i]);
+    }
+
+    public static void Tan(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Tan(b[i]);
+    }
+    public static void Tanh(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Tanh(b[i]);
+    }
+
+    public static void Pow(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Pow(a[i], Math.Round(b[i]));
+    }
+
+    public static void Root(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Pow(a[i], 1 / Math.Round(b[i]));
+    }
+
+    public static void Square(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Pow(b[i], 2d);
+    }
+
+    public static void Sqrt(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Sqrt(b[i]);
+    }
+
+    public static void Cube(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Pow(b[i], 3d);
+    }
+
+    public static void CubeRoot(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = b[i] < 0 ? -Math.Pow(-b[i], 1d / 3d) : Math.Pow(b[i], 1d / 3d);
+    }
+
+    public static void Absolute(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = Math.Abs(b[i]);
+    }
+
+    public static void AnalyticQuotient(double[] a, double[] b) {
+      for (int i = 0; i < BATCHSIZE; ++i)
+        a[i] = a[i] / Math.Sqrt(1d + b[i] * b[i]);
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/InterpreterState.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/InterpreterState.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/InterpreterState.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs	(revision 17687)
@@ -0,0 +1,306 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("DE6C1E1E-D7C1-4070-847E-63B68562B10C")]
+  [Item("IntervalInterpreter", "Intperter for calculation of intervals of symbolic models.")]
+  public sealed class IntervalInterpreter : ParameterizedNamedItem, IStatefulItem {
+
+    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
+
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
+    }
+
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    private IntervalInterpreter(StorableConstructorFlag _) : base(_) { }
+    private IntervalInterpreter(IntervalInterpreter original, Cloner cloner)
+        : base(original, cloner) { }
+
+    public IntervalInterpreter()
+        : base("IntervalInterpreter", "Intperter for calculation of intervals of symbolic models.") {
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new IntervalInterpreter(this, cloner);
+    }
+
+    private readonly object syncRoot = new object();
+
+    #region IStatefulItem Members
+    public void InitializeState() {
+      EvaluatedSolutions = 0;
+    }
+    public void ClearState() { }
+    #endregion
+
+    public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows = null) {
+      var variableRanges = DatasetUtil.GetVariableRanges(dataset, rows);
+      return GetSymbolicExpressionTreeInterval(tree, variableRanges);
+    }
+
+    public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree, IDataset dataset,
+      out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals, IEnumerable<int> rows = null) {
+      var variableRanges = DatasetUtil.GetVariableRanges(dataset, rows);
+      return GetSymbolicExpressionTreeIntervals(tree, variableRanges, out nodeIntervals);
+    }
+
+    public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) {
+      lock (syncRoot) {
+        EvaluatedSolutions++;
+      }
+      int instructionCount = 0;
+      var instructions = PrepareInterpreterState(tree, variableRanges);
+      var outputInterval = Evaluate(instructions, ref instructionCount);
+
+      // because of numerical errors the bounds might be incorrect
+      if (outputInterval.LowerBound <= outputInterval.UpperBound)
+        return outputInterval;
+      else
+        return new Interval(outputInterval.UpperBound, outputInterval.LowerBound);
+    }
+
+
+    public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree,
+      IReadOnlyDictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) {
+      lock (syncRoot) {
+        EvaluatedSolutions++;
+      }
+      int instructionCount = 0;
+      var intervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
+      var instructions = PrepareInterpreterState(tree, variableRanges);
+      var outputInterval = Evaluate(instructions, ref instructionCount, intervals);
+
+      // fix incorrect intervals if necessary (could occur because of numerical errors)
+      nodeIntervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
+      foreach (var kvp in intervals) {
+        var interval = kvp.Value;
+        if (interval.IsInfiniteOrUndefined || interval.LowerBound <= interval.UpperBound)
+          nodeIntervals.Add(kvp.Key, interval);
+        else
+          nodeIntervals.Add(kvp.Key, new Interval(interval.UpperBound, interval.LowerBound));
+      }
+
+      // because of numerical errors the bounds might be incorrect
+      if (outputInterval.IsInfiniteOrUndefined || outputInterval.LowerBound <= outputInterval.UpperBound)
+        return outputInterval;
+      else
+        return new Interval(outputInterval.UpperBound, outputInterval.LowerBound);
+    }
+
+
+    private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) {
+      if (variableRanges == null)
+        throw new ArgumentNullException("No variablew ranges are present!", nameof(variableRanges));
+
+      //Check if all variables used in the tree are present in the dataset
+      foreach (var variable in tree.IterateNodesPrefix().OfType<VariableTreeNode>().Select(n => n.VariableName).Distinct()) {
+        if (!variableRanges.ContainsKey(variable)) throw new InvalidOperationException($"No ranges for variable {variable} is present");
+      }
+
+      Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
+      foreach (Instruction instr in code.Where(i => i.opCode == OpCodes.Variable)) {
+        var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
+        instr.data = variableRanges[variableTreeNode.VariableName];
+      }
+      return code;
+    }
+
+    private Interval Evaluate(Instruction[] instructions, ref int instructionCounter, IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals = null) {
+      Instruction currentInstr = instructions[instructionCounter];
+      //Use ref parameter, because the tree will be iterated through recursively from the left-side branch to the right side
+      //Update instructionCounter, whenever Evaluate is called
+      instructionCounter++;
+      Interval result = null;
+
+      switch (currentInstr.opCode) {
+        //Variables, Constants, ...
+        case OpCodes.Variable: {
+            var variableTreeNode = (VariableTreeNode)currentInstr.dynamicNode;
+            var weightInterval = new Interval(variableTreeNode.Weight, variableTreeNode.Weight);
+            var variableInterval = (Interval)currentInstr.data;
+
+            result = Interval.Multiply(variableInterval, weightInterval);
+            break;
+          }
+        case OpCodes.Constant: {
+            var constTreeNode = (ConstantTreeNode)currentInstr.dynamicNode;
+            result = new Interval(constTreeNode.Value, constTreeNode.Value);
+            break;
+          }
+        //Elementary arithmetic rules
+        case OpCodes.Add: {
+            result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+              result = Interval.Add(result, argumentInterval);
+            }
+            break;
+          }
+        case OpCodes.Sub: {
+            result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            if (currentInstr.nArguments == 1)
+              result = Interval.Multiply(new Interval(-1, -1), result);
+
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+              result = Interval.Subtract(result, argumentInterval);
+            }
+            break;
+          }
+        case OpCodes.Mul: {
+            result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+              result = Interval.Multiply(result, argumentInterval);
+            }
+            break;
+          }
+        case OpCodes.Div: {
+            result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            if (currentInstr.nArguments == 1)
+              result = Interval.Divide(new Interval(1, 1), result);
+
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+              result = Interval.Divide(result, argumentInterval);
+            }
+            break;
+          }
+        //Trigonometric functions
+        case OpCodes.Sin: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Sine(argumentInterval);
+            break;
+          }
+        case OpCodes.Cos: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Cosine(argumentInterval);
+            break;
+          }
+        case OpCodes.Tan: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Tangens(argumentInterval);
+            break;
+          }
+        case OpCodes.Tanh: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.HyperbolicTangent(argumentInterval);
+            break;
+          }
+        //Exponential functions
+        case OpCodes.Log: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Logarithm(argumentInterval);
+            break;
+          }
+        case OpCodes.Exp: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Exponential(argumentInterval);
+            break;
+          }
+        case OpCodes.Square: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Square(argumentInterval);
+            break;
+          }
+        case OpCodes.SquareRoot: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.SquareRoot(argumentInterval);
+            break;
+          }
+        case OpCodes.Cube: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Cube(argumentInterval);
+            break;
+          }
+        case OpCodes.CubeRoot: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.CubicRoot(argumentInterval);
+            break;
+          }
+        case OpCodes.Absolute: {
+            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            result = Interval.Absolute(argumentInterval);
+            break;
+          }
+        case OpCodes.AnalyticQuotient: {
+            result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+            for (var i = 1; i < currentInstr.nArguments; i++) {
+              var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
+              result = Interval.AnalyticalQuotient(result, argumentInterval);
+            }
+
+            break;
+          }
+        default:
+          throw new NotSupportedException($"The tree contains the unknown symbol {currentInstr.dynamicNode.Symbol}");
+      }
+
+      if (nodeIntervals != null)
+        nodeIntervals.Add(currentInstr.dynamicNode, result);
+
+      return result;
+    }
+
+    public static bool IsCompatible(ISymbolicExpressionTree tree) {
+      var containsUnknownSyumbol = (
+        from n in tree.Root.GetSubtree(0).IterateNodesPrefix()
+        where
+          !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) &&
+          !(n.Symbol is Constant) &&
+          !(n.Symbol is StartSymbol) &&
+          !(n.Symbol is Addition) &&
+          !(n.Symbol is Subtraction) &&
+          !(n.Symbol is Multiplication) &&
+          !(n.Symbol is Division) &&
+          !(n.Symbol is Sine) &&
+          !(n.Symbol is Cosine) &&
+          !(n.Symbol is Tangent) &&
+          !(n.Symbol is Logarithm) &&
+          !(n.Symbol is Exponential) &&
+          !(n.Symbol is Square) &&
+          !(n.Symbol is SquareRoot) &&
+          !(n.Symbol is Cube) &&
+          !(n.Symbol is CubeRoot) &&
+          !(n.Symbol is Absolute) &&
+          !(n.Symbol is AnalyticQuotient)
+        select n).Any();
+      return !containsUnknownSyumbol;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,64 +22,117 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public enum OpCode : byte {
+    Add = 1,
+    Sub = 2,
+    Mul = 3,
+    Div = 4,
+    Sin = 5,
+    Cos = 6,
+    Tan = 7,
+    Log = 8,
+    Exp = 9,
+    IfThenElse = 10,
+    GT = 11,
+    LT = 12,
+    AND = 13,
+    OR = 14,
+    NOT = 15,
+    Average = 16,
+    Call = 17,
+    Variable = 18,
+    LagVariable = 19,
+    Constant = 20,
+    Arg = 21,
+    Power = 22,
+    Root = 23,
+    TimeLag = 24,
+    Integral = 25,
+    Derivative = 26,
+    VariableCondition = 27,
+    Square = 28,
+    SquareRoot = 29,
+    Gamma = 30,
+    Psi = 31,
+    Dawson = 32,
+    ExponentialIntegralEi = 33,
+    CosineIntegral = 34,
+    SineIntegral = 35,
+    HyperbolicCosineIntegral = 36,
+    HyperbolicSineIntegral = 37,
+    FresnelCosineIntegral = 38,
+    FresnelSineIntegral = 39,
+    AiryA = 40,
+    AiryB = 41,
+    Norm = 42,
+    Erf = 43,
+    Bessel = 44,
+    XOR = 45,
+    FactorVariable = 46,
+    BinaryFactorVariable = 47,
+    Absolute = 48,
+    AnalyticQuotient = 49,
+    Cube = 50,
+    CubeRoot = 51,
+    Tanh = 52,
+  };
   public static class OpCodes {
-    public const byte Add = 1;
-    public const byte Sub = 2;
-    public const byte Mul = 3;
-    public const byte Div = 4;
+    // constants for API compatibility only
+    public const byte Add = (byte)OpCode.Add;
+    public const byte Sub =(byte)OpCode.Sub;
+    public const byte Mul =(byte)OpCode.Mul;
+    public const byte Div =(byte)OpCode.Div;
+    public const byte Sin =(byte)OpCode.Sin;
+    public const byte Cos =(byte)OpCode.Cos;
+    public const byte Tan =(byte)OpCode.Tan;
+    public const byte Log =(byte)OpCode.Log;
+    public const byte Exp = (byte)OpCode.Exp;
+    public const byte IfThenElse = (byte)OpCode.IfThenElse;
+    public const byte GT = (byte)OpCode.GT;
+    public const byte LT = (byte)OpCode.LT;
+    public const byte AND = (byte)OpCode.AND;
+    public const byte OR = (byte)OpCode.OR;
+    public const byte NOT = (byte)OpCode.NOT;
+    public const byte Average = (byte)OpCode.Average;
+    public const byte Call = (byte)OpCode.Call;
+    public const byte Variable = (byte)OpCode.Variable;
+    public const byte LagVariable = (byte)OpCode.LagVariable;
+    public const byte Constant = (byte)OpCode.Constant;
+    public const byte Arg = (byte)OpCode.Arg;
+    public const byte Power = (byte)OpCode.Power;
+    public const byte Root = (byte)OpCode.Root;
+    public const byte TimeLag = (byte)OpCode.TimeLag;
+    public const byte Integral = (byte)OpCode.Integral;
+    public const byte Derivative = (byte)OpCode.Derivative;
+    public const byte VariableCondition = (byte)OpCode.VariableCondition;
+    public const byte Square = (byte)OpCode.Square;
+    public const byte SquareRoot = (byte)OpCode.SquareRoot;
+    public const byte Gamma = (byte)OpCode.Gamma;
+    public const byte Psi = (byte)OpCode.Psi;
+    public const byte Dawson = (byte)OpCode.Dawson;
+    public const byte ExponentialIntegralEi = (byte)OpCode.ExponentialIntegralEi;
+    public const byte CosineIntegral = (byte)OpCode.CosineIntegral;
+    public const byte SineIntegral = (byte)OpCode.SineIntegral;
+    public const byte HyperbolicCosineIntegral = (byte)OpCode.HyperbolicCosineIntegral;
+    public const byte HyperbolicSineIntegral = (byte)OpCode.HyperbolicSineIntegral;
+    public const byte FresnelCosineIntegral = (byte)OpCode.FresnelCosineIntegral;
+    public const byte FresnelSineIntegral = (byte)OpCode.FresnelSineIntegral;
+    public const byte AiryA = (byte)OpCode.AiryA;
+    public const byte AiryB = (byte)OpCode.AiryB;
+    public const byte Norm = (byte)OpCode.Norm;
+    public const byte Erf = (byte)OpCode.Erf;
+    public const byte Bessel = (byte)OpCode.Bessel;
+    public const byte XOR = (byte)OpCode.XOR;
+    public const byte FactorVariable = (byte)OpCode.FactorVariable;
+    public const byte BinaryFactorVariable = (byte)OpCode.BinaryFactorVariable;
+    public const byte Absolute = (byte)OpCode.Absolute;
+    public const byte AnalyticQuotient = (byte)OpCode.AnalyticQuotient;
+    public const byte Cube = (byte)OpCode.Cube;
+    public const byte CubeRoot = (byte)OpCode.CubeRoot;
+    public const byte Tanh = (byte)OpCode.Tanh;
 
-    public const byte Sin = 5;
-    public const byte Cos = 6;
-    public const byte Tan = 7;
-
-    public const byte Log = 8;
-    public const byte Exp = 9;
-
-    public const byte IfThenElse = 10;
-
-    public const byte GT = 11;
-    public const byte LT = 12;
-
-    public const byte AND = 13;
-    public const byte OR = 14;
-    public const byte NOT = 15;
-
-
-    public const byte Average = 16;
-
-    public const byte Call = 17;
-
-    public const byte Variable = 18;
-    public const byte LagVariable = 19;
-    public const byte Constant = 20;
-    public const byte Arg = 21;
-
-    public const byte Power = 22;
-    public const byte Root = 23;
-    public const byte TimeLag = 24;
-    public const byte Integral = 25;
-    public const byte Derivative = 26;
-
-    public const byte VariableCondition = 27;
-
-    public const byte Square = 28;
-    public const byte SquareRoot = 29;
-    public const byte Gamma = 30;
-    public const byte Psi = 31;
-    public const byte Dawson = 32;
-    public const byte ExponentialIntegralEi = 33;
-    public const byte CosineIntegral = 34;
-    public const byte SineIntegral = 35;
-    public const byte HyperbolicCosineIntegral = 36;
-    public const byte HyperbolicSineIntegral = 37;
-    public const byte FresnelCosineIntegral = 38;
-    public const byte FresnelSineIntegral = 39;
-    public const byte AiryA = 40;
-    public const byte AiryB = 41;
-    public const byte Norm = 42;
-    public const byte Erf = 43;
-    public const byte Bessel = 44;
 
     private static Dictionary<Type, byte> symbolToOpcode = new Dictionary<Type, byte>() {
@@ -91,4 +144,5 @@
       { typeof(Cosine), OpCodes.Cos },
       { typeof(Tangent), OpCodes.Tan },
+      { typeof (HyperbolicTangent), OpCodes.Tanh},
       { typeof(Logarithm), OpCodes.Log },
       { typeof(Exponential), OpCodes.Exp },
@@ -99,4 +153,5 @@
       { typeof(Or), OpCodes.OR },
       { typeof(Not), OpCodes.NOT},
+      { typeof(Xor),OpCodes.XOR},
       { typeof(Average), OpCodes.Average},
       { typeof(InvokeFunction), OpCodes.Call },
@@ -108,5 +163,5 @@
       { typeof(Power),OpCodes.Power},
       { typeof(Root),OpCodes.Root},
-      { typeof(TimeLag), OpCodes.TimeLag}, 
+      { typeof(TimeLag), OpCodes.TimeLag},
       { typeof(Integral), OpCodes.Integral},
       { typeof(Derivative), OpCodes.Derivative},
@@ -128,10 +183,15 @@
       { typeof(Norm), OpCodes.Norm},
       { typeof(Erf), OpCodes.Erf},
-      { typeof(Bessel), OpCodes.Bessel}   
+      { typeof(Bessel), OpCodes.Bessel},
+      { typeof(FactorVariable), OpCodes.FactorVariable },
+      { typeof(BinaryFactorVariable), OpCodes.BinaryFactorVariable },
+      { typeof(Absolute), OpCodes.Absolute },
+      { typeof(AnalyticQuotient), OpCodes.AnalyticQuotient },
+      { typeof(Cube), OpCodes.Cube },
+      { typeof(CubeRoot), OpCodes.CubeRoot }
     };
 
     public static byte MapSymbolToOpCode(ISymbolicExpressionTreeNode treeNode) {
-      byte opCode;
-      if (symbolToOpcode.TryGetValue(treeNode.Symbol.GetType(), out opCode)) return opCode;
+      if (symbolToOpcode.TryGetValue(treeNode.Symbol.GetType(), out byte opCode)) return opCode;
       else throw new NotSupportedException("Symbol: " + treeNode.Symbol);
     }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs	(revision 17687)
@@ -0,0 +1,669 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("DFA06F28-E224-4D93-9907-69792D24D1F9")]
+  [Item("SymbolicDataAnalysisExpressionCompiledTreeInterpreter", "Interpreter that converts the tree into a Linq.Expression then compiles it.")]
+  public sealed class SymbolicDataAnalysisExpressionCompiledTreeInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
+    private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
+    private const string CheckExpressionsWithIntervalArithmeticParameterDescription = "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.";
+    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
+
+    #region method info for the commonly called functions
+    private static readonly MethodInfo Abs = typeof(Math).GetMethod("Abs", new[] { typeof(double) });
+    private static readonly MethodInfo Sin = typeof(Math).GetMethod("Sin", new[] { typeof(double) });
+    private static readonly MethodInfo Cos = typeof(Math).GetMethod("Cos", new[] { typeof(double) });
+    private static readonly MethodInfo Tan = typeof(Math).GetMethod("Tan", new[] { typeof(double) });
+    private static readonly MethodInfo Tanh = typeof(Math).GetMethod("Tanh", new[] { typeof(double) });
+    private static readonly MethodInfo Sqrt = typeof(Math).GetMethod("Sqrt", new[] { typeof(double) });
+    private static readonly MethodInfo Floor = typeof(Math).GetMethod("Floor", new[] { typeof(double) });
+    private static readonly MethodInfo Round = typeof(Math).GetMethod("Round", new[] { typeof(double) });
+    private static readonly MethodInfo Exp = typeof(Math).GetMethod("Exp", new[] { typeof(double) });
+    private static readonly MethodInfo Log = typeof(Math).GetMethod("Log", new[] { typeof(double) });
+    private static readonly MethodInfo IsNaN = typeof(double).GetMethod("IsNaN");
+    private static readonly MethodInfo IsAlmost = typeof(DoubleExtensions).GetMethod("IsAlmost", new Type[] { typeof(double), typeof(double)});
+    private static readonly MethodInfo Gamma = typeof(alglib).GetMethod("gammafunction", new[] { typeof(double) });
+    private static readonly MethodInfo Psi = typeof(alglib).GetMethod("psi", new[] { typeof(double) });
+    private static readonly MethodInfo DawsonIntegral = typeof(alglib).GetMethod("dawsonintegral", new[] { typeof(double) });
+    private static readonly MethodInfo ExponentialIntegralEi = typeof(alglib).GetMethod("exponentialintegralei", new[] { typeof(double) });
+    private static readonly MethodInfo SineCosineIntegrals = typeof(alglib).GetMethod("sinecosineintegrals", new[] { typeof(double), typeof(double).MakeByRefType(), typeof(double).MakeByRefType() });
+    private static readonly MethodInfo HyperbolicSineCosineIntegrals = typeof(alglib).GetMethod("hyperbolicsinecosineintegrals", new[] { typeof(double), typeof(double).MakeByRefType(), typeof(double).MakeByRefType() });
+    private static readonly MethodInfo FresnelIntegral = typeof(alglib).GetMethod("fresnelintegral", new[] { typeof(double), typeof(double).MakeByRefType(), typeof(double).MakeByRefType() });
+    private static readonly MethodInfo Airy = typeof(alglib).GetMethod("airy", new[] { typeof(double), typeof(double).MakeByRefType(), typeof(double).MakeByRefType(), typeof(double).MakeByRefType(), typeof(double).MakeByRefType() });
+    private static readonly MethodInfo NormalDistribution = typeof(alglib).GetMethod("normaldistribution", new[] { typeof(double) });
+    private static readonly MethodInfo ErrorFunction = typeof(alglib).GetMethod("errorfunction", new[] { typeof(double) });
+    private static readonly MethodInfo Bessel = typeof(alglib).GetMethod("besseli0", new[] { typeof(double) });
+    #endregion
+
+    public override bool CanChangeName { get { return false; } }
+    public override bool CanChangeDescription { get { return false; } }
+
+    #region parameter properties
+    public IFixedValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public bool CheckExpressionsWithIntervalArithmetic {
+      get { return CheckExpressionsWithIntervalArithmeticParameter.Value.Value; }
+      set { CheckExpressionsWithIntervalArithmeticParameter.Value.Value = value; }
+    }
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
+    }
+    #endregion
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionCompiledTreeInterpreter(this, cloner);
+    }
+
+    private SymbolicDataAnalysisExpressionCompiledTreeInterpreter(SymbolicDataAnalysisExpressionCompiledTreeInterpreter original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    [StorableConstructor]
+    private SymbolicDataAnalysisExpressionCompiledTreeInterpreter(StorableConstructorFlag _) : base(_) {
+    }
+
+    public SymbolicDataAnalysisExpressionCompiledTreeInterpreter() :
+      base("SymbolicDataAnalysisExpressionCompiledTreeInterpreter", "Interpreter which compiles the tree into a lambda") {
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    public SymbolicDataAnalysisExpressionCompiledTreeInterpreter(string name, string description) :
+      base(name, description) {
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    public void InitializeState() {
+      EvaluatedSolutions = 0;
+    }
+
+    public void ClearState() { }
+
+    private readonly object syncRoot = new object();
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) {
+      if (CheckExpressionsWithIntervalArithmetic)
+        throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
+
+      lock (syncRoot) {
+        EvaluatedSolutions++; // increment the evaluated solutions counter
+      }
+      var columns = dataset.DoubleVariables.Select(x => (IList<double>)dataset.GetReadOnlyDoubleValues(x)).ToArray();
+      var compiled = CompileTree(tree, dataset);
+      return rows.Select(x => compiled(x, columns));
+    }
+
+    public static Func<int, IList<double>[], double> CompileTree(ISymbolicExpressionTree tree, IDataset dataset) {
+      var lambda = CreateDelegate(tree, dataset);
+      return lambda.Compile();
+    }
+
+    public static Expression<Func<int, IList<double>[], double>> CreateDelegate(ISymbolicExpressionTree tree, IDataset dataset) {
+      var row = Expression.Parameter(typeof(int));
+      var columns = Expression.Parameter(typeof(IList<double>[]));
+      var variableIndices = dataset.DoubleVariables.Select((x, i) => new { x, i }).ToDictionary(e => e.x, e => e.i);
+      var expr = MakeExpr(tree, variableIndices, row, columns);
+      var lambda = Expression.Lambda<Func<int, IList<double>[], double>>(expr, row, columns);
+      return lambda;
+    }
+
+    private static Expression MakeExpr(ISymbolicExpressionTree tree, Dictionary<string, int> variableIndices, Expression row, Expression columns) {
+      var actualRoot = tree.Root.GetSubtree(0).GetSubtree(0);
+      return MakeExpr(actualRoot, variableIndices, row, columns);
+    }
+
+    private static readonly PropertyInfo Indexer = typeof(IList<double>).GetProperty("Item");
+    private static Expression MakeExpr(ISymbolicExpressionTreeNode node, Dictionary<string, int> variableIndices, Expression row, Expression columns) {
+      var opcode = OpCodes.MapSymbolToOpCode(node);
+      #region switch opcode
+      switch (opcode) {
+        case OpCodes.Constant: {
+            var constantTreeNode = (ConstantTreeNode)node;
+            return Expression.Constant(constantTreeNode.Value);
+          }
+        case OpCodes.Variable: {
+            var variableTreeNode = (VariableTreeNode)node;
+            var variableWeight = Expression.Constant(variableTreeNode.Weight);
+            var variableName = variableTreeNode.VariableName;
+            var indexExpr = Expression.Constant(variableIndices[variableName]);
+            var valuesExpr = Expression.ArrayIndex(columns, indexExpr);
+            return Expression.Multiply(variableWeight, Expression.Property(valuesExpr, Indexer, row));
+          }
+        case OpCodes.Add: {
+            Expression result = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              result = Expression.Add(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns));
+            }
+            return result;
+          }
+        case OpCodes.Sub: {
+            Expression result = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            if (node.SubtreeCount == 1)
+              return Expression.Negate(result);
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              result = Expression.Subtract(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns));
+            }
+            return result;
+          }
+        case OpCodes.Mul: {
+            Expression result = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              result = Expression.Multiply(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns));
+            }
+            return result;
+          }
+        case OpCodes.Div: {
+            Expression result = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            if (node.SubtreeCount == 1)
+              return Expression.Divide(Expression.Constant(1.0), result);
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              result = Expression.Divide(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns));
+            }
+            return result;
+          }
+        case OpCodes.Average: {
+            Expression result = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              result = Expression.Add(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns));
+            }
+            return Expression.Divide(result, Expression.Constant((double)node.SubtreeCount));
+          }
+        case OpCodes.Absolute: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Abs, arg);
+          }
+        case OpCodes.Cos: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Cos, arg);
+          }
+        case OpCodes.Sin: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Sin, arg);
+          }
+        case OpCodes.Tan: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Tan, arg);
+          }
+        case OpCodes.Tanh: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Tanh, arg);
+          }
+        case OpCodes.Square: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Power(arg, Expression.Constant(2.0));
+          }
+        case OpCodes.Cube: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Power(arg, Expression.Constant(3.0));
+          }
+        case OpCodes.Power: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var power = MakeExpr(node.GetSubtree(1), variableIndices, row, columns);
+            return Expression.Power(arg, Expression.Call(Round, power));
+          }
+        case OpCodes.SquareRoot: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Sqrt, arg);
+          }
+        case OpCodes.CubeRoot: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Condition(Expression.LessThan(arg, Expression.Constant(0.0)),
+              Expression.Negate(Expression.Power(Expression.Negate(arg), Expression.Constant(1.0 / 3.0))),
+              Expression.Power(arg, Expression.Constant(1.0 / 3.0)));
+          }
+        case OpCodes.Root: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var power = MakeExpr(node.GetSubtree(1), variableIndices, row, columns);
+            return Expression.Power(arg, Expression.Divide(Expression.Constant(1.0), Expression.Call(Round, power)));
+          }
+        case OpCodes.Exp: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Exp, arg);
+          }
+        case OpCodes.Log: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            return Expression.Call(Log, arg);
+          }
+        case OpCodes.Gamma: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(
+                isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, Expression.Call(Gamma, arg))
+                ),
+              result
+              );
+            return expr;
+          }
+        case OpCodes.Psi: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+
+            var result = Expression.Variable(typeof(double));
+            var floor = Expression.Call(Floor, arg);
+            var expr = Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(
+                isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.IfThenElse(
+                  Expression.AndAlso(
+                    Expression.LessThanOrEqual(arg, Expression.Constant(0.0)),
+                    Expression.Call(IsAlmost, Expression.Subtract(floor, arg), Expression.Constant(0.0))),
+                  Expression.Assign(result, Expression.Constant(double.NaN)),
+                  Expression.Assign(result, Expression.Call(Psi, arg)))
+                ),
+              result);
+
+            return expr;
+          }
+        case OpCodes.Dawson: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, Expression.Call(DawsonIntegral, arg))),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.ExponentialIntegralEi: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, Expression.Call(ExponentialIntegralEi, arg))),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.SineIntegral: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var si = Expression.Variable(typeof(double));
+            var ci = Expression.Variable(typeof(double));
+            var block = Expression.Block(
+              new[] { si, ci },
+              Expression.Call(SineCosineIntegrals, arg, si, ci),
+              si
+              );
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.CosineIntegral: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var si = Expression.Variable(typeof(double));
+            var ci = Expression.Variable(typeof(double));
+            var block = Expression.Block(
+              new[] { si, ci },
+              Expression.Call(SineCosineIntegrals, arg, si, ci),
+              ci
+              );
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.HyperbolicSineIntegral: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var shi = Expression.Variable(typeof(double));
+            var chi = Expression.Variable(typeof(double));
+            var block = Expression.Block(
+              new[] { shi, chi },
+              Expression.Call(HyperbolicSineCosineIntegrals, arg, shi, chi),
+              shi
+              );
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.HyperbolicCosineIntegral: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var shi = Expression.Variable(typeof(double));
+            var chi = Expression.Variable(typeof(double));
+            var block = Expression.Block(
+              new[] { shi, chi },
+              Expression.Call(HyperbolicSineCosineIntegrals, arg, shi, chi),
+              chi
+              );
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.FresnelSineIntegral: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var s = Expression.Variable(typeof(double));
+            var c = Expression.Variable(typeof(double));
+            var block = Expression.Block(new[] { s, c }, Expression.Call(FresnelIntegral, arg, c, s), s);
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.FresnelCosineIntegral: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var s = Expression.Variable(typeof(double));
+            var c = Expression.Variable(typeof(double));
+            var block = Expression.Block(new[] { s, c }, Expression.Call(FresnelIntegral, arg, c, s), c);
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.AiryA: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var ai = Expression.Variable(typeof(double));
+            var aip = Expression.Variable(typeof(double));
+            var bi = Expression.Variable(typeof(double));
+            var bip = Expression.Variable(typeof(double));
+            var block = Expression.Block(new[] { ai, aip, bi, bip }, Expression.Call(Airy, arg, ai, aip, bi, bip), ai);
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.AiryB: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var ai = Expression.Variable(typeof(double));
+            var aip = Expression.Variable(typeof(double));
+            var bi = Expression.Variable(typeof(double));
+            var bip = Expression.Variable(typeof(double));
+            var block = Expression.Block(new[] { ai, aip, bi, bip }, Expression.Call(Airy, arg, ai, aip, bi, bip), bi);
+            var result = Expression.Variable(typeof(double));
+            var expr = Expression.Block(new[] { result },
+              Expression.IfThenElse(isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, block)),
+              result
+              );
+
+            return expr;
+          }
+        case OpCodes.Norm: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var result = Expression.Variable(typeof(double));
+            return Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(
+                Expression.Call(IsNaN, arg),
+                Expression.Assign(result, arg),
+                Expression.Assign(result, Expression.Call(NormalDistribution, arg))),
+              result);
+          }
+        case OpCodes.Erf: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var result = Expression.Variable(typeof(double));
+            return Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(
+                isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, Expression.Call(ErrorFunction, arg))),
+              result);
+          }
+        case OpCodes.Bessel: {
+            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var isNaN = Expression.Call(IsNaN, arg);
+            var result = Expression.Variable(typeof(double));
+            return Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(
+                isNaN,
+                Expression.Assign(result, Expression.Constant(double.NaN)),
+                Expression.Assign(result, Expression.Call(Bessel, arg))),
+              result);
+          }
+        case OpCodes.AnalyticQuotient: {
+            var x1 = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var x2 = MakeExpr(node.GetSubtree(1), variableIndices, row, columns);
+            return Expression.Divide(x1,
+              Expression.Call(Sqrt,
+              Expression.Add(
+                Expression.Constant(1.0),
+                Expression.Multiply(x2, x2))));
+          }
+        case OpCodes.IfThenElse: {
+            var test = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var result = Expression.Variable(typeof(double));
+            var condition = Expression.IfThenElse(Expression.GreaterThan(test, Expression.Constant(0.0)),
+              Expression.Assign(result, MakeExpr(node.GetSubtree(1), variableIndices, row, columns)),
+              Expression.Assign(result, MakeExpr(node.GetSubtree(2), variableIndices, row, columns)));
+            return Expression.Block(new[] { result }, condition, result);
+          }
+        case OpCodes.AND: {
+            var result = Expression.Variable(typeof(double));
+            var expr = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              expr = Expression.Block(new[] { result },
+                Expression.IfThenElse(
+                  Expression.GreaterThan(expr, Expression.Constant(0.0)),
+                  Expression.Assign(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns)),
+                  Expression.Assign(result, expr)),
+                result
+                );
+            }
+
+            return Expression.Block(
+              new[] { result },
+              Expression.Assign(result, expr),
+              Expression.IfThenElse(
+                Expression.GreaterThan(result, Expression.Constant(0.0)),
+                Expression.Assign(result, Expression.Constant(1.0)),
+                Expression.Assign(result, Expression.Constant(-1.0))
+                ),
+              result
+              );
+          }
+        case OpCodes.OR: {
+            var result = Expression.Variable(typeof(double));
+            var expr = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+
+            for (int i = 1; i < node.SubtreeCount; ++i) {
+              expr = Expression.Block(new[] { result },
+                Expression.IfThenElse(
+                  Expression.LessThanOrEqual(expr, Expression.Constant(0.0)),
+                  Expression.Assign(result, MakeExpr(node.GetSubtree(i), variableIndices, row, columns)),
+                  Expression.Assign(result, expr)),
+                result
+                );
+            }
+
+            return Expression.Block(
+              new[] { result },
+              Expression.Assign(result, expr),
+              Expression.IfThenElse(
+                Expression.GreaterThan(result, Expression.Constant(0.0)),
+                Expression.Assign(result, Expression.Constant(1.0)),
+                Expression.Assign(result, Expression.Constant(-1.0))
+                ),
+              result
+              );
+          }
+        case OpCodes.NOT: {
+            var value = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var result = Expression.Variable(typeof(double));
+            var condition = Expression.IfThenElse(Expression.GreaterThan(value, Expression.Constant(0.0)),
+              Expression.Assign(result, Expression.Constant(-1.0)),
+              Expression.Assign(result, Expression.Constant(1.0)));
+            return Expression.Block(new[] { result }, condition, result);
+          }
+        case OpCodes.XOR: {
+            var ps = Expression.Variable(typeof(int));
+            var block = Expression.Block(
+              new[] { ps },
+              Expression.Assign(ps, Expression.Constant(0)),
+              ps
+              );
+
+            foreach (var subtree in node.Subtrees) {
+              var expr = MakeExpr(subtree, variableIndices, row, columns);
+              block = Expression.Block(
+                new[] { ps },
+                Expression.Assign(ps, block),
+                Expression.IfThen(Expression.GreaterThan(expr, Expression.Constant(0.0)),
+                  Expression.PostIncrementAssign(ps)),
+                ps
+                );
+            }
+
+            var result = Expression.Variable(typeof(double));
+            var xorExpr = Expression.Block(
+              new[] { result },
+              Expression.IfThenElse(
+                Expression.Equal(Expression.Modulo(block, Expression.Constant(2)), Expression.Constant(0)),
+                Expression.Assign(result, Expression.Constant(-1.0)),
+                Expression.Assign(result, Expression.Constant(1.0))
+                ),
+              result
+              );
+            return xorExpr;
+          }
+        case OpCodes.GT: {
+            var left = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var right = MakeExpr(node.GetSubtree(1), variableIndices, row, columns);
+            var result = Expression.Variable(typeof(double));
+
+            var condition = Expression.IfThenElse(Expression.GreaterThan(left, right),
+              Expression.Assign(result, Expression.Constant(1.0)), Expression.Assign(result, Expression.Constant(-1.0)));
+            return Expression.Block(
+              new[] { result },
+              condition,
+              result);
+          }
+        case OpCodes.LT: {
+            var left = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var right = MakeExpr(node.GetSubtree(1), variableIndices, row, columns);
+            var result = Expression.Variable(typeof(double));
+
+            var condition = Expression.IfThenElse(Expression.LessThan(left, right),
+              Expression.Assign(result, Expression.Constant(1.0)), Expression.Assign(result, Expression.Constant(-1.0)));
+            return Expression.Block(new[] { result }, condition, result);
+          }
+        case OpCodes.VariableCondition: {
+            var variableConditionTreeNode = (VariableConditionTreeNode)node;
+            if (variableConditionTreeNode.Symbol.IgnoreSlope) throw new NotSupportedException("Strict variable conditionals are not supported");
+            var variableName = variableConditionTreeNode.VariableName;
+            var indexExpr = Expression.Constant(variableIndices[variableName]);
+            var valuesExpr = Expression.ArrayIndex(columns, indexExpr);
+            var variableValue = Expression.Property(valuesExpr, Indexer, row);
+            var variableThreshold = Expression.Constant(variableConditionTreeNode.Threshold);
+            var variableSlope = Expression.Constant(variableConditionTreeNode.Slope);
+
+            var x = Expression.Subtract(variableValue, variableThreshold);
+            var xSlope = Expression.Multiply(Expression.Negate(variableSlope), x);
+            var xSlopeExp = Expression.Call(Exp, xSlope);
+            var p = Expression.Divide(Expression.Constant(1), Expression.Add(Expression.Constant(1), xSlopeExp));
+            var trueBranch = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
+            var falseBranch = MakeExpr(node.GetSubtree(1), variableIndices, row, columns);
+            return Expression.Add(
+              Expression.Multiply(trueBranch, p),
+              Expression.Multiply(falseBranch, Expression.Subtract(Expression.Constant(1), p))
+              );
+          }
+        default:
+          throw new NotSupportedException("Unsupported symbol: " + node.Symbol);
+      }
+      #endregion
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs	(revision 17687)
@@ -0,0 +1,292 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
+using static HeuristicLab.Problems.DataAnalysis.Symbolic.BatchOperations;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SymbolicDataAnalysisExpressionTreeBatchInterpreter", "An interpreter that uses batching and vectorization techniques to achieve faster performance.")]
+  [StorableType("BEB15146-BB95-4838-83AC-6838543F017B")]
+  public class SymbolicDataAnalysisExpressionTreeBatchInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
+    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
+
+    #region parameters
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
+    }
+    #endregion
+
+    public void ClearState() { }
+
+    public SymbolicDataAnalysisExpressionTreeBatchInterpreter() {
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionTreeBatchInterpreter(StorableConstructorFlag _) : base(_) { }
+    protected SymbolicDataAnalysisExpressionTreeBatchInterpreter(SymbolicDataAnalysisExpressionTreeBatchInterpreter original, Cloner cloner) : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionTreeBatchInterpreter(this, cloner);
+    }
+
+    private void LoadData(BatchInstruction instr, int[] rows, int rowIndex, int batchSize) {
+      for (int i = 0; i < batchSize; ++i) {
+        var row = rows[rowIndex] + i;
+        instr.buf[i] = instr.weight * instr.data[row];
+      }
+    }
+
+    private void Evaluate(BatchInstruction[] code, int[] rows, int rowIndex, int batchSize) {
+      for (int i = code.Length - 1; i >= 0; --i) {
+        var instr = code[i];
+        var c = instr.childIndex;
+        var n = instr.narg;
+
+        switch (instr.opcode) {
+          case OpCodes.Variable: {
+              LoadData(instr, rows, rowIndex, batchSize);
+              break;
+            }
+          case OpCodes.Constant: break; // nothing to do here, don't remove because we want to prevent falling into the default case here.
+          case OpCodes.Add: {
+              Load(instr.buf, code[c].buf);
+              for (int j = 1; j < n; ++j) {
+                Add(instr.buf, code[c + j].buf);
+              }
+              break;
+            }
+
+          case OpCodes.Sub: {
+              if (n == 1) {
+                Neg(instr.buf, code[c].buf);
+              } else {
+                Load(instr.buf, code[c].buf);
+                for (int j = 1; j < n; ++j) {
+                  Sub(instr.buf, code[c + j].buf);
+                }
+              }
+              break;
+            }
+
+          case OpCodes.Mul: {
+              Load(instr.buf, code[c].buf);
+              for (int j = 1; j < n; ++j) {
+                Mul(instr.buf, code[c + j].buf);
+              }
+              break;
+            }
+
+          case OpCodes.Div: {
+              if (n == 1) {
+                Inv(instr.buf, code[c].buf);
+              } else {
+                Load(instr.buf, code[c].buf);
+                for (int j = 1; j < n; ++j) {
+                  Div(instr.buf, code[c + j].buf);
+                }
+              }
+              break;
+            }
+
+          case OpCodes.Square: {
+              Square(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Root: {
+              Load(instr.buf, code[c].buf);
+              Root(instr.buf, code[c + 1].buf);
+              break;
+            }
+
+          case OpCodes.SquareRoot: {
+              Sqrt(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Cube: {
+              Cube(instr.buf, code[c].buf);
+              break;
+            }
+          case OpCodes.CubeRoot: {
+              CubeRoot(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Power: {
+              Load(instr.buf, code[c].buf);
+              Pow(instr.buf, code[c + 1].buf);
+              break;
+            }
+
+          case OpCodes.Exp: {
+              Exp(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Log: {
+              Log(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Sin: {
+              Sin(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Cos: {
+              Cos(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.Tan: {
+              Tan(instr.buf, code[c].buf);
+              break;
+            }
+          case OpCodes.Tanh: {
+              Tanh(instr.buf, code[c].buf);
+              break;
+            }
+          case OpCodes.Absolute: {
+              Absolute(instr.buf, code[c].buf);
+              break;
+            }
+
+          case OpCodes.AnalyticQuotient: {
+              Load(instr.buf, code[c].buf);
+              AnalyticQuotient(instr.buf, code[c + 1].buf);
+              break;
+            }
+          default: throw new NotSupportedException($"This interpreter does not support {(OpCode)instr.opcode}");
+        }
+      }
+    }
+
+    private readonly object syncRoot = new object();
+
+    [ThreadStatic]
+    private static Dictionary<string, double[]> cachedData;
+
+    [ThreadStatic]
+    private static IDataset cachedDataset;
+
+    private void InitCache(IDataset dataset) {
+      cachedDataset = dataset;
+      cachedData = new Dictionary<string, double[]>();
+      foreach (var v in dataset.DoubleVariables) {
+        cachedData[v] = dataset.GetDoubleValues(v).ToArray();
+      }
+    }
+
+    public void InitializeState() {
+      cachedData = null;
+      cachedDataset = null;
+      EvaluatedSolutions = 0;
+    }
+
+    private double[] GetValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
+      if (cachedData == null || cachedDataset != dataset) {
+        InitCache(dataset);
+      }
+
+      var code = Compile(tree, dataset, OpCodes.MapSymbolToOpCode);
+      var remainingRows = rows.Length % BATCHSIZE;
+      var roundedTotal = rows.Length - remainingRows;
+
+      var result = new double[rows.Length];
+
+      for (int rowIndex = 0; rowIndex < roundedTotal; rowIndex += BATCHSIZE) {
+        Evaluate(code, rows, rowIndex, BATCHSIZE);
+        Array.Copy(code[0].buf, 0, result, rowIndex, BATCHSIZE);
+      }
+
+      if (remainingRows > 0) {
+        Evaluate(code, rows, roundedTotal, remainingRows);
+        Array.Copy(code[0].buf, 0, result, roundedTotal, remainingRows);
+      }
+
+      // when evaluation took place without any error, we can increment the counter
+      lock (syncRoot) {
+        EvaluatedSolutions++;
+      }
+
+      return result;
+    }
+
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
+      return GetValues(tree, dataset, rows);
+    }
+
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) {
+      return GetSymbolicExpressionTreeValues(tree, dataset, rows.ToArray());
+    }
+
+    private BatchInstruction[] Compile(ISymbolicExpressionTree tree, IDataset dataset, Func<ISymbolicExpressionTreeNode, byte> opCodeMapper) {
+      var root = tree.Root.GetSubtree(0).GetSubtree(0);
+      var code = new BatchInstruction[root.GetLength()];
+      if (root.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
+      int c = 1, i = 0;
+      foreach (var node in root.IterateNodesBreadth()) {
+        if (node.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
+        code[i] = new BatchInstruction {
+          opcode = opCodeMapper(node),
+          narg = (ushort)node.SubtreeCount,
+          buf = new double[BATCHSIZE],
+          childIndex = c
+        };
+        if (node is VariableTreeNode variable) {
+          code[i].weight = variable.Weight;
+          if (cachedData.ContainsKey(variable.VariableName)) {
+            code[i].data = cachedData[variable.VariableName];
+          } else {
+            code[i].data = dataset.GetReadOnlyDoubleValues(variable.VariableName).ToArray();
+            cachedData[variable.VariableName] = code[i].data;
+          }
+        } else if (node is ConstantTreeNode constant) {
+          code[i].value = constant.Value;
+          for (int j = 0; j < BATCHSIZE; ++j)
+            code[i].buf[j] = code[i].value;
+        }
+        c += node.SubtreeCount;
+        ++i;
+      }
+      return code;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -30,8 +30,8 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("426718E3-2A57-4CA4-98A1-65EDD0B0BDBF")]
   [Item("SymbolicDataAnalysisExpressionTreeILEmittingInterpreter", "Interpreter for symbolic expression trees.")]
   public sealed class SymbolicDataAnalysisExpressionTreeILEmittingInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
@@ -45,4 +45,5 @@
     private static MethodInfo sin = typeof(Math).GetMethod("Sin", new Type[] { typeof(double) });
     private static MethodInfo tan = typeof(Math).GetMethod("Tan", new Type[] { typeof(double) });
+    private static MethodInfo tanh = typeof(Math).GetMethod("Tanh", new Type[] { typeof(double) });
     private static MethodInfo exp = typeof(Math).GetMethod("Exp", new Type[] { typeof(double) });
     private static MethodInfo log = typeof(Math).GetMethod("Log", new Type[] { typeof(double) });
@@ -50,4 +51,5 @@
     private static MethodInfo round = typeof(Math).GetMethod("Round", new Type[] { typeof(double) });
     private static MethodInfo sqrt = typeof(Math).GetMethod("Sqrt", new Type[] { typeof(double) });
+    private static MethodInfo abs = typeof(Math).GetMethod("Abs", new Type[] { typeof(double) });
 
     private static MethodInfo airyA = thisType.GetMethod("AiryA", new Type[] { typeof(double) });
@@ -66,7 +68,9 @@
     private static MethodInfo erf = thisType.GetMethod("Erf", new Type[] { typeof(double) });
     private static MethodInfo bessel = thisType.GetMethod("Bessel", new Type[] { typeof(double) });
+    private static MethodInfo string_eq = typeof(string).GetMethod("Equals", new Type[] { typeof(string) });
     #endregion
 
     private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
+    private const string CheckExpressionsWithIntervalArithmeticParameterDescription = "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.";
     private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
 
@@ -80,32 +84,26 @@
 
     #region parameter properties
-
-    public IValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
-      get { return (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
-    }
-
-    public IValueParameter<IntValue> EvaluatedSolutionsParameter {
-      get { return (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
-    }
-
+    public IFixedValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<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; }
-    }
-
+    public bool CheckExpressionsWithIntervalArithmetic {
+      get { return CheckExpressionsWithIntervalArithmeticParameter.Value.Value; }
+      set { CheckExpressionsWithIntervalArithmeticParameter.Value.Value = value; }
+    }
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
+    }
     #endregion
 
-
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(bool deserializing) : base(deserializing) { }
+    private SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(StorableConstructorFlag _) : base(_) { }
 
     private SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(SymbolicDataAnalysisExpressionTreeILEmittingInterpreter original, Cloner cloner) : base(original, cloner) { }
@@ -116,31 +114,51 @@
     public SymbolicDataAnalysisExpressionTreeILEmittingInterpreter()
       : base("SymbolicDataAnalysisExpressionTreeILEmittingInterpreter", "Interpreter for symbolic expression trees.") {
-      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)));
+      Parameters.Add(new FixedValueParameter<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 FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    public SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(string name, string description)
+      : base(name, description) {
+      Parameters.Add(new FixedValueParameter<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 FixedValueParameter<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)));
+      var evaluatedSolutions = new IntValue(0);
+      var checkExpressionsWithIntervalArithmetic = new BoolValue(false);
+      if (Parameters.ContainsKey(EvaluatedSolutionsParameterName)) {
+        var evaluatedSolutionsParameter = (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName];
+        evaluatedSolutions = evaluatedSolutionsParameter.Value;
+        Parameters.Remove(EvaluatedSolutionsParameterName);
+      }
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", evaluatedSolutions));
+      if (Parameters.ContainsKey(CheckExpressionsWithIntervalArithmeticParameterName)) {
+        var checkExpressionsWithIntervalArithmeticParameter = (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName];
+        Parameters.Remove(CheckExpressionsWithIntervalArithmeticParameterName);
+        checkExpressionsWithIntervalArithmetic = checkExpressionsWithIntervalArithmeticParameter.Value;
+      }
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, checkExpressionsWithIntervalArithmetic));
     }
 
     #region IStatefulItem
-
     public void InitializeState() {
-      EvaluatedSolutions.Value = 0;
+      EvaluatedSolutions = 0;
     }
 
     public void ClearState() {
-      EvaluatedSolutions.Value = 0;
-    }
-
+    }
     #endregion
 
-    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {
-      if (CheckExpressionsWithIntervalArithmetic.Value)
+    private readonly object syncRoot = new object();
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) {
+      if (CheckExpressionsWithIntervalArithmetic)
         throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
 
-      EvaluatedSolutions.Value++; // increment the evaluated solutions counter
+      lock (syncRoot) {
+        EvaluatedSolutions++; // increment the evaluated solutions counter
+      }
       var state = PrepareInterpreterState(tree, dataset);
 
@@ -161,5 +179,5 @@
     }
 
-    private InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset) {
+    private InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, IDataset dataset) {
       Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
       Dictionary<string, int> doubleVariableNames = dataset.DoubleVariables.Select((x, i) => new { x, i }).ToDictionary(e => e.x, e => e.i);
@@ -182,5 +200,5 @@
     }
 
-    private void CompileInstructions(ILGenerator il, InterpreterState state, Dataset ds) {
+    private void CompileInstructions(ILGenerator il, InterpreterState state, IDataset ds) {
       Instruction currentInstr = state.NextInstruction();
       int nArgs = currentInstr.nArguments;
@@ -244,8 +262,13 @@
               il.Emit(System.Reflection.Emit.OpCodes.Add);
             }
-            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, nArgs);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, (double)nArgs);
             il.Emit(System.Reflection.Emit.OpCodes.Div);
             return;
           }
+        case OpCodes.Absolute: {
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Call, abs);
+            return;
+          }
         case OpCodes.Cos: {
             CompileInstructions(il, state, ds);
@@ -261,4 +284,9 @@
             CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, tan);
+            return;
+          }
+        case OpCodes.Tanh: {
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Call, tanh);
             return;
           }
@@ -295,4 +323,10 @@
             return;
           }
+        case OpCodes.Cube: {
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 3.0);
+            il.Emit(System.Reflection.Emit.OpCodes.Call, power);
+            return;
+          }
         case OpCodes.SquareRoot: {
             CompileInstructions(il, state, ds);
@@ -300,4 +334,24 @@
             return;
           }
+        case OpCodes.CubeRoot: {
+            CompileInstructions(il, state, ds);
+            var c1 = il.DefineLabel();
+            var end = il.DefineLabel();
+
+            il.Emit(System.Reflection.Emit.OpCodes.Dup); // x
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0);
+            il.Emit(System.Reflection.Emit.OpCodes.Clt); // x < 0?
+            il.Emit(System.Reflection.Emit.OpCodes.Brfalse, c1);
+            il.Emit(System.Reflection.Emit.OpCodes.Neg); // x = -x
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0 / 3.0);
+            il.Emit(System.Reflection.Emit.OpCodes.Call, power);
+            il.Emit(System.Reflection.Emit.OpCodes.Neg); // -Math.Pow(-x, 1/3)
+            il.Emit(System.Reflection.Emit.OpCodes.Br, end);
+            il.MarkLabel(c1);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0 / 3.0);
+            il.Emit(System.Reflection.Emit.OpCodes.Call, power);
+            il.MarkLabel(end);
+            return;
+          }
         case OpCodes.AiryA: {
             CompileInstructions(il, state, ds);
@@ -373,4 +427,16 @@
             CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Call, sinIntegral);
+            return;
+          }
+        case OpCodes.AnalyticQuotient: {
+            CompileInstructions(il, state, ds); // x1
+            CompileInstructions(il, state, ds); // x2
+
+            il.Emit(System.Reflection.Emit.OpCodes.Dup);
+            il.Emit(System.Reflection.Emit.OpCodes.Mul); // x2*x2
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0);
+            il.Emit(System.Reflection.Emit.OpCodes.Add); // 1+x2*x2
+            il.Emit(System.Reflection.Emit.OpCodes.Call, sqrt);
+            il.Emit(System.Reflection.Emit.OpCodes.Div);
             return;
           }
@@ -379,5 +445,5 @@
             Label c1 = il.DefineLabel();
             CompileInstructions(il, state, ds);
-            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0
             il.Emit(System.Reflection.Emit.OpCodes.Cgt);
             il.Emit(System.Reflection.Emit.OpCodes.Brfalse, c1);
@@ -394,10 +460,10 @@
             CompileInstructions(il, state, ds);
             for (int i = 1; i < nArgs; i++) {
-              il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
+              il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0
               il.Emit(System.Reflection.Emit.OpCodes.Cgt);
               il.Emit(System.Reflection.Emit.OpCodes.Brfalse, falseBranch);
               CompileInstructions(il, state, ds);
             }
-            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0
             il.Emit(System.Reflection.Emit.OpCodes.Cgt);
             il.Emit(System.Reflection.Emit.OpCodes.Brfalse, falseBranch);
@@ -419,5 +485,5 @@
               // complex definition because of special properties of NaN  
               il.Emit(System.Reflection.Emit.OpCodes.Dup);
-              il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // <= 0        
+              il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // <= 0        
               il.Emit(System.Reflection.Emit.OpCodes.Ble, nextArgBranch);
               il.Emit(System.Reflection.Emit.OpCodes.Br, resultBranch);
@@ -427,5 +493,5 @@
             }
             il.MarkLabel(resultBranch);
-            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0
             il.Emit(System.Reflection.Emit.OpCodes.Cgt);
             il.Emit(System.Reflection.Emit.OpCodes.Brtrue, trueBranch);
@@ -440,6 +506,7 @@
         case OpCodes.NOT: {
             CompileInstructions(il, state, ds);
-            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); // > 0
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0
             il.Emit(System.Reflection.Emit.OpCodes.Cgt);
+            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
             il.Emit(System.Reflection.Emit.OpCodes.Mul);
@@ -449,9 +516,17 @@
             return;
           }
-        case OpCodes.GT: {
-            CompileInstructions(il, state, ds);
-            CompileInstructions(il, state, ds);
-
-            il.Emit(System.Reflection.Emit.OpCodes.Cgt); // 1 (>) / 0 (otherwise)
+        case OpCodes.XOR: {
+            CompileInstructions(il, state, ds);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0);
+            il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0
+
+            for (int i = 1; i < nArgs; i++) {
+              CompileInstructions(il, state, ds);
+              il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0);
+              il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0
+              il.Emit(System.Reflection.Emit.OpCodes.Xor);
+            }
+            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
+
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
             il.Emit(System.Reflection.Emit.OpCodes.Mul);
@@ -460,8 +535,21 @@
             return;
           }
+        case OpCodes.GT: {
+            CompileInstructions(il, state, ds);
+            CompileInstructions(il, state, ds);
+
+            il.Emit(System.Reflection.Emit.OpCodes.Cgt); // 1 (>) / 0 (otherwise)
+            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
+            il.Emit(System.Reflection.Emit.OpCodes.Mul);
+            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0); // - 1
+            il.Emit(System.Reflection.Emit.OpCodes.Sub);
+            return;
+          }
         case OpCodes.LT: {
             CompileInstructions(il, state, ds);
             CompileInstructions(il, state, ds);
             il.Emit(System.Reflection.Emit.OpCodes.Clt);
+            il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64
             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2
             il.Emit(System.Reflection.Emit.OpCodes.Mul);
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,41 +27,52 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("FB94F333-B32A-44FB-A561-CBDE76693D20")]
   [Item("SymbolicDataAnalysisExpressionTreeInterpreter", "Interpreter for symbolic expression trees including automatically defined functions.")]
-  public class SymbolicDataAnalysisExpressionTreeInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
+  public class SymbolicDataAnalysisExpressionTreeInterpreter : ParameterizedNamedItem,
+    ISymbolicDataAnalysisExpressionTreeInterpreter {
     private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
+    private const string CheckExpressionsWithIntervalArithmeticParameterDescription = "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.";
     private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
 
-    public override bool CanChangeName { get { return false; } }
-    public override bool CanChangeDescription { get { return false; } }
+    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]; }
+    public IFixedValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<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; }
+    public bool CheckExpressionsWithIntervalArithmetic {
+      get { return CheckExpressionsWithIntervalArithmeticParameter.Value.Value; }
+      set { CheckExpressionsWithIntervalArithmeticParameter.Value.Value = value; }
+    }
+
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
     }
     #endregion
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionTreeInterpreter(bool deserializing) : base(deserializing) { }
-    protected SymbolicDataAnalysisExpressionTreeInterpreter(SymbolicDataAnalysisExpressionTreeInterpreter original, Cloner cloner) : base(original, cloner) { }
+    protected SymbolicDataAnalysisExpressionTreeInterpreter(StorableConstructorFlag _) : base(_) { }
+
+    protected SymbolicDataAnalysisExpressionTreeInterpreter(SymbolicDataAnalysisExpressionTreeInterpreter original,
+      Cloner cloner)
+      : base(original, cloner) { }
+
     public override IDeepCloneable Clone(Cloner cloner) {
       return new SymbolicDataAnalysisExpressionTreeInterpreter(this, cloner);
@@ -70,35 +81,49 @@
     public SymbolicDataAnalysisExpressionTreeInterpreter()
       : base("SymbolicDataAnalysisExpressionTreeInterpreter", "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)));
+      Parameters.Add(new FixedValueParameter<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 FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
     }
 
     protected SymbolicDataAnalysisExpressionTreeInterpreter(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)));
+      Parameters.Add(new FixedValueParameter<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 FixedValueParameter<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)));
+      var evaluatedSolutions = new IntValue(0);
+      var checkExpressionsWithIntervalArithmetic = new BoolValue(false);
+      if (Parameters.ContainsKey(EvaluatedSolutionsParameterName)) {
+        var evaluatedSolutionsParameter = (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName];
+        evaluatedSolutions = evaluatedSolutionsParameter.Value;
+        Parameters.Remove(EvaluatedSolutionsParameterName);
+      }
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", evaluatedSolutions));
+      if (Parameters.ContainsKey(CheckExpressionsWithIntervalArithmeticParameterName)) {
+        var checkExpressionsWithIntervalArithmeticParameter = (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName];
+        Parameters.Remove(CheckExpressionsWithIntervalArithmeticParameterName);
+        checkExpressionsWithIntervalArithmetic = checkExpressionsWithIntervalArithmeticParameter.Value;
+      }
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, checkExpressionsWithIntervalArithmetic));
     }
 
     #region IStatefulItem
     public void InitializeState() {
-      EvaluatedSolutions.Value = 0;
-    }
-
-    public void ClearState() {
-    }
+      EvaluatedSolutions = 0;
+    }
+
+    public void ClearState() { }
     #endregion
 
-    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {
-      if (CheckExpressionsWithIntervalArithmetic.Value)
+    private readonly object syncRoot = new object();
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset,
+      IEnumerable<int> rows) {
+      if (CheckExpressionsWithIntervalArithmetic) {
         throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
-
-      lock (EvaluatedSolutions) {
-        EvaluatedSolutions.Value++; // increment the evaluated solutions counter
+      }
+
+      lock (syncRoot) {
+        EvaluatedSolutions++; // increment the evaluated solutions counter
       }
       var state = PrepareInterpreterState(tree, dataset);
@@ -111,5 +136,5 @@
     }
 
-    private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset) {
+    private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, IDataset dataset) {
       Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
       int necessaryArgStackSize = 0;
@@ -118,4 +143,10 @@
           var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
           instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
+        } else if (instr.opCode == OpCodes.FactorVariable) {
+          var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode;
+          instr.data = dataset.GetReadOnlyStringValues(factorTreeNode.VariableName);
+        } else if (instr.opCode == OpCodes.BinaryFactorVariable) {
+          var factorTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode;
+          instr.data = dataset.GetReadOnlyStringValues(factorTreeNode.VariableName);
         } else if (instr.opCode == OpCodes.LagVariable) {
           var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
@@ -131,6 +162,5 @@
     }
 
-
-    public virtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) {
+    public virtual double Evaluate(IDataset dataset, ref int row, InterpreterState state) {
       Instruction currentInstr = state.NextInstruction();
       switch (currentInstr.opCode) {
@@ -147,5 +177,5 @@
               s -= Evaluate(dataset, ref row, state);
             }
-            if (currentInstr.nArguments == 1) s = -s;
+            if (currentInstr.nArguments == 1) { s = -s; }
             return s;
           }
@@ -162,5 +192,5 @@
               p /= Evaluate(dataset, ref row, state);
             }
-            if (currentInstr.nArguments == 1) p = 1.0 / p;
+            if (currentInstr.nArguments == 1) { p = 1.0 / p; }
             return p;
           }
@@ -172,4 +202,10 @@
             return sum / currentInstr.nArguments;
           }
+        case OpCodes.Absolute: {
+            return Math.Abs(Evaluate(dataset, ref row, state));
+          }
+        case OpCodes.Tanh: {
+            return Math.Tanh(Evaluate(dataset, ref row, state));
+          }
         case OpCodes.Cos: {
             return Math.Cos(Evaluate(dataset, ref row, state));
@@ -183,4 +219,7 @@
         case OpCodes.Square: {
             return Math.Pow(Evaluate(dataset, ref row, state), 2);
+          }
+        case OpCodes.Cube: {
+            return Math.Pow(Evaluate(dataset, ref row, state), 3);
           }
         case OpCodes.Power: {
@@ -192,4 +231,8 @@
             return Math.Sqrt(Evaluate(dataset, ref row, state));
           }
+        case OpCodes.CubeRoot: {
+            var arg = Evaluate(dataset, ref row, state);
+            return arg < 0 ? -Math.Pow(-arg, 1.0 / 3.0) : Math.Pow(arg, 1.0 / 3.0);
+          }
         case OpCodes.Root: {
             double x = Evaluate(dataset, ref row, state);
@@ -205,6 +248,5 @@
         case OpCodes.Gamma: {
             var x = Evaluate(dataset, ref row, state);
-            if (double.IsNaN(x)) return double.NaN;
-            else return alglib.gammafunction(x);
+            if (double.IsNaN(x)) { return double.NaN; } else { return alglib.gammafunction(x); }
           }
         case OpCodes.Psi: {
@@ -216,10 +258,10 @@
         case OpCodes.Dawson: {
             var x = Evaluate(dataset, ref row, state);
-            if (double.IsNaN(x)) return double.NaN;
+            if (double.IsNaN(x)) { return double.NaN; }
             return alglib.dawsonintegral(x);
           }
         case OpCodes.ExponentialIntegralEi: {
             var x = Evaluate(dataset, ref row, state);
-            if (double.IsNaN(x)) return double.NaN;
+            if (double.IsNaN(x)) { return double.NaN; }
             return alglib.exponentialintegralei(x);
           }
@@ -310,4 +352,10 @@
             if (double.IsNaN(x)) return double.NaN;
             else return alglib.besseli0(x);
+          }
+
+        case OpCodes.AnalyticQuotient: {
+            var x1 = Evaluate(dataset, ref row, state);
+            var x2 = Evaluate(dataset, ref row, state);
+            return x1 / Math.Pow(1 + x2 * x2, 0.5);
           }
         case OpCodes.IfThenElse: {
@@ -344,15 +392,22 @@
             return Evaluate(dataset, ref row, state) > 0.0 ? -1.0 : 1.0;
           }
+        case OpCodes.XOR: {
+            //mkommend: XOR on multiple inputs is defined as true if the number of positive signals is odd
+            // this is equal to a consecutive execution of binary XOR operations.
+            int positiveSignals = 0;
+            for (int i = 0; i < currentInstr.nArguments; i++) {
+              if (Evaluate(dataset, ref row, state) > 0.0) { positiveSignals++; }
+            }
+            return positiveSignals % 2 != 0 ? 1.0 : -1.0;
+          }
         case OpCodes.GT: {
             double x = Evaluate(dataset, ref row, state);
             double y = Evaluate(dataset, ref row, state);
-            if (x > y) return 1.0;
-            else return -1.0;
+            if (x > y) { return 1.0; } else { return -1.0; }
           }
         case OpCodes.LT: {
             double x = Evaluate(dataset, ref row, state);
             double y = Evaluate(dataset, ref row, state);
-            if (x < y) return 1.0;
-            else return -1.0;
+            if (x < y) { return 1.0; } else { return -1.0; }
           }
         case OpCodes.TimeLag: {
@@ -425,8 +480,18 @@
             return ((IList<double>)currentInstr.data)[row] * variableTreeNode.Weight;
           }
+        case OpCodes.BinaryFactorVariable: {
+            if (row < 0 || row >= dataset.Rows) return double.NaN;
+            var factorVarTreeNode = currentInstr.dynamicNode as BinaryFactorVariableTreeNode;
+            return ((IList<string>)currentInstr.data)[row] == factorVarTreeNode.VariableValue ? factorVarTreeNode.Weight : 0;
+          }
+        case OpCodes.FactorVariable: {
+            if (row < 0 || row >= dataset.Rows) return double.NaN;
+            var factorVarTreeNode = currentInstr.dynamicNode as FactorVariableTreeNode;
+            return factorVarTreeNode.GetValue(((IList<string>)currentInstr.data)[row]);
+          }
         case OpCodes.LagVariable: {
             var laggedVariableTreeNode = (LaggedVariableTreeNode)currentInstr.dynamicNode;
             int actualRow = row + laggedVariableTreeNode.Lag;
-            if (actualRow < 0 || actualRow >= dataset.Rows) return double.NaN;
+            if (actualRow < 0 || actualRow >= dataset.Rows) { return double.NaN; }
             return ((IList<double>)currentInstr.data)[actualRow] * laggedVariableTreeNode.Weight;
           }
@@ -441,14 +506,28 @@
             if (row < 0 || row >= dataset.Rows) return double.NaN;
             var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode;
-            double variableValue = ((IList<double>)currentInstr.data)[row];
-            double x = variableValue - variableConditionTreeNode.Threshold;
-            double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
-
-            double trueBranch = Evaluate(dataset, ref row, state);
-            double falseBranch = Evaluate(dataset, ref row, state);
-
-            return trueBranch * p + falseBranch * (1 - p);
-          }
-        default: throw new NotSupportedException();
+            if (!variableConditionTreeNode.Symbol.IgnoreSlope) {
+              double variableValue = ((IList<double>)currentInstr.data)[row];
+              double x = variableValue - variableConditionTreeNode.Threshold;
+              double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
+
+              double trueBranch = Evaluate(dataset, ref row, state);
+              double falseBranch = Evaluate(dataset, ref row, state);
+
+              return trueBranch * p + falseBranch * (1 - p);
+            } else {
+              // strict threshold
+              double variableValue = ((IList<double>)currentInstr.data)[row];
+              if (variableValue <= variableConditionTreeNode.Threshold) {
+                var left = Evaluate(dataset, ref row, state);
+                state.SkipInstructions();
+                return left;
+              } else {
+                state.SkipInstructions();
+                return Evaluate(dataset, ref row, state);
+              }
+            }
+          }
+        default:
+          throw new NotSupportedException();
       }
     }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -28,14 +28,15 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("EF325166-E03A-44C4-83CE-7F07B836285E")]
   [Item("SymbolicDataAnalysisExpressionTreeLinearInterpreter", "Fast linear (non-recursive) interpreter for symbolic expression trees. Does not support ADFs.")]
   public sealed class SymbolicDataAnalysisExpressionTreeLinearInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
     private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic";
+    private const string CheckExpressionsWithIntervalArithmeticParameterDescription = "Switch that determines if the interpreter checks the validity of expressions with interval arithmetic before evaluating the expression.";
     private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
 
-    private SymbolicDataAnalysisExpressionTreeInterpreter interpreter;
+    private readonly SymbolicDataAnalysisExpressionTreeInterpreter interpreter;
 
     public override bool CanChangeName {
@@ -48,27 +49,27 @@
 
     #region parameter properties
-    public IValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
-      get { return (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
-    }
-
-    public IValueParameter<IntValue> EvaluatedSolutionsParameter {
-      get { return (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
+    public IFixedValueParameter<BoolValue> CheckExpressionsWithIntervalArithmeticParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName]; }
+    }
+
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<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; }
+    public bool CheckExpressionsWithIntervalArithmetic {
+      get { return CheckExpressionsWithIntervalArithmeticParameter.Value.Value; }
+      set { CheckExpressionsWithIntervalArithmeticParameter.Value.Value = value; }
+    }
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
     }
     #endregion
 
     [StorableConstructor]
-    private SymbolicDataAnalysisExpressionTreeLinearInterpreter(bool deserializing)
-      : base(deserializing) {
+    private SymbolicDataAnalysisExpressionTreeLinearInterpreter(StorableConstructorFlag _) : base(_) {
+      interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
     }
 
@@ -84,6 +85,13 @@
     public SymbolicDataAnalysisExpressionTreeLinearInterpreter()
       : base("SymbolicDataAnalysisExpressionTreeLinearInterpreter", "Linear (non-recursive) interpreter for symbolic expression trees (does not support ADFs).") {
-      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)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+      interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
+    }
+
+    public SymbolicDataAnalysisExpressionTreeLinearInterpreter(string name, string description)
+      : base(name, description) {
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, new BoolValue(false)));
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
       interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
     }
@@ -91,10 +99,23 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
-      if (interpreter == null) interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
+      var evaluatedSolutions = new IntValue(0);
+      var checkExpressionsWithIntervalArithmetic = new BoolValue(false);
+      if (Parameters.ContainsKey(EvaluatedSolutionsParameterName)) {
+        var evaluatedSolutionsParameter = (IValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName];
+        evaluatedSolutions = evaluatedSolutionsParameter.Value;
+        Parameters.Remove(EvaluatedSolutionsParameterName);
+      }
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", evaluatedSolutions));
+      if (Parameters.ContainsKey(CheckExpressionsWithIntervalArithmeticParameterName)) {
+        var checkExpressionsWithIntervalArithmeticParameter = (IValueParameter<BoolValue>)Parameters[CheckExpressionsWithIntervalArithmeticParameterName];
+        Parameters.Remove(CheckExpressionsWithIntervalArithmeticParameterName);
+        checkExpressionsWithIntervalArithmetic = checkExpressionsWithIntervalArithmeticParameter.Value;
+      }
+      Parameters.Add(new FixedValueParameter<BoolValue>(CheckExpressionsWithIntervalArithmeticParameterName, CheckExpressionsWithIntervalArithmeticParameterDescription, checkExpressionsWithIntervalArithmetic));
     }
 
     #region IStatefulItem
     public void InitializeState() {
-      EvaluatedSolutions.Value = 0;
+      EvaluatedSolutions = 0;
     }
 
@@ -102,10 +123,12 @@
     #endregion
 
-    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {
-      if (CheckExpressionsWithIntervalArithmetic.Value)
+    private readonly object syncRoot = new object();
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) {
+      if (!rows.Any()) return Enumerable.Empty<double>();
+      if (CheckExpressionsWithIntervalArithmetic)
         throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter.");
 
-      lock (EvaluatedSolutions) {
-        EvaluatedSolutions.Value++; // increment the evaluated solutions counter
+      lock (syncRoot) {
+        EvaluatedSolutions++; // increment the evaluated solutions counter
       }
 
@@ -115,5 +138,5 @@
     }
 
-    private double Evaluate(Dataset dataset, int row, LinearInstruction[] code) {
+    private double Evaluate(IDataset dataset, int row, LinearInstruction[] code) {
       for (int i = code.Length - 1; i >= 0; --i) {
         if (code[i].skip) continue;
@@ -122,6 +145,20 @@
         if (instr.opCode == OpCodes.Variable) {
           if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
-          var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
-          instr.value = ((IList<double>)instr.data)[row] * variableTreeNode.Weight;
+          else {
+            var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
+            instr.value = ((IList<double>)instr.data)[row] * variableTreeNode.Weight;
+          }
+        } else if (instr.opCode == OpCodes.BinaryFactorVariable) {
+          if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
+          else {
+            var factorTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode;
+            instr.value = ((IList<string>)instr.data)[row] == factorTreeNode.VariableValue ? factorTreeNode.Weight : 0;
+          }
+        } else if (instr.opCode == OpCodes.FactorVariable) {
+          if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
+          else {
+            var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode;
+            instr.value = factorTreeNode.GetValue(((IList<string>)instr.data)[row]);
+          }
         } else if (instr.opCode == OpCodes.LagVariable) {
           var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
@@ -134,12 +171,21 @@
           if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
           var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
-          double variableValue = ((IList<double>)instr.data)[row];
-          double x = variableValue - variableConditionTreeNode.Threshold;
-          double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
-
-          double trueBranch = code[instr.childIndex].value;
-          double falseBranch = code[instr.childIndex + 1].value;
-
-          instr.value = trueBranch * p + falseBranch * (1 - p);
+          if (!variableConditionTreeNode.Symbol.IgnoreSlope) {
+            double variableValue = ((IList<double>)instr.data)[row];
+            double x = variableValue - variableConditionTreeNode.Threshold;
+            double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
+
+            double trueBranch = code[instr.childIndex].value;
+            double falseBranch = code[instr.childIndex + 1].value;
+
+            instr.value = trueBranch * p + falseBranch * (1 - p);
+          } else {
+            double variableValue = ((IList<double>)instr.data)[row];
+            if (variableValue <= variableConditionTreeNode.Threshold) {
+              instr.value = code[instr.childIndex].value;
+            } else {
+              instr.value = code[instr.childIndex + 1].value;
+            }
+          }
         } else if (instr.opCode == OpCodes.Add) {
           double s = code[instr.childIndex].value;
@@ -168,4 +214,8 @@
           if (instr.nArguments == 1) p = 1.0 / p;
           instr.value = p;
+        } else if (instr.opCode == OpCodes.AnalyticQuotient) {
+          var x1 = code[instr.childIndex].value;
+          var x2 = code[instr.childIndex + 1].value;
+          instr.value = x1 / Math.Sqrt(1 + x2 * x2);
         } else if (instr.opCode == OpCodes.Average) {
           double s = code[instr.childIndex].value;
@@ -174,4 +224,8 @@
           }
           instr.value = s / instr.nArguments;
+        } else if (instr.opCode == OpCodes.Absolute) {
+          instr.value = Math.Abs(code[instr.childIndex].value);
+        } else if (instr.opCode == OpCodes.Tanh) {
+          instr.value = Math.Tanh(code[instr.childIndex].value);
         } else if (instr.opCode == OpCodes.Cos) {
           instr.value = Math.Cos(code[instr.childIndex].value);
@@ -182,4 +236,6 @@
         } else if (instr.opCode == OpCodes.Square) {
           instr.value = Math.Pow(code[instr.childIndex].value, 2);
+        } else if (instr.opCode == OpCodes.Cube) {
+          instr.value = Math.Pow(code[instr.childIndex].value, 3);
         } else if (instr.opCode == OpCodes.Power) {
           double x = code[instr.childIndex].value;
@@ -188,7 +244,10 @@
         } else if (instr.opCode == OpCodes.SquareRoot) {
           instr.value = Math.Sqrt(code[instr.childIndex].value);
+        } else if (instr.opCode == OpCodes.CubeRoot) {
+          var arg = code[instr.childIndex].value;
+          instr.value = arg < 0 ? -Math.Pow(-arg, 1.0 / 3.0) : Math.Pow(arg, 1.0 / 3.0);
         } else if (instr.opCode == OpCodes.Root) {
           double x = code[instr.childIndex].value;
-          double y = code[instr.childIndex + 1].value;
+          double y = Math.Round(code[instr.childIndex + 1].value);
           instr.value = Math.Pow(x, 1 / y);
         } else if (instr.opCode == OpCodes.Exp) {
@@ -311,4 +370,10 @@
         } else if (instr.opCode == OpCodes.NOT) {
           instr.value = code[instr.childIndex].value > 0.0 ? -1.0 : 1.0;
+        } else if (instr.opCode == OpCodes.XOR) {
+          int positiveSignals = 0;
+          for (int j = 0; j < instr.nArguments; j++) {
+            if (code[instr.childIndex + j].value > 0.0) positiveSignals++;
+          }
+          instr.value = positiveSignals % 2 != 0 ? 1.0 : -1.0;
         } else if (instr.opCode == OpCodes.GT) {
           double x = code[instr.childIndex].value;
@@ -346,5 +411,5 @@
     }
 
-    private static void PrepareInstructions(LinearInstruction[] code, Dataset dataset) {
+    public static void PrepareInstructions(LinearInstruction[] code, IDataset dataset) {
       for (int i = 0; i != code.Length; ++i) {
         var instr = code[i];
@@ -362,4 +427,14 @@
             }
             break;
+          case OpCodes.BinaryFactorVariable: {
+              var factorVariableTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode;
+              instr.data = dataset.GetReadOnlyStringValues(factorVariableTreeNode.VariableName);
+            }
+            break;
+          case OpCodes.FactorVariable: {
+              var factorVariableTreeNode = instr.dynamicNode as FactorVariableTreeNode;
+              instr.data = dataset.GetReadOnlyStringValues(factorVariableTreeNode.VariableName);
+            }
+            break;
           case OpCodes.LagVariable: {
               var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
@@ -380,6 +455,6 @@
               for (int j = 1; j != seq.Length; ++j)
                 seq[j].skip = true;
-            }
-            break;
+              break;
+            }
         }
         #endregion
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs	(revision 17687)
@@ -0,0 +1,184 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("91723319-8F15-4D33-B277-40AC7C7CF9AE")]
+  [Item("SymbolicDataAnalysisExpressionTreeNativeInterpreter", "An interpreter that wraps a native dll")]
+  public class SymbolicDataAnalysisExpressionTreeNativeInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter {
+    private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
+
+    #region parameters
+    public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[EvaluatedSolutionsParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public int EvaluatedSolutions {
+      get { return EvaluatedSolutionsParameter.Value.Value; }
+      set { EvaluatedSolutionsParameter.Value.Value = value; }
+    }
+    #endregion
+
+    public void ClearState() { }
+
+    public SymbolicDataAnalysisExpressionTreeNativeInterpreter() {
+      Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
+    }
+
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionTreeNativeInterpreter(StorableConstructorFlag _) : base(_) { }
+
+    protected SymbolicDataAnalysisExpressionTreeNativeInterpreter(SymbolicDataAnalysisExpressionTreeNativeInterpreter original, Cloner cloner) : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionTreeNativeInterpreter(this, cloner);
+    }
+
+    private NativeInstruction[] Compile(ISymbolicExpressionTree tree, Func<ISymbolicExpressionTreeNode, byte> opCodeMapper) {
+      var root = tree.Root.GetSubtree(0).GetSubtree(0);
+      var code = new NativeInstruction[root.GetLength()];
+      if (root.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
+      code[0] = new NativeInstruction { narg = (ushort)root.SubtreeCount, opcode = opCodeMapper(root) };
+      int c = 1, i = 0;
+      foreach (var node in root.IterateNodesBreadth()) {
+        for (int j = 0; j < node.SubtreeCount; ++j) {
+          var s = node.GetSubtree(j);
+          if (s.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
+          code[c + j] = new NativeInstruction { narg = (ushort)s.SubtreeCount, opcode = opCodeMapper(s) };
+        }
+
+        if (node is VariableTreeNode variable) {
+          code[i].weight = variable.Weight;
+          code[i].data = cachedData[variable.VariableName].AddrOfPinnedObject();
+        } else if (node is ConstantTreeNode constant) {
+          code[i].value = constant.Value;
+        }
+
+        code[i].childIndex = c;
+        c += node.SubtreeCount;
+        ++i;
+      }
+      return code;
+    }
+
+    private readonly object syncRoot = new object();
+
+    [ThreadStatic]
+    private static Dictionary<string, GCHandle> cachedData;
+
+    [ThreadStatic]
+    private static IDataset cachedDataset;
+
+    private static readonly HashSet<byte> supportedOpCodes = new HashSet<byte>() {
+      (byte)OpCode.Constant,
+      (byte)OpCode.Variable,
+      (byte)OpCode.Add,
+      (byte)OpCode.Sub,
+      (byte)OpCode.Mul,
+      (byte)OpCode.Div,
+      (byte)OpCode.Exp,
+      (byte)OpCode.Log,
+      (byte)OpCode.Sin,
+      (byte)OpCode.Cos,
+      (byte)OpCode.Tan,
+      (byte)OpCode.Tanh,
+      (byte)OpCode.Power,
+      (byte)OpCode.Root,
+      (byte)OpCode.SquareRoot,
+      (byte)OpCode.Square,
+      (byte)OpCode.CubeRoot,
+      (byte)OpCode.Cube,
+      (byte)OpCode.Absolute,
+      (byte)OpCode.AnalyticQuotient
+    };
+
+    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) {
+      if (!rows.Any()) return Enumerable.Empty<double>();
+
+      if (cachedData == null || cachedDataset != dataset) {
+        InitCache(dataset);
+      }
+
+      byte mapSupportedSymbols(ISymbolicExpressionTreeNode node) {        
+        var opCode = OpCodes.MapSymbolToOpCode(node);
+        if (supportedOpCodes.Contains(opCode)) return opCode;
+        else throw new NotSupportedException($"The native interpreter does not support {node.Symbol.Name}");
+      };
+      var code = Compile(tree, mapSupportedSymbols);
+
+      var rowsArray = rows.ToArray();
+      var result = new double[rowsArray.Length];
+
+      NativeWrapper.GetValuesVectorized(code, code.Length, rowsArray, rowsArray.Length, result);
+
+      // when evaluation took place without any error, we can increment the counter
+      lock (syncRoot) {
+        EvaluatedSolutions++;
+      }
+
+      return result;
+    }
+
+    private void InitCache(IDataset dataset) {
+      cachedDataset = dataset;
+
+      // free handles to old data
+      if (cachedData != null) {
+        foreach (var gch in cachedData.Values) {
+          gch.Free();
+        }
+        cachedData = null;
+      }
+
+      // cache new data
+      cachedData = new Dictionary<string, GCHandle>();
+      foreach (var v in dataset.DoubleVariables) {
+        var values = dataset.GetDoubleValues(v).ToArray();
+        var gch = GCHandle.Alloc(values, GCHandleType.Pinned);
+        cachedData[v] = gch;
+      }
+    }
+
+    public void InitializeState() {
+      if (cachedData != null) {
+        foreach (var gch in cachedData.Values) {
+          gch.Free();
+        }
+        cachedData = null;
+      }
+      cachedDataset = null;
+      EvaluatedSolutions = 0;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Plugin.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Plugin.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Plugin.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,7 +26,8 @@
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic","Provides base classes for symbolic data analysis tasks.", "3.4.5.$WCREV$")]
+  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic","Provides base classes for symbolic data analysis tasks.", "3.4.12.$WCREV$")]
   [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
+  [PluginDependency("HeuristicLab.AutoDiff", "1.0")]
   [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
@@ -36,12 +37,14 @@
   [PluginDependency("HeuristicLab.Data", "3.3")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
+  [PluginDependency("HeuristicLab.NativeInterpreter", "0.1")]
   [PluginDependency("HeuristicLab.Operators", "3.3")]
   [PluginDependency("HeuristicLab.Optimization", "3.3")]
   [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
   [PluginDependency("HeuristicLab.Parameters", "3.3")]
-  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Attic", "1.0")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
   [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
   [PluginDependency("HeuristicLab.Random", "3.3")]
+  [PluginDependency("HeuristicLab.Selection", "3.3")]
   public class HeuristicLabProblemsDataAnalysisSymbolicPlugin : PluginBase {
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Properties/AssemblyInfo.cs.frame	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Properties/AssemblyInfo.cs.frame	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,5 +31,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
+[assembly: AssemblyCopyright("(c) HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -53,3 +53,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.5.$WCREV$")]
+[assembly: AssemblyFileVersion("3.4.12.$WCREV$")]
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs	(revision 17687)
@@ -0,0 +1,212 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("3E8EA052-3B86-4609-BD38-E3FE78DAD2FF")]
+  [Item("DiversitySelector", "A selection operator that applies a diversity penalty to the objective function before applying an inner selector.")]
+  public sealed class DiversitySelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
+    private const string StrictSimilarityParameterName = "StrictSimilarity";
+    private const string SimilarityWeightParameterName = "SimilarityWeight";
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string SelectorParameterName = "Selector";
+    private const string DiversityParameterName = "Diversity";
+
+    public IValueParameter<ISingleObjectiveSelector> SelectorParameter {
+      get { return (IValueParameter<ISingleObjectiveSelector>)Parameters[SelectorParameterName]; }
+    }
+
+    public ISingleObjectiveSelector Selector {
+      get { return SelectorParameter.Value; }
+      set { SelectorParameter.Value = value; }
+    }
+
+    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+
+    public IScopeTreeLookupParameter<DoubleValue> DiversityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[DiversityParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> StrictSimilarityParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[StrictSimilarityParameterName]; }
+    }
+
+    public IFixedValueParameter<DoubleValue> SimilarityWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[SimilarityWeightParameterName]; }
+    }
+
+    public bool StrictSimilarity {
+      get { return StrictSimilarityParameter.Value.Value; }
+      set { StrictSimilarityParameter.Value.Value = value; }
+    }
+
+    public double SimilarityWeight {
+      get { return SimilarityWeightParameter.Value.Value; }
+      set { SimilarityWeightParameter.Value.Value = value; }
+    }
+
+    public DiversitySelector() : base() {
+      Parameters.Add(new FixedValueParameter<BoolValue>(StrictSimilarityParameterName, "Calculate strict similarity.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(SimilarityWeightParameterName, "Weight of the diversity term.", new DoubleValue(1)));
+      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees that should be analyzed."));
+      Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", new TournamentSelector()));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName, "The diversity value calcuated by the operator (output). The inner selector uses this value."));
+
+      RegisterParameterEventHandlers();
+    }
+
+    [StorableConstructor]
+    private DiversitySelector(StorableConstructorFlag _) : base(_) { }
+
+    private DiversitySelector(DiversitySelector original, Cloner cloner) : base(original, cloner) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new DiversitySelector(this, cloner);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey(DiversityParameterName)) {
+        Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName));
+      }
+
+      RegisterParameterEventHandlers();
+    }
+
+    #region Events
+    private void RegisterParameterEventHandlers() {
+      SelectorParameter.ValueChanged += SelectorParameter_ValueChanged;
+      CopySelectedParameter.ValueChanged += CopySelectedParameter_ValueChanged;
+      CopySelected.ValueChanged += CopySelected_ValueChanged;
+
+      MaximizationParameter.NameChanged += MaximizationParameter_NameChanged;
+      QualityParameter.NameChanged += QualityParameter_NameChanged;
+      RandomParameter.NameChanged += RandomParameter_NameChanged;
+    }
+
+    private void RandomParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); }
+    private void QualityParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); }
+    private void MaximizationParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); }
+
+    private void CopySelectedParameter_ValueChanged(object sender, EventArgs e) {
+      if (CopySelected.Value != true) {
+        CopySelected.Value = true;
+      }
+      CopySelected.ValueChanged += CopySelected_ValueChanged;
+    }
+
+    private void SelectorParameter_ValueChanged(object sender, EventArgs e) {
+      ParameterizeSelector(Selector);
+    }
+
+    private void CopySelected_ValueChanged(object sender, EventArgs e) {
+      if (CopySelected.Value != true) {
+        CopySelected.Value = true;
+      }
+    }
+    #endregion
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      var w = SimilarityWeight;
+      if (w.IsAlmost(0)) {
+        ApplyInnerSelector();
+        return CurrentScope.SubScopes[1].SubScopes.ToArray();  // return selected individuals (selectors create two sub-scopes with remaining and selected)
+      }
+
+      var trees = SymbolicExpressionTreeParameter.ActualValue;
+      var qualities = QualityParameter.ActualValue;
+
+      // calculate average similarity for each tree
+      var similarityMatrix = SymbolicExpressionTreeHash.ComputeSimilarityMatrix(trees, simplify: false, strict: StrictSimilarity);
+      var similarities = new double[trees.Length];
+      for (int i = 0; i < trees.Length; ++i) {
+        for (int j = 0; j < trees.Length; ++j) {
+          if (i != j) {
+            similarities[i] += similarityMatrix[i, j];
+          }
+        }
+        similarities[i] /= (trees.Length - 1);
+      }
+
+      var v = 1 - w;
+
+      var maximization = MaximizationParameter.ActualValue.Value;
+      var diversities = new ItemArray<DoubleValue>(trees.Length);
+      for (int i = 0; i < trees.Length; ++i) {
+        var q = qualities[i].Value;
+        var d = 1 - similarities[i]; // average distance
+
+        // assuming both q and d are in the interval [0, 1]
+        var value = maximization
+            ? (v * q) + (w * d)
+            : (v * q) - (w * d);
+
+        diversities[i] = new DoubleValue(value);
+      }
+
+      Selector.QualityParameter.ActualName = "Diversity";
+      DiversityParameter.ActualValue = diversities;
+      ApplyInnerSelector(); // apply inner selector
+
+      return CurrentScope.SubScopes[1].SubScopes.ToArray();
+    }
+
+    private void ParameterizeSelector(ISingleObjectiveSelector selector) {
+      selector.CopySelected = new BoolValue(true); // must always be true
+      selector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      selector.QualityParameter.ActualName = QualityParameter.Name;
+
+      IStochasticOperator stoOp = (selector as IStochasticOperator);
+      if (stoOp != null) stoOp.RandomParameter.ActualName = RandomParameter.Name;
+    }
+
+    private void ApplyInnerSelector() {
+      // necessary for inner GenderSpecificSelector to execute all operations in OperationCollection
+      Stack<IOperation> executionStack = new Stack<IOperation>();
+      executionStack.Push(ExecutionContext.CreateChildOperation(Selector));
+      while (executionStack.Count > 0) {
+        CancellationToken.ThrowIfCancellationRequested();
+        IOperation next = executionStack.Pop();
+        if (next is OperationCollection) {
+          OperationCollection coll = (OperationCollection)next;
+          for (int i = coll.Count - 1; i >= 0; i--)
+            if (coll[i] != null) executionStack.Push(coll[i]);
+        } else if (next is IAtomicOperation) {
+          IAtomicOperation operation = (IAtomicOperation)next;
+          next = operation.Operator.Execute((IExecutionContext)operation, CancellationToken);
+          if (next != null) executionStack.Push(next);
+        }
+      }
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/GenerationalSlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/GenerationalSlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/GenerationalSlidingWindowAnalyzer.cs	(revision 17687)
@@ -26,8 +26,9 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [Item("Generational Sliding Window GP Analyzer", "Analyzer which moves a sliding window every n-th generation over the training partition.")]
-  [StorableClass]
+  [StorableType("B72D17A8-B032-4974-9916-D48D128A0A4B")]
   public class GenerationalSlidingWindowAnalyzer : SlidingWindowAnalyzer, IIterationBasedOperator {
     private const string GenerationsIntervalParameterName = "Generation Interval";
@@ -62,5 +63,5 @@
 
     [StorableConstructor]
-    protected GenerationalSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected GenerationalSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected GenerationalSlidingWindowAnalyzer(GenerationalSlidingWindowAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/OffspringSelectionSlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/OffspringSelectionSlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/OffspringSelectionSlidingWindowAnalyzer.cs	(revision 17687)
@@ -25,8 +25,9 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
   [Item("Offspring Selection Sliding Window GP Analyzer", "Analyzer which moves a sliding window whenever the selection pressure exceeds a certain threshold.")]
-  [StorableClass]
+  [StorableType("A6424928-C98C-4166-9ABD-29934B2A0853")]
   public class OffspringSelectionSlidingWindowAnalyzer : SlidingWindowAnalyzer {
     private const string SelectionPressureParameterName = "SelectionPressure";
@@ -50,5 +51,5 @@
 
     [StorableConstructor]
-    protected OffspringSelectionSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected OffspringSelectionSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected OffspringSelectionSlidingWindowAnalyzer(OffspringSelectionSlidingWindowAnalyzer original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs	(revision 17687)
@@ -30,9 +30,9 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
   [Item("Sliding Window GP Analyzer", "Base class for concrete sliding window GP analyzers.")]
+  [StorableType("FDBFFC8A-27BF-44F7-B499-352443B65DBA")]
   public abstract class SlidingWindowAnalyzer : SymbolicDataAnalysisSingleObjectiveAnalyzer {
     private const string ProblemDataParameterName = "ProblemData";
@@ -92,5 +92,5 @@
 
     [StorableConstructor]
-    protected SlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
+    protected SlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
     protected SlidingWindowAnalyzer(SlidingWindowAnalyzer original, Cloner cloner)
       : base(original, cloner) { }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowBestSolutionsCollection.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowBestSolutionsCollection.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowBestSolutionsCollection.cs	(revision 17687)
@@ -28,8 +28,9 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
   [Item("SlidingWindowBestSolutionsCollection", "An object holding a collection of the best sliding window solutions.")]
+  [StorableType("08DA042D-9A0E-4D7A-8ED7-AED6918D8EF3")]
   public abstract class SlidingWindowBestSolutionsCollection : Item {
     [Storable]
@@ -146,6 +147,5 @@
 
     [StorableConstructor]
-    protected SlidingWindowBestSolutionsCollection(bool deserializing)
-      : base(deserializing) {
+    protected SlidingWindowBestSolutionsCollection(StorableConstructorFlag _) : base(_) {
     }
 
@@ -336,5 +336,5 @@
   }
 
-  [StorableClass]
+  [StorableType("170F5739-8D8C-4A44-9EA2-B28B35E97A3F")]
   public sealed class SlidingWindowRange : IEquatable<SlidingWindowRange> {
     [Storable]
@@ -345,5 +345,5 @@
 
     [StorableConstructor]
-    private SlidingWindowRange(bool deserializable) { }
+    private SlidingWindowRange(StorableConstructorFlag _) { }
     private SlidingWindowRange() { }
 
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowData.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowData.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowData.cs	(revision 17687)
@@ -27,8 +27,9 @@
 using HeuristicLab.Data;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
   [Item("Sliding Window Position", "")]
+  [StorableType("6D2F5417-5E2F-4BC6-AA4D-E4FB5B3D09D1")]
   public sealed class SlidingWindowData : Item {
     [Storable]
@@ -71,5 +72,5 @@
 
     [StorableConstructor]
-    private SlidingWindowData(bool deserializing) : base(deserializing) { }
+    private SlidingWindowData(StorableConstructorFlag _) : base(_) { }
     private SlidingWindowData(SlidingWindowData original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowQualitiesAnalyzer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowQualitiesAnalyzer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowQualitiesAnalyzer.cs	(revision 17687)
@@ -28,8 +28,9 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.SlidingWindow {
-  [StorableClass]
   [Item("Sliding Window Qualities Analyzer", "Analyzer that computes the qualities of the best solution on past, current, and future regions of the sliding window training data.")]
+  [StorableType("641864B3-F5B9-4926-84CB-FD881D385E9E")]
   public sealed class SlidingWindowQualitiesAnalyzer : SymbolicDataAnalysisAnalyzer {
     private const string SlidingWindowQualitiesResultName = "Sliding Window Qualities";
@@ -67,5 +68,5 @@
 
     [StorableConstructor]
-    private SlidingWindowQualitiesAnalyzer(bool deserializing) : base(deserializing) { }
+    private SlidingWindowQualitiesAnalyzer(StorableConstructorFlag _) : base(_) { }
 
     public SlidingWindowQualitiesAnalyzer() {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowVisualizer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowVisualizer.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowVisualizer.cs	(revision 17687)
@@ -28,8 +28,9 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.SlidingWindow {
-  [StorableClass]
   [Item("Sliding Window Visualizer", "Visualizes the actual sliding window position.")]
+  [StorableType("27F88470-70F5-47B5-A491-BE6B39B1F78D")]
   public sealed class SlidingWindowVisualizer : SymbolicDataAnalysisAnalyzer {
     private const string ProblemDataParameterName = "ProblemData";
@@ -50,5 +51,5 @@
 
     [StorableConstructor]
-    private SlidingWindowVisualizer(bool deserializing) : base(deserializing) { }
+    private SlidingWindowVisualizer(StorableConstructorFlag _) : base(_) { }
     private SlidingWindowVisualizer(SlidingWindowVisualizer original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs	(revision 17687)
@@ -2,5 +2,5 @@
 
 /* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,10 +29,10 @@
 using HeuristicLab.Operators;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("DBE27385-2E8C-4314-88B4-F96A5240FC9D")]
   [Item("SymbolicExpressionTreePruningOperator", "An operator that replaces introns with constant values in a symbolic expression tree.")]
-  public abstract class SymbolicDataAnalysisExpressionPruningOperator : SingleSuccessorOperator {
+  public abstract class SymbolicDataAnalysisExpressionPruningOperator : SingleSuccessorOperator, ISymbolicExpressionTreeOperator {
     #region parameter names
     private const string ProblemDataParameterName = "ProblemData";
@@ -41,4 +41,5 @@
     private const string PrunedSubtreesParameterName = "PrunedSubtrees";
     private const string PrunedTreesParameterName = "PrunedTrees";
+    private const string PrunedNodesParameterName = "PrunedNodes";
     private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition";
     private const string NodeImpactThresholdParameterName = "ImpactThreshold";
@@ -48,4 +49,5 @@
     private const string EstimationLimitsParameterName = "EstimationLimits";
     private const string InterpreterParameterName = "SymbolicExpressionTreeInterpreter";
+    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
     #endregion
 
@@ -72,4 +74,7 @@
       get { return (ILookupParameter<IntValue>)Parameters[PrunedTreesParameterName]; }
     }
+    public ILookupParameter<IntValue> PrunedNodesParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[PrunedNodesParameterName]; }
+    }
     public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter {
       get { return (IFixedValueParameter<DoubleValue>)Parameters[NodeImpactThresholdParameterName]; }
@@ -84,27 +89,35 @@
       get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[InterpreterParameterName]; }
     }
+    public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
+    }
     #endregion
+
     #region properties
-    protected IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } }
-    protected ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactValuesCalculator { get { return ImpactValuesCalculatorParameter.Value; } }
-    protected IntRange FitnessCalculationPartition { get { return FitnessCalculationPartitionParameter.ActualValue; } }
-    protected BoolValue PruneOnlyZeroImpactNodes { get { return PruneOnlyZeroImpactNodesParameter.Value; } }
-    protected DoubleValue NodeImpactThreshold { get { return NodeImpactThresholdParameter.Value; } }
-    protected ISymbolicExpressionTree SymbolicExpressionTree { get { return SymbolicExpressionTreeParameter.ActualValue; } }
-    protected DoubleValue Quality { get { return QualityParameter.ActualValue; } }
-    protected DoubleLimit EstimationLimits { get { return EstimationLimitsParameter.ActualValue; } }
-    protected ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get { return InterpreterParameter.ActualValue; } }
+    public ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactValuesCalculator {
+      get { return ImpactValuesCalculatorParameter.Value; }
+      set { ImpactValuesCalculatorParameter.Value = value; }
+    }
+    public bool PruneOnlyZeroImpactNodes {
+      get { return PruneOnlyZeroImpactNodesParameter.Value.Value; }
+      set { PruneOnlyZeroImpactNodesParameter.Value.Value = value; }
+    }
+    public double NodeImpactThreshold {
+      get { return NodeImpactThresholdParameter.Value.Value; }
+      set { NodeImpactThresholdParameter.Value.Value = value; }
+    }
     #endregion
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisExpressionPruningOperator(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisExpressionPruningOperator(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisExpressionPruningOperator(SymbolicDataAnalysisExpressionPruningOperator original, Cloner cloner)
       : base(original, cloner) { }
 
-    protected SymbolicDataAnalysisExpressionPruningOperator() {
+    protected SymbolicDataAnalysisExpressionPruningOperator(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactValuesCalculator) {
       #region add parameters
       Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName));
       Parameters.Add(new LookupParameter<ISymbolicDataAnalysisModel>(SymbolicDataAnalysisModelParameterName));
       Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName));
+      Parameters.Add(new LookupParameter<IntValue>(PrunedNodesParameterName, "A counter of how many nodes were pruned."));
       Parameters.Add(new LookupParameter<IntValue>(PrunedSubtreesParameterName, "A counter of how many subtrees were replaced."));
       Parameters.Add(new LookupParameter<IntValue>(PrunedTreesParameterName, "A counter of how many trees were pruned."));
@@ -115,15 +128,45 @@
       Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName));
       Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName));
+      Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName));
+      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, impactValuesCalculator));
       #endregion
     }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      if (!Parameters.ContainsKey(PrunedNodesParameterName)) {
+        Parameters.Add(new LookupParameter<IntValue>(PrunedNodesParameterName, "A counter of how many nodes were pruned."));
+      }
+      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName)) {
+        Parameters.Add(new LookupParameter<BoolValue>(ApplyLinearScalingParameterName));
+      }
+      if (!Parameters.ContainsKey(ImpactValuesCalculatorParameterName)) {
+        // value must be set by derived operators (regression/classification)
+        Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName));
+      }
+      #endregion
+    }
+
+    protected abstract ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits);
+
+    protected abstract double Evaluate(IDataAnalysisModel model);
+
     public override IOperation Apply() {
-      var model = CreateModel();
-      var nodes = SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList();
-      var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size).ToList();
-
+      var tree = SymbolicExpressionTreeParameter.ActualValue;
+      var problemData = ProblemDataParameter.ActualValue;
+      var fitnessCalculationPartition = FitnessCalculationPartitionParameter.ActualValue;
+      var estimationLimits = EstimationLimitsParameter.ActualValue;
+      var interpreter = InterpreterParameter.ActualValue;
+
+      var model = CreateModel(tree, interpreter, problemData, estimationLimits);
+      var nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList();
+      var rows = Enumerable.Range(fitnessCalculationPartition.Start, fitnessCalculationPartition.Size).ToList();
       var prunedSubtrees = 0;
       var prunedTrees = 0;
-
-      double quality = Evaluate(model);
+      var prunedNodes = 0;
+
+      double qualityForImpactsCalculation = double.NaN;
 
       for (int i = 0; i < nodes.Count; ++i) {
@@ -132,16 +175,21 @@
 
         double impactValue, replacementValue;
-        ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, ProblemData, rows, out impactValue, out replacementValue, quality);
-
-        if (PruneOnlyZeroImpactNodes.Value && (!impactValue.IsAlmost(0.0))) continue;
-        else if (NodeImpactThreshold.Value < impactValue) continue;
-
-        var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
+        double newQualityForImpacts;
+        ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, out newQualityForImpacts, qualityForImpactsCalculation);
+
+        if (PruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue;
+        if (!PruneOnlyZeroImpactNodes && impactValue > NodeImpactThreshold) continue;
+
+        var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();
+        constantNode.Value = replacementValue;
+
+        var length = node.GetLength();
         ReplaceWithConstant(node, constantNode);
-        i += node.GetLength() - 1; // skip subtrees under the node that was folded
-
-        quality -= impactValue;
+        i += length - 1; // skip subtrees under the node that was folded
 
         prunedSubtrees++;
+        prunedNodes += length;
+
+        qualityForImpactsCalculation = newQualityForImpacts;
       }
 
@@ -149,8 +197,13 @@
       PrunedSubtreesParameter.ActualValue = new IntValue(prunedSubtrees);
       PrunedTreesParameter.ActualValue = new IntValue(prunedTrees);
+      PrunedNodesParameter.ActualValue = new IntValue(prunedNodes);
+
+      if (prunedSubtrees > 0) // if nothing was pruned then there's no need to re-evaluate the tree
+        QualityParameter.ActualValue.Value = Evaluate(model);
 
       return base.Apply();
     }
-    private static void ReplaceWithConstant(ISymbolicExpressionTreeNode original, ISymbolicExpressionTreeNode replacement) {
+
+    protected static void ReplaceWithConstant(ISymbolicExpressionTreeNode original, ISymbolicExpressionTreeNode replacement) {
       var parent = original.Parent;
       var i = parent.IndexOfSubtree(original);
@@ -158,6 +211,4 @@
       parent.InsertSubtree(i, replacement);
     }
-    protected abstract ISymbolicDataAnalysisModel CreateModel();
-    protected abstract double Evaluate(IDataAnalysisModel model);
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator.cs	(revision 17687)
@@ -0,0 +1,80 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Linq;
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("F30B6562-ECEC-42A0-B7D6-E55390FC0412")]
+  [NonDiscoverableType]
+  public class SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator : InstrumentedOperator {
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+    private const string AverageSimilarityParameterName = "AverageSimilarity";
+    private const string StrictSimilarityParameterName = "StrictSimilarity";
+
+    public SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator() {
+      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(AverageSimilarityParameterName));
+      Parameters.Add(new FixedValueParameter<BoolValue>(StrictSimilarityParameterName));
+    }
+
+    protected SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator(SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator rhs, Cloner cloner) { }
+
+    public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (IScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> StrictSimilarityParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[StrictSimilarityParameterName]; }
+    }
+
+    public bool StrictSimilarity {
+      get { return StrictSimilarityParameter.Value.Value; }
+      set { StrictSimilarityParameter.Value.Value = value; }
+    }
+
+    public IScopeTreeLookupParameter<DoubleValue> AverageSimilarityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[AverageSimilarityParameterName]; }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator(this, cloner);
+    }
+
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator(StorableConstructorFlag _) : base(_) { }
+
+    public override IOperation InstrumentedApply() {
+      var trees = SymbolicExpressionTreeParameter.ActualValue;
+      var similarityMatrix = SymbolicExpressionTreeHash.ComputeSimilarityMatrix(trees, false, StrictSimilarity);
+      DoubleValue averageSimilarity(int i) => new DoubleValue(Enumerable.Range(0, trees.Length).Where(j => i != j).Average(j => similarityMatrix[i, j]));
+      AverageSimilarityParameter.ActualValue = new ItemArray<DoubleValue>(Enumerable.Range(0, trees.Length).Select(averageSimilarity));
+      return base.InstrumentedApply();
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs	(revision 17687)
@@ -0,0 +1,60 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SymbolicExpressionTreeSimplificationOperator", "Simplifies symbolic expression trees encoding a mathematical formula.")]
+  [StorableType("EEAB0E73-1F2D-459E-812B-C98E66FF3C63")]
+  public class SymbolicDataAnalysisExpressionTreeSimplificationOperator : SingleSuccessorOperator, ISymbolicExpressionTreeOperator {
+    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
+
+    public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
+      get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
+    }
+
+    [StorableConstructor]
+    protected SymbolicDataAnalysisExpressionTreeSimplificationOperator(StorableConstructorFlag _) : base(_) { }
+    protected SymbolicDataAnalysisExpressionTreeSimplificationOperator(SymbolicDataAnalysisExpressionTreeSimplificationOperator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicDataAnalysisExpressionTreeSimplificationOperator(this, cloner);
+    }
+
+    public SymbolicDataAnalysisExpressionTreeSimplificationOperator() {
+      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree to simplify."));
+    }
+
+    public override IOperation Apply() {
+      var tree = SymbolicExpressionTreeParameter.ActualValue;
+      var simplifiedTree = TreeSimplifier.Simplify(tree);
+      simplifiedTree = TreeSimplifier.Simplify(simplifiedTree);
+      SymbolicExpressionTreeParameter.ActualValue = simplifiedTree;
+
+      return base.Apply();
+    }
+  }
+}
Index: anches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs	(revision 17686)
+++ 	(revision )
@@ -1,1054 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  /// <summary>
-  /// Simplifier for symbolic expressions
-  /// </summary>
-  public class SymbolicDataAnalysisExpressionTreeSimplifier {
-    private Addition addSymbol = new Addition();
-    private Subtraction subSymbol = new Subtraction();
-    private Multiplication mulSymbol = new Multiplication();
-    private Division divSymbol = new Division();
-    private Constant constSymbol = new Constant();
-    private Variable varSymbol = new Variable();
-    private Logarithm logSymbol = new Logarithm();
-    private Exponential expSymbol = new Exponential();
-    private Root rootSymbol = new Root();
-    private Square sqrSymbol = new Square();
-    private SquareRoot sqrtSymbol = new SquareRoot();
-    private Power powSymbol = new Power();
-    private Sine sineSymbol = new Sine();
-    private Cosine cosineSymbol = new Cosine();
-    private Tangent tanSymbol = new Tangent();
-    private IfThenElse ifThenElseSymbol = new IfThenElse();
-    private And andSymbol = new And();
-    private Or orSymbol = new Or();
-    private Not notSymbol = new Not();
-    private GreaterThan gtSymbol = new GreaterThan();
-    private LessThan ltSymbol = new LessThan();
-    private Integral integralSymbol = new Integral();
-    private LaggedVariable laggedVariableSymbol = new LaggedVariable();
-    private TimeLag timeLagSymbol = new TimeLag();
-
-    public ISymbolicExpressionTree Simplify(ISymbolicExpressionTree originalTree) {
-      var clone = (ISymbolicExpressionTreeNode)originalTree.Root.Clone();
-      // macro expand (initially no argument trees)
-      var macroExpandedTree = MacroExpand(clone, clone.GetSubtree(0), new List<ISymbolicExpressionTreeNode>());
-      ISymbolicExpressionTreeNode rootNode = (new ProgramRootSymbol()).CreateTreeNode();
-      rootNode.AddSubtree(GetSimplifiedTree(macroExpandedTree));
-      return new SymbolicExpressionTree(rootNode);
-    }
-
-    // the argumentTrees list contains already expanded trees used as arguments for invocations
-    private ISymbolicExpressionTreeNode MacroExpand(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode node, IList<ISymbolicExpressionTreeNode> argumentTrees) {
-      List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(node.Subtrees);
-      while (node.SubtreeCount > 0) node.RemoveSubtree(0);
-      if (node.Symbol is InvokeFunction) {
-        var invokeSym = node.Symbol as InvokeFunction;
-        var defunNode = FindFunctionDefinition(root, invokeSym.FunctionName);
-        var macroExpandedArguments = new List<ISymbolicExpressionTreeNode>();
-        foreach (var subtree in subtrees) {
-          macroExpandedArguments.Add(MacroExpand(root, subtree, argumentTrees));
-        }
-        return MacroExpand(root, defunNode, macroExpandedArguments);
-      } else if (node.Symbol is Argument) {
-        var argSym = node.Symbol as Argument;
-        // return the correct argument sub-tree (already macro-expanded)
-        return (SymbolicExpressionTreeNode)argumentTrees[argSym.ArgumentIndex].Clone();
-      } else {
-        // recursive application
-        foreach (var subtree in subtrees) {
-          node.AddSubtree(MacroExpand(root, subtree, argumentTrees));
-        }
-        return node;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode FindFunctionDefinition(ISymbolicExpressionTreeNode root, string functionName) {
-      foreach (var subtree in root.Subtrees.OfType<DefunTreeNode>()) {
-        if (subtree.FunctionName == functionName) return subtree.GetSubtree(0);
-      }
-
-      throw new ArgumentException("Definition of function " + functionName + " not found.");
-    }
-
-
-    #region symbol predicates
-    // arithmetic
-    private bool IsDivision(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Division;
-    }
-
-    private bool IsMultiplication(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Multiplication;
-    }
-
-    private bool IsSubtraction(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Subtraction;
-    }
-
-    private bool IsAddition(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Addition;
-    }
-
-    private bool IsAverage(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Average;
-    }
-    // exponential
-    private bool IsLog(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Logarithm;
-    }
-    private bool IsExp(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Exponential;
-    }
-    private bool IsRoot(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Root;
-    }
-    private bool IsSquare(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Square;
-    }
-    private bool IsSquareRoot(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is SquareRoot;
-    }
-    private bool IsPower(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Power;
-    }
-    // trigonometric
-    private bool IsSine(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Sine;
-    }
-    private bool IsCosine(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Cosine;
-    }
-    private bool IsTangent(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Tangent;
-    }
-    // boolean
-    private bool IsIfThenElse(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is IfThenElse;
-    }
-    private bool IsAnd(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is And;
-    }
-    private bool IsOr(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Or;
-    }
-    private bool IsNot(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Not;
-    }
-    // comparison
-    private bool IsGreaterThan(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is GreaterThan;
-    }
-    private bool IsLessThan(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is LessThan;
-    }
-
-    private bool IsBoolean(ISymbolicExpressionTreeNode node) {
-      return
-        node.Symbol is GreaterThan ||
-        node.Symbol is LessThan ||
-        node.Symbol is And ||
-        node.Symbol is Or;
-    }
-
-    // terminals
-    private bool IsVariable(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Variable;
-    }
-
-    private bool IsConstant(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Constant;
-    }
-
-    // dynamic
-    private bool IsTimeLag(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is TimeLag;
-    }
-    private bool IsIntegral(ISymbolicExpressionTreeNode node) {
-      return node.Symbol is Integral;
-    }
-
-    #endregion
-
-    /// <summary>
-    /// Creates a new simplified tree
-    /// </summary>
-    /// <param name="original"></param>
-    /// <returns></returns>
-    public ISymbolicExpressionTreeNode GetSimplifiedTree(ISymbolicExpressionTreeNode original) {
-      if (IsConstant(original) || IsVariable(original)) {
-        return (ISymbolicExpressionTreeNode)original.Clone();
-      } else if (IsAddition(original)) {
-        return SimplifyAddition(original);
-      } else if (IsSubtraction(original)) {
-        return SimplifySubtraction(original);
-      } else if (IsMultiplication(original)) {
-        return SimplifyMultiplication(original);
-      } else if (IsDivision(original)) {
-        return SimplifyDivision(original);
-      } else if (IsAverage(original)) {
-        return SimplifyAverage(original);
-      } else if (IsLog(original)) {
-        return SimplifyLog(original);
-      } else if (IsExp(original)) {
-        return SimplifyExp(original);
-      } else if (IsSquare(original)) {
-        return SimplifySquare(original);
-      } else if (IsSquareRoot(original)) {
-        return SimplifySquareRoot(original);
-      } else if (IsPower(original)) {
-        return SimplifyPower(original);
-      } else if (IsRoot(original)) {
-        return SimplifyRoot(original);
-      } else if (IsSine(original)) {
-        return SimplifySine(original);
-      } else if (IsCosine(original)) {
-        return SimplifyCosine(original);
-      } else if (IsTangent(original)) {
-        return SimplifyTangent(original);
-      } else if (IsIfThenElse(original)) {
-        return SimplifyIfThenElse(original);
-      } else if (IsGreaterThan(original)) {
-        return SimplifyGreaterThan(original);
-      } else if (IsLessThan(original)) {
-        return SimplifyLessThan(original);
-      } else if (IsAnd(original)) {
-        return SimplifyAnd(original);
-      } else if (IsOr(original)) {
-        return SimplifyOr(original);
-      } else if (IsNot(original)) {
-        return SimplifyNot(original);
-      } else if (IsTimeLag(original)) {
-        return SimplifyTimeLag(original);
-      } else if (IsIntegral(original)) {
-        return SimplifyIntegral(original);
-      } else {
-        return SimplifyAny(original);
-      }
-    }
-
-
-    #region specific simplification routines
-    private ISymbolicExpressionTreeNode SimplifyAny(ISymbolicExpressionTreeNode original) {
-      // can't simplify this function but simplify all subtrees 
-      List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(original.Subtrees);
-      while (original.Subtrees.Count() > 0) original.RemoveSubtree(0);
-      var clone = (SymbolicExpressionTreeNode)original.Clone();
-      List<ISymbolicExpressionTreeNode> simplifiedSubtrees = new List<ISymbolicExpressionTreeNode>();
-      foreach (var subtree in subtrees) {
-        simplifiedSubtrees.Add(GetSimplifiedTree(subtree));
-        original.AddSubtree(subtree);
-      }
-      foreach (var simplifiedSubtree in simplifiedSubtrees) {
-        clone.AddSubtree(simplifiedSubtree);
-      }
-      if (simplifiedSubtrees.TrueForAll(t => IsConstant(t))) {
-        SimplifyConstantExpression(clone);
-      }
-      return clone;
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyConstantExpression(ISymbolicExpressionTreeNode original) {
-      // not yet implemented
-      return original;
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyAverage(ISymbolicExpressionTreeNode original) {
-      if (original.Subtrees.Count() == 1) {
-        return GetSimplifiedTree(original.GetSubtree(0));
-      } else {
-        // simplify expressions x0..xn
-        // make sum(x0..xn) / n
-        var sum = original.Subtrees
-          .Select(x => GetSimplifiedTree(x))
-          .Aggregate((a, b) => MakeSum(a, b));
-        return MakeFraction(sum, MakeConstant(original.Subtrees.Count()));
-      }
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyDivision(ISymbolicExpressionTreeNode original) {
-      if (original.Subtrees.Count() == 1) {
-        return Invert(GetSimplifiedTree(original.GetSubtree(0)));
-      } else {
-        // simplify expressions x0..xn
-        // make multiplication (x0 * 1/(x1 * x1 * .. * xn))
-        var simplifiedTrees = original.Subtrees.Select(x => GetSimplifiedTree(x));
-        return
-          MakeProduct(simplifiedTrees.First(), Invert(simplifiedTrees.Skip(1).Aggregate((a, b) => MakeProduct(a, b))));
-      }
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyMultiplication(ISymbolicExpressionTreeNode original) {
-      if (original.Subtrees.Count() == 1) {
-        return GetSimplifiedTree(original.GetSubtree(0));
-      } else {
-        return original.Subtrees
-          .Select(x => GetSimplifiedTree(x))
-          .Aggregate((a, b) => MakeProduct(a, b));
-      }
-    }
-
-    private ISymbolicExpressionTreeNode SimplifySubtraction(ISymbolicExpressionTreeNode original) {
-      if (original.Subtrees.Count() == 1) {
-        return Negate(GetSimplifiedTree(original.GetSubtree(0)));
-      } else {
-        // simplify expressions x0..xn
-        // make addition (x0,-x1..-xn)
-        var simplifiedTrees = original.Subtrees.Select(x => GetSimplifiedTree(x));
-        return simplifiedTrees.Take(1)
-          .Concat(simplifiedTrees.Skip(1).Select(x => Negate(x)))
-          .Aggregate((a, b) => MakeSum(a, b));
-      }
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyAddition(ISymbolicExpressionTreeNode original) {
-      if (original.Subtrees.Count() == 1) {
-        return GetSimplifiedTree(original.GetSubtree(0));
-      } else {
-        // simplify expression x0..xn
-        // make addition (x0..xn)
-        return original.Subtrees
-          .Select(x => GetSimplifiedTree(x))
-          .Aggregate((a, b) => MakeSum(a, b));
-      }
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyNot(ISymbolicExpressionTreeNode original) {
-      return MakeNot(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyOr(ISymbolicExpressionTreeNode original) {
-      return original.Subtrees
-        .Select(x => GetSimplifiedTree(x))
-        .Aggregate((a, b) => MakeOr(a, b));
-    }
-    private ISymbolicExpressionTreeNode SimplifyAnd(ISymbolicExpressionTreeNode original) {
-      return original.Subtrees
-        .Select(x => GetSimplifiedTree(x))
-        .Aggregate((a, b) => MakeAnd(a, b));
-    }
-    private ISymbolicExpressionTreeNode SimplifyLessThan(ISymbolicExpressionTreeNode original) {
-      return MakeLessThan(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyGreaterThan(ISymbolicExpressionTreeNode original) {
-      return MakeGreaterThan(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyIfThenElse(ISymbolicExpressionTreeNode original) {
-      return MakeIfThenElse(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)), GetSimplifiedTree(original.GetSubtree(2)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyTangent(ISymbolicExpressionTreeNode original) {
-      return MakeTangent(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyCosine(ISymbolicExpressionTreeNode original) {
-      return MakeCosine(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifySine(ISymbolicExpressionTreeNode original) {
-      return MakeSine(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyExp(ISymbolicExpressionTreeNode original) {
-      return MakeExp(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifySquare(ISymbolicExpressionTreeNode original) {
-      return MakeSquare(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifySquareRoot(ISymbolicExpressionTreeNode original) {
-      return MakeSquareRoot(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyLog(ISymbolicExpressionTreeNode original) {
-      return MakeLog(GetSimplifiedTree(original.GetSubtree(0)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyRoot(ISymbolicExpressionTreeNode original) {
-      return MakeRoot(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
-    }
-
-    private ISymbolicExpressionTreeNode SimplifyPower(ISymbolicExpressionTreeNode original) {
-      return MakePower(GetSimplifiedTree(original.GetSubtree(0)), GetSimplifiedTree(original.GetSubtree(1)));
-    }
-    private ISymbolicExpressionTreeNode SimplifyTimeLag(ISymbolicExpressionTreeNode original) {
-      var laggedTreeNode = original as ILaggedTreeNode;
-      var simplifiedSubtree = GetSimplifiedTree(original.GetSubtree(0));
-      if (!ContainsVariableCondition(simplifiedSubtree)) {
-        return AddLagToDynamicNodes(simplifiedSubtree, laggedTreeNode.Lag);
-      } else {
-        return MakeTimeLag(simplifiedSubtree, laggedTreeNode.Lag);
-      }
-    }
-    private ISymbolicExpressionTreeNode SimplifyIntegral(ISymbolicExpressionTreeNode original) {
-      var laggedTreeNode = original as ILaggedTreeNode;
-      var simplifiedSubtree = GetSimplifiedTree(original.GetSubtree(0));
-      if (IsConstant(simplifiedSubtree)) {
-        return GetSimplifiedTree(MakeProduct(simplifiedSubtree, MakeConstant(-laggedTreeNode.Lag)));
-      } else {
-        return MakeIntegral(simplifiedSubtree, laggedTreeNode.Lag);
-      }
-    }
-
-    #endregion
-
-    #region low level tree restructuring
-    private ISymbolicExpressionTreeNode MakeTimeLag(ISymbolicExpressionTreeNode subtree, int lag) {
-      if (lag == 0) return subtree;
-      if (IsConstant(subtree)) return subtree;
-      var lagNode = (LaggedTreeNode)timeLagSymbol.CreateTreeNode();
-      lagNode.Lag = lag;
-      lagNode.AddSubtree(subtree);
-      return lagNode;
-    }
-
-    private ISymbolicExpressionTreeNode MakeIntegral(ISymbolicExpressionTreeNode subtree, int lag) {
-      if (lag == 0) return subtree;
-      else if (lag == -1 || lag == 1) {
-        return MakeSum(subtree, AddLagToDynamicNodes((ISymbolicExpressionTreeNode)subtree.Clone(), lag));
-      } else {
-        var node = (LaggedTreeNode)integralSymbol.CreateTreeNode();
-        node.Lag = lag;
-        node.AddSubtree(subtree);
-        return node;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeNot(ISymbolicExpressionTreeNode t) {
-      if (IsConstant(t)) {
-        var constNode = t as ConstantTreeNode;
-        if (constNode.Value > 0) return MakeConstant(-1.0);
-        else return MakeConstant(1.0);
-      } else if (IsNot(t)) {
-        return t.GetSubtree(0);
-      } else if (!IsBoolean(t)) {
-        var gtNode = gtSymbol.CreateTreeNode();
-        gtNode.AddSubtree(t); gtNode.AddSubtree(MakeConstant(0.0));
-        var notNode = notSymbol.CreateTreeNode();
-        notNode.AddSubtree(gtNode);
-        return notNode;
-      } else {
-        var notNode = notSymbol.CreateTreeNode();
-        notNode.AddSubtree(t);
-        return notNode;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeOr(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        var constA = a as ConstantTreeNode;
-        var constB = b as ConstantTreeNode;
-        if (constA.Value > 0.0 || constB.Value > 0.0) {
-          return MakeConstant(1.0);
-        } else {
-          return MakeConstant(-1.0);
-        }
-      } else if (IsConstant(a)) {
-        return MakeOr(b, a);
-      } else if (IsConstant(b)) {
-        var constT = b as ConstantTreeNode;
-        if (constT.Value > 0.0) {
-          // boolean expression is necessarily true
-          return MakeConstant(1.0);
-        } else {
-          // the constant value has no effect on the result of the boolean condition so we can drop the constant term
-          var orNode = orSymbol.CreateTreeNode();
-          orNode.AddSubtree(a);
-          return orNode;
-        }
-      } else {
-        var orNode = orSymbol.CreateTreeNode();
-        orNode.AddSubtree(a);
-        orNode.AddSubtree(b);
-        return orNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeAnd(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        var constA = a as ConstantTreeNode;
-        var constB = b as ConstantTreeNode;
-        if (constA.Value > 0.0 && constB.Value > 0.0) {
-          return MakeConstant(1.0);
-        } else {
-          return MakeConstant(-1.0);
-        }
-      } else if (IsConstant(a)) {
-        return MakeAnd(b, a);
-      } else if (IsConstant(b)) {
-        var constB = b as ConstantTreeNode;
-        if (constB.Value > 0.0) {
-          // the constant value has no effect on the result of the boolean condition so we can drop the constant term
-          var andNode = andSymbol.CreateTreeNode();
-          andNode.AddSubtree(a);
-          return andNode;
-        } else {
-          // boolean expression is necessarily false
-          return MakeConstant(-1.0);
-        }
-      } else {
-        var andNode = andSymbol.CreateTreeNode();
-        andNode.AddSubtree(a);
-        andNode.AddSubtree(b);
-        return andNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeLessThan(ISymbolicExpressionTreeNode leftSide, ISymbolicExpressionTreeNode rightSide) {
-      if (IsConstant(leftSide) && IsConstant(rightSide)) {
-        var lsConst = leftSide as ConstantTreeNode;
-        var rsConst = rightSide as ConstantTreeNode;
-        if (lsConst.Value < rsConst.Value) return MakeConstant(1.0);
-        else return MakeConstant(-1.0);
-      } else {
-        var ltNode = ltSymbol.CreateTreeNode();
-        ltNode.AddSubtree(leftSide);
-        ltNode.AddSubtree(rightSide);
-        return ltNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeGreaterThan(ISymbolicExpressionTreeNode leftSide, ISymbolicExpressionTreeNode rightSide) {
-      if (IsConstant(leftSide) && IsConstant(rightSide)) {
-        var lsConst = leftSide as ConstantTreeNode;
-        var rsConst = rightSide as ConstantTreeNode;
-        if (lsConst.Value > rsConst.Value) return MakeConstant(1.0);
-        else return MakeConstant(-1.0);
-      } else {
-        var gtNode = gtSymbol.CreateTreeNode();
-        gtNode.AddSubtree(leftSide);
-        gtNode.AddSubtree(rightSide);
-        return gtNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeIfThenElse(ISymbolicExpressionTreeNode condition, ISymbolicExpressionTreeNode trueBranch, ISymbolicExpressionTreeNode falseBranch) {
-      if (IsConstant(condition)) {
-        var constT = condition as ConstantTreeNode;
-        if (constT.Value > 0.0) return trueBranch;
-        else return falseBranch;
-      } else {
-        var ifNode = ifThenElseSymbol.CreateTreeNode();
-        if (IsBoolean(condition)) {
-          ifNode.AddSubtree(condition);
-        } else {
-          var gtNode = gtSymbol.CreateTreeNode();
-          gtNode.AddSubtree(condition); gtNode.AddSubtree(MakeConstant(0.0));
-          ifNode.AddSubtree(gtNode);
-        }
-        ifNode.AddSubtree(trueBranch);
-        ifNode.AddSubtree(falseBranch);
-        return ifNode;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeSine(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(Math.Sin(constT.Value));
-      } else {
-        var sineNode = sineSymbol.CreateTreeNode();
-        sineNode.AddSubtree(node);
-        return sineNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeTangent(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(Math.Tan(constT.Value));
-      } else {
-        var tanNode = tanSymbol.CreateTreeNode();
-        tanNode.AddSubtree(node);
-        return tanNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeCosine(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(Math.Cos(constT.Value));
-      } else {
-        var cosNode = cosineSymbol.CreateTreeNode();
-        cosNode.AddSubtree(node);
-        return cosNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeExp(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(Math.Exp(constT.Value));
-      } else if (IsLog(node)) {
-        return node.GetSubtree(0);
-      } else if (IsAddition(node)) {
-        return node.Subtrees.Select(s => MakeExp(s)).Aggregate((s, t) => MakeProduct(s, t));
-      } else if (IsSubtraction(node)) {
-        return node.Subtrees.Select(s => MakeExp(s)).Aggregate((s, t) => MakeProduct(s, Negate(t)));
-      } else {
-        var expNode = expSymbol.CreateTreeNode();
-        expNode.AddSubtree(node);
-        return expNode;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeSquare(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(constT.Value * constT.Value);
-      } else if (IsSquareRoot(node)) {
-        return node.GetSubtree(0);
-      } else {
-        var sqrNode = sqrSymbol.CreateTreeNode();
-        sqrNode.AddSubtree(node);
-        return sqrNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeSquareRoot(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(Math.Sqrt(constT.Value));
-      } else if (IsSquare(node)) {
-        return node.GetSubtree(0);
-      } else {
-        var sqrtNode = sqrtSymbol.CreateTreeNode();
-        sqrtNode.AddSubtree(node);
-        return sqrtNode;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeLog(ISymbolicExpressionTreeNode node) {
-      if (IsConstant(node)) {
-        var constT = node as ConstantTreeNode;
-        return MakeConstant(Math.Log(constT.Value));
-      } else if (IsExp(node)) {
-        return node.GetSubtree(0);
-      } else if (IsSquareRoot(node)) {
-        return MakeFraction(MakeLog(node.GetSubtree(0)), MakeConstant(2.0));
-      } else {
-        var logNode = logSymbol.CreateTreeNode();
-        logNode.AddSubtree(node);
-        return logNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakeRoot(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        var constA = a as ConstantTreeNode;
-        var constB = b as ConstantTreeNode;
-        return MakeConstant(Math.Pow(constA.Value, 1.0 / Math.Round(constB.Value)));
-      } else if (IsConstant(b)) {
-        var constB = b as ConstantTreeNode;
-        var constBValue = Math.Round(constB.Value);
-        if (constBValue.IsAlmost(1.0)) {
-          return a;
-        } else if (constBValue.IsAlmost(0.0)) {
-          return MakeConstant(1.0);
-        } else if (constBValue.IsAlmost(-1.0)) {
-          return MakeFraction(MakeConstant(1.0), a);
-        } else if (constBValue < 0) {
-          var rootNode = rootSymbol.CreateTreeNode();
-          rootNode.AddSubtree(a);
-          rootNode.AddSubtree(MakeConstant(-1.0 * constBValue));
-          return MakeFraction(MakeConstant(1.0), rootNode);
-        } else {
-          var rootNode = rootSymbol.CreateTreeNode();
-          rootNode.AddSubtree(a);
-          rootNode.AddSubtree(MakeConstant(constBValue));
-          return rootNode;
-        }
-      } else {
-        var rootNode = rootSymbol.CreateTreeNode();
-        rootNode.AddSubtree(a);
-        rootNode.AddSubtree(b);
-        return rootNode;
-      }
-    }
-    private ISymbolicExpressionTreeNode MakePower(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        var constA = a as ConstantTreeNode;
-        var constB = b as ConstantTreeNode;
-        return MakeConstant(Math.Pow(constA.Value, Math.Round(constB.Value)));
-      } else if (IsConstant(b)) {
-        var constB = b as ConstantTreeNode;
-        double exponent = Math.Round(constB.Value);
-        if (exponent.IsAlmost(0.0)) {
-          return MakeConstant(1.0);
-        } else if (exponent.IsAlmost(1.0)) {
-          return a;
-        } else if (exponent.IsAlmost(-1.0)) {
-          return MakeFraction(MakeConstant(1.0), a);
-        } else if (exponent < 0) {
-          var powNode = powSymbol.CreateTreeNode();
-          powNode.AddSubtree(a);
-          powNode.AddSubtree(MakeConstant(-1.0 * exponent));
-          return MakeFraction(MakeConstant(1.0), powNode);
-        } else {
-          var powNode = powSymbol.CreateTreeNode();
-          powNode.AddSubtree(a);
-          powNode.AddSubtree(MakeConstant(exponent));
-          return powNode;
-        }
-      } else {
-        var powNode = powSymbol.CreateTreeNode();
-        powNode.AddSubtree(a);
-        powNode.AddSubtree(b);
-        return powNode;
-      }
-    }
-
-
-    // MakeFraction, MakeProduct and MakeSum take two already simplified trees and create a new simplified tree
-    private ISymbolicExpressionTreeNode MakeFraction(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        // fold constants
-        return MakeConstant(((ConstantTreeNode)a).Value / ((ConstantTreeNode)b).Value);
-      } if (IsConstant(a) && !((ConstantTreeNode)a).Value.IsAlmost(1.0)) {
-        return MakeFraction(MakeConstant(1.0), MakeProduct(b, Invert(a)));
-      } else if (IsVariable(a) && IsConstant(b)) {
-        // merge constant values into variable weights
-        var constB = ((ConstantTreeNode)b).Value;
-        ((VariableTreeNode)a).Weight /= constB;
-        return a;
-      } else if (IsVariable(a) && IsVariable(b) && AreSameVariable(a, b)) {
-        // cancel variables
-        var aVar = a as VariableTreeNode;
-        var bVar = b as VariableTreeNode;
-        return MakeConstant(aVar.Weight / bVar.Weight);
-      } else if (IsAddition(a) && IsConstant(b)) {
-        return a.Subtrees
-          .Select(x => GetSimplifiedTree(x))
-         .Select(x => MakeFraction(x, b))
-         .Aggregate((c, d) => MakeSum(c, d));
-      } else if (IsMultiplication(a) && IsConstant(b)) {
-        return MakeProduct(a, Invert(b));
-      } else if (IsDivision(a) && IsConstant(b)) {
-        // (a1 / a2) / c => (a1 / (a2 * c))
-        return MakeFraction(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
-      } else if (IsDivision(a) && IsDivision(b)) {
-        // (a1 / a2) / (b1 / b2) => 
-        return MakeFraction(MakeProduct(a.GetSubtree(0), b.GetSubtree(1)), MakeProduct(a.GetSubtree(1), b.GetSubtree(0)));
-      } else if (IsDivision(a)) {
-        // (a1 / a2) / b => (a1 / (a2 * b))
-        return MakeFraction(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
-      } else if (IsDivision(b)) {
-        // a / (b1 / b2) => (a * b2) / b1
-        return MakeFraction(MakeProduct(a, b.GetSubtree(1)), b.GetSubtree(0));
-      } else {
-        var div = divSymbol.CreateTreeNode();
-        div.AddSubtree(a);
-        div.AddSubtree(b);
-        return div;
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeSum(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        // fold constants
-        ((ConstantTreeNode)a).Value += ((ConstantTreeNode)b).Value;
-        return a;
-      } else if (IsConstant(a)) {
-        // c + x => x + c
-        // b is not constant => make sure constant is on the right
-        return MakeSum(b, a);
-      } else if (IsConstant(b) && ((ConstantTreeNode)b).Value.IsAlmost(0.0)) {
-        // x + 0 => x
-        return a;
-      } else if (IsAddition(a) && IsAddition(b)) {
-        // merge additions
-        var add = addSymbol.CreateTreeNode();
-        // add all sub trees except for the last
-        for (int i = 0; i < a.Subtrees.Count() - 1; i++) add.AddSubtree(a.GetSubtree(i));
-        for (int i = 0; i < b.Subtrees.Count() - 1; i++) add.AddSubtree(b.GetSubtree(i));
-        if (IsConstant(a.Subtrees.Last()) && IsConstant(b.Subtrees.Last())) {
-          add.AddSubtree(MakeSum(a.Subtrees.Last(), b.Subtrees.Last()));
-        } else if (IsConstant(a.Subtrees.Last())) {
-          add.AddSubtree(b.Subtrees.Last());
-          add.AddSubtree(a.Subtrees.Last());
-        } else {
-          add.AddSubtree(a.Subtrees.Last());
-          add.AddSubtree(b.Subtrees.Last());
-        }
-        MergeVariablesInSum(add);
-        if (add.Subtrees.Count() == 1) {
-          return add.GetSubtree(0);
-        } else {
-          return add;
-        }
-      } else if (IsAddition(b)) {
-        return MakeSum(b, a);
-      } else if (IsAddition(a) && IsConstant(b)) {
-        // a is an addition and b is a constant => append b to a and make sure the constants are merged
-        var add = addSymbol.CreateTreeNode();
-        // add all sub trees except for the last
-        for (int i = 0; i < a.Subtrees.Count() - 1; i++) add.AddSubtree(a.GetSubtree(i));
-        if (IsConstant(a.Subtrees.Last()))
-          add.AddSubtree(MakeSum(a.Subtrees.Last(), b));
-        else {
-          add.AddSubtree(a.Subtrees.Last());
-          add.AddSubtree(b);
-        }
-        return add;
-      } else if (IsAddition(a)) {
-        // a is already an addition => append b
-        var add = addSymbol.CreateTreeNode();
-        add.AddSubtree(b);
-        foreach (var subtree in a.Subtrees) {
-          add.AddSubtree(subtree);
-        }
-        MergeVariablesInSum(add);
-        if (add.Subtrees.Count() == 1) {
-          return add.GetSubtree(0);
-        } else {
-          return add;
-        }
-      } else {
-        var add = addSymbol.CreateTreeNode();
-        add.AddSubtree(a);
-        add.AddSubtree(b);
-        MergeVariablesInSum(add);
-        if (add.Subtrees.Count() == 1) {
-          return add.GetSubtree(0);
-        } else {
-          return add;
-        }
-      }
-    }
-
-    // makes sure variable symbols in sums are combined
-    // possible improvement: combine sums of products where the products only reference the same variable
-    private void MergeVariablesInSum(ISymbolicExpressionTreeNode sum) {
-      var subtrees = new List<ISymbolicExpressionTreeNode>(sum.Subtrees);
-      while (sum.Subtrees.Count() > 0) sum.RemoveSubtree(0);
-      var groupedVarNodes = from node in subtrees.OfType<VariableTreeNode>()
-                            let lag = (node is LaggedVariableTreeNode) ? ((LaggedVariableTreeNode)node).Lag : 0
-                            group node by node.VariableName + lag into g
-                            select g;
-      var unchangedSubtrees = subtrees.Where(t => !(t is VariableTreeNode));
-
-      foreach (var variableNodeGroup in groupedVarNodes) {
-        var weightSum = variableNodeGroup.Select(t => t.Weight).Sum();
-        var representative = variableNodeGroup.First();
-        representative.Weight = weightSum;
-        sum.AddSubtree(representative);
-      }
-      foreach (var unchangedSubtree in unchangedSubtrees)
-        sum.AddSubtree(unchangedSubtree);
-    }
-
-
-    private ISymbolicExpressionTreeNode MakeProduct(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      if (IsConstant(a) && IsConstant(b)) {
-        // fold constants
-        ((ConstantTreeNode)a).Value *= ((ConstantTreeNode)b).Value;
-        return a;
-      } else if (IsConstant(a)) {
-        // a * $ => $ * a
-        return MakeProduct(b, a);
-      } else if (IsConstant(b) && ((ConstantTreeNode)b).Value.IsAlmost(1.0)) {
-        // $ * 1.0 => $
-        return a;
-      } else if (IsConstant(b) && IsVariable(a)) {
-        // multiply constants into variables weights
-        ((VariableTreeNode)a).Weight *= ((ConstantTreeNode)b).Value;
-        return a;
-      } else if (IsConstant(b) && IsAddition(a)) {
-        // multiply constants into additions
-        return a.Subtrees.Select(x => MakeProduct(x, b)).Aggregate((c, d) => MakeSum(c, d));
-      } else if (IsDivision(a) && IsDivision(b)) {
-        // (a1 / a2) * (b1 / b2) => (a1 * b1) / (a2 * b2)
-        return MakeFraction(MakeProduct(a.GetSubtree(0), b.GetSubtree(0)), MakeProduct(a.GetSubtree(1), b.GetSubtree(1)));
-      } else if (IsDivision(a)) {
-        // (a1 / a2) * b => (a1 * b) / a2
-        return MakeFraction(MakeProduct(a.GetSubtree(0), b), a.GetSubtree(1));
-      } else if (IsDivision(b)) {
-        // a * (b1 / b2) => (b1 * a) / b2
-        return MakeFraction(MakeProduct(b.GetSubtree(0), a), b.GetSubtree(1));
-      } else if (IsMultiplication(a) && IsMultiplication(b)) {
-        // merge multiplications (make sure constants are merged)
-        var mul = mulSymbol.CreateTreeNode();
-        for (int i = 0; i < a.Subtrees.Count(); i++) mul.AddSubtree(a.GetSubtree(i));
-        for (int i = 0; i < b.Subtrees.Count(); i++) mul.AddSubtree(b.GetSubtree(i));
-        MergeVariablesAndConstantsInProduct(mul);
-        return mul;
-      } else if (IsMultiplication(b)) {
-        return MakeProduct(b, a);
-      } else if (IsMultiplication(a)) {
-        // a is already an multiplication => append b
-        a.AddSubtree(b);
-        MergeVariablesAndConstantsInProduct(a);
-        return a;
-      } else {
-        var mul = mulSymbol.CreateTreeNode();
-        mul.AddSubtree(a);
-        mul.AddSubtree(b);
-        MergeVariablesAndConstantsInProduct(mul);
-        return mul;
-      }
-    }
-    #endregion
-
-
-    #region helper functions
-    private bool ContainsVariableCondition(ISymbolicExpressionTreeNode node) {
-      if (node.Symbol is VariableCondition) return true;
-      foreach (var subtree in node.Subtrees)
-        if (ContainsVariableCondition(subtree)) return true;
-      return false;
-    }
-
-    private ISymbolicExpressionTreeNode AddLagToDynamicNodes(ISymbolicExpressionTreeNode node, int lag) {
-      var laggedTreeNode = node as ILaggedTreeNode;
-      var variableNode = node as VariableTreeNode;
-      var variableConditionNode = node as VariableConditionTreeNode;
-      if (laggedTreeNode != null)
-        laggedTreeNode.Lag += lag;
-      else if (variableNode != null) {
-        var laggedVariableNode = (LaggedVariableTreeNode)laggedVariableSymbol.CreateTreeNode();
-        laggedVariableNode.Lag = lag;
-        laggedVariableNode.VariableName = variableNode.VariableName;
-        return laggedVariableNode;
-      } else if (variableConditionNode != null) {
-        throw new NotSupportedException("Removal of time lags around variable condition symbols is not allowed.");
-      }
-      var subtrees = new List<ISymbolicExpressionTreeNode>(node.Subtrees);
-      while (node.SubtreeCount > 0) node.RemoveSubtree(0);
-      foreach (var subtree in subtrees) {
-        node.AddSubtree(AddLagToDynamicNodes(subtree, lag));
-      }
-      return node;
-    }
-
-    private bool AreSameVariable(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
-      var aLaggedVar = a as LaggedVariableTreeNode;
-      var bLaggedVar = b as LaggedVariableTreeNode;
-      if (aLaggedVar != null && bLaggedVar != null) {
-        return aLaggedVar.VariableName == bLaggedVar.VariableName &&
-          aLaggedVar.Lag == bLaggedVar.Lag;
-      }
-      var aVar = a as VariableTreeNode;
-      var bVar = b as VariableTreeNode;
-      if (aVar != null && bVar != null) {
-        return aVar.VariableName == bVar.VariableName;
-      }
-      return false;
-    }
-
-    // helper to combine the constant factors in products and to combine variables (powers of 2, 3...)
-    private void MergeVariablesAndConstantsInProduct(ISymbolicExpressionTreeNode prod) {
-      var subtrees = new List<ISymbolicExpressionTreeNode>(prod.Subtrees);
-      while (prod.Subtrees.Count() > 0) prod.RemoveSubtree(0);
-      var groupedVarNodes = from node in subtrees.OfType<VariableTreeNode>()
-                            let lag = (node is LaggedVariableTreeNode) ? ((LaggedVariableTreeNode)node).Lag : 0
-                            group node by node.VariableName + lag into g
-                            orderby g.Count()
-                            select g;
-      var constantProduct = (from node in subtrees.OfType<VariableTreeNode>()
-                             select node.Weight)
-                            .Concat(from node in subtrees.OfType<ConstantTreeNode>()
-                                    select node.Value)
-                            .DefaultIfEmpty(1.0)
-                            .Aggregate((c1, c2) => c1 * c2);
-
-      var unchangedSubtrees = from tree in subtrees
-                              where !(tree is VariableTreeNode)
-                              where !(tree is ConstantTreeNode)
-                              select tree;
-
-      foreach (var variableNodeGroup in groupedVarNodes) {
-        var representative = variableNodeGroup.First();
-        representative.Weight = 1.0;
-        if (variableNodeGroup.Count() > 1) {
-          var poly = mulSymbol.CreateTreeNode();
-          for (int p = 0; p < variableNodeGroup.Count(); p++) {
-            poly.AddSubtree((ISymbolicExpressionTreeNode)representative.Clone());
-          }
-          prod.AddSubtree(poly);
-        } else {
-          prod.AddSubtree(representative);
-        }
-      }
-
-      foreach (var unchangedSubtree in unchangedSubtrees)
-        prod.AddSubtree(unchangedSubtree);
-
-      if (!constantProduct.IsAlmost(1.0)) {
-        prod.AddSubtree(MakeConstant(constantProduct));
-      }
-    }
-
-
-    /// <summary>
-    /// x => x * -1
-    /// Doesn't create new trees and manipulates x
-    /// </summary>
-    /// <param name="x"></param>
-    /// <returns>-x</returns>
-    private ISymbolicExpressionTreeNode Negate(ISymbolicExpressionTreeNode x) {
-      if (IsConstant(x)) {
-        ((ConstantTreeNode)x).Value *= -1;
-      } else if (IsVariable(x)) {
-        var variableTree = (VariableTreeNode)x;
-        variableTree.Weight *= -1.0;
-      } else if (IsAddition(x)) {
-        // (x0 + x1 + .. + xn) * -1 => (-x0 + -x1 + .. + -xn)        
-        List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(x.Subtrees);
-        while (x.Subtrees.Count() > 0) x.RemoveSubtree(0);
-        foreach (var subtree in subtrees) {
-          x.AddSubtree(Negate(subtree));
-        }
-      } else if (IsMultiplication(x) || IsDivision(x)) {
-        // x0 * x1 * .. * xn * -1 => x0 * x1 * .. * -xn
-        var lastSubTree = x.Subtrees.Last();
-        x.RemoveSubtree(x.SubtreeCount - 1);
-        x.AddSubtree(Negate(lastSubTree)); // last is maybe a constant, prefer to negate the constant
-      } else {
-        // any other function
-        return MakeProduct(x, MakeConstant(-1));
-      }
-      return x;
-    }
-
-    /// <summary>
-    /// x => 1/x
-    /// Doesn't create new trees and manipulates x
-    /// </summary>
-    /// <param name="x"></param>
-    /// <returns></returns>
-    private ISymbolicExpressionTreeNode Invert(ISymbolicExpressionTreeNode x) {
-      if (IsConstant(x)) {
-        return MakeConstant(1.0 / ((ConstantTreeNode)x).Value);
-      } else if (IsDivision(x)) {
-        return MakeFraction(x.GetSubtree(1), x.GetSubtree(0));
-      } else {
-        // any other function
-        return MakeFraction(MakeConstant(1), x);
-      }
-    }
-
-    private ISymbolicExpressionTreeNode MakeConstant(double value) {
-      ConstantTreeNode constantTreeNode = (ConstantTreeNode)(constSymbol.CreateTreeNode());
-      constantTreeNode.Value = value;
-      return constantTreeNode;
-    }
-
-    private ISymbolicExpressionTreeNode MakeVariable(double weight, string name) {
-      var tree = (VariableTreeNode)varSymbol.CreateTreeNode();
-      tree.Weight = weight;
-      tree.VariableName = name;
-      return tree;
-    }
-    #endregion
-  }
-}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,9 +21,10 @@
 
 using System;
+using System.Collections.Generic;
 using System.Drawing;
+using System.Linq;
 using HeuristicLab.Common;
-using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -31,6 +32,6 @@
   /// Abstract base class for symbolic data analysis models
   /// </summary>
-  [StorableClass]
-  public abstract class SymbolicDataAnalysisModel : NamedItem, ISymbolicDataAnalysisModel {
+  [StorableType("EE72299A-7F04-40DA-994E-F12EF9B12CE7")]
+  public abstract class SymbolicDataAnalysisModel : DataAnalysisModel, ISymbolicDataAnalysisModel {
     public static new Image StaticItemImage {
       get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
@@ -56,8 +57,21 @@
       get { return interpreter; }
     }
+
+    public override IEnumerable<string> VariablesUsedForPrediction {
+      get {
+        var variables =
+          SymbolicExpressionTree.IterateNodesPrefix()
+            .OfType<IVariableTreeNode>()
+            .Select(x => x.VariableName)
+            .Distinct();
+
+        return variables.OrderBy(x => x);
+      }
+    }
+
     #endregion
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisModel(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisModel(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisModel(SymbolicDataAnalysisModel original, Cloner cloner)
       : base(original, cloner) {
@@ -103,14 +117,12 @@
       ConstantTreeNode alphaTreeNode = null;
       ConstantTreeNode betaTreeNode = null;
-      // check if model has been scaled previously by analyzing the structure of the tree
+      // check if model has a structure that can be re-used for scaling
       var startNode = SymbolicExpressionTree.Root.GetSubtree(0);
-      if (startNode.GetSubtree(0).Symbol is Addition) {
-        var addNode = startNode.GetSubtree(0);
-        if (addNode.SubtreeCount == 2 && addNode.GetSubtree(0).Symbol is Multiplication && addNode.GetSubtree(1).Symbol is Constant) {
-          alphaTreeNode = addNode.GetSubtree(1) as ConstantTreeNode;
-          var mulNode = addNode.GetSubtree(0);
-          if (mulNode.SubtreeCount == 2 && mulNode.GetSubtree(1).Symbol is Constant) {
-            betaTreeNode = mulNode.GetSubtree(1) as ConstantTreeNode;
-          }
+      var addNode = startNode.GetSubtree(0);
+      if (addNode.Symbol is Addition && addNode.SubtreeCount == 2) {
+        alphaTreeNode = (ConstantTreeNode)addNode.Subtrees.LastOrDefault(n => n is ConstantTreeNode);
+        var mulNode = addNode.Subtrees.FirstOrDefault(n => n.Symbol is Multiplication);
+        if (mulNode != null) {
+          betaTreeNode = (ConstantTreeNode)mulNode.Subtrees.LastOrDefault(n => n is ConstantTreeNode);
         }
       }
@@ -160,4 +172,5 @@
     }
     #endregion
+
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModelComplexityCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModelComplexityCalculator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModelComplexityCalculator.cs	(revision 17687)
@@ -0,0 +1,99 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class SymbolicDataAnalysisModelComplexityCalculator {
+    public static double CalculateComplexity(ISymbolicExpressionTree tree) {
+      return CalculateComplexity(tree.Root);
+    }
+    public static double CalculateComplexity(ISymbolicExpressionTreeNode treeNode) {
+      var node = treeNode;
+      if (node.Symbol is ProgramRootSymbol) node = node.GetSubtree(0);
+      if (node.Symbol is StartSymbol) node = node.GetSubtree(0);
+
+      switch (OpCodes.MapSymbolToOpCode(node)) {
+        case OpCodes.Constant: {
+            return 1;
+          }
+        case OpCodes.Variable:
+        case OpCodes.BinaryFactorVariable:
+        case OpCodes.FactorVariable: {
+            return 2;
+          }
+        case OpCodes.Add:
+        case OpCodes.Sub: {
+            double complexity = 0;
+            for (int i = 0; i < node.SubtreeCount; i++) {
+              complexity += CalculateComplexity(node.GetSubtree(i));
+            }
+            return complexity;
+          }
+        case OpCodes.Mul:
+        case OpCodes.Div: {
+            double complexity = 1;
+            for (int i = 0; i < node.SubtreeCount; i++) {
+              var nodeComplexity = CalculateComplexity(node.GetSubtree(i));
+              complexity *= nodeComplexity + 1;
+            }
+            return complexity;
+          }
+        case OpCodes.Sin:
+        case OpCodes.Cos:
+        case OpCodes.Tan:
+        case OpCodes.Exp:
+        case OpCodes.Log: {
+            double complexity = CalculateComplexity(node.GetSubtree(0));
+            return Math.Pow(2.0, complexity);
+          }
+        case OpCodes.Square: {
+            double complexity = CalculateComplexity(node.GetSubtree(0));
+            return complexity * complexity;
+          }
+        case OpCodes.SquareRoot: {
+            double complexity = CalculateComplexity(node.GetSubtree(0));
+            return complexity * complexity * complexity;
+          }
+        case OpCodes.Power:
+        case OpCodes.Root: {
+            double complexity = CalculateComplexity(node.GetSubtree(0));
+            var exponent = node.GetSubtree(1) as ConstantTreeNode;
+            if (exponent != null) {
+              double expVal = exponent.Value;
+              if (expVal < 0) expVal = Math.Abs(expVal);
+              if (expVal < 1) expVal = 1 / expVal;
+              return Math.Pow(complexity, Math.Round(expVal));
+            }
+
+            double expComplexity = CalculateComplexity(node.GetSubtree(1));
+            return Math.Pow(complexity, 2 * expComplexity);
+          }
+
+        default:
+          throw new NotSupportedException();
+      }
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisMultiObjectiveProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisMultiObjectiveProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisMultiObjectiveProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -26,8 +26,8 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("E9876DF8-ACFA-41C8-93B7-FA40C57CE459")]
   public abstract class SymbolicDataAnalysisMultiObjectiveProblem<T, U, V> : SymbolicDataAnalysisProblem<T, U, V>, ISymbolicDataAnalysisMultiObjectiveProblem
     where T : class,IDataAnalysisProblemData
@@ -57,5 +57,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisMultiObjectiveProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisMultiObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisMultiObjectiveProblem(SymbolicDataAnalysisMultiObjectiveProblem<T, U, V> original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,6 +21,8 @@
 
 using System;
+using System.Collections.Generic;
 using System.Drawing;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Common.Resources;
@@ -30,10 +32,9 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.PluginInfrastructure;
 using HeuristicLab.Problems.Instances;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("59935E69-C4A5-480E-8FFB-D9669DE9BFD4")]
   public abstract class SymbolicDataAnalysisProblem<T, U, V> : HeuristicOptimizationProblem<U, V>, IDataAnalysisProblem<T>, ISymbolicDataAnalysisProblem, IStorableContent,
     IProblemInstanceConsumer<T>, IProblemInstanceExporter<T>
@@ -156,5 +157,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisProblem(StorableConstructorFlag _) : base(_) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
@@ -208,27 +209,31 @@
 
     protected virtual void UpdateGrammar() {
-      SymbolicExpressionTreeGrammar.MaximumFunctionArguments = MaximumFunctionArguments.Value;
-      SymbolicExpressionTreeGrammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value;
-      foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Variable>()) {
-        if (!varSymbol.Fixed) {
-          varSymbol.AllVariableNames = ProblemData.InputVariables.Select(x => x.Value);
-          varSymbol.VariableNames = ProblemData.AllowedInputVariables;
-        }
-      }
-      foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableCondition>()) {
-        if (!varSymbol.Fixed) {
-          varSymbol.AllVariableNames = ProblemData.InputVariables.Select(x => x.Value);
-          varSymbol.VariableNames = ProblemData.AllowedInputVariables;
-        }
-      }
+      var problemData = ProblemData;
+      var grammar = SymbolicExpressionTreeGrammar;
+
+      grammar.MaximumFunctionArguments = MaximumFunctionArguments.Value;
+      grammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value;
+
+      grammar.ConfigureVariableSymbols(problemData);
     }
 
     private void InitializeOperators() {
-      Operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>());
-      Operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicDataAnalysisExpressionCrossover<T>>());
-      Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());
-      Operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer());
-      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
-      Operators.Add(new SymbolicExpressionTreeLengthAnalyzer());
+      var operators = new HashSet<IItem>(new TypeEqualityComparer<IItem>());
+      operators.Add(new SubtreeCrossover());
+      operators.Add(new MultiSymbolicExpressionTreeManipulator());
+
+      foreach (var op in ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>())
+        operators.Add(op);
+      foreach (var op in ApplicationManager.Manager.GetInstances<ISymbolicDataAnalysisExpressionCrossover<T>>())
+        operators.Add(op);
+
+      operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());
+      operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer());
+      operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
+      operators.Add(new SymbolicExpressionTreeLengthAnalyzer());
+      operators.Add(new SymbolicExpressionTreeBottomUpSimilarityCalculator());
+      operators.Add(new SymbolicDataAnalysisBottomUpDiversityAnalyzer(operators.OfType<SymbolicExpressionTreeBottomUpSimilarityCalculator>().First()));
+
+      Operators.AddRange(operators);
       ParameterizeOperators();
     }
@@ -319,5 +324,5 @@
       foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
         op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-        op.ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
       }
       foreach (var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSingleObjectiveProblem.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSingleObjectiveProblem.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSingleObjectiveProblem.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -27,8 +27,8 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("BC7E7414-64B5-4428-AA89-270F8EF6E35E")]
   public abstract class SymbolicDataAnalysisSingleObjectiveProblem<T, U, V> : SymbolicDataAnalysisProblem<T, U, V>, ISymbolicDataAnalysisSingleObjectiveProblem
     where T : class,IDataAnalysisProblemData
@@ -66,5 +66,5 @@
 
     [StorableConstructor]
-    protected SymbolicDataAnalysisSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
+    protected SymbolicDataAnalysisSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     protected SymbolicDataAnalysisSingleObjectiveProblem(SymbolicDataAnalysisSingleObjectiveProblem<T, U, V> original, Cloner cloner)
       : base(original, cloner) {
@@ -73,5 +73,5 @@
     }
 
-    public SymbolicDataAnalysisSingleObjectiveProblem(T problemData, U evaluator, V solutionCreator)
+    protected SymbolicDataAnalysisSingleObjectiveProblem(T problemData, U evaluator, V solutionCreator)
       : base(problemData, evaluator, solutionCreator) {
       Parameters.Add(new FixedValueParameter<BoolValue>(MaximizationParameterName, "Set to false if the problem should be minimized."));
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionImpactValuesCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionImpactValuesCalculator.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionImpactValuesCalculator.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,40 +21,89 @@
 
 using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("E725708A-508E-47DC-B667-DAA569FD1DC2")]
   [Item("SymbolicDataAnalysisSolutionImpactValuesCalculator", "Calculates the impact values and replacements values for symbolic expression tree nodes.")]
   public abstract class SymbolicDataAnalysisSolutionImpactValuesCalculator : Item, ISymbolicDataAnalysisSolutionImpactValuesCalculator {
     protected SymbolicDataAnalysisSolutionImpactValuesCalculator() { }
-
     protected SymbolicDataAnalysisSolutionImpactValuesCalculator(SymbolicDataAnalysisSolutionImpactValuesCalculator original, Cloner cloner)
       : base(original, cloner) { }
     [StorableConstructor]
-    protected SymbolicDataAnalysisSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { }
-    public abstract double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows);
-    public abstract double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN);
-    public abstract void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue, double originalQuality = double.NaN);
+    protected SymbolicDataAnalysisSolutionImpactValuesCalculator(StorableConstructorFlag _) : base(_) { }
 
-    protected static double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
-      Dataset dataset, IEnumerable<int> rows) {
+    public virtual void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows,
+        out double impactValue, out double replacementValue, out double newQualityForImpactsCalculation,
+        double qualityForImpactsCalculation = double.NaN) {
+
+      var cloner = new Cloner();
+      var tempModel = cloner.Clone(model);
+
+      if (double.IsNaN(qualityForImpactsCalculation)) {
+        qualityForImpactsCalculation = CalculateQualityForImpacts(tempModel, problemData, rows);
+      }
+
+      var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node);
+      var tempModelParentNode = tempModelNode.Parent;
+      int i = tempModelParentNode.IndexOfSubtree(tempModelNode);
+
+      double bestReplacementValue = 0.0;
+      double bestImpactValue = double.PositiveInfinity;
+      newQualityForImpactsCalculation = qualityForImpactsCalculation; // initialize
+      // try the potentially reasonable replacement values and use the best one
+      foreach (var repValue in CalculateReplacementValues(node, model.SymbolicExpressionTree, model.Interpreter, problemData.Dataset, rows)) {
+        tempModelParentNode.RemoveSubtree(i);
+
+        var constantNode = new ConstantTreeNode(new Constant()) { Value = repValue };
+        tempModelParentNode.InsertSubtree(i, constantNode);
+
+        newQualityForImpactsCalculation = CalculateQualityForImpacts(tempModel, problemData, rows);
+
+        impactValue = qualityForImpactsCalculation - newQualityForImpactsCalculation;
+        if (impactValue < bestImpactValue) {
+          bestImpactValue = impactValue;
+          bestReplacementValue = repValue;
+        }
+      }
+
+      replacementValue = bestReplacementValue;
+      impactValue = bestImpactValue;
+    }
+
+    protected abstract double CalculateQualityForImpacts(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IEnumerable<int> rows);
+
+    protected IEnumerable<double> CalculateReplacementValues(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
+      IDataset dataset, IEnumerable<int> rows) {
       //optimization: constant nodes return always the same value
       ConstantTreeNode constantNode = node as ConstantTreeNode;
-      if (constantNode != null) return constantNode.Value;
+      BinaryFactorVariableTreeNode binaryFactorNode = node as BinaryFactorVariableTreeNode;
+      FactorVariableTreeNode factorNode = node as FactorVariableTreeNode;
+      if (constantNode != null) {
+        yield return constantNode.Value;
+      } else if (binaryFactorNode != null) {
+        // valid replacements are either all off or all on
+        yield return 0;
+        yield return 1;
+      } else if (factorNode != null) {
+        foreach (var w in factorNode.Weights) yield return w;
+        yield return 0.0;
+      } else {
+        var rootSymbol = new ProgramRootSymbol().CreateTreeNode();
+        var startSymbol = new StartSymbol().CreateTreeNode();
+        rootSymbol.AddSubtree(startSymbol);
+        startSymbol.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
 
-      var rootSymbol = new ProgramRootSymbol().CreateTreeNode();
-      var startSymbol = new StartSymbol().CreateTreeNode();
-      rootSymbol.AddSubtree(startSymbol);
-      startSymbol.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
-
-      var tempTree = new SymbolicExpressionTree(rootSymbol);
-      // clone ADFs of source tree
-      for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
-        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
+        var tempTree = new SymbolicExpressionTree(rootSymbol);
+        // clone ADFs of source tree
+        for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
+          tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
+        }
+        yield return interpreter.GetSymbolicExpressionTreeValues(tempTree, dataset, rows).Median();
+        yield return interpreter.GetSymbolicExpressionTreeValues(tempTree, dataset, rows).Average(); // TODO perf
       }
-      return interpreter.GetSymbolicExpressionTreeValues(tempTree, dataset, rows).Median();
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Absolute.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Absolute.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Absolute.cs	(revision 17687)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("E848B148-A03E-4B01-9CBD-03E033636D32")]
+  [Item("Absolute", "Symbol that represents the absolute value function abs(x).")]
+  public sealed class Absolute : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = 1;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private Absolute(StorableConstructorFlag _) : base(_) { }
+    private Absolute(Absolute original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Absolute(this, cloner);
+    }
+    public Absolute() : base("Absolute", "Symbol that represents the absolute value function.") { }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Addition.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Addition.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Addition.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("483AAB50-D2E9-472E-A2FA-625F621B7CA9")]
   [Item("Addition", "Symbol that represents the + operator.")]
   public sealed class Addition : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Addition(bool deserializing) : base(deserializing) { }
+    private Addition(StorableConstructorFlag _) : base(_) { }
     private Addition(Addition original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AiryA.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AiryA.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AiryA.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("713B9373-38D1-47CD-BD03-82A77A4A2728")]
   [Item("AiryA", "Symbol that represents the Airy A function.")]
   public sealed class AiryA : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private AiryA(bool deserializing) : base(deserializing) { }
+    private AiryA(StorableConstructorFlag _) : base(_) { }
     private AiryA(AiryA original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AiryB.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AiryB.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AiryB.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("FF61B6CC-700F-44D3-9D1A-F3BF2F084FE4")]
   [Item("AiryB", "Symbol that represents the Airy B function.")]
   public sealed class AiryB : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private AiryB(bool deserializing) : base(deserializing) { }
+    private AiryB(StorableConstructorFlag _) : base(_) { }
     private AiryB(AiryB original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AnalyticQuotient.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AnalyticQuotient.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AnalyticQuotient.cs	(revision 17687)
@@ -0,0 +1,52 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("1BFD8CB7-7377-4130-9903-1E9A76349285")]
+  [Item("Analytic Quotient", "The analytic quotient function aq(a,b) = a / sqrt(b²+1) can be used as an " +
+    "alternative to protected division. See H. Drieberg and P. Rocket, The Use of an Analytic Quotient Operator" +
+    " in Genetic Programming. IEEE Transactions on Evolutionary Computation, Vol. 17, No. 1, February 2013, pp. 146 -- 152")]
+  public sealed class AnalyticQuotient : Symbol {
+    private const int minimumArity = 2;
+    private const int maximumArity = 2;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private AnalyticQuotient(StorableConstructorFlag _) : base(_) { }
+    private AnalyticQuotient(AnalyticQuotient original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AnalyticQuotient(this, cloner);
+    }
+    public AnalyticQuotient() : base("AnalyticQuotient", "The analytic quotient function aq(a,b) = a / sqrt(b²+1) can be used as an " +
+    "alternative to protected division. See H. Drieberg and P. Rocket, The Use of an Analytic Quotient Operator" +
+    " in Genetic Programming. IEEE Transactions on Evolutionary Computation, Vol. 17, No. 1, February 2013, pp. 146 -- 152") { }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/And.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/And.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/And.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("814BC6C4-C631-4819-90CE-2B403E71170C")]
   [Item("And", "Symbol that represents the boolean AND operator.")]
   public sealed class And : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private And(bool deserializing) : base(deserializing) { }
+    private And(StorableConstructorFlag _) : base(_) { }
     private And(And original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AutoregressiveVariable.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AutoregressiveVariable.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/AutoregressiveVariable.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,11 +22,11 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("AA17605D-3F9A-4C52-89F5-34AF2AF4999C")]
   [Item("AutoregressiveTargetVariable", "Represents a variable value with a time offset.")]
   public sealed class AutoregressiveTargetVariable : LaggedVariable {
     [StorableConstructor]
-    private AutoregressiveTargetVariable(bool deserializing) : base(deserializing) { }
+    private AutoregressiveTargetVariable(StorableConstructorFlag _) : base(_) { }
     private AutoregressiveTargetVariable(AutoregressiveTargetVariable original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Average.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Average.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Average.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("459E521B-A921-4A0F-B63D-B298DA2CDD11")]
   [Item("Average", "Symbol that represents the average (arithmetic mean) function.")]
   public sealed class Average : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Average(bool deserializing) : base(deserializing) { }
+    private Average(StorableConstructorFlag _) : base(_) { }
     private Average(Average original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Bessel.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Bessel.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Bessel.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("D36513D2-D36E-412E-BC56-AA744BF1F124")]
   [Item("Bessel", "Symbol that represents the Bessel function.")]
   public sealed class Bessel : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Bessel(bool deserializing) : base(deserializing) { }
+    private Bessel(StorableConstructorFlag _) : base(_) { }
     private Bessel(Bessel original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariable.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariable.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariable.cs	(revision 17687)
@@ -0,0 +1,75 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("241007AC-B461-4028-BA3A-79F393FF3ACB")]
+  [Item("BinaryFactorVariable", "Represents a categorical variable (comparable to factors as in R) and it's value.")]
+  public sealed class BinaryFactorVariable : VariableBase {
+
+    private readonly Dictionary<string, List<string>> variableValues;
+
+    [Storable]
+    public IEnumerable<KeyValuePair<string, List<string>>> VariableValues {
+      get { return variableValues; }
+      set {
+        if (value == null) throw new ArgumentNullException();
+        variableValues.Clear();
+        foreach (var kvp in value) {
+          variableValues.Add(kvp.Key, new List<string>(kvp.Value));
+        }
+      }
+    }
+
+    [StorableConstructor]
+    private BinaryFactorVariable(StorableConstructorFlag _) : base(_) {
+      variableValues = new Dictionary<string, List<string>>();
+    }
+    private BinaryFactorVariable(BinaryFactorVariable original, Cloner cloner)
+      : base(original, cloner) {
+      variableValues =
+        original.variableValues.ToDictionary(kvp => kvp.Key, kvp => new List<string>(kvp.Value));
+    }
+    public BinaryFactorVariable() : this("BinaryFactorVariable", "Represents a categorical variable (comparable to factors as in R) and it's value.") { }
+    public BinaryFactorVariable(string name, string description)
+      : base(name, description) {
+      variableValues = new Dictionary<string, List<string>>();
+    }
+
+    public override ISymbolicExpressionTreeNode CreateTreeNode() {
+      return new BinaryFactorVariableTreeNode(this);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BinaryFactorVariable(this, cloner);
+    }
+
+    public IEnumerable<string> GetVariableValues(string variableName) {
+      return variableValues[variableName];
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariableTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariableTreeNode.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariableTreeNode.cs	(revision 17687)
@@ -0,0 +1,84 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HEAL.Attic;
+using HeuristicLab.Random;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("FC7010CD-639B-42E1-B1D0-7DE5CEFBC8B1")]
+  public sealed class BinaryFactorVariableTreeNode : VariableTreeNodeBase {
+    public new BinaryFactorVariable Symbol {
+      get { return (BinaryFactorVariable)base.Symbol; }
+    }
+
+    [Storable]
+    private string variableValue;
+    public string VariableValue {
+      get { return variableValue; }
+      set { variableValue = value; }
+    }
+
+    [StorableConstructor]
+    private BinaryFactorVariableTreeNode(StorableConstructorFlag _) : base(_) { }
+    private BinaryFactorVariableTreeNode(BinaryFactorVariableTreeNode original, Cloner cloner)
+      : base(original, cloner) {
+      variableValue = original.variableValue;
+    }
+    public BinaryFactorVariableTreeNode(BinaryFactorVariable variableSymbol) : base(variableSymbol) { }
+
+    public override bool HasLocalParameters {
+      get { return true; }
+    }
+
+    public override void ResetLocalParameters(IRandom random) {
+      base.ResetLocalParameters(random);
+      variableValue = Symbol.GetVariableValues(VariableName).SampleRandom(random);
+    }
+
+    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
+      // 50% additive & 50% multiplicative (override of functionality of base class because of a BUG)
+      if (random.NextDouble() < 0.5) {
+        double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
+        Weight = Weight + x * shakingFactor;
+      } else {
+        double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
+        Weight = Weight * x;
+      }
+      if (random.NextDouble() < Symbol.VariableChangeProbability) {
+        var oldName = VariableName;
+        VariableName = Symbol.VariableNames.SampleRandom(random);
+        // reinitialize weights if variable has changed (similar to FactorVariableTreeNode)
+        if (oldName != VariableName)
+          Weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
+      }
+      variableValue = Symbol.GetVariableValues(VariableName).SampleRandom(random);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BinaryFactorVariableTreeNode(this, cloner);
+    }
+
+    public override string ToString() {
+      return base.ToString() + " = " + variableValue;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Constant.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Constant.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Constant.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,7 +24,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("5CD355EA-36E4-4E43-B8C4-9E9CF4CBC860")]
   [Item("Constant", "Represents a constant value.")]
   public sealed class Constant : Symbol {
@@ -100,5 +100,5 @@
 
     [StorableConstructor]
-    private Constant(bool deserializing) : base(deserializing) { }
+    private Constant(StorableConstructorFlag _) : base(_) { }
     private Constant(Constant original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ConstantTreeNode.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,8 +23,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.Random;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("247DBD04-18F2-4184-B6F5-6E283BF06FD0")]
   public sealed class ConstantTreeNode : SymbolicExpressionTreeTerminalNode {
     public new Constant Symbol {
@@ -40,5 +40,5 @@
 
     [StorableConstructor]
-    private ConstantTreeNode(bool deserializing) : base(deserializing) { }
+    private ConstantTreeNode(StorableConstructorFlag _) : base(_) { }
 
     private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cosine.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cosine.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cosine.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("06203C9F-F299-44E6-97B9-D0221ED340BA")]
   [Item("Cosine", "Symbol that represents the cosine function.")]
   public sealed class Cosine : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Cosine(bool deserializing) : base(deserializing) { }
+    private Cosine(StorableConstructorFlag _) : base(_) { }
     private Cosine(Cosine original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/CosineIntegral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/CosineIntegral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/CosineIntegral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("E81D60C0-B816-458C-A200-FB7A6DD16B92")]
   [Item("CosineIntegral", "Symbol that represents the cosine integral.")]
   public sealed class CosineIntegral : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private CosineIntegral(bool deserializing) : base(deserializing) { }
+    private CosineIntegral(StorableConstructorFlag _) : base(_) { }
     private CosineIntegral(CosineIntegral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cube.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cube.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cube.cs	(revision 17687)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("99766C72-9ED8-4C02-BC44-7620D49AFADB")]
+  [Item("Cube", "Symbol that represents the cube function.")]
+  public sealed class Cube : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = 1;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private Cube(StorableConstructorFlag _) : base(_) { }
+    private Cube(Cube original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Cube(this, cloner);
+    }
+    public Cube() : base("Cube", "Symbol that represents the cube function.") { }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/CubeRoot.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/CubeRoot.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/CubeRoot.cs	(revision 17687)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("7708EF21-17D9-4585-B9EA-74FEBE2A4B88")]
+  [Item("CubeRoot", "Symbol that represents the cube root function.")]
+  public sealed class CubeRoot : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = 1;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private CubeRoot(StorableConstructorFlag _) : base(_) { }
+    private CubeRoot(CubeRoot original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CubeRoot(this, cloner);
+    }
+    public CubeRoot() : base("CubeRoot", "Symbol that represents the cube root function.") { }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Dawson.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Dawson.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Dawson.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("41CB51E4-CDD0-4082-8E4F-9F4D66376C92")]
   [Item("Dawson", "Symbol that represents dawsons integral.")]
   public sealed class Dawson : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Dawson(bool deserializing) : base(deserializing) { }
+    private Dawson(StorableConstructorFlag _) : base(_) { }
     private Dawson(Dawson original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Derivative.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Derivative.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Derivative.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("6207C7B5-A461-4CB2-8860-58E236BBDC41")]
   [Item("Derivative", "Represents the derivative over the specified subtree.")]
   public sealed class Derivative : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Derivative(bool deserializing) : base(deserializing) { }
+    private Derivative(StorableConstructorFlag _) : base(_) { }
     private Derivative(Derivative original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new Derivative(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Division.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Division.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Division.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("EE4A9CF4-483A-4671-AEA2-03E3DAF2F976")]
   [Item("Division", "Symbol that represents the / operator.")]
   public sealed class Division : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Division(bool deserializing) : base(deserializing) { }
+    private Division(StorableConstructorFlag _) : base(_) { }
     private Division(Division original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Erf.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Erf.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Erf.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("2C298890-15BC-42A9-AC63-4E48B1ED4FF3")]
   [Item("Erf", "Symbol that represents the error function.")]
   public sealed class Erf : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Erf(bool deserializing) : base(deserializing) { }
+    private Erf(StorableConstructorFlag _) : base(_) { }
     private Erf(Erf original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Exponential.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Exponential.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Exponential.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("98360DAA-C01A-42B3-8AB1-B18E6C0835BB")]
   [Item("Exponential", "Symbol that represents the exponential function.")]
   public sealed class Exponential : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Exponential(bool deserializing) : base(deserializing) { }
+    private Exponential(StorableConstructorFlag _) : base(_) { }
     private Exponential(Exponential original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ExponentialIntegralEi.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ExponentialIntegralEi.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ExponentialIntegralEi.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("189FCA77-9541-4F5B-9215-7AEA995C6203")]
   [Item("ExponentialIntegralEi", "Symbol that represents the exponential integral (e_i).")]
   public sealed class ExponentialIntegralEi : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private ExponentialIntegralEi(bool deserializing) : base(deserializing) { }
+    private ExponentialIntegralEi(StorableConstructorFlag _) : base(_) { }
     private ExponentialIntegralEi(ExponentialIntegralEi original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariable.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariable.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariable.cs	(revision 17687)
@@ -0,0 +1,77 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("511B0319-0180-4C2E-81AD-3A8936BE4DE8")]
+  [Item("FactorVariable", "Represents a categorical variable (comparable to factors as in R).")]
+  public sealed class FactorVariable : VariableBase {
+    private readonly Dictionary<string, Dictionary<string, int>> variableValues; // for each variable value also store a zero-based index
+    [Storable]
+    public IEnumerable<KeyValuePair<string, Dictionary<string, int>>> VariableValues {
+      get { return variableValues; }
+      set {
+        if(value == null) throw new ArgumentNullException();
+        variableValues.Clear();
+        foreach(var kvp in value) {
+          variableValues.Add(kvp.Key, new Dictionary<string, int>(kvp.Value));
+        }
+      }
+    }
+
+    [StorableConstructor]
+    private FactorVariable(StorableConstructorFlag _) : base(_) {
+      variableValues = new Dictionary<string, Dictionary<string, int>>();
+    }
+    private FactorVariable(FactorVariable original, Cloner cloner)
+      : base(original, cloner) {
+      variableValues =
+        original.variableValues.ToDictionary(kvp => kvp.Key, kvp => new Dictionary<string, int>(kvp.Value));
+    }
+    public FactorVariable() : this("FactorVariable", "Represents a categorical variable (comparable to factors as in R).") { }
+    public FactorVariable(string name, string description)
+      : base(name, description) {
+      variableValues = new Dictionary<string, Dictionary<string,int>>();
+    }
+
+    public override ISymbolicExpressionTreeNode CreateTreeNode() {
+      return new FactorVariableTreeNode(this);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FactorVariable(this, cloner);
+    }
+
+    public IEnumerable<string> GetVariableValues(string variableName) {
+      return variableValues[variableName].Keys;
+    }
+
+    public int GetIndexForValue(string variableName, string variableValue) {
+      return variableValues[variableName][variableValue];
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs	(revision 17687)
@@ -0,0 +1,115 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+using HeuristicLab.Random;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("A968620F-339E-4C96-B39A-8FC8E42D6509")]
+  public sealed class FactorVariableTreeNode : SymbolicExpressionTreeTerminalNode, IVariableTreeNode {
+    public new FactorVariable Symbol {
+      get { return (FactorVariable)base.Symbol; }
+    }
+    [Storable]
+    private double[] weights;
+    public double[] Weights {
+      get { return weights; }
+      set { weights = value; }
+    }
+    [Storable]
+    private string variableName;
+    public string VariableName {
+      get { return variableName; }
+      set { variableName = value; }
+    }
+
+    [StorableConstructor]
+    private FactorVariableTreeNode(StorableConstructorFlag _) : base(_) { }
+    private FactorVariableTreeNode(FactorVariableTreeNode original, Cloner cloner)
+      : base(original, cloner) {
+      variableName = original.variableName;
+      if (original.weights != null) {
+        this.weights = new double[original.Weights.Length];
+        Array.Copy(original.Weights, weights, weights.Length);
+      }
+    }
+
+    public FactorVariableTreeNode(FactorVariable variableSymbol)
+      : base(variableSymbol) {
+    }
+
+    public override bool HasLocalParameters {
+      get { return true; }
+    }
+
+    public override void ResetLocalParameters(IRandom random) {
+      base.ResetLocalParameters(random);
+      variableName = Symbol.VariableNames.SampleRandom(random);
+      weights =
+        Symbol.GetVariableValues(variableName)
+        .Select(_ => NormalDistributedRandom.NextDouble(random, 0, 1)).ToArray();
+    }
+
+    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
+      // mutate only one randomly selected weight
+      var idx = random.Next(weights.Length);
+      // 50% additive & 50% multiplicative
+      if (random.NextDouble() < 0.5) {
+        double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu,
+          Symbol.WeightManipulatorSigma);
+        weights[idx] = weights[idx] + x * shakingFactor;
+      } else {
+        double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
+        weights[idx] = weights[idx] * x;
+      }
+      if (random.NextDouble() < Symbol.VariableChangeProbability) {
+        VariableName = Symbol.VariableNames.SampleRandom(random);
+        if (weights.Length != Symbol.GetVariableValues(VariableName).Count()) {
+          // if the length of the weight array does not match => re-initialize weights
+          weights =
+            Symbol.GetVariableValues(variableName)
+              .Select(_ => NormalDistributedRandom.NextDouble(random, 0, 1))
+              .ToArray();
+        }
+      }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FactorVariableTreeNode(this, cloner);
+    }
+
+    public double GetValue(string cat) {
+      return weights[Symbol.GetIndexForValue(VariableName, cat)];
+    }
+
+    public override string ToString() {
+      var weightStr = string.Join("; ",
+        Symbol.GetVariableValues(VariableName).Select(value => value + ": " + GetValue(value).ToString("E4")));
+      return VariableName + " (factor) "
+        + "[" + weightStr + "]";
+    }
+  }
+}
+
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FresnelCosineIntegral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FresnelCosineIntegral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FresnelCosineIntegral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("6AAB7AAC-F0DD-466F-8111-0EBA3BAB51C6")]
   [Item("FresnelCosineIntegral", "Symbol that represents the Fresnel cosine integral.")]
   public sealed class FresnelCosineIntegral : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private FresnelCosineIntegral(bool deserializing) : base(deserializing) { }
+    private FresnelCosineIntegral(StorableConstructorFlag _) : base(_) { }
     private FresnelCosineIntegral(FresnelCosineIntegral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FresnelSineIntegral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FresnelSineIntegral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FresnelSineIntegral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("CEB592FC-E402-4A7C-A207-E4048F87DB82")]
   [Item("FresnelSineIntegral", "Symbol that represents the Fresnel sine integral.")]
   public sealed class FresnelSineIntegral : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private FresnelSineIntegral(bool deserializing) : base(deserializing) { }
+    private FresnelSineIntegral(StorableConstructorFlag _) : base(_) { }
     private FresnelSineIntegral(FresnelSineIntegral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Gamma.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Gamma.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Gamma.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("8CC57AD6-B24D-4DCE-BFA0-A799804448F7")]
   [Item("Gamma", "Symbol that represents the gamma function.")]
   public sealed class Gamma : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Gamma(bool deserializing) : base(deserializing) { }
+    private Gamma(StorableConstructorFlag _) : base(_) { }
     private Gamma(Gamma original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/GreaterThan.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/GreaterThan.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/GreaterThan.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("A64DBD26-2DD7-4799-B413-AB05CDAAE749")]
   [Item("GreaterThan", "Symbol that represents a greater than relation.")]
   public sealed class GreaterThan : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private GreaterThan(bool deserializing) : base(deserializing) { }
+    private GreaterThan(StorableConstructorFlag _) : base(_) { }
     private GreaterThan(GreaterThan original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicCosineIntegral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicCosineIntegral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicCosineIntegral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("C4F429C2-B26A-4BD8-AB6A-3EBE45D3EE25")]
   [Item("HyperbolicCosineIntegral", "Symbol that represents the hyperbolic cosine integral.")]
   public sealed class HyperbolicCosineIntegral : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private HyperbolicCosineIntegral(bool deserializing) : base(deserializing) { }
+    private HyperbolicCosineIntegral(StorableConstructorFlag _) : base(_) { }
     private HyperbolicCosineIntegral(HyperbolicCosineIntegral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicSineIntegral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicSineIntegral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicSineIntegral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("2C77DB69-380F-48B9-95FE-458C8576B886")]
   [Item("HyperbolicSineIntegral", "Symbol that represents the hyperbolic sine integral.")]
   public sealed class HyperbolicSineIntegral : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private HyperbolicSineIntegral(bool deserializing) : base(deserializing) { }
+    private HyperbolicSineIntegral(StorableConstructorFlag _) : base(_) { }
     private HyperbolicSineIntegral(HyperbolicSineIntegral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicTangent.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicTangent.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/HyperbolicTangent.cs	(revision 17687)
@@ -0,0 +1,52 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("32F7D410-066A-4ABF-81BB-9CD5A49C7B17")]
+  [Item("HyperbolicSineIntegral", "Symbol that represents the hyperbolic sine integral.")]
+  public sealed class HyperbolicTangent : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = 1;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private HyperbolicTangent(StorableConstructorFlag _) : base(_) { }
+    private HyperbolicTangent(HyperbolicTangent original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new HyperbolicTangent(this, cloner);
+    }
+    public HyperbolicTangent() : base("HyperbolicTangent", "Symbol that represents the hyperbolic tanh().") { }
+  }
+}
+
+
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ILaggedTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ILaggedTreeNode.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ILaggedTreeNode.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,5 +22,8 @@
 
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("9396d5df-6a2e-4cd1-ac5a-36ca8d391927")]
   public interface ILaggedTreeNode : ISymbolicExpressionTreeNode {
     int Lag { get; set; }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/IfThenElse.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/IfThenElse.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/IfThenElse.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("8AD33C34-9F5C-4F58-8C4C-25EA7F0A8C97")]
   [Item("IfThenElse", "Symbol that represents a conditional operator.")]
   public sealed class IfThenElse : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private IfThenElse(bool deserializing) : base(deserializing) { }
+    private IfThenElse(StorableConstructorFlag _) : base(_) { }
     private IfThenElse(IfThenElse original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Integral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Integral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Integral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,7 +22,7 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("217049E2-47B0-430A-808B-F667D5EEAE39")]
   [Item("Integral", "Represents the integral over the specified subtree.")]
   public sealed class Integral : LaggedSymbol {
@@ -38,5 +38,5 @@
 
     [StorableConstructor]
-    private Integral(bool deserializing) : base(deserializing) { }
+    private Integral(StorableConstructorFlag _) : base(_) { }
     private Integral(Integral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new Integral(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedSymbol.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedSymbol.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedSymbol.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,8 +23,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("3290F116-CD55-4749-9983-E4E5692A5666")]
   [Item("LaggedSymbol", "Represents a symblol whose evaluation is shifted.")]
   public abstract class LaggedSymbol : Symbol {
@@ -43,5 +43,5 @@
 
     [StorableConstructor]
-    protected LaggedSymbol(bool deserializing) : base(deserializing) { }
+    protected LaggedSymbol(StorableConstructorFlag _) : base(_) { }
     protected LaggedSymbol(LaggedSymbol original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedTreeNode.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedTreeNode.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,7 +24,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("B5DF4207-7FDD-478D-B2FD-E52D8B7CD709")]
   public class LaggedTreeNode : SymbolicExpressionTreeNode, ILaggedTreeNode {
     public new LaggedSymbol Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    protected LaggedTreeNode(bool deserializing) : base(deserializing) { }
+    protected LaggedTreeNode(StorableConstructorFlag _) : base(_) { }
     protected LaggedTreeNode(LaggedTreeNode original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariable.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariable.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariable.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,9 +23,9 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("82D1162C-A27E-460D-97D0-497361262446")]
   [Item("LaggedVariable", "Represents a variable value with a time offset.")]
-  public class LaggedVariable : Variable {
+  public class LaggedVariable : VariableBase {
     [Storable]
     private int minLag;
@@ -41,5 +41,5 @@
     }
     [StorableConstructor]
-    protected LaggedVariable(bool deserializing) : base(deserializing) { }
+    protected LaggedVariable(StorableConstructorFlag _) : base(_) { }
     protected LaggedVariable(LaggedVariable original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariableTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariableTreeNode.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LaggedVariableTreeNode.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,8 +23,8 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
-  public sealed class LaggedVariableTreeNode : VariableTreeNode, ILaggedTreeNode {
+  [StorableType("0B35397B-5634-44DB-9350-9EC41E5D4A45")]
+  public sealed class LaggedVariableTreeNode : VariableTreeNodeBase, ILaggedTreeNode {
     public new LaggedVariable Symbol {
       get { return (LaggedVariable)base.Symbol; }
@@ -42,5 +42,5 @@
 
     [StorableConstructor]
-    private LaggedVariableTreeNode(bool deserializing) : base(deserializing) { }
+    private LaggedVariableTreeNode(StorableConstructorFlag _) : base(_) { }
     private LaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner)
       : base(original, cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LessThan.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LessThan.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LessThan.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("1CDA8B1E-9CA1-4D55-BFB8-557BD2FB2D1C")]
   [Item("LessThan", "Symbol that represents a less than relation.")]
   public sealed class LessThan : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private LessThan(bool deserializing) : base(deserializing) { }
+    private LessThan(StorableConstructorFlag _) : base(_) { }
     private LessThan(LessThan original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Logarithm.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Logarithm.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Logarithm.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("640A38A9-CDEE-4928-BC4A-B69AD2328FB8")]
   [Item("Logarithm", "Symbol that represents the logarithm function.")]
   public sealed class Logarithm : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Logarithm(bool deserializing) : base(deserializing) { }
+    private Logarithm(StorableConstructorFlag _) : base(_) { }
     private Logarithm(Logarithm original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Multiplication.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Multiplication.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Multiplication.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("8F054D7F-82D0-400A-BAE3-8C90EA709C34")]
   [Item("Multiplication", "Symbol that represents the * operator.")]
   public sealed class Multiplication : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Multiplication(bool deserializing) : base(deserializing) { }
+    private Multiplication(StorableConstructorFlag _) : base(_) { }
     private Multiplication(Multiplication original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Norm.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Norm.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Norm.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("343418E1-2BA5-45A6-B324-3F0B78EFD95B")]
   [Item("Norm", "Symbol that represents the normal distribution function.")]
   public sealed class Norm : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Norm(bool deserializing) : base(deserializing) { }
+    private Norm(StorableConstructorFlag _) : base(_) { }
     private Norm(Norm original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Not.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Not.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Not.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("5AC7B0DB-F1F8-49AA-AB01-28BD49B41378")]
   [Item("Not", "Symbol that represents the boolean NOT operator.")]
   public sealed class Not : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Not(bool deserializing) : base(deserializing) { }
+    private Not(StorableConstructorFlag _) : base(_) { }
     private Not(Not original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Or.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Or.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Or.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("0A0574AA-B606-4633-973F-C1D888EAB386")]
   [Item("Or", "Symbol that represents the boolean OR operator.")]
   public sealed class Or : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Or(bool deserializing) : base(deserializing) { }
+    private Or(StorableConstructorFlag _) : base(_) { }
     private Or(Or original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Power.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Power.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Power.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("844DADA3-5315-46FD-B34D-CD76F68714EB")]
   [Item("Power", "Symbol that represents the power function.")]
   public sealed class Power : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Power(bool deserializing) : base(deserializing) { }
+    private Power(StorableConstructorFlag _) : base(_) { }
     private Power(Power original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Psi.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Psi.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Psi.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("5B0CDC8F-F87C-487F-A64B-A9D2C27F0F1A")]
   [Item("Psi", "Symbol that represents the psi function.")]
   public sealed class Psi : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Psi(bool deserializing) : base(deserializing) { }
+    private Psi(StorableConstructorFlag _) : base(_) { }
     private Psi(Psi original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Root.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Root.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Root.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("A6EF8F30-D00E-4620-9560-06FEAC3131C8")]
   [Item("Root", "Symbol that represents the n-th root function.")]
   public sealed class Root : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Root(bool deserializing) : base(deserializing) { }
+    private Root(StorableConstructorFlag _) : base(_) { }
     private Root(Root original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Sine.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Sine.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Sine.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("8234F316-1816-41C5-94A9-11A5F3D36A77")]
   [Item("Sine", "Symbol that represents the sine function.")]
   public sealed class Sine : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Sine(bool deserializing) : base(deserializing) { }
+    private Sine(StorableConstructorFlag _) : base(_) { }
     private Sine(Sine original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SineIntegral.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SineIntegral.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SineIntegral.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("2E0DFA26-2513-4F86-B276-F35AE8F4C1CA")]
   [Item("SineIntegral", "Symbol that represents the sine integral.")]
   public sealed class SineIntegral : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private SineIntegral(bool deserializing) : base(deserializing) { }
+    private SineIntegral(StorableConstructorFlag _) : base(_) { }
     private SineIntegral(SineIntegral original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Square.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Square.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Square.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("A6251B59-A1CE-43A9-98C0-211B88D53DD5")]
   [Item("Square", "Symbol that represents the square function.")]
   public sealed class Square : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Square(bool deserializing) : base(deserializing) { }
+    private Square(StorableConstructorFlag _) : base(_) { }
     private Square(Square original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SquareRoot.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SquareRoot.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SquareRoot.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("E5D97AE5-0656-4FE5-B493-52A400ACE9AE")]
   [Item("SquareRoot", "Symbol that represents the square root function.")]
   public sealed class SquareRoot : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private SquareRoot(bool deserializing) : base(deserializing) { }
+    private SquareRoot(StorableConstructorFlag _) : base(_) { }
     private SquareRoot(SquareRoot original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Subtraction.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Subtraction.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Subtraction.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("F50263D4-2B07-42C8-8AB6-297A54AE00CC")]
   [Item("Subtraction", "Symbol that represents the - operator.")]
   public sealed class Subtraction : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Subtraction(bool deserializing) : base(deserializing) { }
+    private Subtraction(StorableConstructorFlag _) : base(_) { }
     private Subtraction(Subtraction original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Tangent.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Tangent.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Tangent.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,7 +23,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("636D006E-C4A5-494B-8E26-566B42A9B4AF")]
   [Item("Tangent", "Symbol that represents the tangent trigonometric function.")]
   public sealed class Tangent : Symbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private Tangent(bool deserializing) : base(deserializing) { }
+    private Tangent(StorableConstructorFlag _) : base(_) { }
     private Tangent(Tangent original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,8 +22,8 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("A9FEA73C-37C4-4948-B08E-0A12EDE169E2")]
   [Item("TimeLag", "Represents a symblol whose evaluation is shifted.")]
   public sealed class TimeLag : LaggedSymbol {
@@ -39,5 +39,5 @@
 
     [StorableConstructor]
-    private TimeLag(bool deserializing) : base(deserializing) { }
+    private TimeLag(StorableConstructorFlag _) : base(_) { }
     private TimeLag(TimeLag original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new TimeLag(this, cloner); }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,152 +20,21 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("9072AE0E-FA62-48D2-A416-F678D6CC2CBC")]
   [Item("Variable", "Represents a variable value.")]
-  public class Variable : Symbol {
-    #region Properties
-    [Storable]
-    private double weightMu;
-    public double WeightMu {
-      get { return weightMu; }
-      set {
-        if (value != weightMu) {
-          weightMu = value;
-          OnChanged(EventArgs.Empty);
-        }
-      }
-    }
-    [Storable]
-    private double weightSigma;
-    public double WeightSigma {
-      get { return weightSigma; }
-      set {
-        if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
-        if (value != weightSigma) {
-          weightSigma = value;
-          OnChanged(EventArgs.Empty);
-        }
-      }
-    }
-    [Storable]
-    private double weightManipulatorMu;
-    public double WeightManipulatorMu {
-      get { return weightManipulatorMu; }
-      set {
-        if (value != weightManipulatorMu) {
-          weightManipulatorMu = value;
-          OnChanged(EventArgs.Empty);
-        }
-      }
-    }
-    [Storable]
-    private double weightManipulatorSigma;
-    public double WeightManipulatorSigma {
-      get { return weightManipulatorSigma; }
-      set {
-        if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
-        if (value != weightManipulatorSigma) {
-          weightManipulatorSigma = value;
-          OnChanged(EventArgs.Empty);
-        }
-      }
-    }
-    [Storable(DefaultValue = 0.0)]
-    private double multiplicativeWeightManipulatorSigma;
-    public double MultiplicativeWeightManipulatorSigma {
-      get { return multiplicativeWeightManipulatorSigma; }
-      set {
-        if (multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
-        if (value != multiplicativeWeightManipulatorSigma) {
-          multiplicativeWeightManipulatorSigma = value;
-          OnChanged(EventArgs.Empty);
-        }
-      }
-    }
-    private List<string> variableNames;
-    [Storable]
-    public IEnumerable<string> VariableNames {
-      get { return variableNames; }
-      set {
-        if (value == null) throw new ArgumentNullException();
-        variableNames.Clear();
-        variableNames.AddRange(value);
-        OnChanged(EventArgs.Empty);
-      }
-    }
-
-    private List<string> allVariableNames;
-    [Storable]
-    public IEnumerable<string> AllVariableNames {
-      get { return allVariableNames; }
-      set {
-        if (value == null) throw new ArgumentNullException();
-        allVariableNames.Clear();
-        allVariableNames.AddRange(value);
-      }
-    }
-
-    public override bool Enabled {
-      get {
-        if (variableNames.Count == 0) return false;
-        return base.Enabled;
-      }
-      set {
-        if (variableNames.Count == 0) base.Enabled = false;
-        else base.Enabled = value;
-      }
-    }
-
-    private const int minimumArity = 0;
-    private const int maximumArity = 0;
-
-    public override int MinimumArity {
-      get { return minimumArity; }
-    }
-    public override int MaximumArity {
-      get { return maximumArity; }
-    }
-    #endregion
-
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
-        allVariableNames = variableNames;
-      }
-    }
+  public sealed class Variable : VariableBase {
 
     [StorableConstructor]
-    protected Variable(bool deserializing)
-      : base(deserializing) {
-      variableNames = new List<string>();
-      allVariableNames = new List<string>();
+    private Variable(StorableConstructorFlag _) : base(_) {
     }
-    protected Variable(Variable original, Cloner cloner)
+    private Variable(Variable original, Cloner cloner)
       : base(original, cloner) {
-      weightMu = original.weightMu;
-      weightSigma = original.weightSigma;
-      variableNames = new List<string>(original.variableNames);
-      allVariableNames = new List<string>(original.allVariableNames);
-      weightManipulatorMu = original.weightManipulatorMu;
-      weightManipulatorSigma = original.weightManipulatorSigma;
-      multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma;
     }
-    public Variable() : this("Variable", "Represents a variable value.") { }
-    public Variable(string name, string description)
-      : base(name, description) {
-      weightMu = 1.0;
-      weightSigma = 1.0;
-      weightManipulatorMu = 0.0;
-      weightManipulatorSigma = 0.05;
-      multiplicativeWeightManipulatorSigma = 0.03;
-      variableNames = new List<string>();
-      allVariableNames = new List<string>();
-    }
+    public Variable() : base("Variable", "Represents a variable value.") { }
+    public Variable(string name, string description) : base(name, description) { }
 
     public override ISymbolicExpressionTreeNode CreateTreeNode() {
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs	(revision 17687)
@@ -0,0 +1,181 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("F8A6AD96-28D9-4BEC-8392-8B7BA824B085")]
+  public abstract class VariableBase : Symbol, IVariableSymbol {
+    #region Properties
+    [Storable]
+    private double weightMu;
+    public double WeightMu {
+      get { return weightMu; }
+      set {
+        if (value != weightMu) {
+          weightMu = value;
+          OnChanged(EventArgs.Empty);
+        }
+      }
+    }
+    [Storable]
+    private double weightSigma;
+    public double WeightSigma {
+      get { return weightSigma; }
+      set {
+        if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
+        if (value != weightSigma) {
+          weightSigma = value;
+          OnChanged(EventArgs.Empty);
+        }
+      }
+    }
+    [Storable]
+    private double weightManipulatorMu;
+    public double WeightManipulatorMu {
+      get { return weightManipulatorMu; }
+      set {
+        if (value != weightManipulatorMu) {
+          weightManipulatorMu = value;
+          OnChanged(EventArgs.Empty);
+        }
+      }
+    }
+    [Storable]
+    private double weightManipulatorSigma;
+    public double WeightManipulatorSigma {
+      get { return weightManipulatorSigma; }
+      set {
+        if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
+        if (value != weightManipulatorSigma) {
+          weightManipulatorSigma = value;
+          OnChanged(EventArgs.Empty);
+        }
+      }
+    }
+    [Storable(DefaultValue = 0.0)]
+    private double multiplicativeWeightManipulatorSigma;
+    public double MultiplicativeWeightManipulatorSigma {
+      get { return multiplicativeWeightManipulatorSigma; }
+      set {
+        if (multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");
+        if (value != multiplicativeWeightManipulatorSigma) {
+          multiplicativeWeightManipulatorSigma = value;
+          OnChanged(EventArgs.Empty);
+        }
+      }
+    }
+
+    [Storable(DefaultValue = 1.0)]
+    private double variableChangeProbability;
+
+    public double VariableChangeProbability {
+      get { return variableChangeProbability; }
+      set {
+        if (value < 0 || value > 1.0) throw new ArgumentException("Variable change probability must lie in the interval [0..1]");
+        variableChangeProbability = value;
+      }
+    }
+
+    private List<string> variableNames;
+    [Storable]
+    public IEnumerable<string> VariableNames {
+      get { return variableNames; }
+      set {
+        if (value == null) throw new ArgumentNullException();
+        variableNames.Clear();
+        variableNames.AddRange(value);
+        OnChanged(EventArgs.Empty);
+      }
+    }
+
+    private List<string> allVariableNames;
+    [Storable]
+    public IEnumerable<string> AllVariableNames {
+      get { return allVariableNames; }
+      set {
+        if (value == null) throw new ArgumentNullException();
+        allVariableNames.Clear();
+        allVariableNames.AddRange(value);
+      }
+    }
+
+    public override bool Enabled {
+      get {
+        if (variableNames.Count == 0) return false;
+        return base.Enabled;
+      }
+      set {
+        if (variableNames.Count == 0) base.Enabled = false;
+        else base.Enabled = value;
+      }
+    }
+
+    private const int minimumArity = 0;
+    private const int maximumArity = 0;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+    #endregion
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
+        allVariableNames = variableNames;
+      }
+    }
+
+    [StorableConstructor]
+    protected VariableBase(StorableConstructorFlag _) : base(_) {
+      variableNames = new List<string>();
+      allVariableNames = new List<string>();
+    }
+    protected VariableBase(VariableBase original, Cloner cloner)
+      : base(original, cloner) {
+      weightMu = original.weightMu;
+      weightSigma = original.weightSigma;
+      variableNames = new List<string>(original.variableNames);
+      allVariableNames = new List<string>(original.allVariableNames);
+      weightManipulatorMu = original.weightManipulatorMu;
+      weightManipulatorSigma = original.weightManipulatorSigma;
+      multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma;
+      variableChangeProbability = original.variableChangeProbability;
+    }
+    protected VariableBase(string name, string description)
+      : base(name, description) {
+      weightMu = 1.0;
+      weightSigma = 1.0;
+      weightManipulatorMu = 0.0;
+      weightManipulatorSigma = 0.05;
+      multiplicativeWeightManipulatorSigma = 0.03;
+      variableChangeProbability = 0.2;
+      variableNames = new List<string>();
+      allVariableNames = new List<string>();
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,10 +25,10 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
+  [StorableType("6DD62329-E3A5-4C3B-9B38-D57E62D61CCC")]
   [Item("Variable Condition", "Represents a condition that tests a given variable against a specified threshold.")]
-  public sealed class VariableCondition : Symbol {
+  public sealed class VariableCondition : Symbol, IVariableSymbol {
     #region properties
     [Storable]
@@ -100,5 +100,4 @@
         allVariableNames.Clear();
         allVariableNames.AddRange(value);
-        VariableNames = value;
       }
     }
@@ -149,4 +148,25 @@
           OnChanged(EventArgs.Empty);
         }
+      }
+    }
+
+    /// <summary>
+    /// Flag to indicate if the interpreter should ignore the slope parameter (introduced for representation of expression trees)
+    /// </summary>
+    [Storable]
+    private bool ignoreSlope;
+    public bool IgnoreSlope {
+      get { return ignoreSlope; }
+      set { ignoreSlope = value; }
+    }
+
+    public override bool Enabled {
+      get {
+        if (variableNames.Count == 0) return false;
+        return base.Enabled;
+      }
+      set {
+        if (variableNames.Count == 0) base.Enabled = false;
+        else base.Enabled = value;
       }
     }
@@ -172,6 +192,5 @@
 
     [StorableConstructor]
-    private VariableCondition(bool deserializing)
-      : base(deserializing) {
+    private VariableCondition(StorableConstructorFlag _) : base(_) {
       variableNames = new List<string>();
       allVariableNames = new List<string>();
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableConditionTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableConditionTreeNode.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableConditionTreeNode.cs	(revision 17687)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,10 +24,10 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HEAL.Attic;
 using HeuristicLab.Random;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
-  public sealed class VariableConditionTreeNode : SymbolicExpressionTreeNode {
+  [StorableType("D3076BBC-7CF3-4768-8C4B-3FC4FEF041B3")]
+  public sealed class VariableConditionTreeNode : SymbolicExpressionTreeNode, IVariableTreeNode {
     #region properties
     public new VariableCondition Symbol {
@@ -55,5 +55,5 @@
 
     [StorableConstructor]
-    private VariableConditionTreeNode(bool deserializing) : base(deserializing) { }
+    private VariableConditionTreeNode(StorableConstructorFlag _) : base(_) { }
     private VariableConditionTreeNode(VariableConditionTreeNode original, Cloner cloner)
       : base(original, cloner) {
@@ -74,5 +74,9 @@
       base.ResetLocalParameters(random);
       threshold = NormalDistributedRandom.NextDouble(random, Symbol.ThresholdInitializerMu, Symbol.ThresholdInitializerSigma);
+
+#pragma warning disable 612, 618
       variableName = Symbol.VariableNames.SelectRandom(random);
+#pragma warning restore 612, 618
+
       slope = NormalDistributedRandom.NextDouble(random, Symbol.SlopeInitializerMu, Symbol.SlopeInitializerSigma);
     }
@@ -82,5 +86,9 @@
       double x = NormalDistributedRandom.NextDouble(random, Symbol.ThresholdManipulatorMu, Symbol.ThresholdManipulatorSigma);
       threshold = threshold + x * shakingFactor;
+
+#pragma warning disable 612, 618
       variableName = Symbol.VariableNames.SelectRandom(random);
+#pragma warning restore 612, 618
+
       x = NormalDistributedRandom.NextDouble(random, Symbol.SlopeManipulatorMu, Symbol.SlopeManipulatorSigma);
       slope = slope + x * shakingFactor;
@@ -88,9 +96,10 @@
 
     public override string ToString() {
-      if (slope.IsAlmost(0.0))
+      if (slope.IsAlmost(0.0) || Symbol.IgnoreSlope) {
+        return variableName + " < " + threshold.ToString("E4");
+      } else {
         return variableName + " > " + threshold.ToString("E4") + Environment.NewLine +
-          "slope: " + slope.ToString("E4");
-      else
-        return variableName + " > " + threshold.ToString("E4");
+               "slope: " + slope.ToString("E4");
+      }
     }
   }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNode.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNode.cs	(revision 17686)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNode.cs	(revision 17687)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -21,68 +21,22 @@
 
 using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Random;
+using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableClass]
-  public class VariableTreeNode : SymbolicExpressionTreeTerminalNode {
+  [StorableType("E60C4216-A6BA-48DE-BA66-389B9946B70A")]
+  public sealed class VariableTreeNode : VariableTreeNodeBase {
     public new Variable Symbol {
       get { return (Variable)base.Symbol; }
     }
-    [Storable]
-    private double weight;
-    public double Weight {
-      get { return weight; }
-      set { weight = value; }
+    [StorableConstructor]
+    private VariableTreeNode(StorableConstructorFlag _) : base(_) { }
+    private VariableTreeNode(VariableTreeNode original, Cloner cloner)
+      : base(original, cloner) {
     }
-    [Storable]
-    private string variableName;
-    public string VariableName {
-      get { return variableName; }
-      set { variableName = value; }
-    }
-
-    [StorableConstructor]
-    protected VariableTreeNode(bool deserializing) : base(deserializing) { }
-    protected VariableTreeNode(VariableTreeNode original, Cloner cloner)
-      : base(original, cloner) {
-      weight = original.weight;
-      variableName = original.variableName;
-    }
-    protected VariableTreeNode() { }
+    private VariableTreeNode() { }
     public VariableTreeNode(Variable variableSymbol) : base(variableSymbol) { }
-
-    public override bool HasLocalParameters {
-      get { return true; }
-    }
-
-    public override void ResetLocalParameters(IRandom random) {
-      base.ResetLocalParameters(random);
-      weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
-      variableName = Symbol.VariableNames.SelectRandom(random);
-    }
-
-    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
-      base.ShakeLocalParameters(random, shakingFactor);
-      // 50% additive & 50% multiplicative
-      if (random.NextDouble() < 0) {
-        double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
-        weight = weight + x * shakingFactor;
-      } else {        
-        double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
-        weight = weight * x;
-      }
-      variableName = Symbol.VariableNames.SelectRandom(random);
-    }
 
     public override IDeepCloneable Clone(Cloner cloner) {
       return new VariableTreeNode(this, cloner);
     }
-
-    public override string ToString() {
-      if (weight.IsAlmost(1.0)) return variableName;
-      else return weight.ToString("E4") + " " + variableName;
-    }
   }
 }
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNodeBase.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNodeBase.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNodeBase.cs	(revision 17687)
@@ -0,0 +1,103 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+using HeuristicLab.Random;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("B92EF904-18EC-41FC-9123-9B9293246815")]
+  public abstract class VariableTreeNodeBase : SymbolicExpressionTreeTerminalNode, IVariableTreeNode {
+    public new VariableBase Symbol {
+      get { return (VariableBase)base.Symbol; }
+    }
+    [Storable]
+    private double weight;
+    public double Weight {
+      get { return weight; }
+      set { weight = value; }
+    }
+    [Storable]
+    private string variableName;
+    public string VariableName {
+      get { return variableName; }
+      set { variableName = value; }
+    }
+
+    [StorableConstructor]
+    protected VariableTreeNodeBase(StorableConstructorFlag _) : base(_) { }
+    protected VariableTreeNodeBase(VariableTreeNodeBase original, Cloner cloner)
+      : base(original, cloner) {
+      weight = original.weight;
+      variableName = original.variableName;
+    }
+    protected VariableTreeNodeBase() { }
+    protected VariableTreeNodeBase(VariableBase variableSymbol) : base(variableSymbol) { }
+
+    public override bool HasLocalParameters {
+      get { return true; }
+    }
+
+    public override void ResetLocalParameters(IRandom random) {
+      base.ResetLocalParameters(random);
+      weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
+
+#pragma warning disable 612, 618
+      variableName = Symbol.VariableNames.SelectRandom(random);
+#pragma warning restore 612, 618
+    }
+
+    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
+      base.ShakeLocalParameters(random, shakingFactor);
+
+      // 50% additive & 50% multiplicative (TODO: BUG in if statement below -> fix in HL 4.0!)
+      if (random.NextDouble() < 0) {
+        double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
+        weight = weight + x * shakingFactor;
+      } else {
+        double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
+        weight = weight * x;
+      }
+
+      if (Symbol.VariableChangeProbability >= 1.0) {
+        // old behaviour for backwards compatibility
+        #region Backwards compatible code, remove with 3.4
+#pragma warning disable 612, 618
+        variableName = Symbol.VariableNames.SelectRandom(random);
+#pragma warning restore 612, 618
+        #endregion
+      } else if (random.NextDouble() < Symbol.VariableChangeProbability) {
+        var oldName = variableName;
+        variableName = Symbol.VariableNames.SampleRandom(random);
+        if (oldName != variableName) {
+          // re-initialize weight if the variable is changed
+          weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
+        }
+      }
+    }
+
+    public override string ToString() {
+      if (weight.IsAlmost(1.0)) return variableName;
+      else return weight.ToString("E4") + " " + variableName;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Xor.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Xor.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Xor.cs	(revision 17687)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("36A4BD81-EA93-4497-8421-D0C9A0DCB246")]
+  [Item("Xor", "Symbol that represents the boolean XOR operator.")]
+  public sealed class Xor : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = byte.MaxValue;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private Xor(StorableConstructorFlag _) : base(_) { }
+    private Xor(Xor original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Xor(this, cloner);
+    }
+    public Xor() : base("Xor", "Symbol that represents the boolean XOR operator.") { }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Transformations/SymbolicExpressionTreeBacktransformator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Transformations/SymbolicExpressionTreeBacktransformator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Transformations/SymbolicExpressionTreeBacktransformator.cs	(revision 17687)
@@ -0,0 +1,97 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class SymbolicExpressionTreeBacktransformator : IModelBacktransformator {
+    private readonly ITransformationMapper<ISymbolicExpressionTreeNode> transformationMapper;
+
+    public SymbolicExpressionTreeBacktransformator(ITransformationMapper<ISymbolicExpressionTreeNode> transformationMapper) {
+      this.transformationMapper = transformationMapper;
+    }
+
+    public ISymbolicDataAnalysisModel Backtransform(ISymbolicDataAnalysisModel model, IEnumerable<ITransformation> transformations, string targetVariable) {
+      var symbolicModel = (ISymbolicDataAnalysisModel)model.Clone();
+
+      foreach (var transformation in transformations.Reverse()) {
+        ApplyBacktransformation(transformation, symbolicModel.SymbolicExpressionTree, targetVariable);
+      }
+
+      return symbolicModel;
+    }
+
+    private void ApplyBacktransformation(ITransformation transformation, ISymbolicExpressionTree symbolicExpressionTree, string targetVariable) {
+      if (transformation.Column != targetVariable) {
+        var variableNodes = symbolicExpressionTree.IterateNodesBreadth()
+          .OfType<VariableTreeNode>()
+          .Where(n => n.VariableName == transformation.Column);
+        ApplyRegularBacktransformation(transformation, variableNodes);
+      } else if (!(transformation is CopyColumnTransformation)) {
+        ApplyInverseBacktransformation(transformation, symbolicExpressionTree);
+      }
+    }
+
+    private void ApplyRegularBacktransformation(ITransformation transformation, IEnumerable<VariableTreeNode> variableNodes) {
+      foreach (var variableNode in variableNodes) {
+        // generate new subtrees because same subtree cannot be added more than once
+        var transformationTree = transformationMapper.GenerateModel(transformation);
+        SwapVariableWithTree(variableNode, transformationTree);
+      }
+    }
+
+    private void ApplyInverseBacktransformation(ITransformation transformation, ISymbolicExpressionTree symbolicExpressionTree) {
+      var startSymbol = symbolicExpressionTree.Root.GetSubtree(0);
+      var modelTree = startSymbol.GetSubtree(0);
+      startSymbol.RemoveSubtree(0);
+
+      var transformationTree = transformationMapper.GenerateInverseModel(transformation);
+      var variableNode = transformationTree.IterateNodesBreadth()
+        .OfType<VariableTreeNode>()
+        .Single(n => n.VariableName == transformation.Column);
+
+      SwapVariableWithTree(variableNode, modelTree);
+
+      startSymbol.AddSubtree(transformationTree);
+    }
+
+    private void SwapVariableWithTree(VariableTreeNode variableNode, ISymbolicExpressionTreeNode treeNode) {
+      var parent = variableNode.Parent;
+      int index = parent.IndexOfSubtree(variableNode);
+      parent.RemoveSubtree(index);
+
+      if (!variableNode.Weight.IsAlmost(1.0))
+        treeNode = CreateNodeFromWeight(treeNode, variableNode);
+
+      parent.InsertSubtree(index, treeNode);
+    }
+
+    private ISymbolicExpressionTreeNode CreateNodeFromWeight(ISymbolicExpressionTreeNode transformationTree, VariableTreeNode variableNode) {
+      var multiplicationNode = new SymbolicExpressionTreeNode(new Multiplication());
+      multiplicationNode.AddSubtree(new ConstantTreeNode(new Constant()) { Value = variableNode.Weight });
+      multiplicationNode.AddSubtree(transformationTree);
+      return multiplicationNode;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Transformations/TransformationToSymbolicTreeMapper.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Transformations/TransformationToSymbolicTreeMapper.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Transformations/TransformationToSymbolicTreeMapper.cs	(revision 17687)
@@ -0,0 +1,294 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class TransformationToSymbolicTreeMapper : ITransformationMapper<ISymbolicExpressionTreeNode> {
+    private ITransformation transformation;
+    private string column;
+
+    #region ITransformationMapper<ISymbolicExpressionTree> Members
+
+    public ISymbolicExpressionTreeNode GenerateModel(ITransformation transformation) {
+      InitComponents(transformation);
+
+      if (transformation is LinearTransformation) {
+        return GenerateModelForLinearTransformation();
+      } else if (transformation is ExponentialTransformation) {
+        return GenerateModelForExponentialTransformation();
+      } else if (transformation is LogarithmicTransformation) {
+        return GenerateModelForLogarithmicTransformation();
+      } else if (transformation is PowerTransformation) {
+        return GenerateModelForPowerTransformation();
+      } else if (transformation is ReciprocalTransformation) {
+        return GenerateModelForReciprocalTransformation();
+      } else if (transformation is ShiftStandardDistributionTransformation) {
+        return GenerateModelForShiftStandardDistributionTransformation();
+      } else if (transformation is CopyColumnTransformation) {
+        return GenerateTreeNodeForCopyColumnTransformation();
+      }
+      throw new NotImplementedException();
+    }
+
+    public ISymbolicExpressionTreeNode GenerateInverseModel(ITransformation transformation) {
+      InitComponents(transformation);
+
+      if (transformation is LinearTransformation) {
+        return GenerateInverseModelForLinearTransformation();
+      } else if (transformation is ExponentialTransformation) {
+        return GenerateInverseModelForExponentialTransformation();
+      } else if (transformation is LogarithmicTransformation) {
+        return GenerateInverseModelForLogarithmicTransformation();
+      } else if (transformation is PowerTransformation) {
+        return GenerateInverseModelForPowerTransformation();
+      } else if (transformation is ReciprocalTransformation) {
+        return GenerateInverseModelForReciprocalTransformation();
+      } else if (transformation is ShiftStandardDistributionTransformation) {
+        GenerateInverseModelForShiftStandardDistributionTransformation();
+      } else if (transformation is CopyColumnTransformation) {
+        return GenerateTreeNodeForCopyColumnTransformation();
+      }
+
+      throw new NotImplementedException();
+    }
+
+    #endregion
+
+    // helper
+
+    private ISymbolicExpressionTreeNode GenerateModelForLinearTransformation() {
+      var linearTransformation = (LinearTransformation)transformation;
+      var kValue = linearTransformation.Multiplier;
+      var dValue = linearTransformation.Addend;
+
+      // k * x
+      var multiplicationNode = new Multiplication().CreateTreeNode();
+      var kNode = CreateConstantTreeNode("k", kValue);
+      var xNode = CreateVariableTreeNode(column, "x");
+      multiplicationNode.AddSubtree(kNode);
+      multiplicationNode.AddSubtree(xNode);
+
+      // ( k * x ) + d
+      var additionNode = new Addition().CreateTreeNode();
+      var dNode = CreateConstantTreeNode("d", dValue);
+      additionNode.AddSubtree(multiplicationNode);
+      additionNode.AddSubtree(dNode);
+
+      return additionNode;
+    }
+
+    private ISymbolicExpressionTreeNode GenerateInverseModelForLinearTransformation() {
+      var linearTransformation = (LinearTransformation)transformation;
+      var kValue = linearTransformation.Multiplier;
+      var dValue = linearTransformation.Addend;
+
+      // x - d
+      var substractionNode = new Subtraction().CreateTreeNode();
+      var dNode = CreateConstantTreeNode("d", dValue);
+      var xNode = CreateVariableTreeNode(column, "x");
+      substractionNode.AddSubtree(xNode);
+      substractionNode.AddSubtree(dNode);
+
+      // ( x - d ) / k
+      var divisionNode = new Division().CreateTreeNode();
+      var kNode = CreateConstantTreeNode("k", kValue);
+      divisionNode.AddSubtree(substractionNode);
+      divisionNode.AddSubtree(kNode);
+
+      return divisionNode;
+    }
+
+
+    private ISymbolicExpressionTreeNode GenerateModelForExponentialTransformation() {
+      var exponentialTransformation = (ExponentialTransformation)transformation;
+      var bValue = exponentialTransformation.Base;
+
+      return GenTreePow_b_x(bValue);
+    }
+
+    private ISymbolicExpressionTreeNode GenerateInverseModelForExponentialTransformation() {
+      var exponentialTransformation = (ExponentialTransformation)transformation;
+      var bValue = exponentialTransformation.Base;
+
+      return GenTreeLog_x_b(bValue);
+    }
+
+
+    private ISymbolicExpressionTreeNode GenerateModelForLogarithmicTransformation() {
+      var logarithmicTransformation = (LogarithmicTransformation)transformation;
+      var bValue = logarithmicTransformation.Base;
+
+      return GenTreeLog_x_b(bValue);
+    }
+
+    private ISymbolicExpressionTreeNode GenerateInverseModelForLogarithmicTransformation() {
+      var logarithmicTransformation = (LogarithmicTransformation)transformation;
+      var bValue = logarithmicTransformation.Base;
+
+      return GenTreePow_b_x(bValue);
+    }
+
+
+    private ISymbolicExpressionTreeNode GenerateModelForPowerTransformation() {
+      var powerTransformation = (PowerTransformation)transformation;
+      var expValue = powerTransformation.Exponent;
+
+      // x ^ exp
+      var powerNode = new Power().CreateTreeNode();
+      var xNode = CreateVariableTreeNode(column, "x");
+      var expNode = CreateConstantTreeNode("exp", expValue);
+      powerNode.AddSubtree(xNode);
+      powerNode.AddSubtree(expNode);
+
+      return powerNode;
+    }
+
+    private ISymbolicExpressionTreeNode GenerateInverseModelForPowerTransformation() {
+      var powerTransformation = (PowerTransformation)transformation;
+      var expValue = powerTransformation.Exponent;
+
+      // rt(x, b)
+      var rootNode = new Root().CreateTreeNode();
+      var xNode = CreateVariableTreeNode(column, "x");
+      var bNode = CreateConstantTreeNode("b", expValue);
+      rootNode.AddSubtree(xNode);
+      rootNode.AddSubtree(bNode);
+
+      return rootNode;
+    }
+
+
+    private ISymbolicExpressionTreeNode GenerateModelForReciprocalTransformation() {
+      return GenTreeDiv_1_x();
+    }
+
+    private ISymbolicExpressionTreeNode GenerateInverseModelForReciprocalTransformation() {
+      return GenTreeDiv_1_x();
+    }
+
+
+    private ISymbolicExpressionTreeNode GenerateModelForShiftStandardDistributionTransformation() {
+      var shiftStandardDistributionTransformation = (ShiftStandardDistributionTransformation)transformation;
+      var m_orgValue = shiftStandardDistributionTransformation.OriginalMean;
+      var s_orgValue = shiftStandardDistributionTransformation.OriginalStandardDeviation;
+      var m_tarValue = shiftStandardDistributionTransformation.Mean;
+      var s_tarValue = shiftStandardDistributionTransformation.StandardDeviation;
+
+      return GenTreeShiftStdDist(column, m_orgValue, s_orgValue, m_tarValue, s_tarValue);
+    }
+
+    private ISymbolicExpressionTreeNode GenerateInverseModelForShiftStandardDistributionTransformation() {
+      var shiftStandardDistributionTransformation = (ShiftStandardDistributionTransformation)transformation;
+      var m_orgValue = shiftStandardDistributionTransformation.OriginalMean;
+      var s_orgValue = shiftStandardDistributionTransformation.OriginalStandardDeviation;
+      var m_tarValue = shiftStandardDistributionTransformation.Mean;
+      var s_tarValue = shiftStandardDistributionTransformation.StandardDeviation;
+
+      return GenTreeShiftStdDist(column, m_tarValue, s_tarValue, m_orgValue, s_orgValue);
+    }
+
+    private ISymbolicExpressionTreeNode GenerateTreeNodeForCopyColumnTransformation() {
+      var copyColumnTransformation = (CopyColumnTransformation)transformation;
+      var copiedColumnName = copyColumnTransformation.CopiedColumnName;
+
+      return CreateVariableTreeNode(copiedColumnName, copiedColumnName + "(original)");
+    }
+
+    // helper's helper:
+
+    private ISymbolicExpressionTreeNode GenTreeLog_x_b(double b) {
+      // log(x, b)
+      var logNode = new Logarithm().CreateTreeNode();
+      var bNode = CreateConstantTreeNode("b", b);
+      var xNode = CreateVariableTreeNode(column, "x");
+      logNode.AddSubtree(xNode);
+      logNode.AddSubtree(bNode);
+
+      return logNode;
+    }
+
+    private ISymbolicExpressionTreeNode GenTreePow_b_x(double b) {
+      // b ^ x
+      var powerNode = new Power().CreateTreeNode();
+      var bNode = CreateConstantTreeNode("b", b);
+      var xNode = CreateVariableTreeNode(column, "x");
+      powerNode.AddSubtree(bNode);
+      powerNode.AddSubtree(xNode);
+
+      return powerNode;
+    }
+
+    private ISymbolicExpressionTreeNode GenTreeDiv_1_x() {
+      // 1 / x
+      var divNode = new Division().CreateTreeNode();
+      var oneNode = CreateConstantTreeNode("1", 1.0);
+      var xNode = CreateVariableTreeNode(column, "x");
+      divNode.AddSubtree(oneNode);
+      divNode.AddSubtree(xNode);
+
+      return divNode;
+    }
+
+    private ISymbolicExpressionTreeNode GenTreeShiftStdDist(string variable, double m_org, double s_org, double m_tar, double s_tar) {
+      // x - m_org
+      var substractionNode = new Subtraction().CreateTreeNode();
+      var xNode = CreateVariableTreeNode(variable, "x");
+      var m_orgNode = CreateConstantTreeNode("m_org", m_org);
+      substractionNode.AddSubtree(xNode);
+      substractionNode.AddSubtree(m_orgNode);
+
+      // (x - m_org) / s_org
+      var divisionNode = new Division().CreateTreeNode();
+      var s_orgNode = CreateConstantTreeNode("s_org", s_org);
+      divisionNode.AddSubtree(substractionNode);
+      divisionNode.AddSubtree(s_orgNode);
+
+      // ((x - m_org) / s_org ) * s_tar
+      var multiplicationNode = new Multiplication().CreateTreeNode();
+      var s_tarNode = CreateConstantTreeNode("s_tar", s_tar);
+      multiplicationNode.AddSubtree(divisionNode);
+      multiplicationNode.AddSubtree(s_tarNode);
+
+      // ((x - m_org) / s_org ) * s_tar + m_tar
+      var additionNode = new Addition().CreateTreeNode();
+      var m_tarNode = CreateConstantTreeNode("m_tar", m_tar);
+      additionNode.AddSubtree(multiplicationNode);
+      additionNode.AddSubtree(m_tarNode);
+
+      return additionNode;
+    }
+
+    private ConstantTreeNode CreateConstantTreeNode(string description, double value) {
+      return new ConstantTreeNode(new Constant()) { Value = value };
+    }
+
+    private VariableTreeNode CreateVariableTreeNode(string name, string description) {
+      return new VariableTreeNode(new Variable(name, description)) { VariableName = name, Weight = 1.0 };
+    }
+
+    private void InitComponents(ITransformation transformation) {
+      this.transformation = transformation;
+      column = transformation.Column;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs	(revision 17687)
@@ -0,0 +1,241 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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.Globalization;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization.Operators;
+using HEAL.Attic;
+
+using NodeMap = System.Collections.Generic.Dictionary<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTreeNode, HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTreeNode>;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("63ACB7A4-137F-468F-BE42-A4CA6B62C63B")]
+  [Item("SymbolicExpressionTreeBottomUpSimilarityCalculator", "A similarity calculator which uses the tree bottom-up distance as a similarity metric.")]
+  public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SolutionSimilarityCalculator {
+    private readonly HashSet<string> commutativeSymbols = new HashSet<string> { "Addition", "Multiplication", "Average", "And", "Or", "Xor" };
+
+    public SymbolicExpressionTreeBottomUpSimilarityCalculator() { }
+    protected override bool IsCommutative { get { return true; } }
+
+    public bool MatchConstantValues { get; set; }
+    public bool MatchVariableWeights { get; set; }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeBottomUpSimilarityCalculator(StorableConstructorFlag _) : base(_) {
+    }
+
+    protected SymbolicExpressionTreeBottomUpSimilarityCalculator(SymbolicExpressionTreeBottomUpSimilarityCalculator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeBottomUpSimilarityCalculator(this, cloner);
+    }
+
+    #region static methods
+    private static ISymbolicExpressionTreeNode ActualRoot(ISymbolicExpressionTree tree) {
+      return tree.Root.GetSubtree(0).GetSubtree(0);
+    }
+
+    public static double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, bool strict = false) {
+      return CalculateSimilarity(ActualRoot(t1), ActualRoot(t2), strict);
+    }
+
+    public static double CalculateSimilarity(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) {
+      var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchConstantValues = strict, MatchVariableWeights = strict };
+      return CalculateSimilarity(n1, n2, strict);
+    }
+
+    public static Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, bool strict = false) {
+      return ComputeBottomUpMapping(ActualRoot(t1), ActualRoot(t2), strict);
+    }
+
+    public static Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2, bool strict = false) {
+      var calculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchConstantValues = strict, MatchVariableWeights = strict };
+      return calculator.ComputeBottomUpMapping(n1, n2);
+    }
+    #endregion
+
+    public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
+      return CalculateSimilarity(t1, t2, out Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> map);
+    }
+
+    public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, out NodeMap map) {
+      if (t1 == t2) {
+        map = null;
+        return 1;
+      }
+      map = ComputeBottomUpMapping(t1, t2);
+      return 2.0 * map.Count / (t1.Length + t2.Length - 4); // -4 for skipping root and start symbols in the two trees
+    }
+
+    public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
+      if (leftSolution == rightSolution)
+        return 1.0;
+
+      var t1 = leftSolution.Variables[SolutionVariableName].Value as ISymbolicExpressionTree;
+      var t2 = rightSolution.Variables[SolutionVariableName].Value as ISymbolicExpressionTree;
+
+      if (t1 == null || t2 == null)
+        throw new ArgumentException("Cannot calculate similarity when one of the arguments is null.");
+
+      var similarity = CalculateSimilarity(t1, t2);
+      if (similarity > 1.0)
+        throw new Exception("Similarity value cannot be greater than 1");
+
+      return similarity;
+    }
+
+    public Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> ComputeBottomUpMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
+      return ComputeBottomUpMapping(ActualRoot(t1), ActualRoot(t2));
+    }
+
+    public Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> ComputeBottomUpMapping(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2) {
+      var compactedGraph = Compact(n1, n2);
+
+      IEnumerable<ISymbolicExpressionTreeNode> Subtrees(ISymbolicExpressionTreeNode node, bool commutative) {
+        var subtrees = node.IterateNodesPrefix();
+        return commutative ? subtrees.OrderBy(x => compactedGraph[x].Hash) : subtrees;
+      }
+
+      var nodes1 = n1.IterateNodesPostfix().OrderByDescending(x => x.GetLength()); // by descending length so that largest subtrees are mapped first
+      var nodes2 = (List<ISymbolicExpressionTreeNode>)n2.IterateNodesPostfix();
+
+      var forward = new NodeMap();
+      var reverse = new NodeMap();
+
+      foreach (ISymbolicExpressionTreeNode v in nodes1) {
+        if (forward.ContainsKey(v))
+          continue;
+
+        var kv = compactedGraph[v];
+        var commutative = v.SubtreeCount > 1 && commutativeSymbols.Contains(kv.Label);
+
+        foreach (ISymbolicExpressionTreeNode w in nodes2) {
+          if (w.GetLength() != kv.Length || w.GetDepth() != kv.Depth || reverse.ContainsKey(w) || compactedGraph[w] != kv)
+            continue;
+
+          // map one whole subtree to the other
+          foreach (var t in Subtrees(v, commutative).Zip(Subtrees(w, commutative), Tuple.Create)) {
+            forward[t.Item1] = t.Item2;
+            reverse[t.Item2] = t.Item1;
+          }
+
+          break;
+        }
+      }
+
+      return forward;
+    }
+
+    /// <summary>
+    /// Creates a compact representation of the two trees as a directed acyclic graph
+    /// </summary>
+    /// <param name="n1">The root of the first tree</param>
+    /// <param name="n2">The root of the second tree</param>
+    /// <returns>The compacted DAG representing the two trees</returns>
+    private Dictionary<ISymbolicExpressionTreeNode, GraphNode> Compact(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2) {
+      var nodeMap = new Dictionary<ISymbolicExpressionTreeNode, GraphNode>(); // K
+      var labelMap = new Dictionary<string, GraphNode>(); // L
+
+      var nodes = n1.IterateNodesPostfix().Concat(n2.IterateNodesPostfix()); // the disjoint union F
+      var graph = new List<GraphNode>();
+
+      IEnumerable<GraphNode> Subtrees(GraphNode g, bool commutative) {
+        var subtrees = g.SymbolicExpressionTreeNode.Subtrees.Select(x => nodeMap[x]);
+        return commutative ? subtrees.OrderBy(x => x.Hash) : subtrees;
+      }
+
+      foreach (var node in nodes) {
+        var label = GetLabel(node);
+
+        if (node.SubtreeCount == 0) {
+          if (!labelMap.ContainsKey(label)) {
+            labelMap[label] = new GraphNode(node, label);
+          }
+          nodeMap[node] = labelMap[label];
+        } else {
+          var v = new GraphNode(node, label);
+          bool found = false;
+          var commutative = node.SubtreeCount > 1 && commutativeSymbols.Contains(label);
+
+          var vv = Subtrees(v, commutative);
+
+          foreach (var w in graph) {
+            if (v.Depth != w.Depth || v.SubtreeCount != w.SubtreeCount || v.Length != w.Length || v.Label != w.Label) {
+              continue;
+            }
+
+            var ww = Subtrees(w, commutative);
+            found = vv.SequenceEqual(ww);
+
+            if (found) {
+              nodeMap[node] = w;
+              break;
+            }
+          }
+          if (!found) {
+            nodeMap[node] = v;
+            graph.Add(v);
+          }
+        }
+      }
+      return nodeMap;
+    }
+
+    private string GetLabel(ISymbolicExpressionTreeNode node) {
+      if (node.SubtreeCount > 0)
+        return node.Symbol.Name;
+
+      if (node is ConstantTreeNode constant)
+        return MatchConstantValues ? constant.Value.ToString(CultureInfo.InvariantCulture) : constant.Symbol.Name;
+
+      if (node is VariableTreeNode variable)
+        return MatchVariableWeights ? variable.Weight + variable.VariableName : variable.VariableName;
+
+      return node.ToString();
+    }
+
+    private class GraphNode {
+      private GraphNode() { }
+
+      public GraphNode(ISymbolicExpressionTreeNode node, string label) {
+        SymbolicExpressionTreeNode = node;
+        Label = label;
+        Hash = GetHashCode();
+        Depth = node.GetDepth();
+        Length = node.GetLength();
+      }
+
+      public int Hash { get; }
+      public ISymbolicExpressionTreeNode SymbolicExpressionTreeNode { get; }
+      public string Label { get; }
+      public int Depth { get; }
+      public int SubtreeCount { get { return SymbolicExpressionTreeNode.SubtreeCount; } }
+      public int Length { get; }
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeCanonicalSorter.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeCanonicalSorter.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeCanonicalSorter.cs	(revision 17687)
@@ -0,0 +1,30 @@
+﻿
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public class SymbolicExpressionTreeCanonicalSorter {
+    private readonly HashSet<Type> nonSymmetricSymbols = new HashSet<Type> { typeof(Subtraction), typeof(Division) };
+
+    public void SortSubtrees(ISymbolicExpressionTree tree) {
+      SortSubtrees(tree.Root);
+    }
+
+    public void SortSubtrees(ISymbolicExpressionTreeNode node) {
+      if (node.SubtreeCount == 0) return;
+      var subtrees = node.Subtrees as List<ISymbolicExpressionTreeNode> ?? node.Subtrees.ToList();
+      if (IsSymmetric(node.Symbol)) {
+        var comparer = new SymbolicExpressionTreeNodeComparer();
+        subtrees.Sort(comparer);
+      }
+      foreach (var s in subtrees)
+        SortSubtrees(s);
+    }
+
+    private bool IsSymmetric(ISymbol s) {
+      return !nonSymmetricSymbols.Contains(s.GetType());
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeEqualityComparer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeEqualityComparer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeEqualityComparer.cs	(revision 17687)
@@ -0,0 +1,27 @@
+﻿using System;
+using System.Collections.Generic;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("535830d4-551e-4b53-97e3-9605bd7e785f")]
+  public class SymbolicExpressionTreeEqualityComparer : IEqualityComparer<ISymbolicExpressionTree> {
+    [Storable]
+    public SymbolicExpressionTreeNodeEqualityComparer SimilarityComparer { get; set; }
+
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeEqualityComparer(StorableConstructorFlag _) { }
+    public SymbolicExpressionTreeEqualityComparer() { }
+
+    public bool Equals(ISymbolicExpressionTree a, ISymbolicExpressionTree b) {
+      if (SimilarityComparer == null) throw new Exception("SimilarityComparer needs to be initialized first.");
+      return a.Length == b.Length && SymbolicExpressionTreeMatching.Match(a.Root, b.Root, SimilarityComparer) == Math.Min(a.Length, b.Length);
+    }
+
+    public int GetHashCode(ISymbolicExpressionTree tree) {
+      return (tree.Length << 8) % 12345;
+    }
+
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMatching.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMatching.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMatching.cs	(revision 17687)
@@ -0,0 +1,125 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+//using HeuristicLab.EvolutionTracking;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  public static class SymbolicExpressionTreeMatching {
+    public static bool ContainsSubtree(this ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, SymbolicExpressionTreeNodeEqualityComparer comparer) {
+      return FindMatches(root, subtree, comparer).Any();
+    }
+    public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode subtree, SymbolicExpressionTreeNodeEqualityComparer comparer) {
+      return FindMatches(tree.Root, subtree, comparer);
+    }
+
+    public static IEnumerable<ISymbolicExpressionTreeNode> FindMatches(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode subtree, SymbolicExpressionTreeNodeEqualityComparer comp) {
+      var fragmentLength = subtree.GetLength();
+      // below, we use ">=" for Match(n, subtree, comp) >= fragmentLength because in case of relaxed conditions, 
+      // we can have multiple matches of the same node
+
+      return root.IterateNodesBreadth().Where(n => n.GetLength() >= fragmentLength && Match(n, subtree, comp) == fragmentLength);
+    }
+
+    ///<summary>
+    /// Finds the longest common subsequence in quadratic time and linear space
+    /// Variant of:
+    /// D. S. Hirschberg. A linear space algorithm for or computing maximal common subsequences. 1975.
+    /// http://dl.acm.org/citation.cfm?id=360861
+    /// </summary>
+    /// <returns>Number of pairs that were matched</returns>
+    public static int Match(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, ISymbolicExpressionTreeNodeSimilarityComparer comp) {
+      if (!comp.Equals(a, b)) return 0;
+      int m = a.SubtreeCount;
+      int n = b.SubtreeCount;
+      if (m == 0 || n == 0) return 1;
+      var matrix = new int[m + 1, n + 1];
+      for (int i = 1; i <= m; ++i) {
+        var ai = a.GetSubtree(i - 1);
+        for (int j = 1; j <= n; ++j) {
+          var bj = b.GetSubtree(j - 1);
+          int match = Match(ai, bj, comp);
+          matrix[i, j] = Math.Max(Math.Max(matrix[i, j - 1], matrix[i - 1, j]), matrix[i - 1, j - 1] + match);
+        }
+      }
+      return matrix[m, n] + 1;
+    }
+
+    /// <summary>
+    /// Calculates the difference between two symbolic expression trees.
+    /// </summary>
+    /// <param name="tree">The first symbolic expression tree</param>
+    /// <param name="other">The second symbolic expression tree</param>
+    /// <returns>Returns the root of the subtree (from T1) by which T1 differs from T2, or null if no difference is found.</returns>
+    public static ISymbolicExpressionTreeNode Difference(this ISymbolicExpressionTree tree, ISymbolicExpressionTree other) {
+      return Difference(tree.Root, other.Root);
+    }
+
+    public static ISymbolicExpressionTreeNode Difference(this ISymbolicExpressionTreeNode node, ISymbolicExpressionTreeNode other) {
+      var a = node.IterateNodesPrefix().ToList();
+      var b = other.IterateNodesPrefix().ToList();
+      var list = new List<ISymbolicExpressionTreeNode>();
+      for (int i = 0, j = 0; i < a.Count && j < b.Count; ++i, ++j) {
+        var s1 = a[i].ToString();
+        var s2 = b[j].ToString();
+        if (s1 == s2) continue;
+        list.Add(a[i]);
+        // skip subtrees since the parents are already different
+        i += a[i].SubtreeCount;
+        j += b[j].SubtreeCount;
+      }
+      ISymbolicExpressionTreeNode result = list.Count > 0 ? LowestCommonAncestor(node, list) : null;
+      return result;
+    }
+
+    private static ISymbolicExpressionTreeNode LowestCommonAncestor(ISymbolicExpressionTreeNode root, List<ISymbolicExpressionTreeNode> nodes) {
+      if (nodes.Count == 0)
+        throw new ArgumentException("The nodes list should contain at least one element.");
+
+      if (nodes.Count == 1)
+        return nodes[0];
+
+      int minLevel = nodes.Min(x => root.GetBranchLevel(x));
+
+      // bring the nodes in the nodes to the same level (relative to the root)
+      for (int i = 0; i < nodes.Count; ++i) {
+        var node = nodes[i];
+        var level = root.GetBranchLevel(node);
+        for (int j = minLevel; j < level; ++j)
+          node = node.Parent;
+        nodes[i] = node;
+      }
+
+      // while not all the elements in the nodes are equal, go one level up
+      while (nodes.Any(x => x != nodes[0])) {
+        for (int i = 0; i < nodes.Count; ++i)
+          nodes[i] = nodes[i].Parent;
+      }
+
+      return nodes[0];
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator.cs	(revision 17687)
@@ -0,0 +1,107 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization.Operators;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("2634824A-D8E6-4047-9146-79EDF50BEED8")]
+  [Item("SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator", "A similarity calculator based on the size of the maximum common subtree between two trees")]
+  public class SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator : SolutionSimilarityCalculator {
+    [Storable]
+    private readonly SymbolicExpressionTreeNodeEqualityComparer comparer;
+    public bool MatchVariableWeights {
+      get { return comparer.MatchVariableWeights; }
+      set { comparer.MatchVariableWeights = value; }
+    }
+
+    public bool MatchConstantValues {
+      get { return comparer.MatchConstantValues; }
+      set { comparer.MatchConstantValues = value; }
+    }
+
+    protected override bool IsCommutative { get { return true; } }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator(StorableConstructorFlag _) : base(_) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator(this, cloner);
+    }
+
+    protected SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator(SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator original, Cloner cloner)
+      : base(original, cloner) {
+      comparer = cloner.Clone(original.comparer);
+    }
+
+    public SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator() {
+      comparer = new SymbolicExpressionTreeNodeEqualityComparer {
+        MatchConstantValues = true,
+        MatchVariableNames = true,
+        MatchVariableWeights = true
+      };
+    }
+
+    public SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculator(bool matchVariableWeights, bool matchConstantValues) {
+      comparer = new SymbolicExpressionTreeNodeEqualityComparer {
+        MatchConstantValues = matchConstantValues,
+        MatchVariableNames = true,
+        MatchVariableWeights = matchVariableWeights
+      };
+    }
+
+    public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
+      return MaxCommonSubtreeSimilarity(t1, t2, comparer);
+    }
+
+    public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
+      var t1 = leftSolution.Variables[SolutionVariableName].Value as ISymbolicExpressionTree;
+      var t2 = rightSolution.Variables[SolutionVariableName].Value as ISymbolicExpressionTree;
+
+      if (t1 == null || t2 == null)
+        throw new ArgumentException("Cannot calculate similarity when one of the arguments is null.");
+
+      return MaxCommonSubtreeSimilarity(t1, t2, comparer);
+    }
+
+    public static double MaxCommonSubtreeSimilarity(ISymbolicExpressionTree a, ISymbolicExpressionTree b, ISymbolicExpressionTreeNodeSimilarityComparer comparer) {
+      int max = 0;
+      var rootA = a.Root.GetSubtree(0).GetSubtree(0);
+      var rootB = b.Root.GetSubtree(0).GetSubtree(0);
+      foreach (var aa in rootA.IterateNodesBreadth()) {
+        int lenA = aa.GetLength();
+        if (lenA <= max) continue;
+        foreach (var bb in rootB.IterateNodesBreadth()) {
+          int lenB = bb.GetLength();
+          if (lenB <= max) continue;
+          int matches = SymbolicExpressionTreeMatching.Match(aa, bb, comparer);
+          if (max < matches)
+            max = matches;
+        }
+      }
+      return 2.0 * max / (rootA.GetLength() + rootB.GetLength());
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeComparer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeComparer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeComparer.cs	(revision 17687)
@@ -0,0 +1,74 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableType("eabf848e-d10c-499e-8c48-c771232ede0e")]
+  // this comparer considers that a < b if the type of a is "greater" than the type of b, for example:
+  // - A function node is "greater" than a terminal node
+  // - A variable terminal is "greater" than a constant terminal
+  // - used for bringing subtrees to a "canonical" form when the operation allows reordering of arguments
+  public class SymbolicExpressionTreeNodeComparer : ISymbolicExpressionTreeNodeComparer {
+    public static int CompareNodes(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      var ta = a as SymbolicExpressionTreeTerminalNode;
+      var tb = b as SymbolicExpressionTreeTerminalNode;
+
+      if (ta == null)
+        return tb == null ? String.CompareOrdinal(a.Symbol.Name, b.Symbol.Name) : -1;
+
+      if (tb == null)
+        return 1;
+
+      // at this point we know a and b are both terminals
+      var va = a as VariableTreeNode;
+      var vb = b as VariableTreeNode;
+
+      if (va != null)
+        return vb == null ? -1 : CompareVariables(va, vb);
+
+      if (vb != null)
+        return 1;
+
+      // at this point we know a and b are not variables
+      var ca = a as ConstantTreeNode;
+      var cb = b as ConstantTreeNode;
+
+      if (ca != null && cb != null)
+        return ca.Value.CompareTo(cb.Value);
+
+      // for other unknown terminal types, compare strings
+      return string.CompareOrdinal(a.ToString(), b.ToString());
+    }
+
+    private static int CompareVariables(VariableTreeNode a, VariableTreeNode b) {
+      int result = string.CompareOrdinal(a.VariableName, b.VariableName);
+      return result == 0 ? a.Weight.CompareTo(b.Weight) : result;
+    }
+
+    public int Compare(ISymbolicExpressionTreeNode x, ISymbolicExpressionTreeNode y) {
+      return CompareNodes(x, y);
+    }
+  }
+
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeEqualityComparer.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeEqualityComparer.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeEqualityComparer.cs	(revision 17687)
@@ -0,0 +1,97 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SymbolicExpressionTreeNodeEqualityComparer", "An operator that checks node equality based on different similarity measures.")]
+  [StorableType("F5BC06AA-3F08-4692-93E8-E44CE8205A46")]
+  public class SymbolicExpressionTreeNodeEqualityComparer : Item, ISymbolicExpressionTreeNodeSimilarityComparer {
+    [StorableConstructor]
+    protected SymbolicExpressionTreeNodeEqualityComparer(StorableConstructorFlag _) : base(_) { }
+    protected SymbolicExpressionTreeNodeEqualityComparer(SymbolicExpressionTreeNodeEqualityComparer original, Cloner cloner)
+      : base(original, cloner) {
+      matchConstantValues = original.matchConstantValues;
+      matchVariableNames = original.matchVariableNames;
+      matchVariableWeights = original.matchVariableWeights;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicExpressionTreeNodeEqualityComparer(this, cloner); }
+
+    // more flexible matching criteria 
+    [Storable]
+    private bool matchConstantValues;
+    public bool MatchConstantValues {
+      get { return matchConstantValues; }
+      set { matchConstantValues = value; }
+    }
+
+    [Storable]
+    private bool matchVariableNames;
+    public bool MatchVariableNames {
+      get { return matchVariableNames; }
+      set { matchVariableNames = value; }
+    }
+
+    [Storable]
+    private bool matchVariableWeights;
+    public bool MatchVariableWeights {
+      get { return matchVariableWeights; }
+      set { matchVariableWeights = value; }
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+    }
+
+    public SymbolicExpressionTreeNodeEqualityComparer() {
+      matchConstantValues = true;
+      matchVariableNames = true;
+      matchVariableWeights = true;
+    }
+
+    public int GetHashCode(ISymbolicExpressionTreeNode n) {
+      return n.ToString().ToLower().GetHashCode();
+    }
+
+    public bool Equals(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b) {
+      if (!(a is SymbolicExpressionTreeTerminalNode))
+        // if a and b are non terminal nodes, check equality of symbol names
+        return !(b is SymbolicExpressionTreeTerminalNode) && a.Symbol.Name.Equals(b.Symbol.Name);
+      var va = a as VariableTreeNode;
+      if (va != null) {
+        var vb = b as VariableTreeNode;
+        if (vb == null) return false;
+
+        return (!MatchVariableNames || va.VariableName.Equals(vb.VariableName)) && (!MatchVariableWeights || va.Weight.Equals(vb.Weight));
+      }
+      var ca = a as ConstantTreeNode;
+      if (ca != null) {
+        var cb = b as ConstantTreeNode;
+        if (cb == null) return false;
+        return (!MatchConstantValues || ca.Value.Equals(cb.Value));
+      }
+      return false;
+    }
+  }
+}
Index: /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs
===================================================================
--- /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs	(revision 17687)
+++ /branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs	(revision 17687)
@@ -0,0 +1,101 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization.Operators;
+using HEAL.Attic;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [Item("SymbolicExpressionTreePhenotypicSimilarityCalculator", "An operator that calculates the similarity betweeon two trees based on the correlation of their outputs.")]
+  [StorableType("163CE915-506E-472B-B77F-156ECC9D9C05")]
+  public class SymbolicExpressionTreePhenotypicSimilarityCalculator : SolutionSimilarityCalculator {
+    [Storable]
+    public IDataAnalysisProblemData ProblemData { get; set; }
+    [Storable]
+    public ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get; set; }
+
+    protected override bool IsCommutative { get { return true; } }
+
+    [StorableConstructor]
+    protected SymbolicExpressionTreePhenotypicSimilarityCalculator(StorableConstructorFlag _) : base(_) { }
+
+    public SymbolicExpressionTreePhenotypicSimilarityCalculator(SymbolicExpressionTreePhenotypicSimilarityCalculator original, Cloner cloner)
+      : base(original, cloner) {
+      this.ProblemData = cloner.Clone(original.ProblemData);
+      this.Interpreter = cloner.Clone(original.Interpreter);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreePhenotypicSimilarityCalculator(this, cloner);
+    }
+
+    public SymbolicExpressionTreePhenotypicSimilarityCalculator() { }
+
+    public double CalculateSimilarity(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
+      if (Interpreter == null || ProblemData == null)
+        throw new InvalidOperationException("Cannot calculate phenotypic similarity when no interpreter or problem data were set.");
+
+      var v1 = Interpreter.GetSymbolicExpressionTreeValues(t1, ProblemData.Dataset, ProblemData.TrainingIndices);
+      var v2 = Interpreter.GetSymbolicExpressionTreeValues(t2, ProblemData.Dataset, ProblemData.TrainingIndices);
+
+      if (v1.Variance().IsAlmost(0) && v2.Variance().IsAlmost(0))
+        return 1.0;
+
+      OnlineCalculatorError error;
+      var r = OnlinePearsonsRCalculator.Calculate(v1, v2, out error);
+
+      var r2 = error == OnlineCalculatorError.None ? r * r : 0;
+
+      if (r2 > 1.0)
+        r2 = 1.0;
+
+      return r2;
+    }
+
+    public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
+      if (leftSolution == rightSolution)
+        return 1.0;
+
+      if (!leftSolution.Variables.ContainsKey("EstimatedValues") || !rightSolution.Variables.ContainsKey("EstimatedValues"))
+        throw new ArgumentException("No estimated values are present in the subscopes.");
+
+      var leftValues = (DoubleArray)leftSolution.Variables["EstimatedValues"].Value;
+      var rightValues = (DoubleArray)rightSolution.Variables["EstimatedValues"].Value;
+
+      if (leftValues.Variance().IsAlmost(0) && rightValues.Variance().IsAlmost(0))
+        return 1.0;
+
+      OnlineCalculatorError error;
+      var r = OnlinePearsonsRCalculator.Calculate(leftValues, rightValues, out error);
+
+      var r2 = error == OnlineCalculatorError.None ? r * r : 0;
+
+      if (r2 > 1.0)
+        r2 = 1.0;
+
+      return r2;
+    }
+  }
+}
Index: anches/1837_Sliding Window GP/PreBuildEvent.cmd
===================================================================
--- /branches/1837_Sliding Window GP/PreBuildEvent.cmd	(revision 17686)
+++ 	(revision )
@@ -1,2 +1,0 @@
-IF EXIST "%ProjectDir%\Properties\AssemblyInfo.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.cs.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
-IF EXIST "%ProjectDir%\Plugin.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Plugin.cs.frame" "%ProjectDir%\Plugin.cs"
Index: /branches/1837_Sliding Window GP/Sliding Window GP.sln
===================================================================
--- /branches/1837_Sliding Window GP/Sliding Window GP.sln	(revision 17686)
+++ /branches/1837_Sliding Window GP/Sliding Window GP.sln	(revision 17687)
@@ -1,13 +1,8 @@
 ﻿
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.30110.0
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30204.135
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj", "{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{16B09058-C46B-4126-AC63-97B3EBD0C98A}"
-	ProjectSection(SolutionItems) = preProject
-		PreBuildEvent.cmd = PreBuildEvent.cmd
-	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj", "{7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}"
@@ -79,3 +74,6 @@
 		HideSolutionNode = FALSE
 	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {FE309F94-FDDA-4F55-A7E2-9953F7E03343}
+	EndGlobalSection
 EndGlobal
