Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AgingScheme.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AgingScheme.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AgingScheme.cs	(revision 12083)
@@ -0,0 +1,49 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  public enum AgingSchemes {
+    Linear,
+    Fibonacci,
+    Polynomial,
+    Exponential
+  }
+
+  [Item("AgingScheme", "Represents a certain type of an aging scheme.")]
+  [StorableClass]
+  public class AgingScheme : EnumValue<AgingSchemes> {
+    [StorableConstructor]
+    protected AgingScheme(bool deserializing) : base(deserializing) { }
+    protected AgingScheme(AgingScheme original, Cloner cloner) : base(original, cloner) { }
+
+    public AgingScheme() : base(AgingSchemes.Linear) { }
+    public AgingScheme(AgingSchemes type) : base(type) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AgingScheme(this, cloner);
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs	(revision 12083)
@@ -0,0 +1,615 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Collections;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Random;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("ALPS Genetic Algorithm", "A genetic algorithm with an age-layered population structure.")]
+  [Creatable("Algorithms")]
+  [StorableClass]
+  public sealed class AlpsGeneticAlgorithm : HeuristicOptimizationEngineAlgorithm, IStorableContent {
+    public string Filename { get; set; }
+
+    #region Problem Properties
+    public override Type ProblemType {
+      get { return typeof(ISingleObjectiveHeuristicOptimizationProblem); }
+    }
+    public new ISingleObjectiveHeuristicOptimizationProblem Problem {
+      get { return (ISingleObjectiveHeuristicOptimizationProblem)base.Problem; }
+      set { base.Problem = value; }
+    }
+    #endregion
+
+    #region Parameter Properties
+    private IValueParameter<IntValue> SeedParameter {
+      get { return (IValueParameter<IntValue>)Parameters["Seed"]; }
+    }
+    private IValueParameter<BoolValue> SetSeedRandomlyParameter {
+      get { return (IValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
+    }
+    private IFixedValueParameter<MultiAnalyzer> AnalyzerParameter {
+      get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
+    }
+    private IFixedValueParameter<MultiAnalyzer> LayerAnalyzerParameter {
+      get { return (IFixedValueParameter<MultiAnalyzer>)Parameters["LayerAnalyzer"]; }
+    }
+    private IValueParameter<IntValue> NumberOfLayersParameter {
+      get { return (IValueParameter<IntValue>)Parameters["NumberOfLayers"]; }
+    }
+    private IValueParameter<IntArray> PopulationSizeParameter {
+      get { return (IValueParameter<IntArray>)Parameters["PopulationSize"]; }
+    }
+    private IValueParameter<IntValue> MaximumGenerationsParameter {
+      get { return (IValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
+    }
+    private IValueParameter<AgingScheme> AgingSchemeParameter {
+      get { return (IValueParameter<AgingScheme>)Parameters["AgingScheme"]; }
+    }
+    private IValueParameter<IntValue> AgeGapParameter {
+      get { return (IValueParameter<IntValue>)Parameters["AgeGap"]; }
+    }
+    private IValueParameter<IntArray> AgeLimitsParameter {
+      get { return (IValueParameter<IntArray>)Parameters["AgeLimits"]; }
+    }
+    private IValueParameter<ReductionOperation> AgeInheritanceParameter {
+      get { return (IValueParameter<ReductionOperation>)Parameters["AgeInheritance"]; }
+    }
+    private IValueParameter<IntValue> MatingPoolRangeParameter {
+      get { return (IValueParameter<IntValue>)Parameters["MatingPoolRange"]; }
+    }
+    private IValueParameter<PercentValue> MatingPoolSelectionPercentageParameter {
+      get { return (IValueLookupParameter<PercentValue>)Parameters["MatingPoolSelectionPercentage"]; }
+    }
+    public IConstrainedValueParameter<ISelector> SelectorParameter {
+      get { return (IConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
+    }
+    public IConstrainedValueParameter<ICrossover> CrossoverParameter {
+      get { return (IConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
+    }
+    private IValueParameter<PercentValue> MutationProbabilityParameter {
+      get { return (IValueParameter<PercentValue>)Parameters["MutationProbability"]; }
+    }
+    public IConstrainedValueParameter<IManipulator> MutatorParameter {
+      get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
+    }
+    private IValueParameter<IntValue> ElitesParameter {
+      get { return (IValueParameter<IntValue>)Parameters["Elites"]; }
+    }
+    private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
+    }
+    #endregion
+
+    #region Properties
+    public IntValue Seed {
+      get { return SeedParameter.Value; }
+      set { SeedParameter.Value = value; }
+    }
+    public BoolValue SetSeedRandomly {
+      get { return SetSeedRandomlyParameter.Value; }
+      set { SetSeedRandomlyParameter.Value = value; }
+    }
+    public MultiAnalyzer Analyzer {
+      get { return AnalyzerParameter.Value; }
+    }
+    public MultiAnalyzer LayerAnalyzer {
+      get { return LayerAnalyzerParameter.Value; }
+    }
+    public IntValue NumberOfLayers {
+      get { return NumberOfLayersParameter.Value; }
+      set { NumberOfLayersParameter.Value = value; }
+    }
+
+    public IntArray PopulationSize {
+      get { return PopulationSizeParameter.Value; }
+      set { PopulationSizeParameter.Value = value; }
+    }
+    public IntValue MaximumGenerations {
+      get { return MaximumGenerationsParameter.Value; }
+      set { MaximumGenerationsParameter.Value = value; }
+    }
+    public AgingScheme AgingScheme {
+      get { return AgingSchemeParameter.Value; }
+      set { AgingSchemeParameter.Value = value; }
+    }
+    public IntValue AgeGap {
+      get { return AgeGapParameter.Value; }
+      set { AgeGapParameter.Value = value; }
+    }
+    public IntArray AgeLimits {
+      get { return AgeLimitsParameter.Value; }
+      set { AgeLimitsParameter.Value = value; }
+    }
+    public ReductionOperation AgeInheritance {
+      get { return AgeInheritanceParameter.Value; }
+      set { AgeInheritanceParameter.Value = value; }
+    }
+    public IntValue MatingPoolRange {
+      get { return MatingPoolRangeParameter.Value; }
+      set { MatingPoolRangeParameter.Value = value; }
+    }
+    public PercentValue MatingPoolSelectionPercentage {
+      get { return MatingPoolSelectionPercentageParameter.Value; }
+      set { MatingPoolSelectionPercentageParameter.Value = value; }
+    }
+    public ISelector Selector {
+      get { return SelectorParameter.Value; }
+      set { SelectorParameter.Value = value; }
+    }
+    public ICrossover Crossover {
+      get { return CrossoverParameter.Value; }
+      set { CrossoverParameter.Value = value; }
+    }
+    public PercentValue MutationProbability {
+      get { return MutationProbabilityParameter.Value; }
+      set { MutationProbabilityParameter.Value = value; }
+    }
+    public IManipulator Mutator {
+      get { return MutatorParameter.Value; }
+      set { MutatorParameter.Value = value; }
+    }
+    public IntValue Elites {
+      get { return ElitesParameter.Value; }
+      set { ElitesParameter.Value = value; }
+    }
+    public bool ReevaluteElites {
+      get { return ReevaluateElitesParameter.Value.Value; }
+      set { ReevaluateElitesParameter.Value.Value = value; }
+    }
+
+    private RandomCreator GlobalRandomCreator {
+      get { return (RandomCreator)OperatorGraph.InitialOperator; }
+    }
+    private SolutionsCreator SolutionsCreator {
+      get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); }
+    }
+    private AlpsGeneticAlgorithmMainLoop MainLoop {
+      get { return OperatorGraph.Iterate().OfType<AlpsGeneticAlgorithmMainLoop>().First(); }
+    }
+
+    #endregion
+
+    #region Preconfigured Analyzers
+    [Storable]
+    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
+    [Storable]
+    private BestAverageWorstQualityAnalyzer layerQualityAnalyzer;
+    #endregion
+
+    [StorableConstructor]
+    private AlpsGeneticAlgorithm(bool deserializing)
+      : base(deserializing) { }
+    private AlpsGeneticAlgorithm(AlpsGeneticAlgorithm original, Cloner cloner)
+      : base(original, cloner) {
+      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
+      layerQualityAnalyzer = cloner.Clone(original.layerQualityAnalyzer);
+      Initialize();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AlpsGeneticAlgorithm(this, cloner);
+    }
+    public AlpsGeneticAlgorithm()
+      : base() {
+      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
+      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
+      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));
+      Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "The number of layers.", new IntValue(10)));
+      Parameters.Add(new ValueParameter<IntArray>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 })));
+      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.", new IntValue(1000)));
+      Parameters.Add(new ValueParameter<AgingScheme>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new AgingScheme(AgingSchemes.Polynomial)));
+      Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers", new IntValue(20)));
+      Parameters.Add(new ValueParameter<IntArray>("AgeLimits", new IntArray(new int[0])) { Hidden = true });
+      Parameters.Add(new ValueParameter<ReductionOperation>("AgeInheritance", "The operator for determining the age of an offspring based the parents' age.", new ReductionOperation(ReductionOperations.Max)) { Hidden = true });
+      Parameters.Add(new ValueParameter<IntValue>("MatingPoolRange", "The range of layers used for creating a mating pool. (1 = current + previous layer)", new IntValue(1)) { Hidden = true });
+      Parameters.Add(new ValueParameter<PercentValue>("MatingPoolSelectionPercentage", "Percentage of the previous layers used for creating a mating pool.", new PercentValue(1.0, restrictToUnitInterval: true)) { Hidden = true });
+      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
+      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
+      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
+      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
+      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 });
+
+      var globalRandomCreator = new RandomCreator();
+      var layer0Creator = new SubScopesCreator() { Name = "Create Layer Zero" };
+      var layer0Processor = new LayerUniformSubScopesProcessor();
+      var localRandomCreator = new LocalRandomCreator();
+      var layerVariableCreator = new VariableCreator();
+      var layerSolutionsCreator = new SolutionsCreator();
+      var initializeAgeProcessor = new UniformSubScopesProcessor();
+      var initializeAge = new VariableCreator() { Name = "Initialize Age" };
+      var initializeLayerPopulationSize = new SubScopesCounter() { Name = "Init LayerPopulationCounter" };
+      var initializeLocalEvaluatedSolutions = new Assigner() { Name = "Initialize LayerEvaluatedSolutions" };
+      var initializeGlobalEvaluatedSolutions = new DataReducer() { Name = "Initialize EvaluatedSolutions" };
+      var resultsCollector = new ResultsCollector();
+      var mainLoop = new AlpsGeneticAlgorithmMainLoop();
+
+      OperatorGraph.InitialOperator = globalRandomCreator;
+
+      globalRandomCreator.RandomParameter.ActualName = "GlobalRandom";
+      globalRandomCreator.SeedParameter.Value = null;
+      globalRandomCreator.SetSeedRandomlyParameter.Value = null;
+      globalRandomCreator.Successor = layer0Creator;
+
+      layer0Creator.NumberOfSubScopesParameter.Value = new IntValue(1);
+      layer0Creator.Successor = layer0Processor;
+
+      layer0Processor.Operator = localRandomCreator;
+      layer0Processor.Successor = initializeGlobalEvaluatedSolutions;
+
+      localRandomCreator.Successor = layerVariableCreator;
+
+      layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0)));
+      //layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
+      layerVariableCreator.Successor = layerSolutionsCreator;
+
+      layerSolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
+      layerSolutionsCreator.Successor = initializeAgeProcessor;
+
+      initializeAgeProcessor.Operator = initializeAge;
+      initializeAgeProcessor.Successor = initializeLayerPopulationSize;
+
+      initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize";
+      initializeLayerPopulationSize.Successor = initializeLocalEvaluatedSolutions;
+
+      initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(0)));
+      initializeAge.Successor = null;
+
+      initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName = "LayerEvaluatedSolutions";
+      initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "LayerPopulationSize";
+      initializeLocalEvaluatedSolutions.Successor = null;
+
+      initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum;
+      initializeGlobalEvaluatedSolutions.TargetOperation.Value.Value = ReductionOperations.Assign;
+      initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = "LayerEvaluatedSolutions";
+      initializeGlobalEvaluatedSolutions.TargetParameter.ActualName = "EvaluatedSolutions";
+      initializeGlobalEvaluatedSolutions.Successor = resultsCollector;
+
+      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
+      resultsCollector.Successor = mainLoop;
+
+      foreach (var selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(s => !(s is IMultiObjectiveSelector)).OrderBy(s => Name))
+        SelectorParameter.ValidValues.Add(selector);
+      var porportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(s => s is ProportionalSelector);
+      if (porportionalSelector != null) SelectorParameter.Value = porportionalSelector;
+
+      ParameterizeSelectors();
+
+      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
+      layerQualityAnalyzer = new BestAverageWorstQualityAnalyzer();
+
+      RecalculateAgeLimits();
+      ParameterizeAnalyzers();
+      UpdateAnalyzers();
+
+      Initialize();
+    }
+
+    public override void Prepare() {
+      if (Problem != null)
+        base.Prepare();
+    }
+
+    #region Events
+    protected override void OnProblemChanged() {
+      ParameterizeStochasticOperator(Problem.SolutionCreator);
+      ParameterizeStochasticOperatorForLayer(Problem.Evaluator);
+      foreach (var @operator in Problem.Operators.OfType<IOperator>())
+        ParameterizeStochasticOperator(@operator);
+      ParameterizeSolutionsCreator();
+      ParameterizeMainLoop();
+      ParameterizeSelectors();
+      ParameterizeAnalyzers();
+      ParameterizeIterationBasedOperators();
+      UpdateCrossovers();
+      UpdateMutators();
+      UpdateAnalyzers();
+      Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
+      base.OnProblemChanged();
+    }
+
+    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
+      ParameterizeStochasticOperator(Problem.SolutionCreator);
+      ParameterizeSolutionsCreator();
+      base.Problem_SolutionCreatorChanged(sender, e);
+    }
+    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
+      ParameterizeStochasticOperatorForLayer(Problem.Evaluator);
+      ParameterizeSolutionsCreator();
+      ParameterizeMainLoop();
+      ParameterizeSelectors();
+      ParameterizeAnalyzers();
+      Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
+      base.Problem_EvaluatorChanged(sender, e);
+    }
+    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
+      foreach (var @operator in Problem.Operators.OfType<IOperator>())
+        ParameterizeStochasticOperator(@operator);
+      ParameterizeIterationBasedOperators();
+      UpdateCrossovers();
+      UpdateMutators();
+      UpdateAnalyzers();
+      base.Problem_OperatorsChanged(sender, e);
+    }
+    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
+      ParameterizeMainLoop();
+      ParameterizeSelectors();
+      ParameterizeAnalyzers();
+    }
+
+    void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
+      PopulationSizeParameter.ValueChanged += PopulationSize_ValueChanged;
+      ParameterizeSelectors();
+    }
+    void PopulationSize_ValueChanged(object sender, EventArgs e) {
+      ParameterizeSelectors();
+    }
+    void ElitesParameter_ValueChanged(object sender, EventArgs e) {
+      Elites.ValueChanged += ElitesParameter_ValueChanged;
+      ParameterizeSelectors();
+    }
+    void Elites_ValueChanged(object sender, EventArgs e) {
+      ParameterizeSelectors();
+    }
+    private void AgeGapParameter_ValueChanged(object sender, EventArgs e) {
+      AgeGap.ValueChanged += AgeGap_ValueChanged;
+      RecalculateAgeLimits();
+    }
+    private void AgeGap_ValueChanged(object sender, EventArgs e) {
+      RecalculateAgeLimits();
+    }
+    private void AgingSchemeParameter_ValueChanged(object sender, EventArgs e) {
+      AgingScheme.ValueChanged += AgingScheme_ValueChanged;
+      RecalculateAgeLimits();
+    }
+    private void AgingScheme_ValueChanged(object sender, EventArgs e) {
+      RecalculateAgeLimits();
+    }
+    private void NumberOfLayersParameter_ValueChanged(object sender, EventArgs e) {
+      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
+      RecalculateAgeLimits();
+    }
+    private void NumberOfLayers_ValueChanged(object sender, EventArgs e) {
+      RecalculateAgeLimits();
+    }
+    private void AnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
+      foreach (var analyzer in e.Items) {
+        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
+          parameter.Depth = 2;
+        }
+      }
+    }
+    private void LayerAnalyzerOperators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IAnalyzer>> e) {
+      foreach (var analyzer in e.Items) {
+        IParameter resultParameter;
+        if (analyzer.Value.Parameters.TryGetValue("Results", out resultParameter)) {
+          var lookupParameter = resultParameter as ILookupParameter<ResultCollection>;
+          if (lookupParameter != null)
+            lookupParameter.ActualName = "LayerResults";
+        }
+        foreach (var parameter in analyzer.Value.Parameters.OfType<IScopeTreeLookupParameter>()) {
+          parameter.Depth = 1;
+        }
+      }
+    }
+    #endregion
+
+    #region Parameterization
+    private void Initialize() {
+      PopulationSizeParameter.ValueChanged += PopulationSizeParameter_ValueChanged;
+      //PopulationSize.ValueChanged += PopulationSize_ValueChanged; TODO
+      ElitesParameter.ValueChanged += ElitesParameter_ValueChanged;
+      Elites.ValueChanged += Elites_ValueChanged;
+      if (Problem != null)
+        Problem.Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
+      AgeGapParameter.ValueChanged += AgeGapParameter_ValueChanged;
+      AgeGap.ValueChanged += AgeGap_ValueChanged;
+      AgingSchemeParameter.ValueChanged += AgingSchemeParameter_ValueChanged;
+      AgingScheme.ValueChanged += AgingScheme_ValueChanged;
+      NumberOfLayersParameter.ValueChanged += NumberOfLayersParameter_ValueChanged;
+      NumberOfLayers.ValueChanged += NumberOfLayers_ValueChanged;
+      Analyzer.Operators.ItemsAdded += AnalyzerOperators_ItemsAdded;
+      LayerAnalyzer.Operators.ItemsAdded += LayerAnalyzerOperators_ItemsAdded;
+    }
+    private void ParameterizeSolutionsCreator() {
+      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
+      MainLoop.LayerUpdator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      MainLoop.LayerUpdator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
+    }
+    private void ParameterizeMainLoop() {
+      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;
+      MainLoop.EldersEmigrator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+      MainLoop.EldersEmigrator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      MainLoop.LayerUpdator.SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
+    }
+    private void ParameterizeSelectors() {
+      foreach (var selector in SelectorParameter.ValidValues) {
+        selector.CopySelected = new BoolValue(true);
+        // Explicit setting of NumberOfSelectedSubScopesParameter is not required anymore because the NumberOfSelectedSubScopesCalculator calculates it itself
+        //selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSize - Elites.Value)); 
+        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
+        ParameterizeStochasticOperatorForLayer(selector);
+      }
+      if (Problem != null) {
+        foreach (var selector in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
+          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+          selector.MaximizationParameter.Hidden = true;
+          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+          selector.QualityParameter.Hidden = true;
+        }
+      }
+    }
+    private void ParameterizeAnalyzers() {
+      qualityAnalyzer.ResultsParameter.ActualName = "Results";
+      qualityAnalyzer.ResultsParameter.Hidden = true;
+      qualityAnalyzer.QualityParameter.Depth = 2;
+      layerQualityAnalyzer.ResultsParameter.ActualName = "Results";
+      layerQualityAnalyzer.ResultsParameter.Hidden = true;
+      layerQualityAnalyzer.QualityParameter.Depth = 1;
+      if (Problem != null) {
+        qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+        qualityAnalyzer.MaximizationParameter.Hidden = true;
+        qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+        qualityAnalyzer.QualityParameter.Hidden = true;
+        qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
+        qualityAnalyzer.BestKnownQualityParameter.Hidden = true;
+        layerQualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+        layerQualityAnalyzer.MaximizationParameter.Hidden = true;
+        layerQualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+        layerQualityAnalyzer.QualityParameter.Hidden = true;
+        layerQualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
+        layerQualityAnalyzer.BestKnownQualityParameter.Hidden = true;
+      }
+    }
+    private void ParameterizeIterationBasedOperators() {
+      if (Problem != null) {
+        foreach (var @operator in Problem.Operators.OfType<IIterationBasedOperator>()) {
+          @operator.IterationsParameter.ActualName = "Generations";
+          @operator.IterationsParameter.Hidden = true;
+          @operator.MaximumIterationsParameter.ActualName = "MaximumGenerations";
+          @operator.MaximumIterationsParameter.Hidden = true;
+        }
+      }
+    }
+    private void ParameterizeStochasticOperator(IOperator @operator) {
+      var stochasticOperator = @operator as IStochasticOperator;
+      if (stochasticOperator != null) {
+        stochasticOperator.RandomParameter.ActualName = GlobalRandomCreator.RandomParameter.ActualName;
+        stochasticOperator.RandomParameter.Hidden = true;
+      }
+    }
+    private void ParameterizeStochasticOperatorForLayer(IOperator @operator) {
+      var stochasticOperator = @operator as IStochasticOperator;
+      if (stochasticOperator != null) {
+        stochasticOperator.RandomParameter.ActualName = "LocalRandom";
+        stochasticOperator.RandomParameter.Hidden = true;
+      }
+    }
+    #endregion
+
+    #region Updates
+    private void UpdateCrossovers() {
+      var oldCrossover = CrossoverParameter.Value;
+      var defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
+      CrossoverParameter.ValidValues.Clear();
+      foreach (var crossover in Problem.Operators.OfType<ICrossover>().OrderBy(c => c.Name)) {
+        ParameterizeStochasticOperatorForLayer(crossover);
+        CrossoverParameter.ValidValues.Add(crossover);
+      }
+      if (oldCrossover != null) {
+        var crossover = CrossoverParameter.ValidValues.FirstOrDefault(c => c.GetType() == oldCrossover.GetType());
+        if (crossover != null)
+          CrossoverParameter.Value = crossover;
+        else
+          oldCrossover = null;
+      }
+      if (oldCrossover == null && defaultCrossover != null)
+        CrossoverParameter.Value = defaultCrossover;
+    }
+    private void UpdateMutators() {
+      var oldMutator = MutatorParameter.Value;
+      MutatorParameter.ValidValues.Clear();
+      foreach (var mutator in Problem.Operators.OfType<IManipulator>().OrderBy(m => m.Name)) {
+        ParameterizeStochasticOperatorForLayer(mutator);
+        MutatorParameter.ValidValues.Add(mutator);
+      }
+      if (oldMutator != null) {
+        var mutator = MutatorParameter.ValidValues.FirstOrDefault(m => m.GetType() == oldMutator.GetType());
+        if (mutator != null)
+          MutatorParameter.Value = mutator;
+      }
+    }
+    private void UpdateAnalyzers() {
+      Analyzer.Operators.Clear();
+      LayerAnalyzer.Operators.Clear();
+
+      Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault);
+      LayerAnalyzer.Operators.Add(layerQualityAnalyzer, layerQualityAnalyzer.EnabledByDefault);
+
+      if (Problem != null) {
+        foreach (var analyzer in Problem.Operators.OfType<IAnalyzer>()) {
+          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
+        }
+      }
+    }
+    #endregion
+
+    #region AgeLimits calculation
+    private void RecalculateAgeLimits() {
+      IEnumerable<int> scheme;
+      switch (AgingScheme.Value) {
+        case AgingSchemes.Linear: scheme = LinearAgingScheme(); break;
+        case AgingSchemes.Fibonacci: scheme = FibonacciAgingScheme(); break;
+        case AgingSchemes.Polynomial: scheme = PolynomialAgingScheme(2); break;
+        case AgingSchemes.Exponential: scheme = ExponentialAgingScheme(2); break;
+        default: throw new NotSupportedException("Aging Scheme " + AgingScheme.Value + " is not supported.");
+      }
+
+      int ageGap = AgeGap.Value;
+      AgeLimits = new IntArray(scheme.Select(a => a * ageGap).Take(NumberOfLayers.Value).ToArray());
+    }
+
+    // 1 2 3 4 5 6 7
+    private static IEnumerable<int> LinearAgingScheme() {
+      for (int i = 0; ; i++)
+        yield return i + 1;
+    }
+    // 1 2 3 5 8 13 21
+    private static IEnumerable<int> FibonacciAgingScheme() {
+      for (int i = 1, next = 2, temp; ; temp = next, next = i + next, i = temp)
+        yield return i;
+    }
+    // (n^2): 1 2 4 9 16 25 36
+    private static IEnumerable<int> PolynomialAgingScheme(double exp) {
+      yield return 1;
+      yield return 2;
+      for (int i = 2; ; i++)
+        yield return (int)Math.Pow(i, exp);
+
+    }
+    // 1 2 4 8 16 32 64
+    private static IEnumerable<int> ExponentialAgingScheme(double @base) {
+      for (int i = 0; ; i++)
+        yield return (int)Math.Pow(@base, i);
+    }
+    #endregion
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs	(revision 12083)
@@ -0,0 +1,224 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Algorithms.GeneticAlgorithm;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
+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.")]
+  [StorableClass]
+  public sealed class AlpsGeneticAlgorithmMainLoop : AlgorithmOperator {
+    #region Parameter Properties
+    public ValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+    public ILookupParameter<IntValue> MaximumGenerationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
+    }
+    public ILookupParameter<IOperator> AnalyzerParameter {
+      get { return (ILookupParameter<IOperator>)Parameters["Analyzer"]; }
+    }
+    public ILookupParameter<IOperator> LayerAnalyzerParameter {
+      get { return (ILookupParameter<IOperator>)Parameters["LayerAnalyzer"]; }
+    }
+    #endregion
+
+    public GeneticAlgorithmMainLoop MainOperator {
+      get { return OperatorGraph.Iterate().OfType<GeneticAlgorithmMainLoop>().First(); }
+    }
+    public EldersEmigrator EldersEmigrator {
+      get { return OperatorGraph.Iterate().OfType<EldersEmigrator>().First(); }
+    }
+    public LayerUpdator LayerUpdator {
+      get { return OperatorGraph.Iterate().OfType<LayerUpdator>().First(); }
+    }
+
+    [StorableConstructor]
+    private AlpsGeneticAlgorithmMainLoop(bool deserializing)
+      : base(deserializing) { }
+    private AlpsGeneticAlgorithmMainLoop(AlpsGeneticAlgorithmMainLoop original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AlpsGeneticAlgorithmMainLoop(this, cloner);
+    }
+    public AlpsGeneticAlgorithmMainLoop()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<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<IntValue>("MaximumGenerations", "The maximum number of generations that the algorithm should process."));
+      Parameters.Add(new LookupParameter<IOperator>("Analyzer", "The operator used to the analyze all individuals."));
+      Parameters.Add(new LookupParameter<IOperator>("LayerAnalyzer", "The operator used to analyze each layer."));
+
+      var variableCreator = new VariableCreator() { Name = "Initialize" };
+      var initLayerAnalyzerProcessor = new SubScopesProcessor();
+      var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" };
+      var initLayerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
+      var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };
+      var resultsCollector = new ResultsCollector();
+      var matingPoolPreProcessor = new UniformSubScopesProcessor() { Name = "MatingPoolPreProcessor" };
+      var matingPoolPreSorter = new SubScopesSorter() { Name = "MatingPoolPreSorter" };
+      var matingPoolCreator = new MatingPoolCreator() { Name = "Create Mating Pools" };
+      var matingPoolProcessor = new LayerUniformSubScopesProcessor();
+      var initializeLayer = new Assigner() { Name = "Reset LayerEvaluatedSolutions" };
+      var mainOperator = CreatePreparedGeneticAlgorithmMainLoop();
+      var layerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
+      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 analyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };
+      var generationsComparator = new Comparator() { Name = "Generations >= MaximumGenerations" };
+      var terminateBranch = new ConditionalBranch() { Name = "Terminate?" };
+
+      OperatorGraph.InitialOperator = variableCreator;
+
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastRefresh", new IntValue(0)));
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1)));
+      variableCreator.Successor = initLayerAnalyzerProcessor;
+
+      initLayerAnalyzerProcessor.Operators.Add(layerVariableCreator);
+      initLayerAnalyzerProcessor.Successor = initAnalyzerPlaceholder;
+
+      layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions"));
+      layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults"));
+      layerVariableCreator.Successor = initLayerAnalyzerPlaceholder;
+
+      initLayerAnalyzerPlaceholder.OperatorParameter.ActualName = LayerAnalyzerParameter.Name;
+      initLayerAnalyzerPlaceholder.Successor = null;
+
+      initAnalyzerPlaceholder.OperatorParameter.ActualName = AnalyzerParameter.Name;
+      initAnalyzerPlaceholder.Successor = resultsCollector;
+
+      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
+      resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "LayerResults"));
+      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
+      resultsCollector.CopyValue = new BoolValue(false);
+      resultsCollector.Successor = matingPoolPreProcessor;
+
+      matingPoolPreProcessor.Operator = matingPoolPreSorter;
+      matingPoolPreProcessor.Successor = matingPoolCreator;
+
+      matingPoolPreSorter.ValueParameter.ActualName = QualityParameter.Name;
+      matingPoolPreSorter.DescendingParameter.ActualName = MaximizationParameter.Name;
+
+      matingPoolCreator.Successor = matingPoolProcessor;
+
+      matingPoolProcessor.Parallel.Value = true;
+      matingPoolProcessor.Operator = initializeLayer;
+      matingPoolProcessor.Successor = generationsIcrementor;
+
+      initializeLayer.LeftSideParameter.ActualName = "LayerEvaluatedSolutions";
+      initializeLayer.RightSideParameter.Value = new IntValue(0);
+      initializeLayer.Successor = mainOperator;
+
+      generationsIcrementor.ValueParameter.ActualName = "Generations";
+      generationsIcrementor.Increment = new IntValue(1);
+      generationsIcrementor.Successor = evaluatedSolutionsReducer;
+
+      evaluatedSolutionsReducer.ParameterToReduce.ActualName = "LayerEvaluatedSolutions";
+      evaluatedSolutionsReducer.TargetParameter.ActualName = "EvaluatedSolutions";
+      evaluatedSolutionsReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
+      evaluatedSolutionsReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
+      evaluatedSolutionsReducer.Successor = eldersEmigrator;
+
+      mainOperator.Successor = layerAnalyzerPlaceholder;
+
+      layerAnalyzerPlaceholder.OperatorParameter.ActualName = LayerAnalyzerParameter.Name;
+      layerAnalyzerPlaceholder.Successor = null;
+
+      eldersEmigrator.Successor = layerUpdator;
+
+      layerUpdator.Successor = analyzerPlaceholder;
+
+      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;
+    }
+
+    private GeneticAlgorithmMainLoop CreatePreparedGeneticAlgorithmMainLoop() {
+      var mainLoop = new GeneticAlgorithmMainLoop();
+      var numberOfSelectedSubScopesCalculator = new NumberOfSelectedSubScopesCalculator();
+      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 numberOfSelectedSubScopesCalculator
+      mainLoop.OperatorGraph.InitialOperator = numberOfSelectedSubScopesCalculator;
+      numberOfSelectedSubScopesCalculator.Successor = 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 = null;
+      ageCalculator.ReductionOperation.ActualName = "AgeInheritance";
+      ageCalculator.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
+      crossover.Successor = ageCalculator;
+      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, 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";
+
+      return mainLoop;
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/AgeDistributionAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/AgeDistributionAnalyzer.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/AgeDistributionAnalyzer.cs	(revision 12083)
@@ -0,0 +1,137 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  // Based on QualityDistributionAnalyzer
+  [Item("AgeDistributionAnalyzer", "Analyzes the distribution of the ages in that it adds a Histogram of them into the result collection.")]
+  [StorableClass]
+  public sealed class AgeDistributionAnalyzer : SingleSuccessorOperator, IAnalyzer, IIterationBasedOperator {
+
+    #region Parameter Properties
+    public IScopeTreeLookupParameter<IntValue> AgeParameter {
+      get { return (IScopeTreeLookupParameter<IntValue>)Parameters["Age"]; }
+    }
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+    private ValueParameter<StringValue> HistogramNameParameter {
+      get { return (ValueParameter<StringValue>)Parameters["HistogramName"]; }
+    }
+    private ValueParameter<BoolValue> StoreHistoryParameter {
+      get { return (ValueParameter<BoolValue>)Parameters["StoreHistory"]; }
+    }
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+    #endregion
+
+    public bool EnabledByDefault { get { return false; } }
+
+    public string HistogramName {
+      get { return HistogramNameParameter.Value.Value; }
+      set { HistogramNameParameter.Value.Value = value; }
+    }
+    public bool StoreHistory {
+      get { return StoreHistoryParameter.Value.Value; }
+      set { StoreHistoryParameter.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    private AgeDistributionAnalyzer(bool deserializing)
+      : base(deserializing) { }
+    private AgeDistributionAnalyzer(AgeDistributionAnalyzer original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AgeDistributionAnalyzer(this, cloner);
+    }
+    public AgeDistributionAnalyzer()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Age", "The value which represents the age of a solution."));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored."));
+      Parameters.Add(new FixedValueParameter<StringValue>("HistogramName", "The name of the histogram that gets injected in to the results collection.", new StringValue("Age Distribution")));
+      Parameters.Add(new FixedValueParameter<BoolValue>("StoreHistory", "True if the history should be stored in addition to the current distribution", new BoolValue(false)));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "Optional: A value indicating the current iteration."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "Unused", new IntValue(-1)));
+
+      AgeParameter.Hidden = true;
+      ResultsParameter.Hidden = true;
+      IterationsParameter.Hidden = true;
+      MaximumIterationsParameter.Hidden = true;
+    }
+
+    public override IOperation Apply() {
+      DataTable ageDistribution = null;
+      ResultCollection results = ResultsParameter.ActualValue;
+      string description = "Shows the age distributions in the current population.";
+      if (results.ContainsKey(HistogramName)) {
+        ageDistribution = results[HistogramName].Value as DataTable;
+      } else {
+        ageDistribution = new DataTable("Population Age Distribution", description);
+        ageDistribution.VisualProperties.XAxisTitle = AgeParameter.ActualName;
+        ageDistribution.VisualProperties.YAxisTitle = "Frequency";
+        results.Add(new Result(HistogramName, description, ageDistribution));
+      }
+      DataRow row;
+      if (!ageDistribution.Rows.TryGetValue("AgeDistribution", out row)) {
+        row = new DataRow("AgeDistribution");
+        row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
+        ageDistribution.Rows.Add(row);
+      }
+      var ages = AgeParameter.ActualValue;
+      row.Values.Replace(ages.Select(x => (double)x.Value));
+
+      if (StoreHistory) {
+        string historyResultName = HistogramName + " History";
+        DataTableHistory adHistory = null;
+        if (results.ContainsKey(historyResultName)) {
+          adHistory = results[historyResultName].Value as DataTableHistory;
+        } else {
+          adHistory = new DataTableHistory();
+          results.Add(new Result(historyResultName, adHistory));
+        }
+        DataTable table = (DataTable)ageDistribution.Clone();
+        IntValue iteration = IterationsParameter.ActualValue;
+        if (iteration != null) {
+          string iterationName = IterationsParameter.ActualName;
+          if (iterationName.EndsWith("s")) iterationName = iterationName.Remove(iterationName.Length - 1);
+          string appendix = " at " + iterationName + " " + iteration.Value.ToString();
+          table.Name += appendix;
+          table.Rows["AgeDistribution"].VisualProperties.DisplayName += appendix;
+        }
+        adHistory.Add(table);
+      }
+      return base.Apply();
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeAnalyzer.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeAnalyzer.cs	(revision 12083)
@@ -0,0 +1,140 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("OldestAverageYoungestAgeAnalyzer", "An operator which calculates the current oldest, average and youngest age in the scope tree.")]
+  [StorableClass]
+  public sealed class OldestAverageYoungestAgeAnalyzer : AlgorithmOperator, IAnalyzer {
+    #region Parameter properties
+    public IScopeTreeLookupParameter<IntValue> AgeParameter {
+      get { return (IScopeTreeLookupParameter<IntValue>)Parameters["Age"]; }
+    }
+    public IValueLookupParameter<IntValue> CurrentOldestAgeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["CurrentOldestAge"]; }
+    }
+    public IValueLookupParameter<IntValue> CurrentAverageAgeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["CurrentAverageAge"]; }
+    }
+    public IValueLookupParameter<IntValue> CurrentYoungestAgeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["CurrentYoungestAge"]; }
+    }
+    public IValueLookupParameter<DataTable> AgesParameter {
+      get { return (IValueLookupParameter<DataTable>)Parameters["Ages"]; }
+    }
+    public ValueLookupParameter<ResultCollection> ResultsParameter {
+      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+    #endregion
+
+    #region Properties
+    public bool EnabledByDefault {
+      get { return true; }
+    }
+    private OldestAverageYoungestAgeCalculator OldestAverageYoungestAgeCalculator {
+      get { return (OldestAverageYoungestAgeCalculator)OperatorGraph.InitialOperator; }
+    }
+    #endregion
+
+    #region Storing & Cloning
+    [StorableConstructor]
+    private OldestAverageYoungestAgeAnalyzer(bool deserializing) : base(deserializing) { }
+    private OldestAverageYoungestAgeAnalyzer(OldestAverageYoungestAgeAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+      Initialize();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new OldestAverageYoungestAgeAnalyzer(this, cloner);
+    }
+    #endregion
+    public OldestAverageYoungestAgeAnalyzer()
+      : base() {
+      #region Create parameters
+      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Age", "The value which represents the age of a solution."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("CurrentOldestAge", "The oldest age value found in the current population."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("CurrentAverageAge", "The average age value of all solutions in the current population."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("CurrentYoungestAge", "The youngest age value found in the current population."));
+      Parameters.Add(new ValueLookupParameter<DataTable>("Ages", "The data table to store the current oldest, current average, current youngest age value."));
+      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored."));
+
+      CurrentOldestAgeParameter.Hidden = true;
+      CurrentAverageAgeParameter.Hidden = true;
+      CurrentYoungestAgeParameter.Hidden = true;
+      AgesParameter.Hidden = true;
+      #endregion
+
+      #region Create operators
+      var oldestAverageYoungestAgeCalculator = new OldestAverageYoungestAgeCalculator();
+      var dataTableValuesCollector = new DataTableValuesCollector();
+      var resultsCollector = new ResultsCollector();
+
+      oldestAverageYoungestAgeCalculator.AverageAgeParameter.ActualName = CurrentAverageAgeParameter.Name;
+      oldestAverageYoungestAgeCalculator.OldestAgeParameter.ActualName = CurrentOldestAgeParameter.Name;
+      oldestAverageYoungestAgeCalculator.AgeParameter.ActualName = AgeParameter.Name;
+      oldestAverageYoungestAgeCalculator.AgeParameter.Depth = AgeParameter.Depth;
+      oldestAverageYoungestAgeCalculator.YoungestAgeParameter.ActualName = CurrentYoungestAgeParameter.Name;
+
+      dataTableValuesCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentOldestAge", null, CurrentOldestAgeParameter.Name));
+      dataTableValuesCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentAverageAge", null, CurrentAverageAgeParameter.Name));
+      dataTableValuesCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentYoungestAge", null, CurrentYoungestAgeParameter.Name));
+      dataTableValuesCollector.DataTableParameter.ActualName = AgesParameter.Name;
+
+      //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentOldestAge", null, CurrentOldestAgeParameter.Name));
+      //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentAverageAge", null, CurrentAverageAgeParameter.Name));
+      //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentYoungestAge", null, CurrentYoungestAgeParameter.Name));
+      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(AgesParameter.Name));
+      resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
+      #endregion
+
+      #region Create operator graph
+      OperatorGraph.InitialOperator = oldestAverageYoungestAgeCalculator;
+      oldestAverageYoungestAgeCalculator.Successor = dataTableValuesCollector;
+      dataTableValuesCollector.Successor = resultsCollector;
+      resultsCollector.Successor = null;
+      #endregion
+
+      Initialize();
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      Initialize();
+    }
+
+    private void Initialize() {
+      AgeParameter.DepthChanged += new EventHandler(AgeParameter_DepthChanged);
+    }
+
+    private void AgeParameter_DepthChanged(object sender, EventArgs e) {
+      OldestAverageYoungestAgeCalculator.AgeParameter.Depth = AgeParameter.Depth;
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeCalculator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeCalculator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeCalculator.cs	(revision 12083)
@@ -0,0 +1,91 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("OldestAverageYoungestAgeCalculator", "An operator which calculates the oldest, average and youngest age of solutions in the scope tree.")]
+  [StorableClass]
+  public class OldestAverageYoungestAgeCalculator : SingleSuccessorOperator {
+    public IScopeTreeLookupParameter<IntValue> AgeParameter {
+      get { return (IScopeTreeLookupParameter<IntValue>)Parameters["Age"]; }
+    }
+    public IValueLookupParameter<IntValue> OldestAgeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["OldestAge"]; }
+    }
+    public IValueLookupParameter<IntValue> AverageAgeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["AverageAge"]; }
+    }
+    public IValueLookupParameter<IntValue> YoungestAgeParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["YoungestAge"]; }
+    }
+
+    #region Storing & Cloning
+    [StorableConstructor]
+    private OldestAverageYoungestAgeCalculator(bool deserializing) : base(deserializing) { }
+    private OldestAverageYoungestAgeCalculator(OldestAverageYoungestAgeCalculator original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new OldestAverageYoungestAgeCalculator(this, cloner);
+    }
+    #endregion
+
+    public OldestAverageYoungestAgeCalculator()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Age", "The value contained in the scope tree which represents the solution age."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("OldestAge", "The age value of the oldest solution."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("AverageAge", "The average age of all solutions."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("YoungestAge", "The age value of the youngest solution."));
+
+      OldestAgeParameter.Hidden = true;
+      AverageAgeParameter.Hidden = true;
+      YoungestAgeParameter.Hidden = true;
+    }
+
+    public override IOperation Apply() {
+      var ages = AgeParameter.ActualValue;
+
+      if (ages.Length > 0) {
+        int min = int.MaxValue, max = int.MinValue, sum = 0;
+        for (int i = 0; i < ages.Length; i++) {
+          if (ages[i].Value < min) min = ages[i].Value;
+          if (ages[i].Value > max) max = ages[i].Value;
+          sum += ages[i].Value;
+        }
+
+        var oldest = OldestAgeParameter.ActualValue;
+        if (oldest == null) OldestAgeParameter.ActualValue = new IntValue(max);
+        else oldest.Value = max;
+        var average = AverageAgeParameter.ActualValue;
+        if (average == null) AverageAgeParameter.ActualValue = new IntValue(sum / ages.Length);
+        else average.Value = sum / ages.Length;
+        var youngest = YoungestAgeParameter.ActualValue;
+        if (youngest == null) YoungestAgeParameter.ActualValue = new IntValue(min);
+        else youngest.Value = min;
+      }
+      return base.Apply();
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersEmigrator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersEmigrator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersEmigrator.cs	(revision 12083)
@@ -0,0 +1,102 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("EldersEmigrator", "Moves Individuals which are too old for its current layer up to the next layer.")]
+  [StorableClass]
+  public sealed class EldersEmigrator : AlgorithmOperator {
+
+    public IValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+
+    [StorableConstructor]
+    private EldersEmigrator(bool deserializing)
+      : base(deserializing) { }
+    private EldersEmigrator(EldersEmigrator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EldersEmigrator(this, cloner);
+    }
+    public EldersEmigrator()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<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."));
+
+      var selectorProsessor = new UniformSubScopesProcessor();
+      var eldersSelector = new EldersSelector();
+      var shiftToRightMigrator = new ShiftToRightMigrator();
+      var mergingProsessor = new LayerUniformSubScopesProcessor();
+      var mergingReducer = new MergingReducer();
+      var subScopesCounter = new SubScopesCounter();
+      // TODO: if expression calculator supports int, use expression calculator
+      var countCalculator = new MergingReducerCalculator() { Name = "LayerPopulationSize = Min(LayerPopulationSize, PopulationSize)" };
+      //var countCalculator = new ExpressionCalculator() { Name = "NumSubScopes = Min(NumSubScopes, PopulationSize)" };
+      var bestSelector = new BestSelector();
+      var rightReducer = new RightReducer();
+
+
+      OperatorGraph.InitialOperator = selectorProsessor;
+
+      selectorProsessor.Operator = eldersSelector;
+      selectorProsessor.Successor = shiftToRightMigrator;
+
+      eldersSelector.CopySelected = new BoolValue(false);
+      eldersSelector.Successor = null;
+
+      shiftToRightMigrator.Successor = mergingProsessor;
+
+      mergingProsessor.Operator = mergingReducer;
+      mergingProsessor.Successor = null;
+
+      mergingReducer.Successor = subScopesCounter;
+
+      subScopesCounter.ValueParameter.ActualName = "LayerPopulationSize";
+      subScopesCounter.AccumulateParameter.Value = new BoolValue(false);
+      subScopesCounter.Successor = countCalculator;
+
+      //countCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
+      //countCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumSubScopes"));
+      //countCalculator.ExpressionParameter.Value = new StringValue("NumSubScopes PopulationSize NumSubScopes PopulationSize < if");
+      //countCalculator.ExpressionResultParameter.ActualName = "NumSubScopes";
+      countCalculator.Successor = bestSelector;
+
+      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "LayerPopulationSize";
+      bestSelector.QualityParameter.ActualName = QualityParameter.Name;
+      bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestSelector.CopySelected = new BoolValue(false);
+      bestSelector.Successor = rightReducer;
+
+      rightReducer.Successor = null;
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersSelector.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersSelector.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersSelector.cs	(revision 12083)
@@ -0,0 +1,86 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.Algorithms.ALPS {
+
+  [Item("EldersSelector", "Select all individuals which are to old for their current layer.")]
+  [StorableClass]
+  public sealed class EldersSelector : SingleObjectiveSelector {
+
+    private ILookupParameter<IntArray> AgeLimitsParameter {
+      get { return (ILookupParameter<IntArray>)Parameters["AgeLimits"]; }
+    }
+    private ILookupParameter<IntValue> NumberOfLayersParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["NumberOfLayers"]; }
+    }
+    private ILookupParameter<IntValue> LayerParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Layer"]; }
+    }
+
+    [StorableConstructor]
+    private EldersSelector(bool deserializing)
+      : base(deserializing) { }
+    private EldersSelector(EldersSelector original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EldersSelector(this, cloner);
+    }
+    public EldersSelector()
+      : base() {
+      Parameters.Add(new LookupParameter<IntArray>("AgeLimits"));
+      Parameters.Add(new LookupParameter<IntValue>("NumberOfLayers"));
+      Parameters.Add(new LookupParameter<IntValue>("Layer"));
+    }
+
+    protected override IScope[] Select(List<IScope> scopes) {
+      var ageLimits = AgeLimitsParameter.ActualValue;
+      int numberOfLayers = NumberOfLayersParameter.ActualValue.Value;
+      int layer = LayerParameter.ActualValue.Value;
+
+      if (layer >= numberOfLayers - 1) // is max layer?
+        return new IScope[0];
+
+      int limit = ageLimits[layer];
+      var eldersQuery =
+        from scope in scopes
+        let age = ((IntValue)scope.Variables["Age"].Value).Value
+        where age > limit
+        select scope;
+
+      var elders = eldersQuery.ToArray();
+
+      if (!CopySelected.Value)
+        foreach (var elder in elders)
+          scopes.Remove(elder);
+
+      return elders;
+    }
+  }
+}
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 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj	(revision 12083)
@@ -0,0 +1,202 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{59F354CB-FE13-4253-AED2-AD86372BEC27}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Algorithms.ALPS</RootNamespace>
+    <AssemblyName>HeuristicLab.Algorithms.ALPS-3.3</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\..\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>..\..\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\..\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>..\..\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Drawing" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Analyzers\OldestAverageYoungestAgeAnalyzer.cs" />
+    <Compile Include="Analyzers\AgeDistributionAnalyzer.cs" />
+    <Compile Include="AgingScheme.cs" />
+    <Compile Include="AlpsGeneticAlgorithm.cs" />
+    <Compile Include="AlpsGeneticAlgorithmMainLoop.cs" />
+    <Compile Include="Analyzers\OldestAverageYoungestAgeCalculator.cs" />
+    <Compile Include="EldersEmigrator.cs" />
+    <Compile Include="EldersSelector.cs" />
+    <Compile Include="LayerCreator.cs" />
+    <Compile Include="LayerSorter.cs" />
+    <Compile Include="LayerUniformSubScopesProcessor.cs" />
+    <Compile Include="LayerUpdator.cs" />
+    <Compile Include="MatingPoolCreator.cs" />
+    <Compile Include="NumberOfSelectedSubScopesCalculator.cs" />
+    <Compile Include="OpenNewLayerCalculator.cs" />
+    <Compile Include="MergingReducerCalculator.cs" />
+    <Compile Include="Plugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ShiftToRightMigrator.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="Plugin.cs.frame" />
+    <None Include="Properties\AssemblyInfo.cs.frame" />
+  </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>
+      <Name>HeuristicLab.Analysis-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
+      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
+      <Name>HeuristicLab.Collections-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
+      <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project>
+      <Name>HeuristicLab.Common.Resources-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
+      <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>
+      <Name>HeuristicLab.Common-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
+      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
+      <Name>HeuristicLab.Core-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
+      <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project>
+      <Name>HeuristicLab.Data-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
+      <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project>
+      <Name>HeuristicLab.Operators-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
+      <Project>{25087811-f74c-4128-bc86-8324271da13e}</Project>
+      <Name>HeuristicLab.Optimization.Operators-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
+      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
+      <Name>HeuristicLab.Optimization-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
+      <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project>
+      <Name>HeuristicLab.Parameters-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
+      <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project>
+      <Name>HeuristicLab.Persistence-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{f4539fb6-4708-40c9-be64-0a1390aea197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Selection\3.3\HeuristicLab.Selection-3.3.csproj">
+      <Project>{2c36cd4f-e5f5-43a4-801a-201ea895fe17}</Project>
+      <Name>HeuristicLab.Selection-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd</PreBuildEvent>
+  </PropertyGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerCreator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerCreator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerCreator.cs	(revision 12083)
@@ -0,0 +1,91 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("LayerCreator", "An operator which creates a new layer by cloning the oldest one and setting the variables accordingly.")]
+  [StorableClass]
+  public sealed class LayerCreator : SingleSuccessorOperator {
+
+    /*private static readonly ISet<string> SavedVariables = new HashSet<string>{
+      "LocalRandom", "Layer", "LayerEvaluatedSolutions", "NumSubScopes"
+    };*/
+
+    private ILookupParameter<IntValue> OpenLayersParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["OpenLayers"]; }
+    }
+
+    [StorableConstructor]
+    private LayerCreator(bool deserializing) : base(deserializing) { }
+
+    private LayerCreator(LayerCreator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public LayerCreator()
+      : base() {
+      Parameters.Add(new LookupParameter<IntValue>("OpenLayers"));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LayerCreator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var scopes = ExecutionContext.Scope.SubScopes;
+      if (scopes.Count < 1)
+        throw new ArgumentException("At least one sub-scope must exist.");
+
+      var lastSubScope = scopes.Last();
+      var clone = (IScope)lastSubScope.Clone(new Cloner());
+
+      int number;
+      if (int.TryParse(clone.Name, out number))
+        clone.Name = (number + 1).ToString();
+
+      scopes.Add(clone);
+
+      clone.Variables["Layer"].Value = new IntValue(OpenLayersParameter.ActualValue.Value);
+      foreach (var solution in clone.SubScopes)
+        ((IntValue)solution.Variables["Age"].Value).Value -= 1; // Decrement age, because MainOperator is goint to increment it
+      //foreach (var variable in clone.Variables.Where(v => !SavedVariables.Contains(v.Name)))
+      //  variable.Value = null;
+
+      //HACK: delete old values from quality table
+      /*var rows = ((DataTable)clone.Variables["Qualities"].Value).Rows;
+      var last = rows.Last();
+      rows.Clear();
+      rows.Add(last);*/
+
+      return base.Apply();
+    }
+
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerSorter.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerSorter.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerSorter.cs	(revision 12083)
@@ -0,0 +1,64 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("LayerSorter", "")]
+  [StorableClass]
+  public class LayerSorter : SingleSuccessorOperator {
+    private IScopeTreeLookupParameter<IntValue> LayerParameter {
+      get { return (IScopeTreeLookupParameter<IntValue>)Parameters["Layer"]; }
+    }
+
+    [StorableConstructor]
+    private LayerSorter(bool deserializing)
+      : base(deserializing) { }
+    private LayerSorter(LayerSorter original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LayerSorter(this, cloner);
+    }
+    public LayerSorter()
+      : base() {
+      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Layer"));
+    }
+
+    public override IOperation Apply() {
+      var layers = ExecutionContext.Scope.SubScopes;
+      layers.Sort(SortLayers);
+
+      return base.Apply();
+    }
+
+    private int SortLayers(IScope x, IScope y) {
+      var lx = (IntValue)x.Variables["Layer"].Value;
+      var ly = (IntValue)y.Variables["Layer"].Value;
+
+      return lx.Value.CompareTo(ly.Value);
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUniformSubScopesProcessor.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUniformSubScopesProcessor.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUniformSubScopesProcessor.cs	(revision 12083)
@@ -0,0 +1,120 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("LayerUniformSubScopesProcessor", "")]
+  [StorableClass]
+  public class LayerUniformSubScopesProcessor : SingleSuccessorOperator {
+    private OperatorParameter OperatorParameter {
+      get { return (OperatorParameter)Parameters["Operator"]; }
+    }
+    public ValueLookupParameter<BoolValue> ParallelParameter {
+      get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
+    }
+
+    private ILookupParameter<IntArray> PopulationSizeParameter {
+      get { return (ILookupParameter<IntArray>)Parameters["PopulationSize"]; }
+    }
+
+    public IOperator Operator {
+      get { return OperatorParameter.Value; }
+      set { OperatorParameter.Value = value; }
+    }
+    public BoolValue Parallel {
+      get { return ParallelParameter.Value; }
+      set { ParallelParameter.Value = value; }
+    }
+
+    [StorableConstructor]
+    private LayerUniformSubScopesProcessor(bool deserializing) : base(deserializing) { }
+    private LayerUniformSubScopesProcessor(LayerUniformSubScopesProcessor original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public LayerUniformSubScopesProcessor()
+      : base() {
+      Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(false)));
+
+      Parameters.Add(new LookupParameter<IntArray>("PopulationSize"));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LayerUniformSubScopesProcessor(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var next = new OperationCollection(Successor != null ? ExecutionContext.CreateOperation(Successor) : null);
+      if (Operator != null) {
+        var scopes = ExecutionContext.Scope.SubScopes;
+        var inner = new OperationCollection() {
+          Parallel = Parallel == null ? false : Parallel.Value
+        };
+        for (int i = 0; i < scopes.Count; i++) {
+          var layerParameters = new LayerIntermediateParameter {
+            new ValueParameter<IntValue>(PopulationSizeParameter.ActualName, new IntValue(PopulationSizeParameter.ActualValue[Math.Min(i, PopulationSizeParameter.ActualValue.Length - 1)]))
+          };
+          var immediateContext = new ExecutionContext(ExecutionContext.Parent, layerParameters, scopes[i]);
+          inner.Add(immediateContext.CreateChildOperation(Operator, scopes[i]));
+        }
+        next.Insert(0, inner);
+      }
+      return next;
+    }
+  }
+
+  [Item("LayerIntermediateParameter", "")]
+  [StorableClass]
+  public class LayerIntermediateParameter : ParameterizedNamedItem, IEnumerable<IParameter> {
+    [StorableConstructor]
+    private LayerIntermediateParameter(bool deserializing) : base(deserializing) { }
+    private LayerIntermediateParameter(LayerIntermediateParameter original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public LayerIntermediateParameter()
+      : base("LayerIntermediateParameter") {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LayerIntermediateParameter(this, cloner);
+    }
+
+    public void Add(IParameter parameter) {
+      Parameters.Add(parameter);
+    }
+
+    public IEnumerator<IParameter> GetEnumerator() {
+      return Parameters.GetEnumerator();
+    }
+    IEnumerator IEnumerable.GetEnumerator() {
+      return GetEnumerator();
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs	(revision 12083)
@@ -0,0 +1,186 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Selection;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("LayerUpdator", "Operator which manages the reseeding and creation of layers.")]
+  [StorableClass]
+  public class LayerUpdator : AlgorithmOperator {
+
+    public SolutionsCreator SolutionsCreator {
+      get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); }
+    }
+
+    [StorableConstructor]
+    private LayerUpdator(bool deserializing)
+      : base(deserializing) { }
+    private LayerUpdator(LayerUpdator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new LayerUpdator(this, cloner);
+    }
+    public LayerUpdator(IOperator mainOperator)
+      : base() {
+      var incGenSlr = new IntCounter() { Name = "Incr. GenerationsSinceLastRefresh" };
+      var genSlrEqAgeGap = new Comparator() { Name = "GenerationsSinceLastRefresh >= AgeGap" };
+      var updateLayersBranch = new ConditionalBranch() { Name = "UpdateLayers?" };
+      // TODO: if expression calculator supports array indexing, use expression calculator
+      //var openNewLayerCalculator = new ExpressionCalculator();
+      var openNewLayerCalculator = new OpenNewLayerCalculator();
+      var openNewLayerBranch = new ConditionalBranch() { Name = "OpenNewLayer?" };
+      //var layerCloner = new LastSubScopeCloner() { Name = "Copy Lower Layer" };
+      var layerCreator = new LayerCreator() { Name = "Create new Layer" };
+      var incrOpenLayers = new IntCounter() { Name = "Incr. OpenLayers" };
+      var newLayerResultsCollector = new ResultsCollector() { Name = "Collect new Layer Results" };
+      var newLayerSelector = new RightSelector();
+      var newLayerProsessor = new SubScopesProcessor();
+      var newLayerLayerProcessor = new LayerUniformSubScopesProcessor();
+      var newLayerReducer = new MergingReducer();
+      var layerInitializer = new Assigner() { Name = "Init Layer" };
+      var correctAgeProcessor = new UniformSubScopesProcessor() { Name = "Hack: Decrement Age" };
+      var correctAgeDecrementor = new IntCounter() { Name = "Age = Age - 1" };
+      var incrEvaluatedSolutionsForNewLayer = new SubScopesCounter() { Name = "Update EvaluatedSolutions" };
+      var newResultCollectionAssigner = new Assigner() { Name = "Empty Results" };
+      var regenerateLayerZeroSelector = new LeftSelector();
+      var regenerateLayerZeroProsessor = new SubScopesProcessor();
+      var regenerateLayerZeroLayerProsessor = new LayerUniformSubScopesProcessor();
+      var regenerateLayerZeroReducer = new MergingReducer();
+      var layerSorter = new LayerSorter();
+      var subScopesRemover = new SubScopesRemover();
+      var solutionsCreator = new SolutionsCreator();
+      var initializeAgeProsessor = new UniformSubScopesProcessor();
+      var initializeAge = new VariableCreator() { Name = "Initialize Age" };
+      var incrEvaluatedSolutionsAfterReseeding = new SubScopesCounter() { Name = "Update EvaluatedSolutions" };
+      var resetGenSlr = new Assigner() { Name = "Reset GenerationsSinceLastRefresh" };
+
+      OperatorGraph.InitialOperator = incGenSlr;
+
+      incGenSlr.ValueParameter.ActualName = "GenerationsSinceLastRefresh";
+      incGenSlr.Increment = new IntValue(1);
+      incGenSlr.Successor = genSlrEqAgeGap;
+
+      genSlrEqAgeGap.LeftSideParameter.ActualName = "GenerationsSinceLastRefresh";
+      genSlrEqAgeGap.RightSideParameter.ActualName = "AgeGap";
+      genSlrEqAgeGap.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
+      genSlrEqAgeGap.ResultParameter.ActualName = "UpdateLayers";
+      genSlrEqAgeGap.Successor = updateLayersBranch;
+
+      updateLayersBranch.ConditionParameter.ActualName = "UpdateLayers";
+      updateLayersBranch.TrueBranch = openNewLayerCalculator;
+
+      //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
+      //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("AgeGap"));
+      //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
+      //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfLayers"));
+      //openNewLayerCalculator.ExpressionParameter.Value = new StringValue("Generations AgeLimits [] OpenedLayers 1 - 1 + = false OpenLayers NumberOfLayers < if");
+      //openNewLayerCalculator.ExpressionResultParameter.ActualName = "OpenNewLayer";
+      openNewLayerCalculator.Successor = openNewLayerBranch;
+
+      openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer";
+      openNewLayerBranch.TrueBranch = layerCreator;
+      openNewLayerBranch.Successor = regenerateLayerZeroSelector;
+
+      layerCreator.Successor = newLayerSelector;
+
+      newLayerSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
+      newLayerSelector.CopySelected = new BoolValue(false);
+      newLayerSelector.Successor = newLayerProsessor;
+
+      newLayerProsessor.Operators.Add(new EmptyOperator());
+      newLayerProsessor.Operators.Add(newLayerLayerProcessor);
+      newLayerProsessor.Successor = newLayerReducer;
+
+      newLayerLayerProcessor.Operator = incrEvaluatedSolutionsForNewLayer;
+
+      newLayerReducer.Successor = incrOpenLayers;
+
+      layerInitializer.LeftSideParameter.ActualName = "Layer";
+      layerInitializer.RightSideParameter.ActualName = "OpenLayers";
+      layerInitializer.Successor = correctAgeProcessor;
+
+      correctAgeProcessor.Operator = correctAgeDecrementor;
+      correctAgeProcessor.Successor = incrEvaluatedSolutionsForNewLayer;
+
+      correctAgeDecrementor.Increment = new IntValue(-1);
+      correctAgeDecrementor.ValueParameter.ActualName = "Age";
+
+      incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = "EvaluatedSolutions";
+      incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true);
+      //incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner;
+      incrEvaluatedSolutionsForNewLayer.Successor = mainOperator;
+
+      newResultCollectionAssigner.LeftSideParameter.ActualName = "LayerResults";
+      newResultCollectionAssigner.RightSideParameter.Value = new ResultCollection();
+      newResultCollectionAssigner.Successor = mainOperator;
+      // TODO mainOperator increment age
+
+      incrOpenLayers.ValueParameter.ActualName = "OpenLayers";
+      incrOpenLayers.Increment = new IntValue(1);
+      incrOpenLayers.Successor = newLayerResultsCollector;
+
+      newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "LayerResults"));
+      newLayerResultsCollector.CopyValue = new BoolValue(false);
+      newLayerResultsCollector.Successor = null;
+
+      regenerateLayerZeroSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
+      regenerateLayerZeroSelector.CopySelected = new BoolValue(false);
+      regenerateLayerZeroSelector.Successor = regenerateLayerZeroProsessor;
+
+      regenerateLayerZeroProsessor.Operators.Add(new EmptyOperator());
+      regenerateLayerZeroProsessor.Operators.Add(regenerateLayerZeroLayerProsessor);
+      regenerateLayerZeroProsessor.Successor = regenerateLayerZeroReducer;
+
+      regenerateLayerZeroLayerProsessor.Operator = subScopesRemover;
+
+      regenerateLayerZeroReducer.Successor = layerSorter;
+
+      layerSorter.Successor = resetGenSlr;
+
+      subScopesRemover.Successor = solutionsCreator;
+
+      solutionsCreator.Successor = initializeAgeProsessor;
+
+      initializeAgeProsessor.Operator = initializeAge;
+      initializeAgeProsessor.Successor = incrEvaluatedSolutionsAfterReseeding;
+
+      initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(0)));
+      initializeAge.Successor = null;
+
+      incrEvaluatedSolutionsAfterReseeding.ValueParameter.ActualName = "EvaluatedSolutions";
+      incrEvaluatedSolutionsAfterReseeding.AccumulateParameter.Value = new BoolValue(true);
+      incrEvaluatedSolutionsAfterReseeding.Successor = null;
+
+      resetGenSlr.LeftSideParameter.ActualName = "GenerationsSinceLastRefresh";
+      resetGenSlr.RightSideParameter.Value = new IntValue(0);
+      resetGenSlr.Successor = null;
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs	(revision 12083)
@@ -0,0 +1,76 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+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 {
+
+    public ILookupParameter<IntValue> MatingPoolRangeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["MatingPoolRange"]; }
+    }
+    public ILookupParameter<PercentValue> MatingPoolSelectionPercentageParameter {
+      get { return (ILookupParameter<PercentValue>)Parameters["MatingPoolSelectionPercentage"]; }
+    }
+
+    [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() {
+      Parameters.Add(new LookupParameter<IntValue>("MatingPoolRange"));
+      Parameters.Add(new LookupParameter<PercentValue>("MatingPoolSelectionPercentage"));
+    }
+
+    public override IOperation Apply() {
+      var layers = ExecutionContext.Scope.SubScopes;
+      int range = MatingPoolRangeParameter.ActualValue.Value;
+      double percentage = MatingPoolSelectionPercentageParameter.ActualValue.Value;
+
+      for (int layer = layers.Count - 1; layer > 0; layer--) {
+        var layerScope = layers[layer];
+        for (int n = 1; (n <= range) && (layer - n >= 0); n++) {
+          var prevLayerScope = layers[layer - n];
+          var individuals = prevLayerScope.SubScopes;
+          foreach (var individual in individuals.Take((int)(individuals.Count * percentage))) {
+            layerScope.SubScopes.Add((IScope)individual.Clone(new Cloner()));
+          }
+        }
+      }
+
+      return base.Apply();
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MergingReducerCalculator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MergingReducerCalculator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MergingReducerCalculator.cs	(revision 12083)
@@ -0,0 +1,64 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.ALPS {
+  [Item("MergingReducerCalculator", "")]
+  [StorableClass]
+  public class MergingReducerCalculator : SingleSuccessorOperator {
+    private ILookupParameter<IntValue> PopulationSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; }
+    }
+    private ILookupParameter<IntValue> LayerPopulationSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["LayerPopulationSize"]; }
+    }
+
+    [StorableConstructor]
+    private MergingReducerCalculator(bool deserializing)
+      : base(deserializing) { }
+    private MergingReducerCalculator(MergingReducerCalculator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MergingReducerCalculator(this, cloner);
+    }
+    public MergingReducerCalculator()
+      : base() {
+      Parameters.Add(new LookupParameter<IntValue>("PopulationSize"));
+      Parameters.Add(new LookupParameter<IntValue>("LayerPopulationSize"));
+    }
+
+    public override IOperation Apply() {
+      int populationSize = PopulationSizeParameter.ActualValue.Value;
+      int numSubScopes = LayerPopulationSizeParameter.ActualValue.Value;
+
+      LayerPopulationSizeParameter.ActualValue.Value = Math.Min(populationSize, numSubScopes);
+
+      return base.Apply();
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/NumberOfSelectedSubScopesCalculator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/NumberOfSelectedSubScopesCalculator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/NumberOfSelectedSubScopesCalculator.cs	(revision 12083)
@@ -0,0 +1,69 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("NumberOfSelectedSubScopesCalculator", "")]
+  [StorableClass]
+  public class NumberOfSelectedSubScopesCalculator : SingleSuccessorOperator {
+    private ILookupParameter<IntValue> PopulationSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; }
+    }
+    private ILookupParameter<IntValue> ElitesParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Elites"]; }
+    }
+    private ILookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
+    }
+
+    [StorableConstructor]
+    private NumberOfSelectedSubScopesCalculator(bool deserializing)
+      : base(deserializing) { }
+    private NumberOfSelectedSubScopesCalculator(NumberOfSelectedSubScopesCalculator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new NumberOfSelectedSubScopesCalculator(this, cloner);
+    }
+    public NumberOfSelectedSubScopesCalculator()
+      : base() {
+      Parameters.Add(new LookupParameter<IntValue>("PopulationSize"));
+      Parameters.Add(new LookupParameter<IntValue>("Elites"));
+      Parameters.Add(new LookupParameter<IntValue>("NumberOfSelectedSubScopes"));
+    }
+
+    public override IOperation Apply() {
+      var populationSize = PopulationSizeParameter.ActualValue;
+      var elites = ElitesParameter.ActualValue;
+
+      int selectedSubScopes = 2 * (populationSize.Value - elites.Value);
+
+      NumberOfSelectedSubScopesParameter.ActualValue = new IntValue(selectedSubScopes);
+
+      return base.Apply();
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/OpenNewLayerCalculator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/OpenNewLayerCalculator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/OpenNewLayerCalculator.cs	(revision 12083)
@@ -0,0 +1,80 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.ALPS {
+  [Item("OpenNewLayerCalculator", "")]
+  [StorableClass]
+  public class OpenNewLayerCalculator : SingleSuccessorOperator {
+
+    private ILookupParameter<IntArray> AgeLimitsParameter {
+      get { return (ILookupParameter<IntArray>)Parameters["AgeLimits"]; }
+    }
+    private ILookupParameter<IntValue> GenerationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Generations"]; }
+    }
+    private ILookupParameter<IntValue> NumberOfLayersParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["NumberOfLayers"]; }
+    }
+    private ILookupParameter<IntValue> OpenLayersParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["OpenLayers"]; }
+    }
+    private ILookupParameter<BoolValue> OpenNewLayerParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters["OpenNewLayer"]; }
+    }
+
+    [StorableConstructor]
+    private OpenNewLayerCalculator(bool deserializing)
+      : base(deserializing) { }
+    private OpenNewLayerCalculator(OpenNewLayerCalculator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new OpenNewLayerCalculator(this, cloner);
+    }
+    public OpenNewLayerCalculator()
+      : base() {
+      Parameters.Add(new LookupParameter<IntArray>("AgeLimits"));
+      Parameters.Add(new LookupParameter<IntValue>("Generations"));
+      Parameters.Add(new LookupParameter<IntValue>("NumberOfLayers"));
+      Parameters.Add(new LookupParameter<IntValue>("OpenLayers"));
+      Parameters.Add(new LookupParameter<BoolValue>("OpenNewLayer"));
+    }
+
+    public override IOperation Apply() {
+      var ageLimits = AgeLimitsParameter.ActualValue;
+      int generations = GenerationsParameter.ActualValue.Value;
+      int numberOfLayers = NumberOfLayersParameter.ActualValue.Value;
+      int openLayers = OpenLayersParameter.ActualValue.Value;
+      var openNewLayer = OpenNewLayerParameter;
+
+      openNewLayer.ActualValue = new BoolValue(openLayers < numberOfLayers && generations >= ageLimits[openLayers - 1]);
+
+      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 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Plugin.cs.frame	(revision 12083)
@@ -0,0 +1,45 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  /// <summary>
+  /// Plugin class for HeuristicLab.Algorithms.ALPS plugin.
+  /// </summary>
+  [Plugin("HeuristicLab.Algorithms.ALPS", "Provides the Age-Layered Population Structure (ALPS) as described in Gregory S. Hornby. 2006. ALPS: the age-layered population structure for reducing the problem of premature convergence. In Proceedings of the 8th annual conference on Genetic and evolutionary computation (GECCO '06). 815-822.", "3.3.11.$WCREV$")]
+  [PluginFile("HeuristicLab.Algorithms.ALPS-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
+  [PluginDependency("HeuristicLab.Collections", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
+  [PluginDependency("HeuristicLab.Parameters", "3.3")]
+  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Random", "3.3")]
+  [PluginDependency("HeuristicLab.Selection", "3.3")]
+  [PluginDependency("HeuristicLab.Algorithms.GeneticAlgorithm", "3.3")]
+  public class HeuristicLabAlgorithmsALPSPlugin : PluginBase {
+  }
+}
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Properties/AssemblyInfo.cs.frame	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Properties/AssemblyInfo.cs.frame	(revision 12083)
@@ -0,0 +1,55 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Algorithms.ALPS")]
+[assembly: AssemblyDescription("HeuristicLab ALPS")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("196f5964-865f-42aa-a584-f0d6f47aa5af")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.11.$WCREV$")]
Index: branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/ShiftToRightMigrator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/ShiftToRightMigrator.cs	(revision 12083)
+++ branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/ShiftToRightMigrator.cs	(revision 12083)
@@ -0,0 +1,67 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ALPS {
+  [Item("ShiftToRightMigrator", "Migrates the selected sub scopes by shifting them to the next(right) subscope.")]
+  [StorableClass]
+  public sealed class ShiftToRightMigrator : SingleSuccessorOperator, IMigrator {
+
+    [StorableConstructor]
+    private ShiftToRightMigrator(bool deserializing)
+      : base(deserializing) { }
+    private ShiftToRightMigrator(ShiftToRightMigrator original, Cloner cloner)
+      : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ShiftToRightMigrator(this, cloner);
+    }
+    public ShiftToRightMigrator()
+      : base() {
+    }
+
+    public override IOperation Apply() {
+      var scope = ExecutionContext.Scope;
+      var emigrantsList = new List<IScope>();
+
+      for (int i = 0; i < scope.SubScopes.Count; i++) {
+        var emigrants = scope.SubScopes[i].SubScopes[1];
+        scope.SubScopes[i].SubScopes.Remove(emigrants);
+        emigrantsList.Add(emigrants);
+      }
+
+      // Shift last emigrant to begin of list
+      emigrantsList.Insert(0, emigrantsList.Last());
+      emigrantsList.RemoveAt(emigrantsList.Count - 1);
+
+      for (int i = 0; i < scope.SubScopes.Count; i++)
+        scope.SubScopes[i].SubScopes.Add(emigrantsList[i]);
+
+      return base.Apply();
+    }
+  }
+}
