Index: branches/ALPS/HeuristicLab.Algorithms.ALPS.OffspringSelection/3.3/AlpsOffspringSelectionGeneticAlgorithm.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS.OffspringSelection/3.3/AlpsOffspringSelectionGeneticAlgorithm.cs	(revision 12549)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS.OffspringSelection/3.3/AlpsOffspringSelectionGeneticAlgorithm.cs	(revision 12550)
@@ -21,4 +21,5 @@
 
 using System;
+using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm;
@@ -63,6 +64,6 @@
       get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
     }
-    private IValueParameter<IntValue> MaximumGenerationsParameter {
-      get { return (IValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
+    private IFixedValueParameter<IntValue> MaximumGenerationsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
     }
     private ValueLookupParameter<DoubleValue> SuccessRatioParameter {
@@ -78,6 +79,6 @@
       get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["ComparisonFactorModifier"]; }
     }
-    private ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
-      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
+    private IFixedValueParameter<DoubleValue> MaximumSelectionPressureParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
     }
     private ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
@@ -87,6 +88,6 @@
       get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
     }
-    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
-      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
+    private IValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
+      get { return (IValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     }
     private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
@@ -124,7 +125,7 @@
       set { ReevaluateElitesParameter.Value.Value = value; }
     }
-    public IntValue MaximumGenerations {
-      get { return MaximumGenerationsParameter.Value; }
-      set { MaximumGenerationsParameter.Value = value; }
+    public int MaximumGenerations {
+      get { return MaximumGenerationsParameter.Value.Value; }
+      set { MaximumGenerationsParameter.Value.Value = value; }
     }
     public DoubleValue SuccessRatio {
@@ -144,7 +145,7 @@
       set { ComparisonFactorModifierParameter.Value = value; }
     }
-    public DoubleValue MaximumSelectionPressure {
-      get { return MaximumSelectionPressureParameter.Value; }
-      set { MaximumSelectionPressureParameter.Value = value; }
+    public double MaximumSelectionPressure {
+      get { return MaximumSelectionPressureParameter.Value.Value; }
+      set { MaximumSelectionPressureParameter.Value.Value = value; }
     }
     public BoolValue OffspringSelectionBeforeMutation {
@@ -156,8 +157,4 @@
       set { SelectedParentsParameter.Value = value; }
     }
-    public IntValue MaximumEvaluatedSolutions {
-      get { return MaximumEvaluatedSolutionsParameter.Value; }
-      set { MaximumEvaluatedSolutionsParameter.Value = value; }
-    }
     public bool FillPopulationWithParents {
       get { return FillPopulationWithParentsParameter.Value.Value; }
@@ -171,7 +168,11 @@
 
     [Storable]
-    private ValueAnalyzer selectionPressureAnalyzer;
+    private ValueAnalyzer layerSelectionPressureAnalyzer;
     [Storable]
     private SuccessfulOffspringAnalyzer successfulOffspringAnalyzer;
+
+    [Storable]
+    private ComparisonTerminator<IntValue> generationsTerminator;
+    //[Storable]private ComparisonTerminator<DoubleValue> selectionPressureTerminator;
 
     [StorableConstructor]
@@ -180,6 +181,8 @@
     private AlpsOffspringSelectionGeneticAlgorithm(AlpsOffspringSelectionGeneticAlgorithm original, Cloner cloner)
       : base(original, cloner) {
-      selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
+      layerSelectionPressureAnalyzer = cloner.Clone(original.layerSelectionPressureAnalyzer);
       successfulOffspringAnalyzer = cloner.Clone(original.successfulOffspringAnalyzer);
+      generationsTerminator = cloner.Clone(original.generationsTerminator);
+      //selectionPressureTerminator = cloner.Clone(original.selectionPressureTerminator);
       Initialize();
     }
@@ -197,13 +200,12 @@
       Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
       Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
-      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
+      Parameters.Add(new FixedValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
       Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
       Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0)));
       Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorUpperBound", "The upper bound of the comparison factor (end).", new DoubleValue(1)));
       Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("ComparisonFactorModifier", "The operator used to modify the comparison factor.", new ItemSet<IDiscreteDoubleValueModifier>(new IDiscreteDoubleValueModifier[] { new LinearDiscreteDoubleValueModifier() }), new LinearDiscreteDoubleValueModifier()));
-      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));
       Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false)));
       Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "How much parents should be selected each time the offspring selection step is performed until the population is filled. This parameter should be about the same or twice the size of PopulationSize for smaller problems, and less for large problems.", new IntValue(200)));
-      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
       Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
 
@@ -285,15 +287,21 @@
       ParameterizeComparisonFactorModifiers();
 
-      selectionPressureAnalyzer = new ValueAnalyzer();
+      layerSelectionPressureAnalyzer = new ValueAnalyzer();
       successfulOffspringAnalyzer = new SuccessfulOffspringAnalyzer();
