Index: branches/TerminationCriteria/HeuristicLab.Termination/3.3/ComparisonTerminationCriterion.cs
===================================================================
--- branches/TerminationCriteria/HeuristicLab.Termination/3.3/MaximumIterationsTerminationCriterion.cs	(revision 12303)
+++ branches/TerminationCriteria/HeuristicLab.Termination/3.3/ComparisonTerminationCriterion.cs	(revision 12310)
@@ -20,39 +20,78 @@
 #endregion
 
+using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Termination {
-  [Item("MaximumIterationsTerminationCriterion", "")]
+  [Item("ComparisonTerminationCriterion", "")]
   [StorableClass]
-  public sealed class MaximumIterationsTerminationCriterion : TerminationCriterion, IIterationBasedOperator {
-    public ILookupParameter<IntValue> IterationsParameter {
-      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+  public sealed class ComparisonTerminationCriterion<T> : TerminationCriterion where T : class, IItem, IComparable {
+    public ILookupParameter<T> LeftSideParameter {
+      get { return (ILookupParameter<T>)Parameters["LeftSide"]; }
+    }
+    public IValueLookupParameter<T> RightSideParameter {
+      get { return (IValueLookupParameter<T>)Parameters["RightSide"]; }
+    }
+    private ValueParameter<Comparison> ComparisonParameter {
+      get { return (ValueParameter<Comparison>)Parameters["Comparison"]; }
     }
 
-    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    public Comparison Comparison {
+      get { return ComparisonParameter.Value; }
+      set { ComparisonParameter.Value = value; }
     }
 
     [StorableConstructor]
-    private MaximumIterationsTerminationCriterion(bool deserializing) : base(deserializing) { }
-    private MaximumIterationsTerminationCriterion(MaximumIterationsTerminationCriterion original, Cloner cloner)
+    private ComparisonTerminationCriterion(bool deserializing) : base(deserializing) { }
+    private ComparisonTerminationCriterion(ComparisonTerminationCriterion<T> original, Cloner cloner)
       : base(original, cloner) {
     }
     public override IDeepCloneable Clone(Cloner cloner) {
-      return new MaximumIterationsTerminationCriterion(this, cloner);
+      return new ComparisonTerminationCriterion<T>(this, cloner);
     }
-    public MaximumIterationsTerminationCriterion()
+    public ComparisonTerminationCriterion()
       : base() {
-      Parameters.Add(new LookupParameter<IntValue>("Iterations", "The current iteration"));
-      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The number of iterations that the algorithm should run."));
+      Parameters.Add(new LookupParameter<T>("LeftSide", "The left side of the comparison."));
+      Parameters.Add(new ValueLookupParameter<T>("RightSide", "The right side of the comparison."));
+      Parameters.Add(new ValueParameter<Comparison>("Comparison", "The type of comparison.", new Comparison(ComparisonType.Equal)) { Hidden = true });
+    }
+    public ComparisonTerminationCriterion(string leftSideActualName, string rightSideActualName, ComparisonType comparison = ComparisonType.GreaterOrEqual)
+      : this() {
+      LeftSideParameter.ActualName = leftSideActualName;
+      RightSideParameter.ActualName = rightSideActualName;
+      Comparison.Value = comparison;
+    }
+    public ComparisonTerminationCriterion(string leftSideActualName, T rightSideValue, ComparisonType comparison = ComparisonType.GreaterOrEqual)
+      : this() {
+      LeftSideParameter.ActualName = leftSideActualName;
+      RightSideParameter.Value = rightSideValue;
+      Comparison.Value = comparison;
     }
 
     protected override bool CheckTermination() {
-      return IterationsParameter.ActualValue.Value >= MaximumIterationsParameter.ActualValue.Value;
+      IComparable lhs = LeftSideParameter.ActualValue;
+      IComparable rhs = RightSideParameter.ActualValue;
+
+      int i = lhs.CompareTo(rhs);
+      switch (Comparison.Value) {
+        case ComparisonType.Less:
+          return i < 0;
+        case ComparisonType.LessOrEqual:
+          return i <= 0;
+        case ComparisonType.Equal:
+          return i == 0;
+        case ComparisonType.GreaterOrEqual:
+          return i >= 0;
+        case ComparisonType.Greater:
+          return i > 0;
+        case ComparisonType.NotEqual:
+          return i != 0;
+        default:
+          throw new InvalidOperationException(Name + ": " + Comparison.Value + " is not supported.");
+      }
     }
   }
