Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm-3.3.csproj
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm-3.3.csproj	(revision 11509)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm-3.3.csproj	(revision 11510)
@@ -161,4 +161,6 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="OffspringSelectors\IOffspringSelector.cs" />
+    <Compile Include="OffspringSelectors\StandardOffspringSelector.cs" />
     <Compile Include="ProbabilitiesGenerator.cs" />
     <Compile Include="Plugin.cs" />
Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/OffspringSelectors/StandardOffspringSelector.cs
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/OffspringSelectors/StandardOffspringSelector.cs	(revision 11510)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/OffspringSelectors/StandardOffspringSelector.cs	(revision 11510)
@@ -0,0 +1,197 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm {
+  [Item("StandardOffspringSelector", "Selects among the offspring population those that are designated successful and discards the unsuccessful offspring, except for some lucky losers. It expects the parent scopes to be below the first sub-scope, and offspring scopes to be below the second sub-scope separated again in two sub-scopes, the first with the failed offspring and the second with successful offspring.")]
+  [StorableClass]
+  public class StandardOffspringSelector : SingleSuccessorOperator, IOffspringSelector {
+    public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
+    }
+    public ValueLookupParameter<DoubleValue> SuccessRatioParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
+    }
+    public LookupParameter<DoubleValue> SelectionPressureParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["SelectionPressure"]; }
+    }
+    public LookupParameter<DoubleValue> CurrentSuccessRatioParameter {
+      get { return (LookupParameter<DoubleValue>)Parameters["CurrentSuccessRatio"]; }
+    }
+    public LookupParameter<ItemList<IScope>> OffspringPopulationParameter {
+      get { return (LookupParameter<ItemList<IScope>>)Parameters["OffspringPopulation"]; }
+    }
+    public LookupParameter<IntValue> OffspringPopulationWinnersParameter {
+      get { return (LookupParameter<IntValue>)Parameters["OffspringPopulationWinners"]; }
+    }
+    public ScopeTreeLookupParameter<BoolValue> SuccessfulOffspringParameter {
+      get { return (ScopeTreeLookupParameter<BoolValue>)Parameters["SuccessfulOffspring"]; }
+    }
+    public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
+    }
+    public ILookupParameter<BoolValue> EnoughChildrenGeneratedParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters["EnoughChildrenGenerated"]; }
+    }
+
+
+    [StorableConstructor]
+    protected StandardOffspringSelector(bool deserializing) : base(deserializing) { }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      if (Parameters.ContainsKey("FillPopulationWithParents") && Parameters["FillPopulationWithParents"] is FixedValueParameter<BoolValue>)
+        Parameters.Remove("FillPopulationWithParents");
+      if (!Parameters.ContainsKey("FillPopulationWithParents"))
+        Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individuals instead of lucky losers."));
+      #endregion
+    }
+
+    protected StandardOffspringSelector(StandardOffspringSelector original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new StandardOffspringSelector(this, cloner);
+    }
+    public StandardOffspringSelector()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure which prematurely terminates the offspring selection step."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful offspring that has to be produced."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("SelectionPressure", "The amount of selection pressure currently necessary to fulfill the success ratio."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio indicates how much of the successful offspring have already been generated."));
+      Parameters.Add(new LookupParameter<ItemList<IScope>>("OffspringPopulation", "Temporary store of the offspring population."));
+      Parameters.Add(new LookupParameter<IntValue>("OffspringPopulationWinners", "Temporary store the number of successful offspring in the offspring population."));
+      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("SuccessfulOffspring", "True if the offspring was more successful than its parents.", 2));
+      Parameters.Add(new ValueLookupParameter<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."));
+      Parameters.Add(new LookupParameter<BoolValue>("EnoughChildrenGenerated", "True if enough children have been generated, otherwise false."));
+    }
+
+    public override IOperation Apply() {
+      double maxSelPress = MaximumSelectionPressureParameter.ActualValue.Value;
+      double successRatio = SuccessRatioParameter.ActualValue.Value;
+      bool fillPopulationWithParents = false;
+      if (FillPopulationWithParentsParameter.ActualValue != null)
+        fillPopulationWithParents = FillPopulationWithParentsParameter.ActualValue.Value;
+      IScope scope = ExecutionContext.Scope;
+      IScope parents = scope.SubScopes[0];
+      IScope offspring = scope.SubScopes[1];
+      int populationSize = parents.SubScopes.Count;
+
+      // retrieve actual selection pressure and success ratio
+      DoubleValue selectionPressure = SelectionPressureParameter.ActualValue;
+      if (selectionPressure == null) {
+        selectionPressure = new DoubleValue(0);
+        SelectionPressureParameter.ActualValue = selectionPressure;
+      }
+      DoubleValue currentSuccessRatio = CurrentSuccessRatioParameter.ActualValue;
+      if (currentSuccessRatio == null) {
+        currentSuccessRatio = new DoubleValue(0);
+        CurrentSuccessRatioParameter.ActualValue = currentSuccessRatio;
+      }
+
+      // retrieve next population
+      ItemList<IScope> population = OffspringPopulationParameter.ActualValue;
+      IntValue successfulOffspring;
+      if (population == null) {
+        population = new ItemList<IScope>();
+        OffspringPopulationParameter.ActualValue = population;
+        selectionPressure.Value = 0; // initialize selection pressure for this round
+        currentSuccessRatio.Value = 0; // initialize current success ratio for this round
+        successfulOffspring = new IntValue(0);
+        OffspringPopulationWinnersParameter.ActualValue = successfulOffspring;
+      } else successfulOffspring = OffspringPopulationWinnersParameter.ActualValue;
+
+      int worseOffspringNeeded = (int)((1 - successRatio) * populationSize) - (population.Count - successfulOffspring.Value);
+      int successfulOffspringAdded = 0;
+
+      // implement the ActualValue fetch here - otherwise the parent scope would also be included, given that there may be 1000 or more parents, this is quite unnecessary
+      string tname = SuccessfulOffspringParameter.TranslatedName;
+      double tmpSelPress = selectionPressure.Value, tmpSelPressInc = 1.0 / populationSize;
+      for (int i = 0; i < offspring.SubScopes.Count; i++) {
+        // fetch value
+        IVariable tmpVar;
+        if (!offspring.SubScopes[i].Variables.TryGetValue(tname, out tmpVar)) throw new InvalidOperationException(Name + ": Could not determine if an offspring was successful or not.");
+        BoolValue tmp = (tmpVar.Value as BoolValue);
+        if (tmp == null) throw new InvalidOperationException(Name + ": The variable that indicates whether an offspring is successful or not must contain a BoolValue.");
+
+        // add to population
+        if (tmp.Value) {
+          IScope currentOffspring = offspring.SubScopes[i];
+          offspring.SubScopes.Remove(currentOffspring);
+          i--;
+          population.Add(currentOffspring);
+          successfulOffspringAdded++;
+        } else if (worseOffspringNeeded > 0 || tmpSelPress >= maxSelPress) {
+          IScope currentOffspring;
+          if (!fillPopulationWithParents || worseOffspringNeeded > 0) {
+            currentOffspring = offspring.SubScopes[i];
+            offspring.SubScopes.Remove(currentOffspring);
+            i--;
+            worseOffspringNeeded--;
+          } else {
+            currentOffspring = parents.SubScopes[i];
+          }
+          population.Add(currentOffspring);
+        }
+        tmpSelPress += tmpSelPressInc;
+        if (population.Count == populationSize) break;
+      }
+      successfulOffspring.Value += successfulOffspringAdded;
+
+      // calculate actual selection pressure and success ratio
+      selectionPressure.Value = tmpSelPress;
+      currentSuccessRatio.Value = successfulOffspring.Value / ((double)populationSize);
+
+
+      if (EnoughChildrenGeneratedParameter.ActualValue == null) {
+        EnoughChildrenGeneratedParameter.ActualValue = new BoolValue();
+      }
+      // check if enough children have been generated
+      if (((selectionPressure.Value < maxSelPress) && (currentSuccessRatio.Value < successRatio)) ||
+          (population.Count < populationSize)) {
+        // more children required -> reduce left and start children generation again
+        scope.SubScopes.Remove(parents);
+        scope.SubScopes.Remove(offspring);
+        while (parents.SubScopes.Count > 0) {
+          IScope parent = parents.SubScopes[0];
+          parents.SubScopes.RemoveAt(0);
+          scope.SubScopes.Add(parent);
+        }
+        EnoughChildrenGeneratedParameter.ActualValue.Value = false;
+      } else {
+        // enough children generated
+        offspring.SubScopes.Clear();
+        offspring.SubScopes.AddRange(population);
+
+        scope.Variables.Remove(OffspringPopulationParameter.TranslatedName);
+        scope.Variables.Remove(OffspringPopulationWinnersParameter.TranslatedName);
+        EnoughChildrenGeneratedParameter.ActualValue.Value = true;
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/Plugin.cs.frame
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/Plugin.cs.frame	(revision 11509)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/Plugin.cs.frame	(revision 11510)
@@ -40,5 +40,5 @@
   [PluginDependency("HeuristicLab.Random", "3.3")]
   [PluginDependency("HeuristicLab.Selection", "3.3")]
-  public class HeuristicLabAlgorithmsOffspringSelectionGeneticAlgorithmPlugin : PluginBase {
+  public class HeuristicLabAlgorithmsVOffspringSelectionGeneticAlgorithmPlugin : PluginBase {
   }
 }
Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithm.cs
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithm.cs	(revision 11509)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithm.cs	(revision 11510)
@@ -38,8 +38,8 @@
   /// An offspring selection genetic algorithm.
   /// </summary>
-  [Item("Offspring Selection Genetic Algorithm", "An offspring selection genetic algorithm (Affenzeller, M. et al. 2009. Genetic Algorithms and Genetic Programming - Modern Concepts and Practical Applications. CRC Press).")]
+  [Item("VOSGA", "An OSGA with selectable OS criteria and automtic crossover/mutation selection.")]
   [Creatable("Algorithms")]
   [StorableClass]
-  public sealed class OffspringSelectionGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
+  public sealed class VOffspringSelectionGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
     public string Filename { get; set; }
 
@@ -114,4 +114,7 @@
     private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
       get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
+    }
+    public IConstrainedValueParameter<IOffspringSelector> OffspringSelectorParameter {
+      get { return (IConstrainedValueParameter<IOffspringSelector>)Parameters["OffspringSelector"]; }
     }
     #endregion
@@ -134,4 +137,8 @@
       set { SelectorParameter.Value = value; }
     }
