Index: /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
===================================================================
--- /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs	(revision 11582)
+++ /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs	(revision 11583)
@@ -39,5 +39,5 @@
   [Creatable("Algorithms")]
   [StorableClass]
-  public class AlpsGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
+  public sealed class AlpsGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
     public string Filename { get; set; }
 
@@ -371,8 +371,11 @@
     }
     private void ParameterizeMainLoop() {
-      MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
-      MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
-      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
-      MainLoop.BestKnownQualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      //MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
+      //MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      //MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+      //MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      MainLoop.MainOperator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      MainLoop.MainOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+      MainLoop.MainOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
     }
     private void ParameterizeSelectors() {
Index: /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
===================================================================
--- /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs	(revision 11582)
+++ /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs	(revision 11583)
@@ -20,4 +20,6 @@
 #endregion
 
+using System.Linq;
+using HeuristicLab.Algorithms.GeneticAlgorithm;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,14 +30,15 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Selection;
 
 namespace HeuristicLab.Algorithms.ALPS {
 
   [Item("AlpsGeneticAlgorithmMainLoop", "An ALPS genetic algorithm main loop operator.")]
-  public class AlpsGeneticAlgorithmMainLoop : AlgorithmOperator {
+  public sealed class AlpsGeneticAlgorithmMainLoop : AlgorithmOperator {
     #region Parameter Properties
     public ILookupParameter<IRandom> RandomParameter {
       get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     }
-    public ILookupParameter<BoolValue> MaximizationParameter {
+    /*public ILookupParameter<BoolValue> MaximizationParameter {
       get { return (ILookupParameter<BoolValue>)Parameters["Maximization"]; }
     }
@@ -46,4 +49,7 @@
       get { return (ILookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
     }
+    public ILookupParameter<IOperator> EvaluatorParameter {
+      get { return (ILookupParameter<IOperator>)Parameters["Evaluator"]; }
+    }*/
     public ILookupParameter<IntValue> PopulationSizeParameter {
       get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; }
@@ -64,7 +70,4 @@
       get { return (ILookupParameter<IOperator>)Parameters["Mutator"]; }
     }
-    public ILookupParameter<IOperator> EvaluatorParameter {
-      get { return (ILookupParameter<IOperator>)Parameters["Evaluator"]; }
-    }
     public ILookupParameter<IntValue> ElitesParameter {
       get { return (ILookupParameter<IntValue>)Parameters["Elites"]; }
@@ -83,4 +86,8 @@
     }
     #endregion
+
+    public GeneticAlgorithmMainLoop MainOperator {
+      get { return OperatorGraph.Iterate().OfType<GeneticAlgorithmMainLoop>().First(); }
+    }
 
     [StorableConstructor]
@@ -95,7 +102,8 @@
       : base() {
       Parameters.Add(new LookupParameter<IRandom>("Random", "A pseudo random number generator."));
-      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
+      /*Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
       Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
+      Parameters.Add(new LookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));*/
       Parameters.Add(new LookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
       Parameters.Add(new LookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that the algorithm should process."));
@@ -104,5 +112,4 @@
       Parameters.Add(new LookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
       Parameters.Add(new LookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
-      Parameters.Add(new LookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
       Parameters.Add(new LookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
       Parameters.Add(new LookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));
@@ -111,5 +118,4 @@
       Parameters.Add(new LookupParameter<IOperator>("LayerAnalyzer", "The operator used to analyze each layer."));
 
-
       var variableCreator = new VariableCreator() { Name = "Initialize" };
       var resultsCollector = new ResultsCollector();
@@ -117,8 +123,10 @@
       var initLayerAnalyzerProcessor = new SubScopesProcessor();
       var initLayerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
-      var matingPoolCreator = new CombinedOperator() { Name = "Create Mating Pools" };
+      var matingPoolCreator = new MatingPoolCreator() { Name = "Create Mating Pools" };
       var matingPoolProcessor = new UniformSubScopesProcessor();
-      var mainOperator = new CombinedOperator() { Name = "Perform Generation" };
+      var mainOperator = PrepareGeneticAlgorithmMainLoop();
       var layerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
+      var generationsIcrementor = new IntCounter() { Name = "Increment Generations" };
+      var evaluatedSolutionsReducer = new DataReducer() { Name = "Increment EvaluatedSolutions" };
       var eldersEmigrator = new CombinedOperator() { Name = "Emigrate Elders" };
       var layerUpdator = new CombinedOperator() { Name = "Update Layers" };
@@ -150,5 +158,15 @@
       matingPoolProcessor.Parallel.Value = true;
       matingPoolProcessor.Operator = mainOperator;
-      matingPoolProcessor.Successor = eldersEmigrator;
+      matingPoolProcessor.Successor = generationsIcrementor;
+
+      generationsIcrementor.ValueParameter.ActualName = "Generations";
+      generationsIcrementor.Increment = new IntValue(1);
+      generationsIcrementor.Successor = evaluatedSolutionsReducer;
+
+      evaluatedSolutionsReducer.ParameterToReduce.ActualName = "EvaluatedSolutions";
+      evaluatedSolutionsReducer.TargetParameter.ActualName = "EvaluatedSolutions";
+      evaluatedSolutionsReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
+      evaluatedSolutionsReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
+      evaluatedSolutionsReducer.Successor = eldersEmigrator;
 
       mainOperator.Successor = layerAnalyzerPlaceholder;
@@ -170,9 +188,49 @@
       generationsComparator.Successor = terminateBranch;
 
-      terminateBranch.ConditionParameter.ActualName = "Terminategenerations";
+      terminateBranch.ConditionParameter.ActualName = "TerminateGenerations";
       terminateBranch.FalseBranch = matingPoolCreator;
-
-    }
-
+    }
+
+    private GeneticAlgorithmMainLoop PrepareGeneticAlgorithmMainLoop() {
+      var mainLoop = new GeneticAlgorithmMainLoop();
+      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 elitesMerger = mainLoop.OperatorGraph.Iterate().OfType<MergingReducer>().First();
+
+      // Operator starts with selector
+      mainLoop.OperatorGraph.InitialOperator = selector;
+
+      // Insert AgeCalculator between crossover and its successor
+      var crossoverSuccessor = crossover.Successor;
+      var ageCalculator = new DataReducer() { Name = "Calculate Age" };
+      ageCalculator.ParameterToReduce.ActualName = "Age";
+      ageCalculator.TargetParameter.ActualName = "Age";
+      ageCalculator.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Max);
+      ageCalculator.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
+      crossover.Successor = ageCalculator;
+      ageCalculator.Successor = crossoverSuccessor;
+
+      // Instead of generational loop after merging of elites, increment ages of all individuals
+      var processor = new UniformSubScopesProcessor();
+      var incrementor = new IntCounter() { Name = "Increment Age" };
+      processor.Operator = incrementor;
+      processor.Successor = null;
+      incrementor.ValueParameter.ActualName = "Age";
+      incrementor.Increment = new IntValue(1);
+      incrementor.Successor = null;
+      elitesMerger.Successor = processor;
+
+      // 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 unnessesary subtrees
+      //foreach (var @operator in mainLoop.OperatorGraph.Iterate().OfType<SingleSuccessorOperator>().Where(o => o.Successor == selector))
+      //  @operator.Successor = null;
+
+      return mainLoop;
+    }
   }
 }
Index: /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj
===================================================================
--- /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj	(revision 11582)
+++ /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj	(revision 11583)
@@ -81,4 +81,5 @@
     <Compile Include="AlpsGeneticAlgorithm.cs" />
     <Compile Include="AlpsGeneticAlgorithmMainLoop.cs" />
+    <Compile Include="MatingPoolCreator.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
@@ -90,4 +91,8 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Algorithms.GeneticAlgorithm\3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj">
+      <Project>{a51da44f-cb35-4f6f-99f5-2a2e904ab93b}</Project>
+      <Name>HeuristicLab.Algorithms.GeneticAlgorithm-3.3</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
       <Project>{887425b4-4348-49ed-a457-b7d2c26ddbf9}</Project>
Index: /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs
===================================================================
--- /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs	(revision 11583)
+++ /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs	(revision 11583)
@@ -0,0 +1,59 @@
+﻿#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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("MatingPoolCreator", "An operator which creating mating pools based on a set of sub-populations. For each sub-population, the individuals from the previous sub-population are copied into the current sub-population.")]
+  [StorableClass]
+  public sealed class MatingPoolCreator : SingleSuccessorOperator {
+
+    [StorableConstructor]
+    private MatingPoolCreator(bool deserializing)
+      : base(deserializing) { }
+    private MatingPoolCreator(MatingPoolCreator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MatingPoolCreator(this, cloner);
+    }
+    public MatingPoolCreator()
+      : base() {
+    }
+
+    public override IOperation Apply() {
+      var subPopulations = ExecutionContext.Scope.SubScopes;
+
+      for (int i = subPopulations.Count - 1; i >= 0; i++) {
+        var currentSubPopulation = subPopulations[i].SubScopes;
+        var prevSubPopulation = i > 0 ? subPopulations[i - 1].SubScopes : Enumerable.Empty<IScope>();
+
+        foreach (var individual in prevSubPopulation) {
+          currentSubPopulation.Add(individual);
+        }
+      }
+      return base.Apply();
+    }
+  }
+}
Index: /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Plugin.cs.frame
===================================================================
--- /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Plugin.cs.frame	(revision 11582)
+++ /branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Plugin.cs.frame	(revision 11583)
@@ -40,4 +40,5 @@
   [PluginDependency("HeuristicLab.Random", "3.3")]
   [PluginDependency("HeuristicLab.Selection", "3.3")]
+  [PluginDependency("HeuristicLab.Algorithms.GeneticAlgorithm", "3.3")]
   public class HeuristicLabAlgorithmsALPSPlugin : PluginBase {
   }
