Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/AdaptiveSamplingAlgorithm.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/AdaptiveSamplingAlgorithm.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/AdaptiveSamplingAlgorithm.cs	(revision 15064)
@@ -0,0 +1,538 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.EGO {
+  [Item("Adaptive Sampling Algorithm (EGO)", "An adaptive sampling algorithm.")]
+  [Creatable(CreatableAttribute.Categories.SingleSolutionAlgorithms, Priority = 150)]
+  [StorableClass]
+  public class AdaptiveSamplingAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
+    public string Filename { get; set; }
+
+    #region Problem Properties
+    public override Type ProblemType => typeof(IHeuristicOptimizationProblem);
+    private ISingleObjectiveHeuristicOptimizationProblem SingleObjectiveProblem => Problem as ISingleObjectiveHeuristicOptimizationProblem;
+    #endregion
+
+    #region Parameter Names
+    private const string InfillCriterionParameterName = "InfillCriterion";
+    private const string InitialEvaluationsParameterName = "Initial Evaluations";
+    private const string TerminatorParameterName = "Terminator";
+    private const string SeedParameterName = "Seed";
+    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
+    private const string RegressionAlgorithmParameterName = "RegressionAlgorithm";
+    private const string InfillOptimizationAlgorithmParameterName = "InfillOptimizationAlgorithm";
+    private const string AnalyzerParameterName = "Analyzers";
+    private const string RemoveDuplicatesParamterName = "PerturbDuplicates";
+    private const string MaxModelSizeParameterName = "Maximal Model Size";
+    #endregion
+
+    #region Parameter Properties
+    public IFixedValueParameter<IntValue> SeedParameter => (IFixedValueParameter<IntValue>)Parameters[SeedParameterName];
+    public IFixedValueParameter<BoolValue> SetSeedRandomlyParameter => (IFixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName];
+    public IFixedValueParameter<MultiTerminator> TerminatorParameter => (IFixedValueParameter<MultiTerminator>)Parameters[TerminatorParameterName];
+    public IFixedValueParameter<IntValue> InitialEvaluationsParameter => (IFixedValueParameter<IntValue>)Parameters[InitialEvaluationsParameterName];
+    public IConstrainedValueParameter<IInfillCriterion> InfillCriterionParameter => Parameters[InfillCriterionParameterName] as IConstrainedValueParameter<IInfillCriterion>;
+    public IValueParameter<Algorithm> InfillOptimizationAlgorithmParameter => Parameters[InfillOptimizationAlgorithmParameterName] as IValueParameter<Algorithm>;
+    public IValueParameter<IDataAnalysisAlgorithm<IRegressionProblem>> RegressionAlgorithmParameter => Parameters[RegressionAlgorithmParameterName] as IValueParameter<IDataAnalysisAlgorithm<IRegressionProblem>>;
+    private IFixedValueParameter<MultiAnalyzer> AnalyzerParameter => (IFixedValueParameter<MultiAnalyzer>)Parameters[AnalyzerParameterName];
+    public IFixedValueParameter<BoolValue> RemoveDuplicatesParameter => (IFixedValueParameter<BoolValue>)Parameters[RemoveDuplicatesParamterName];
+    public IFixedValueParameter<IntValue> MaxModelSizeParameter => (IFixedValueParameter<IntValue>)Parameters[MaxModelSizeParameterName];
+    #endregion
+
+    #region Properties
+    public int Seed => SeedParameter.Value.Value;
+    public bool SetSeedRandomly => SetSeedRandomlyParameter.Value.Value;
+    public MultiTerminator Terminator => TerminatorParameter.Value;
+    public MultiAnalyzer Analyzer => AnalyzerParameter.Value;
+    public int InitialEvaluations => InitialEvaluationsParameter.Value.Value;
+    public IInfillCriterion InfillCriterion => InfillCriterionParameter.Value;
+    public Algorithm InfillOptimizationAlgorithm => InfillOptimizationAlgorithmParameter.Value;
+    public IDataAnalysisAlgorithm<IRegressionProblem> RegressionAlgorithm => RegressionAlgorithmParameter.Value;
+    public bool RemoveDuplicates => RemoveDuplicatesParameter.Value.Value;
+    public int MaxModelSize => MaxModelSizeParameter.Value.Value;
+    #endregion
+
+    #region Helper Properties
+    private SolutionsCreator SolutionsCreator => OperatorGraph.Iterate().OfType<SolutionsCreator>().First();
+    #endregion
+
+    #region Preconfigured Analyzers
+    [Storable]
+    private BestAverageWorstQualityAnalyzer singleObjectiveQualityAnalyzer;
+    [Storable]
+    private CorrelationAnalyzer correlationAnalyzer;
+    [Storable]
+    private EvaluatedSolutionsAnalyzer sampleAnalyzer;
+    [Storable]
+    private ModelQualityAnalyzer modelAnalyzer;
+    [Storable]
+    private VariableVariabilityAnalyzer variabilityAnalyzer;
+    [Storable]
+    private FitnessClusteringAnalyzer fitnessClusterAnalyzer;
+    #endregion
+
+    #region Preconfigured Terminators
+    [Storable]
+    private ComparisonTerminator<IntValue> evaluationsTerminator;
+    [Storable]
+    private ExecutionTimeTerminator executionTimeTerminator;
+    [Storable]
+    private SingleObjectiveQualityTerminator qualityTerminator;
+    #endregion
+
+    #region Problem-dependent Operators
+    [Storable]
+    private SampleCollector sampleCollector;
+    [Storable]
+    private InfillSolver infillSolver;
+    [Storable]
+    private SolutionsCreator infillSolutionsCreator;
+    #endregion
+
+    #region Constructors
+    [StorableConstructor]
+    protected AdaptiveSamplingAlgorithm(bool deserializing) : base(deserializing) { }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      Initialize();
+    }
+    protected AdaptiveSamplingAlgorithm(AdaptiveSamplingAlgorithm original, Cloner cloner) : base(original, cloner) {
+      singleObjectiveQualityAnalyzer = cloner.Clone(original.singleObjectiveQualityAnalyzer);
+      evaluationsTerminator = cloner.Clone(original.evaluationsTerminator);
+      qualityTerminator = cloner.Clone(original.qualityTerminator);
+      executionTimeTerminator = cloner.Clone(original.executionTimeTerminator);
+      sampleCollector = cloner.Clone(original.sampleCollector);
+      infillSolver = cloner.Clone(original.infillSolver);
+      infillSolutionsCreator = cloner.Clone(original.infillSolutionsCreator);
+      correlationAnalyzer = cloner.Clone(original.correlationAnalyzer);
+      sampleAnalyzer = cloner.Clone(original.sampleAnalyzer);
+      modelAnalyzer = cloner.Clone(original.modelAnalyzer);
+      fitnessClusterAnalyzer = cloner.Clone(original.fitnessClusterAnalyzer);
+      Initialize();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AdaptiveSamplingAlgorithm(this, cloner);
+    }
+    public AdaptiveSamplingAlgorithm() {
+
+      #region Add parameters
+      var criteria = new ItemSet<IInfillCriterion> {
+        new AugmentedExpectedImprovement(),
+        new ExpectedImprovement(),
+        new ExpectedQuality(),
+        new ExpectedQuantileImprovement(),
+        new MinimalQuantileCriterium(),
+        new NeighbourDistance(),
+        new PluginExpectedImprovement()
+      };
+      var cmaes = new CMAEvolutionStrategy.CMAEvolutionStrategy {
+        MaximumGenerations = 300,
+        PopulationSize = 50,
+        Problem = new InfillProblem()
+      };
+      var model = new GaussianProcessRegression {
+        Problem = new RegressionProblem()
+      };
+      model.CovarianceFunctionParameter.Value = new CovarianceRationalQuadraticIso();
+
+      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator()));
+      Parameters.Add(new FixedValueParameter<MultiAnalyzer>(AnalyzerParameterName, "The operator used to analyze the solutions each iteration.", new MultiAnalyzer()));
+      Parameters.Add(new FixedValueParameter<IntValue>(InitialEvaluationsParameterName, "The number of random solutions that are evaluated (in parallel) per iteration.", new IntValue(100)));
+      Parameters.Add(new ConstrainedValueParameter<IInfillCriterion>(InfillCriterionParameterName, "Decision what value should decide the next sample", criteria, criteria.OfType<ExpectedImprovement>().Single()));
+      Parameters.Add(new ValueParameter<IDataAnalysisAlgorithm<IRegressionProblem>>(RegressionAlgorithmParameterName, "The model used to approximate the problem", model));
+      Parameters.Add(new ValueParameter<Algorithm>(InfillOptimizationAlgorithmParameterName, "The algorithm used to solve the expected improvement subproblem", cmaes));
+      Parameters.Add(new FixedValueParameter<BoolValue>(RemoveDuplicatesParamterName, "Whether (almost) duplicate points in the dataset should be perturbed before evaluation (this greatly increases numerical stability for some model types)", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<IntValue>("Maximal Model Size", "The maximum number of sample points used to build the model", new IntValue(-1)));
+      #endregion
+
+      #region Create operators
+      var randomCreator = new RandomCreator();
+      var variableCreator = new VariableCreator { Name = "Initialize Variables" };
+      var resultsCollector = new ResultsCollector();
+      var solutionCreator = new SolutionsCreator { Name = "Create Initial Solutions" };
+      var analyzerPlaceholder = new Placeholder { Name = "Analyzer (Placeholder)" };
+      var evaluationsCounter = new IntCounter { Name = "Increment EvaluatedSolutions" };
+      var solutionsCollectorProcessor = new UniformSubScopesProcessor { Name = "Collect Samples to Dataset" };
+      var phaseChecker = new ConditionalBranch { Name = "Inital Samples evaluated?" };
+      var initialPhaseChecker = new Comparator { Name = "Compare Initial Samples to evaluated Solutions" };
+      var modelbuilder = new ModelBuilder { Name = "Build Model" };
+      sampleCollector = new SampleCollector { Name = "Collect Sample" };
+      infillSolutionsCreator = new SolutionsCreator { Name = "Create Adaptive Solutions" };
+      infillSolver = new InfillSolver();
+      var subScopesRemover = new SubScopesRemover();
+      var iterationsCounter = new IntCounter { Name = "Increment Iterations" };
+      var terminationOperator = new TerminationOperator();
+      #endregion
+
+      #region Wire operators
+      const string iterationsVariableName = "Iterations";
+      const string evaluatedSolutionsVariableName = "EvaluatedSolutions";
+      const string datasetVariableName = "SampleSet";
+      const string modelVariableName = "Model";
+      const string initialPhaseVariableName = "InitialPhase";
+      const string infillBoundsVariableName = "InfillBounds";
+
+      OperatorGraph.InitialOperator = randomCreator;
+
+      randomCreator.SeedParameter.Value = null;
+      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
+      randomCreator.SetSeedRandomlyParameter.Value = null;
+      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
+      randomCreator.Successor = variableCreator;
+
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>(iterationsVariableName, new IntValue(0)));
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>(evaluatedSolutionsVariableName, new IntValue(0)));
+      variableCreator.CollectedValues.Add(new ValueParameter<ModifiableDataset>(datasetVariableName, new ModifiableDataset()));
+      variableCreator.CollectedValues.Add(new ValueParameter<IRegressionSolution>(modelVariableName, "The regression solution representing the model for EGO", null));
+      variableCreator.CollectedValues.Add(new FixedValueParameter<BoolValue>(initialPhaseVariableName, new BoolValue(false)));
+      variableCreator.CollectedValues.Add(new ValueParameter<DoubleMatrix>(infillBoundsVariableName));
+      variableCreator.Successor = resultsCollector;
+
+      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>(iterationsVariableName, "The current iteration number."));
+      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>(evaluatedSolutionsVariableName, "The current number of evaluated solutions."));
+      resultsCollector.CollectedValues.Add(new LookupParameter<ModifiableDataset>(datasetVariableName, "A dataset containing all evaluated solutions"));
+      resultsCollector.Successor = phaseChecker;
+
+      phaseChecker.ConditionParameter.ActualName = initialPhaseVariableName;
+      phaseChecker.FalseBranch = solutionCreator;
+      phaseChecker.TrueBranch = modelbuilder;
+
+      #region Adaptive Phase
+      modelbuilder.DatasetParameter.ActualName = datasetVariableName;
+      modelbuilder.ModelParameter.ActualName = modelVariableName;
+      modelbuilder.RegressionAlgorithmParameter.ActualName = RegressionAlgorithmParameter.Name;
+      ParameterizeStochasticOperator(modelbuilder);
+      modelbuilder.Successor = infillSolutionsCreator;
+      modelbuilder.MaxModelSizeParameter.ActualName = MaxModelSizeParameter.Name;
+
+      infillSolutionsCreator.SolutionCreatorParameter.Value = infillSolver;
+      infillSolutionsCreator.Successor = evaluationsCounter;
+      infillSolutionsCreator.NumberOfSolutionsParameter.Value = new IntValue(1);
+
+      infillSolver.InfillOptimizationAlgorithmParamter.ActualName = InfillOptimizationAlgorithmParameterName;
+      infillSolver.ModelParameter.ActualName = modelVariableName;
+      infillSolver.RemoveDuplicatesParameter.ActualName = RemoveDuplicatesParameter.Name;
+      infillSolver.InfillBoundsParameter.ActualName = infillBoundsVariableName;
+      #endregion
+
+      #region Initial Phase 
+      solutionCreator.NumberOfSolutionsParameter.Value = new IntValue(1);
+      solutionCreator.ParallelParameter.Value.Value = true;
+      solutionCreator.Successor = evaluationsCounter;
+      #endregion
+
+      evaluationsCounter.ValueParameter.ActualName = evaluatedSolutionsVariableName;
+      evaluationsCounter.Increment = null;
+      evaluationsCounter.IncrementParameter.Value = new IntValue(1);
+      evaluationsCounter.Successor = initialPhaseChecker;
+
+      initialPhaseChecker.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
+      initialPhaseChecker.LeftSideParameter.ActualName = evaluatedSolutionsVariableName;
+      initialPhaseChecker.RightSideParameter.ActualName = InitialEvaluationsParameterName;
+      initialPhaseChecker.ResultParameter.ActualName = initialPhaseVariableName;
+      initialPhaseChecker.Successor = analyzerPlaceholder;
+
+      analyzerPlaceholder.OperatorParameter.ActualName = AnalyzerParameter.Name;
+      analyzerPlaceholder.Successor = solutionsCollectorProcessor;
+
+      solutionsCollectorProcessor.Operator = sampleCollector;
+      solutionsCollectorProcessor.Depth.Value = 1;
+      solutionsCollectorProcessor.Successor = subScopesRemover;
+
+      sampleCollector.DatasetParameter.ActualName = datasetVariableName;
+
+      subScopesRemover.RemoveAllSubScopes = true;
+      subScopesRemover.Successor = iterationsCounter;
+
+      iterationsCounter.ValueParameter.ActualName = "Iterations";
+      iterationsCounter.Increment = new IntValue(1);
+      iterationsCounter.Successor = terminationOperator;
+
+
+
+      terminationOperator.TerminatorParameter.ActualName = TerminatorParameter.Name;
+      terminationOperator.ContinueBranch = phaseChecker;
+
+      #endregion
+
+      #region Create analyzers
+      singleObjectiveQualityAnalyzer = new BestAverageWorstQualityAnalyzer();
+      correlationAnalyzer = new CorrelationAnalyzer();
+      correlationAnalyzer.ModelParameter.ActualName = modelVariableName;
+
+      sampleAnalyzer = new EvaluatedSolutionsAnalyzer();
+      sampleAnalyzer.PhaseParameter.ActualName = initialPhaseVariableName;
+
+      modelAnalyzer = new ModelQualityAnalyzer();
+      modelAnalyzer.ModelParameter.ActualName = modelVariableName;
+
+      variabilityAnalyzer = new VariableVariabilityAnalyzer();
+      variabilityAnalyzer.DatasetParameter.ActualName = datasetVariableName;
+      variabilityAnalyzer.InitialEvaluationsParameter.ActualName = InitialEvaluationsParameter.Name;
+
+      fitnessClusterAnalyzer = new FitnessClusteringAnalyzer();
+      fitnessClusterAnalyzer.DatasetParameter.ActualName = datasetVariableName;
+      #endregion
+
+      #region Create terminators
+
+      evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less,
+        new IntValue(1000)) { Name = "Evaluated solutions." };
+      qualityTerminator = new SingleObjectiveQualityTerminator { Name = "Quality" };
+      executionTimeTerminator = new ExecutionTimeTerminator(this, new TimeSpanValue(TimeSpan.FromMinutes(5)));
+
+      #endregion
+
+      #region Parameterize
+      UpdateAnalyzers();
+      ParameterizeAnalyzers();
+      UpdateTerminators();
+      #endregion
+
+      Initialize();
+    }
+    #endregion
+
+    private void Initialize() {
+      if (SingleObjectiveProblem != null) {
+        SingleObjectiveProblem.Evaluator.QualityParameter.ActualNameChanged +=
+         Evaluator_QualityParameter_ActualNameChanged;
+      }
+
+      singleObjectiveQualityAnalyzer.CurrentBestQualityParameter.NameChanged +=
+        QualityAnalyzer_CurrentBestQualityParameter_NameChanged;
+      RegisterParameterEvents();
+    }
+
+    #region Parameterization
+    private void ParameterizeTerminators() {
+      if (SingleObjectiveProblem != null)
+        qualityTerminator.Parameterize(singleObjectiveQualityAnalyzer.CurrentBestQualityParameter,
+          SingleObjectiveProblem);
+    }
+    private void ParameterizeAnalyzers() {
+      //TODO how to guarantee ResultsParameters and QualityParameters are really there? This seems hardcoded
+      singleObjectiveQualityAnalyzer.ResultsParameter.ActualName = "Results";
+      singleObjectiveQualityAnalyzer.ResultsParameter.Hidden = true;
+      singleObjectiveQualityAnalyzer.QualityParameter.Depth = 1;
+      correlationAnalyzer.ResultsParameter.ActualName = "Results";
+      correlationAnalyzer.ResultsParameter.Hidden = true;
+      correlationAnalyzer.QualityParameter.Depth = 1;
+      correlationAnalyzer.RealVectorParameter.Depth = 1;
+      sampleAnalyzer.ResultsParameter.ActualName = "Results";
+      sampleAnalyzer.ResultsParameter.Hidden = true;
+      sampleAnalyzer.QualityParameter.Depth = 1;
+      sampleAnalyzer.RealVectorParameter.Depth = 1;
+      modelAnalyzer.ResultsParameter.ActualName = "Results";
+      modelAnalyzer.ResultsParameter.Hidden = true;
+      fitnessClusterAnalyzer.ResultsParameter.ActualName = "Results";
+      fitnessClusterAnalyzer.ResultsParameter.Hidden = true;
+
+
+      if (SingleObjectiveProblem == null) return;
+      singleObjectiveQualityAnalyzer.MaximizationParameter.ActualName = SingleObjectiveProblem.MaximizationParameter.Name;
+      singleObjectiveQualityAnalyzer.MaximizationParameter.Hidden = true;
+      singleObjectiveQualityAnalyzer.QualityParameter.ActualName = SingleObjectiveProblem.Evaluator.QualityParameter.ActualName;
+      singleObjectiveQualityAnalyzer.QualityParameter.Hidden = true;
+      singleObjectiveQualityAnalyzer.BestKnownQualityParameter.ActualName = SingleObjectiveProblem.BestKnownQualityParameter.Name;
+      singleObjectiveQualityAnalyzer.BestKnownQualityParameter.Hidden = true;
+      correlationAnalyzer.QualityParameter.ActualName = SingleObjectiveProblem.Evaluator.QualityParameter.ActualName;
+      correlationAnalyzer.QualityParameter.Hidden = true;
+      sampleAnalyzer.QualityParameter.ActualName = SingleObjectiveProblem.Evaluator.QualityParameter.ActualName;
+      sampleAnalyzer.QualityParameter.Hidden = true;
+    }
+    private void ParameterizeSolutionsCreators() {
+      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
+      infillSolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+    }
+    private void ParameterizeStochasticOperator(IOperator @operator) {
+      var stochasticOperator = @operator as IStochasticOperator;
+      if (stochasticOperator == null) return;
+      stochasticOperator.RandomParameter.ActualName = "Random";
+      stochasticOperator.RandomParameter.Hidden = true;
+    }
+    private void ParameterizeProblemSpecificOperators() {
+      if (SingleObjectiveProblem == null) throw new ArgumentException("Adaptive sampling requires a single objective problem");
+      infillSolver.MaximizationParameter.ActualName = SingleObjectiveProblem.MaximizationParameter.Name;
+      var rcreator = Problem.SolutionCreator as IRealVectorCreator;
+      if (rcreator == null) throw new ArgumentException("Adaptive sampling requires real vectors as solution candidates");
+      infillSolver.LengthParameter.ActualName = rcreator.LengthParameter.ActualName;
+      infillSolver.BoundsParameter.ActualName = rcreator.BoundsParameter.ActualName;
+      // if (rcreator.LengthParameter.Value != null)
+      infillSolver.LengthParameter.Value = rcreator.LengthParameter.Value;
+      // if (rcreator.BoundsParameter.Value != null)
+      infillSolver.BoundsParameter.Value = rcreator.BoundsParameter.Value;
+      infillSolver.RealVectorParameter.ActualName = rcreator.RealVectorParameter.ActualName;
+
+      sampleCollector.RealVectorParameter.ActualName = rcreator.RealVectorParameter.ActualName;
+      sampleCollector.QualityParameter.ActualName = SingleObjectiveProblem.Evaluator.QualityParameter.ActualName;
+
+      correlationAnalyzer.RealVectorParameter.ActualName = rcreator.RealVectorParameter.ActualName;
+      sampleAnalyzer.RealVectorParameter.ActualName = rcreator.RealVectorParameter.ActualName;
+    }
+    #endregion
+
+    public override void Start() {
+      ParameterizeProblemSpecificOperators();
+      ((InfillProblem)InfillOptimizationAlgorithm.Problem).InfillCriterion = InfillCriterion;
+      base.Start();
+    }
+    public override void Stop() {
+      if (InfillOptimizationAlgorithm.ExecutionState == ExecutionState.Started || InfillOptimizationAlgorithm.ExecutionState == ExecutionState.Paused)
+        InfillOptimizationAlgorithm.Stop();
+      if (RegressionAlgorithm.ExecutionState == ExecutionState.Started || RegressionAlgorithm.ExecutionState == ExecutionState.Paused)
+        RegressionAlgorithm.Stop();
+      base.Stop();
+    }
+    public override void Pause() {
+      if (InfillOptimizationAlgorithm.ExecutionState == ExecutionState.Started) InfillOptimizationAlgorithm.Pause();
+      if (RegressionAlgorithm.ExecutionState == ExecutionState.Started) RegressionAlgorithm.Pause();
+      base.Pause();
+    }
+
+    #region events
+    private void RegisterParameterEvents() {
+      InfillOptimizationAlgorithmParameter.ValueChanged += OnInfillAlgorithmChanged;
+      InfillOptimizationAlgorithm.ProblemChanged += OnInfillProblemChanged;
+      InfillCriterionParameter.ValueChanged += OnInfillCriterionChanged;
+    }
+    private void OnInfillCriterionChanged(object sender, EventArgs e) {
+      ((InfillProblem)InfillOptimizationAlgorithm.Problem).InfillCriterion = InfillCriterion;
+    }
+    private void OnInfillAlgorithmChanged(object sender, EventArgs e) {
+      InfillOptimizationAlgorithm.Problem = new InfillProblem { InfillCriterion = InfillCriterion };
+      InfillOptimizationAlgorithm.ProblemChanged -= OnInfillProblemChanged; //avoid double attaching
+      InfillOptimizationAlgorithm.ProblemChanged += OnInfillProblemChanged;
+    }
+    private void OnInfillProblemChanged(object sender, EventArgs e) {
+      //enforce an infill problem for the infill optimization algorithm
+      InfillOptimizationAlgorithm.ProblemChanged -= OnInfillProblemChanged;
+      InfillOptimizationAlgorithm.Problem = new InfillProblem { InfillCriterion = InfillCriterion };
+      InfillOptimizationAlgorithm.ProblemChanged += OnInfillProblemChanged;
+    }
+    protected override void OnProblemChanged() {
+      base.OnProblemChanged();
+      ParameterizeStochasticOperator(Problem.SolutionCreator);
+      foreach (var @operator in Problem.Operators.OfType<IOperator>())
+        ParameterizeStochasticOperator(@operator);
+
+      //TODO ParameterizeIterationBasedOperators();
+
+      ParameterizeSolutionsCreators();
+      ParameterizeAnalyzers();
+      ParameterizeTerminators();
+
+      if (SingleObjectiveProblem != null)
+        SingleObjectiveProblem.Evaluator.QualityParameter.ActualNameChanged +=
+          Evaluator_QualityParameter_ActualNameChanged;
+
+      UpdateAnalyzers();
+      UpdateTerminators();
+    }
+    protected override void RegisterProblemEvents() {
+      base.RegisterProblemEvents();
+      var maximizationParameter = (IValueParameter<BoolValue>)SingleObjectiveProblem?.MaximizationParameter;
+      if (maximizationParameter != null) maximizationParameter.ValueChanged += MaximizationParameter_ValueChanged;
+
+    }
+    protected override void DeregisterProblemEvents() {
+      var maximizationParameter = (IValueParameter<BoolValue>)SingleObjectiveProblem?.MaximizationParameter;
+      if (maximizationParameter != null) maximizationParameter.ValueChanged -= MaximizationParameter_ValueChanged;
+      base.DeregisterProblemEvents();
+    }
+    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
+      base.Problem_SolutionCreatorChanged(sender, e);
+      ParameterizeStochasticOperator(Problem.SolutionCreator);
+
+      if (SingleObjectiveProblem != null) SingleObjectiveProblem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
+
+      ParameterizeSolutionsCreators();
+      ParameterizeAnalyzers();
+    }
+    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
+      base.Problem_EvaluatorChanged(sender, e);
+      foreach (var @operator in Problem.Operators.OfType<IOperator>())
+        ParameterizeStochasticOperator(@operator);
+
+      UpdateAnalyzers();
+
+      ParameterizeSolutionsCreators();
+    }
+    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
+      base.Problem_OperatorsChanged(sender, e);
+      //TODO ParameterizeIterationBasedOperators();
+      UpdateTerminators();
+    }
+    private void MaximizationParameter_ValueChanged(object sender, EventArgs e) {
+      ParameterizeTerminators();
+    }
+    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
+      ParameterizeAnalyzers();
+    }
+    private void QualityAnalyzer_CurrentBestQualityParameter_NameChanged(object sender, EventArgs e) {
+      ParameterizeTerminators();
+    }
+    #endregion
+
+    #region Updates
+    private void UpdateAnalyzers() {
+      Analyzer.Operators.Clear();
+      if (Problem == null) return;
+      if (SingleObjectiveProblem != null) {
+        Analyzer.Operators.Add(singleObjectiveQualityAnalyzer, singleObjectiveQualityAnalyzer.EnabledByDefault);
+        Analyzer.Operators.Add(correlationAnalyzer, correlationAnalyzer.EnabledByDefault);
+        Analyzer.Operators.Add(sampleAnalyzer, sampleAnalyzer.EnabledByDefault);
+        Analyzer.Operators.Add(modelAnalyzer, modelAnalyzer.EnabledByDefault);
+        Analyzer.Operators.Add(variabilityAnalyzer, variabilityAnalyzer.EnabledByDefault);
+        Analyzer.Operators.Add(fitnessClusterAnalyzer, fitnessClusterAnalyzer.EnabledByDefault);
+      }
+      foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>())
+        Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
+    }
+    private void UpdateTerminators() {
+      var newTerminators = new Dictionary<ITerminator, bool> {
+        {
+          evaluationsTerminator,
+          !Terminator.Operators.Contains(evaluationsTerminator) ||
+          Terminator.Operators.ItemChecked(evaluationsTerminator)
+        }, {
+          executionTimeTerminator,
+          Terminator.Operators.Contains(executionTimeTerminator) &&
+          Terminator.Operators.ItemChecked(executionTimeTerminator)
+        }
+      };
+      if (Problem != null) {
+        if (SingleObjectiveProblem != null)
+          newTerminators.Add(qualityTerminator,
+            Terminator.Operators.Contains(qualityTerminator) && Terminator.Operators.ItemChecked(qualityTerminator));
+        foreach (var terminator in Problem.Operators.OfType<ITerminator>())
+          newTerminators.Add(terminator,
+            !Terminator.Operators.Contains(terminator) || Terminator.Operators.ItemChecked(terminator));
+      }
+
+      Terminator.Operators.Clear();
+      foreach (var newTerminator in newTerminators)
+        Terminator.Operators.Add(newTerminator.Key, newTerminator.Value);
+    }
+    #endregion
+
+  }
+
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EfficientGlobalOptimizationAlgorithm.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EfficientGlobalOptimizationAlgorithm.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EfficientGlobalOptimizationAlgorithm.cs	(revision 15064)
@@ -24,5 +24,4 @@
 using System.Linq;
 using System.Threading;
