Index: branches/ProblemRefactoring/HeuristicLab 3.3.sln
===================================================================
--- branches/ProblemRefactoring/HeuristicLab 3.3.sln	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab 3.3.sln	(revision 14429)
@@ -1,6 +1,6 @@
 ﻿
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96396439-A764-4022-A8D2-BE021449B8D1}"
@@ -451,4 +451,7 @@
 EndProject
 Global
+	GlobalSection(Performance) = preSolution
+		HasPerformanceSessions = true
+	EndGlobalSection
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/BinaryCanonicalGeneticAlgorithm.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/BinaryCanonicalGeneticAlgorithm.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/BinaryCanonicalGeneticAlgorithm.cs	(revision 14429)
@@ -0,0 +1,51 @@
+﻿#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.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Selection;
+using TProblem = HeuristicLab.Optimization.SingleObjectiveProblem<HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVectorEncoding, HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVector>;
+using TContext = HeuristicLab.Algorithms.GeneticAlgorithm.EvolutionaryAlgorithmContext<HeuristicLab.Optimization.SingleObjectiveProblem<HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVectorEncoding, HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVector>, HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVectorEncoding, HeuristicLab.Encodings.BinaryVectorEncoding.BinaryVector>;
+
+namespace HeuristicLab.Algorithms.GeneticAlgorithm {
+  [Item("Canonical Genetic Algorithm (binary) (CGA)", "Performs a canonical genetic algorithm.")]
+  [Creatable(CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 999)]
+  [StorableClass]
+  public sealed class BinaryCanonicalGeneticAlgorithm : CanonicalGeneticAlgorithm<TProblem, BinaryVectorEncoding, BinaryVector> {
+
+    [StorableConstructor]
+    private BinaryCanonicalGeneticAlgorithm(bool deserializing) : base(deserializing) { }
+    private BinaryCanonicalGeneticAlgorithm(BinaryCanonicalGeneticAlgorithm original, Cloner cloner)
+      : base(original, cloner) { }
+    public BinaryCanonicalGeneticAlgorithm() {
+      SelectorParameter.ValidValues.Add(new TournamentSelector<TContext, TProblem, BinaryVectorEncoding, BinaryVector>());
+      MutatorParameter.ValidValues.Add(new SingleBitflipManipulator<TContext>());
+      MutatorParameter.ValidValues.Add(new MultiBitflipManipulator<TContext>());
+      CrossoverParameter.ValidValues.Add(new NPointCrossover<TContext>());
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BinaryCanonicalGeneticAlgorithm(this, cloner);
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/CanonicalGeneticAlgorithm.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/CanonicalGeneticAlgorithm.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/CanonicalGeneticAlgorithm.cs	(revision 14429)
@@ -0,0 +1,206 @@
+﻿#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 System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Selection;
+using HeuristicLab.Optimization.Algorithms.SingleObjective;
+using HeuristicLab.Optimization.Crossover;
+using HeuristicLab.Optimization.Manipulation;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.GeneticAlgorithm {
+  public class CanonicalGeneticAlgorithm<TProblem, TEncoding, TSolution> : HeuristicAlgorithm<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>, TProblem, TEncoding, TSolution>
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+
+    [Storable]
+    private IValueParameter<IntValue> populationSize;
+    public int PopulationSize {
+      get { return populationSize.Value.Value; }
+      set {
+        if (value < 2) throw new ArgumentException("PopulationSize cannot be smaller than 2");
+        populationSize.Value.Value = value;
+      }
+    }
+
+    [Storable]
+    private IConstrainedValueParameter<ISelector<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>> selector;
+    public IConstrainedValueParameter<ISelector<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>> SelectorParameter {
+      get { return selector; }
+    }
+    public ISelector<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>> Selector {
+      get { return selector.Value; }
+      set {
+        if (!selector.ValidValues.Contains(value))
+          selector.ValidValues.Add(value);
+        selector.Value = value;
+      }
+    }
+
+    [Storable]
+    private IConstrainedValueParameter<ICrossover<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>> crossover;
+    public IConstrainedValueParameter<ICrossover<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>> CrossoverParameter {
+      get { return crossover; }
+    }
+    public ICrossover<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>> Crossover {
+      get { return crossover.Value; }
+      set {
+        if (!crossover.ValidValues.Contains(value))
+          crossover.ValidValues.Add(value);
+        crossover.Value = value;
+      }
+    }
+
+    [Storable]
+    private IConstrainedValueParameter<IManipulator<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>> mutator;
+    public IConstrainedValueParameter<IManipulator<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>> MutatorParameter {
+      get { return mutator; }
+    }
+    public IManipulator<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>> Mutator {
+      get { return mutator.Value; }
+      set {
+        if (!mutator.ValidValues.Contains(value))
+          mutator.ValidValues.Add(value);
+        mutator.Value = value;
+      }
+    }
+
+    [Storable]
+    private IValueParameter<PercentValue> mutationProbability;
+    public double MutationProbability {
+      get { return mutationProbability.Value.Value; }
+      set { mutationProbability.Value.Value = value; }
+    }
+
+    [Storable]
+    private IValueParameter<IntValue> elitism;
+    public int Elitism {
+      get { return elitism.Value.Value; }
+      set {
+        if (value < 0) throw new ArgumentException("Elitism cannot be negative");
+        elitism.Value.Value = value;
+      }
+    }
+
+    [Storable]
+    protected BestAverageWorstQualityAnalyzer qualityAnalyzer;
+
+    [StorableConstructor]
+    protected CanonicalGeneticAlgorithm(bool deserializing) : base(deserializing) { }
+    protected CanonicalGeneticAlgorithm(CanonicalGeneticAlgorithm<TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) {
+      populationSize = cloner.Clone(original.populationSize);
+      selector = cloner.Clone(original.selector);
+      crossover = cloner.Clone(original.crossover);
+      mutator = cloner.Clone(original.mutator);
+      mutationProbability = cloner.Clone(original.mutationProbability);
+      elitism = cloner.Clone(original.elitism);
+    }
+    public CanonicalGeneticAlgorithm() {
+      ProblemAnalyzer = new MultiAnalyzer();
+      AlgorithmAnalyzer = new MultiAnalyzer();
+      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
+      AlgorithmAnalyzer.Operators.Add(qualityAnalyzer, true);
+
+      Parameters.Add(populationSize = new ValueParameter<IntValue>("PopulationSize", "The number of individuals in the population", new IntValue(100)));
+      Parameters.Add(selector = new ConstrainedValueParameter<ISelector<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>>("Selector", "The selection heuristic that creates the mating pool."));
+      Parameters.Add(crossover = new ConstrainedValueParameter<ICrossover<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>>("Crossover", "The crossover heuristic that takes two parents and produces a child."));
+      Parameters.Add(mutator = new ConstrainedValueParameter<IManipulator<EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>>>("Mutator", "The mutation heuristic that slightly alters an individual."));
+      Parameters.Add(mutationProbability = new ValueParameter<PercentValue>("MutationProbability", "The probability with which mutation will be applied to an individual after mating.", new PercentValue(0.05)));
+      Parameters.Add(elitism = new ValueParameter<IntValue>("Elitism", "The number of best solutions from the old population that will live in the next generation."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CanonicalGeneticAlgorithm<TProblem, TEncoding, TSolution>(this, cloner);
+    }
+
+    protected override void OnProblemChanged() {
+      base.OnProblemChanged();
+      qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      qualityAnalyzer.QualityParameter.Depth = 1;
+      qualityAnalyzer.QualityParameter.Hidden = true;
+    }
+
+    protected override void PerformInitialize(CancellationToken token) {
+      for (var i = 0; i < PopulationSize; i++) {
+        var solutionScope = CreateEmptySolutionScope();
+        Context.Scope.SubScopes.Add(solutionScope);
+        RunOperator(Problem.Encoding.SolutionCreator, solutionScope, token);
+      }
+      EvaluatePopulation(Context.Scope.SubScopes.OfType<ISingleObjectiveSolutionScope<TSolution>>().ToList(), token);
+    }
+
+    protected override void PerformIterate(CancellationToken token) {
+      Selector.Select(Context, 2 * (PopulationSize - Elitism), true);
+      var pool = Context.MatingPool.ToList();
+
+      var nextGen = new List<ISingleObjectiveSolutionScope<TSolution>>(PopulationSize);
+      for (var i = 0; i < PopulationSize - Elitism; i++) {
+        Context.Parents = Tuple.Create(pool[2 * i], pool[2 * i + 1]);
+        Context.Child = CreateEmptySolutionScope();
+        Crossover.Cross(Context);
+        if (Context.Random.NextDouble() < MutationProbability)
+          Mutator.Manipulate(Context);
+        nextGen.Add(Context.Child);
+      }
+      EvaluatePopulation(nextGen, token);
+      if (Elitism > 0) {
+        nextGen.AddRange(Problem.Maximization
+          ? Context.Population.OrderByDescending(x => x.Fitness).Take(Elitism)
+          : Context.Population.OrderBy(x => x.Fitness).Take(Elitism));
+      }
+      
+      Context.Scope.SubScopes.Replace(nextGen);
+      Context.Iterations++;
+    }
+
+    private void EvaluatePopulation(ICollection<ISingleObjectiveSolutionScope<TSolution>> solutions, CancellationToken token) {
+      Parallel.ForEach(solutions, p => Evaluate(p, token));
+      Context.EvaluatedSolutions += solutions.Count;
+      var best = Problem.Maximization ? solutions.MaxItems(x => x.Fitness).First() : solutions.MinItems(x => x.Fitness).First();
+      if (IsBetter(Problem.Maximization, best.Fitness, Context.BestQuality)) {
+        Context.BestQuality = best.Fitness;
+        Context.BestSolution = (TSolution)best.Solution.Clone();
+      }
+    }
+
+    protected override void PerformAnalyze(CancellationToken token) {
+      base.PerformAnalyze(token);
+
+      IResult res;
+      if (!Results.TryGetValue("Generations", out res)) {
+        res = new Result("Generations", new IntValue(Context.Iterations));
+        Results.Add(res);
+      } else ((IntValue)res.Value).Value = Context.Iterations;
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/EvolutionaryAlgorithmContext.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/EvolutionaryAlgorithmContext.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/EvolutionaryAlgorithmContext.cs	(revision 14429)
@@ -0,0 +1,114 @@
+﻿#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.Optimization;
+using HeuristicLab.Optimization.Algorithms.SingleObjective;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.GeneticAlgorithm {
+  [Item("Evolutionary Algorithm Context", "", ExcludeGenericTypeInfo = true)]
+  [StorableClass]
+  public class EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution> : HeuristicAlgorithmContext<TProblem, TEncoding, TSolution>,
+      ISingleObjectivePopulationContext<TSolution>, ISingleObjectiveMatingpoolContext<TSolution>, ISingleObjectiveMatingContext<TSolution>,
+      ISingleObjectiveSolutionContext<TSolution>, IIterationsContext
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+
+    [StorableConstructor]
+    protected EvolutionaryAlgorithmContext(bool deserializing) : base(deserializing) { }
+
+    protected EvolutionaryAlgorithmContext(EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) {
+      matingPool = original.matingPool != null ? original.matingPool.Select(cloner.Clone).ToList() : null;
+      parents = original.parents != null ? Tuple.Create(cloner.Clone(original.parents.Item1), cloner.Clone(original.parents.Item2)) : null;
+      child = original.child != null ? cloner.Clone(child) : null;
+    }
+    public EvolutionaryAlgorithmContext() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EvolutionaryAlgorithmContext<TProblem, TEncoding, TSolution>(this, cloner);
+    }
+
+    IEnumerable<IScope> IPopulationContext.Population {
+      get { return Scope.SubScopes; }
+    }
+
+    IEnumerable<ISolutionScope<TSolution>> IPopulationContext<TSolution>.Population {
+      get { return Scope.SubScopes.OfType<ISolutionScope<TSolution>>(); }
+    }
+    
+    public IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population {
+      get { return Scope.SubScopes.OfType<ISingleObjectiveSolutionScope<TSolution>>(); }
+    }
+
+    [Storable]
+    private IEnumerable<ISingleObjectiveSolutionScope<TSolution>> matingPool;
+    public IEnumerable<ISingleObjectiveSolutionScope<TSolution>> MatingPool {
+      get { return matingPool; }
+      set { matingPool = value; }
+    }
+    IEnumerable<ISolutionScope<TSolution>> IMatingpoolContext<TSolution>.MatingPool {
+      get { return matingPool; }
+      set { matingPool = value.OfType<ISingleObjectiveSolutionScope<TSolution>>(); }
+    }
+
+    [Storable]
+    private Tuple<ISingleObjectiveSolutionScope<TSolution>, ISingleObjectiveSolutionScope<TSolution>> parents;
+    public Tuple<ISingleObjectiveSolutionScope<TSolution>, ISingleObjectiveSolutionScope<TSolution>> Parents {
+      get { return parents; }
+      set { parents = value; }
+    }
+    Tuple<ISolutionScope<TSolution>, ISolutionScope<TSolution>> IMatingContext<TSolution>.Parents {
+      get { return Tuple.Create((ISolutionScope<TSolution>)Parents.Item1, (ISolutionScope<TSolution>)Parents.Item2); }
+    }
+
+    [Storable]
+    private ISingleObjectiveSolutionScope<TSolution> child;
+
+
+    public ISingleObjectiveSolutionScope<TSolution> Child {
+      get { return child; }
+      set { child = value; }
+    }
+    ISolutionScope<TSolution> IMatingContext<TSolution>.Child {
+      get { return Child; }
+    }
+    public ISingleObjectiveSolutionScope<TSolution> Solution {
+      get { return child; }
+    }
+    ISolutionScope<TSolution> ISolutionContext<TSolution>.Solution { get { return child; } }
+    IScope ISolutionContext.Solution { get { return child; } }
+
+    [Storable]
+    private int iterations;
+    public int Iterations {
+      get { return iterations; }
+      set { iterations = value; }
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj	(revision 14429)
@@ -115,4 +115,7 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BinaryCanonicalGeneticAlgorithm.cs" />
+    <Compile Include="CanonicalGeneticAlgorithm.cs" />
+    <Compile Include="EvolutionaryAlgorithmContext.cs" />
     <Compile Include="GeneticAlgorithm.cs" />
     <Compile Include="GeneticAlgorithmMainLoop.cs" />
@@ -147,4 +150,8 @@
       <Name>HeuristicLab.Data-3.3</Name>
       <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj">
+      <Project>{66D249C3-A01D-42A8-82A2-919BC8EC3D83}</Project>
+      <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/BinaryIteratedLocalSearch.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/BinaryIteratedLocalSearch.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/BinaryIteratedLocalSearch.cs	(revision 14429)
@@ -0,0 +1,54 @@
+﻿#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.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Encodings.BinaryVectorEncoding.LocalSearch;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.LocalSearch {
+  [Item("Iterated Local Search (ILS)", "Performs a repeated local search by applying a kick to each previous local optimum.")]
+  [Creatable(CreatableAttribute.Categories.SingleSolutionAlgorithms, Priority = 999)]
+  [StorableClass]
+  public sealed class BinaryIteratedLocalSearch : IteratedLocalSearch<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, BinaryVectorEncoding, BinaryVector> {
+
+    [StorableConstructor]
+    private BinaryIteratedLocalSearch(bool deserializing) : base(deserializing) { }
+    private BinaryIteratedLocalSearch(BinaryIteratedLocalSearch original, Cloner cloner)
+      : base(original, cloner) { }
+    public BinaryIteratedLocalSearch() {
+      var ls = new ExhaustiveBitflip<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, LocalSearchContext<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, BinaryVectorEncoding, BinaryVector>>();
+      LocalSearchParameter.ValidValues.Add(ls);
+      //foreach (var ls in ApplicationManager.Manager.GetInstances<IBinaryLocalSearch<LocalSearchContext<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, BinaryVectorEncoding, BinaryVector>>>())
+        //LocalSearchParameter.ValidValues.Add(ls);
+      KickerParameter.ValidValues.Add(new SingleBitflipManipulator<LocalSearchContext<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, BinaryVectorEncoding, BinaryVector>>());
+      KickerParameter.ValidValues.Add(new MultiBitflipManipulator<LocalSearchContext<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, BinaryVectorEncoding, BinaryVector>>());
+      //foreach (var ls in ApplicationManager.Manager.GetInstances<IManipulator<LocalSearchContext<SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector>, BinaryVectorEncoding, BinaryVector>>>())
+      //KickerParameter.ValidValues.Add(ls);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BinaryIteratedLocalSearch(this, cloner);
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/HeuristicLab.Algorithms.LocalSearch-3.3.csproj
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/HeuristicLab.Algorithms.LocalSearch-3.3.csproj	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/HeuristicLab.Algorithms.LocalSearch-3.3.csproj	(revision 14429)
@@ -114,4 +114,7 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BinaryIteratedLocalSearch.cs" />
+    <Compile Include="IteratedLocalSearch.cs" />
+    <Compile Include="LocalSearchContext.cs" />
     <Compile Include="LocalSearchImprovementOperator.cs" />
     <Compile Include="LocalSearchMainLoop.cs" />
@@ -150,4 +153,8 @@
       <Name>HeuristicLab.Data-3.3</Name>
       <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj">
+      <Project>{66D249C3-A01D-42A8-82A2-919BC8EC3D83}</Project>
+      <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/IteratedLocalSearch.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/IteratedLocalSearch.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/IteratedLocalSearch.cs	(revision 14429)
@@ -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.Threading;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Algorithms.SingleObjective;
+using HeuristicLab.Optimization.LocalSearch;
+using HeuristicLab.Optimization.Manipulation;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.LocalSearch {
+  [Item("Iterated Local Search (ILS)", "Performs a repeated local search by applying a kick to each previous local optimum.")]
+  [Creatable(CreatableAttribute.Categories.SingleSolutionAlgorithms, Priority = 999)]
+  [StorableClass]
+  public class IteratedLocalSearch<TProblem, TEncoding, TSolution> : HeuristicAlgorithm<LocalSearchContext<TProblem, TEncoding, TSolution>, TProblem, TEncoding, TSolution>
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+
+    public IConstrainedValueParameter<ILocalSearch<LocalSearchContext<TProblem, TEncoding, TSolution>>> LocalSearchParameter {
+      get { return (IConstrainedValueParameter<ILocalSearch<LocalSearchContext<TProblem, TEncoding, TSolution>>>)Parameters["LocalSearch"]; }
+    }
+    public IConstrainedValueParameter<IManipulator<LocalSearchContext<TProblem, TEncoding, TSolution>>> KickerParameter {
+      get { return (IConstrainedValueParameter<IManipulator<LocalSearchContext<TProblem, TEncoding, TSolution>>>)Parameters["Kicker"]; }
+    }
+
+    [Storable]
+    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
+
+    [StorableConstructor]
+    protected IteratedLocalSearch(bool deserializing) : base(deserializing) { }
+    protected IteratedLocalSearch(IteratedLocalSearch<TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) {
+      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
+    }
+    public IteratedLocalSearch() {
+      ProblemAnalyzer = new MultiAnalyzer();
+      AlgorithmAnalyzer = new MultiAnalyzer();
+      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
+      AlgorithmAnalyzer.Operators.Add(qualityAnalyzer, true);
+
+      Parameters.Add(new ConstrainedValueParameter<ILocalSearch<LocalSearchContext<TProblem, TEncoding, TSolution>>>("LocalSearch", "The local search operator to use."));
+      Parameters.Add(new ConstrainedValueParameter<IManipulator<LocalSearchContext<TProblem, TEncoding, TSolution>>>("Kicker", "The manipulator operator that performs the kick."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new IteratedLocalSearch<TProblem, TEncoding, TSolution>(this, cloner);
+    }
+
+    protected override void OnProblemChanged() {
+      base.OnProblemChanged();
+      qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      qualityAnalyzer.QualityParameter.Depth = 1;
+      qualityAnalyzer.QualityParameter.Hidden = true;
+    }
+
+    protected override void PerformInitialize(CancellationToken token) {
+      Context.Solution = CreateEmptySolutionScope();
+      RunOperator(Problem.Encoding.SolutionCreator, Context.Solution, token);
+      Evaluate(Context.Solution, token);
+      DoLocalSearch();
+    }
+
+    protected override void PerformIterate(CancellationToken token) {
+      Context.Iterations++;
+      KickerParameter.Value.Manipulate(Context);
+      DoLocalSearch();
+    }
+
+    private void DoLocalSearch() {
+      LocalSearchParameter.Value.Optimize(Context);
+    }
+
+    protected override void PerformAnalyze(CancellationToken token) {
+      base.PerformAnalyze(token);
+      IResult res;
+      if (!Results.TryGetValue("Iterations", out res)) {
+        res = new Result("Iterations", new IntValue(Context.Iterations));
+        Results.Add(res);
+      }
+      ((IntValue)res.Value).Value = Context.Iterations;
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchContext.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchContext.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchContext.cs	(revision 14429)
@@ -0,0 +1,76 @@
+﻿#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.Optimization;
+using HeuristicLab.Optimization.Algorithms.SingleObjective;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.LocalSearch {
+  [Item("LocalSearchContext", "")]
+  [StorableClass]
+  public class LocalSearchContext<TProblem, TEncoding, TSolution> : HeuristicAlgorithmContext<TProblem, TEncoding, TSolution>,
+      ISingleObjectiveSolutionContext<TSolution>, IImprovementStepsContext, IIterationsContext
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution> // need both !?
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution: class, ISolution {
+
+    [Storable]
+    private ISingleObjectiveSolutionScope<TSolution> solution;
+    public ISingleObjectiveSolutionScope<TSolution> Solution {
+      get { return solution; }
+      set {
+        solution = value;
+        if (Scope.SubScopes.Count == 0)
+          Scope.SubScopes.Add(solution);
+        else Scope.SubScopes[0] = solution;
+      }
+    }
+
+    [Storable]
+    private int iterations;
+    public int Iterations {
+      get { return iterations; }
+      set { iterations = value; }
+    }
+
+    [Storable]
+    private int improvementSteps;
+    public int ImprovementSteps {
+      get { return improvementSteps; }
+      set { improvementSteps = value; }
+    }
+
+    [StorableConstructor]
+    private LocalSearchContext(bool deserializing) : base(deserializing) { }
+    private LocalSearchContext(LocalSearchContext<TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) { }
+    public LocalSearchContext() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LocalSearchContext<TProblem, TEncoding, TSolution>(this, cloner);
+    }
+
+    IScope ISolutionContext.Solution { get { return solution; } }
+    ISolutionScope<TSolution> ISolutionContext<TSolution>.Solution { get { return solution; } }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs	(revision 14429)
@@ -39,12 +39,12 @@
       set { description = value == null ? string.Empty : value; }
     }
+    public bool ExcludeGenericTypeInfo { get; set; }
 
-    public ItemAttribute() {
-      Name = string.Empty;
-      Description = string.Empty;
-    }
-    public ItemAttribute(string name, string description) {
+    public ItemAttribute() : this(string.Empty, string.Empty, false) { }
+    public ItemAttribute(string name, string description) : this(name, description, false) { }
+    public ItemAttribute(string name, string description, bool excludeGenericTypeInfo) {
       Name = name;
       Description = description;
+      ExcludeGenericTypeInfo = excludeGenericTypeInfo;
     }
 
@@ -52,6 +52,7 @@
       object[] attribs = type.GetCustomAttributes(typeof(ItemAttribute), false);
       if (attribs.Length > 0) {
-        string name = ((ItemAttribute)attribs[0]).Name;
-        if (type.IsGenericType) {
+        var attribute = (ItemAttribute)attribs[0];
+        string name = attribute.Name;
+        if (!attribute.ExcludeGenericTypeInfo && type.IsGenericType) {
           name += "<";
           Type[] typeParams = type.GetGenericArguments();
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/NPointCrossover.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/NPointCrossover.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/NPointCrossover.cs	(revision 14429)
@@ -25,4 +25,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -70,17 +71,17 @@
     /// <param name="n">Number of crossover points.</param>
     /// <returns>The newly created binary vector, resulting from the N point crossover.</returns>
-    public static BinaryVector Apply(IRandom random, BinaryVector parent1, BinaryVector parent2, IntValue n) {
+    public static BinaryVector Apply(IRandom random, BinaryVector parent1, BinaryVector parent2, int n) {
       if (parent1.Length != parent2.Length)
         throw new ArgumentException("NPointCrossover: The parents are of different length.");
 
-      if (n.Value > parent1.Length)
+      if (n > parent1.Length)
         throw new ArgumentException("NPointCrossover: There cannot be more breakpoints than the size of the parents.");
 
-      if (n.Value < 1)
+      if (n < 1)
         throw new ArgumentException("NPointCrossover: N cannot be < 1.");
 
       int length = parent1.Length;
       bool[] result = new bool[length];
-      int[] breakpoints = new int[n.Value];
+      int[] breakpoints = new int[n];
 
       //choose break points
@@ -90,5 +91,5 @@
         breakpointPool.Add(i);
 
-      for (int i = 0; i < n.Value; i++) {
+      for (int i = 0; i < n; i++) {
         int index = random.Next(breakpointPool.Count);
         breakpoints[i] = breakpointPool[index];
@@ -137,5 +138,40 @@
       if (NParameter.ActualValue == null) throw new InvalidOperationException("NPointCrossover: Parameter " + NParameter.ActualName + " could not be found.");
 
-      return Apply(random, parents[0], parents[1], NParameter.ActualValue);
+      return Apply(random, parents[0], parents[1], NParameter.ActualValue.Value);
+    }
+  }
+
+  [Item("N-point Crossover", "", ExcludeGenericTypeInfo = true)]
+  [StorableClass]
+  public sealed class NPointCrossover<TContext> : ParameterizedNamedItem, IBinaryCrossover<TContext>
+    where TContext : IMatingContext<BinaryVector>, IStochasticContext {
+
+    [Storable]
+    private IValueParameter<IntValue> nparameter;
+    public int N {
+      get { return nparameter.Value.Value; }
+      set {
+        if (value < 1) throw new ArgumentException("Cannot set N to less than 1.");
+        nparameter.Value.Value = value;
+      }
+    }
+
+    [StorableConstructor]
+    private NPointCrossover(bool deserializing) : base(deserializing) { }
+    private NPointCrossover(NPointCrossover<TContext> original, Cloner cloner)
+      : base(original, cloner) {
+      nparameter = cloner.Clone(original.nparameter);
+    }
+    public NPointCrossover() {
+      Parameters.Add(nparameter = new ValueParameter<IntValue>("N", "The number of crossover points.", new IntValue(1)));
+    }
+
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new NPointCrossover<TContext>(this, cloner);
+    }
+
+    public void Cross(TContext context) {
+      context.Child.Solution = NPointCrossover.Apply(context.Random, context.Parents.Item1.Solution, context.Parents.Item2.Solution, N);
     }
   }
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs	(revision 14429)
@@ -57,5 +57,5 @@
       if (parents.Length != 2) throw new ArgumentException("ERROR in SinglePointCrossover: The number of parents is not equal to 2");
 
-      return NPointCrossover.Apply(random, parents[0], parents[1], new IntValue(1));
+      return NPointCrossover.Apply(random, parents[0], parents[1], 1);
     }
   }
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj	(revision 14429)
@@ -126,4 +126,5 @@
     <Compile Include="Crossovers\NPointCrossover.cs" />
     <Compile Include="BinaryVector.cs" />
+    <Compile Include="Interfaces\IBinaryLocalSearch.cs" />
     <Compile Include="Interfaces\IBinaryVectorMultiNeighborhoodShakingOperator.cs" />
     <Compile Include="Interfaces\IBinaryVectorSolutionsOperator.cs" />
@@ -139,4 +140,8 @@
     <Compile Include="BinaryVectorManipulator.cs" />
     <Compile Include="Interfaces\IBinaryVectorMoveOperator.cs" />
+    <Compile Include="LocalSearch\ExhaustiveBitflip.cs" />
+    <Compile Include="Manipulators\MultiBitflipManipulator.cs" />
+    <Compile Include="Manipulators\SingleBitflipManipulator.cs" />
+    <Compile Include="Manipulators\BitflipManipulator.cs" />
     <Compile Include="Manipulators\SomePositionsBitflipManipulator.cs" />
     <Compile Include="Manipulators\SinglePositionBitflipManipulator.cs" />
@@ -205,4 +210,8 @@
       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
       <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
     </ProjectReference>
   </ItemGroup>
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Interfaces/IBinaryLocalSearch.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Interfaces/IBinaryLocalSearch.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Interfaces/IBinaryLocalSearch.cs	(revision 14429)
@@ -0,0 +1,27 @@
+﻿#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.Optimization.LocalSearch;
+
+namespace HeuristicLab.Encodings.BinaryVectorEncoding {
+  public interface IBinaryLocalSearch<TContext> : ILocalSearch<TContext> {
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Interfaces/IBinaryVectorCrossover.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Interfaces/IBinaryVectorCrossover.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Interfaces/IBinaryVectorCrossover.cs	(revision 14429)
@@ -22,4 +22,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Crossover;
 
 namespace HeuristicLab.Encodings.BinaryVectorEncoding {
@@ -31,3 +32,6 @@
     ILookupParameter<BinaryVector> ChildParameter { get; }
   }
+
+  // TODO: probably unecessary
+  public interface IBinaryCrossover<TContext> : ICrossover<TContext> { }
 }
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/LocalSearch/ExhaustiveBitflip.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/LocalSearch/ExhaustiveBitflip.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/LocalSearch/ExhaustiveBitflip.cs	(revision 14429)
@@ -0,0 +1,113 @@
+﻿#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 System.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Encodings.BinaryVectorEncoding.LocalSearch {
+  [Item("Exhaustive Bitflip Local Search (binary)", "", ExcludeGenericTypeInfo = true)]
+  [StorableClass]
+  public class ExhaustiveBitflip<TProblem, TContext> : NamedItem, IBinaryLocalSearch<TContext>
+      where TProblem : class, ISingleObjectiveProblemDefinition<BinaryVectorEncoding, BinaryVector>, ISingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> // need both, because one has Maximization, the other only the IParameter
+      where TContext : IProblemContext<TProblem, BinaryVectorEncoding, BinaryVector>,
+                       ISingleObjectiveSolutionContext<BinaryVector>, IStochasticContext,
+                       IEvaluatedSolutionsContext, ILongRunningOperationContext {
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    public override bool CanChangeDescription {
+      get { return false; }
+    }
+
+    [StorableConstructor]
+    protected ExhaustiveBitflip(bool deserializing) : base(deserializing) { }
+    protected ExhaustiveBitflip(ExhaustiveBitflip<TProblem, TContext> original, Cloner cloner) : base(original, cloner) { }
+    public ExhaustiveBitflip() : base() {
+      name = ItemName;
+      description = ItemDescription;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ExhaustiveBitflip<TProblem, TContext>(this, cloner);
+    }
+
+    public void Optimize(TContext context) {
+      var quality = context.Solution.Fitness;
+      try {
+        var result = Search(context.Random, context.Solution.Solution, ref quality,
+          context.Problem.Maximization, context.Problem.Evaluate, context.CancellationToken);
+        context.IncEvaluatedSolutions(result.Item1);
+        var stepsContext = context as IImprovementStepsContext;
+        if (stepsContext != null)
+          stepsContext.ImprovementSteps = result.Item2;
+      } finally {
+        context.Solution.Fitness = quality;
+      }
+    }
+
+    private static bool IsBetter(bool maximization, double a, double b) {
+      return maximization && a > b
+        || !maximization && a < b;
+    }
+
+    public static Tuple<int, int> Search(IRandom random, BinaryVector solution, ref double quality, bool maximization, Func<BinaryVector, IRandom, double> evalFunc, CancellationToken token, bool[] subspace = null) {
+      if (double.IsNaN(quality)) quality = evalFunc(solution, null);
+      var improved = false;
+      var order = Enumerable.Range(0, solution.Length).Shuffle(random).ToArray();
+      var lastImp = -1;
+      var steps = 0;
+      var evaluations = 0;
+      do {
+        improved = false;
+        for (var i = 0; i < solution.Length; i++) {
+          // in case we didn't make an improvement this round and arrived at the index of the last improvement
+          // break means we don't need to try the remaining moves again as they have brought no improvement
+          if (!improved && lastImp == i) break;
+          var idx = order[i];
+          if (subspace != null && !subspace[idx]) continue;
+          // bitflip the solution
+          solution[idx] = !solution[idx];
+          var after = evalFunc(solution, null);
+          evaluations++;
+          if (IsBetter(maximization, after, quality)) {
+            steps++;
+            quality = after;
+            lastImp = i;
+            improved = true;
+          } else {
+            // undo the bitflip in case no improvement was made
+            solution[idx] = !solution[idx];
+          }
+          token.ThrowIfCancellationRequested();
+        }
+      } while (improved);
+
+      return Tuple.Create(evaluations, steps);
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/BitflipManipulator.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/BitflipManipulator.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/BitflipManipulator.cs	(revision 14429)
@@ -0,0 +1,42 @@
+﻿#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.Optimization;
+using HeuristicLab.Optimization.Manipulation;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.BinaryVectorEncoding {
+  [Item("Bitflip Manipulator", "")]
+  [StorableClass]
+  public abstract class BitflipManipulator<TContext> : ParameterizedNamedItem, IManipulator<TContext>
+      where TContext : ISingleObjectiveSolutionContext<BinaryVector>, IStochasticContext {
+
+    [StorableConstructor]
+    protected BitflipManipulator(bool deserializing) : base(deserializing) { }
+    protected BitflipManipulator(BitflipManipulator<TContext> original, Cloner cloner)
+      : base(original, cloner) { }
+    public BitflipManipulator() { }
+
+    public abstract void Manipulate(TContext context);
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/MultiBitflipManipulator.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/MultiBitflipManipulator.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/MultiBitflipManipulator.cs	(revision 14429)
@@ -0,0 +1,65 @@
+﻿#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.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.BinaryVectorEncoding {
+  [Item("Multi Bitflip Manipulator", "", ExcludeGenericTypeInfo = true)]
+  [StorableClass]
+  public sealed class MultiBitflipManipulator<TContext> : BitflipManipulator<TContext>
+      where TContext : ISingleObjectiveSolutionContext<BinaryVector>, IStochasticContext {
+
+    private IValueParameter<PercentValue> RatePerBitParameter {
+      get { return (IValueParameter<PercentValue>)Parameters["RatePerBit"]; }
+    }
+
+    public double RatePerBit {
+      get { return RatePerBitParameter.Value.Value; }
+      set { RatePerBitParameter.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    private MultiBitflipManipulator(bool deserializing) : base(deserializing) { }
+    private MultiBitflipManipulator(MultiBitflipManipulator<TContext> original, Cloner cloner)
+      : base(original, cloner) { }
+    public MultiBitflipManipulator() {
+      Parameters.Add(new ValueParameter<PercentValue>("RatePerBit", "The probability of mutating each bit (independent of each other).", new PercentValue(0.05)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MultiBitflipManipulator<TContext>(this, cloner);
+    }
+
+    public override void Manipulate(TContext context) {
+      var len = context.Solution.Solution.Length;
+      var rate = RatePerBit;
+
+      for (var idx = 0; idx < len; idx++)
+        if (context.Random.NextDouble() < rate)
+          context.Solution.Solution[idx] = !context.Solution.Solution[idx];
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/SingleBitflipManipulator.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/SingleBitflipManipulator.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Manipulators/SingleBitflipManipulator.cs	(revision 14429)
@@ -0,0 +1,49 @@
+﻿#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.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.BinaryVectorEncoding {
+  [Item("Single Bitflip Manipulator", "", ExcludeGenericTypeInfo = true)]
+  [StorableClass]
+  public sealed class SingleBitflipManipulator<TContext> : BitflipManipulator<TContext>
+      where TContext : ISingleObjectiveSolutionContext<BinaryVector>, IStochasticContext {
+
+    [StorableConstructor]
+    private SingleBitflipManipulator(bool deserializing) : base(deserializing) { }
+    private SingleBitflipManipulator(SingleBitflipManipulator<TContext> original, Cloner cloner)
+      : base(original, cloner) { }
+    public SingleBitflipManipulator() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SingleBitflipManipulator<TContext>(this, cloner);
+    }
+
+    public override void Manipulate(TContext context) {
+      var len = context.Solution.Solution.Length;
+      var idx = context.Random.Next(len);
+      context.Solution.Solution[idx] = !context.Solution.Solution[idx];
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/AlgorithmContext.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/AlgorithmContext.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/AlgorithmContext.cs	(revision 14429)
@@ -0,0 +1,73 @@
+﻿#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.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Algorithms {
+  [Item("AlgorithmContext", "")]
+  [StorableClass]
+  public abstract class AlgorithmContext : ParameterizedNamedItem, IExecutionContext {
+
+    private IExecutionContext parent;
+    public IExecutionContext Parent {
+      get { return parent; }
+      set { parent = value; }
+    }
+
+    IKeyedItemCollection<string, IParameter> IExecutionContext.Parameters {
+      get { return Parameters; }
+    }
+
+    [Storable]
+    private IScope scope;
+    public IScope Scope {
+      get { return scope; }
+    }
+
+    [StorableConstructor]
+    protected AlgorithmContext(bool deserializing) : base(deserializing) { }
+    protected AlgorithmContext(AlgorithmContext original, Cloner cloner)
+      : base(original, cloner) { }
+    protected AlgorithmContext() : this(new Scope("Scope")) { }
+    protected AlgorithmContext(IScope s) {
+      scope = s;
+    }
+
+
+    public IAtomicOperation CreateOperation(IOperator op) {
+      return new ExecutionContext(parent, op, scope);
+    }
+
+    public IAtomicOperation CreateOperation(IOperator op, IScope s) {
+      return new ExecutionContext(parent, op, s);
+    }
+
+    public IAtomicOperation CreateChildOperation(IOperator op) {
+      return new ExecutionContext(this, op, scope);
+    }
+
+    public IAtomicOperation CreateChildOperation(IOperator op, IScope s) {
+      return new ExecutionContext(this, op, s);
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/HeuristicAlgorithm.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/HeuristicAlgorithm.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/HeuristicAlgorithm.cs	(revision 14429)
@@ -0,0 +1,339 @@
+﻿#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 System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Algorithms.SingleObjective {
+  public abstract class HeuristicAlgorithm<TContext, TProblem, TEncoding, TSolution> : Algorithm
+      where TContext : HeuristicAlgorithmContext<TProblem, TEncoding, TSolution>,
+                       IStochasticContext, IEvaluatedSolutionsContext, IBestQualityContext,
+                       IBestSolutionContext<TSolution>, new()
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+    private Type problemType;
+
+    public override Type ProblemType {
+      get { return typeof(SingleObjectiveProblem<TEncoding, TSolution>); }
+    }
+
+    public new TProblem Problem {
+      get { return (TProblem)base.Problem; }
+      set { base.Problem = value; }
+    }
+
+    private CancellationTokenSource cancellationTokenSource;
+    protected CancellationTokenSource CancellationTokenSource {
+      get { return cancellationTokenSource; }
+      private set { cancellationTokenSource = value; }
+    }
+
+
+    public int? MaximumEvaluations {
+      get {
+        var val = ((OptionalValueParameter<IntValue>)Parameters["MaximumEvaluations"]).Value;
+        return val != null ? val.Value : (int?)null;
+      }
+      set {
+        var param = (OptionalValueParameter<IntValue>)Parameters["MaximumEvaluations"];
+        param.Value = value.HasValue ? new IntValue(value.Value) : null;
+      }
+    }
+
+    public TimeSpan? MaximumExecutionTime {
+      get {
+        var val = ((OptionalValueParameter<TimeSpanValue>)Parameters["MaximumExecutionTime"]).Value;
+        return val != null ? val.Value : (TimeSpan?)null;
+      }
+      set {
+        var param = (OptionalValueParameter<TimeSpanValue>)Parameters["MaximumExecutionTime"];
+        param.Value = value.HasValue ? new TimeSpanValue(value.Value) : null;
+      }
+    }
+
+    public double? TargetQuality {
+      get {
+        var val = ((OptionalValueParameter<DoubleValue>)Parameters["TargetQuality"]).Value;
+        return val != null ? val.Value : (double?)null;
+      }
+      set {
+        var param = (OptionalValueParameter<DoubleValue>)Parameters["TargetQuality"];
+        param.Value = value.HasValue ? new DoubleValue(value.Value) : null;
+      }
+    }
+
+    public bool SetSeedRandomly {
+      get { return ((FixedValueParameter<BoolValue>)Parameters["SetSeedRandomly"]).Value.Value; }
+      set { ((FixedValueParameter<BoolValue>)Parameters["SetSeedRandomly"]).Value.Value = value; }
+    }
+
+    public int Seed {
+      get { return ((FixedValueParameter<IntValue>)Parameters["Seed"]).Value.Value; }
+      set { ((FixedValueParameter<IntValue>)Parameters["Seed"]).Value.Value = value; }
+    }
+
+    public IMultiAnalyzer AlgorithmAnalyzer {
+      get { return ((ValueParameter<IMultiAnalyzer>)Parameters["Analyzer.Algorithm"]).Value; }
+      set { ((ValueParameter<IMultiAnalyzer>)Parameters["Analyzer.Algorithm"]).Value = value; }
+    }
+
+    public IMultiAnalyzer ProblemAnalyzer {
+      get { return ((ValueParameter<IMultiAnalyzer>)Parameters["Analyzer.Problem"]).Value; }
+      set { ((ValueParameter<IMultiAnalyzer>)Parameters["Analyzer.Problem"]).Value = value; }
+    }
+
+    [Storable]
+    private ResultCollection results;
+    public override ResultCollection Results {
+      get { return results; }
+    }
+
+    [Storable]
+    private TContext context;
+    public TContext Context {
+      get { return context; }
+      protected set {
+        if (context == value) return;
+        context = value;
+      }
+    }
+
+    [StorableConstructor]
+    protected HeuristicAlgorithm(bool deserializing) : base(deserializing) { }
+    protected HeuristicAlgorithm(HeuristicAlgorithm<TContext, TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) { }
+    protected HeuristicAlgorithm() {
+      results = new ResultCollection();
+
+      Parameters.Add(new ValueParameter<IMultiAnalyzer>("Analyzer.Algorithm", "The algorithm's analyzers to apply to the solution(s) (independent of the problem)."));
+      Parameters.Add(new ValueParameter<IMultiAnalyzer>("Analyzer.Problem", "The problem's analyzer to apply to the solution(s)."));
+      Parameters.Add(new OptionalValueParameter<IntValue>("MaximumEvaluations", "The maximum number of solution evaluations."));
+      Parameters.Add(new OptionalValueParameter<TimeSpanValue>("MaximumExecutionTime", "The maximum runtime.", new TimeSpanValue(TimeSpan.FromMinutes(1))));
+      Parameters.Add(new OptionalValueParameter<DoubleValue>("TargetQuality", "The target quality at which the algorithm terminates."));
+      Parameters.Add(new FixedValueParameter<BoolValue>("SetSeedRandomly", "Whether each run of the algorithm should be conducted with a new random seed.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<IntValue>("Seed", "The random number seed that is used in case SetSeedRandomly is false.", new IntValue(0)));
+
+    }
+
+    protected override void OnProblemChanged() {
+      base.OnProblemChanged();
+      if (ProblemAnalyzer != null) {
+        ProblemAnalyzer.Operators.Clear();
+        if (Problem != null) {
+          foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>()) {
+            foreach (var param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
+              param.Depth = 1;
+            ProblemAnalyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
+          }
+        }
+      }
+    }
+
+    public override void Prepare() {
+      if (Problem == null) return;
+      base.Prepare();
+      results.Clear();
+      Context = null;
+      stopRequested = false;
+      OnPrepared();
+    }
+
+    private bool stopRequested = false;
+    public override void Start() {
+      base.Start();
+      CancellationTokenSource = new CancellationTokenSource();
+
+      OnStarted();
+      var task = Task.Run((Action)Run, cancellationTokenSource.Token);
+      var continuation = new Task[3];
+      continuation[0] = task.ContinueWith(t => {
+        if (t.Exception != null) {
+          OnExceptionOccurred(t.Exception.InnerExceptions.Count == 1 ? t.Exception.InnerExceptions[0] : t.Exception);
+        }
+        OnPaused();
+      }, TaskContinuationOptions.OnlyOnFaulted);
+      continuation[1] = task.ContinueWith(t => {
+        OnStopped();
+      }, TaskContinuationOptions.OnlyOnRanToCompletion);
+      continuation[2] = task.ContinueWith(t => {
+        if (stopRequested) OnStopped();
+        else OnPaused();
+      }, TaskContinuationOptions.OnlyOnCanceled);
+      Task.WhenAny(continuation).ContinueWith(_ => {
+        CancellationTokenSource.Dispose();
+        CancellationTokenSource = null;
+      });
+    }
+
+    public override void Pause() {
+      base.Pause();
+      CancellationTokenSource.Cancel();
+    }
+
+    public override void Stop() {
+      // CancellationToken.ThrowIfCancellationRequested() must be called from within the Run method, otherwise stop does nothing
+      // alternatively check the IsCancellationRequested property of the cancellation token
+      base.Stop();
+      stopRequested = true;
+      if (CancellationTokenSource != null) {
+        try {
+          CancellationTokenSource.Cancel();
+        } catch {
+          OnStopped();
+        }
+      } else OnStopped();
+    }
+
+    private DateTime lastUpdateTime;
+    private void Run() {
+      var token = CancellationTokenSource.Token;
+      lastUpdateTime = DateTime.UtcNow;
+      System.Timers.Timer timer = new System.Timers.Timer(250);
+      timer.AutoReset = true;
+      timer.Elapsed += timer_Elapsed;
+      timer.Start();
+      try {
+        if (context == null) {
+          context = CreateContext();
+
+          IExecutionContext ctxt = null;
+          foreach (var item in Problem.ExecutionContextItems)
+            ctxt = new Core.ExecutionContext(ctxt, item, Context.Scope);
+          ctxt = new Core.ExecutionContext(ctxt, this, Context.Scope);
+
+          context.Parent = ctxt;
+
+          if (SetSeedRandomly) Seed = new System.Random().Next();
+          Context.Random.Reset(Seed);
+          Context.Scope.Variables.Add(new Variable("Results", Results));
+        } else context.CancellationToken = token;
+
+        if (!Context.Initialized) {
+          try {
+            PerformInitialize(token);
+          } catch {
+            context = null;
+            return;
+          }
+          Context.Initialized = true;
+        }
+
+        while (!CheckTerminate(token)) {
+          PerformIterate(token);
+          PerformAnalyze(token);
+          token.ThrowIfCancellationRequested();
+        }
+      } finally {
+        timer.Elapsed -= timer_Elapsed;
+        timer.Stop();
+        ExecutionTime += DateTime.UtcNow - lastUpdateTime;
+      }
+    }
+
+    protected virtual TContext CreateContext() {
+      return new TContext() { Problem = Problem, CancellationToken = CancellationTokenSource.Token };
+    }
+
+    protected virtual ISingleObjectiveSolutionScope<TSolution> CreateEmptySolutionScope() {
+      return new SingleObjectiveSolutionScope<TSolution>(null, Problem.Encoding.Name, double.NaN, Problem.Evaluator.QualityParameter.ActualName);
+    }
+
+    protected static bool IsBetter(bool maximization, double a, double b) {
+      return !double.IsNaN(a) && double.IsNaN(b) || maximization && a > b || !maximization && a < b;
+    }
+
+    protected virtual void Evaluate(ISingleObjectiveSolutionScope<TSolution> scope, CancellationToken token) {
+      scope.Fitness = Problem.Evaluate(scope.Solution, Context.Random);
+    }
+
+    protected abstract void PerformInitialize(CancellationToken token);
+    protected abstract void PerformIterate(CancellationToken token);
+    protected virtual void PerformAnalyze(CancellationToken token) {
+      IResult res;
+      if (!Results.TryGetValue("EvaluatedSolutions", out res)) {
+        res = new Result("EvaluatedSolutions", new IntValue(Context.EvaluatedSolutions));
+        Results.Add(res);
+      } else ((IntValue)res.Value).Value = Context.EvaluatedSolutions;
+      if (!Results.TryGetValue("BestQuality", out res)) {
+        res = new Result("BestQuality", new DoubleValue(Context.BestQuality));
+        Results.Add(res);
+      } else ((DoubleValue)res.Value).Value = Context.BestQuality;
+
+      RunOperator(ProblemAnalyzer, Context.Scope, token);
+      RunOperator(AlgorithmAnalyzer, Context.Scope, token);
+    }
+
+    protected virtual bool CheckTerminate(CancellationToken token) {
+      return MaximumEvaluations.HasValue && Context.EvaluatedSolutions >= MaximumEvaluations.Value
+        || MaximumExecutionTime.HasValue && ExecutionTime >= MaximumExecutionTime.Value
+        || TargetQuality.HasValue && (Problem.Maximization && Context.BestQuality >= TargetQuality.Value
+                                  || !Problem.Maximization && Context.BestQuality <= TargetQuality.Value);
+    }
+
+    #region Engine Helper
+    protected void RunOperator(IOperator op, IScope scope, CancellationToken cancellationToken) {
+      var stack = new Stack<IOperation>();
+      stack.Push(Context.CreateChildOperation(op, scope));
+
+      while (stack.Count > 0) {
+        cancellationToken.ThrowIfCancellationRequested();
+
+        var next = stack.Pop();
+        if (next is OperationCollection) {
+          var coll = (OperationCollection)next;
+          for (int i = coll.Count - 1; i >= 0; i--)
+            if (coll[i] != null) stack.Push(coll[i]);
+        } else if (next is IAtomicOperation) {
+          var operation = (IAtomicOperation)next;
+          try {
+            next = operation.Operator.Execute((IExecutionContext)operation, cancellationToken);
+          } catch (Exception ex) {
+            stack.Push(operation);
+            if (ex is OperationCanceledException) throw ex;
+            else throw new OperatorExecutionException(operation.Operator, ex);
+          }
+          if (next != null) stack.Push(next);
+        }
+      }
+    }
+    #endregion
+
+    #region Events
+    private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
+      System.Timers.Timer timer = (System.Timers.Timer)sender;
+      timer.Enabled = false;
+      DateTime now = DateTime.UtcNow;
+      ExecutionTime += now - lastUpdateTime;
+      lastUpdateTime = now;
+      timer.Enabled = true;
+    }
+    #endregion
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/HeuristicAlgorithmContext.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/HeuristicAlgorithmContext.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/HeuristicAlgorithmContext.cs	(revision 14429)
@@ -0,0 +1,147 @@
+﻿#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.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Random;
+using ExecutionContext = HeuristicLab.Core.ExecutionContext;
+
+namespace HeuristicLab.Optimization.Algorithms.SingleObjective {
+  [Item("AlgorithmContext", "")]
+  [StorableClass]
+  public abstract class HeuristicAlgorithmContext<TProblem, TEncoding, TSolution> : ParameterizedNamedItem,
+      IProblemContext<TProblem, TEncoding, TSolution>, IStochasticContext,
+      IEvaluatedSolutionsContext, IBestQualityContext, IBestSolutionContext<TSolution>,
+      ILongRunningOperationContext
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+
+    private IExecutionContext parent;
+    public IExecutionContext Parent {
+      get { return parent; }
+      set { parent = value; }
+    }
+
+    IKeyedItemCollection<string, IParameter> IExecutionContext.Parameters {
+      get { return Parameters; }
+    }
+
+    public CancellationToken CancellationToken { get; set; }
+
+    [Storable]
+    private IValueParameter<TProblem> problem;
+    public TProblem Problem {
+      get { return problem.Value; }
+      set { problem.Value = value; }
+    }
+
+    [Storable]
+    private IScope scope;
+    public IScope Scope {
+      get { return scope; }
+    }
+
+    [Storable]
+    private IValueParameter<BoolValue> initialized;
+    public bool Initialized {
+      get { return initialized.Value.Value; }
+      set { initialized.Value.Value = value; }
+    }
+
+    [Storable]
+    private IValueParameter<IRandom> random;
+    public IRandom Random {
+      get { return random.Value; }
+      set { random.Value = value; }
+    }
+
+    [Storable]
+    private IValueParameter<IntValue> evaluatedSolutions;
+    public int EvaluatedSolutions {
+      get { return evaluatedSolutions.Value.Value; }
+      set { evaluatedSolutions.Value.Value = value; }
+    }
+
+    public void IncEvaluatedSolutions(int inc) {
+      EvaluatedSolutions += inc;
+    }
+
+    [Storable]
+    private IValueParameter<DoubleValue> bestQuality;
+    public double BestQuality {
+      get { return bestQuality.Value.Value; }
+      set { bestQuality.Value.Value = value; }
+    }
+
+    [Storable]
+    private IValueParameter<TSolution> bestSolution;
+    public TSolution BestSolution {
+      get { return bestSolution.Value; }
+      set { bestSolution.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected HeuristicAlgorithmContext(bool deserializing) : base(deserializing) { }
+    protected HeuristicAlgorithmContext(HeuristicAlgorithmContext<TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) {
+      problem = cloner.Clone(original.problem);
+      scope = cloner.Clone(original.scope);
+      initialized = cloner.Clone(original.initialized);
+      random = cloner.Clone(original.random);
+      evaluatedSolutions = cloner.Clone(original.evaluatedSolutions);
+      bestQuality = cloner.Clone(original.bestQuality);
+      bestSolution = cloner.Clone(original.bestSolution);
+    }
+    protected HeuristicAlgorithmContext() : this(new Scope("Scope"), CancellationToken.None) { }
+    protected HeuristicAlgorithmContext(IScope s, CancellationToken token) {
+      scope = s;
+      CancellationToken = token;
+      Parameters.Add(problem = new ValueParameter<TProblem>("Problem", "The problem that is to be solved."));
+      Parameters.Add(initialized = new ValueParameter<BoolValue>("Initialized", "Whether the algorithm has finished the initialization phase.", new BoolValue(false)));
+      Parameters.Add(random = new ValueParameter<IRandom>("Random", "The random number generator.", new MersenneTwister()));
+      Parameters.Add(evaluatedSolutions = new ValueParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.", new IntValue(0)));
+      Parameters.Add(bestQuality = new ValueParameter<DoubleValue>("BestQuality", "The best quality found so far.", new DoubleValue(double.NaN)));
+      Parameters.Add(bestSolution = new OptionalValueParameter<TSolution>("BestSolution", "The best solution found so far."));
+
+    }
+
+    public IAtomicOperation CreateOperation(IOperator op) {
+      return new ExecutionContext(parent, op, scope);
+    }
+
+    public IAtomicOperation CreateOperation(IOperator op, IScope s) {
+      return new ExecutionContext(parent, op, s);
+    }
+
+    public IAtomicOperation CreateChildOperation(IOperator op) {
+      return new ExecutionContext(this, op, scope);
+    }
+
+    public IAtomicOperation CreateChildOperation(IOperator op, IScope s) {
+      return new ExecutionContext(this, op, s);
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/SingleObjectiveSolutionScope.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/SingleObjectiveSolutionScope.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/SingleObjective/SingleObjectiveSolutionScope.cs	(revision 14429)
@@ -0,0 +1,147 @@
+﻿#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.Drawing;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Algorithms.SingleObjective {
+  [Item("MemPRScope", "Scope for a MemPR individual.")]
+  [StorableClass]
+  public sealed class SingleObjectiveSolutionScope<T> : NamedItem, ISingleObjectiveSolutionScope<T> where T : class, IItem {
+    public new static Image StaticItemImage {
+      get { return HeuristicLab.Common.Resources.VSImageLibrary.OrgChart; }
+    }
+
+    [Storable]
+    private IScope parent;
+    public IScope Parent {
+      get { return parent; }
+      set {
+        if (parent != value) {
+          parent = value;
+        }
+      }
+    }
+
+    [Storable]
+    private VariableCollection variables;
+    public VariableCollection Variables {
+      get { return variables; }
+    }
+
+    [Storable]
+    private ScopeList subScopes;
+    public ScopeList SubScopes {
+      get { return subScopes; }
+    }
+
+    [Storable]
+    private Variable solution;
+    public T Solution {
+      get { return (T)solution.Value; }
+      set { solution.Value = value; }
+    }
+
+    [Storable]
+    private Variable fitness;
+    public double Fitness {
+      get { return ((DoubleValue)fitness.Value).Value; }
+      set { ((DoubleValue)fitness.Value).Value = value; }
+    }
+
+    [StorableConstructor]
+    private SingleObjectiveSolutionScope(bool deserializing) : base(deserializing) { }
+    private SingleObjectiveSolutionScope(SingleObjectiveSolutionScope<T> original, Cloner cloner)
+      : base(original, cloner) {
+      // the parent will not be deep-cloned
+      parent = original.parent;
+      variables = cloner.Clone(original.variables);
+      subScopes = cloner.Clone(original.subScopes);
+      foreach (var child in SubScopes)
+        child.Parent = this;
+      solution = cloner.Clone(original.solution);
+      fitness = cloner.Clone(original.fitness);
+
+      RegisterSubScopesEvents();
+    }
+    public SingleObjectiveSolutionScope(T code, string codeName, double fitness, string fitnessName) {
+      this.solution = new Variable(codeName, code);
+      this.fitness = new Variable(fitnessName, new DoubleValue(fitness));
+      variables = new VariableCollection(2) { this.solution, this.fitness };
+      subScopes = new ScopeList(2);
+
+      RegisterSubScopesEvents();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SingleObjectiveSolutionScope<T>(this, cloner);
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterSubScopesEvents();
+    }
+
+    public void Clear() {
+      variables.Clear();
+      subScopes.Clear();
+    }
+
+    #region SubScopes Events
+    private void RegisterSubScopesEvents() {
+      if (subScopes != null) {
+        subScopes.ItemsAdded += SubScopes_ItemsAdded;
+        subScopes.ItemsRemoved += SubScopes_ItemsRemoved;
+        subScopes.ItemsReplaced += SubScopes_ItemsReplaced;
+        subScopes.CollectionReset += SubScopes_CollectionReset;
+      }
+    }
+    private void SubScopes_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
+      foreach (var item in e.Items) item.Value.Parent = this;
+    }
+    private void SubScopes_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
+      foreach (var item in e.Items) item.Value.Parent = null;
+    }
+    private void SubScopes_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
+      foreach (var oldItem in e.OldItems) oldItem.Value.Parent = null;
+      foreach (var item in e.Items) item.Value.Parent = this;
+    }
+    private void SubScopes_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
+      foreach (var oldItem in e.OldItems) oldItem.Value.Parent = null;
+      foreach (var item in e.Items) item.Value.Parent = this;
+    }
+    #endregion
+
+    public void Adopt(ISingleObjectiveSolutionScope<T> orphan) {
+      Solution = orphan.Solution;
+      Fitness = orphan.Fitness;
+    }
+
+    public void Adopt(ISolutionScope<T> orphan) {
+      Solution = orphan.Solution;
+      Fitness = double.NaN;
+    }
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs	(revision 14429)
@@ -81,5 +81,5 @@
     }
 
-
+    // TODO: There is no way to access the Operators collection other than through OperatorParameter.Value
     protected override IEnumerable<IItem> GetOperators() {
       if (Encoding == null) return base.GetOperators();
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 14429)
@@ -120,5 +120,9 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Algorithms\SingleObjective\HeuristicAlgorithmContext.cs" />
     <Compile Include="Algorithms\BasicAlgorithm.cs" />
+    <Compile Include="Algorithms\SingleObjective\HeuristicAlgorithm.cs" />
+    <Compile Include="Algorithms\AlgorithmContext.cs" />
+    <Compile Include="Algorithms\SingleObjective\SingleObjectiveSolutionScope.cs" />
     <Compile Include="BasicProblems\CombinedSolution.cs" />
     <Compile Include="BasicProblems\Interfaces\IMultiEncodingOperator.cs" />
@@ -170,4 +174,5 @@
     <Compile Include="MetaOptimizers\Experiment.cs" />
     <Compile Include="MetaOptimizers\TimeLimitRun.cs" />
+    <Compile Include="NewInfrastructure\Interfaces.cs" />
     <Compile Include="RunCollectionModification\RunCollectionRunRemover.cs" />
     <Compile Include="Plugin.cs" />
@@ -312,4 +317,8 @@
       <Private>False</Private>
     </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
Index: branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/NewInfrastructure/Interfaces.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/NewInfrastructure/Interfaces.cs	(revision 14429)
+++ branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/NewInfrastructure/Interfaces.cs	(revision 14429)
@@ -0,0 +1,177 @@
+﻿#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.Threading;
+using HeuristicLab.Core;
+using HeuristicLab.Optimization;
+
+/*************************************************
+ * ********************************************* *
+ *                    DATA                       *
+ * ********************************************* *
+ *************************************************/
+
+
+
+/*************************************************
+   * ********************************************* *
+   *                  OPERATORS                    *
+   * ********************************************* *
+   *************************************************/
+
+
+namespace HeuristicLab.Optimization.LocalSearch {
+  public interface ILocalSearch<TContext> : IItem {
+    void Optimize(TContext context);
+  }
+}
+
+namespace HeuristicLab.Optimization.Crossover {
+  public interface ICrossover<TContext> : IItem {
+
+    void Cross(TContext context);
+  }
+}
+
+namespace HeuristicLab.Optimization.Manipulation {
+  public interface IManipulator<TContext> : IItem {
+    void Manipulate(TContext context);
+  }
+}
+
+namespace HeuristicLab.Optimization.Selection {
+  public interface ISelector<TContext> : IItem {
+
+    void Select(TContext context, int n, bool withRepetition);
+  }
+}
+
+/*************************************************
+   * ********************************************* *
+   *                  CONTEXTS                     *
+   * ********************************************* *
+   *************************************************/
+
+namespace HeuristicLab.Optimization {
+
+  public interface ILongRunningOperationContext : IExecutionContext {
+    CancellationToken CancellationToken { get; set; }
+  }
+
+  public interface IStochasticContext : IExecutionContext {
+    IRandom Random { get; }
+  }
+
+  public interface IEvaluatedSolutionsContext : IExecutionContext {
+    int EvaluatedSolutions { get; }
+    void IncEvaluatedSolutions(int inc);
+  }
+
+  public interface IBestQualityContext : IExecutionContext {
+    double BestQuality { get; set; }
+  }
+
+  public interface IBestSolutionContext<TSolution> : IExecutionContext {
+    TSolution BestSolution { get; set; }
+  }
+
+  public interface IIterationsContext : IExecutionContext {
+    int Iterations { get; }
+  }
+
+  public interface IImprovementStepsContext : IExecutionContext {
+    int ImprovementSteps { get; set; }
+  }
+
+  public interface IProblemContext<TProblem, TEncoding, TSolution> : IExecutionContext
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+    TProblem Problem { get; }
+  }
+
+  public interface IPopulationContext : IExecutionContext {
+    IEnumerable<IScope> Population { get; }
+  }
+
+  public interface IPopulationContext<TSolution> : IPopulationContext {
+    new IEnumerable<ISolutionScope<TSolution>> Population { get; }
+  }
+
+  public interface ISingleObjectivePopulationContext<TSolution> : IPopulationContext<TSolution> {
+    new IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
+  }
+
+  public interface ISolutionContext : IExecutionContext {
+    IScope Solution { get; }
+  }
+
+  public interface ISolutionContext<TSolution> : ISolutionContext {
+    new ISolutionScope<TSolution> Solution { get; }
+  }
+
+  public interface ISingleObjectiveSolutionContext<TSolution> : ISolutionContext<TSolution> {
+    new ISingleObjectiveSolutionScope<TSolution> Solution { get; }
+  }
+
+  public interface IMatingContext<TSolution> : IExecutionContext {
+    Tuple<ISolutionScope<TSolution>, ISolutionScope<TSolution>>  Parents { get; }
+    ISolutionScope<TSolution> Child { get; }
+  }
+
+  public interface ISingleObjectiveMatingContext<TSolution> : IMatingContext<TSolution> {
+    new Tuple<ISingleObjectiveSolutionScope<TSolution>, ISingleObjectiveSolutionScope<TSolution>> Parents { get; }
+    new ISingleObjectiveSolutionScope<TSolution> Child { get; }
+  }
+
+  public interface IMatingpoolContext<TSolution> : IExecutionContext
+      where TSolution : class, ISolution {
+    IEnumerable<ISolutionScope<TSolution>> MatingPool { get; set; }
+  }
+
+  public interface ISingleObjectiveMatingpoolContext<TSolution> : IMatingpoolContext<TSolution>
+      where TSolution : class, ISolution {
+    new IEnumerable<ISingleObjectiveSolutionScope<TSolution>> MatingPool { get; set; }
+  }
+}
+
+
+/*************************************************
+   * ********************************************* *
+   *                   SCOPES                      *
+   * ********************************************* *
+   *************************************************/
+
+namespace HeuristicLab.Core {
+  public interface ISolutionScope<TSolution> : IScope {
+    TSolution Solution { get; set; }
+
+    void Adopt(ISolutionScope<TSolution> orphan);
+  }
+
+  public interface ISingleObjectiveSolutionScope<TSolution> : ISolutionScope<TSolution> {
+    double Fitness { get; set; }
+
+    void Adopt(ISingleObjectiveSolutionScope<TSolution> orphan);
+  }
+}
Index: branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/Analyzers/BestKnapsackSolutionAnalyzer.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/Analyzers/BestKnapsackSolutionAnalyzer.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/Analyzers/BestKnapsackSolutionAnalyzer.cs	(revision 14429)
@@ -60,5 +60,5 @@
     }
     public ILookupParameter<KnapsackSolution> BestSolutionParameter {
-      get { return (ILookupParameter<KnapsackSolution>)Parameters["BestSolution"]; }
+      get { return (ILookupParameter<KnapsackSolution>)Parameters["BestKnapsackSolution"]; }
     }
     public IValueLookupParameter<ResultCollection> ResultsParameter {
@@ -84,5 +84,5 @@
 
       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the Knapsack solutions which should be visualized."));
-      Parameters.Add(new LookupParameter<KnapsackSolution>("BestSolution", "The best Knapsack solution."));
+      Parameters.Add(new LookupParameter<KnapsackSolution>("BestKnapsackSolution", "The best Knapsack solution."));
       Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the knapsack solution should be stored."));
       Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution."));
Index: branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs	(revision 14429)
@@ -91,4 +91,5 @@
 
       InitializeRandomKnapsackInstance();
+      Encoding.Length = Weights.Length;
 
       InitializeOperators();
@@ -97,10 +98,12 @@
 
     public override double Evaluate(BinaryVector solution, IRandom random) {
+      var weights = Weights;
+      var values = Values;
       var totalWeight = 0.0;
       var totalValue = 0.0;
       for (var i = 0; i < solution.Length; i++) {
         if (!solution[i]) continue;
-        totalWeight += Weights[i];
-        totalValue += Values[i];
+        totalWeight += weights[i];
+        totalValue += values[i];
       }
       return totalWeight > KnapsackCapacity ? KnapsackCapacity - totalWeight : totalValue;
@@ -253,5 +256,6 @@
       var sysrand = new System.Random();
 
-      var itemCount = sysrand.Next(10, 100);
+      var power = sysrand.Next(5, 11);
+      var itemCount = (int)Math.Pow(2, power);
       Weights = new IntArray(itemCount);
       Values = new IntArray(itemCount);
@@ -260,6 +264,6 @@
 
       for (int i = 0; i < itemCount; i++) {
-        var value = sysrand.Next(1, 10);
-        var weight = sysrand.Next(1, 10);
+        var value = sysrand.Next(1, 30);
+        var weight = sysrand.Next(1, 30);
 
         Values[i] = value;
@@ -268,5 +272,5 @@
       }
 
-      KnapsackCapacity = (int)Math.Round(0.7 * totalWeight);
+      KnapsackCapacity = (int)Math.Round(0.5 * totalWeight);
     }
   }
Index: branches/ProblemRefactoring/HeuristicLab.Selection/3.3/TournamentSelector.cs
===================================================================
--- branches/ProblemRefactoring/HeuristicLab.Selection/3.3/TournamentSelector.cs	(revision 13469)
+++ branches/ProblemRefactoring/HeuristicLab.Selection/3.3/TournamentSelector.cs	(revision 14429)
@@ -27,4 +27,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Selection;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -90,3 +91,62 @@
     }
   }
+
+  [Item("Tournament Selector", "", ExcludeGenericTypeInfo = true)]
+  [StorableClass]
+  public sealed class TournamentSelector<TContext, TProblem, TEncoding, TSolution> : ParameterizedNamedItem, ISelector<TContext>
+      where TContext : ISingleObjectivePopulationContext<TSolution>, IMatingpoolContext<TSolution>, IStochasticContext,
+                       IProblemContext<TProblem, TEncoding, TSolution>
+      where TProblem : class, ISingleObjectiveProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>
+      where TEncoding : class, IEncoding<TSolution>
+      where TSolution : class, ISolution {
+
+    [Storable]
+    private IValueParameter<IntValue> groupSizeParameter;
+    public int GroupSize {
+      get { return groupSizeParameter.Value.Value; }
+      set {
+        if (value < 1) throw new ArgumentException("Cannot use a group size less than 1 in tournament selection.");
+        groupSizeParameter.Value.Value = value;
+      }
+    }
+    
+    [StorableConstructor]
+    private TournamentSelector(bool deserializing) : base(deserializing) { }
+    private TournamentSelector(TournamentSelector<TContext, TProblem, TEncoding, TSolution> original, Cloner cloner)
+      : base(original, cloner) {
+      groupSizeParameter = cloner.Clone(groupSizeParameter);
+    }
+    public TournamentSelector() {
+      Parameters.Add(groupSizeParameter = new ValueParameter<IntValue>("GroupSize", "The group size that competes in the tournament.", new IntValue(2)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TournamentSelector<TContext, TProblem, TEncoding, TSolution>(this, cloner);
+    }
+
+    public void Select(TContext context, int n, bool withRepetition) {
+      context.MatingPool = Select(context.Random, context.Problem.IsBetter, context.Population, GroupSize, n, withRepetition);
+    }
+
+    public static IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Select(IRandom random, Func<double, double, bool> isBetterFunc, IEnumerable<ISingleObjectiveSolutionScope<TSolution>> population, int groupSize, int n, bool withRepetition) {
+      var pop = population.Where(x => !double.IsNaN(x.Fitness)).ToList();
+
+      var i = n;
+      while (i > 0 && pop.Count > 0) {
+        var best = random.Next(pop.Count);
+        for (var j = 1; j < groupSize; j++) {
+          var index = random.Next(pop.Count);
+          if (isBetterFunc(pop[index].Fitness, pop[best].Fitness)) {
+            best = index;
+          }
+        }
+
+        yield return pop[best];
+        i--;
+        if (!withRepetition) {
+          pop.RemoveAt(i);
+        }
+      }
+    }
+  }
 }
