Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSInitializer.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSInitializer.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSInitializer.cs	(revision 8371)
@@ -0,0 +1,95 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "BFGSInitializer", Description = "Initializes the necessary data structures for the BFGS algorithm.")]
+  public sealed class BFGSInitializer : SingleSuccessorOperator {
+    private const string NumberOfHyperparameterParameterName = "NumberOfHyperparameter";
+    private const string HyperparameterParameterName = "Hyperparameter";
+    private const string BFGSStateParameterName = "BFGSState";
+    private const string IterationsParameterName = "Iterations";
+
+    #region Parameter Properties
+    // in
+    public ILookupParameter<IntValue> NumberOfHyperparameterParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[NumberOfHyperparameterParameterName]; }
+    }
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[IterationsParameterName]; }
+    }
+    // out
+    public ILookupParameter<DoubleArray> HyperparameterParameter {
+      get { return (ILookupParameter<DoubleArray>)Parameters[HyperparameterParameterName]; }
+    }
+    public ILookupParameter<BFGSState> BFGSStateParameter {
+      get { return (ILookupParameter<BFGSState>)Parameters[BFGSStateParameterName]; }
+    }
+
+
+    #endregion
+
+    #region Properties
+    public IntValue NumberOfHyperparameter { get { return NumberOfHyperparameterParameter.ActualValue; } }
+    public IntValue Iterations { get { return IterationsParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    private BFGSInitializer(bool deserializing) : base(deserializing) { }
+    private BFGSInitializer(BFGSInitializer original, Cloner cloner) : base(original, cloner) { }
+    public BFGSInitializer()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<IntValue>(NumberOfHyperparameterParameterName, "The number of parameters to optimize."));
+      Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "The maximal number of iterations for the BFGS algorithm."));
+      // out
+      Parameters.Add(new LookupParameter<DoubleArray>(HyperparameterParameterName, "The hyperparameters for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<BFGSState>(BFGSStateParameterName, "The state of the BFGS algorithm."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BFGSInitializer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      int n = NumberOfHyperparameter.Value;
+      double[] initialHyp = Enumerable.Repeat(0.0, n).ToArray();
+      alglib.minlbfgs.minlbfgsstate state = new alglib.minlbfgs.minlbfgsstate();
+      alglib.minlbfgs.minlbfgscreate(n, Math.Min(n, 5), initialHyp, state);
+      alglib.minlbfgs.minlbfgssetcond(state, 0, 0, 0, Iterations.Value);
+
+      HyperparameterParameter.ActualValue = new DoubleArray(initialHyp);
+      BFGSStateParameter.ActualValue = new BFGSState(state);
+      return base.Apply();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSMakeStep.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSMakeStep.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSMakeStep.cs	(revision 8371)
@@ -0,0 +1,88 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "BFGSMakeStep", Description = "Makes a step in the BFGS optimization algorithm.")]
+  public sealed class BFGSMakeStep : SingleSuccessorOperator {
+    private const string TerminationCriterionParameterName = "TerminationCriterion";
+    private const string HyperparameterParameterName = "Hyperparameter";
+    private const string BFGSStateParameterName = "BFGSState";
+
+    #region Parameter Properties
+    public ILookupParameter<BFGSState> BFGSStateParameter {
+      get { return (ILookupParameter<BFGSState>)Parameters[BFGSStateParameterName]; }
+    }
+    public ILookupParameter<BoolValue> TerminationCriterionParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters[TerminationCriterionParameterName]; }
+    }
+    public ILookupParameter<DoubleArray> HyperparameterParameter {
+      get { return (ILookupParameter<DoubleArray>)Parameters[HyperparameterParameterName]; }
+    }
+    #endregion
+
+
+    #region Properties
+    public BFGSState BFGSState { get { return BFGSStateParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    private BFGSMakeStep(bool deserializing) : base(deserializing) { }
+    private BFGSMakeStep(BFGSMakeStep original, Cloner cloner) : base(original, cloner) { }
+    public BFGSMakeStep()
+      : base() {
+      // in & out
+      Parameters.Add(new LookupParameter<BFGSState>(BFGSStateParameterName, "The state of the BFGS algorithm."));
+      // out
+      Parameters.Add(new LookupParameter<BoolValue>(TerminationCriterionParameterName, "The termination criterion indicating that the BFGS optimization algorithm should stop."));
+      Parameters.Add(new LookupParameter<DoubleArray>(HyperparameterParameterName, "The parameters of the function to optimize."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BFGSMakeStep(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var state = BFGSState;
+      bool stop = alglib.minlbfgs.minlbfgsiteration(state.State);
+      TerminationCriterionParameter.ActualValue = new BoolValue(stop);
+      if (!stop) {
+        HyperparameterParameter.ActualValue = new DoubleArray(state.State.x);
+      } else {
+        double[] x = new double[state.State.x.Length];
+        alglib.minlbfgs.minlbfgsreport rep = new alglib.minlbfgs.minlbfgsreport();
+        alglib.minlbfgs.minlbfgsresults(state.State, ref x, rep);
+        HyperparameterParameter.ActualValue = new DoubleArray(x);
+      }
+      return base.Apply();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSState.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSState.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSState.cs	(revision 8371)
@@ -0,0 +1,301 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item("BFGSState", "Internal state for the BFGS optimization algorithm.")]
+  public sealed class BFGSState : Item {
+    private alglib.minlbfgs.minlbfgsstate state;
+    public alglib.minlbfgs.minlbfgsstate State { get { return state; } }
+
+    [StorableConstructor]
+    private BFGSState(bool deserializing)
+      : base(deserializing) {
+      state = new alglib.minlbfgs.minlbfgsstate();
+    }
+    private BFGSState(BFGSState original, Cloner cloner)
+      : base(original, cloner) {
+      this.state = new alglib.minlbfgs.minlbfgsstate();
+      this.state.autobuf = CopyArray(original.state.autobuf);
+      this.state.d = CopyArray(original.state.d);
+      this.state.denseh = CopyArray(original.state.denseh);
+      this.state.diagh = CopyArray(original.state.diagh);
+      this.state.diffstep = original.state.diffstep;
+      this.state.epsf = original.state.epsf;
+      this.state.epsg = original.state.epsg;
+      this.state.epsx = original.state.epsx;
+      this.state.f = original.state.f;
+      this.state.fbase = original.state.fbase;
+      this.state.fm1 = original.state.fm1;
+      this.state.fm2 = original.state.fm2;
+      this.state.fold = original.state.fold;
+      this.state.fp1 = original.state.fp1;
+      this.state.fp2 = original.state.fp1;
+      this.state.g = CopyArray(original.state.g);
+      this.state.gammak = original.state.gammak;
+      this.state.k = original.state.k;
+
+      this.state.lstate.brackt = original.state.lstate.brackt;
+      this.state.lstate.dg = original.state.lstate.dg;
+      this.state.lstate.dginit = original.state.lstate.dginit;
+      this.state.lstate.dgm = original.state.lstate.dgm;
+      this.state.lstate.dgtest = original.state.lstate.dgtest;
+      this.state.lstate.dgx = original.state.lstate.dgx;
+      this.state.lstate.dgxm = original.state.lstate.dgxm;
+      this.state.lstate.dgy = original.state.lstate.dgy;
+      this.state.lstate.dgym = original.state.lstate.dgym;
+      this.state.lstate.finit = original.state.lstate.finit;
+      this.state.lstate.fm = original.state.lstate.fm;
+      this.state.lstate.ftest1 = original.state.lstate.ftest1;
+      this.state.lstate.fx = original.state.lstate.fx;
+      this.state.lstate.fxm = original.state.lstate.fxm;
+      this.state.lstate.fy = original.state.lstate.fy;
+      this.state.lstate.fym = original.state.lstate.fym;
+      this.state.lstate.infoc = original.state.lstate.infoc;
+      this.state.lstate.stage1 = original.state.lstate.stage1;
+      this.state.lstate.stmax = original.state.lstate.stmax;
+      this.state.lstate.stmin = original.state.lstate.stmin;
+      this.state.lstate.stx = original.state.lstate.stx;
+      this.state.lstate.sty = original.state.lstate.sty;
+      this.state.lstate.width = original.state.lstate.width;
+      this.state.lstate.width1 = original.state.lstate.width1;
+      this.state.lstate.xtrapf = original.state.lstate.xtrapf;
+
+      this.state.m = original.state.m;
+      this.state.maxits = original.state.maxits;
+      this.state.mcstage = original.state.mcstage;
+      this.state.n = original.state.n;
+      this.state.needf = original.state.needf;
+      this.state.needfg = original.state.needfg;
+      this.state.nfev = original.state.nfev;
+      this.state.p = original.state.p;
+      this.state.prectype = original.state.prectype;
+      this.state.q = original.state.q;
+      this.state.repiterationscount = original.state.repiterationscount;
+      this.state.repnfev = original.state.repnfev;
+      this.state.repterminationtype = original.state.repterminationtype;
+      this.state.rho = CopyArray(original.state.rho);
+      this.state.rstate.ba = CopyArray(original.state.rstate.ba);
+      this.state.rstate.ca = CopyArray(original.state.rstate.ca);
+      this.state.rstate.ia = CopyArray(original.state.rstate.ia);
+      this.state.rstate.ra = CopyArray(original.state.rstate.ra);
+      this.state.rstate.stage = original.state.rstate.stage;
+
+      this.state.s = CopyArray(original.state.s);
+      this.state.sk = CopyArray(original.state.sk);
+      this.state.stp = original.state.stp;
+      this.state.stpmax = original.state.stpmax;
+      this.state.theta = CopyArray(original.state.theta);
+      this.state.trimthreshold = original.state.trimthreshold;
+      this.state.work = CopyArray(original.state.work);
+      this.state.x = CopyArray(original.state.x);
+      this.state.xrep = original.state.xrep;
+      this.state.xupdated = original.state.xupdated;
+      this.state.yk = CopyArray(original.state.yk);
+    }
+
+    public BFGSState(alglib.minlbfgs.minlbfgsstate state)
+      : base() {
+      this.state = state;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BFGSState(this, cloner);
+    }
+
+
+    private T[] CopyArray<T>(T[] a) {
+      var c = new T[a.Length];
+      Array.Copy(a, c, c.Length);
+      return c;
+    }
+    private T[,] CopyArray<T>(T[,] a) {
+      var c = new T[a.GetLength(0), a.GetLength(1)];
+      Array.Copy(a, c, c.Length);
+      return c;
+    }
+
+    #region persistence
+    [Storable]
+    private double[] Autobuf { get { return state.autobuf; } set { state.autobuf = value; } }
+    [Storable]
+    private double[] D { get { return state.d; } set { state.d = value; } }
+    [Storable]
+    private double[,] Denseh { get { return state.denseh; } set { state.denseh = value; } }
+    [Storable]
+    private double[] Diagh { get { return state.diagh; } set { state.diagh = value; } }
+    [Storable]
+    private double Diffstep { get { return state.diffstep; } set { state.diffstep = value; } }
+    [Storable]
+    private double Epsf { get { return state.epsf; } set { state.epsf = value; } }
+    [Storable]
+    private double Epsg { get { return state.epsg; } set { state.epsg = value; } }
+    [Storable]
+    private double Epsx { get { return state.epsx; } set { state.epsx = value; } }
+    [Storable]
+    private double F { get { return state.f; } set { state.f = value; } }
+    [Storable]
+    private double Fbase { get { return state.fbase; } set { state.fbase = value; } }
+    [Storable]
+    private double Fm1 { get { return state.fm1; } set { state.fm1 = value; } }
+    [Storable]
+    private double Fm2 { get { return state.fm2; } set { state.fm2 = value; } }
+    [Storable]
+    private double Fold { get { return state.fold; } set { state.fold = value; } }
+    [Storable]
+    private double Fp1 { get { return state.fp1; } set { state.fp1 = value; } }
+    [Storable]
+    private double Fp2 { get { return state.fp2; } set { state.fp2 = value; } }
+    [Storable]
+    private double[] G { get { return state.g; } set { state.g = value; } }
+    [Storable]
+    private double Gammak { get { return state.gammak; } set { state.gammak = value; } }
+    [Storable]
+    private int K { get { return state.k; } set { state.k = value; } }
+    [Storable]
+    private bool LstateBrackt { get { return state.lstate.brackt; } set { state.lstate.brackt = value; } }
+    [Storable]
+    private double LstateDg { get { return state.lstate.dg; } set { state.lstate.dg = value; } }
+    [Storable]
+    private double LstateDginit { get { return state.lstate.dginit; } set { state.lstate.dginit = value; } }
+    [Storable]
+    private double LstateDgm { get { return state.lstate.dgm; } set { state.lstate.dgm = value; } }
+    [Storable]
+    private double LstateDgtest { get { return state.lstate.dgtest; } set { state.lstate.dgtest = value; } }
+    [Storable]
+    private double LstateDgx { get { return state.lstate.dgx; } set { state.lstate.dgx = value; } }
+    [Storable]
+    private double LstateDgxm { get { return state.lstate.dgxm; } set { state.lstate.dgxm = value; } }
+    [Storable]
+    private double LstateDgy { get { return state.lstate.dgy; } set { state.lstate.dgy = value; } }
+    [Storable]
+    private double LstateDgym { get { return state.lstate.dgym; } set { state.lstate.dgym = value; } }
+    [Storable]
+    private double LstateFinit { get { return state.lstate.finit; } set { state.lstate.finit = value; } }
+    [Storable]
+    private double LstateFm { get { return state.lstate.fm; } set { state.lstate.fm = value; } }
+    [Storable]
+    private double LstateFtest1 { get { return state.lstate.ftest1; } set { state.lstate.ftest1 = value; } }
+    [Storable]
+    private double LstateFx { get { return state.lstate.fx; } set { state.lstate.fx = value; } }
+    [Storable]
+    private double LstateFxm { get { return state.lstate.fxm; } set { state.lstate.fxm = value; } }
+    [Storable]
+    private double LstateFy { get { return state.lstate.fy; } set { state.lstate.fy = value; } }
+    [Storable]
+    private double LstateFym { get { return state.lstate.fym; } set { state.lstate.fym = value; } }
+    [Storable]
+    private int LstateInfoc { get { return state.lstate.infoc; } set { state.lstate.infoc = value; } }
+    [Storable]
+    private bool LstateStage1 { get { return state.lstate.stage1; } set { state.lstate.stage1 = value; } }
+    [Storable]
+    private double LstateStmax { get { return state.lstate.stmax; } set { state.lstate.stmax = value; } }
+    [Storable]
+    private double LstateStmin { get { return state.lstate.stmin; } set { state.lstate.stmin = value; } }
+    [Storable]
+    private double LstateStx { get { return state.lstate.stx; } set { state.lstate.stx = value; } }
+    [Storable]
+    private double LstateSty { get { return state.lstate.sty; } set { state.lstate.sty = value; } }
+    [Storable]
+    private double LstateWidth { get { return state.lstate.width; } set { state.lstate.width = value; } }
+    [Storable]
+    private double LstateWidth1 { get { return state.lstate.width1; } set { state.lstate.width1 = value; } }
+    [Storable]
+    private double LstateXtrapf { get { return state.lstate.xtrapf; } set { state.lstate.xtrapf = value; } }
+
+    [Storable]
+    private int M { get { return state.m; } set { state.m = value; } }
+    [Storable]
+    private int MaxIts { get { return state.maxits; } set { state.maxits = value; } }
+    [Storable]
+    private int Mcstage { get { return state.mcstage; } set { state.mcstage = value; } }
+    [Storable]
+    private int N { get { return state.n; } set { state.n = value; } }
+    [Storable]
+    private bool Needf { get { return state.needf; } set { state.needf = value; } }
+    [Storable]
+    private bool Needfg { get { return state.needfg; } set { state.needfg = value; } }
+    [Storable]
+    private int Nfev { get { return state.nfev; } set { state.nfev = value; } }
+    [Storable]
+    private int P { get { return state.p; } set { state.p = value; } }
+    [Storable]
+    private int Prectype { get { return state.prectype; } set { state.prectype = value; } }
+    [Storable]
+    private int Q { get { return state.q; } set { state.q = value; } }
+    [Storable]
+    private int Repiterationscount { get { return state.repiterationscount; } set { state.repiterationscount = value; } }
+    [Storable]
+    private int Repnfev { get { return state.repnfev; } set { state.repnfev = value; } }
+    [Storable]
+    private int Repterminationtype { get { return state.repterminationtype; } set { state.repterminationtype = value; } }
+    [Storable]
+    private double[] Rho { get { return state.rho; } set { state.rho = value; } }
+    [Storable]
+    private bool[] RstateBa { get { return state.rstate.ba; } set { state.rstate.ba = value; } }
+    [Storable]
+    private IList<Tuple<double, double>> RStateCa {
+      get { return state.rstate.ca.Select(c => Tuple.Create(c.x, c.y)).ToList(); }
+      set { state.rstate.ca = value.Select(t => new alglib.complex(t.Item1, t.Item2)).ToArray(); }
+    }
+    [Storable]
+    private int[] RstateIa { get { return state.rstate.ia; } set { state.rstate.ia = value; } }
+    [Storable]
+    private double[] RstateRa { get { return state.rstate.ra; } set { state.rstate.ra = value; } }
+    [Storable]
+    private int RstateStage { get { return state.rstate.stage; } set { state.p = value; } }
+    [Storable]
+    private double[] S { get { return state.s; } set { state.s = value; } }
+    [Storable]
+    private double[,] Sk { get { return state.sk; } set { state.sk = value; } }
+    [Storable]
+    private double Stp { get { return state.stp; } set { state.stp = value; } }
+    [Storable]
+    private double Stpmax { get { return state.stpmax; } set { state.stpmax = value; } }
+    [Storable]
+    private double[] Theta { get { return state.theta; } set { state.theta = value; } }
+    [Storable]
+    private double Trimthreshold { get { return state.trimthreshold; } set { state.trimthreshold = value; } }
+    [Storable]
+    private double[] Work { get { return state.work; } set { state.work = value; } }
+    [Storable]
+    private double[] X { get { return state.x; } set { state.x = value; } }
+    [Storable]
+    private bool Xrep { get { return state.xrep; } set { state.xrep = value; } }
+    [Storable]
+    private bool Xupdated { get { return state.xupdated; } set { state.xupdated = value; } }
+    [Storable]
+    private double[,] Yk { get { return state.yk; } set { state.yk = value; } }
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSUpdateResults.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSUpdateResults.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSUpdateResults.cs	(revision 8371)
@@ -0,0 +1,83 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "BFGSUpdateResults", Description = "Sets the results (function value and gradients) for the next optimization step in the BFGS algorithm.")]
+  public sealed class BFGSUpdateResults : SingleSuccessorOperator {
+    private const string HyperparameterGradientsParameterName = "HyperparameterGradients";
+    private const string FunctionValueParameterName = "NegativeLogLikelihood";
+    private const string BFGSStateParameterName = "BFGSState";
+
+    #region Parameter Properties
+    public ILookupParameter<DoubleArray> HyperparameterGradientsParameter {
+      get { return (ILookupParameter<DoubleArray>)Parameters[HyperparameterGradientsParameterName]; }
+    }
+    public ILookupParameter<DoubleValue> FunctionValueParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[FunctionValueParameterName]; }
+    }
+    public ILookupParameter<BFGSState> BFGSStateParameter {
+      get { return (ILookupParameter<BFGSState>)Parameters[BFGSStateParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public DoubleArray HyperparameterGradients { get { return HyperparameterGradientsParameter.ActualValue; } }
+    public DoubleValue FunctionValue { get { return FunctionValueParameter.ActualValue; } }
+    public BFGSState BFGSState { get { return BFGSStateParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    private BFGSUpdateResults(bool deserializing) : base(deserializing) { }
+    private BFGSUpdateResults(BFGSUpdateResults original, Cloner cloner) : base(original, cloner) { }
+    public BFGSUpdateResults()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<DoubleArray>(HyperparameterGradientsParameterName, "The function gradients for the parameters of the function to optimize."));
+      Parameters.Add(new LookupParameter<DoubleValue>(FunctionValueParameterName, "The value of the function to optimize."));
+      // in & out
+      Parameters.Add(new LookupParameter<BFGSState>(BFGSStateParameterName, "The state of the BFGS algorithm."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BFGSUpdateResults(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var state = BFGSState;
+      var f = FunctionValue.Value;
+      var g = HyperparameterGradients.ToArray();
+      state.State.f = f;
+      state.State.g = g;
+      return base.Apply();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs	(revision 8371)
@@ -4,5 +4,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   [StorableClass]
   [Item(Name = "CovarianceLinear", Description = "Linear covariance function with for Gaussian processes.")]
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs	(revision 8371)
@@ -5,5 +5,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   [StorableClass]
   [Item(Name = "CovarianceSEard", Description = "Squared exponential covariance function with automatic relevance determination for Gaussian processes.")]
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs	(revision 8371)
@@ -5,5 +5,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   [StorableClass]
   [Item(Name = "CovarianceSEiso",
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8371)
@@ -28,5 +28,5 @@
 using HeuristicLab.Problems.DataAnalysis;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   /// <summary>
   /// Represents a Gaussian process model.
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModelCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModelCreator.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModelCreator.cs	(revision 8371)
@@ -0,0 +1,87 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  // base class for GaussianProcessModelCreators (specific for classification and regression)
+  public abstract class GaussianProcessModelCreator : SingleSuccessorOperator {
+    private const string HyperparameterParameterName = "Hyperparameter";
+    private const string MeanFunctionParameterName = "MeanFunction";
+    private const string CovarianceFunctionParameterName = "CovarianceFunction";
+    private const string ModelParameterName = "Model";
+    private const string NegativeLogLikelihoodParameterName = "NegativeLogLikelihood";
+    private const string HyperparameterGradientsParameterName = "HyperparameterGradients";
+
+    #region Parameter Properties
+    // in
+    public ILookupParameter<DoubleArray> HyperparameterParameter {
+      get { return (ILookupParameter<DoubleArray>)Parameters[HyperparameterParameterName]; }
+    }
+    public ILookupParameter<IMeanFunction> MeanFunctionParameter {
+      get { return (ILookupParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
+    }
+    public ILookupParameter<ICovarianceFunction> CovarianceFunctionParameter {
+      get { return (ILookupParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
+    }
+    // out
+    public ILookupParameter<IGaussianProcessModel> ModelParameter {
+      get { return (ILookupParameter<IGaussianProcessModel>)Parameters[ModelParameterName]; }
+    }
+    public ILookupParameter<DoubleArray> HyperparameterGradientsParameter {
+      get { return (ILookupParameter<DoubleArray>)Parameters[HyperparameterGradientsParameterName]; }
+    }
+    public ILookupParameter<DoubleValue> NegativeLogLikelihoodParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[NegativeLogLikelihoodParameterName]; }
+    }
+
+    #endregion
+
+    #region Properties
+    public DoubleArray Hyperparameter { get { return HyperparameterParameter.ActualValue; } }
+    public IMeanFunction MeanFunction { get { return MeanFunctionParameter.ActualValue; } }
+    public ICovarianceFunction CovarianceFunction { get { return CovarianceFunctionParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    protected GaussianProcessModelCreator(bool deserializing) : base(deserializing) { }
+    protected GaussianProcessModelCreator(GaussianProcessModelCreator original, Cloner cloner) : base(original, cloner) { }
+    protected GaussianProcessModelCreator()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<DoubleArray>(HyperparameterParameterName, "The hyperparameters for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function for the Gaussian process model."));
+      // out
+      Parameters.Add(new LookupParameter<IGaussianProcessModel>(ModelParameterName, "The resulting Gaussian process model"));
+      Parameters.Add(new LookupParameter<DoubleArray>(HyperparameterGradientsParameterName, "The gradients of the hyperparameters for the produced Gaussian process model (necessary for hyperparameter optimization)"));
+      Parameters.Add(new LookupParameter<DoubleValue>(NegativeLogLikelihoodParameterName, "The negative log-likelihood of the produced Gaussian process model given the data."));
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 8371)
@@ -21,4 +21,5 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -27,4 +28,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Operators;
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
@@ -34,5 +36,5 @@
 using HeuristicLab.Random;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   /// <summary>
   ///Gaussian process regression data analysis algorithm.
@@ -41,10 +43,18 @@
   [Creatable("Data Analysis")]
   [StorableClass]
-  public sealed class GaussianProcessRegression : FixedDataAnalysisAlgorithm<IRegressionProblem> {
+  public sealed class GaussianProcessRegression : EngineAlgorithm, IStorableContent {
+    public string Filename { get; set; }
+
+    public override Type ProblemType { get { return typeof(IRegressionProblem); } }
+    public new IRegressionProblem Problem {
+      get { return (IRegressionProblem)base.Problem; }
+      set { base.Problem = value; }
+    }
+
     private const string MeanFunctionParameterName = "MeanFunction";
     private const string CovarianceFunctionParameterName = "CovarianceFunction";
-    private const string MinimizationIterationsParameterName = "MinimizationIterations";
-    private const string NegativeLogLikelihoodTableParameterName = "NegativeLogLikelihoodTable";
-    private const string HyperParametersTableParameterName = "HyperParametersTable";
+    private const string MinimizationIterationsParameterName = "Iterations";
+    //private const string NegativeLogLikelihoodTableParameterName = "NegativeLogLikelihoodTable";
+    //private const string HyperParametersTableParameterName = "HyperParametersTable";
 
     #region parameter properties
@@ -95,7 +105,44 @@
       Parameters.Add(new ConstrainedValueParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function to use.",
         new ItemSet<ICovarianceFunction>(covFunctions), covFunctions.First()));
-      Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization.", new IntValue(20)));
+      Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization with BFGS.", new IntValue(20)));
       //Parameters.Add(new LookupParameter<DataTable>(NegativeLogLikelihoodTableParameterName, "The negative log likelihood values over the whole run."));
       //Parameters.Add(new LookupParameter<DataTable>(HyperParametersTableParameterName, "The values of the hyper-parameters over the whole run."));
+
+      var setParameterLength = new GaussianProcessSetHyperparameterLength();
+      var initializer = new BFGSInitializer();
+      var makeStep = new BFGSMakeStep();
+      var branch = new ConditionalBranch();
+      var modelCreator = new GaussianProcessRegressionModelCreator();
+      var updateResults = new BFGSUpdateResults();
+
+      OperatorGraph.InitialOperator = setParameterLength;
+
+      setParameterLength.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
+      setParameterLength.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
+      setParameterLength.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
+      setParameterLength.Successor = initializer;
+
+      initializer.IterationsParameter.ActualName = MinimizationIterationsParameterName;
+      initializer.NumberOfHyperparameterParameter.ActualName = setParameterLength.NumberOfHyperparameterParameter.Name;
+      initializer.Successor = makeStep;
+
+      makeStep.BFGSStateParameter.ActualName = initializer.BFGSStateParameter.Name;
+      makeStep.HyperparameterParameter.ActualName = initializer.NumberOfHyperparameterParameter.Name;
+      makeStep.Successor = branch;
+
+      branch.ConditionParameter.ActualName = makeStep.TerminationCriterionParameter.Name;
+      branch.FalseBranch = modelCreator;
+
+      modelCreator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
+      modelCreator.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
+      modelCreator.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
+      modelCreator.HyperparameterParameter.ActualName = initializer.HyperparameterParameter.Name;
+      modelCreator.Successor = updateResults;
+
+      updateResults.BFGSStateParameter.ActualName = initializer.BFGSStateParameter.Name;
+      updateResults.FunctionValueParameter.ActualName = modelCreator.NegativeLogLikelihoodParameter.Name;
+      updateResults.HyperparameterGradientsParameter.ActualName = modelCreator.HyperparameterGradientsParameter.Name;
+      updateResults.Successor = makeStep;
+
     }
     [StorableHook(HookType.AfterDeserialization)]
@@ -105,5 +152,5 @@
       return new GaussianProcessRegression(this, cloner);
     }
-
+    /*
     #region Gaussian process regression
     protected override void Run() {
@@ -215,4 +262,5 @@
 
     #endregion
+     */
   }
 }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionModelCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionModelCreator.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionModelCreator.cs	(revision 8371)
@@ -0,0 +1,75 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "GaussianProcessRegressionModelCreator",
+    Description = "Creates a Gaussian process model for regression given the data, the hyperparameters, a mean function, and a covariance function.")]
+  public sealed class GaussianProcessRegressionModelCreator : GaussianProcessModelCreator {
+    private const string ProblemDataParameterName = "ProblemData";
+
+    #region Parameter Properties
+    public ILookupParameter<IRegressionProblemData> ProblemDataParameter {
+      get { return (ILookupParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public IRegressionProblemData ProblemData {
+      get { return ProblemDataParameter.ActualValue; }
+    }
+    #endregion
+    [StorableConstructor]
+    private GaussianProcessRegressionModelCreator(bool deserializing) : base(deserializing) { }
+    private GaussianProcessRegressionModelCreator(GaussianProcessRegressionModelCreator original, Cloner cloner) : base(original, cloner) { }
+    public GaussianProcessRegressionModelCreator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The regression problem data for the Gaussian process model."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessRegressionModelCreator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var model = Create(ProblemData, Hyperparameter.ToArray(), MeanFunction, CovarianceFunction);
+      ModelParameter.ActualValue = model;
+      NegativeLogLikelihoodParameter.ActualValue = new DoubleValue(model.NegativeLogLikelihood);
+      HyperparameterGradientsParameter.ActualValue = new DoubleArray(model.GetHyperparameterGradients());
+      return base.Apply();
+    }
+
+    public static IGaussianProcessModel Create(IRegressionProblemData problemData, double[] hyperparameter, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction) {
+      return new GaussianProcessModel(problemData.Dataset, problemData.TargetVariable, problemData.AllowedInputVariables, problemData.TrainingIndices, hyperparameter, meanFunction, covarianceFunction);
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs	(revision 8371)
@@ -25,5 +25,5 @@
 using HeuristicLab.Problems.DataAnalysis;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   /// <summary>
   /// Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessSetHyperparameterLength.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessSetHyperparameterLength.cs	(revision 8371)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessSetHyperparameterLength.cs	(revision 8371)
@@ -0,0 +1,91 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "GaussianProcessSetHyperparameterLength",
+    Description = "Determines the length of the hyperparameter vector based on the mean function, covariance function, and number of allowed input variables.")]
+  public sealed class GaussianProcessSetHyperparameterLength : SingleSuccessorOperator {
+    private const string MeanFunctionParameterName = "MeanFunction";
+    private const string CovarianceFunctionParameterName = "CovarianceFunction";
+    private const string ProblemDataParameterName = "ProblemData";
+    private const string NumberOfHyperparameterParameterName = "NumberOfHyperparameter";
+
+    #region Parameter Properties
+    // in
+    public ILookupParameter<IMeanFunction> MeanFunctionParameter {
+      get { return (ILookupParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
+    }
+    public ILookupParameter<ICovarianceFunction> CovarianceFunctionParameter {
+      get { return (ILookupParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
+    }
+    public ILookupParameter<IDataAnalysisProblemData> ProblemDataParameter {
+      get { return (ILookupParameter<IDataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    // out
+    public ILookupParameter<IntValue> NumberOfHyperparameterParameter {
+      get { return (ILookupParameter<IntValue>)Parameters[NumberOfHyperparameterParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    public IMeanFunction MeanFunction { get { return MeanFunctionParameter.ActualValue; } }
+    public ICovarianceFunction CovarianceFunction { get { return CovarianceFunctionParameter.ActualValue; } }
+    public IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    private GaussianProcessSetHyperparameterLength(bool deserializing) : base(deserializing) { }
+    private GaussianProcessSetHyperparameterLength(GaussianProcessSetHyperparameterLength original, Cloner cloner) : base(original, cloner) { }
+    public GaussianProcessSetHyperparameterLength()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The input data for the Gaussian process."));
+      // out
+      Parameters.Add(new LookupParameter<IntValue>(NumberOfHyperparameterParameterName, "The length of the hyperparameter vector for the Gaussian process model."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessSetHyperparameterLength(this, cloner);
+    }
+
+    public override IOperation Apply()
+    {
+      var inputVariablesCount = ProblemData.AllowedInputVariables.Count();
+      int l = 1 + MeanFunction.GetNumberOfParameters(inputVariablesCount) +
+              CovarianceFunction.GetNumberOfParameters(inputVariablesCount);
+      NumberOfHyperparameterParameter.ActualValue = new IntValue(l);
+      return base.Apply();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs	(revision 8371)
@@ -3,5 +3,5 @@
 using HeuristicLab.Core;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   public interface ICovarianceFunction : IItem {
     int GetNumberOfParameters(int numberOfVariables);
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs	(revision 8371)
@@ -2,5 +2,5 @@
 using HeuristicLab.Core;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   public interface IMeanFunction : IItem {
     int GetNumberOfParameters(int numberOfVariables);
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs	(revision 8371)
@@ -6,5 +6,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   [StorableClass]
   [Item(Name = "MeanConst", Description = "Constant mean function for Gaussian processes.")]
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs	(revision 8371)
@@ -6,5 +6,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   [StorableClass]
   [Item(Name = "MeanLinear", Description = "Linear mean function for Gaussian processes.")]
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs	(revision 8371)
@@ -6,5 +6,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   [StorableClass]
   [Item(Name = "MeanZero", Description = "Constant zero mean function for Gaussian processes.")]
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs	(revision 8371)
@@ -5,5 +5,5 @@
 using System.Linq;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   public static class Util {
     public static double ScalarProd(IEnumerable<double> v, IEnumerable<double> u) {
@@ -17,5 +17,5 @@
 
     public static double SqrDist(IEnumerable<double> x, IEnumerable<double> y) {
-      return Math.Max(x.Zip(y, (a, b) => (a - b) * (a - b)).Sum(), 0);
+      return x.Zip(y, SqrDist).Sum();
     }
 
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8371)
@@ -122,5 +122,14 @@
     </Compile>
     <Compile Include="FixedDataAnalysisAlgorithm.cs" />
+    <Compile Include="GaussianProcess\BFGSInitializer.cs" />
+    <Compile Include="GaussianProcess\BFGSState.cs" />
+    <Compile Include="GaussianProcess\BFGSUpdateResults.cs" />
+    <Compile Include="GaussianProcess\BFGSMakeStep.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessSetHyperparameterLength.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessRegressionModelCreator.cs" />
     <Compile Include="GaussianProcess\CovarianceLinear.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessModelCreator.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="GaussianProcess\MeanLinear.cs" />
     <Compile Include="GaussianProcess\Util.cs" />
@@ -237,4 +246,12 @@
       <Private>False</Private>
     </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
+      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
+      <Name>HeuristicLab.Operators-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
+      <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>
+      <Name>HeuristicLab.Optimization.Operators-3.3</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
       <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8371)
@@ -23,5 +23,5 @@
 using HeuristicLab.Problems.DataAnalysis;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   /// <summary>
   /// Interface to represent a Gaussian process posterior
@@ -32,4 +32,5 @@
     ICovarianceFunction CovarianceFunction { get; }
     IEnumerable<double> Hyperparameters { get; }
+    double[] GetHyperparameterGradients();
   }
 }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs	(revision 8371)
@@ -22,5 +22,5 @@
 using HeuristicLab.Problems.DataAnalysis;
 
-namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+namespace HeuristicLab.Algorithms.DataAnalysis {
   /// <summary>
   /// Interface to represent a Gaussian process solution (either regression or classification)
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame	(revision 8368)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame	(revision 8371)
@@ -37,5 +37,7 @@
   [PluginDependency("HeuristicLab.Data", "3.3")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
+  [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")]
