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 12097)
@@ -53,14 +53,13 @@
       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 maxLayerReached = new Comparator() { Name = "MaxLayersReached = OpenLayers >= NumberOfLayers" };
+      var maxLayerReachedBranch = new ConditionalBranch() { Name = "MaxLayersReached?" };
+      var openNewLayerCalculator = new ExpressionCalculator() { Name = "OpenNewLayer = Generations >= AgeLimits[OpenLayers - 1]" };
       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 newLayerProsessor = new SubScopesProcessor() { Name = "NewLayerProcessor" };
       var newLayerLayerProcessor = new LayerUniformSubScopesProcessor();
       var newLayerReducer = new MergingReducer();
@@ -71,5 +70,5 @@
       var newResultCollectionAssigner = new Assigner() { Name = "Empty Results" };
       var regenerateLayerZeroSelector = new LeftSelector();
-      var regenerateLayerZeroProsessor = new SubScopesProcessor();
+      var regenerateLayerZeroProsessor = new SubScopesProcessor() { Name = "LayerZeroProcessor" };
       var regenerateLayerZeroLayerProsessor = new LayerUniformSubScopesProcessor();
       var regenerateLayerZeroReducer = new MergingReducer();
@@ -95,17 +94,26 @@
 
       updateLayersBranch.ConditionParameter.ActualName = "UpdateLayers";
-      updateLayersBranch.TrueBranch = openNewLayerCalculator;
+      updateLayersBranch.TrueBranch = maxLayerReached;
 
-      //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";
+      maxLayerReached.LeftSideParameter.ActualName = "OpenLayers";
+      maxLayerReached.RightSideParameter.ActualName = "NumberOfLayers";
+      maxLayerReached.ResultParameter.ActualName = "MaxLayerReached";
+      maxLayerReached.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
+      maxLayerReached.Successor = maxLayerReachedBranch;
+
+      maxLayerReachedBranch.ConditionParameter.ActualName = "MaxLayerReached";
+      maxLayerReachedBranch.FalseBranch = openNewLayerCalculator;
+      maxLayerReachedBranch.Successor = regenerateLayerZeroSelector;
+
+      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntArray>("AgeLimits"));
+      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
+      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfLayers"));
+      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
+      openNewLayerCalculator.ExpressionResultParameter.ActualName = "OpenNewLayer";
+      openNewLayerCalculator.ExpressionParameter.Value = new StringValue("Generations 1 + AgeLimits OpenLayers 1 - [] >");
       openNewLayerCalculator.Successor = openNewLayerBranch;
 
       openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer";
       openNewLayerBranch.TrueBranch = layerCreator;
-      openNewLayerBranch.Successor = regenerateLayerZeroSelector;
 
       layerCreator.Successor = newLayerSelector;
@@ -135,5 +143,4 @@
       incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = "EvaluatedSolutions";
       incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true);
-      //incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner;
       incrEvaluatedSolutionsForNewLayer.Successor = mainOperator;
 
