Index: trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs	(revision 3131)
+++ trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs	(revision 3142)
@@ -46,4 +46,7 @@
       get { return (LookupParameter<DoubleValue>)Parameters["Quality"]; }
     }
+    public ValueLookupParameter<DoubleValue> BestKnownQualityParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
+    }
     public LookupParameter<DoubleValue> MoveQualityParameter {
       get { return (LookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
@@ -61,25 +64,24 @@
       get { return (ValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
     }
+    public ValueLookupParameter<IOperator> MoveGeneratorParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["MoveGenerator"]; }
+    }
+    public ValueLookupParameter<IOperator> MoveEvaluatorParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["MoveEvaluator"]; }
+    }
+    public ValueLookupParameter<IOperator> MoveMakerParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["MoveMaker"]; }
+    }
+    public ValueLookupParameter<IOperator> AnnealingOperatorParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["AnnealingOperator"]; }
+    }
+    public ValueLookupParameter<IOperator> VisualizerParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; }
+    }
+    public LookupParameter<IItem> VisualizationParameter {
+      get { return (LookupParameter<IItem>)Parameters["Visualization"]; }
+    }
     public ValueLookupParameter<VariableCollection> ResultsParameter {
       get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
-    }
-    public ValueLookupParameter<IOperator> MoveGeneratorParameter {
-      get { return (ValueLookupParameter<IOperator>)Parameters["MoveGenerator"]; }
-    }
-    public ValueLookupParameter<IOperator> MoveEvaluatorParameter {
-      get { return (ValueLookupParameter<IOperator>)Parameters["MoveEvaluator"]; }
-    }
-    public ValueLookupParameter<IOperator> MoveMakerParameter {
-      get { return (ValueLookupParameter<IOperator>)Parameters["MoveMaker"]; }
-    }
-    public ValueLookupParameter<IOperator> AnnealingOperatorParameter {
-      get { return (ValueLookupParameter<IOperator>)Parameters["AnnealingOperator"]; }
-    }
-
-    private ScopeParameter CurrentScopeParameter {
-      get { return (ScopeParameter)Parameters["CurrentScope"]; }
-    }
-    public IScope CurrentScope {
-      get { return CurrentScopeParameter.ActualValue; }
     }
     #endregion
@@ -97,4 +99,5 @@
       Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
       Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
       Parameters.Add(new ValueLookupParameter<DoubleValue>("StartTemperature", "The initial temperature."));
@@ -102,6 +105,5 @@
       Parameters.Add(new ValueLookupParameter<IntValue>("InnerIterations", "The amount of inner iterations (number of moves before temperature is adjusted again)."));
       Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed."));
-      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
-
+      
       Parameters.Add(new ValueLookupParameter<IOperator>("MoveGenerator", "The operator that generates the moves."));
       Parameters.Add(new ValueLookupParameter<IOperator>("MoveEvaluator", "The operator that evaluates a move."));
@@ -109,13 +111,17 @@
       Parameters.Add(new ValueLookupParameter<IOperator>("AnnealingOperator", "The operator that modifies the temperature."));
 
-      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied."));
+      Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
+      Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
+      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
       #endregion
 
       #region Create operators
       VariableCreator variableCreator = new VariableCreator();
-      BestQualityMemorizer initializeBestQuality = new BestQualityMemorizer();
+      BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer();
+      BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();
+      QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator();
+      Placeholder visualizer1 = new Placeholder();
       SequentialSubScopesProcessor sssp = new SequentialSubScopesProcessor();
       ResultsCollector resultsCollector = new ResultsCollector();
-      BestQualityMemorizer bestQualityMemorizer = new BestQualityMemorizer();
       Placeholder annealingOperator = new Placeholder();
       UniformSequentialSubScopesProcessor mainProcessor = new UniformSequentialSubScopesProcessor();
@@ -130,32 +136,55 @@
       IntCounter iterationsCounter = new IntCounter();
       Comparator iterationsComparator = new Comparator();
+      BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer();
+      BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer();
+      QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
+      Placeholder visualizer2 = new Placeholder();
       ConditionalBranch iterationsTermination = new ConditionalBranch();
-      EmptyOperator finished = new EmptyOperator();
-
+      
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
       variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("Qualities", new DataTable("Qualities")));
       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Temperature", new DoubleValue(double.MaxValue)));
 
+      bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
+      bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name;
+
+      bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
+      bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name;
+
+      qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
+      qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
+      qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
+      qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality";
+
+      visualizer1.Name = "Visualizer (placeholder)";
+      visualizer1.OperatorParameter.ActualName = VisualizerParameter.Name;
+
       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
-      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Quality"));
+      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(QualityParameter.Name));
       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality") { ActualName = "BestQuality" });
