Index: /trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs	(revision 3489)
+++ /trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs	(revision 3490)
@@ -103,4 +103,7 @@
       get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
     }
+    private ValueLookupParameter<DoubleValue> FinalMaximumSelectionPressureParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["FinalMaximumSelectionPressure"]; }
+    }
     private ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
       get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
@@ -153,25 +156,29 @@
       set { ParallelParameter.Value = value; }
     }
-    private DoubleValue SuccessRatio {
+    public DoubleValue SuccessRatio {
       get { return SuccessRatioParameter.Value; }
       set { SuccessRatioParameter.Value = value; }
     }
-    private DoubleValue ComparisonFactorLowerBound {
+    public DoubleValue ComparisonFactorLowerBound {
       get { return ComparisonFactorLowerBoundParameter.Value; }
       set { ComparisonFactorLowerBoundParameter.Value = value; }
     }
-    private DoubleValue ComparisonFactorUpperBound {
+    public DoubleValue ComparisonFactorUpperBound {
       get { return ComparisonFactorUpperBoundParameter.Value; }
       set { ComparisonFactorUpperBoundParameter.Value = value; }
     }
-    private IDiscreteDoubleValueModifier ComparisonFactorModifier {
+    public IDiscreteDoubleValueModifier ComparisonFactorModifier {
       get { return ComparisonFactorModifierParameter.Value; }
       set { ComparisonFactorModifierParameter.Value = value; }
     }
-    private DoubleValue MaximumSelectionPressure {
+    public DoubleValue MaximumSelectionPressure {
       get { return MaximumSelectionPressureParameter.Value; }
       set { MaximumSelectionPressureParameter.Value = value; }
     }
-    private BoolValue OffspringSelectionBeforeMutation {
+    public DoubleValue FinalMaximumSelectionPressure {
+      get { return FinalMaximumSelectionPressureParameter.Value; }
+      set { FinalMaximumSelectionPressureParameter.Value = value; }
+    }
+    public BoolValue OffspringSelectionBeforeMutation {
       get { return OffspringSelectionBeforeMutationParameter.Value; }
       set { OffspringSelectionBeforeMutationParameter.Value = value; }
@@ -216,4 +223,5 @@
       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 ValueLookupParameter<DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left.", 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)));
 
@@ -257,4 +265,5 @@
       mainLoop.ComparisonFactorUpperBoundParameter.ActualName = ComparisonFactorUpperBoundParameter.Name;
       mainLoop.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
+      mainLoop.FinalMaximumSelectionPressureParameter.ActualName = FinalMaximumSelectionPressureParameter.Name;
       mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
       mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
Index: /trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs	(revision 3489)
+++ /trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs	(revision 3490)
@@ -102,4 +102,7 @@
     public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
       get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
+    }
+    public ValueLookupParameter<DoubleValue> FinalMaximumSelectionPressureParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["FinalMaximumSelectionPressure"]; }
     }
     public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
@@ -136,4 +139,5 @@
       Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor."));
       Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left."));
       Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum genreation that terminates the algorithm."));
       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."));
@@ -142,4 +146,5 @@
       #region Create operators
       VariableCreator variableCreator = new VariableCreator();
+      Assigner maxSelPressAssigner = new Assigner();
       Assigner villageCountAssigner = new Assigner();
       Assigner comparisonFactorInitializer = new Assigner();
@@ -171,9 +176,12 @@
       IntCounter villageMaximumGenerationsCounter = new IntCounter();
       DataTableValuesCollector selPressValuesCollector2 = new DataTableValuesCollector();
-      Comparator villageCountComparator = new Comparator();
-      ConditionalBranch villageTerminationCondition0 = new ConditionalBranch();
+      Comparator villageCountComparator1 = new Comparator();
+      ConditionalBranch villageTerminationCondition1 = new ConditionalBranch();
       SASEGASAReunificator reunificator = new SASEGASAReunificator();
       IntCounter reunificationCounter = new IntCounter();
       Placeholder comparisonFactorModifier = new Placeholder();
+      Comparator villageCountComparator2 = new Comparator();
+      ConditionalBranch villageTerminationCondition2 = new ConditionalBranch();
+      Assigner finalMaxSelPressAssigner = new Assigner();
       Comparator maximumGenerationsComparator = new Comparator();
       BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer();
@@ -181,5 +189,5 @@
       DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector();
       QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
-      ConditionalBranch villagesTerminationCondition = new ConditionalBranch();
+      ConditionalBranch villagesTerminationCondition3 = new ConditionalBranch();
       ConditionalBranch maximumGenerationsTerminationCondition = new ConditionalBranch();
 
@@ -189,4 +197,7 @@
       villageCountAssigner.LeftSideParameter.ActualName = "VillageCount";
       villageCountAssigner.RightSideParameter.ActualName = NumberOfVillagesParameter.Name;
+
+      maxSelPressAssigner.LeftSideParameter.ActualName = "CurrentMaximumSelectionPressure";
+      maxSelPressAssigner.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
 
       comparisonFactorInitializer.LeftSideParameter.ActualName = "ComparisonFactor";
@@ -269,5 +280,5 @@
       mainLoop.ComparisonFactorModifierParameter.Value = new EmptyOperator(); // comparison factor is modified here
       mainLoop.ComparisonFactorUpperBoundParameter.ActualName = ComparisonFactorUpperBoundParameter.Name;
-      mainLoop.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
+      mainLoop.MaximumSelectionPressureParameter.ActualName = "CurrentMaximumSelectionPressure";
       mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
 
@@ -306,12 +317,12 @@
 
       // if there's just one island left and we're getting to this point SASEGASA terminates
-      villageCountComparator.Name = "VillageCount <= 1 ?";
-      villageCountComparator.LeftSideParameter.ActualName = "VillageCount";
-      villageCountComparator.RightSideParameter.Value = new IntValue(1);
-      villageCountComparator.Comparison.Value = ComparisonType.LessOrEqual;
-      villageCountComparator.ResultParameter.ActualName = "TerminateVillages";
-
-      villageTerminationCondition0.Name = "Skip reunification?";
-      villageTerminationCondition0.ConditionParameter.ActualName = "TerminateVillages";
+      villageCountComparator1.Name = "VillageCount <= 1 ?";
+      villageCountComparator1.LeftSideParameter.ActualName = "VillageCount";
+      villageCountComparator1.RightSideParameter.Value = new IntValue(1);
+      villageCountComparator1.Comparison.Value = ComparisonType.LessOrEqual;
+      villageCountComparator1.ResultParameter.ActualName = "TerminateVillages";
+
+      villageTerminationCondition1.Name = "Skip reunification?";
+      villageTerminationCondition1.ConditionParameter.ActualName = "TerminateVillages";
 
       reunificator.VillageCountParameter.ActualName = "VillageCount";
@@ -321,4 +332,16 @@
 
       comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
+
+      villageCountComparator2.Name = "VillageCount == 1 ?";
+      villageCountComparator2.LeftSideParameter.ActualName = "VillageCount";
+      villageCountComparator2.RightSideParameter.Value = new IntValue(1);
+      villageCountComparator2.Comparison.Value = ComparisonType.Equal;
+      villageCountComparator2.ResultParameter.ActualName = "ChangeMaxSelPress";
+
+      villageTerminationCondition2.Name = "Change max selection pressure?";
+      villageTerminationCondition2.ConditionParameter.ActualName = "ChangeMaxSelPress";
+
+      finalMaxSelPressAssigner.LeftSideParameter.ActualName = "CurrentMaximumSelectionPressure";
+      finalMaxSelPressAssigner.RightSideParameter.ActualName = FinalMaximumSelectionPressureParameter.Name;
 
       // if SASEGASAGenerations is reaching MaximumGenerations we're also terminating
@@ -350,5 +373,5 @@
       qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
 
-      villagesTerminationCondition.ConditionParameter.ActualName = "TerminateVillages";
+      villagesTerminationCondition3.ConditionParameter.ActualName = "TerminateVillages";
       villageMaximumGenerationsConditionalBranch1.ConditionParameter.ActualName = "TerminateMaximumGenerations";
       #endregion
@@ -357,5 +380,6 @@
       OperatorGraph.InitialOperator = variableCreator;
       variableCreator.Successor = villageCountAssigner;
-      villageCountAssigner.Successor = comparisonFactorInitializer;
+      villageCountAssigner.Successor = maxSelPressAssigner;
+      maxSelPressAssigner.Successor = comparisonFactorInitializer;
       comparisonFactorInitializer.Successor = ussp0;
       ussp0.Operator = islandVariableCreator;
@@ -389,20 +413,25 @@
       villageMaximumGenerationsToGenerationsAssigner.Successor = villageMaximumGenerationsCounter;
       villageMaximumGenerationsCounter.Successor = null;
-      selPressValuesCollector2.Successor = villageCountComparator;
-      villageCountComparator.Successor = villageTerminationCondition0;
-      villageTerminationCondition0.TrueBranch = null;
-      villageTerminationCondition0.FalseBranch = reunificator;
-      villageTerminationCondition0.Successor = maximumGenerationsComparator;
+      selPressValuesCollector2.Successor = villageCountComparator1;
+      villageCountComparator1.Successor = villageTerminationCondition1;
+      villageTerminationCondition1.TrueBranch = null;
+      villageTerminationCondition1.FalseBranch = reunificator;
+      villageTerminationCondition1.Successor = maximumGenerationsComparator;
       reunificator.Successor = reunificationCounter;
       reunificationCounter.Successor = comparisonFactorModifier;
-      comparisonFactorModifier.Successor = null;
+      comparisonFactorModifier.Successor = villageCountComparator2;
+      villageCountComparator2.Successor = villageTerminationCondition2;
+      villageTerminationCondition2.TrueBranch = finalMaxSelPressAssigner;
+      villageTerminationCondition2.FalseBranch = null;
+      villageTerminationCondition2.Successor = null;
+      finalMaxSelPressAssigner.Successor = null;
       maximumGenerationsComparator.Successor = bestQualityMemorizer3;
       bestQualityMemorizer3.Successor = bestAverageWorstQualityCalculator3;
       bestAverageWorstQualityCalculator3.Successor = dataTableValuesCollector2;
       dataTableValuesCollector2.Successor = qualityDifferenceCalculator2;
-      qualityDifferenceCalculator2.Successor = villagesTerminationCondition;
-      villagesTerminationCondition.FalseBranch = maximumGenerationsTerminationCondition;
-      villagesTerminationCondition.TrueBranch = null;
-      villagesTerminationCondition.Successor = null;
+      qualityDifferenceCalculator2.Successor = villagesTerminationCondition3;
+      villagesTerminationCondition3.FalseBranch = maximumGenerationsTerminationCondition;
+      villagesTerminationCondition3.TrueBranch = null;
+      villagesTerminationCondition3.Successor = null;
       maximumGenerationsTerminationCondition.FalseBranch = fixedReunificationStepConditionInitializer;
       maximumGenerationsTerminationCondition.TrueBranch = null;
