Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 15624)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 15625)
@@ -156,4 +156,12 @@
     <Compile Include="Interfaces\ILocalImprovementAlgorithmOperator.cs" />
     <Compile Include="Interfaces\IMultiObjectiveOperator.cs" />
+    <Compile Include="Model2\Algorithms\ContextAlgorithm.cs" />
+    <Compile Include="Model2\Algorithms\StochasticAlgorithm.cs" />
+    <Compile Include="Model2\Contexts\BasicContext.cs" />
+    <Compile Include="Model2\Contexts\PopulationContext.cs" />
+    <Compile Include="Model2\Contexts\SingleSolutionContext.cs" />
+    <Compile Include="Model2\Contexts\StochasticContext.cs" />
+    <Compile Include="Model2\Interfaces.cs" />
+    <Compile Include="Model2\SingleObjectiveSolutionScope.cs" />
     <Compile Include="MultiObjective\DominationCalculator.cs" />
     <Compile Include="Results\IResultParameter.cs" />
@@ -312,4 +320,9 @@
       <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>
+      <Private>False</Private>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Algorithms/ContextAlgorithm.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Algorithms/ContextAlgorithm.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Algorithms/ContextAlgorithm.cs	(revision 15625)
@@ -0,0 +1,110 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Model2 {
+  [Item("Context-based Algorithm", "Algorithms that make use of contexts to facilitate applying operators.")]
+  [StorableClass]
+  public abstract class ContextAlgorithm<TContext> : BasicAlgorithm
+    where TContext : class, IContext, new() {
+    
+    [Storable]
+    private TContext context;
+    public TContext Context {
+      get { return context; }
+    }
+
+    [Storable]
+    private ValueParameter<IAnalyzer> analyzerParameter;
+    public IValueParameter<IAnalyzer> AnalyzerParameter {
+      get { return analyzerParameter; }
+    }
+    [Storable]
+    private FixedValueParameter<MultiTerminator> terminationParameter;
+    public IFixedValueParameter<MultiTerminator> TerminationParameter {
+      get { return terminationParameter; }
+    }
+
+    public IAnalyzer Analyzer {
+      get { return analyzerParameter.Value; }
+      set { analyzerParameter.Value = value; }
+    }
+    public MultiTerminator Termination {
+      get { return terminationParameter.Value; }
+    }
+
+    [StorableConstructor]
+    protected ContextAlgorithm(bool deserializing) : base(deserializing) { }
+    protected ContextAlgorithm(ContextAlgorithm<TContext> original, Cloner cloner)
+      : base(original, cloner) {
+      context = cloner.Clone(original.context);
+      analyzerParameter = cloner.Clone(original.analyzerParameter);
+      terminationParameter = cloner.Clone(original.terminationParameter);
+    }
+    protected ContextAlgorithm()
+      : base() {
+      Parameters.Add(analyzerParameter = new ValueParameter<IAnalyzer>("Analyzer", "The analyzers that are used to perform an analysis of the solutions."));
+      Parameters.Add(terminationParameter = new FixedValueParameter<MultiTerminator>("Termination", "The termination criteria that are being used.", new MultiTerminator()));
+
+      var generationsTerminator = new ComparisonTerminator<IntValue>("Iterations", ComparisonType.Less, new IntValue(1000)) { Name = "Iterations" };
+      var evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less, new IntValue(int.MaxValue)) { Name = "Evaluations" };
+      var executionTimeTerminator = new ExecutionTimeTerminator(this, new TimeSpanValue(TimeSpan.FromMinutes(5)));
+
+      Termination.AddOperator(generationsTerminator);
+      Termination.AddOperator(evaluationsTerminator);
+      Termination.AddOperator(executionTimeTerminator);
+
+    }
+
+    protected override void Initialize(CancellationToken cancellationToken) {
+      base.Initialize(cancellationToken);
+      context = new TContext();
+      context.Scope.Variables.Add(new Variable("Results", Results));
+
+      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;
+
+      context.Iterations = 0;
+      context.EvaluatedSolutions = 0;
+      context.BestQuality = double.NaN;
+    }
+
+    public override void Prepare() {
+      context = null;
+      base.Prepare();
+    }
+
+    protected virtual bool StoppingCriterion() {
+      Context.RunOperator(Termination, CancellationToken.None);
+      return Context.Terminate;
+    }
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Algorithms/StochasticAlgorithm.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Algorithms/StochasticAlgorithm.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Algorithms/StochasticAlgorithm.cs	(revision 15625)
@@ -0,0 +1,80 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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;
+
+namespace HeuristicLab.Optimization.Model2 {
+  [Item("Stochastic Algorithm", "Stochastic context-based algorithms to facilitate applying operators.")]
+  [StorableClass]
+  public abstract class StochasticAlgorithm<TContext> : ContextAlgorithm<TContext>
+    where TContext : class, IStochasticContext, new() {
+    
+    [Storable]
+    private FixedValueParameter<BoolValue> setSeedRandomlyParameter;
+    private IFixedValueParameter<BoolValue> SetSeedRandomlyParameter {
+      get { return setSeedRandomlyParameter; }
+    }
+    [Storable]
+    private FixedValueParameter<IntValue> seedParameter;
+    private IFixedValueParameter<IntValue> SeedParameter {
+      get { return seedParameter; }
+    }
+    
+    public bool SetSeedRandomly {
+      get { return setSeedRandomlyParameter.Value.Value; }
+      set { setSeedRandomlyParameter.Value.Value = value; }
+    }
+    public int Seed {
+      get { return seedParameter.Value.Value; }
+      set { seedParameter.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected StochasticAlgorithm(bool deserializing) : base(deserializing) { }
+    protected StochasticAlgorithm(StochasticAlgorithm<TContext> original, Cloner cloner)
+      : base(original, cloner) {
+      setSeedRandomlyParameter = cloner.Clone(original.setSeedRandomlyParameter);
+      seedParameter = cloner.Clone(original.seedParameter);
+    }
+    protected StochasticAlgorithm()
+      : base() {
+      Parameters.Add(setSeedRandomlyParameter = new FixedValueParameter<BoolValue>("SetSeedRandomly", "Whether to overwrite the seed with a random value each time the algorithm is run.", new BoolValue(true)));
+      Parameters.Add(seedParameter = new FixedValueParameter<IntValue>("Seed", "The random seed that is used in the stochastic algorithm", new IntValue(0)));
+    }
+
+    protected override void Initialize(CancellationToken cancellationToken) {
+      base.Initialize(cancellationToken);
+
+      if (SetSeedRandomly) {
+        var rnd = new System.Random();
+        Seed = rnd.Next();
+      }
+
+      Context.Random = new MersenneTwister((uint)Seed);
+    }
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/BasicContext.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/BasicContext.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/BasicContext.cs	(revision 15625)
@@ -0,0 +1,178 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Model2 {
+  [Item("Basic Context", "A base class for algorithms' contexts.")]
+  [StorableClass]
+  public class BasicContext : ParameterizedNamedItem, IContext {
+
+    private IExecutionContext parent;
+    public IExecutionContext Parent {
+      get { return parent; }
+      set { parent = value; }
+    }
+
+    [Storable]
+    private IScope scope;
+    public IScope Scope {
+      get { return scope; }
+      private set { scope = value; }
+    }
+
+    IKeyedItemCollection<string, IParameter> IExecutionContext.Parameters {
+      get { return Parameters; }
+    }
+
+    [Storable]
+    private IFixedValueParameter<IntValue> iterations;
+    public int Iterations {
+      get { return iterations.Value.Value; }
+      set { iterations.Value.Value = value; }
+    }
+
+    [Storable]
+    private IFixedValueParameter<IntValue> evaluatedSolutions;
+    public int EvaluatedSolutions {
+      get { return evaluatedSolutions.Value.Value; }
+      set { evaluatedSolutions.Value.Value = value; }
+    }
+
+    [Storable]
+    private IValueParameter<DoubleValue> bestQuality;
+    public double BestQuality {
+      get { return bestQuality.Value.Value; }
+      set { bestQuality.Value.Value = value; }
+    }
+
+    [Storable]
+    private IValueParameter<BoolValue> terminate;
+    public bool Terminate {
+      get { return terminate.Value.Value; }
+      set { terminate.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected BasicContext(bool deserializing) : base(deserializing) { }
+    protected BasicContext(BasicContext original, Cloner cloner)
+    : base(original, cloner) {
+      scope = cloner.Clone(original.scope);
+      iterations = cloner.Clone(original.iterations);
+      evaluatedSolutions = cloner.Clone(original.evaluatedSolutions);
+      bestQuality = cloner.Clone(original.bestQuality);
+      terminate = cloner.Clone(original.terminate);
+    }
+    protected BasicContext() : base() {
+      scope = new Scope("Global");
+      Parameters.Add(iterations = new FixedValueParameter<IntValue>("Iterations", new IntValue(0)));
+      Parameters.Add(evaluatedSolutions = new FixedValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
+      Parameters.Add(bestQuality = new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(double.NaN)));
+      Parameters.Add(terminate = new ValueParameter<BoolValue>("Terminate", new BoolValue(false)));
+    }
+    protected BasicContext(string name) : base(name) {
+      scope = new Scope("Global");
+      Parameters.Add(iterations = new FixedValueParameter<IntValue>("Iterations", new IntValue(0)));
+      Parameters.Add(evaluatedSolutions = new FixedValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
+      Parameters.Add(bestQuality = new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(double.NaN)));
+      Parameters.Add(terminate = new ValueParameter<BoolValue>("Terminate", new BoolValue(false)));
+    }
+    protected BasicContext(string name, ParameterCollection parameters) : base(name, parameters) {
+      scope = new Scope("Global");
+      Parameters.Add(iterations = new FixedValueParameter<IntValue>("Iterations", new IntValue(0)));
+      Parameters.Add(evaluatedSolutions = new FixedValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
+      Parameters.Add(bestQuality = new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(double.NaN)));
+      Parameters.Add(terminate = new ValueParameter<BoolValue>("Terminate", new BoolValue(false)));
+    }
+    protected BasicContext(string name, string description) : base(name, description) {
+      scope = new Scope("Global");
+      Parameters.Add(iterations = new FixedValueParameter<IntValue>("Iterations", new IntValue(0)));
+      Parameters.Add(evaluatedSolutions = new FixedValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
+      Parameters.Add(bestQuality = new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(double.NaN)));
+      Parameters.Add(terminate = new ValueParameter<BoolValue>("Terminate", new BoolValue(false)));
+    }
+    protected BasicContext(string name, string description, ParameterCollection parameters) : base(name, description, parameters) {
+      scope = new Scope("Global");
+      Parameters.Add(iterations = new FixedValueParameter<IntValue>("Iterations", new IntValue(0)));
+      Parameters.Add(evaluatedSolutions = new FixedValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));
+      Parameters.Add(bestQuality = new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(double.NaN)));
+      Parameters.Add(terminate = new ValueParameter<BoolValue>("Terminate", new BoolValue(false)));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BasicContext(this, cloner);
+    }
+
+
+    public void RunOperator(IOperator op, CancellationToken cancellationToken) {
+      RunOperator(op, scope, cancellationToken);
+    }
+
+    public void RunOperator(IOperator op, IScope s, CancellationToken cancellationToken) {
+      if (op == null) return;
+      var stack = new Stack<IOperation>();
+      stack.Push(((IExecutionContext)this).CreateChildOperation(op, s));
+
+      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);
+        }
+      }
+    }
+
+    #region IExecutionContext members
+    IAtomicOperation IExecutionContext.CreateOperation(IOperator op) {
+      return new Core.ExecutionContext(this, op, Scope);
+    }
+    IAtomicOperation IExecutionContext.CreateOperation(IOperator op, IScope s) {
+      return new Core.ExecutionContext(this, op, s);
+    }
+    IAtomicOperation IExecutionContext.CreateChildOperation(IOperator op) {
+      return new Core.ExecutionContext(this, op, Scope);
+    }
+    IAtomicOperation IExecutionContext.CreateChildOperation(IOperator op, IScope s) {
+      return new Core.ExecutionContext(this, op, s);
+    }
+    #endregion
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/PopulationContext.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/PopulationContext.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/PopulationContext.cs	(revision 15625)
@@ -0,0 +1,77 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Model2 {
+  [Item("Population Context", "A context for population-based algorithms.")]
+  [StorableClass]
+  public class PopulationContext<TSolutionScope> : StochasticContext
+    where TSolutionScope: class, IScope {
+
+    public IEnumerable<TSolutionScope> Population {
+      get { return Scope.SubScopes.OfType<TSolutionScope>(); }
+    }
+    public void AddToPopulation(TSolutionScope solScope) {
+      Scope.SubScopes.Add(solScope);
+    }
+    public void ReplaceAtPopulation(int index, TSolutionScope solScope) {
+      Scope.SubScopes[index] = solScope;
+    }
+    public void ReplacePopulation(IEnumerable<TSolutionScope> replacement) {
+      Scope.SubScopes.Replace(replacement);
+    }
+    public TSolutionScope AtPopulation(int index) {
+      return Scope.SubScopes[index] as TSolutionScope;
+    }
+    public TSolutionScope AtRandomPopulation() {
+      return Scope.SubScopes[Random.Next(PopulationCount)] as TSolutionScope;
+    }
+    public int PopulationCount {
+      get { return Scope.SubScopes.Count; }
+    }
+
+
+    [StorableConstructor]
+    protected PopulationContext(bool deserializing) : base(deserializing) { }
+    protected PopulationContext(PopulationContext<TSolutionScope> original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public PopulationContext() : base() { }
+    public PopulationContext(string name) : base(name) { }
+    public PopulationContext(string name, ParameterCollection parameters) : base(name, parameters) { }
+    public PopulationContext(string name, string description) : base(name, description) { }
+    public PopulationContext(string name, string description, ParameterCollection parameters) : base(name, description, parameters) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PopulationContext<TSolutionScope>(this, cloner);
+    }
+
+    public void RunOperator(IOperator op, int individual, CancellationToken cancellationToken) {
+      RunOperator(op, AtPopulation(individual), cancellationToken);
+    }
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/SingleSolutionContext.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/SingleSolutionContext.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/SingleSolutionContext.cs	(revision 15625)
@@ -0,0 +1,57 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Model2 {
+  [Item("Single Solution Context", "A context for single solution algorithms.")]
+  [StorableClass]
+  public abstract class SingleSolutionContext<TSolutionScope> : StochasticContext
+    where TSolutionScope: class, IScope {
+    
+    [Storable]
+    private TSolutionScope incumbent;
+    public TSolutionScope Incumbent {
+      get { return incumbent; }
+    }
+
+    public void ReplaceIncumbent(TSolutionScope solScope) {
+      if (incumbent != null) Scope.SubScopes.Remove(incumbent);
+      this.incumbent = solScope;
+      if (incumbent != null) Scope.SubScopes.Add(incumbent);
+    }
+
+
+    [StorableConstructor]
+    protected SingleSolutionContext(bool deserializing) : base(deserializing) { }
+    protected SingleSolutionContext(SingleSolutionContext<TSolutionScope> original, Cloner cloner)
+      : base(original, cloner) {
+      incumbent = cloner.Clone(original.incumbent);
+    }
+    protected SingleSolutionContext() : base() { }
+    protected SingleSolutionContext(string name) : base(name) { }
+    protected SingleSolutionContext(string name, ParameterCollection parameters) : base(name, parameters) { }
+    protected SingleSolutionContext(string name, string description) : base(name, description) { }
+    protected SingleSolutionContext(string name, string description, ParameterCollection parameters) : base(name, description, parameters) { }
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/StochasticContext.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/StochasticContext.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Contexts/StochasticContext.cs	(revision 15625)
@@ -0,0 +1,65 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Optimization.Model2 {
+  [Item("Stochastic Context", "A base class for stochastic algorithms' contexts.")]
+  [StorableClass]
+  public class StochasticContext : BasicContext, IStochasticContext {
+    
+    [Storable]
+    private IValueParameter<IRandom> random;
+    public IRandom Random {
+      get { return random.Value; }
+      set { random.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected StochasticContext(bool deserializing) : base(deserializing) { }
+    protected StochasticContext(StochasticContext original, Cloner cloner)
+    : base(original, cloner) {
+      random = cloner.Clone(original.random);
+    }
+    protected StochasticContext() : base() {
+      Parameters.Add(random = new ValueParameter<IRandom>("Random"));
+    }
+    protected StochasticContext(string name) : base(name) {
+      Parameters.Add(random = new ValueParameter<IRandom>("Random"));
+    }
+    protected StochasticContext(string name, ParameterCollection parameters) : base(name, parameters) {
+      Parameters.Add(random = new ValueParameter<IRandom>("Random"));
+    }
+    protected StochasticContext(string name, string description) : base(name, description) {
+      Parameters.Add(random = new ValueParameter<IRandom>("Random"));
+    }
+    protected StochasticContext(string name, string description, ParameterCollection parameters) : base(name, description, parameters) {
+      Parameters.Add(random = new ValueParameter<IRandom>("Random"));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new StochasticContext(this, cloner);
+    }
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Interfaces.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Interfaces.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/Interfaces.cs	(revision 15625)
@@ -0,0 +1,47 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Core;
+
+namespace HeuristicLab.Optimization.Model2 {
+  public interface ISolutionScope : IScope {
+    double Fitness { get; set; }
+  }
+
+  public interface ISolutionScope<TSolution> : ISolutionScope {
+    TSolution Solution { get; set; }
+  }
+
+  public interface IContext : IExecutionContext {
+    new IExecutionContext Parent { get; set; }
+    int Iterations { get; set; }
+    int EvaluatedSolutions { get; set; }
+    double BestQuality { get; set; }
+    bool Terminate { get; set; }
+
+    void RunOperator(IOperator op, CancellationToken token);
+  }
+
+  public interface IStochasticContext : IContext {
+    IRandom Random { get; set; }
+  }
+}
Index: branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/SingleObjectiveSolutionScope.cs
===================================================================
--- branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/SingleObjectiveSolutionScope.cs	(revision 15625)
+++ branches/ContextAlgorithms/HeuristicLab.Optimization/3.3/Model2/SingleObjectiveSolutionScope.cs	(revision 15625)
@@ -0,0 +1,137 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Model2 {
+  [Item("Solution Scope", "Scope for an individual/solution of a single-objective single-encoded problem.")]
+  [StorableClass]
+  public sealed class SingleObjectiveSolutionScope<T> : NamedItem, ISolutionScope<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
+  }
+}