-      selectionPressureAnalyzer.Name = "SelectionPressure Analyzer";
-      selectionPressureAnalyzer.ResultsParameter.ActualName = "Results";
-      selectionPressureAnalyzer.ValueParameter.ActualName = "SelectionPressure";
-      selectionPressureAnalyzer.ValueParameter.Depth = 0;
-      selectionPressureAnalyzer.ValuesParameter.ActualName = "Selection Pressure History";
-      successfulOffspringAnalyzer.ResultsParameter.ActualName = "Results";
+      layerSelectionPressureAnalyzer.Name = "SelectionPressure Analyzer";
+      //layerSelectionPressureAnalyzer.ResultsParameter.ActualName = "Results";
+      layerSelectionPressureAnalyzer.ValueParameter.ActualName = "SelectionPressure";
+      layerSelectionPressureAnalyzer.ValueParameter.Depth = 0;
+      layerSelectionPressureAnalyzer.ValuesParameter.ActualName = "Selection Pressure History";
+      //successfulOffspringAnalyzer.ResultsParameter.ActualName = "Results";
       successfulOffspringAnalyzer.GenerationsParameter.ActualName = "Generations";
       successfulOffspringAnalyzer.SuccessfulOffspringFlagParameter.Value.Value = "SuccessfulOffspring";
       successfulOffspringAnalyzer.DepthParameter.Value = new IntValue(1);
+
+      generationsTerminator = new ComparisonTerminator<IntValue>("Generations", ComparisonType.Less, MaximumGenerationsParameter) { Name = "Generations" };
+      //selectionPressureTerminator = new ComparisonTerminator<DoubleValue>("SelectionPressure", ComparisonType.Less, MaximumSelectionPressureParameter) { Name = "Selection Pressure" };
+
+      UpdateAnalyzers();
+      UpdateTerminators();
 
       Initialize();
@@ -309,4 +317,6 @@
       UpdateCrossovers();
       UpdateMutators();
+      UpdateAnalyzers();
+      UpdateTerminators();
     }
     protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
@@ -325,4 +335,6 @@
       UpdateCrossovers();
       UpdateMutators();
+      UpdateAnalyzers();
+      UpdateTerminators();
     }
     protected override void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
@@ -396,4 +408,22 @@
 
     #region Updates
+    private void UpdateTerminators() {
+      var newTerminators = new Dictionary<ITerminator, bool> {
+        {generationsTerminator, !Terminators.Operators.Contains(generationsTerminator) || Terminators.Operators.ItemChecked(generationsTerminator)},
+        //{selectionPressureTerminator, !Terminators.Operators.Contains(generationsTerminator) || Terminators.Operators.ItemChecked(selectionPressureTerminator)},
+        {evaluationsTerminator, Terminators.Operators.Contains(evaluationsTerminator) && Terminators.Operators.ItemChecked(evaluationsTerminator)},
+        {qualityTerminator, Terminators.Operators.Contains(qualityTerminator) && Terminators.Operators.ItemChecked(qualityTerminator) },
+        {executionTimeTerminator, Terminators.Operators.Contains(executionTimeTerminator) && Terminators.Operators.ItemChecked(executionTimeTerminator)}
+      };
+      if (Problem != null) {
+        foreach (var terminator in Problem.Operators.OfType<ITerminator>())
+          newTerminators.Add(terminator, !Terminators.Operators.Contains(terminator) || Terminators.Operators.ItemChecked(terminator));
+      }
+
+      Terminators.Operators.Clear();
+
+      foreach (var newTerminator in newTerminators)
+        Terminators.Operators.Add(newTerminator.Key, newTerminator.Value);
+    }
     private void UpdateCrossovers() {
       var oldCrossover = CrossoverParameter.Value;
@@ -427,4 +457,9 @@
       }
     }
+    private void UpdateAnalyzers() {
+      LayerAnalyzer.Operators.Add(layerSelectionPressureAnalyzer, layerSelectionPressureAnalyzer.EnabledByDefault);
+      layerSelectionPressureAnalyzer.ValueParameter.Depth = 0; // Correct Depth because the depth of layer-analyzers is automatically set to 1
+      LayerAnalyzer.Operators.Add(successfulOffspringAnalyzer, successfulOffspringAnalyzer.EnabledByDefault);
+    }
     #endregion
   }
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS.OffspringSelection/3.3/AlpsOffspringSelectionGeneticAlgorithmMainLoop.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS.OffspringSelection/3.3/AlpsOffspringSelectionGeneticAlgorithmMainLoop.cs	(revision 12549)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS.OffspringSelection/3.3/AlpsOffspringSelectionGeneticAlgorithmMainLoop.cs	(revision 12550)
@@ -113,6 +113,5 @@
       var layerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
       var analyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };
-      var generationsComparator = new Comparator() { Name = "Generations >= MaximumGenerations" };
-      var terminateBranch = new ConditionalBranch() { Name = "Terminate?" };
+      var termination = new TerminationOperator();
 
       OperatorGraph.InitialOperator = variableCreator;
@@ -190,14 +189,7 @@
 
       analyzerPlaceholder.OperatorParameter.ActualName = AnalyzerParameter.Name;
-      analyzerPlaceholder.Successor = generationsComparator;
-
-      generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
-      generationsComparator.LeftSideParameter.ActualName = "Generations";
-      generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
-      generationsComparator.ResultParameter.ActualName = "TerminateGenerations";
-      generationsComparator.Successor = terminateBranch;
-
-      terminateBranch.ConditionParameter.ActualName = "TerminateGenerations";
-      terminateBranch.FalseBranch = matingPoolPreProcessor;
+      analyzerPlaceholder.Successor = termination;
+
+      termination.ContinueBranch = matingPoolPreProcessor;
     }
 
