Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs	(revision 13046)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs	(revision 13095)
@@ -30,5 +30,4 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Selection;
 
 namespace HeuristicLab.Algorithms.ALPS {
@@ -61,7 +60,4 @@
       get { return OperatorGraph.Iterate().OfType<EldersEmigrator>().First(); }
     }
-    public LayerUpdator LayerUpdator {
-      get { return OperatorGraph.Iterate().OfType<LayerUpdator>().First(); }
-    }
 
     [StorableConstructor]
@@ -90,9 +86,10 @@
       var matingPoolProcessor = new UniformSubScopesProcessor();
       var initializeLayer = new Assigner() { Name = "Reset LayerEvaluatedSolutions" };
-      var mainOperator = CreatePreparedGeneticAlgorithmMainLoop();
+      var mainOperator = AlpsGeneticAlgorithmMainOperator.Create();
       var generationsIcrementor = new IntCounter() { Name = "Increment Generations" };
       var evaluatedSolutionsReducer = new DataReducer() { Name = "Increment EvaluatedSolutions" };
       var eldersEmigrator = new EldersEmigrator() { Name = "Emigrate Elders" };
-      var layerUpdator = new LayerUpdator(mainOperator) { Name = "Update Layers" };
+      var layerOpener = new LayerOpener() { Name = "Open new Layer" };
+      var layerReseeder = new LayerReseeder() { Name = "Reseed Layer Zero" };
       var layerAnalyzerProcessor = new UniformSubScopesProcessor();
       var layerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
@@ -146,7 +143,9 @@
       evaluatedSolutionsReducer.Successor = eldersEmigrator;
 
-      eldersEmigrator.Successor = layerUpdator;
+      eldersEmigrator.Successor = layerOpener;
 
-      layerUpdator.Successor = layerAnalyzerProcessor;
+      layerOpener.Successor = layerReseeder;
+
+      layerReseeder.Successor = layerAnalyzerProcessor;
 
       layerAnalyzerProcessor.Operator = layerAnalyzerPlaceholder;
@@ -160,98 +159,4 @@
       termination.ContinueBranch = matingPoolCreator;
     }
