Index: branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/Analyzers/SelectionPressureAnalyzer.cs
===================================================================
--- branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/Analyzers/SelectionPressureAnalyzer.cs	(revision 8385)
+++ branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/Analyzers/SelectionPressureAnalyzer.cs	(revision 8385)
@@ -0,0 +1,97 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.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.RAPGA {
+  /// <summary>
+  /// An operator which analyzes the actual selection pressure.
+  /// </summary>
+  [Item("PopulationSizeAnalyzer", "An operator which analyzes the actual selection pressure.")]
+  [StorableClass]
+  public sealed class SelectionPressureAnalyzer : AlgorithmOperator, IAnalyzer {
+    #region Parameter properties
+    public ILookupParameter<DoubleValue> ActualSelectionPressureParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["ActualSelectionPressure"]; }
+    }
+    public IValueLookupParameter<DataTable> SelectionPressureParameter {
+      get { return (IValueLookupParameter<DataTable>)Parameters["SelectionPressure"]; }
+    }
+    public IValueLookupParameter<VariableCollection> ResultsParameter {
+      get { return (IValueLookupParameter<VariableCollection>)Parameters["Results"]; }
+    }
+    #endregion
+
+    #region Properties
+    public bool EnabledByDefault {
+      get { return true; }
+    }
+    private DataTableValuesCollector DataTableValuesCollector {
+      get { return (DataTableValuesCollector)OperatorGraph.InitialOperator; }
+    }
+    private ResultsCollector ResultsCollector {
+      get { return (ResultsCollector)DataTableValuesCollector.Successor; }
+    }
+    #endregion
+
+    #region Storing & Cloning
+    [StorableConstructor]
+    private SelectionPressureAnalyzer(bool deserializing) : base(deserializing) { }
+    private SelectionPressureAnalyzer(SelectionPressureAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SelectionPressureAnalyzer(this, cloner);
+    }
+    #endregion
+    public SelectionPressureAnalyzer()
+      : base() {
+      #region Create parameters
+      Parameters.Add(new LookupParameter<DoubleValue>("ActualSelectionPressure", "The actual selection pressure."));
+      Parameters.Add(new ValueLookupParameter<DataTable>("SelectionPressure", "The data table to store the values."));
+      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The results collection where the analysis values should be stored."));
+      #endregion
+
+      #region Create operators
+      DataTableValuesCollector dataTableValuesCollector = new DataTableValuesCollector();
+      ResultsCollector resultsCollector = new ResultsCollector();
+
+      dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("ActualSelectionPressure", null, ActualSelectionPressureParameter.Name));
+      dataTableValuesCollector.DataTableParameter.ActualName = SelectionPressureParameter.Name;
+
+      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(SelectionPressureParameter.Name));
+      resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
+      #endregion
+
+      #region Create operator graph
+      OperatorGraph.InitialOperator = dataTableValuesCollector;
+      dataTableValuesCollector.Successor = resultsCollector;
+      resultsCollector.Successor = null;
+      #endregion
+    }
+  }
+}
Index: branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/ExpressionEvaluator.cs
===================================================================
--- branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/ExpressionEvaluator.cs	(revision 8385)
+++ branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/ExpressionEvaluator.cs	(revision 8385)
@@ -0,0 +1,110 @@
+﻿#region License Information
+
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 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.RAPGA {
+  /// <summary>
+  /// An operator that evaluates an expression.
+  /// </summary>
+  [Item("ExpressionEvaluator", "An operator that evaluates an expression.")]
+  [StorableClass]
+  public class ExpressionEvaluator : ValuesCollector {
+    [Storable]
+    public Calculator Calculator { get; set; }
+
+    #region Parameter Properties
+    public IValueLookupParameter<StringValue> ExpressionParameter {
+      get { return (IValueLookupParameter<StringValue>)Parameters["Expression"]; }
+    }
+    public IValueLookupParameter<IItem> ExpressionResultParameter {
+      get { return (IValueLookupParameter<IItem>)Parameters["ExpressionResult"]; }
+    }
+    #endregion
+
+    #region Properties
+    private string Formula {
+      get { return ExpressionParameter.Value.Value; }
+    }
+    private IItem ExpressionResult {
+      set { ExpressionResultParameter.ActualValue = value; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected ExpressionEvaluator(bool deserializing) : base(deserializing) { }
+    protected ExpressionEvaluator(ExpressionEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+      this.Calculator = cloner.Clone(original.Calculator);
+    }
+    public ExpressionEvaluator()
+      : base() {
+      Parameters.Add(new ValueLookupParameter<IItem>("ExpressionResult", "The result of the evaluated expression."));
+      Parameters.Add(new ValueLookupParameter<StringValue>("Expression",
+@"RPN formula for new value in postfix notation.
+
+This can contain the following elements:
+
+literals:
+  numbers, true, false, null and strings in single quotes
+variables (run parameters or results):
+  unquoted or in double quotes if they contain special characters or whitespace
+mathematical functions:
+  +, -, /, ^ (power), log
+predicates:
+  ==, <, >, isnull, not
+stack manipulation:
+  drop swap dup
+string matching:
+  <string> <pattern> ismatch
+string replacing:
+  <string> <pattern> <replacement> rename
+conditionals:
+  <then> <else> <condition> if
+
+If the final value is null, the result variable is removed if it exists."));
+
+      Calculator = new Calculator();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ExpressionEvaluator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      Calculator.Formula = Formula;
+      var variables = new Dictionary<string, IItem>();
+      foreach (var collectedValue in CollectedValues)
+        variables[collectedValue.Name] = collectedValue.ActualValue;
+      ExpressionResult = Calculator.GetValue(variables);
+      return base.Apply();
+    }
+  }
+}
Index: branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/HeuristicLab.Algorithms.RAPGA-3.3.csproj
===================================================================
--- branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/HeuristicLab.Algorithms.RAPGA-3.3.csproj	(revision 8379)
+++ branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/HeuristicLab.Algorithms.RAPGA-3.3.csproj	(revision 8385)
@@ -97,7 +97,9 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Analyzers\SelectionPressureAnalyzer.cs" />
     <Compile Include="Analyzers\OffspringSuccessAnalyzer.cs" />
     <Compile Include="Analyzers\PopulationSizeAnalyzer.cs" />
     <Compile Include="DuplicatesSelector.cs" />
+    <Compile Include="ExpressionEvaluator.cs" />
     <Compile Include="OffspringRestorer.cs" />
     <Compile Include="ProgressiveOffspringPreserver.cs" />
Index: branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs
===================================================================
--- branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs	(revision 8379)
+++ branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs	(revision 8385)
@@ -185,4 +185,6 @@
     [Storable]
     private OffspringSuccessAnalyzer offspringSuccessAnalyzer;
+    [Storable]
+    private SelectionPressureAnalyzer selectionPressureAnalyzer;
     #endregion
 
@@ -196,4 +198,5 @@
       populationSizeAnalyzer = cloner.Clone(original.populationSizeAnalyzer);
       offspringSuccessAnalyzer = cloner.Clone(original.offspringSuccessAnalyzer);
+      selectionPressureAnalyzer = cloner.Clone(original.selectionPressureAnalyzer);
       Initialize();
     }
@@ -263,4 +266,5 @@
       populationSizeAnalyzer = new PopulationSizeAnalyzer();
       offspringSuccessAnalyzer = new OffspringSuccessAnalyzer();
+      selectionPressureAnalyzer = new SelectionPressureAnalyzer();
       ParameterizeAnalyzers();
       UpdateAnalyzers();
@@ -401,4 +405,6 @@
       offspringSuccessAnalyzer.ResultsParameter.ActualName = "Results";
       offspringSuccessAnalyzer.ResultsParameter.Hidden = true;
+      selectionPressureAnalyzer.ResultsParameter.ActualName = "Results";
+      selectionPressureAnalyzer.ResultsParameter.Hidden = true;
       if (Problem != null) {
         qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
@@ -459,4 +465,5 @@
       Analyzer.Operators.Add(populationSizeAnalyzer, populationSizeAnalyzer.EnabledByDefault);
       Analyzer.Operators.Add(offspringSuccessAnalyzer, offspringSuccessAnalyzer.EnabledByDefault);
+      Analyzer.Operators.Add(selectionPressureAnalyzer, selectionPressureAnalyzer.EnabledByDefault);
     }
     private void UpdateSimilarityCalculators() {
Index: branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/RAPGAMainLoop.cs
===================================================================
--- branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/RAPGAMainLoop.cs	(revision 8379)
+++ branches/RAPGA/HeuristicLab.Algorithms.RAPGA/3.3/RAPGAMainLoop.cs	(revision 8385)
@@ -158,6 +158,6 @@
       WeightedParentsQualityComparator weightedParentsQualityComparator = new WeightedParentsQualityComparator();
       SubScopesRemover subScopesRemover = new SubScopesRemover();
-      SubScopesCounter subScopesCounter1 = new SubScopesCounter();
       IntCounter intCounter1 = new IntCounter();
+      IntCounter intCounter2 = new IntCounter();
       ConditionalSelector conditionalSelector = new ConditionalSelector();
       RightReducer rightReducer1 = new RightReducer();
@@ -177,17 +177,20 @@
       OffspringRestorer offspringRestorer = new OffspringRestorer();
       MergingReducer mergingReducer = new MergingReducer();
-      IntCounter intCounter2 = new IntCounter();
+      Assigner assigner2 = new Assigner();
+      IntCounter intCounter3 = new IntCounter();
       SubScopesCounter subScopesCounter3 = new SubScopesCounter();
+      ExpressionEvaluator expressionEvaluator = new ExpressionEvaluator();
+      Placeholder analyzer2 = new Placeholder();
       Comparator comparator3 = new Comparator();
-      Placeholder analyzer2 = new Placeholder();
       ConditionalBranch conditionalBranch3 = new ConditionalBranch();
       Comparator comparator4 = new Comparator();
       ConditionalBranch conditionalBranch4 = new ConditionalBranch();
-      Assigner assigner2 = new Assigner();
       Assigner assigner3 = new Assigner();
       Assigner assigner4 = new Assigner();
+      Assigner assigner5 = new Assigner();
 
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class RAPGA expects this to be called Generations
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentPopulationSize", new IntValue(0)));
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LastPopulationSize", new IntValue(0)));
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("NumberOfCreatedOffspring", new IntValue(0)));
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("NumberOfSuccessfulOffspring", new IntValue(0)));
@@ -232,11 +235,13 @@
       subScopesRemover.RemoveAllSubScopes = true;
 
-      subScopesCounter1.Name = "Increment NumberOfCreatedOffspring";
-      subScopesCounter1.ValueParameter.ActualName = "NumberOfCreatedOffspring";
-
-      intCounter1.Name = "Increment EvaluatedSolutions";
-      intCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
+      intCounter1.Name = "Increment NumberOfCreatedOffspring";
+      intCounter1.ValueParameter.ActualName = "NumberOfCreatedOffspring";
       intCounter1.Increment = null;
-      intCounter1.IncrementParameter.ActualName = "NumberOfCreatedOffspring";
+      intCounter1.IncrementParameter.ActualName = BatchSizeParameter.Name;
+
+      intCounter2.Name = "Increment EvaluatedSolutions";
+      intCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
+      intCounter2.Increment = null;
+      intCounter2.IncrementParameter.ActualName = BatchSizeParameter.Name;
 
       conditionalSelector.ConditionParameter.ActualName = "SuccessfulOffspring";
@@ -276,11 +281,26 @@
       bestSelector.QualityParameter.ActualName = QualityParameter.Name;
 
-      intCounter2.Name = "Increment Generations";
-      intCounter2.Increment = new IntValue(1);
-      intCounter2.ValueParameter.ActualName = "Generations";
-      subScopesCounter3.Name = "Set CurrentPopulationSize";
-
+      assigner2.Name = "Update LastPopulationSize";
+      assigner2.LeftSideParameter.ActualName = "LastPopulationSize";
+      assigner2.RightSideParameter.ActualName = "CurrentPopulationSize";
+
+      intCounter3.Name = "Increment Generations";
+      intCounter3.Increment = new IntValue(1);
+      intCounter3.ValueParameter.ActualName = "Generations";
+
+      subScopesCounter3.Name = "Update CurrentPopulationSize";
       subScopesCounter3.ValueParameter.ActualName = "CurrentPopulationSize";
       subScopesCounter3.AccumulateParameter.Value = new BoolValue(false);
+
+      expressionEvaluator.Name = "Evaluate ActualSelectionPressure";
+      expressionEvaluator.CollectedValues.Add(new ValueLookupParameter<IntValue>("CurrentPopulationSize"));
+      expressionEvaluator.CollectedValues.Add(new ValueLookupParameter<IntValue>("LastPopulationSize"));
+      expressionEvaluator.CollectedValues.Add(new ValueLookupParameter<IntValue>("NumberOfCreatedOffspring"));
+      expressionEvaluator.CollectedValues.Add(new ValueLookupParameter<IntValue>("NumberOfSuccessfulOffspring"));
+      expressionEvaluator.ExpressionParameter.Value = new StringValue("CurrentPopulationSize NumberOfCreatedOffspring NumberOfSuccessfulOffspring - + LastPopulationSize /");
+      expressionEvaluator.ExpressionResultParameter.ActualName = "ActualSelectionPressure";
+
+      analyzer2.Name = "Analyzer";
+      analyzer2.OperatorParameter.ActualName = "Analyzer";
 
       comparator3.Name = "Generations >= MaximumGenerations";
@@ -290,7 +310,4 @@
       comparator3.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
 
-      analyzer2.Name = "Analyzer";
-      analyzer2.OperatorParameter.ActualName = "Analyzer";
-
       conditionalBranch3.Name = "Terminate?";
       conditionalBranch3.ConditionParameter.ActualName = "Terminate";
@@ -305,15 +322,15 @@
       conditionalBranch4.ConditionParameter.ActualName = "Terminate";
 
-      assigner2.Name = "Reset NumberOfCreatedOffspring";
-      assigner2.LeftSideParameter.ActualName = "NumberOfCreatedOffspring";
-      assigner2.RightSideParameter.Value = new IntValue(0);
-
-      assigner3.Name = "Reset NumberOfSuccessfulOffspring";
-      assigner3.LeftSideParameter.ActualName = "NumberOfSuccessfulOffspring";
+      assigner3.Name = "Reset NumberOfCreatedOffspring";
+      assigner3.LeftSideParameter.ActualName = "NumberOfCreatedOffspring";
       assigner3.RightSideParameter.Value = new IntValue(0);
 
-      assigner4.Name = "Reset OffspringList";
-      assigner4.LeftSideParameter.ActualName = "OffspringList";
-      assigner4.RightSideParameter.Value = new ScopeList();
+      assigner4.Name = "Reset NumberOfSuccessfulOffspring";
+      assigner4.LeftSideParameter.ActualName = "NumberOfSuccessfulOffspring";
+      assigner4.RightSideParameter.Value = new IntValue(0);
+
+      assigner5.Name = "Reset OffspringList";
+      assigner5.LeftSideParameter.ActualName = "OffspringList";
+      assigner5.RightSideParameter.Value = new ScopeList();
       #endregion
 
@@ -330,5 +347,5 @@
       childrenCreator.Successor = uniformSubScopesProcessor;
       uniformSubScopesProcessor.Operator = crossover;
-      uniformSubScopesProcessor.Successor = subScopesCounter1;
+      uniformSubScopesProcessor.Successor = intCounter1;
       crossover.Successor = stochasticBranch;
       stochasticBranch.FirstBranch = mutator;
@@ -338,6 +355,6 @@
       evaluator.Successor = weightedParentsQualityComparator;
       weightedParentsQualityComparator.Successor = subScopesRemover;
-      subScopesCounter1.Successor = intCounter1;
-      intCounter1.Successor = conditionalSelector;
+      intCounter1.Successor = intCounter2;
+      intCounter2.Successor = conditionalSelector;
       conditionalSelector.Successor = rightReducer1;
       rightReducer1.Successor = duplicateSelector;
@@ -358,7 +375,9 @@
       rightReducer2.Successor = null;
       scopeCleaner.Successor = offspringRestorer;
-      mergingReducer.Successor = intCounter2;
-      intCounter2.Successor = subScopesCounter3;
-      subScopesCounter3.Successor = analyzer2;
+      mergingReducer.Successor = assigner2;
+      assigner2.Successor = intCounter3;
+      intCounter3.Successor = subScopesCounter3;
+      subScopesCounter3.Successor = expressionEvaluator;
+      expressionEvaluator.Successor = analyzer2;
       analyzer2.Successor = comparator3;
       comparator3.Successor = conditionalBranch3;
@@ -367,10 +386,10 @@
       conditionalBranch3.Successor = null;
       comparator4.Successor = conditionalBranch4;
-      conditionalBranch4.FalseBranch = assigner2;
+      conditionalBranch4.FalseBranch = assigner3;
       conditionalBranch4.TrueBranch = null;
       conditionalBranch4.Successor = null;
-      assigner2.Successor = assigner3;
       assigner3.Successor = assigner4;
-      assigner4.Successor = selector;
+      assigner4.Successor = assigner5;
+      assigner5.Successor = selector;
 
       #endregion