+    public IOffspringSelector OffspringSelector {
+      get { return OffspringSelectorParameter.Value; }
+      set { OffspringSelectorParameter.Value = value; }
+    }
     public ICrossover Crossover {
       get { return CrossoverParameter.Value; }
@@ -204,5 +211,5 @@
       get { return (SolutionsCreator)RandomCreator.Successor; }
     }
-    private OffspringSelectionGeneticAlgorithmMainLoop MainLoop {
+    private VOffspringSelectionGeneticAlgorithmMainLoop MainLoop {
       get { return FindMainLoop(SolutionsCreator.Successor); }
     }
@@ -216,5 +223,5 @@
 
     [StorableConstructor]
-    private OffspringSelectionGeneticAlgorithm(bool deserializing) : base(deserializing) { }
+    private VOffspringSelectionGeneticAlgorithm(bool deserializing) : base(deserializing) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
@@ -232,5 +239,5 @@
       Initialize();
     }
-    private OffspringSelectionGeneticAlgorithm(OffspringSelectionGeneticAlgorithm original, Cloner cloner)
+    private VOffspringSelectionGeneticAlgorithm(VOffspringSelectionGeneticAlgorithm original, Cloner cloner)
       : base(original, cloner) {
       qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
@@ -240,7 +247,7 @@
     }
     public override IDeepCloneable Clone(Cloner cloner) {
-      return new OffspringSelectionGeneticAlgorithm(this, cloner);
-    }
-    public OffspringSelectionGeneticAlgorithm()
+      return new VOffspringSelectionGeneticAlgorithm(this, cloner);
+    }
+    public VOffspringSelectionGeneticAlgorithm()
       : base() {
       Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
@@ -264,4 +271,6 @@
       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 });