-
-    private GeneticAlgorithmMainLoop CreatePreparedGeneticAlgorithmMainLoop() {
-      var mainLoop = new GeneticAlgorithmMainLoop();
-
-      var oldInitialOp = mainLoop.OperatorGraph.InitialOperator;
-      var selector = mainLoop.OperatorGraph.Iterate().OfType<Placeholder>().First(o => o.OperatorParameter.ActualName == "Selector");
-      var crossover = mainLoop.OperatorGraph.Iterate().OfType<Placeholder>().First(o => o.OperatorParameter.ActualName == "Crossover");
-      var subScopesCounter = mainLoop.OperatorGraph.Iterate().OfType<SubScopesCounter>().First();
-      var elitesMerger = mainLoop.OperatorGraph.Iterate().OfType<MergingReducer>().First();
-
-      // Operator starts with calculating number of selected scopes base on plus/comma-selection replacement scheme
-      var numberOfSubScopesBranch = new ConditionalBranch() { Name = "PlusSelection?" };
-      var numberOfSelectedSubScopesPlusCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = PopulationSize * 2" };
-      var numberOfSelectedSubScopesCalculator = new ExpressionCalculator() { Name = "NumberOfSelectedSubScopes = (PopulationSize - Elites) * 2" };
-      var replacementBranch = new ConditionalBranch() { Name = "PlusSelection?" };
-
-      // Set new initial operator
-      mainLoop.OperatorGraph.InitialOperator = numberOfSubScopesBranch;
-
-      numberOfSubScopesBranch.ConditionParameter.ActualName = "PlusSelection";
-      numberOfSubScopesBranch.TrueBranch = numberOfSelectedSubScopesPlusCalculator;
-      numberOfSubScopesBranch.FalseBranch = numberOfSelectedSubScopesCalculator;
-      numberOfSubScopesBranch.Successor = selector;
-
-      numberOfSelectedSubScopesPlusCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
-      numberOfSelectedSubScopesPlusCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes";
-      numberOfSelectedSubScopesPlusCalculator.ExpressionParameter.Value = new StringValue("PopulationSize 2 * toint");
-
-      numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
-      numberOfSelectedSubScopesCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Elites"));
-      numberOfSelectedSubScopesCalculator.ExpressionResultParameter.ActualName = "NumberOfSelectedSubScopes";
-      numberOfSelectedSubScopesCalculator.ExpressionParameter.Value = new StringValue("PopulationSize Elites - 2 * toint");
-
-      // Use Elitism or Plus-Selection as replacement strategy
-      var selectedProcessor = (SubScopesProcessor)selector.Successor;
-      var elitismReplacement = selectedProcessor.Successor;
-      selectedProcessor.Successor = replacementBranch;
-      replacementBranch.ConditionParameter.ActualName = "PlusSelection";
-      replacementBranch.FalseBranch = elitismReplacement;
-
-      // Plus selection replacement
-      var replacementMergingReducer = new MergingReducer();
-      var replacementBestSelector = new BestSelector();
-      var replacementRightReducer = new RightReducer();
-      replacementBranch.TrueBranch = replacementMergingReducer;
-
-      replacementMergingReducer.Successor = replacementBestSelector;
-
-      replacementBestSelector.NumberOfSelectedSubScopesParameter.ActualName = "PopulationSize";
-      replacementBestSelector.CopySelected = new BoolValue(false);
-      replacementBestSelector.Successor = replacementRightReducer;
-
-      replacementRightReducer.Successor = null;
-
-      // Increment ages of all individuals after replacement
-      var incrementAgeProcessor = new UniformSubScopesProcessor();
-      var ageIncrementor = new DoubleCounter() { Name = "Increment Age" };
-      replacementBranch.Successor = incrementAgeProcessor;
-      incrementAgeProcessor.Operator = ageIncrementor;
-      incrementAgeProcessor.Successor = null;
-      ageIncrementor.ValueParameter.ActualName = "Age";
-      ageIncrementor.Increment = new DoubleValue(1.0);
-
-      // Insert AgeCalculator between crossover and its successor
-      var crossoverSuccessor = crossover.Successor;
-      var ageCalculator = new WeightingReducer() { Name = "Calculate Age" };
-      crossover.Successor = ageCalculator;
-
-      ageCalculator.ParameterToReduce.ActualName = "Age";
-      ageCalculator.TargetParameter.ActualName = "Age";
-      ageCalculator.WeightParameter.ActualName = "AgeInheritance";
-      ageCalculator.Successor = crossoverSuccessor;
-
-      // When counting the evaluated solutions, write in LayerEvaluatedSolutions
-      subScopesCounter.ValueParameter.ActualName = "LayerEvaluatedSolutions";
-      subScopesCounter.AccumulateParameter.Value = new BoolValue(false);
-
-      // Instead of generational loop after merging of elites, stop
-      elitesMerger.Successor = null;
-
-      // Parameterize
-      foreach (var stochasticOperator in mainLoop.OperatorGraph.Iterate().OfType<IStochasticOperator>())
-        stochasticOperator.RandomParameter.ActualName = "LocalRandom";
-      foreach (var stochasticBranch in mainLoop.OperatorGraph.Iterate().OfType<StochasticBranch>())
-        stochasticBranch.RandomParameter.ActualName = "LocalRandom";
-
-      // Remove unused operators
-      var usedOperators = mainLoop.OperatorGraph.Iterate();
-      var unusedOperators = mainLoop.OperatorGraph.Operators.Except(usedOperators);
-      foreach (var op in unusedOperators.ToList())
-        mainLoop.OperatorGraph.Operators.Remove(op);
-
-      return mainLoop;
-    }
   }
 }