-using System.Windows.Forms;
 using HeuristicLab.Algorithms.DataAnalysis;
 using HeuristicLab.Analysis;
@@ -35,6 +34,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Problems.DataAnalysis;
-using HeuristicLab.Problems.Instances.DataAnalysis;
-using HeuristicLab.Problems.Instances.DataAnalysis.Views;
+using HeuristicLab.Problems.Instances;
 using HeuristicLab.Random;
 
@@ -42,5 +40,5 @@
   [StorableClass]
   [Creatable(CreatableAttribute.Categories.Algorithms, Priority = 95)]
-  [Item("EfficientGlobalOptimizationAlgortihm", "Solves a problem by sequentially learning a model, solving a subproblem on the model and evaluating the best found solution for this subproblem.")]
+  [Item("EfficientGlobalOptimizationAlgorithm", "Solves a problem by sequentially learning a model, solving a subproblem on the model and evaluating the best found solution for this subproblem.")]
   public class EfficientGlobalOptimizationAlgorithm : BasicAlgorithm, ISurrogateAlgorithm<RealVector> {
     #region Basic-Alg-Essentials
@@ -84,9 +82,4 @@
     #endregion
 
-    #region TransmissionResultNames
-    public const string BestInfillSolutionResultName = "BestInfillSolution";
-    public const string BestInfillQualityResultName = "BestInfillQuality";
-    #endregion
-
     #region ParameterProperties
     public IFixedValueParameter<IntValue> GenerationSizeParemeter => Parameters[GenerationSizeParameterName] as IFixedValueParameter<IntValue>;
@@ -108,5 +101,4 @@
 
     #region Properties
-
     public int GenerationSize => GenerationSizeParemeter.Value.Value;
     public IInfillCriterion InfillCriterion => InfillCriterionParameter.Value;
@@ -123,5 +115,4 @@
       ? Samples.Skip(Samples.Count - MaximalDatasetSize)
       : Samples;
-
     private bool RemoveDuplicates => RemoveDuplicatesParameter.Value.Value;
     private RealVector BaselineVector => BaselineVectorParameter.Value;
@@ -161,9 +152,6 @@
     private DataTable ResultsQualities => (DataTable)Results[QualitiesChartResultName].Value;
     private DataRow ResultsQualitiesBest => ResultsQualities.Rows[BestQualitiesRowResultName];
-
     private DataRow ResultsQualitiesWorst => ResultsQualities.Rows[WorstQualitiesRowResultName];
-
     private DataRow ResultsQualitiesIteration => ResultsQualities.Rows[CurrentQualitiesRowResultName];
-
     private IRegressionSolution ResultsModel
     {
@@ -177,16 +165,20 @@
     protected EfficientGlobalOptimizationAlgorithm(bool deserializing) : base(deserializing) { }
     [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeseialization() {
+    protected void AfterDeseialization() {
       RegisterEventhandlers();
     }
-    protected EfficientGlobalOptimizationAlgorithm(EfficientGlobalOptimizationAlgorithm original, Cloner cloner)
-      : base(original, cloner) {
+    protected EfficientGlobalOptimizationAlgorithm(EfficientGlobalOptimizationAlgorithm original, Cloner cloner) : base(original, cloner) {
       Random = cloner.Clone(Random);
       if (original.Samples != null) Samples = original.Samples.Select(x => new Tuple<RealVector, double>(cloner.Clone(x.Item1), x.Item2)).ToList();
-      if (original.InitialSamples != null) Samples = original.InitialSamples.Select(x => new Tuple<RealVector, double>(cloner.Clone(x.Item1), x.Item2)).ToList();
+      if (original.InitialSamples != null) InitialSamples = original.InitialSamples.Select(x => new Tuple<RealVector, double>(cloner.Clone(x.Item1), x.Item2)).ToList();
       RegisterEventhandlers();
     }
     public override IDeepCloneable Clone(Cloner cloner) { return new EfficientGlobalOptimizationAlgorithm(this, cloner); }
     public EfficientGlobalOptimizationAlgorithm() {
+      IProblemInstanceExporter dummy = new RegressionProblem(); //this variable is irrelevant
+      //the dummy variable enforces a using-Statement for HeuristicLab.Problems.Instances
+      //"new ValueParameter<IDataAnalysisAlgorithm<IRegressionProblem>>" requires no using using-Statement, but nontheless it requires HeuristicLab.Problems.Instances to be referenced  
+      //Having HeuristicLab.Problems.Instances referenced but not used, causes the Essential-Unit-tests to fail. 
+
       var cmaes = new CMAEvolutionStrategy.CMAEvolutionStrategy {
         MaximumGenerations = 300,
@@ -206,26 +198,21 @@
       Parameters.Add(new FixedValueParameter<IntValue>(InfillOptimizationRestartsParameterName, "Number of restarts of the SubAlgortihm to avoid local optima", new IntValue(1)));
       Parameters.Add(new FixedValueParameter<IntValue>(GenerationSizeParameterName, "Number points that are sampled every iteration (stadard EGO: 1)", new IntValue(1)));
-      Parameters.Add(new ConstrainedValueParameter<IInfillCriterion>(InfillCriterionParameterName, "Decision what value should decide the next sample"));
-      InfillCriterionParameter.ValidValues.Add(new ExpectedImprovement());
-      InfillCriterionParameter.ValidValues.Add(new AugmentedExpectedImprovement());
-      InfillCriterionParameter.ValidValues.Add(new ExpectedQuality());
-      var eqi = new ExpectedQuantileImprovement();
-      InfillCriterionParameter.ValidValues.Add(eqi);
-      eqi.MaxEvaluationsParameter.Value = MaximumEvaluationsParameter.Value;
-      InfillCriterionParameter.ValidValues.Add(new MinimalQuantileCriterium());
-      InfillCriterionParameter.ValidValues.Add(new RobustImprovement());
-      InfillCriterionParameter.ValidValues.Add(new PluginExpectedImprovement());
       Parameters.Add(new FixedValueParameter<IntValue>(MaximalDataSetSizeParameterName, "The maximum number of sample points used to generate the model. Set 0 or less to use always all samples ", new IntValue(-1)));
       Parameters.Add(new FixedValueParameter<BoolValue>(RemoveDuplicatesParamterName, "Wether duplicate samples should be replaced by a single sample with an averaged quality. This GREATLY decreases the chance of ill conditioned models (unbuildable models) but is not theoretically sound as the model ignores the increasing certainty in this region"));
       Parameters.Add(new FixedValueParameter<FileValue>(InitialSamplesParameterName, "The file specifying some initial samples used to jump start the algorithm. These samples are not counted as evaluations. If InitialEvaluations is more than the samples specified in the file, the rest is uniformly random generated and evaluated.", new FileValue()));
       Parameters.Add(new ValueParameter<RealVector>(BaselineVectorParameterName, "A vector used to create a baseline, this vector is evaluated once and is not part of the modeling process (has no influence on algorithm performance)"));
-      var intialSamplingPlans = new ItemSet<IInitialSampling> { new UniformRandomSampling(), new LatinHyperCubeDesign() };
-      Parameters.Add(new ConstrainedValueParameter<IInitialSampling>(InitialSamplingPlanParamterName, intialSamplingPlans, intialSamplingPlans.First()));
-
+      var eqi = new ExpectedQuantileImprovement();
+      eqi.MaxEvaluationsParameter.Value = MaximumEvaluationsParameter.Value;
+      var criteria = new ItemSet<IInfillCriterion> { new ExpectedImprovement(), new AugmentedExpectedImprovement(), new ExpectedQuality(), eqi, new MinimalQuantileCriterium(), new PluginExpectedImprovement() };
+      Parameters.Add(new ConstrainedValueParameter<IInfillCriterion>(InfillCriterionParameterName, "Decision what value should decide the next sample", criteria, criteria.First()));
+      var intialSamplingPlans = new ItemSet<IInitialSampling> { new UniformRandomSampling(), new LatinHyperCubeDesignCreator() };
+      Parameters.Add(new ConstrainedValueParameter<IInitialSampling>(InitialSamplingPlanParamterName, "Determies the initial samples from which the first model can be built.", intialSamplingPlans, intialSamplingPlans.First()));
       SetInfillProblem();
       RegisterEventhandlers();
     }
     #endregion
-
+    public void SetInitialSamples(RealVector[] individuals, double[] qualities) {
+      InitialSamples = individuals.Zip(qualities, (individual, d) => new Tuple<RealVector, double>(individual, d)).ToList();
+    }
     protected override void Initialize(CancellationToken cancellationToken) {
       base.Initialize(cancellationToken);
@@ -235,6 +222,4 @@
       var infillProblem = InfillOptimizationAlgorithm.Problem as InfillProblem;
       if (infillProblem == null) throw new ArgumentException("InfillOptimizationAlgorithm has no InfillProblem. Troubles with Eventhandling?");
-      infillProblem.Problem = Problem;
-
 
       //random
@@ -259,5 +244,4 @@
 
     }
-
     protected override void Run(CancellationToken cancellationToken) {
       //initial samples
@@ -294,8 +278,4 @@
     }
 
-    public void SetInitialSamples(RealVector[] individuals, double[] qualities) {
-      InitialSamples = individuals.Zip(qualities, (individual, d) => new Tuple<RealVector, double>(individual, d)).ToList();
-    }
-
     #region Eventhandling
     private void RegisterEventhandlers() {
@@ -318,5 +298,4 @@
     private void OnInfillOptimizationAlgorithmChanged(object sender, EventArgs args) {
       SetInfillProblem();
-      InfillOptimizationAlgorithm.ProblemChanged -= InfillOptimizationProblemChanged;
       InfillOptimizationAlgorithm.ProblemChanged += InfillOptimizationProblemChanged;
     }
@@ -334,30 +313,5 @@
       RegressionAlgorithm.Problem = new RegressionProblem();
     }
-    private void OnInitialSamplesChanged(object sender, EventArgs args) {
-      IRegressionProblemData samplesData = null;
-      using (var importTypeDialog = new RegressionImportTypeDialog()) {
-        if (importTypeDialog.ShowDialog() != DialogResult.OK) return;
-        samplesData = new RegressionCSVInstanceProvider().ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
-        InitialSamplesParameter.ToStringChanged -= OnInitialSamplesChanged;
-        InitialSamplesParameter.Value.Value = importTypeDialog.Path;
-        InitialSamplesParameter.ToStringChanged -= OnInitialSamplesChanged;
-
-      }
-
-
-
-      var solutions = new RealVector[samplesData.Dataset.Rows];
-      var qualities = new double[samplesData.Dataset.Rows];
-      var inputVariables = samplesData.InputVariables.CheckedItems.ToArray();
-      for (var i = 0; i < solutions.Length; i++) {
-        qualities[i] = samplesData.Dataset.GetDoubleValue(samplesData.TargetVariable, i);
-        solutions[i] = new RealVector(inputVariables.Length);
-        for (var j = 0; j < inputVariables.Length; j++) solutions[i][j] = samplesData.Dataset.GetDoubleValue(inputVariables[j].Value.Value, i);
-      }
-
-      SetInitialSamples(solutions, qualities);
-
-    }
-
+    private void OnInitialSamplesChanged(object sender, EventArgs args) { }
     protected override void OnExecutionTimeChanged() {
       base.OnExecutionTimeChanged();
@@ -376,20 +330,7 @@
       base.Stop();
     }
-    protected override void OnProblemChanged() {
-      base.OnProblemChanged();
-      var infillProblem = InfillOptimizationAlgorithm.Problem as InfillProblem;
-      if (infillProblem == null) throw new ArgumentException("InfillOptimizationAlgorithm has no InfillProblem. Troubles with Eventhandling?");
-      infillProblem.Problem = Problem;
-    }
     #endregion
 
     #region helpers
-    private void SetInfillProblem() {
-      var infillProblem = new InfillProblem {
-        InfillCriterion = InfillCriterion,
-        Problem = Problem
-      };
-      InfillOptimizationAlgorithm.Problem = infillProblem;
-    }
     private IRegressionSolution BuildModel(CancellationToken cancellationToken) {
       var dataset = EgoUtilities.GetDataSet(DataSamples.ToList(), RemoveDuplicates);
@@ -406,5 +347,5 @@
       IRegressionSolution solution = null;
 
-      while (solution == null && i++ < 100) {  //TODO: Question: Why does GP degenerate to NaN so often? Answer: There is not even the slightest mitigation strategy for "almost duplicates" that ill-condition the covariance matrix.
+      while (solution == null && i++ < 100) {
         var results = EgoUtilities.SyncRunSubAlgorithm(RegressionAlgorithm, Random.Next(int.MaxValue));
         solution = results.Select(x => x.Value).OfType<IRegressionSolution>().SingleOrDefault();
@@ -451,12 +392,15 @@
       //parameterize and check InfillProblem
       var infillProblem = InfillOptimizationAlgorithm.Problem as InfillProblem;
-      if (infillProblem == null) throw new ArgumentException("InfillOptimizationAlgorithm does not have InfillProblem. Problem with Eventhandling?");
-      if (infillProblem.InfillCriterion != InfillCriterion) throw new ArgumentException("InfillCiriterion for Problem is not correct. Problem with Eventhandling?");
-      if (infillProblem.Problem != Problem) throw new ArgumentException("Expensive real problem is not correctly set in InfillProblem. Problem with Eventhandling?");
-      InfillCriterion.Initialize(ResultsModel, Problem.Maximization, infillProblem.Encoding);
+      if (infillProblem == null) throw new ArgumentException("InfillOptimizationAlgorithm does not have an InfillProblem.");
+      if (infillProblem.InfillCriterion != InfillCriterion) throw new ArgumentException("InfillCiriterion for Problem is not correctly set.");
+      var enc = Problem.Encoding as RealVectorEncoding;
+      infillProblem.Encoding.Bounds = enc.Bounds;
+      infillProblem.Encoding.Length = enc.Length;
+      infillProblem.Initialize(ResultsModel, Problem.Maximization);
+
+
 
       RealVector bestVector = null;
       var bestValue = infillProblem.Maximization ? double.NegativeInfinity : double.PositiveInfinity;
-
       for (var i = 0; i < InfillOptimizationRestarts; i++) {
         //optimize
@@ -464,10 +408,9 @@
         cancellationToken.ThrowIfCancellationRequested();
         //extract results
-        if (!res.ContainsKey(BestInfillSolutionResultName)) throw new ArgumentException("The InfillOptimizationAlgorithm did not return a best solution");
-        var v = res[BestInfillSolutionResultName].Value as RealVector;
-        if (!res.ContainsKey(BestInfillQualityResultName)) throw new ArgumentException("The InfillOptimizationAlgorithm did not return a best quality");
-        var d = res[BestInfillQualityResultName].Value as DoubleValue;
+        if (!res.ContainsKey(InfillProblem.BestInfillSolutionResultName)) throw new ArgumentException("The InfillOptimizationAlgorithm did not return a best solution");
+        var v = res[InfillProblem.BestInfillSolutionResultName].Value as RealVector;
+        if (!res.ContainsKey(InfillProblem.BestInfillQualityResultName)) throw new ArgumentException("The InfillOptimizationAlgorithm did not return a best quality");
+        var d = res[InfillProblem.BestInfillQualityResultName].Value as DoubleValue;
         if (d == null || v == null) throw new ArgumentException("The InfillOptimizationAlgorithm did not return the expected result types");
-
         //check for improvement
         if (infillProblem.Maximization != d.Value > bestValue) continue;
@@ -475,11 +418,8 @@
         bestVector = v;
       }
-
       InfillOptimizationAlgorithm.Runs.Clear();
       return bestVector;
     }
-    private Tuple<RealVector, double> Evaluate(RealVector point) {
-      return new Tuple<RealVector, double>(point, Problem.Evaluate(GetIndividual(point), Random));
-    }
+
     private void Analyze() {
       ResultsEvaluations = Samples.Count;
@@ -493,20 +433,36 @@
       ResultsQualitiesWorst.Values.Add(Samples[Problem.Maximization ? min : max].Item2);
       Problem.Analyze(Samples.Select(x => GetIndividual(x.Item1)).ToArray(), Samples.Select(x => x.Item2).ToArray(), Results, Random);
-
-      if (Samples.Count != 0 && Samples[0].Item1.Length == 2) {
-        var plotname = "DEBUG:Sample Distribution";
-        var rowInit = "Initial Samples";
-        var rowAll = "All Samples";
-        if (!Results.ContainsKey(plotname)) Results.Add(new Result(plotname, new ScatterPlot()));
-        var plot = Results[plotname].Value as ScatterPlot;
-        if (!plot.Rows.ContainsKey(rowInit) && InitialSamples != null && InitialSamples.Count > 0)
-          plot.Rows.Add(new ScatterPlotDataRow(rowInit, "samples from inital file (already evaulated)", InitialSamples.Select(x => new Point2D<double>(x.Item1[0], x.Item1[1]))));
-        if (!plot.Rows.ContainsKey(rowAll)) plot.Rows.Add(new ScatterPlotDataRow(rowAll, "All samples", new Point2D<double>[0]));
-        else { plot.Rows[rowAll].Points.Clear(); }
-        plot.Rows[rowAll].Points.AddRange(Samples.Select(x => new Point2D<double>(x.Item1[0], x.Item1[1])));
-
-
-      }
-    }
+      if (Samples.Count != 0 && Samples[0].Item1.Length == 2) AnalyzeSampleDistribution();
+      AnalyzePredictionCorrelation();
+    }
+
+    private void AnalyzeSampleDistribution() {
+      const string plotname = "DEBUG:Sample Distribution";
+      const string rowInit = "Initial Samples";
+      const string rowAll = "All Samples";
+      if (!Results.ContainsKey(plotname)) Results.Add(new Result(plotname, new ScatterPlot()));
+      var plot = (ScatterPlot)Results[plotname].Value;
+      if (!plot.Rows.ContainsKey(rowInit) && InitialSamples != null && InitialSamples.Count > 0)
+        plot.Rows.Add(new ScatterPlotDataRow(rowInit, "samples from inital file (already evaulated)", InitialSamples.Select(x => new Point2D<double>(x.Item1[0], x.Item1[1]))));
+      if (!plot.Rows.ContainsKey(rowAll)) plot.Rows.Add(new ScatterPlotDataRow(rowAll, "All samples", new Point2D<double>[0]));
+      else { plot.Rows[rowAll].Points.Clear(); }
+      plot.Rows[rowAll].Points.AddRange(Samples.Select(x => new Point2D<double>(x.Item1[0], x.Item1[1])));
+    }
+
+    private void AnalyzePredictionCorrelation() {
+      const string plotName = "Prediction";
+      const string rowName = "Samples";
+      const string lastrowName = "Last Sample";
+      if (!Results.ContainsKey(plotName)) Results.Add(new Result(plotName, new ScatterPlot()));
+      var plot = (ScatterPlot)Results[plotName].Value;
+      if (!plot.Rows.ContainsKey(rowName)) plot.Rows.Add(new ScatterPlotDataRow(rowName, rowName, new List<Point2D<double>>()));
+      if (!plot.Rows.ContainsKey(lastrowName)) plot.Rows.Add(new ScatterPlotDataRow(lastrowName, lastrowName, new List<Point2D<double>>()));
+      var p = Samples[Samples.Count - 1];
+      if (ResultsModel != null) plot.Rows[rowName].Points.Add(new Point2D<double>(ResultsModel.Model.GetEstimation(p.Item1), p.Item2, p.Item1));
+      plot.VisualProperties.YAxisTitle = "True Objective Value";
+      plot.VisualProperties.XAxisTitle = "Predicted Objective Value";
+
+    }
+
     private Individual GetIndividual(RealVector r) {
       var scope = new Scope();
@@ -514,4 +470,11 @@
       return new SingleEncodingIndividual(Problem.Encoding, scope);
     }
+    private Tuple<RealVector, double> Evaluate(RealVector point) {
+      return new Tuple<RealVector, double>(point, Problem.Evaluate(GetIndividual(point), Random));
+    }
+
+    private void SetInfillProblem() {
+      InfillOptimizationAlgorithm.Problem = new InfillProblem { InfillCriterion = InfillCriterion };
+    }
     #endregion
   }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EgoUtilities.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EgoUtilities.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EgoUtilities.cs	(revision 15064)
@@ -25,4 +25,5 @@
 using System.Threading;
 using HeuristicLab.Common;
+using HeuristicLab.Core;
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.RealVectorEncoding;
@@ -32,4 +33,5 @@
 namespace HeuristicLab.Algorithms.EGO {
   internal static class EgoUtilities {
+    //Extention methods for convenience
     public static int ArgMax<T>(this IEnumerable<T> values, Func<T, double> func) {
       var max = double.MinValue;
@@ -49,5 +51,17 @@
       return ArgMax(values, x => -func.Invoke(x));
     }
+    public static double GetEstimation(this IRegressionModel model, RealVector r) {
+      var dataset = GetDataSet(new[] { new Tuple<RealVector, double>(r, 0.0) }, false);
+      return model.GetEstimatedValues(dataset, new[] { 0 }).First();
+    }
+    public static double GetVariance(this IConfidenceRegressionModel model, RealVector r) {
+      var dataset = GetDataSet(new[] { new Tuple<RealVector, double>(r, 0.0) }, false);
+      return model.GetEstimatedVariances(dataset, new[] { 0 }).First();
+    }
+    public static double GetDoubleValue(this IDataset dataset, int i, int j) {
+      return dataset.GetDoubleValue("input" + j, i);
+    }
 
+    //Sub-ALgorithms
     public static ResultCollection SyncRunSubAlgorithm(IAlgorithm alg, int random) {
 
@@ -64,9 +78,15 @@
       EventWaitHandle trigger = new AutoResetEvent(false);
       Exception ex = null;
-      EventHandler<EventArgs<Exception>> exhandler = (sender, e) => ex = e.Value;
+      EventHandler<EventArgs<Exception>> exhandler = (sender, e) => { ex = e.Value; trigger.Set(); };
       EventHandler stoppedHandler = (sender, e) => trigger.Set();
+
+      alg.ExceptionOccurred -= exhandler; //avoid double attaching in case of pause
       alg.ExceptionOccurred += exhandler;
+      alg.Stopped -= stoppedHandler;
       alg.Stopped += stoppedHandler;
-      alg.Prepare();
+      alg.Paused -= stoppedHandler;
+      alg.Paused += stoppedHandler;
+
+      if (alg.ExecutionState != ExecutionState.Paused) alg.Prepare();
       alg.Start();
       trigger.WaitOne();
@@ -77,40 +97,20 @@
     }
 
-    public static double GetEstimation(this IRegressionModel model, RealVector r) {
-      var dataset = GetDataSet(new[] { new Tuple<RealVector, double>(r, 0.0) }, false);
-      return model.GetEstimatedValues(dataset, new[] { 0 }).First();
-    }
-    public static double GetVariance(this IConfidenceRegressionModel model, RealVector r) {
-      var dataset = GetDataSet(new[] { new Tuple<RealVector, double>(r, 0.0) }, false);
-      return model.GetEstimatedVariances(dataset, new[] { 0 }).First();
-    }
-
-
-    public static double GetDoubleValue(this IDataset dataset, int i, int j) {
-      return dataset.GetDoubleValue("input" + j, i);
-    }
+    //RegressionModel extensions
+    public const double DuplicateResolution = 0.0001;
     public static Dataset GetDataSet(IReadOnlyList<Tuple<RealVector, double>> samples, bool removeDuplicates) {
-      if (removeDuplicates)
-        samples = RemoveDuplicates(samples); //TODO duplicates require heteroskedasticity in Models
-
-
+      if (removeDuplicates) samples = RemoveDuplicates(samples); //TODO duplicate removal leads to incorrect uncertainty values in models
       var dimensions = samples[0].Item1.Length + 1;
       var data = new double[samples.Count, dimensions];
       var names = new string[dimensions - 1];
       for (var i = 0; i < names.Length; i++) names[i] = "input" + i;
-
       for (var j = 0; j < samples.Count; j++) {
         for (var i = 0; i < names.Length; i++) data[j, i] = samples[j].Item1[i];
         data[j, dimensions - 1] = samples[j].Item2;
-
       }
-
-
       return new Dataset(names.Concat(new[] { "output" }).ToArray(), data);
     }
-
     private static IReadOnlyList<Tuple<RealVector, double>> RemoveDuplicates(IReadOnlyList<Tuple<RealVector, double>> samples) {
       var res = new List<Tuple<RealVector, double, int>>();
-
       foreach (var sample in samples) {
         if (res.Count == 0) {
@@ -118,8 +118,7 @@
           continue;
         }
-
         var index = res.ArgMin(x => Euclidian(sample.Item1, x.Item1));
         var d = Euclidian(res[index].Item1, sample.Item1);
-        if (d > 0.0001)
+        if (d > DuplicateResolution)
           res.Add(new Tuple<RealVector, double, int>(sample.Item1, sample.Item2, 1));
         else {
@@ -131,25 +130,7 @@
       return res.Select(x => new Tuple<RealVector, double>(x.Item1, x.Item2 / x.Item3)).ToArray();
     }
-
     private static double Euclidian(IEnumerable<double> a, IEnumerable<double> b) {
       return Math.Sqrt(a.Zip(b, (d, d1) => d - d1).Sum(d => d * d));
     }
-
-    public static DoubleMatrix GetBoundingBox(IEnumerable<RealVector> vectors) {
-      DoubleMatrix res = null;
-      foreach (var vector in vectors)
-        if (res == null) {
-          res = new DoubleMatrix(vector.Length, 2);
-          for (var i = 0; i < vector.Length; i++)
-            res[i, 0] = res[i, 1] = vector[i];
-        } else
-          for (var i = 0; i < vector.Length; i++) {
-            res[i, 0] = Math.Min(vector[i], res[i, 0]);
-            res[i, 1] = Math.Max(vector[i], res[i, 1]);
-          }
-      return res;
-    }
-
-
   }
 }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/HeuristicLab.Algorithms.EGO-3.4.csproj
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/HeuristicLab.Algorithms.EGO-3.4.csproj	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/HeuristicLab.Algorithms.EGO-3.4.csproj	(revision 15064)
@@ -39,8 +39,4 @@
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
     </Reference>
-    <Reference Include="HeuristicLab.Algorithms.EvolutionStrategy-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.EvolutionStrategy-3.3.dll</HintPath>
-    </Reference>
     <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -55,8 +51,4 @@
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     </Reference>
-    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
-    </Reference>
     <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -66,4 +58,8 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
@@ -75,4 +71,8 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
@@ -92,15 +92,8 @@
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     </Reference>
-    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec" />
+    <Reference Include="HeuristicLab.Problems.SurrogateProblem-3.3, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath>
-    </Reference>
-    <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.dll</HintPath>
+      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.SurrogateProblem-3.3.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
@@ -108,13 +101,8 @@
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     </Reference>
+    <Reference Include="Microsoft.Build.Tasks.v4.0" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
@@ -122,7 +110,8 @@
     <Compile Include="EfficientGlobalOptimizationAlgorithm.cs" />
     <Compile Include="InfillCriteria\AugmentedExpectedImprovement.cs" />
+    <Compile Include="InfillCriteria\ExpectedImprovementBase.cs" />
+    <Compile Include="InfillCriteria\NeighbourDistance.cs" />
     <Compile Include="InfillCriteria\ExpectedQuantileImprovement.cs" />
     <Compile Include="InfillCriteria\PluginExpectedImprovement.cs" />
-    <Compile Include="InfillCriteria\RobustImprovement.cs" />
     <Compile Include="InfillCriteria\MinimalQuantileCriterium.cs" />
     <Compile Include="InfillCriteria\ExpectedQuality.cs" />
@@ -132,8 +121,18 @@
     <Compile Include="Interfaces\ISurrogateAlgorithm.cs" />
     <Compile Include="Interfaces\IInfillCriterion.cs" />
+    <Compile Include="AdaptiveSamplingAlgorithm.cs" />
+    <Compile Include="Operators\FitnessClusteringAnalyzer.cs" />
+    <Compile Include="Operators\VariableVariabilityAnalyzer.cs" />
+    <Compile Include="Operators\ModelQualityAnalyzer.cs" />
+    <Compile Include="Operators\EvaluatedSolutionsAnalyzer.cs" />
+    <Compile Include="Operators\ModelBuilder.cs" />
+    <Compile Include="Operators\InfillSolver.cs" />
+    <Compile Include="Operators\CorrelationAnalyzer.cs" />
+    <Compile Include="Operators\SampleCollector.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Problems\InfillProblem.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="SamplingMethods\LatinHyperCubeDesign.cs" />
+    <Compile Include="SamplingMethods\LatinHyperCubeDesignOLD.cs" />
+    <Compile Include="SamplingMethods\LatinHyperCubeDesignCreator.cs" />
     <Compile Include="SamplingMethods\UniformRandomSampling.cs" />
   </ItemGroup>
@@ -142,7 +141,5 @@
     <None Include="Properties\AssemblyInfo.cs.frame" />
   </ItemGroup>
-  <ItemGroup>
-    <WCFMetadata Include="Service References\" />
-  </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/AugmentedExpectedImprovement.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/AugmentedExpectedImprovement.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/AugmentedExpectedImprovement.cs	(revision 15064)
@@ -35,40 +35,28 @@
   [StorableClass]
   [Item("AugmentedExpectedImprovement", "Noisy InfillCriterion, Extension of the Expected Improvement as described in\n Global optimization of stochastic black-box systems via sequential kriging meta-models.\r\nHuang, D., Allen, T., Notz, W., Zeng, N.")]
-  public class AugmentedExpectedImprovement : ExpectedImprovement {
-
-
+  public class AugmentedExpectedImprovement : ExpectedImprovementBase {
 
     #region Parameternames
-
     public const string AlphaParameterName = "Alpha";
-
     #endregion
 
     #region Parameters
-
     public IValueParameter<DoubleValue> AlphaParameter => Parameters[AlphaParameterName] as IValueParameter<DoubleValue>;
-
     #endregion
 
     #region Properties
-
     public double Alpha => AlphaParameter.Value.Value;
     [Storable]
     private double Tau;
-
     #endregion
 
-
-    #region HL-Constructors, Serialization and Cloning 
+    #region Constructors, Serialization and Cloning 
     [StorableConstructor]
-    private AugmentedExpectedImprovement(bool deserializing) : base(deserializing) { }
-
-    private AugmentedExpectedImprovement(AugmentedExpectedImprovement original, Cloner cloner) : base(original, cloner) {
+    protected AugmentedExpectedImprovement(bool deserializing) : base(deserializing) { }
+    protected AugmentedExpectedImprovement(AugmentedExpectedImprovement original, Cloner cloner) : base(original, cloner) {
       Tau = original.Tau;
     }
-
     public AugmentedExpectedImprovement() {
       Parameters.Add(new ValueParameter<DoubleValue>(AlphaParameterName, "The Alpha value specifiying the robustness of the \"effective best solution\". Recommended value is 1", new DoubleValue(1.0)));
-
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -82,16 +70,16 @@
     }
 
-    protected override void Initialize() {
-      if (ExpensiveMaximization) throw new NotImplementedException("AugmentedExpectedImprovement for maximization not yet implemented");
-      var solution = RegressionSolution as IConfidenceRegressionSolution;
-      if (solution == null) throw new ArgumentException("can not calculate Augmented EI without a regression solution providing confidence values");
+    protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) {
+      var d = GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization);
+      return d * (1 - Tau / Math.Sqrt(estimatedStandardDeviation * estimatedStandardDeviation + Tau * Tau));
+    }
 
+    protected override double FindBestFitness(IConfidenceRegressionSolution solution) {
       Tau = RegressionSolution.EstimatedTrainingValues.Zip(RegressionSolution.ProblemData.TargetVariableTrainingValues, (d, d1) => Math.Abs(d - d1)).Average();
-      var xss = new RealVector(Encoding.Length);
+      var bestSolution = new RealVector(Encoding.Length);
       var xssIndex = solution.EstimatedTrainingValues.Zip(solution.EstimatedTrainingValues, (m, s2) => m + Alpha * Math.Sqrt(s2)).ArgMin(x => x);
       var i = solution.ProblemData.TrainingIndices.ToArray()[xssIndex];
-      for (var j = 0; j < Encoding.Length; j++) xss[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j);
-
-      YMin = RegressionSolution.Model.GetEstimation(xss);
+      for (var j = 0; j < Encoding.Length; j++) bestSolution[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j);
+      return RegressionSolution.Model.GetEstimation(bestSolution);
     }
   }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovement.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovement.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovement.cs	(revision 15064)
@@ -24,7 +24,5 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
 using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Problems.DataAnalysis;
@@ -35,36 +33,10 @@
   [StorableClass]
   [Item("ExpectedImprovementMeassure", "Extension of the Expected Improvement to a weighted version by ANDRAS SÓBESTER , STEPHEN J. LEARY and ANDY J. KEANE   in \n On the Design of Optimization Strategies Based on Global Response Surface Approximation Models")]
-  public class ExpectedImprovement : InfillCriterionBase {
-
-    #region ParameterNames
-    private const string ExploitationWeightParameterName = "ExploitationWeight";
-    #endregion
-
-    #region ParameterProperties
-    public IFixedValueParameter<DoubleValue> ExploitationWeightParameter => Parameters[ExploitationWeightParameterName] as IFixedValueParameter<DoubleValue>;
-
-    #endregion
-
-    #region Properties
-    protected double ExploitationWeight => ExploitationWeightParameter.Value.Value;
-
-    [Storable]
-    protected double YMin;
-    #endregion
-
-    #region HL-Constructors, Serialization and Cloning 
+  public sealed class ExpectedImprovement : ExpectedImprovementBase {
+    #region Constructors, Serialization and Cloning 
     [StorableConstructor]
-    protected ExpectedImprovement(bool deserializing) : base(deserializing) { }
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      RegisterEventhandlers();
-    }
-    protected ExpectedImprovement(ExpectedImprovement original, Cloner cloner) : base(original, cloner) {
-      RegisterEventhandlers();
-    }
-    public ExpectedImprovement() {
-      Parameters.Add(new FixedValueParameter<DoubleValue>(ExploitationWeightParameterName, "A value between 0 and 1 indicating the focus on exploration (0) or exploitation (1)", new DoubleValue(0.5)));
-      RegisterEventhandlers();
-    }
+    private ExpectedImprovement(bool deserializing) : base(deserializing) { }
+    private ExpectedImprovement(ExpectedImprovement original, Cloner cloner) : base(original, cloner) { }
+    public ExpectedImprovement() { }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new ExpectedImprovement(this, cloner);
@@ -76,63 +48,14 @@
       var yhat = model.GetEstimation(vector);
       var s = Math.Sqrt(model.GetVariance(vector));
-      return GetEstimatedImprovement(YMin, yhat, s, ExploitationWeight);
+      return GetEstimatedImprovement(BestFitness, yhat, s, ExploitationWeight, ExpensiveMaximization);
     }
 
-    public override bool Maximization() {
-      return true;
+    protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) {
+      return GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization);
     }
 
-    protected override void Initialize() {
-      if (ExpensiveMaximization) throw new NotImplementedException("Expected Improvement for maximization not yet implemented");
-      var model = RegressionSolution.Model as IConfidenceRegressionModel;
-      if (model == null) throw new ArgumentException("can not calculate EI without confidence measure");
-      YMin = RegressionSolution.ProblemData.TargetVariableTrainingValues.Min();
+    protected override double FindBestFitness(IConfidenceRegressionSolution solution) {
+      return ExpensiveMaximization ? solution.ProblemData.TargetVariableTrainingValues.Max() : solution.ProblemData.TargetVariableTrainingValues.Min();
     }
-
-    #region Eventhandling
-    private void RegisterEventhandlers() {
-      DeregisterEventhandlers();
-      ExploitationWeightParameter.Value.ValueChanged += OnExploitationWeightChanged;
-    }
-    private void DeregisterEventhandlers() {
-      ExploitationWeightParameter.Value.ValueChanged -= OnExploitationWeightChanged;
-    }
-    private void OnExploitationWeightChanged(object sender, EventArgs e) {
-      ExploitationWeightParameter.Value.ValueChanged -= OnExploitationWeightChanged;
-      ExploitationWeightParameter.Value.Value = Math.Max(0, Math.Min(ExploitationWeight, 1));
-      ExploitationWeightParameter.Value.ValueChanged += OnExploitationWeightChanged;
-    }
-    #endregion
-
-    #region Helpers
-    protected static double GetEstimatedImprovement(double ymin, double yhat, double s, double w) {
-      if (Math.Abs(s) < double.Epsilon) return 0;
-      var val = (ymin - yhat) / s;
-      var res = w * (ymin - yhat) * StandardNormalDistribution(val) + (1 - w) * s * StandardNormalDensity(val);
-      return double.IsInfinity(res) || double.IsNaN(res) ? 0 : res;
-    }
-
-    private static double StandardNormalDensity(double x) {
-      if (Math.Abs(x) > 10) return 0;
-      return Math.Exp(-0.5 * x * x) / Math.Sqrt(2 * Math.PI);
-    }
-
-    //taken from https://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
-    private static double StandardNormalDistribution(double x) {
-      if (x > 10) return 1;
-      if (x < -10) return 0;
-      const double a1 = 0.254829592;
-      const double a2 = -0.284496736;
-      const double a3 = 1.421413741;
-      const double a4 = -1.453152027;
-      const double a5 = 1.061405429;
-      const double p = 0.3275911;
-      var sign = x < 0 ? -1 : 1;
-      x = Math.Abs(x) / Math.Sqrt(2.0);
-      var t = 1.0 / (1.0 + p * x);
-      var y = 1.0 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.Exp(-x * x);
-      return 0.5 * (1.0 + sign * y);
-    }
-    #endregion
   }
 }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovementBase.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovementBase.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovementBase.cs	(revision 15064)
@@ -0,0 +1,130 @@
+﻿#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 System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+// ReSharper disable once CheckNamespace
+namespace HeuristicLab.Algorithms.EGO {
+
+  [StorableClass]
+  public abstract class ExpectedImprovementBase : InfillCriterionBase {
+
+    #region ParameterNames
+    private const string ExploitationWeightParameterName = "ExploitationWeight";
+    #endregion
+
+    #region ParameterProperties
+    public IFixedValueParameter<DoubleValue> ExploitationWeightParameter => Parameters[ExploitationWeightParameterName] as IFixedValueParameter<DoubleValue>;
+    #endregion
+
+    #region Properties
+    protected double ExploitationWeight => ExploitationWeightParameter.Value.Value;
+    [Storable]
+    protected double BestFitness;
+    #endregion
+
+    #region Constructors, Serialization and Cloning 
+    [StorableConstructor]
+    protected ExpectedImprovementBase(bool deserializing) : base(deserializing) { }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterEventhandlers();
+    }
+    protected ExpectedImprovementBase(ExpectedImprovementBase original, Cloner cloner) : base(original, cloner) {
+      BestFitness = original.BestFitness;
+      RegisterEventhandlers();
+    }
+    protected ExpectedImprovementBase() {
+      Parameters.Add(new FixedValueParameter<DoubleValue>(ExploitationWeightParameterName, "A value between 0 and 1 indicating the focus on exploration (0) or exploitation (1). 0.5 equates to the original EI by Jones et al.", new DoubleValue(0.5)));
+      RegisterEventhandlers();
+    }
+    #endregion
+
+    public override void Initialize() {
+      var solution = RegressionSolution as IConfidenceRegressionSolution;
+      if (solution == null) throw new ArgumentException("can not calculate EI without a regression solution providing confidence values");
+      BestFitness = FindBestFitness(solution);
+    }
+
+    protected abstract double FindBestFitness(IConfidenceRegressionSolution solution);
+
+    public override double Evaluate(RealVector vector) {
+      var model = RegressionSolution.Model as IConfidenceRegressionModel;
+      var yhat = model.GetEstimation(vector);
+      var s = Math.Sqrt(model.GetVariance(vector));
+      return Evaluate(vector, yhat, s);
+    }
+
+    protected abstract double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation);
+
+    #region Eventhandling
+    private void RegisterEventhandlers() {
+      DeregisterEventhandlers();
+      ExploitationWeightParameter.Value.ValueChanged += OnExploitationWeightChanged;
+    }
+    private void DeregisterEventhandlers() {
+      ExploitationWeightParameter.Value.ValueChanged -= OnExploitationWeightChanged;
+    }
+    private void OnExploitationWeightChanged(object sender, EventArgs e) {
+      ExploitationWeightParameter.Value.ValueChanged -= OnExploitationWeightChanged;
+      ExploitationWeightParameter.Value.Value = Math.Max(0, Math.Min(ExploitationWeight, 1));
+      ExploitationWeightParameter.Value.ValueChanged += OnExploitationWeightChanged;
+    }
+    #endregion
+
+    #region Helpers
+    public static double GetEstimatedImprovement(double bestFitness, double estimatedFitness, double modelUncertainty, double weight, bool maximization) {
+      if (Math.Abs(modelUncertainty) < double.Epsilon) return 0;
+      var diff = maximization ? (estimatedFitness - bestFitness) : (bestFitness - estimatedFitness);
+      var val = diff / modelUncertainty;
+      var res = weight * diff * StandardNormalDistribution(val) + (1 - weight) * modelUncertainty * StandardNormalDensity(val);
+      return double.IsInfinity(res) || double.IsNaN(res) ? 0 : res;
+    }
+    private static double StandardNormalDensity(double x) {
+      if (Math.Abs(x) > 10) return 0;
+      return Math.Exp(-0.5 * x * x) / Math.Sqrt(2 * Math.PI);
+    }
+    //taken from https://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
+    private static double StandardNormalDistribution(double x) {
+      if (x > 10) return 1;
+      if (x < -10) return 0;
+      const double a1 = 0.254829592;
+      const double a2 = -0.284496736;
+      const double a3 = 1.421413741;
+      const double a4 = -1.453152027;
+      const double a5 = 1.061405429;
+      const double p = 0.3275911;
+      var sign = x < 0 ? -1 : 1;
+      x = Math.Abs(x) / Math.Sqrt(2.0);
+      var t = 1.0 / (1.0 + p * x);
+      var y = 1.0 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.Exp(-x * x);
+      return 0.5 * (1.0 + sign * y);
+    }
+    #endregion
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedQuality.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedQuality.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedQuality.cs	(revision 15064)
@@ -29,10 +29,10 @@
 
   [StorableClass]
-  [Item("ExpectedQualityMeassure", "Use simply the qualitypredicted by the model")]
+  [Item("ExpectedQualityMeassure", "Use the quality predicted by the model")]
   public class ExpectedQuality : InfillCriterionBase {
-    #region HL-Constructors, Serialization and Cloning 
+    #region Constructors, Serialization and Cloning 
     [StorableConstructor]
-    private ExpectedQuality(bool deserializing) : base(deserializing) { }
-    private ExpectedQuality(ExpectedQuality original, Cloner cloner) : base(original, cloner) { }
+    protected ExpectedQuality(bool deserializing) : base(deserializing) { }
+    protected ExpectedQuality(ExpectedQuality original, Cloner cloner) : base(original, cloner) { }
     public ExpectedQuality() { }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -42,12 +42,8 @@
 
     public override double Evaluate(RealVector vector) {
-      return RegressionSolution.Model.GetEstimation(vector);
+      return ExpensiveMaximization ? RegressionSolution.Model.GetEstimation(vector) : -RegressionSolution.Model.GetEstimation(vector);
     }
 
-    public override bool Maximization() {
-      return ExpensiveMaximization;
-    }
-
-    protected override void Initialize() {
+    public override void Initialize() {
     }
   }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedQuantileImprovement.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedQuantileImprovement.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedQuantileImprovement.cs	(revision 15064)
@@ -35,5 +35,5 @@
   [StorableClass]
   [Item("ExpectedQuantileImprovement", "Noisy InfillCriterion, Extension of the Expected Improvement as described in \n Noisy expectedimprovement and on - line computation time allocation for the optimization of simulators with tunable fidelitys\r\nPicheny, V., Ginsbourger, D., Richet, Y")]
-  public class ExpectedQuantileImprovement : ExpectedImprovement {
+  public class ExpectedQuantileImprovement : ExpectedImprovementBase {
 
     #region Parameternames
@@ -48,23 +48,19 @@
 
     #region Properties
-
     public int MaxEvaluations => MaxEvaluationsParameter.Value.Value;
     public double Alpha => AlphaParameter.Value.Value;
     [Storable]
     private double Tau;
-
     #endregion
 
     #region HL-Constructors, Serialization and Cloning 
     [StorableConstructor]
-    private ExpectedQuantileImprovement(bool deserializing) : base(deserializing) { }
-
-    private ExpectedQuantileImprovement(ExpectedQuantileImprovement original, Cloner cloner) : base(original, cloner) {
+    protected ExpectedQuantileImprovement(bool deserializing) : base(deserializing) { }
+    protected ExpectedQuantileImprovement(ExpectedQuantileImprovement original, Cloner cloner) : base(original, cloner) {
       Tau = original.Tau;
     }
-
     public ExpectedQuantileImprovement() {
       Parameters.Add(new FixedValueParameter<DoubleValue>(AlphaParameterName, "The Alpha value specifiying the robustness of the \"effective best solution\". Recommended value is 1.0", new DoubleValue(1.0)));
-      Parameters.Add(new ValueParameter<IntValue>(MaxEvaluationsParameterName, "The maximum number of evaluations allowed for EGO", new IntValue(100)));
+      Parameters.Add(new ValueParameter<IntValue>(MaxEvaluationsParameterName, "The maximum number of evaluations allowed for EGO", new IntValue(500)));
       MaxEvaluationsParameter.Hidden = true;
     }
@@ -74,28 +70,19 @@
     #endregion
 
-    public override double Evaluate(RealVector vector) {
-      var model = RegressionSolution.Model as IConfidenceRegressionModel;
-      var s2 = model.GetVariance(vector);
+    protected override double FindBestFitness(IConfidenceRegressionSolution solution) {
+      Tau = RegressionSolution.EstimatedTrainingValues.Zip(solution.ProblemData.TargetVariableTrainingValues, (d, d1) => Math.Abs(d - d1)).Average();
+      Tau = Tau * Tau / (MaxEvaluations - solution.ProblemData.Dataset.Rows % MaxEvaluations + 1);
 
-      var yhat = model.GetEstimation(vector) + Alpha * Math.Sqrt(Tau * s2 / (Tau + s2));
-      var s = Math.Sqrt(s2 * s2 / (Tau + s2));
+      var index = solution.EstimatedTrainingValues.Zip(solution.EstimatedTrainingVariances, (m, s2) => m + Alpha * Math.Sqrt(s2)).ArgMin(x => x);
+      return solution.EstimatedTrainingValues.ToArray()[index];
 
-      return GetEstimatedImprovement(YMin, yhat, s, ExploitationWeight);
     }
 
-    protected override void Initialize() {
-      if (ExpensiveMaximization) throw new NotImplementedException("AugmentedExpectedImprovement for maximization not yet implemented");
-      var solution = RegressionSolution as IConfidenceRegressionSolution;
-      if (solution == null) throw new ArgumentException("can not calculate Augmented EI without a regression solution providing confidence values");
-
-      Tau = RegressionSolution.EstimatedTrainingValues.Zip(RegressionSolution.ProblemData.TargetVariableTrainingValues, (d, d1) => Math.Abs(d - d1)).Average();
-      Tau = Tau * Tau / (MaxEvaluations - RegressionSolution.ProblemData.Dataset.Rows + 1);
-
-      var xss = new RealVector(Encoding.Length);
-      var xssIndex = solution.EstimatedTrainingVariances.Zip(solution.EstimatedTrainingVariances, (m, s2) => m + Alpha * Math.Sqrt(s2)).ArgMin(x => x);
-      var i = solution.ProblemData.TrainingIndices.ToArray()[xssIndex];
-      for (var j = 0; j < Encoding.Length; j++) xss[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j);
-
-      YMin = RegressionSolution.Model.GetEstimation(xss);
+    protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) {
+      var s2 = estimatedStandardDeviation * estimatedStandardDeviation;
+      var penalty = Alpha * Math.Sqrt(Tau * s2 / (Tau + s2));
+      var yhat = estimatedFitness + (ExpensiveMaximization ? -penalty : penalty);
+      var s = Math.Sqrt(s2 * s2 / (Tau + s2));
+      return GetEstimatedImprovement(BestFitness, yhat, s, ExploitationWeight, ExpensiveMaximization);
     }
 
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/InfillCriterionBase.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/InfillCriterionBase.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/InfillCriterionBase.cs	(revision 15064)
@@ -30,14 +30,12 @@
   [StorableClass]
   public abstract class InfillCriterionBase : ParameterizedNamedItem, IInfillCriterion {
-
     [Storable]
-    protected IRegressionSolution RegressionSolution;
+    public IRegressionSolution RegressionSolution { get; set; }
     [Storable]
-    protected bool ExpensiveMaximization;
+    public bool ExpensiveMaximization { get; set; }
     [Storable]
-    protected RealVectorEncoding Encoding;
+    public RealVectorEncoding Encoding { get; set; }
 
     protected InfillCriterionBase(bool deserializing) : base(deserializing) { }
-
     protected InfillCriterionBase(InfillCriterionBase original, Cloner cloner) : base(original, cloner) {
       RegressionSolution = cloner.Clone(original.RegressionSolution);
@@ -48,15 +46,7 @@
 
     public abstract double Evaluate(RealVector vector);
-    public abstract bool Maximization();
+    //public abstract bool Maximization();
 
-    public void Initialize(IRegressionSolution solution, bool expensiveMaximization, RealVectorEncoding encoding) {
-      RegressionSolution = solution;
-      ExpensiveMaximization = expensiveMaximization;
-      Encoding = encoding;
-      Initialize();
-    }
-
-    protected abstract void Initialize();
-
+    public abstract void Initialize();
   }
 }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/MinimalQuantileCriterium.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/MinimalQuantileCriterium.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/MinimalQuantileCriterium.cs	(revision 15064)
@@ -42,18 +42,16 @@
     #region ParameterProperties
     public IFixedValueParameter<DoubleValue> ConfidenceWeightParameter => Parameters[ConfidenceWeightParameterName] as IFixedValueParameter<DoubleValue>;
-
     #endregion
 
     #region Properties
     private double ConfidenceWeight => ConfidenceWeightParameter.Value.Value;
-
     #endregion
 
-    #region HL-Constructors, Serialization and Cloning 
+    #region Constructors, Serialization and Cloning 
     [StorableConstructor]
-    private MinimalQuantileCriterium(bool deserializing) : base(deserializing) { }
-    private MinimalQuantileCriterium(MinimalQuantileCriterium original, Cloner cloner) : base(original, cloner) { }
+    protected MinimalQuantileCriterium(bool deserializing) : base(deserializing) { }
+    protected MinimalQuantileCriterium(MinimalQuantileCriterium original, Cloner cloner) : base(original, cloner) { }
     public MinimalQuantileCriterium() {
-      Parameters.Add(new FixedValueParameter<DoubleValue>(ConfidenceWeightParameterName, "A value between 0 and 1 indicating the focus on exploration (0) or exploitation (1)", new DoubleValue(0.5)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(ConfidenceWeightParameterName, "A value greater than 0. The larger the value the stronger the emphasis on exploration", new DoubleValue(0.5)));
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -66,12 +64,9 @@
       var yhat = model.GetEstimation(vector);
       var s = Math.Sqrt(model.GetVariance(vector)) * ConfidenceWeight;
-      return ExpensiveMaximization ? yhat + s : yhat - s;
+      return (ExpensiveMaximization ? yhat : -yhat) + s;
     }
 
-    public override bool Maximization() {
-      return ExpensiveMaximization;
-    }
 
-    protected override void Initialize() {
+    public override void Initialize() {
       var model = RegressionSolution.Model as IConfidenceRegressionModel;
       if (model == null) throw new ArgumentException("can not calculate EI without confidence measure");
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/NeighbourDistance.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/NeighbourDistance.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/NeighbourDistance.cs	(revision 15064)
@@ -0,0 +1,75 @@
+﻿#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 System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+// ReSharper disable once CheckNamespace
+namespace HeuristicLab.Algorithms.EGO {
+
+  [StorableClass]
+  [Item("NeighbourDistance", "Exploration by maximizing the distance to the nearest neighbour")]
+  public class NeighbourDistance : InfillCriterionBase {
+
+    private IVantagePointTree<IEnumerable<double>> Points;
+    #region Constructors, Serialization and Cloning 
+    [StorableConstructor]
+    protected NeighbourDistance(bool deserializing) : base(deserializing) { }
+
+    protected NeighbourDistance(NeighbourDistance original, Cloner cloner) : base(original, cloner) {
+    }
+    public NeighbourDistance() { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new NeighbourDistance(this, cloner);
+    }
+    #endregion
+
+    public override double Evaluate(RealVector vector) {
+      if (Points == null) Points = CreateTree();
+      IList<IEnumerable<double>> neighbours;
+      IList<double> distances;
+      Points.Search(vector, 1, out neighbours, out distances);
+      return distances[0];
+      //return RegressionSolution.ProblemData.AllIndices.Min(i => DistanceToSample(vector, i));
+    }
+
+    public override void Initialize() {
+      Points = CreateTree();
+    }
+
+    private double DistanceToSample(RealVector vector, int i) {
+      throw new NotImplementedException();
+    }
+
+    private VantagePointTree<IEnumerable<double>> CreateTree() {
+      var data = RegressionSolution.ProblemData.Dataset;
+      var rows = RegressionSolution.ProblemData.AllIndices;
+      var cols = RegressionSolution.ProblemData.AllowedInputVariables;
+      return new VantagePointTree<IEnumerable<double>>(new EuclideanDistance(), rows.Select(r => cols.Select(c => data.GetDoubleValue(c, r)).ToArray()));
+    }
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/PluginExpectedImprovement.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/PluginExpectedImprovement.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/PluginExpectedImprovement.cs	(revision 15064)
@@ -20,8 +20,8 @@
 #endregion
 
-using System;
 using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Problems.DataAnalysis;
@@ -32,11 +32,10 @@
   [StorableClass]
   [Item("PluginExpectedImprovement", "Noisy InfillCriterion, Extension of the Expected Improvement by using the minimal prediction on the observed points\n rather than the minimal observed value as described in \n Global optimization based on noisy evaluations: An empirical study of two statistical approaches\r\nEmmanuel Vazqueza, Julien Villemonteixb, Maryan Sidorkiewiczb and Éric Walterc")]
-  public class PluginExpectedImprovement : ExpectedImprovement {
-
+  public class PluginExpectedImprovement : ExpectedImprovementBase {
 
     #region HL-Constructors, Serialization and Cloning 
     [StorableConstructor]
-    private PluginExpectedImprovement(bool deserializing) : base(deserializing) { }
-    private PluginExpectedImprovement(PluginExpectedImprovement original, Cloner cloner) : base(original, cloner) { }
+    protected PluginExpectedImprovement(bool deserializing) : base(deserializing) { }
+    protected PluginExpectedImprovement(PluginExpectedImprovement original, Cloner cloner) : base(original, cloner) { }
     public PluginExpectedImprovement() { }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -45,9 +44,10 @@
     #endregion
 
-    protected override void Initialize() {
-      if (ExpensiveMaximization) throw new NotImplementedException("PluginExpectedImprovement for maximization not yet implemented");
-      var model = RegressionSolution.Model as IConfidenceRegressionModel;
-      if (model == null) throw new ArgumentException("can not calculate EI without confidence measure");
-      YMin = RegressionSolution.EstimatedTrainingValues.Min();
+    protected override double FindBestFitness(IConfidenceRegressionSolution solution) {
+      return ExpensiveMaximization ? RegressionSolution.EstimatedTrainingValues.Max() : RegressionSolution.EstimatedTrainingValues.Min();
+    }
+
+    protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) {
+      return GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization);
     }
   }
Index: anches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/RobustImprovement.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/RobustImprovement.cs	(revision 15063)
+++ 	(revision )
@@ -1,159 +1,0 @@
-﻿#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 System;
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.RealVectorEncoding;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Problems.DataAnalysis;
-
-// ReSharper disable once CheckNamespace
-namespace HeuristicLab.Algorithms.EGO {
-
-  [StorableClass]
-  [Item("RobustImprovementMeassure", "Adding or Subtracting the variance * factor to the model estimation")]
-  public class RobustImprovement : InfillCriterionBase {
-
-    #region ParameterNames
-    private const string KParameterName = "NearestNeighbours";
-    #endregion
-
-    #region ParameterProperties
-    public IFixedValueParameter<IntValue> KParameter => Parameters[KParameterName] as IFixedValueParameter<IntValue>;
-
-    #endregion
-
-    #region Properties
-    private int K => KParameter.Value.Value;
-
-    [Storable]
-    private double MaxSolutionDist;
-
-    [Storable]
-    //TODO use VP-Tree instead of array
-    private RealVector[] Data;
-    #endregion
-
-    #region HL-Constructors, Serialization and Cloning 
-    [StorableConstructor]
-    private RobustImprovement(bool deserializing) : base(deserializing) { }
-
-    private RobustImprovement(RobustImprovement original, Cloner cloner) : base(original, cloner) {
-      MaxSolutionDist = original.MaxSolutionDist;
-      Data = original.Data != null ? original.Data.Select(cloner.Clone).ToArray() : null;
-    }
-    public RobustImprovement() {
-      Parameters.Add(new FixedValueParameter<IntValue>(KParameterName, "A value larger than 0 indicating how many nearestNeighbours shall be used to determine the RI meassure", new IntValue(3)));
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new RobustImprovement(this, cloner);
-    }
-    #endregion
-
-
-    public override double Evaluate(RealVector vector) {
-      List<RealVector> nearestNeighbours;
-      List<double> distances;
-      Search(vector, K, out nearestNeighbours, out distances);
-      var distVectors = nearestNeighbours.Select(x => Minus(x, vector)).ToList();
-      var sum = 0.0;
-      var wsum = 1.0; //weights for angular distance
-      var used = new HashSet<RealVector>();
-      foreach (var distVector in distVectors) {
-        var d = Math.Pow(distances[used.Count], 0.5);
-        if (used.Count == 0) {
-          sum += d;
-        } else {
-          var w = used.Select(x => Angular(distVector, x)).Min();
-          sum += w * d;
-          wsum += w;
-        }
-        used.Add(distVector);
-      }
-      sum /= wsum * MaxSolutionDist; //normalize
-      return sum;
-    }
-    public override bool Maximization() {
-      return ExpensiveMaximization;
-    }
-    protected override void Initialize() {
-      var model = RegressionSolution.Model as IConfidenceRegressionModel;
-      if (model == null) throw new ArgumentException("can not calculate EI without confidence measure");
-      Data = new RealVector[RegressionSolution.ProblemData.Dataset.Rows];
-      for (var i = 0; i < Data.Length; i++) {
-        Data[i] = new RealVector(Encoding.Length);
-        for (var j = 0; j < Encoding.Length; j++)
-          Data[i][j] = RegressionSolution.ProblemData.Dataset.GetDoubleValue(i, j);
-      }
-
-      var maxSolution = new double[Encoding.Length];
-      var minSolution = new double[Encoding.Length];
-      for (var i = 0; i < Encoding.Length; i++) {
-        var j = i % Encoding.Bounds.Rows;
-        maxSolution[i] = Encoding.Bounds[j, 1];
-        minSolution[i] = Encoding.Bounds[j, 0];
-      }
-      MaxSolutionDist = Euclidian(maxSolution, minSolution) / Data.Length;
-    }
-
-    #region Helpers
-    private static double Euclidian(IEnumerable<double> a, IEnumerable<double> b) {
-      return Math.Sqrt(a.Zip(b, (d, d1) => d - d1).Sum(d => d * d));
-    }
-    private static double Angular(RealVector a, RealVector b) {
-      var innerProduct = a.Zip(b, (x, y) => x * y).Sum();
-      var res = Math.Acos(innerProduct / (Norm(a) * Norm(b))) / Math.PI;
-      return double.IsNaN(res) ? 0 : res;
-    }
-    private static double Norm(IEnumerable<double> a) {
-      return Math.Sqrt(a.Sum(d => d * d));
-    }
-    private static RealVector Minus(RealVector a, RealVector b) {
-      return new RealVector(a.Zip(b, (d, d1) => d - d1).ToArray());
-    }
-
-    private void Search(RealVector vector, int k, out List<RealVector> nearestNeighbours, out List<double> distances) {
-      var neighbours = new SortedList<double, RealVector>(new DuplicateKeyComparer<double>());
-      foreach (var n in Data) neighbours.Add(Euclidian(n, vector), n);
-      nearestNeighbours = new List<RealVector>();
-
-      distances = new List<double>();
-      foreach (var entry in neighbours) {
-        nearestNeighbours.Add(entry.Value);
-        distances.Add(entry.Key);
-        if (distances.Count == k) break;
-      }
-    }
-    #endregion
-
-    public class DuplicateKeyComparer<TKey> : IComparer<TKey> where TKey : IComparable {
-      public int Compare(TKey x, TKey y) {
-        var result = x.CompareTo(y);
-        return result == 0 ? 1 : result;
-      }
-    }
-  }
-}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Interfaces/IInfillCriterion.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Interfaces/IInfillCriterion.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Interfaces/IInfillCriterion.cs	(revision 15064)
@@ -27,7 +27,11 @@
 namespace HeuristicLab.Algorithms.EGO {
   public interface IInfillCriterion : INamedItem {
+
+    IRegressionSolution RegressionSolution { get; set; }
+    bool ExpensiveMaximization { get; set; }
+    RealVectorEncoding Encoding { get; set; }
     double Evaluate(RealVector vector);
-    bool Maximization();
-    void Initialize(IRegressionSolution solution, bool expensiveMaximization, RealVectorEncoding encoding);
+    //bool Maximization();
+    void Initialize();
   }
 }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/CorrelationAnalyzer.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/CorrelationAnalyzer.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/CorrelationAnalyzer.cs	(revision 15064)
@@ -0,0 +1,94 @@
+﻿#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 System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.EGO {
+  [Item("CorrelationAnalyzer", "Analyzes the correlation between perdictions and actual fitness values")]
+  [StorableClass]
+  public class CorrelationAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    public override bool CanChangeName => true;
+    public bool EnabledByDefault => false;
+
+    public IScopeTreeLookupParameter<RealVector> RealVectorParameter => (IScopeTreeLookupParameter<RealVector>)Parameters["RealVector"];
+    public IScopeTreeLookupParameter<DoubleValue> QualityParameter => (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"];
+    public ILookupParameter<IRegressionSolution> ModelParameter => (ILookupParameter<IRegressionSolution>)Parameters["Model"];
+    public ILookupParameter<ResultCollection> ResultsParameter => (ILookupParameter<ResultCollection>)Parameters["Results"];
+
+    private const string PlotName = "Prediction";
+    private const string RowName = "Samples";
+
+    [StorableConstructor]
+    protected CorrelationAnalyzer(bool deserializing) : base(deserializing) { }
+    protected CorrelationAnalyzer(CorrelationAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public CorrelationAnalyzer() {
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector", "The vector which should be collected."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality associated which this vector"));
+      Parameters.Add(new LookupParameter<IRegressionSolution>("Model", "The model of this iteration"));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection to store the results in."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CorrelationAnalyzer(this, cloner);
+    }
+
+    public sealed override IOperation Apply() {
+      var model = ModelParameter.ActualValue;
+      var results = ResultsParameter.ActualValue;
+      var q = QualityParameter.ActualValue.Select(x => x.Value).ToArray();
+      var p = RealVectorParameter.ActualValue.ToArray();
+      if (model == null) return base.Apply();
+      var plot = CreateScatterPlotResult(results);
+      for (var i = 0; i < q.Length; i++) plot.Rows[RowName].Points.Add(new Point2D<double>(model.Model.GetEstimation(p[i]), q[i], p[i]));
+      return base.Apply();
+    }
+
+    private static ScatterPlot CreateScatterPlotResult(ResultCollection results) {
+      ScatterPlot plot;
+      if (!results.ContainsKey(PlotName)) {
+        plot = new ScatterPlot("Fitness-Prediction-Correlation", "The correlation between the predicted and actual fitness values") {
+          VisualProperties = {
+            XAxisTitle = "Predicted Objective Value",
+            YAxisTitle = "True Objective Value"
+          }
+        };
+        results.Add(new Result(PlotName, plot));
+      } else { plot = (ScatterPlot)results[PlotName].Value; }
+      if (!plot.Rows.ContainsKey(RowName)) {
+        plot.Rows.Add(new ScatterPlotDataRow(RowName, RowName, new List<Point2D<double>>()));
+        plot.Rows[RowName].VisualProperties.PointSize = 5;
+      }
+      return plot;
+    }
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/EvaluatedSolutionsAnalyzer.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/EvaluatedSolutionsAnalyzer.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/EvaluatedSolutionsAnalyzer.cs	(revision 15064)
@@ -0,0 +1,107 @@
+﻿#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 System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.EGO {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("EvaluatedSolutionsAnalyzer", "Displays the evaluated Solutions for one or two dimensional problems")]
+  [StorableClass]
+  public class EvaluatedSolutionsAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    public override bool CanChangeName => true;
+    public bool EnabledByDefault => false;
+
+    public IScopeTreeLookupParameter<RealVector> RealVectorParameter => (IScopeTreeLookupParameter<RealVector>)Parameters["RealVector"];
+    public IScopeTreeLookupParameter<DoubleValue> QualityParameter => (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"];
+    public ILookupParameter<ResultCollection> ResultsParameter => (ILookupParameter<ResultCollection>)Parameters["Results"];
+    public ILookupParameter<BoolValue> PhaseParameter => (ILookupParameter<BoolValue>)Parameters["InitialPhase"];
+
+    private const string PlotName = "Evaluated Solutions Plot";
+    private const string InitialRowName = "Initial Samples";
+    private const string AdaptiveRowName = "Adaptive Samples";
+
+
+    [StorableConstructor]
+    protected EvaluatedSolutionsAnalyzer(bool deserializing) : base(deserializing) { }
+    protected EvaluatedSolutionsAnalyzer(EvaluatedSolutionsAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public EvaluatedSolutionsAnalyzer() {
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector", "The vector which should be collected."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality associated which this vector"));
+      Parameters.Add(new LookupParameter<BoolValue>("InitialPhase", "Whether the initial phase has finished"));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection to store the results in."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EvaluatedSolutionsAnalyzer(this, cloner);
+    }
+
+    public sealed override IOperation Apply() {
+      var p = RealVectorParameter.ActualValue.ToArray();
+      if (p.Length == 0 || p[0].Length > 2 || p[0].Length == 0) return base.Apply();
+      var results = ResultsParameter.ActualValue;
+      var q = QualityParameter.ActualValue.Select(x => x.Value).ToArray();
+
+      var plot = CreateScatterPlotResult(results, p[0].Length);
+      var points = plot.Rows[PhaseParameter.ActualValue.Value ? AdaptiveRowName : InitialRowName].Points;
+      if (p[0].Length == 2)
+        for (var i = 0; i < q.Length; i++) points.Add(new Point2D<double>(p[i][0], p[i][1], q[i]));
+      else
+        for (var i = 0; i < q.Length; i++) points.Add(new Point2D<double>(p[i][0], q[i]));
+      return base.Apply();
+
+    }
+
+    private static ScatterPlot CreateScatterPlotResult(ResultCollection results, int dim) {
+      ScatterPlot plot;
+      if (!results.ContainsKey(PlotName)) {
+        plot = new ScatterPlot("Evaluated Solutions", "The solution evaluated so far") {
+          VisualProperties = {
+            XAxisTitle = "First Dimension",
+            YAxisTitle = dim==2?"Second Dimension":"Quality"
+          }
+        };
+        results.Add(new Result(PlotName, plot));
+      } else { plot = (ScatterPlot)results[PlotName].Value; }
+      if (!plot.Rows.ContainsKey(InitialRowName)) {
+        plot.Rows.Add(new ScatterPlotDataRow(InitialRowName, InitialRowName, new List<Point2D<double>>()));
+        plot.Rows[InitialRowName].VisualProperties.PointSize = 5;
+      }
+      if (!plot.Rows.ContainsKey(AdaptiveRowName)) {
+        plot.Rows.Add(new ScatterPlotDataRow(AdaptiveRowName, AdaptiveRowName, new List<Point2D<double>>()));
+        plot.Rows[AdaptiveRowName].VisualProperties.PointSize = 5;
+      }
+      return plot;
+    }
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/FitnessClusteringAnalyzer.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/FitnessClusteringAnalyzer.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/FitnessClusteringAnalyzer.cs	(revision 15064)
@@ -0,0 +1,132 @@
+﻿#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 System;
+using System.Linq;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.SurrogateProblem;
+
+namespace HeuristicLab.Algorithms.EGO {
+  [Item("FitnessClusteringAnalyzer", "Analyzes the correlation between perdictions and actual fitness values")]
+  [StorableClass]
+  public class FitnessClusteringAnalyzer : SingleSuccessorOperator, IAnalyzer, IStochasticOperator {
+    public override bool CanChangeName => true;
+    public bool EnabledByDefault => false;
+
+    public ILookupParameter<ModifiableDataset> DatasetParameter => (ILookupParameter<ModifiableDataset>)Parameters["Dataset"];
+    public ILookupParameter<ResultCollection> ResultsParameter => (ILookupParameter<ResultCollection>)Parameters["Results"];
+    public IFixedValueParameter<IntValue> KParameter => (IFixedValueParameter<IntValue>)Parameters["K"];
+    public IFixedValueParameter<IntValue> K2Parameter => (IFixedValueParameter<IntValue>)Parameters["K2"];
+    public ILookupParameter<IRandom> RandomParameter => (ILookupParameter<IRandom>)Parameters["Random"];
+
+    private const string SolutionName = "FitnessClustering";
+    private const string PlotName = "FitnessClusterPlot";
+
+    [StorableConstructor]
+    protected FitnessClusteringAnalyzer(bool deserializing) : base(deserializing) { }
+
+    protected FitnessClusteringAnalyzer(FitnessClusteringAnalyzer original, Cloner cloner) : base(original, cloner) { }
+
+    public FitnessClusteringAnalyzer() {
+      Parameters.Add(new LookupParameter<ModifiableDataset>("Dataset"));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection to store the results in."));
+      Parameters.Add(new FixedValueParameter<IntValue>("K", "The number of clusters.", new IntValue(3)));
+      Parameters.Add(new FixedValueParameter<IntValue>("K2", "The number of clusters.", new IntValue(3)));
+      Parameters.Add(new LookupParameter<IRandom>("Random"));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FitnessClusteringAnalyzer(this, cloner);
+    }
+
+    public sealed override IOperation Apply() {
+      var dataset = DatasetParameter.ActualValue;
+      var results = ResultsParameter.ActualValue;
+      var random = RandomParameter.ActualValue;
+      if (dataset.Rows < KParameter.Value.Value || dataset.Rows < 20) return base.Apply();
+
+      var clustering = CreateClustering(dataset, random);
+      if (!results.ContainsKey(SolutionName)) results.Add(new Result(SolutionName, clustering));
+      results[SolutionName].Value = clustering;
+      var plot = CreateTSNEPlot(clustering, dataset, random);
+      if (!results.ContainsKey(PlotName)) results.Add(new Result(PlotName, plot));
+      results[PlotName].Value = plot;
+
+      return base.Apply();
+    }
+
+
+    private ScatterPlot CreateTSNEPlot(KMeansClusteringSolution clustering, ModifiableDataset data, IRandom random) {
+      var clusteredData = (ModifiableDataset)data.Clone();
+      clusteredData.AddVariable("cluster", clustering.ClusterValues.Select(x => (double)x));
+
+      var prob = new RegressionProblem {
+        ProblemData = new RegressionProblemData(clusteredData, new[] { "output" }, "cluster")
+      };
+      var tsne = new TSNEAlgorithm {
+        Perplexity = data.Rows / 3 - 1,
+        Problem = prob
+      };
+      tsne.ClassesParameter.Value.Value = "cluster";
+      var res = EgoUtilities.SyncRunSubAlgorithm(tsne, random.Next());
+      return res.Select(r => r.Value).OfType<ScatterPlot>().First();
+    }
+
+    private KMeansClusteringSolution CreateClustering(ModifiableDataset dataset, IRandom random) {
+      var pd = new ClusteringProblemData(dataset, new[] { "output" });
+      pd.TestPartition.Start = dataset.Rows;
+      pd.TestPartition.End = dataset.Rows;
+      pd.TrainingPartition.Start = 0;
+      pd.TrainingPartition.End = dataset.Rows;
+
+      return ObservationWeightedKMeans.CreateKMeansSolution(pd, GetWeights(dataset), KParameter.Value.Value, 1000, random);
+    }
+    private double[] GetWeights(ModifiableDataset dataset) {
+      var inputMatrix = dataset.ToArray(dataset.VariableNames.Where(x => x.StartsWith("input")), Enumerable.Range(0, dataset.Rows));
+      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+        throw new NotSupportedException("k-Means clustering does not support NaN or infinity values in the input dataset.");
+      var indices = Enumerable.Range(0, inputMatrix.GetLength(0)).ToArray();
+      return indices.Select(i =>
+            K2Parameter.Value.Value > 0 ? indices.Where(j => j != i).Select(j =>
+                    1 / Math.Sqrt(EuclideanSquared(inputMatrix, inputMatrix, i, j))
+            ).OrderBy(x => x).Take(K2Parameter.Value.Value).Sum() : 1.0
+         ).ToArray();
+    }
+    private static double EuclideanSquared(double[,] input, double[,] input2, int row1, int row2) {
+      var sum = 0.0;
+      for (var i = 0; i < input.GetLength(1); i++) {
+        var d = input[row1, i] - input2[row2, i];
+        sum += d * d;
+      }
+      return sum;
+    }
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/InfillSolver.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/InfillSolver.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/InfillSolver.cs	(revision 15064)
@@ -0,0 +1,107 @@
+﻿#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 System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.EGO {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("InfillSolver", "A RealVectorCreator that creates candidates by optimizing an infill-subproblem")]
+  [StorableClass]
+  public class InfillSolver : RealVectorCreator {
+
+    public ILookupParameter<IAlgorithm> InfillOptimizationAlgorithmParamter => (ILookupParameter<IAlgorithm>)Parameters["InfillAlgorithm"];
+    public ILookupParameter<IRegressionSolution> ModelParameter => (ILookupParameter<IRegressionSolution>)Parameters["Model"];
+    public ILookupParameter<BoolValue> MaximizationParameter => (ILookupParameter<BoolValue>)Parameters["Maximization"];
+    public ILookupParameter<BoolValue> RemoveDuplicatesParameter => (ILookupParameter<BoolValue>)Parameters["RemoveDuplicates"];
+    public IFixedValueParameter<DoubleValue> DuplicateCutoffParameter => (IFixedValueParameter<DoubleValue>)Parameters["Duplicates Cutoff"];
+    public ILookupParameter<DoubleMatrix> InfillBoundsParameter => (ILookupParameter<DoubleMatrix>)Parameters["InfillBounds"];
+
+    [StorableConstructor]
+    protected InfillSolver(bool deserializing) : base(deserializing) { }
+    protected InfillSolver(InfillSolver original, Cloner cloner) : base(original, cloner) { }
+    public InfillSolver() {
+      Parameters.Add(new LookupParameter<IAlgorithm>("InfillAlgorithm", "The algorithm used to optimize the infill problem") { Hidden = true });
+      Parameters.Add(new LookupParameter<IRegressionSolution>("Model", "The RegressionSolution upon which the InfillProblem operates") { Hidden = true });
+      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "Whether the original problem is a maximization problem") { Hidden = true });
+      Parameters.Add(new LookupParameter<BoolValue>("RemoveDuplicates", "Whether duplicates shall be removed") { Hidden = true });
+      Parameters.Add(new FixedValueParameter<DoubleValue>("Duplicates Cutoff", "The cut off radius for", new DoubleValue(0.01)) { Hidden = false });
+      Parameters.Add(new LookupParameter<DoubleMatrix>("InfillBounds", "The bounds applied for infill solving") { Hidden = true });
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new InfillSolver(this, cloner);
+    }
+
+    protected override RealVector Create(IRandom random, IntValue length, DoubleMatrix bounds) {
+      var infillBounds = InfillBoundsParameter.ActualValue;
+      if (infillBounds != null && infillBounds.Rows > 0) {
+        bounds = infillBounds;
+      }
+
+      var alg = InfillOptimizationAlgorithmParamter.ActualValue;
+      var model = ModelParameter.ActualValue;
+      var max = MaximizationParameter.ActualValue.Value;
+      var res = OptimizeInfillProblem(alg, model, max, bounds, length.Value, random);
+      var rad = DuplicateCutoffParameter.Value.Value;
+      if (!RemoveDuplicatesParameter.ActualValue.Value || !(GetMinDifference(model.ProblemData.Dataset, res) < rad * rad)) return res;
+      for (var i = 0; i < res.Length; i++) res[i] += random.NextDouble() * rad * 2;
+      return res;
+    }
+
+    public static RealVector OptimizeInfillProblem(IAlgorithm algorithm, IRegressionSolution model, bool maximization, DoubleMatrix bounds, int length, IRandom random) {
+      var infillProblem = algorithm.Problem as InfillProblem;
+      if (infillProblem == null) throw new ArgumentException("The algortihm has no InfillProblem to solve");
+      infillProblem.Encoding.Length = length;
+      infillProblem.Encoding.Bounds = bounds;
+      infillProblem.Initialize(model, maximization);
+      var res = EgoUtilities.SyncRunSubAlgorithm(algorithm, random.Next(int.MaxValue));
+      var v = res[InfillProblem.BestInfillSolutionResultName].Value as RealVector;
+      algorithm.Runs.Clear();
+      return v;
+    }
+
+    private static double GetMinDifference(IDataset data, RealVector r) {
+      var mind = double.MaxValue;
+      for (var i = 0; i < data.Rows; i++) {
+        var d = 0.0;
+        for (var j = 0; j < r.Length; j++) {
+          var d2 = data.GetDoubleValue("input" + j, i) - r[j];
+          d += d2 * d2;
+        }
+        if (!(d < mind)) continue;
+        mind = d;
+      }
+      return mind;
+    }
+
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelBuilder.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelBuilder.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelBuilder.cs	(revision 15064)
@@ -0,0 +1,137 @@
+﻿#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 System;
+using System.Linq;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.EGO {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("ModelBuilder", "Builds a model from a dataset and a given RegressionAlgorithm")]
+  [StorableClass]
+  public class ModelBuilder : InstrumentedOperator, IStochasticOperator {
+    public override bool CanChangeName => true;
+
+    public ILookupParameter<IDataAnalysisAlgorithm<IRegressionProblem>> RegressionAlgorithmParameter => (ILookupParameter<IDataAnalysisAlgorithm<IRegressionProblem>>)Parameters["RegressionAlgorithm"];
+    public ILookupParameter<IRegressionSolution> ModelParameter => (ILookupParameter<IRegressionSolution>)Parameters["Model"];
+    public ILookupParameter<ModifiableDataset> DatasetParameter => (ILookupParameter<ModifiableDataset>)Parameters["Dataset"];
+    public ILookupParameter<IRandom> RandomParameter => (ILookupParameter<IRandom>)Parameters["Random"];
+    public ILookupParameter<IntValue> MaxModelSizeParameter => (ILookupParameter<IntValue>)Parameters["Maximal Model Size"];
+    public ILookupParameter<DoubleMatrix> InfillBoundsParameter => (ILookupParameter<DoubleMatrix>)Parameters["InfillBounds"];
+
+    [StorableConstructor]
+    protected ModelBuilder(bool deserializing) : base(deserializing) { }
+    protected ModelBuilder(ModelBuilder original, Cloner cloner) : base(original, cloner) { }
+    public ModelBuilder() {
+      Parameters.Add(new LookupParameter<IDataAnalysisAlgorithm<IRegressionProblem>>("RegressionAlgorithm", "The algorithm used to build a model") { Hidden = true });
+      Parameters.Add(new LookupParameter<IRegressionSolution>("Model", "The resulting model") { Hidden = true });
+      Parameters.Add(new LookupParameter<ModifiableDataset>("Dataset", "The Dataset from which the model is created") { Hidden = true });
+      Parameters.Add(new LookupParameter<IRandom>("Random", "A random number generator") { Hidden = true });
+      Parameters.Add(new LookupParameter<IntValue>("Maximal Model Size", "The maximum number of sample points used to build the model (Set -1 for infinite size") { Hidden = true });
+      Parameters.Add(new LookupParameter<DoubleMatrix>("InfillBounds", "The bounds applied for infill solving") { Hidden = true });
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ModelBuilder(this, cloner);
+    }
+
+    public override IOperation InstrumentedApply() {
+      var regressionAlg = RegressionAlgorithmParameter.ActualValue;
+      IDataset data = DatasetParameter.ActualValue;
+      var random = RandomParameter.ActualValue;
+      var oldModel = ModelParameter.ActualValue;
+      var max = MaxModelSizeParameter.ActualValue.Value;
+      if (data.Rows > max && max > 0) {
+        data = SelectBestSamples(data, max);
+        InfillBoundsParameter.ActualValue = GetBounds(data);
+      }
+      ModelParameter.ActualValue = BuildModel(random, regressionAlg, data, oldModel);
+      return base.InstrumentedApply();
+    }
+
+    private DoubleMatrix GetBounds(IDataset data) {
+      var res = new DoubleMatrix(data.Columns - 1, 2);
+      var names = data.DoubleVariables.ToArray();
+      for (var i = 0; i < names.Length - 1; i++) {
+        res[i, 0] = data.GetDoubleValues(names[i]).Min();
+        res[i, 1] = data.GetDoubleValues(names[i]).Max();
+      }
+      return res;
+    }
+
+    private static Dataset SelectBestSamples(IDataset data, int max) {
+      var bestSampleIndices = data.GetDoubleValues("output").Select((d, i) => Tuple.Create(d, i)).OrderBy(x => x.Item1).Take(max).Select(x => x.Item2).ToArray();
+      return new Dataset(data.VariableNames, data.VariableNames.Select(v => data.GetDoubleValues(v, bestSampleIndices).ToList()));
+    }
+
+    private static IRegressionSolution BuildModel(IRandom random, IDataAnalysisAlgorithm<IRegressionProblem> regressionAlgorithm, IDataset dataset, IRegressionSolution oldSolution) {
+      //var dataset = EgoUtilities.GetDataSet(dataSamples, RemoveDuplicates);
+      var problemdata = new RegressionProblemData(dataset, dataset.VariableNames.Where(x => !x.Equals("output")), "output");
+      problemdata.TrainingPartition.Start = 0;
+      problemdata.TrainingPartition.End = dataset.Rows;
+      problemdata.TestPartition.Start = dataset.Rows;
+      problemdata.TestPartition.End = dataset.Rows;
+
+      //train 
+      var problem = (RegressionProblem)regressionAlgorithm.Problem;
+      problem.ProblemDataParameter.Value = problemdata;
+      var i = 0;
+      IRegressionSolution solution = null;
+
+      while (solution == null && i++ < 100) {
+        var results = EgoUtilities.SyncRunSubAlgorithm(regressionAlgorithm, random.Next(int.MaxValue));
+        solution = results.Select(x => x.Value).OfType<IRegressionSolution>().SingleOrDefault();
+      }
+
+      //try creating a model with old hyperparameters and new dataset;
+      var gp = regressionAlgorithm as GaussianProcessRegression;
+      var oldmodel = oldSolution as GaussianProcessRegressionSolution;
+      if (gp != null && oldmodel != null) {
+        var mean = (IMeanFunction)oldmodel.Model.MeanFunction.Clone();
+        var cov = (ICovarianceFunction)oldmodel.Model.CovarianceFunction.Clone();
+        try {
+          var model = new GaussianProcessModel(problemdata.Dataset, problemdata.TargetVariable,
+            problemdata.AllowedInputVariables, problemdata.TrainingIndices, new[] { 0.0 }, mean, cov);
+          model.FixParameters();
+          var sol = new GaussianProcessRegressionSolution(model, problemdata);
+          if (solution == null || solution.TrainingMeanSquaredError > sol.TrainingMeanSquaredError) {
+            solution = sol;
+          }
+        }
+        catch (ArgumentException) { }
+      }
+
+      regressionAlgorithm.Runs.Clear();
+      return solution;
+
+    }
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelQualityAnalyzer.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelQualityAnalyzer.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelQualityAnalyzer.cs	(revision 15064)
@@ -0,0 +1,94 @@
+﻿#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.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.EGO {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("ModelQualityAnalyzer", "Collects RealVectors into a modifiablbe dataset")]
+  [StorableClass]
+  public class ModelQualityAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    public override bool CanChangeName => true;
+    public bool EnabledByDefault => false;
+
+    public ILookupParameter<IRegressionSolution> ModelParameter => (ILookupParameter<IRegressionSolution>)Parameters["Model"];
+    public ILookupParameter<ResultCollection> ResultsParameter => (ILookupParameter<ResultCollection>)Parameters["Results"];
+
+    private const string PlotName = "Model Quality Values";
+    private const string R2RowName = "Training R²";
+    private const string MAERowName = "Training Mean Absolute Error";
+    private const string RMSERowName = "Training Root Mean Squared Error";
+    private const string ModelResultName = "Model";
+
+
+    [StorableConstructor]
+    protected ModelQualityAnalyzer(bool deserializing) : base(deserializing) { }
+    protected ModelQualityAnalyzer(ModelQualityAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public ModelQualityAnalyzer() {
+      Parameters.Add(new LookupParameter<IRegressionSolution>("Model", "The model of this iteration"));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection to store the results in."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ModelQualityAnalyzer(this, cloner);
+    }
+
+    public sealed override IOperation Apply() {
+      var model = ModelParameter.ActualValue;
+      var results = ResultsParameter.ActualValue;
+      if (model == null) return base.Apply();
+      var plot = CreateDataTableResult(results);
+      plot.Rows[R2RowName].Values.Add(model.TrainingRSquared);
+      plot.Rows[MAERowName].Values.Add(model.TrainingMeanAbsoluteError);
+      plot.Rows[RMSERowName].Values.Add(model.TrainingRootMeanSquaredError);
+      if (!results.ContainsKey(ModelResultName)) results.Add(new Result(ModelResultName, model));
+      results[ModelResultName].Value = model;
+      return base.Apply();
+    }
+
+    private static DataTable CreateDataTableResult(ResultCollection results) {
+      DataTable plot;
+      if (!results.ContainsKey(PlotName)) {
+        plot = new DataTable("Model-Quality-Measures", "The quality measures of the models on the training data") {
+          VisualProperties = {
+            XAxisTitle = "Generation",
+          }
+        };
+        results.Add(new Result(PlotName, plot));
+      } else plot = (DataTable)results[PlotName].Value;
+      if (!plot.Rows.ContainsKey(R2RowName)) plot.Rows.Add(new DataRow(R2RowName, R2RowName, new double[0]));
+      if (!plot.Rows.ContainsKey(MAERowName)) plot.Rows.Add(new DataRow(MAERowName, MAERowName, new double[0]));
+      if (!plot.Rows.ContainsKey(RMSERowName)) plot.Rows.Add(new DataRow(RMSERowName, RMSERowName, new double[0]));
+
+      return plot;
+    }
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/SampleCollector.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/SampleCollector.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/SampleCollector.cs	(revision 15064)
@@ -0,0 +1,84 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.EGO {
+  /// <summary>
+  /// A base class for operators that manipulate real-valued vectors.
+  /// </summary>
+  [Item("SampleCollector", "Collects RealVectors into a modifiablbe dataset")]
+  [StorableClass]
+  public class SampleCollector : InstrumentedOperator {
+    public override bool CanChangeName => true;
+
+    public ILookupParameter<RealVector> RealVectorParameter => (ILookupParameter<RealVector>)Parameters["RealVector"];
+    public ILookupParameter<DoubleValue> QualityParameter => (ILookupParameter<DoubleValue>)Parameters["Quality"];
+    public ILookupParameter<ModifiableDataset> DatasetParameter => (ILookupParameter<ModifiableDataset>)Parameters["Dataset"];
+
+    [StorableConstructor]
+    protected SampleCollector(bool deserializing) : base(deserializing) { }
+    protected SampleCollector(SampleCollector original, Cloner cloner) : base(original, cloner) { }
+    public SampleCollector() {
+      Parameters.Add(new LookupParameter<RealVector>("RealVector", "The vector which should be collected."));
+      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality associated which this vector"));
+      Parameters.Add(new LookupParameter<ModifiableDataset>("Dataset", "The Dataset in wich new samples are stored."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SampleCollector(this, cloner);
+    }
+
+    public sealed override IOperation InstrumentedApply() {
+      var vector = RealVectorParameter.ActualValue;
+      var quality = QualityParameter.ActualValue.Value;
+      var data = DatasetParameter.ActualValue;
+
+      if (data.Columns != vector.Length + 1) {
+        if (data.Columns != 0 || data.Rows != 0) throw new OperatorExecutionException(this, "dataset columns do not match samplesize+1");
+        for (var i = 0; i < vector.Length; i++)
+          data.AddVariable("input" + i, new double[0]);
+        data.AddVariable("output", new double[0]);
+      }
+      AddRow(data, vector, quality);
+      return base.InstrumentedApply(); ;
+    }
+
+
+    private static void AddRow(ModifiableDataset data, RealVector vector, double quality) {
+      var row = new object[vector.Length + 1];
+      for (var i = 0; i < vector.Length; i++)
+        row[i] = vector[i];
+      row[vector.Length] = quality;
+      data.AddRow(row);
+    }
+
+
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/VariableVariabilityAnalyzer.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/VariableVariabilityAnalyzer.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/VariableVariabilityAnalyzer.cs	(revision 15064)
@@ -0,0 +1,102 @@
+﻿#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 System;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.EGO {
+  [Item("VariableVariabilityAnalyzer", "Analyzes the correlation between perdictions and actual fitness values")]
+  [StorableClass]
+  public class VariableVariabilityAnalyzer : SingleSuccessorOperator, IAnalyzer {
+    public override bool CanChangeName => true;
+    public bool EnabledByDefault => false;
+
+    public ILookupParameter<ModifiableDataset> DatasetParameter => (ILookupParameter<ModifiableDataset>)Parameters["Dataset"];
+    public ILookupParameter<ResultCollection> ResultsParameter => (ILookupParameter<ResultCollection>)Parameters["Results"];
+    public ILookupParameter<IntValue> InitialEvaluationsParameter => (ILookupParameter<IntValue>)Parameters["Initial Evaluations"];
+    public IFixedValueParameter<IntValue> LookBackSizeParameter => (IFixedValueParameter<IntValue>)Parameters["LookBackSize"];
+
+    private const string NormalizedPlotName = "Normalized Variable Variance";
+    private const string PlotName = "Variable Variance";
+
+    [StorableConstructor]
+    protected VariableVariabilityAnalyzer(bool deserializing) : base(deserializing) { }
+    protected VariableVariabilityAnalyzer(VariableVariabilityAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public VariableVariabilityAnalyzer() {
+      Parameters.Add(new FixedValueParameter<IntValue>("LookBackSize", new IntValue(10)));
+      Parameters.Add(new LookupParameter<IntValue>("Initial Evaluations"));
+      Parameters.Add(new LookupParameter<ModifiableDataset>("Dataset"));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The collection to store the results in."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new VariableVariabilityAnalyzer(this, cloner);
+    }
+
+    public sealed override IOperation Apply() {
+      var dataset = DatasetParameter.ActualValue;
+      var results = ResultsParameter.ActualValue;
+      var initialEvals = InitialEvaluationsParameter.ActualValue.Value;
+      var lbsize = LookBackSizeParameter.Value.Value;
+
+      var normPlot = CreateScatterPlotResult(results, NormalizedPlotName);
+      var plot = CreateScatterPlotResult(results, PlotName);
+      foreach (var s in dataset.VariableNames) {
+        if (!normPlot.Rows.ContainsKey(s)) normPlot.Rows.Add(new DataRow(s));
+        if (!plot.Rows.ContainsKey(s)) plot.Rows.Add(new DataRow(s));
+
+        if (dataset.Rows < lbsize) continue;
+        var wd = dataset.GetDoubleValues(s, Enumerable.Range(dataset.Rows - lbsize, lbsize)).StandardDeviation();
+        plot.Rows[s].Values.Add(wd);
+
+        if (dataset.Rows < Math.Max(initialEvals, lbsize)) continue;
+        var sd = dataset.GetDoubleValues(s, Enumerable.Range(0, initialEvals)).StandardDeviation();
+        normPlot.Rows[s].Values.Add(wd / sd);
+      }
+      return base.Apply();
+    }
+
+    private static DataTable CreateScatterPlotResult(ResultCollection results, string plotname) {
+      DataTable plot;
+      if (!results.ContainsKey(plotname)) {
+        plot = new DataTable(plotname) {
+          VisualProperties = {
+            XAxisTitle = "Iteration",
+            YAxisTitle = plotname.Equals(NormalizedPlotName)? "Normalized Variance (Variance of last Samples)/(Variance of Initial Samples)" : "Standard deviation of last samples"
+          }
+        };
+        results.Add(new Result(plotname, plot));
+      }
+      plot = (DataTable)results[plotname].Value;
+      return plot;
+    }
+
+  }
+}
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Plugin.cs.frame
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Plugin.cs.frame	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Plugin.cs.frame	(revision 15064)
@@ -28,5 +28,4 @@
   [Plugin("HeuristicLab.Algorithms.EGO", "3.4.5.$WCREV$")]
   [PluginFile("HeuristicLab.Algorithms.EGO-3.4.dll", PluginFileType.Assembly)]
-  [PluginFile("displayModelFrame.html", PluginFileType.Data)]
   [PluginDependency("HeuristicLab.Algorithms.CMAEvolutionStrategy", "3.4")]
   [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
@@ -34,10 +33,11 @@
   [PluginDependency("HeuristicLab.Collections", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
-  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
   [PluginDependency("HeuristicLab.Core", "3.3")]
   [PluginDependency("HeuristicLab.Data", "3.3")]
   [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")]
   [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")]
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Problems/InfillProblem.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Problems/InfillProblem.cs	(revision 15063)
+++ /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
+
   }
 }
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/LatinHyperCubeDesignCreator.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/LatinHyperCubeDesignCreator.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/LatinHyperCubeDesignCreator.cs	(revision 15064)
@@ -0,0 +1,81 @@
+﻿#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 System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+// ReSharper disable once CheckNamespace
+namespace HeuristicLab.Algorithms.EGO {
+
+  [StorableClass]
+  [Item("LatinHyperCubeDesignCreator", "A latin hypercube sampling strategy for real valued optimization")]
+  public class LatinHyperCubeDesignCreator : RealVectorCreator, IInitialSampling {
+    private IValueLookupParameter<IntValue> DesignSize => (IValueLookupParameter<IntValue>)Parameters["DesignSize"];
+    [Storable]
+    private Queue<RealVector> design = new Queue<RealVector>();
+
+    [StorableConstructor]
+    protected LatinHyperCubeDesignCreator(bool deserializing) : base(deserializing) { }
+
+    protected LatinHyperCubeDesignCreator(LatinHyperCubeDesignCreator original, Cloner cloner) : base(original, cloner) {
+      design = new Queue<RealVector>(original.design.Select(cloner.Clone));
+    }
+    public LatinHyperCubeDesignCreator() {
+      Parameters.Add(new ValueLookupParameter<IntValue>("DesignSize", "The size of the LHS-design produced by this creator"));
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LatinHyperCubeDesignCreator(this, cloner);
+    }
+
+    public RealVector[] GetSamples(int noSamples, RealVector[] existingSamples, RealVectorEncoding encoding, IRandom random) {
+      return GetSamples(random, encoding.Length, encoding.Bounds, noSamples);
+    }
+
+    public RealVector[] GetSamples(IRandom random, int dimensions, DoubleMatrix bounds, int noSamples) {
+      if (noSamples < 1) throw new ArgumentException("Designs need to have at least 1 Point");
+      var samples = new RealVector[noSamples];
+      for (var i = 0; i < noSamples; i++) samples[i] = new RealVector(dimensions);
+
+      for (var i = 0; i < dimensions; i++) {
+        var permutations = new Permutation(PermutationTypes.Absolute, noSamples, random);
+        var row = i % bounds.Rows;
+        var offset = bounds[row, 0];
+        var range = (bounds[row, 1] - offset) / noSamples;
+        for (var j = 0; j < noSamples; j++) samples[j][i] = offset + (permutations[j] + random.NextDouble()) * range;
+      }
+      return samples;
+    }
+
+    protected override RealVector Create(IRandom random, IntValue length, DoubleMatrix bounds) {
+      if (design.Count == 0) design = new Queue<RealVector>(GetSamples(random, length.Value, bounds, DesignSize.ActualValue.Value));
+      return design.Dequeue();
+    }
+  }
+}
+
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/LatinHyperCubeDesignOLD.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/LatinHyperCubeDesignOLD.cs	(revision 15064)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/LatinHyperCubeDesignOLD.cs	(revision 15064)
@@ -0,0 +1,142 @@
+﻿#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 System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+// ReSharper disable once CheckNamespace
+namespace HeuristicLab.Algorithms.EGO {
+
+ [StorableClass]
+ [Item("LatinHyperCubeDesign", "A latin hypercube sampling strategy for real valued optimization")]
+ public class LatinHyperCubeDesign : ParameterizedNamedItem, IInitialSampling {
+
+   public const string DesigningAlgorithmParamterName = "DesignningAlgorithm";
+   public IValueParameter<IAlgorithm> DesigningAlgorithmParameter => Parameters[DesigningAlgorithmParamterName] as IValueParameter<IAlgorithm>;
+   private IAlgorithm DesigningAlgorithm => DesigningAlgorithmParameter.Value;
+
+   [StorableConstructor]
+   protected LatinHyperCubeDesign(bool deserializing) : base(deserializing) { }
+   protected LatinHyperCubeDesign(LatinHyperCubeDesign original, Cloner cloner) : base(original, cloner) { }
+   public LatinHyperCubeDesign() {
+     var es = new EvolutionStrategy.EvolutionStrategy {
+       PopulationSize = { Value = 50 },
+       Children = { Value = 100 },
+       MaximumGenerations = { Value = 300 }
+     };
+     Parameters.Add(new ValueParameter<IAlgorithm>(DesigningAlgorithmParamterName, "The Algorithm used for optimizing the Latin Hypercube (minimax) criterion.", es));
+   }
+   public override IDeepCloneable Clone(Cloner cloner) {
+     return new LatinHyperCubeDesign(this, cloner);
+   }
+
+   public RealVector[] GetSamples(int noSamples, RealVector[] existingSamples, RealVectorEncoding encoding, IRandom random) {
+     var lhsprob = new LHSProblem(noSamples, existingSamples, encoding);
+     DesigningAlgorithm.Problem = lhsprob;
+     EgoUtilities.SyncRunSubAlgorithm(DesigningAlgorithm, random.Next());
+     return lhsprob.BestSolution;
+   }
+ }
+
+ [StorableClass]
+ internal class LHSProblem : SingleObjectiveBasicProblem<RealVectorEncoding> {
+   [Storable]
+   private int NoVectors;
+   [Storable]
+   private int NoDimensions;
+   [Storable]
+   private RealVector[] ExistingSamples;
+
+   [Storable]
+   public double BestQuality = double.MinValue;
+   [Storable]
+   public RealVector[] BestSolution;
+
+   [StorableConstructor]
+   protected LHSProblem(bool deserializing) : base(deserializing) { }
+   protected LHSProblem(LHSProblem original, Cloner cloner) : base(original, cloner) {
+     NoDimensions = original.NoDimensions;
+     NoVectors = original.NoVectors;
+     ExistingSamples = original.ExistingSamples?.Select(cloner.Clone).ToArray();
+   }
+   public LHSProblem(int novectors, RealVector[] existingSamples, RealVectorEncoding encoding) {
+     NoVectors = novectors;
+     NoDimensions = encoding.Length;
+     ExistingSamples = existingSamples;
+     Encoding.Length = novectors * encoding.Length;
+     var b = new DoubleMatrix(Encoding.Length, 2);
+     for (int i = 0; i < novectors; i++) {
+       for (int j = 0; j < encoding.Length; j++) {
+         var k = j % encoding.Bounds.Rows;
+         b[i * encoding.Length + j, 0] = encoding.Bounds[k, 0];
+         b[i * encoding.Length + j, 1] = encoding.Bounds[k, 1];
+       }
+     }
+     Encoding.Bounds = b;
+
+   }
+   public override IDeepCloneable Clone(Cloner cloner) {
+     return new LHSProblem(this, cloner);
+   }
+
+   public override double Evaluate(Individual individual, IRandom random) {
+     return Enumerable.Range(0, NoVectors).Select(x => MinDistance(x, individual.RealVector())).Min();
+   }
+
+   //returns -1 if no distance can be calculated
+   private double MinDistance(int pointNumber, RealVector design) {
+     var min = double.MaxValue;
+     if (ExistingSamples != null && ExistingSamples.Length != 0) min = ExistingSamples.Select(x => Distance(x, ExtractPoint(pointNumber, design))).Min();
+     if (pointNumber == 0) return min;
+     var min2 = Enumerable.Range(0, pointNumber).Select(i => Distance(ExtractPoint(i, design), ExtractPoint(pointNumber, design))).Min();
+     return min < 0 ? min2 : Math.Min(min, min2);
+   }
+   private IEnumerable<double> ExtractPoint(int pointNumber, RealVector design) {
+     return design.Skip(NoDimensions * pointNumber).Take(NoDimensions);
+   }
+   private static double Distance(IEnumerable<double> a, IEnumerable<double> b) {
+     return a.Zip(b, (d, d1) => d - d1).Sum(d => d * d);
+   }
+
+   public override void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) {
+     base.Analyze(individuals, qualities, results, random);
+     var i = qualities.ArgMin(x => x);
+     if (BestQuality > qualities[i]) return;
+     var r = individuals[i].RealVector();
+     BestSolution = Enumerable.Range(0, NoVectors).Select(x => new RealVector(ExtractPoint(x, r).ToArray())).ToArray();
+   }
+   public override bool Maximization => true;
+ }
+
+
+
+
+}
+*/
Index: /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/UniformRandomSampling.cs
===================================================================
--- /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/UniformRandomSampling.cs	(revision 15063)
+++ /branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/SamplingMethods/UniformRandomSampling.cs	(revision 15064)
@@ -34,6 +34,6 @@
     #region HL-Constructors, Serialization and Cloning 
     [StorableConstructor]
-    private UniformRandomSampling(bool deserializing) : base(deserializing) { }
-    private UniformRandomSampling(UniformRandomSampling original, Cloner cloner) : base(original, cloner) { }
+    protected UniformRandomSampling(bool deserializing) : base(deserializing) { }
+    protected UniformRandomSampling(UniformRandomSampling original, Cloner cloner) : base(original, cloner) { }
     public UniformRandomSampling() {
     }