+      Parameters.Add(new ConstrainedValueParameter<IOffspringSelector>("OffspringSelector", "The operator used as selection criterea for deciding which individuals are successful and which should be disgarded."));
+
 
       RandomCreator randomCreator = new RandomCreator();
@@ -269,5 +278,5 @@
       SubScopesCounter subScopesCounter = new SubScopesCounter();
       ResultsCollector resultsCollector = new ResultsCollector();
-      OffspringSelectionGeneticAlgorithmMainLoop mainLoop = new OffspringSelectionGeneticAlgorithmMainLoop();
+      VOffspringSelectionGeneticAlgorithmMainLoop mainLoop = new VOffspringSelectionGeneticAlgorithmMainLoop();
       OperatorGraph.InitialOperator = randomCreator;
 
@@ -321,4 +330,10 @@
       ParameterizeComparisonFactorModifiers();
 
+      foreach (IOffspringSelector selector in ApplicationManager.Manager.GetInstances<IOffspringSelector>().OrderBy(x => x.Name))
+        OffspringSelectorParameter.ValidValues.Add(selector);
+      IOffspringSelector standardOffspringSelector = OffspringSelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("StandardOffspringSelector"));
+      if (standardOffspringSelector != null) OffspringSelectorParameter.Value = standardOffspringSelector;
+      ParameterizeOffspringSelectors();
+
       qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
       selectionPressureAnalyzer = new ValueAnalyzer();
