Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Grammar.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Grammar.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Grammar.cs	(revision 15712)
@@ -0,0 +1,32 @@
+﻿namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration {
+  public class Grammar {
+
+    public Symbol StartSymbol;
+
+    public Grammar(string[] variables) {
+      #region Define Symbols
+      VariableSymbol var = new VariableSymbol("var", variables);
+
+      NonterminalSymbol expr = new NonterminalSymbol("Expr");
+      NonterminalSymbol term = new NonterminalSymbol("Expr");
+      NonterminalSymbol factor = new NonterminalSymbol("Expr");
+
+      TerminalSymbol addition = new TerminalSymbol("+");
+      TerminalSymbol multiplication = new TerminalSymbol("*");
+      #endregion
+
+
+      #region Production ruless
+      StartSymbol = expr;
+
+      expr.AddProduction(term, expr, addition);
+      expr.AddProduction(term);
+
+      term.AddProduction(factor, term, multiplication);
+      term.AddProduction(factor);
+
+      factor.AddProduction(var);
+      #endregion
+    }
+  }
+}
Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs	(revision 15712)
@@ -0,0 +1,125 @@
+﻿using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading;
+using HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.GrammarEnumeration;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration {
+  [Item("Grammar Enumeration Symbolic Regression", "Iterates all possible model structures for a fixed grammar.")]
+  [StorableClass]
+  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 250)]
+  public class GrammarEnumerationAlgorithm : FixedDataAnalysisAlgorithm<IRegressionProblem> {
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GrammarEnumerationAlgorithm(this, cloner);
+    }
+
+
+    public GrammarEnumerationAlgorithm() {
+      Problem = new RegressionProblem();
+
+    }
+
+
+    private GrammarEnumerationAlgorithm(GrammarEnumerationAlgorithm original, Cloner cloner) : base(original, cloner) { }
+
+
+
+
+
+    protected override void Run(CancellationToken cancellationToken) {
+
+      IntValue generatedSolutions = new IntValue();
+      Results.Add(new Result("Generated Solutions", generatedSolutions));
+
+      DoubleValue averageTreeLength = new DoubleValue();
+      Results.Add(new Result("Average Tree Length of Solutions", averageTreeLength));
+
+
+      int maxStringLength = 4;
+
+
+      List<SymbolString> results = new List<SymbolString>();
+
+      Grammar grammar = new Grammar(new[] { "a", "b" });
+
+      Stack<SymbolString> remainingTrees = new Stack<SymbolString>();
+      remainingTrees.Push(new SymbolString(new[] { grammar.StartSymbol }));
+
+      while (remainingTrees.Any()) {
+        SymbolString currSymbolString = remainingTrees.Pop();
+
+        if (currSymbolString.IsSentence()) {
+          results.Add(currSymbolString);
+
+          generatedSolutions.Value++;
+          averageTreeLength.Value = results.Select(r => r.Count).Average();
+
+        } else {
+          // expand next nonterminal symbols
+          int nonterminalSymbolIndex = currSymbolString.FindIndex(s => s is NonterminalSymbol);
+
+          NonterminalSymbol expandedSymbol = currSymbolString[nonterminalSymbolIndex] as NonterminalSymbol;
+
+          foreach (Production productionAlternative in expandedSymbol.Alternatives) {
+            SymbolString newSentence = new SymbolString(currSymbolString);
+            newSentence.RemoveAt(nonterminalSymbolIndex);
+            newSentence.InsertRange(nonterminalSymbolIndex, productionAlternative);
+
+            if (newSentence.Count <= maxStringLength) {
+              remainingTrees.Push(newSentence);
+            }
+          }
+        }
+      }
+
+
+      StringArray sentences = new StringArray(results.Select(r => r.ToString()).ToArray());
+      Results.Add(new Result("All sentences", sentences));
+
+
+
+      /*
+      addSy = grammar.AllowedSymbols.OfType<Addition>().First();
+      mulSy = grammar.AllowedSymbols.OfType<Multiplication>().First();
+      logSy = grammar.AllowedSymbols.OfType<Logarithm>().First();
+      expSy = grammar.AllowedSymbols.OfType<Exponential>().First();
+      divSy = grammar.AllowedSymbols.OfType<Division>().First();
+
+      progRootSy = grammar.AllowedSymbols.OfType<ProgramRootSymbol>().First();
+      startSy = grammar.AllowedSymbols.OfType<StartSymbol>().First();
+
+
+
+      var rootNode = progRootSy.CreateTreeNode();
+
+      var startNode = startSy.CreateTreeNode();
+      rootNode.AddSubtree(startNode);
+
+      startNode.AddSubtree(const0);
+
+
+
+      SymbolicExpressionTree tree = new SymbolicExpressionTree(rootNode);
+
+      SymbolicRegressionModel model = new SymbolicRegressionModel(
+        Problem.ProblemData.TargetVariable,
+        tree,
+        new SymbolicDataAnalysisExpressionTreeLinearInterpreter());
+
+      IRegressionSolution solution = model.CreateRegressionSolution(Problem.ProblemData);
+      Results.Add(new Result("Best solution (training)", solution));
+      Results.Add(new Result("Best solution quality (training)", new DoubleValue(solution.TrainingRSquared).AsReadOnly()));
+
+      Results.Add(new Result("Best solution (test)", solution));
+      Results.Add(new Result("Best solution quality (test)", new DoubleValue(solution.TestRSquared).AsReadOnly()));
+      */
+    }
+  }
+}
Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Sentence.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Sentence.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Sentence.cs	(revision 15712)
@@ -0,0 +1,27 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.GrammarEnumeration {
+  public class SymbolString : List<Symbol> {
+
+    public SymbolString(IEnumerable<Symbol> symbols) : base(symbols) { }
+
+    public bool IsSentence() {
+      return this.All(sym => sym is TerminalSymbol);
+    }
+
+    public int[] GetNonterminalSymbolIndexes() {
+      return Enumerable.Range(0, Count)
+        .Where(i => this[i] is NonterminalSymbol)
+        .ToArray();
+    }
+
+    public override string ToString()
+    {
+      return string.Join(" ", this);
+    }
+  }
+}
Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Symbol.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Symbol.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/Symbol.cs	(revision 15712)
@@ -0,0 +1,52 @@
+﻿using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration {
+
+  public abstract class Symbol {
+    private readonly string stringRepresentation;
+
+    protected Symbol(string representation) {
+      stringRepresentation = representation;
+    }
+
+    public override string ToString() {
+      return stringRepresentation;
+    }
+  }
+
+  public class TerminalSymbol : Symbol {
+    public TerminalSymbol(string representation) : base(representation) { }
+  }
+
+  public class NonterminalSymbol : Symbol {
+    public List<Production> Alternatives;
+
+    public NonterminalSymbol(string representation) : base(representation) {
+      Alternatives = new List<Production>();
+    }
+
+    public void AddProduction(params Symbol[] production) {
+      Alternatives.Add(new Production(production));
+    }
+  }
+
+  public class VariableSymbol : NonterminalSymbol { // Convenience class
+    public VariableSymbol(string representation, IEnumerable<string> variableNames) : base(representation) {
+      foreach (string variableName in variableNames) {
+        AddProduction(new TerminalSymbol("[" + variableName + "]"));
+      }
+    }
+  }
+
+  public class Production : List<Symbol> {
+
+    public Production(params Symbol[] symbols) : base(symbols) { }
+
+    public Production(IEnumerable<Symbol> symbols) : base(symbols) { }
+
+    public override string ToString() {
+      return string.Join(" ", this);
+    }
+  }
+}
Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.csproj
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.csproj	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.csproj	(revision 15712)
@@ -0,0 +1,108 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{DC3DEB6C-0D1C-4F23-A9BA-67896DA700D3}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration</RootNamespace>
+    <AssemblyName>HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\trunk\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ALGLIB-3.7.0">
+      <HintPath>..\..\..\trunk\bin\ALGLIB-3.7.0.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="GrammarEnumeration\Grammar.cs" />
+    <Compile Include="GrammarEnumeration\GrammarEnumerationAlgorithm.cs" />
+    <Compile Include="GrammarEnumeration\Sentence.cs" />
+    <Compile Include="Plugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="GrammarEnumeration\Symbol.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Plugin.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Plugin.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Plugin.cs	(revision 15712)
@@ -0,0 +1,47 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration {
+  [Plugin("HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration", "", "3.4.0.15608")]
+  [PluginFile("HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.ALGLIB", "3.7")]
+  [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
+  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
+  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")]
+  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
+  [PluginDependency("HeuristicLab.Random", "3.3")]
+
+  public class Plugin : PluginBase {
+  }
+}
Index: /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Properties/AssemblyInfo.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Properties/AssemblyInfo.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/Properties/AssemblyInfo.cs	(revision 15712)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HEAL")]
+[assembly: AssemblyProduct("HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration")]
+[assembly: AssemblyCopyright("HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("dc3deb6c-0d1c-4f23-a9ba-67896da700d3")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/2886_SymRegGrammarEnumeration/SymRegGrammarEnumeration.sln
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/SymRegGrammarEnumeration.sln	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/SymRegGrammarEnumeration.sln	(revision 15712)
@@ -0,0 +1,28 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration", "HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration\HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.csproj", "{DC3DEB6C-0D1C-4F23-A9BA-67896DA700D3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{C828DECC-CAF5-4E23-B594-8D4F51255072}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DC3DEB6C-0D1C-4F23-A9BA-67896DA700D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DC3DEB6C-0D1C-4F23-A9BA-67896DA700D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DC3DEB6C-0D1C-4F23-A9BA-67896DA700D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DC3DEB6C-0D1C-4F23-A9BA-67896DA700D3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C828DECC-CAF5-4E23-B594-8D4F51255072}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C828DECC-CAF5-4E23-B594-8D4F51255072}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C828DECC-CAF5-4E23-B594-8D4F51255072}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C828DECC-CAF5-4E23-B594-8D4F51255072}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Index: /branches/2886_SymRegGrammarEnumeration/Test/GrammarEnumerationTest.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/Test/GrammarEnumerationTest.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/Test/GrammarEnumerationTest.cs	(revision 15712)
@@ -0,0 +1,582 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression {
+  [TestClass()]
+  public class MctsSymbolicRegressionTest {
+    private const int Seed = 1234;
+    private IRandom rand;
+
+    private const double SuccessThreshold = 0.99999;
+
+    [TestInitialize]
+    public void InitTest() {
+      Console.Write("init called... ");
+      rand = new FastRandom(Seed);
+    }
+
+    #region test structure search (no constants)
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Nguyen1() {
+      // x³ + x² + x
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F1 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Nguyen2() {
+      // x^4 + x³ + x² + x
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F2 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Nguyen3() {
+      // x^5 + x^4 + x³ + x² + x
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F3 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Nguyen4() {
+      // x^6 + x^5 + x^4 + x³ + x² + x
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F4 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Nguyen7() {
+      // log(x + 1) + log(x² + 1)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F7 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Poly10_Part1() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+
+      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
+      //  Y' = X1*X2 + X3*X4 + X5*X6
+      // simplify problem by changing target
+      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
+      var ys = ds.GetDoubleValues("Y").ToArray();
+      var x1 = ds.GetDoubleValues("X1").ToArray();
+      var x2 = ds.GetDoubleValues("X2").ToArray();
+      var x3 = ds.GetDoubleValues("X3").ToArray();
+      var x4 = ds.GetDoubleValues("X4").ToArray();
+      var x5 = ds.GetDoubleValues("X5").ToArray();
+      var x6 = ds.GetDoubleValues("X6").ToArray();
+      var x7 = ds.GetDoubleValues("X7").ToArray();
+      var x8 = ds.GetDoubleValues("X8").ToArray();
+      var x9 = ds.GetDoubleValues("X9").ToArray();
+      var x10 = ds.GetDoubleValues("X10").ToArray();
+      for (int i = 0; i < ys.Length; i++) {
+        ys[i] -= x1[i] * x7[i] * x9[i];
+        ys[i] -= x3[i] * x6[i] * x10[i];
+      }
+      ds.ReplaceVariable("Y", ys.ToList());
+
+      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
+
+      TestGrammarEnumeration(modifiedProblemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Poly10_Part2() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+
+      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
+      //  Y' = X1*X7*X9 + X3*X6*X10
+      // simplify problem by changing target
+      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
+      var ys = ds.GetDoubleValues("Y").ToArray();
+      var x1 = ds.GetDoubleValues("X1").ToArray();
+      var x2 = ds.GetDoubleValues("X2").ToArray();
+      var x3 = ds.GetDoubleValues("X3").ToArray();
+      var x4 = ds.GetDoubleValues("X4").ToArray();
+      var x5 = ds.GetDoubleValues("X5").ToArray();
+      var x6 = ds.GetDoubleValues("X6").ToArray();
+      var x7 = ds.GetDoubleValues("X7").ToArray();
+      var x8 = ds.GetDoubleValues("X8").ToArray();
+      var x9 = ds.GetDoubleValues("X9").ToArray();
+      var x10 = ds.GetDoubleValues("X10").ToArray();
+      for (int i = 0; i < ys.Length; i++) {
+        ys[i] -= x1[i] * x2[i];
+        ys[i] -= x3[i] * x4[i];
+        ys[i] -= x5[i] * x6[i];
+      }
+      ds.ReplaceVariable("Y", ys.ToList());
+
+      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
+
+      TestGrammarEnumeration(modifiedProblemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Poly10_Part3() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+
+      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
+      //  Y' = X1*X2 + X1*X7*X9
+      // simplify problem by changing target
+      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
+      var ys = ds.GetDoubleValues("Y").ToArray();
+      var x1 = ds.GetDoubleValues("X1").ToArray();
+      var x2 = ds.GetDoubleValues("X2").ToArray();
+      var x3 = ds.GetDoubleValues("X3").ToArray();
+      var x4 = ds.GetDoubleValues("X4").ToArray();
+      var x5 = ds.GetDoubleValues("X5").ToArray();
+      var x6 = ds.GetDoubleValues("X6").ToArray();
+      var x7 = ds.GetDoubleValues("X7").ToArray();
+      var x8 = ds.GetDoubleValues("X8").ToArray();
+      var x9 = ds.GetDoubleValues("X9").ToArray();
+      var x10 = ds.GetDoubleValues("X10").ToArray();
+      for (int i = 0; i < ys.Length; i++) {
+        ys[i] -= x3[i] * x4[i];
+        ys[i] -= x5[i] * x6[i];
+        ys[i] -= x3[i] * x6[i] * x10[i];
+      }
+      ds.ReplaceVariable("Y", ys.ToList());
+
+      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
+
+      TestGrammarEnumeration(modifiedProblemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Poly10_Part4() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+
+      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
+      //  Y' = X3*X4 + X5*X6 + X3*X6*X10
+      // simplify problem by changing target
+      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
+      var ys = ds.GetDoubleValues("Y").ToArray();
+      var x1 = ds.GetDoubleValues("X1").ToArray();
+      var x2 = ds.GetDoubleValues("X2").ToArray();
+      var x3 = ds.GetDoubleValues("X3").ToArray();
+      var x4 = ds.GetDoubleValues("X4").ToArray();
+      var x5 = ds.GetDoubleValues("X5").ToArray();
+      var x6 = ds.GetDoubleValues("X6").ToArray();
+      var x7 = ds.GetDoubleValues("X7").ToArray();
+      var x8 = ds.GetDoubleValues("X8").ToArray();
+      var x9 = ds.GetDoubleValues("X9").ToArray();
+      var x10 = ds.GetDoubleValues("X10").ToArray();
+      for (int i = 0; i < ys.Length; i++) {
+        ys[i] -= x1[i] * x2[i];
+        ys[i] -= x1[i] * x7[i] * x9[i];
+      }
+      ds.ReplaceVariable("Y", ys.ToList());
+      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
+
+
+      TestGrammarEnumeration(modifiedProblemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Poly10_Part5() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+
+      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
+      //  Y' = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9
+      // simplify problem by changing target
+      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
+      var ys = ds.GetDoubleValues("Y").ToArray();
+      var x1 = ds.GetDoubleValues("X1").ToArray();
+      var x2 = ds.GetDoubleValues("X2").ToArray();
+      var x3 = ds.GetDoubleValues("X3").ToArray();
+      var x4 = ds.GetDoubleValues("X4").ToArray();
+      var x5 = ds.GetDoubleValues("X5").ToArray();
+      var x6 = ds.GetDoubleValues("X6").ToArray();
+      var x7 = ds.GetDoubleValues("X7").ToArray();
+      var x8 = ds.GetDoubleValues("X8").ToArray();
+      var x9 = ds.GetDoubleValues("X9").ToArray();
+      var x10 = ds.GetDoubleValues("X10").ToArray();
+      for (int i = 0; i < ys.Length; i++) {
+        ys[i] -= x3[i] * x6[i] * x10[i];
+      }
+      ds.ReplaceVariable("Y", ys.ToList());
+      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
+
+
+      TestGrammarEnumeration(modifiedProblemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Poly10_Part6() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+
+      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
+      //  Y' = X1*X2 + X3*X4 + X5*X6 + X3*X6*X10
+      // simplify problem by changing target
+      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
+      var ys = ds.GetDoubleValues("Y").ToArray();
+      var x1 = ds.GetDoubleValues("X1").ToArray();
+      var x2 = ds.GetDoubleValues("X2").ToArray();
+      var x3 = ds.GetDoubleValues("X3").ToArray();
+      var x4 = ds.GetDoubleValues("X4").ToArray();
+      var x5 = ds.GetDoubleValues("X5").ToArray();
+      var x6 = ds.GetDoubleValues("X6").ToArray();
+      var x7 = ds.GetDoubleValues("X7").ToArray();
+      var x8 = ds.GetDoubleValues("X8").ToArray();
+      var x9 = ds.GetDoubleValues("X9").ToArray();
+      var x10 = ds.GetDoubleValues("X10").ToArray();
+      for (int i = 0; i < ys.Length; i++) {
+        ys[i] -= x1[i] * x7[i] * x9[i];
+      }
+      ds.ReplaceVariable("Y", ys.ToList());
+      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
+
+      TestGrammarEnumeration(modifiedProblemData);
+    }
+
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "long")]
+    public void MctsSymbReg_NoConstants_Poly10_250rows() {
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
+      regProblem.TrainingPartition.Start = 0;
+      regProblem.TrainingPartition.End = regProblem.Dataset.Rows;
+      regProblem.TestPartition.Start = 0;
+      regProblem.TestPartition.End = 2;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "long")]
+    public void MctsSymbReg_NoConstants_Poly10_10000rows() {
+      // as poly-10 but more rows
+      var x1 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x2 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x3 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x4 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x5 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x6 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x7 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x8 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x9 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var x10 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
+      var ys = new List<double>();
+      for (int i = 0; i < x1.Count; i++) {
+        ys.Add(x1[i] * x2[i] + x3[i] * x4[i] + x5[i] * x6[i] + x1[i] * x7[i] * x9[i] + x3[i] * x6[i] * x10[i]);
+      }
+
+      var ds = new Dataset(new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "y" },
+        new[] { x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, ys });
+
+
+      var problemData = new RegressionProblemData(ds, new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }, "y");
+
+      problemData.TrainingPartition.Start = 0;
+      problemData.TrainingPartition.End = problemData.Dataset.Rows;
+      problemData.TestPartition.Start = 0;
+      problemData.TestPartition.End = 2; // must not be empty
+
+
+      TestGrammarEnumeration(problemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_TwoVars() {
+
+      // y = x1 + x2 + x1*x2 + x1*x2*x2 + x1*x1*x2
+      var x1 = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
+      var x2 = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
+      var ys = x1.Zip(x2, (x1i, x2i) => x1i + x2i + x1i * x2i + x1i * x2i * x2i + x1i * x1i * x2i).ToList();
+
+      var ds = new Dataset(new string[] { "a", "b", "y" }, new[] { x1, x2, ys });
+      var problemData = new RegressionProblemData(ds, new string[] { "a", "b" }, "y");
+
+      TestGrammarEnumeration(problemData);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbReg_NoConstants_Misleading() {
+
+      // y = a + baaaaa (the effect of the second term should be very small)
+      // the alg will quickly find that a has big effect and will search below a
+      // since we prevent a + a... the algorithm must find the correct expression via a + b...
+      // however b has a small effect so the branch might not be identified as relevant
+      var @as = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
+      var bs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
+      var cs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() * 1.0e-3).ToList();
+      var ds = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
+      var es = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
+      var ys = new double[@as.Count];
+      for (int i = 0; i < ys.Length; i++)
+        ys[i] = @as[i] + bs[i] + @as[i] * bs[i] * cs[i];
+
+      var dataset = new Dataset(new string[] { "a", "b", "c", "d", "e", "y" }, new[] { @as, bs, cs, ds, es, ys.ToList() });
+
+      var problemData = new RegressionProblemData(dataset, new string[] { "a", "b", "c", "d", "e" }, "y");
+
+      TestGrammarEnumeration(problemData);
+    }
+    #endregion
+
+    #region restricted structure but including numeric constants
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegKeijzer7() {
+      // ln(x)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 7 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen5() {
+      // sin(x²)cos(x) - 1
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F5 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen6() {
+      // sin(x) + sin(x + x²)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F6 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen7() {
+      //  log(x + 1) + log(x² + 1)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F7 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen8() {
+      // Sqrt(x)
+      // = x ^ 0.5
+      // = exp(0.5 * log(x))
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F8 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    
+    // [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen9() {
+      //  sin(x) + sin(y²)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F9 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+
+    // [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen10() {
+      // 2sin(x)cos(y)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F10 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen11() {
+      // x ^ y  , x > 0, y > 0   
+      // = exp(y * log(x))
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F11 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkNguyen12() {
+      // x^4 - x³ + y²/2 - y
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F12 ")));
+      TestGrammarEnumeration(regProblem);
+    }
+
+    #endregion
+
+    #region keijzer
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "long")]
+    public void MctsSymbRegBenchmarkKeijzer5() {
+      // (30 * x * z) / ((x - 10)  * y²)
+      // = 30 x z / (xy² - y²)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 5 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer6() {
+      // Keijzer 6 f(x) = Sum(1 / i) From 1 to X  , x \in [0..120]
+      // we can only approximate this
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 6 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer8() {
+      // sqrt(x)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 8 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer9() {
+      // arcsinh(x)  i.e. ln(x + sqrt(x² + 1))
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 9 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer11() {
+      // xy + sin( (x-1) (y-1) )
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider();
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 11 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer12() {
+      // x^4 - x³ + y² / 2 - y,  same as Nguyen 12             
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 12 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer14() {
+      // 8 / (2 + x² + y²)
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 14 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+
+    [TestMethod]
+    [TestCategory("Algorithms.DataAnalysis")]
+    [TestProperty("Time", "short")]
+    public void MctsSymbRegBenchmarkKeijzer15() {
+      // x³ / 5 + y³ / 2 - y - x
+      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
+      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 15 f(")));
+      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
+      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
+      TestGrammarEnumeration(regProblem);
+    }
+    #endregion
+
+    private void TestGrammarEnumeration(IRegressionProblemData problemData)
+    {
+      // Configure algorithm and problem
+      var alg = new GrammarEnumerationAlgorithm();
+      var problem = new RegressionProblem();
+      alg.Problem = problem;
+      problem.ProblemData = problemData;
+      
+      // Run
+      alg.Start();
+
+      // Evaluate results
+      var eps = 1.0 - SuccessThreshold;
+
+      // Check if algorithm terminated correctly
+      Assert.IsTrue(alg.Results.ContainsKey("Best solution quality (training)"), "No training solution returned!");
+      Assert.IsTrue(alg.Results.ContainsKey("Best solution quality (test)"), "No test solution returned!");
+
+      // Check resultss
+      Assert.AreEqual(1.0, ((DoubleValue)alg.Results["Best solution quality (training)"].Value).Value, eps, "Training quality too low!");
+      Assert.AreEqual(1.0, ((DoubleValue)alg.Results["Best solution quality (test)"].Value).Value, eps, "Test quality too low!");
+    }
+  }
+}
Index: /branches/2886_SymRegGrammarEnumeration/Test/Properties/AssemblyInfo.cs
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/Test/Properties/AssemblyInfo.cs	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/Test/Properties/AssemblyInfo.cs	(revision 15712)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("FH-Hagenberg")]
+[assembly: AssemblyProduct("Test")]
+[assembly: AssemblyCopyright("Copyright © FH-Hagenberg 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c828decc-caf5-4e23-b594-8d4f51255072")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/2886_SymRegGrammarEnumeration/Test/Test.csproj
===================================================================
--- /branches/2886_SymRegGrammarEnumeration/Test/Test.csproj	(revision 15712)
+++ /branches/2886_SymRegGrammarEnumeration/Test/Test.csproj	(revision 15712)
@@ -0,0 +1,146 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{C828DECC-CAF5-4E23-B594-8D4F51255072}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Test</RootNamespace>
+    <AssemblyName>Test</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="ALGLIB-3.7.0">
+      <HintPath>..\..\..\trunk\bin\ALGLIB-3.7.0.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3">
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <Choose>
+    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+      </ItemGroup>
+    </When>
+    <Otherwise>
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
+      </ItemGroup>
+    </Otherwise>
+  </Choose>
+  <ItemGroup>
+    <Compile Include="GrammarEnumerationTest.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration\HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.csproj">
+      <Project>{dc3deb6c-0d1c-4f23-a9ba-67896da700d3}</Project>
+      <Name>HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Choose>
+    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+      </ItemGroup>
+    </When>
+  </Choose>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
