Index: /branches/PausableBasicAlgorithm/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs
===================================================================
--- /branches/PausableBasicAlgorithm/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs	(revision 13377)
+++ /branches/PausableBasicAlgorithm/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs	(revision 13378)
@@ -48,4 +48,8 @@
 
     private const string IterationsParameterName = "Iterations";
+    private const string BestQualityResultName = "Best quality";
+    private const string IterationsResultName = "Iterations";
+
+    public override bool Pausable { get { return true; } }
 
     public override Type ProblemType {
@@ -66,4 +70,15 @@
     }
 
+    #region ResultsProperties
+    private double ResultsBestQuality {
+      get { return ((DoubleValue)Results[BestQualityResultName].Value).Value; }
+      set { ((DoubleValue)Results[BestQualityResultName].Value).Value = value; }
+    }
+    private int ResultsIterations {
+      get { return ((IntValue)Results[IterationsResultName].Value).Value; }
+      set { ((IntValue)Results[IterationsResultName].Value).Value = value; }
+    }
+    #endregion
+
     [StorableConstructor]
     protected HillClimber(bool deserializing) : base(deserializing) { }
@@ -80,8 +95,13 @@
       Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "", new IntValue(100)));
     }
+    protected override void Initialize(CancellationToken cancellationToken) {
+      Results.Add(new Result(BestQualityResultName, new DoubleValue(double.NaN)));
+      Results.Add(new Result(IterationsResultName, new IntValue(0)));
+      base.Initialize(cancellationToken);
+    }
     protected override void Run(CancellationToken cancellationToken) {
-      var BestQuality = new DoubleValue(double.NaN);
-      Results.Add(new Result("Best quality", BestQuality));
-      for (int iteration = 0; iteration < Iterations; iteration++) {
+      while (ResultsIterations < Iterations) {
+        cancellationToken.ThrowIfCancellationRequested();
+
         var solution = new BinaryVector(Problem.Length);
         for (int i = 0; i < solution.Length; i++) {
@@ -92,7 +112,9 @@
 
         fitness = ImproveToLocalOptimum(Problem, solution, fitness, random);
-        if (double.IsNaN(BestQuality.Value) || Problem.IsBetter(fitness, BestQuality.Value)) {
-          BestQuality.Value = fitness;
+        if (double.IsNaN(ResultsBestQuality) || Problem.IsBetter(fitness, ResultsBestQuality)) {
+          ResultsBestQuality = fitness;
         }
+
+        ResultsIterations++;
       }
     }
Index: /branches/PausableBasicAlgorithm/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs
===================================================================
--- /branches/PausableBasicAlgorithm/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs	(revision 13377)
+++ /branches/PausableBasicAlgorithm/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs	(revision 13378)
@@ -213,5 +213,5 @@
     }
 
-    protected override void Run(CancellationToken cancellationToken) {
+    protected override void Initialize(CancellationToken cancellationToken) {
       // Set up the algorithm
       if (SetSeedRandomly) Seed = new System.Random().Next();
@@ -242,21 +242,23 @@
       Results.Add(new Result("Stored Solutions", table));
 
+      base.Initialize(cancellationToken);
+    }
+
+    protected override void Run(CancellationToken cancellationToken) {
       // Loop until iteration limit reached or canceled.
-      for (ResultsIterations = 0; ResultsIterations < MaximumIterations; ResultsIterations++) {
-        double fitness = double.NaN;
-
-        try {
-          fitness = iterate();
-          cancellationToken.ThrowIfCancellationRequested();
-        } finally {
-          ResultsEvaluations = tracker.Evaluations;
-          ResultsBestSolution = new BinaryVector(tracker.BestSolution);
-          ResultsBestQuality = tracker.BestQuality;
-          ResultsBestFoundOnEvaluation = tracker.BestFoundOnEvaluation;
-          ResultsQualitiesBest.Values.Add(tracker.BestQuality);
-          ResultsQualitiesIteration.Values.Add(fitness);
-          ResultsLevels.Values.Add(pyramid.Count);
-          ResultsSolutions.Values.Add(seen.Count);
-        }
+      while (ResultsIterations < MaximumIterations) {
+        cancellationToken.ThrowIfCancellationRequested();
+        double fitness = iterate();
+
+        ResultsEvaluations = tracker.Evaluations;
+        ResultsBestSolution = new BinaryVector(tracker.BestSolution);
+        ResultsBestQuality = tracker.BestQuality;
+        ResultsBestFoundOnEvaluation = tracker.BestFoundOnEvaluation;
+        ResultsQualitiesBest.Values.Add(tracker.BestQuality);
+        ResultsQualitiesIteration.Values.Add(fitness);
+        ResultsLevels.Values.Add(pyramid.Count);
+        ResultsSolutions.Values.Add(seen.Count);
+
+        ResultsIterations++;
       }
     }
Index: /branches/PausableBasicAlgorithm/HeuristicLab.Optimization.Views/3.3/BasicAlgorithmView.cs
===================================================================
--- /branches/PausableBasicAlgorithm/HeuristicLab.Optimization.Views/3.3/BasicAlgorithmView.cs	(revision 13377)
+++ /branches/PausableBasicAlgorithm/HeuristicLab.Optimization.Views/3.3/BasicAlgorithmView.cs	(revision 13378)
@@ -34,12 +34,8 @@
     }
 
-    protected override void SetEnabledStateOfControls() {
-      base.SetEnabledStateOfControls();
-      pauseButton.Enabled = false;
-    }
-
     protected override void SetEnabledStateOfExecutableButtons() {
       base.SetEnabledStateOfExecutableButtons();
-      pauseButton.Enabled = false;
+      if (Content != null)
+        pauseButton.Enabled &= Content.Pausable;
     }
   }
Index: /branches/PausableBasicAlgorithm/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs
===================================================================
--- /branches/PausableBasicAlgorithm/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs	(revision 13377)
+++ /branches/PausableBasicAlgorithm/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs	(revision 13378)
@@ -24,4 +24,5 @@
 using System.Threading.Tasks;
 using HeuristicLab.Common;
+using HeuristicLab.Core;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -30,4 +31,5 @@
   public abstract class BasicAlgorithm : Algorithm, IStorableContent {
     public string Filename { get; set; }
+    public virtual bool Pausable { get { return false; } }
 
     [Storable]
@@ -58,4 +60,5 @@
       base.Prepare();
       results.Clear();
+      initialized = false;
       OnPrepared();
     }
@@ -64,5 +67,5 @@
       base.Start();
       CancellationTokenSource = new CancellationTokenSource();
-
+      pausePending = false;
       OnStarted();
       Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
@@ -80,10 +83,17 @@
         CancellationTokenSource.Dispose();
         CancellationTokenSource = null;
-        OnStopped();
+        if (pausePending) OnPaused();
+        else OnStopped();
       });
     }
 
+    private bool pausePending;
     public override void Pause() {
-      throw new NotSupportedException("Pause is not supported in basic algorithms.");
+      if (!Pausable)
+        throw new NotSupportedException("Pause is not supported by this algorithm.");
+
+      base.Pause();
+      pausePending = Pausable;
+      cancellationTokenSource.Cancel();
     }
 
@@ -92,5 +102,6 @@
       // alternatively check the IsCancellationRequested property of the cancellation token
       base.Stop();
-      CancellationTokenSource.Cancel();
+      if (ExecutionState == ExecutionState.Paused) OnStopped();
+      else CancellationTokenSource.Cancel();
     }
 
@@ -105,4 +116,7 @@
       timer.Start();
       try {
+        if (!initialized)
+          Initialize(cancellationToken);
+        initialized = true;
         Run(cancellationToken);
       } finally {
@@ -113,4 +127,6 @@
     }
 
+    private bool initialized;
+    protected virtual void Initialize(CancellationToken cancellationToken) { }
     protected abstract void Run(CancellationToken cancellationToken);
 
