Index: branches/3022-FastFunctionExtraction/FFX/BasisFunction.cs
===================================================================
--- branches/3022-FastFunctionExtraction/FFX/BasisFunction.cs	(revision 17219)
+++ branches/3022-FastFunctionExtraction/FFX/BasisFunction.cs	(revision 17219)
@@ -0,0 +1,18 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.FastFunctionExtraction
+{
+    public enum operators { Abs, Log, Sin, Cos };
+
+    class BasisFunction
+    {
+        public double _val { get; set; }
+        public string _var { get; set; }
+        public double _exp { get; set; }
+        public operators _op { get; set; }
+    }
+}
Index: branches/3022-FastFunctionExtraction/FFX/FastFunctionExtraction.cs
===================================================================
--- branches/3022-FastFunctionExtraction/FFX/FastFunctionExtraction.cs	(revision 17218)
+++ branches/3022-FastFunctionExtraction/FFX/FastFunctionExtraction.cs	(revision 17219)
@@ -1,4 +1,5 @@
 ﻿using System;
 using System.Threading;
+using System.Linq;
 using HeuristicLab.Common; // required for parameters collection
 using HeuristicLab.Core; // required for parameters collection
@@ -10,103 +11,176 @@
 using HeuristicLab.Random; // MersenneTwister
 using HEAL.Attic;