+      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities"));
       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Temperature"));
-
+      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));
+      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));
+      resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, VisualizationParameter.Name));
+      
       annealingOperator.Name = "Annealing operator (placeholder)";
-      annealingOperator.OperatorParameter.ActualName = "AnnealingOperator";
-
-      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Quality"));
+      annealingOperator.OperatorParameter.ActualName = AnnealingOperatorParameter.Name;
+
+      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>(QualityParameter.Name));
       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestQuality"));
       valuesCollector.DataTableParameter.ActualName = "Qualities";
 
       moveGenerator.Name = "Move generator (placeholder)";
-      moveGenerator.OperatorParameter.ActualName = "MoveGenerator";
+      moveGenerator.OperatorParameter.ActualName = MoveGeneratorParameter.Name;
 
       moveEvaluator.Name = "Move evaluator (placeholder)";
-      moveEvaluator.OperatorParameter.ActualName = "MoveEvaluator";
-
-      qualityComparator.LeftSideParameter.ActualName = "MoveQuality";
-      qualityComparator.RightSideParameter.ActualName = "Quality";
+      moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;
+
+      qualityComparator.LeftSideParameter.ActualName = MoveQualityParameter.Name;
+      qualityComparator.RightSideParameter.ActualName = QualityParameter.Name;
       qualityComparator.ResultParameter.ActualName = "IsBetter";
       qualityComparator.DampeningParameter.ActualName = "Temperature";
@@ -164,5 +193,5 @@
 
       moveMaker.Name = "Move maker (placeholder)";
-      moveMaker.OperatorParameter.ActualName = "MoveMaker";
+      moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;
 
       subScopesRemover.RemoveAllSubScopes = true;
@@ -174,21 +203,38 @@
       iterationsComparator.Name = "Iterations >= MaximumIterations";
       iterationsComparator.LeftSideParameter.ActualName = "Iterations";
-      iterationsComparator.RightSideParameter.ActualName = "MaximumIterations";
-      iterationsComparator.ResultParameter.ActualName = "IterationsCondition";
+      iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
+      iterationsComparator.ResultParameter.ActualName = "Terminate";
       iterationsComparator.Comparison.Value = ComparisonType.GreaterOrEqual;
 
+      bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality";
+      bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestQualityMemorizer3.QualityParameter.ActualName = QualityParameter.Name;
+
+      bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
+      bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      bestQualityMemorizer4.QualityParameter.ActualName = QualityParameter.Name;
+
+      qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
+      qualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
+      qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
+      qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
+
+      visualizer2.Name = "Visualizer (placeholder)";
+      visualizer2.OperatorParameter.ActualName = VisualizerParameter.Name;
+
       iterationsTermination.Name = "Iterations termination condition";
-      iterationsTermination.ConditionParameter.ActualName = "IterationsCondition";
-
-      finished.Name = "Finished";
+      iterationsTermination.ConditionParameter.ActualName = "Terminate";
       #endregion
 
       #region Create operator graph
       OperatorGraph.InitialOperator = variableCreator;
-      variableCreator.Successor = initializeBestQuality;
-      initializeBestQuality.Successor = sssp;
+      variableCreator.Successor = bestQualityMemorizer1;
+      bestQualityMemorizer1.Successor = bestQualityMemorizer2;
+      bestQualityMemorizer2.Successor = qualityDifferenceCalculator1;
+      qualityDifferenceCalculator1.Successor = visualizer1;
+      visualizer1.Successor = sssp;
       sssp.Operators.Add(resultsCollector);
-      sssp.Successor = bestQualityMemorizer;
-      bestQualityMemorizer.Successor = annealingOperator;
+      resultsCollector.Successor = null;
+      sssp.Successor = annealingOperator;
       annealingOperator.Successor = mainProcessor;
       mainProcessor.Operator = valuesCollector;
@@ -202,7 +248,11 @@
       improvesQualityBranch.TrueBranch = moveMaker;
       iterationsCounter.Successor = iterationsComparator;
-      iterationsComparator.Successor = iterationsTermination;
-      iterationsTermination.TrueBranch = finished;
-      iterationsTermination.FalseBranch = bestQualityMemorizer;
+      iterationsComparator.Successor = bestQualityMemorizer3;
+      bestQualityMemorizer3.Successor = bestQualityMemorizer4;
+      bestQualityMemorizer4.Successor = qualityDifferenceCalculator2;
+      qualityDifferenceCalculator2.Successor = visualizer2;
+      visualizer2.Successor = iterationsTermination;
+      iterationsTermination.TrueBranch = null;
+      iterationsTermination.FalseBranch = annealingOperator;
       #endregion
     }