@@ -329,6 +344,4 @@
       Initialize();
     }
-
-
 
     public override void Prepare() {
@@ -431,4 +444,17 @@
           selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
         }
+      }
+    }
+    private void ParameterizeOffspringSelectors() {
+      foreach (IOffspringSelector selector in OffspringSelectorParameter.ValidValues) {
+        //TODO: do we need to set these parameters? if yes, where?
+        // selector.CurrentSuccessRatioParameter.ActualName = CurrentSuccessRatioParameter.Name;
+        //selector.SelectionPressureParameter.ActualName = SelectionPressureParameter.Name; 
+        selector.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
+        selector.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
+        selector.OffspringPopulationParameter.ActualName = "OffspringPopulation";
+        selector.OffspringPopulationWinnersParameter.ActualName = "OffspringPopulationWinners";
+        selector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring";
+        selector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
       }
     }
@@ -507,10 +533,10 @@
       Analyzer.Operators.Add(successfulOffspringAnalyzer, successfulOffspringAnalyzer.EnabledByDefault);
     }
-    private OffspringSelectionGeneticAlgorithmMainLoop FindMainLoop(IOperator start) {
+    private VOffspringSelectionGeneticAlgorithmMainLoop FindMainLoop(IOperator start) {
       IOperator mainLoop = start;
-      while (mainLoop != null && !(mainLoop is OffspringSelectionGeneticAlgorithmMainLoop))
+      while (mainLoop != null && !(mainLoop is VOffspringSelectionGeneticAlgorithmMainLoop))
         mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
       if (mainLoop == null) return null;
-      else return (OffspringSelectionGeneticAlgorithmMainLoop)mainLoop;
+      else return (VOffspringSelectionGeneticAlgorithmMainLoop)mainLoop;
     }
     #endregion
Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainLoop.cs
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainLoop.cs	(revision 11509)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainLoop.cs	(revision 11510)
@@ -32,7 +32,7 @@
   /// An operator which represents the main loop of an offspring selection genetic algorithm.
   /// </summary>
-  [Item("OffspringSelectionGeneticAlgorithmMainLoop", "An operator which represents the main loop of an offspring selection genetic algorithm.")]
+  [Item("VOffspringSelectionGeneticAlgorithmMainLoop", "An operator which represents the main loop of an offspring selection genetic algorithm.")]
   [StorableClass]
-  public sealed class OffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator {
+  public sealed class VOffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator {
     #region Parameter properties
     public ValueLookupParameter<IRandom> RandomParameter {
@@ -102,12 +102,12 @@
 
     [StorableConstructor]
-    private OffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base(deserializing) { }
-    private OffspringSelectionGeneticAlgorithmMainLoop(OffspringSelectionGeneticAlgorithmMainLoop original, Cloner cloner)
+    private VOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing) : base(deserializing) { }
+    private VOffspringSelectionGeneticAlgorithmMainLoop(VOffspringSelectionGeneticAlgorithmMainLoop original, Cloner cloner)
       : base(original, cloner) {
     }
     public override IDeepCloneable Clone(Cloner cloner) {
-      return new OffspringSelectionGeneticAlgorithmMainLoop(this, cloner);
-    }
-    public OffspringSelectionGeneticAlgorithmMainLoop()
+      return new VOffspringSelectionGeneticAlgorithmMainLoop(this, cloner);
+    }
+    public VOffspringSelectionGeneticAlgorithmMainLoop()
       : base() {
       Initialize();
@@ -157,5 +157,5 @@
       Placeholder analyzer1 = new Placeholder();
       ResultsCollector resultsCollector1 = new ResultsCollector();
-      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
+      VOffspringSelectionGeneticAlgorithmMainOperator mainOperator = new VOffspringSelectionGeneticAlgorithmMainOperator();
       IntCounter generationsCounter = new IntCounter();
       Comparator maxGenerationsComparator = new Comparator();
Index: /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainOperator.cs
===================================================================
--- /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainOperator.cs	(revision 11509)
+++ /branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainOperator.cs	(revision 11510)
@@ -33,7 +33,7 @@
   /// An operator which represents the main loop of an offspring selection genetic algorithm.
   /// </summary>
-  [Item("OffspringSelectionGeneticAlgorithmMainOperator", "An operator that represents the core of an offspring selection genetic algorithm.")]
+  [Item("VOffspringSelectionGeneticAlgorithmMainOperator", "An operator that represents the core of an offspring selection genetic algorithm.")]
   [StorableClass]
-  public sealed class OffspringSelectionGeneticAlgorithmMainOperator : AlgorithmOperator {
+  public sealed class VOffspringSelectionGeneticAlgorithmMainOperator : AlgorithmOperator {
     #region Parameter properties
     public ValueLookupParameter<IRandom> RandomParameter {
@@ -91,15 +91,18 @@
       get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
     }
+    public ValueLookupParameter<IOffspringSelector> OffspringSelectorParameter {
+      get { return (ValueLookupParameter<IOffspringSelector>)Parameters["OffspringSelector"]; }
+    }
     #endregion
 
     [StorableConstructor]
-    private OffspringSelectionGeneticAlgorithmMainOperator(bool deserializing) : base(deserializing) { }
-    private OffspringSelectionGeneticAlgorithmMainOperator(OffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner)
+    private VOffspringSelectionGeneticAlgorithmMainOperator(bool deserializing) : base(deserializing) { }
+    private VOffspringSelectionGeneticAlgorithmMainOperator(VOffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner)
       : base(original, cloner) {
     }
     public override IDeepCloneable Clone(Cloner cloner) {
-      return new OffspringSelectionGeneticAlgorithmMainOperator(this, cloner);
-    }
-    public OffspringSelectionGeneticAlgorithmMainOperator()
+      return new VOffspringSelectionGeneticAlgorithmMainOperator(this, cloner);
+    }
+    public VOffspringSelectionGeneticAlgorithmMainOperator()
       : base() {
       Initialize();
@@ -138,4 +141,5 @@
       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."));
       Parameters.Add(new ValueLookupParameter<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."));
+      Parameters.Add(new ValueLookupParameter<IOffspringSelector>("OffspringSelector", "The operator used as selection criterea for deciding which individuals are successful and which should be disgarded."));
       #endregion
 
@@ -172,5 +176,5 @@
       WeightedParentsQualityComparator qualityComparer2 = new WeightedParentsQualityComparator();
       SubScopesRemover subScopesRemover2 = new SubScopesRemover();
-      OffspringSelector offspringSelector = new OffspringSelector();
+      Placeholder offspringSelector = new Placeholder();
       SubScopesProcessor subScopesProcessor3 = new SubScopesProcessor();
       BestSelector bestSelector = new BestSelector();
@@ -183,4 +187,5 @@
       Placeholder evaluator4 = new Placeholder();
       SubScopesCounter subScopesCounter4 = new SubScopesCounter();
+      ConditionalBranch conditionalBranch = new ConditionalBranch();
 
       selector.Name = "Selector (placeholder)";
@@ -260,12 +265,6 @@
       subScopesRemover2.RemoveAllSubScopes = true;
 
-      offspringSelector.CurrentSuccessRatioParameter.ActualName = CurrentSuccessRatioParameter.Name;
-      offspringSelector.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
-      offspringSelector.SelectionPressureParameter.ActualName = SelectionPressureParameter.Name;
-      offspringSelector.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
-      offspringSelector.OffspringPopulationParameter.ActualName = "OffspringPopulation";
-      offspringSelector.OffspringPopulationWinnersParameter.ActualName = "OffspringPopulationWinners";
-      offspringSelector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring";
-      offspringSelector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name;
+      offspringSelector.Name = "OffspringSelector (placeholder)";
+      offspringSelector.OperatorParameter.ActualName = OffspringSelectorParameter.Name;
 
       bestSelector.CopySelected = new BoolValue(false);
@@ -289,4 +288,9 @@
       subScopesCounter4.Name = "Increment EvaluatedSolutions";
       subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
+
+      conditionalBranch.Name = "Enough children produced?";
+      conditionalBranch.ConditionParameter.ActualName = "EnoughChildrenGenerated";
+      conditionalBranch.FalseBranch = selector;
+      conditionalBranch.TrueBranch = subScopesProcessor3;
       #endregion
 
@@ -340,6 +344,5 @@
       subScopesRemover2.Successor = null;
       subScopesCounter3.Successor = null;
-      offspringSelector.OffspringCreator = selector;
-      offspringSelector.Successor = subScopesProcessor3;
+      offspringSelector.Successor = conditionalBranch;
       subScopesProcessor3.Operators.Add(bestSelector);
       subScopesProcessor3.Operators.Add(worstSelector);