+using HeuristicLab.Algorithms.DataAnalysis.Glmnet;
+using HeuristicLab.Problems.DataAnalysis;
+using System.Collections.Generic;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.FastFunctionExtraction {
-  // each HL item needs to have a name and a description (BasicAlgorithm is an Item)
-  // The name and description of items is shown in the GUI<<<<
-  [Item(Name = "FastFunctionExtraction", Description = "An FFX algorithm.")]
+namespace HeuristicLab.Algorithms.DataAnalysis.FastFunctionExtraction
+{
 
-  // If the algorithm should be shown in the "New..." dialog it must be creatable. Entries in the new dialog are grouped to categories and ordered by priorities
-  [Creatable(Category = CreatableAttribute.Categories.Algorithms, Priority = 999)]
+    [Item(Name = "FastFunctionExtraction", Description = "An FFX algorithm.")]
+    [Creatable(Category = CreatableAttribute.Categories.Algorithms, Priority = 999)]
+    [StorableType("689280F7-E371-44A2-98A5-FCEDF22CA343")] // for persistence (storing your algorithm to a files or transfer to HeuristicLab.Hive
+    public sealed class FastFunctionExtraction : FixedDataAnalysisAlgorithm<RegressionProblem>
+    {
+        private enum Operator { Abs, Log };
+        private static readonly double[] exponents = { 0.5, 1, 2 };
 
-  [StorableType("689280F7-E371-44A2-98A5-FCEDF22CA343")] // for persistence (storing your algorithm to a files or transfer to HeuristicLab.Hive
-  public class FastFunctionExtraction : BasicAlgorithm {
-    // This algorithm only works for BinaryProblems. 
-    // Overriding the ProblemType property has the effect that only BinaryProblems can be set as problem
-    // for the algorithm in the GUI
-    public override Type ProblemType { get { return typeof(BinaryProblem); } }
-    public new BinaryProblem Problem { get { return (BinaryProblem)base.Problem; } }
-    
-    #region parameters
-    // If an algorithm has parameters then we usually also add properties to access these parameters.
-    // This is not strictly required but considered good shape.
-    private IFixedValueParameter<IntValue> MaxIterationsParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters["MaxIterations"]; }
-    }
-    public int MaxIterations {
-      get { return MaxIterationsParameter.Value.Value; }
-      set { MaxIterationsParameter.Value.Value = value; }
-    }
-    #endregion
+        private const string PenaltyParameterName = "Penalty";
+        private const string ConsiderInteractionsParameterName = "Consider Interactions";
+        private const string ConsiderDenominationParameterName = "Consider Denomination";
+        private const string ConsiderExponentiationParameterName = "Consider Exponentiation";
+        private const string ConsiderNonlinearFuncsParameterName = "Consider Nonlinear functions";
+        private const string ConsiderHingeFuncsParameterName = "Consider Hinge Functions";
 
-    // createable items must have a default ctor
-    public FastFunctionExtraction() {
-      // algorithm parameters are shown in the GUI
-      Parameters.Add(new FixedValueParameter<IntValue>("MaxIterations", new IntValue(10000)));
-    }
+        #region parameters
+        public IValueParameter<BoolValue> ConsiderInteractionsParameter
+        {
+            get { return (IValueParameter<BoolValue>)Parameters[ConsiderInteractionsParameterName]; }
+        }
+        #endregion
 
-    // Persistence uses this ctor to improve deserialization efficiency.
-    // If we would use the default ctor instead this would completely initialize the object (e.g. creating parameters)
-    // even though the data is later overwritten by the stored data.
-    [StorableConstructor]
-    public FastFunctionExtraction(StorableConstructorFlag _) : base(_) { }
+        #region properties
+        public bool ConsiderInteractions
+        {
+            get { return ConsiderInteractionsParameter.Value.Value; }
+            set { ConsiderInteractionsParameter.Value.Value = value; }
+        }
+        #endregion
 
-    // Each clonable item must have a cloning ctor (deep cloning, the cloner is used to handle cyclic object references)
-    public FastFunctionExtraction(FastFunctionExtraction original, Cloner cloner) : base(original, cloner) {
-      // Don't forget to call the cloning ctor of the base class
-      // This class does not have fields, therefore we don't need to actually clone anything
-    }
+        [StorableConstructor]
+        private FastFunctionExtraction(StorableConstructorFlag _) : base(_) { }
+        public FastFunctionExtraction(FastFunctionExtraction original, Cloner cloner) : base(original, cloner)
+        {
+            // Don't forget to call the cloning ctor of the base class  
+            // This class does not have fields, therefore we don't need to actually clone anything
+        }
+        public FastFunctionExtraction() : base()
+        {
+            // algorithm parameters are shown in the GUI
+            Parameters.Add(new FixedValueParameter<DoubleValue>(PenaltyParameterName, "Penalty factor (alpha) for balancing between ridge (0.0) and lasso (1.0) regression", new DoubleValue(0.5)));
+            Parameters.Add(new ValueParameter<BoolValue>(ConsiderInteractionsParameterName, "True if you want to consider interactions, otherwise false.", new BoolValue(true)));
+            Parameters.Add(new ValueParameter<BoolValue>(ConsiderDenominationParameterName, "True if you want to consider denominations, otherwise false.", new BoolValue(true)));
+            Parameters.Add(new ValueParameter<BoolValue>(ConsiderExponentiationParameterName, "True if you want to consider exponentiation, otherwise false.", new BoolValue(true)));
+            Parameters.Add(new ValueParameter<BoolValue>(ConsiderNonlinearFuncsParameterName, "True if you want to consider nonlinear functions(abs, log,...), otherwise false.", new BoolValue(true)));
+            Parameters.Add(new ValueParameter<BoolValue>(ConsiderHingeFuncsParameterName, "True if you want to consider Hinge Functions, otherwise false.", new BoolValue(true)));
+        }
 
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new FastFunctionExtraction(this, cloner);
-    }
+        [StorableHook(HookType.AfterDeserialization)]
+        private void AfterDeserialization() { }
 
-    protected override void Run(CancellationToken cancellationToken) {
-      int maxIters = MaxIterations;
-      var problem = Problem;
-      var rand = new MersenneTwister(1234);
+        public override IDeepCloneable Clone(Cloner cloner)
+        {
+            return new FastFunctionExtraction(this, cloner);
+        }
 
-      var bestQuality = problem.Maximization ? double.MinValue : double.MaxValue;
-
-      var curItersItem = new IntValue();
-      var bestQualityItem = new DoubleValue(bestQuality);
-      var curItersResult = new Result("Iteration", curItersItem);
-      var bestQualityResult = new Result("Best quality", bestQualityItem);
-      Results.Add(curItersResult);
-      Results.Add(bestQualityResult);
-
-      var funcs = generateBasisFunctions();
-
-      for (int i = 0; i < maxIters; i++) {
-        curItersItem.Value = i;
-
-        // -----------------------------
-        // IMPLEMENT YOUR ALGORITHM HERE
-        // -----------------------------
+        public override Type ProblemType { get { return typeof(RegressionProblem); } }
+        public new RegressionProblem Problem { get { return (RegressionProblem)base.Problem; } }
 
 
-        // this is an example for random search
-        // for a more elaborate algorithm check the source code of "HeuristicLab.Algorithms.ParameterlessPopulationPyramid"
-        var cand = new BinaryVector(problem.Length, rand);
-        var quality = problem.Evaluate(cand, rand); // calling Evaluate like this is not possible for all problems...
-        if (problem.Maximization) bestQuality = Math.Max(bestQuality, quality);
-        else bestQuality = Math.Min(quality, bestQuality);
-        bestQualityItem.Value = bestQuality;
+        protected override void Run(CancellationToken cancellationToken)
+        {
+            var basisFunctions = generateBasisFunctions(Problem.ProblemData);
+            var x = Problem.ProblemData.AllowedInputsTrainingValues;
+            List<SymbolicExpressionTree> trees = new List<SymbolicExpressionTree>();
 
-        // check the cancellation token to see if the used clicked "Stop"
-        if (cancellationToken.IsCancellationRequested) break;
-      }
 
-      Results.Add(new Result("Execution time", new TimeSpanValue(this.ExecutionTime)));
-    }
+            foreach (var basisFunc in basisFunctions)
+            {
+                // add tree representation of basisFunc to trees
+                trees.Add(generateSymbolicExpressionTree(basisFunc));
+            }
 
-        
-        private object generateBasisFunctions()
+            foreach (var tree in trees)
+            {
+                // create new data through the help of the Interpreter
+                //IEnumerable<double> responses = 
+            }
+
+            var coefficientVectorSet = findCoefficientValues(basisFunctions);
+            var paretoFront = nondominatedFilter(coefficientVectorSet);
+        }
+
+        private SymbolicExpressionTree generateSymbolicExpressionTree(KeyValuePair<string, double[]> basisFunc)
         {
             throw new NotImplementedException();
         }
 
-        public override bool SupportsPause {
-      get { return false; }
+        // generate all possible models
+        private static Dictionary<string, double[]> generateBasisFunctions(IRegressionProblemData problemData)
+        {
+            var basisFunctions = generateUnivariateBases(problemData);
+            return basisFunctions;
+        }
+
+        private static Dictionary<string, double[]> generateUnivariateBases(IRegressionProblemData problemData)
+        {
+
+            var dataset = problemData.Dataset;
+            var rows = problemData.TrainingIndices;
+            var B1 = new Dictionary<string, double[]>();
+
+            foreach (var variableName in dataset.VariableNames)
+            {
+                foreach (var exp in new[] { 0.5, 1, 2 })
+                {
+                    var name = variableName + " ** " + exp;
+                    var data = dataset.GetDoubleValues(variableName, rows).Select(x => Math.Pow(x, exp)).ToArray();
+                    B1.Add(name, data);
+                    foreach (Operator op in Enum.GetValues(typeof(Operator)))
+                    {
+                        var inner_name = op.ToString() + "(" + name + ")";
+                        var inner_data = data.Select(x => executeOperator(x, op)).ToArray();
+                        B1.Add(inner_name, inner_data);
+                    }
+                }
+            }
+            
+            return B1;
+        }
+
+        private static double executeOperator(double x, Operator op)
+        {
+            switch (op)
+            {
+                case Operator.Abs:
+                    return x > 0 ? x : -x;
+                case Operator.Log:
+                    return Math.Log10(x);
+                default:
+                    throw new NotImplementedException();
+            }
+        }
+
+        private static Dictionary<string, double[]> generateMultiVariateBases(Dictionary<string, double[]> B1)
+        {
+            var B2 = new Dictionary<string, double[]>();
+            for(int i = 1; i <= B1.Count(); i++ )
+            {
+                var b_i = B1.ElementAt(i);
+                for (int j = 1; j < i; i++)
+                {
+                    var b_j = B1.ElementAt(j);
+                }
+            }
+
+            // return union of B1 and B2
+            return B2.Concat(B1).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
+        }
+
+        private static object findCoefficientValues(IEnumerable<KeyValuePair<string, double[]>> basisFunctions)
+        {
+            return new object();
+        }
+
+        private static object nondominatedFilter(object coefficientVectorSet)
+        {
+            return new object();
+        }
+
+        public override bool SupportsPause
+        {
+            get { return false; }
+        }
     }
-  }
 }
Index: branches/3022-FastFunctionExtraction/FFX/FastFunctionExtraction.csproj
===================================================================
--- branches/3022-FastFunctionExtraction/FFX/FastFunctionExtraction.csproj	(revision 17218)
+++ branches/3022-FastFunctionExtraction/FFX/FastFunctionExtraction.csproj	(revision 17219)
@@ -36,4 +36,12 @@
       <HintPath>..\..\..\trunk\bin\HEAL.Attic.dll</HintPath>
     </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis.Glmnet-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Algorithms.DataAnalysis.Glmnet-3.4.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -56,4 +64,8 @@
       <HintPath>..\..\..\trunk\bin\HeuristicLab.Encodings.BinaryVectorEncoding-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.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -75,4 +87,13 @@
       <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.Binary-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.Regression-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec" />
     <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -89,5 +110,7 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BasisFunction.cs" />
     <Compile Include="FastFunctionExtraction.cs" />
+    <Compile Include="GeneralizedLinearModel.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
