Index: branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Problems/InfillProblem.cs
===================================================================
--- branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Problems/InfillProblem.cs	(revision 14818)
+++ branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Problems/InfillProblem.cs	(revision 15064)
@@ -21,4 +21,6 @@
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -27,4 +29,5 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
 
 namespace HeuristicLab.Algorithms.EGO {
@@ -33,39 +36,31 @@
   public sealed class InfillProblem : SingleObjectiveBasicProblem<RealVectorEncoding> {
 
-    public override bool Maximization => true;  //This is necessary because algorithms do not expect the maximization to change
+    public override bool Maximization => true;
 
-    #region Properties;
+    #region ProblemResultNames
+    public const string BestInfillSolutionResultName = "BestInfillSolution";
+    public const string BestInfillQualityResultName = "BestInfillQuality";
+    #endregion
+
+    #region Properties
     [Storable]
     private IInfillCriterion infillCriterion;
-    [Storable]
-    private SingleObjectiveBasicProblem<IEncoding> problem;
 
     public IInfillCriterion InfillCriterion
     {
       get { return infillCriterion; }
-      set { infillCriterion = value; }
-    }
-    public SingleObjectiveBasicProblem<IEncoding> Problem
-    {
-      get { return problem; }
       set
       {
-        problem = value;
-        if (problem == null) return;
-        var enc = problem.Encoding as RealVectorEncoding;
-        if (enc == null) throw new ArgumentException("EGO can not be performed on non-RealVectorEncodings");
-        Encoding = enc;
-        SolutionCreator = new UniformRandomRealVectorCreator();//ignore Problem specific Solution Creation
-
+        infillCriterion = value;
+        infillCriterion.Encoding = Encoding;
       }
     }
     #endregion
 
-    #region HLConstructors
+    #region Constructors
     [StorableConstructor]
     private InfillProblem(bool deserializing) : base(deserializing) { }
     private InfillProblem(InfillProblem original, Cloner cloner) : base(original, cloner) {
-      infillCriterion = cloner.Clone(original.InfillCriterion);
-      problem = cloner.Clone(original.Problem);
+      infillCriterion = cloner.Clone(original.infillCriterion);
     }
     public InfillProblem() { }
@@ -74,24 +69,53 @@
 
     public override double Evaluate(Individual individual, IRandom r) {
-      var q = InfillCriterion.Evaluate(individual.RealVector());
-      return InfillCriterion.Maximization() ? q : -q;
+      return !InBounds(individual.RealVector(), Encoding.Bounds) ? double.MinValue : InfillCriterion.Evaluate(individual.RealVector());
     }
     public override void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) {
       base.Analyze(individuals, qualities, results, random);
       var best = qualities.ArgMax(x => x);
-      var qnew = InfillCriterion.Maximization() ? qualities[best] : -qualities[best];
-      const string qname = EfficientGlobalOptimizationAlgorithm.BestInfillQualityResultName;
-      const string sname = EfficientGlobalOptimizationAlgorithm.BestInfillSolutionResultName;
-      if (!results.ContainsKey(EfficientGlobalOptimizationAlgorithm.BestInfillQualityResultName)) {
-        results.Add(new Result(sname, (RealVector)individuals[best].RealVector().Clone()));
-        results.Add(new Result(qname, new DoubleValue(qnew)));
+      var newQuality = qualities[best];
+      if (!results.ContainsKey(BestInfillQualityResultName)) {
+        results.Add(new Result(BestInfillSolutionResultName, (RealVector)individuals[best].RealVector().Clone()));
+        results.Add(new Result(BestInfillQualityResultName, new DoubleValue(newQuality)));
         return;
       }
-      var qold = results[qname].Value as DoubleValue;
+      var qold = results[BestInfillQualityResultName].Value as DoubleValue;
       if (qold == null) throw new ArgumentException("Old best quality is not a double value. Conflicting Analyzers?");
-      if (qold.Value >= qnew == InfillCriterion.Maximization()) return;
-      results[sname].Value = (RealVector)individuals[best].RealVector().Clone();
-      qold.Value = qnew;
+      if (qold.Value >= newQuality) return;
+      results[BestInfillSolutionResultName].Value = (RealVector)individuals[best].RealVector().Clone();
+      qold.Value = newQuality;
     }
+    public override IEnumerable<Individual> GetNeighbors(Individual individual, IRandom random) {
+      var bounds = Encoding.Bounds;
+      var michalewiczIteration = 0;
+      while (true) {
+        var neighbour = individual.Copy();
+        var r = neighbour.RealVector();
+        switch (random.Next(5)) {
+          case 0: UniformOnePositionManipulator.Apply(random, r, bounds); break;
+          case 1: UniformOnePositionManipulator.Apply(random, r, bounds); break;//FixedNormalAllPositionsManipulator.Apply(random, r, new RealVector(new[] { 0.1 })); break;
+          case 2: MichalewiczNonUniformAllPositionsManipulator.Apply(random, r, bounds, new IntValue(michalewiczIteration++), new IntValue(10000), new DoubleValue(5.0)); break;
+          case 3: MichalewiczNonUniformOnePositionManipulator.Apply(random, r, bounds, new IntValue(michalewiczIteration++), new IntValue(10000), new DoubleValue(5.0)); break;
+          case 4: BreederGeneticAlgorithmManipulator.Apply(random, r, bounds, new DoubleValue(0.1)); break;
+          default: throw new NotImplementedException();
+        }
+        yield return neighbour;
+        michalewiczIteration %= 10000;
+      }
+    }
+
+    public void Initialize(IRegressionSolution model, bool expensiveMaximization) {
+      infillCriterion.RegressionSolution = model;
+      infillCriterion.ExpensiveMaximization = expensiveMaximization;
+      infillCriterion.Encoding = Encoding;
+      infillCriterion.Initialize();
+    }
+
+    #region helpers
+    private static bool InBounds(RealVector r, DoubleMatrix bounds) {
+      return !r.Where((t, i) => t < bounds[i % bounds.Rows, 0] || t > bounds[i % bounds.Rows, 1]).Any();
+    }
+    #endregion
+
   }
 }
