Index: /branches/2521_ProblemRefactoring/HeuristicLab.Optimizer/3.3/StartPage.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Optimizer/3.3/StartPage.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Optimizer/3.3/StartPage.cs	(revision 17241)
@@ -110,6 +110,7 @@
         }
 
+      } catch {
+      } finally {
         OnAllSamplesLoaded();
-      } finally {
         Progress.HideFromControl(samplesListView);
       }
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj	(revision 17241)
@@ -128,10 +128,4 @@
     </Compile>
     <Compile Include="Plugin.cs" />
-    <Compile Include="TravelingSalesmanProblemView.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
-    <Compile Include="TravelingSalesmanProblemView.Designer.cs">
-      <DependentUpon>TravelingSalesmanProblemView.cs</DependentUpon>
-    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/PathTSPTourView.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/PathTSPTourView.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/PathTSPTourView.cs	(revision 17241)
@@ -21,4 +21,5 @@
 
 using System;
+using System.ComponentModel;
 using System.Drawing;
 using System.Windows.Forms;
@@ -48,14 +49,10 @@
 
     protected override void DeregisterContentEvents() {
-      Content.QualityChanged -= new EventHandler(Content_QualityChanged);
-      Content.CoordinatesChanged -= new EventHandler(Content_CoordinatesChanged);
-      Content.PermutationChanged -= new EventHandler(Content_PermutationChanged);
+      Content.PropertyChanged -= ContentOnPropertyChanged;
       base.DeregisterContentEvents();
     }
     protected override void RegisterContentEvents() {
       base.RegisterContentEvents();
-      Content.QualityChanged += new EventHandler(Content_QualityChanged);
-      Content.CoordinatesChanged += new EventHandler(Content_CoordinatesChanged);
-      Content.PermutationChanged += new EventHandler(Content_PermutationChanged);
+      Content.PropertyChanged += ContentOnPropertyChanged;
     }
 
@@ -67,7 +64,7 @@
         tourViewHost.Content = null;
       } else {
-        qualityViewHost.Content = Content.Quality;
+        qualityViewHost.Content = Content.TourLength;
         GenerateImage();
-        tourViewHost.Content = Content.Permutation;
+        tourViewHost.Content = Content.Tour;
       }
     }
@@ -86,5 +83,5 @@
         } else {
           DoubleMatrix coordinates = Content.Coordinates;
-          Permutation permutation = Content.Permutation;
+          Permutation permutation = Content.Tour;
           Bitmap bitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
 
@@ -133,22 +130,20 @@
     }
 
-    private void Content_QualityChanged(object sender, EventArgs e) {
+    private void ContentOnPropertyChanged(object sender, PropertyChangedEventArgs e) {
       if (InvokeRequired)
-        Invoke(new EventHandler(Content_QualityChanged), sender, e);
-      else
-        qualityViewHost.Content = Content.Quality;
-    }
-    private void Content_CoordinatesChanged(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_CoordinatesChanged), sender, e);
-      else
-        GenerateImage();
-    }
-    private void Content_PermutationChanged(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_PermutationChanged), sender, e);
+        Invoke((Action<object, PropertyChangedEventArgs>)ContentOnPropertyChanged, sender, e);
       else {
-        GenerateImage();
-        tourViewHost.Content = Content.Permutation;
+        switch (e.PropertyName) {
+          case nameof(Content.Coordinates):
+            GenerateImage();
+            break;
+          case nameof(Content.Tour):
+            GenerateImage();
+            tourViewHost.Content = Content.Tour;
+            break;
+          case nameof(Content.TourLength):
+            qualityViewHost.Content = Content.TourLength;
+            break;
+        }
       }
     }
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.Designer.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.Designer.cs	(revision 17240)
+++ 	(revision )
@@ -1,151 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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
-
-namespace HeuristicLab.Problems.TravelingSalesman.Views {
-  partial class TravelingSalesmanProblemView {
-    /// <summary> 
-    /// Required designer variable.
-    /// </summary>
-    private System.ComponentModel.IContainer components = null;
-
-    protected override void Dispose(bool disposing) {
-      if (disposing) {
-        if (components != null) components.Dispose();
-      }
-      base.Dispose(disposing);
-    }
-
-    #region Component Designer generated code
-
-    /// <summary> 
-    /// Required method for Designer support - do not modify 
-    /// the contents of this method with the code editor.
-    /// </summary>
-    private void InitializeComponent() {
-      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
-      this.parametersTabPage = new System.Windows.Forms.TabPage();
-      this.visualizationTabPage = new System.Windows.Forms.TabPage();
-      this.pathTSPTourView = new HeuristicLab.Problems.TravelingSalesman.Views.PathTSPTourView();
-      ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).BeginInit();
-      this.problemInstanceSplitContainer.Panel1.SuspendLayout();
-      this.problemInstanceSplitContainer.Panel2.SuspendLayout();
-      this.problemInstanceSplitContainer.SuspendLayout();
-      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
-      this.tabControl.SuspendLayout();
-      this.parametersTabPage.SuspendLayout();
-      this.visualizationTabPage.SuspendLayout();
-      this.SuspendLayout();
-      // 
-      // problemInstanceSplitContainer
-      // 
-      // 
-      // problemInstanceSplitContainer.Panel2
-      // 
-      this.problemInstanceSplitContainer.Panel2.Controls.Add(this.tabControl);
-      // 
-      // parameterCollectionView
-      // 
-      this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
-      this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.parameterCollectionView.Location = new System.Drawing.Point(3, 3);
-      this.parameterCollectionView.Size = new System.Drawing.Size(497, 274);
-      // 
-      // nameTextBox
-      // 
-      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
-      // 
-      // tabControl
-      // 
-      this.tabControl.AllowDrop = true;
-      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                  | System.Windows.Forms.AnchorStyles.Left)
-                  | System.Windows.Forms.AnchorStyles.Right)));
-      this.tabControl.Controls.Add(this.parametersTabPage);
-      this.tabControl.Controls.Add(this.visualizationTabPage);
-      this.tabControl.Location = new System.Drawing.Point(0, 27);
-      this.tabControl.Name = "tabControl";
-      this.tabControl.SelectedIndex = 0;
-      this.tabControl.Size = new System.Drawing.Size(511, 306);
-      this.tabControl.TabIndex = 4;
-      // 
-      // parametersTabPage
-      // 
-      this.parametersTabPage.BackColor = System.Drawing.SystemColors.Window;
-      this.parametersTabPage.Controls.Add(this.parameterCollectionView);
-      this.parametersTabPage.Location = new System.Drawing.Point(4, 22);
-      this.parametersTabPage.Name = "parametersTabPage";
-      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
-      this.parametersTabPage.Size = new System.Drawing.Size(503, 280);
-      this.parametersTabPage.TabIndex = 0;
-      this.parametersTabPage.Text = "Parameters";
-      // 
-      // visualizationTabPage
-      // 
-      this.visualizationTabPage.BackColor = System.Drawing.SystemColors.Window;
-      this.visualizationTabPage.Controls.Add(this.pathTSPTourView);
-      this.visualizationTabPage.Location = new System.Drawing.Point(4, 22);
-      this.visualizationTabPage.Name = "visualizationTabPage";
-      this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
-      this.visualizationTabPage.Size = new System.Drawing.Size(503, 280);
-      this.visualizationTabPage.TabIndex = 1;
-      this.visualizationTabPage.Text = "Visualization";
-      // 
-      // pathTSPTourView
-      // 
-      this.pathTSPTourView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                  | System.Windows.Forms.AnchorStyles.Left)
-                  | System.Windows.Forms.AnchorStyles.Right)));
-      this.pathTSPTourView.Caption = "PathTSPTour View";
-      this.pathTSPTourView.Content = null;
-      this.pathTSPTourView.Location = new System.Drawing.Point(6, 6);
-      this.pathTSPTourView.Name = "pathTSPTourView";
-      this.pathTSPTourView.ReadOnly = false;
-      this.pathTSPTourView.Size = new System.Drawing.Size(491, 268);
-      this.pathTSPTourView.TabIndex = 0;
-      // 
-      // TravelingSalesmanProblemView
-      // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
-      this.Name = "TravelingSalesmanProblemView";
-      this.problemInstanceSplitContainer.Panel1.ResumeLayout(false);
-      this.problemInstanceSplitContainer.Panel1.PerformLayout();
-      this.problemInstanceSplitContainer.Panel2.ResumeLayout(false);
-      this.problemInstanceSplitContainer.Panel2.PerformLayout();
-      ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).EndInit();
-      this.problemInstanceSplitContainer.ResumeLayout(false);
-      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
-      this.tabControl.ResumeLayout(false);
-      this.parametersTabPage.ResumeLayout(false);
-      this.visualizationTabPage.ResumeLayout(false);
-      this.ResumeLayout(false);
-
-    }
-
-    #endregion
-
-    private HeuristicLab.MainForm.WindowsForms.DragOverTabControl tabControl;
-    private System.Windows.Forms.TabPage parametersTabPage;
-    private System.Windows.Forms.TabPage visualizationTabPage;
-    private PathTSPTourView pathTSPTourView;
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs	(revision 17240)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Windows.Forms;
-using HeuristicLab.MainForm;
-using HeuristicLab.Optimization.Views;
-
-namespace HeuristicLab.Problems.TravelingSalesman.Views {
-  /// <summary>
-  /// A view for a Traveling Salesman Problem instance.
-  /// </summary>
-  [View("Traveling Salesman Problem View")]
-  [Content(typeof(TravelingSalesmanProblem), true)]
-  public sealed partial class TravelingSalesmanProblemView : ProblemView {
-    public new TravelingSalesmanProblem Content {
-      get { return (TravelingSalesmanProblem)base.Content; }
-      set { base.Content = value; }
-    }
-
-    /// <summary>
-    /// Initializes a new instance of <see cref="TravelingSalesmanProblemView"/>.
-    /// </summary>
-    public TravelingSalesmanProblemView() {
-      InitializeComponent();
-    }
-
-    protected override void DeregisterContentEvents() {
-      Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
-      Content.BestKnownQualityParameter.ValueChanged -= new EventHandler(BestKnownQualityParameter_ValueChanged);
-      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
-      base.DeregisterContentEvents();
-    }
-    protected override void RegisterContentEvents() {
-      base.RegisterContentEvents();
-      Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
-      Content.BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged);
-      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
-    }
-
-    protected override void OnContentChanged() {
-      base.OnContentChanged();
-      if (Content == null) {
-        pathTSPTourView.Content = null;
-      } else {
-        pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution, Content.BestKnownQuality);
-      }
-    }
-
-    protected override void SetEnabledStateOfControls() {
-      base.SetEnabledStateOfControls();
-      pathTSPTourView.Enabled = Content != null;
-    }
-
-    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
-      pathTSPTourView.Content.Coordinates = Content.Coordinates;
-    }
-    private void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) {
-      pathTSPTourView.Content.Quality = Content.BestKnownQuality;
-    }
-    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
-      pathTSPTourView.Content.Permutation = Content.BestKnownSolution;
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/BestTSPSolutionAnalyzer.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/BestTSPSolutionAnalyzer.cs	(revision 17240)
+++ 	(revision )
@@ -1,132 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator for analyzing the best solution of Traveling Salesman Problems given in path representation using city coordinates.
-  /// </summary>
-  [Item("BestTSPSolutionAnalyzer", "An operator for analyzing the best solution of Traveling Salesman Problems given in path representation using city coordinates.")]
-  [StorableType("86D3A4A2-C91C-46D4-9644-10F88F94FEA1")]
-  public sealed class BestTSPSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
-    public bool EnabledByDefault {
-      get { return true; }
-    }
-
-    public LookupParameter<BoolValue> MaximizationParameter {
-      get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; }
-    }
-    public LookupParameter<DoubleMatrix> CoordinatesParameter {
-      get { return (LookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
-    }
-    public ScopeTreeLookupParameter<Permutation> PermutationParameter {
-      get { return (ScopeTreeLookupParameter<Permutation>)Parameters["Permutation"]; }
-    }
-    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
-      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
-    }
-    public LookupParameter<PathTSPTour> BestSolutionParameter {
-      get { return (LookupParameter<PathTSPTour>)Parameters["BestSolution"]; }
-    }
-    public ValueLookupParameter<ResultCollection> ResultsParameter {
-      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
-    }
-    public LookupParameter<DoubleValue> BestKnownQualityParameter {
-      get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
-    }
-    public LookupParameter<Permutation> BestKnownSolutionParameter {
-      get { return (LookupParameter<Permutation>)Parameters["BestKnownSolution"]; }
-    }
-
-    [StorableConstructor]
-    private BestTSPSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
-    private BestTSPSolutionAnalyzer(BestTSPSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new BestTSPSolutionAnalyzer(this, cloner);
-    }
-    public BestTSPSolutionAnalyzer()
-      : base() {
-      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
-      Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities."));
-      Parameters.Add(new ScopeTreeLookupParameter<Permutation>("Permutation", "The TSP solutions given in path representation from which the best solution should be analyzed."));
-      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the TSP solutions which should be analyzed."));
-      Parameters.Add(new LookupParameter<PathTSPTour>("BestSolution", "The best TSP solution."));
-      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best TSP solution should be stored."));
-      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance."));
-      Parameters.Add(new LookupParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance."));
-
-      MaximizationParameter.Hidden = true;
-      CoordinatesParameter.Hidden = true;
-      PermutationParameter.Hidden = true;
-      QualityParameter.Hidden = true;
-      BestSolutionParameter.Hidden = true;
-      ResultsParameter.Hidden = true;
-      BestKnownQualityParameter.Hidden = true;
-      BestKnownSolutionParameter.Hidden = true;
-    }
-
-    public override IOperation Apply() {
-      DoubleMatrix coordinates = CoordinatesParameter.ActualValue;
-      ItemArray<Permutation> permutations = PermutationParameter.ActualValue;
-      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
-      ResultCollection results = ResultsParameter.ActualValue;
-      bool max = MaximizationParameter.ActualValue.Value;
-      DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue;
-
-      int i = -1;
-      if (!max)
-        i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
-      else i = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index;
-
-      if (bestKnownQuality == null ||
-          max && qualities[i].Value > bestKnownQuality.Value ||
-          !max && qualities[i].Value < bestKnownQuality.Value) {
-        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value);
-        BestKnownSolutionParameter.ActualValue = (Permutation)permutations[i].Clone();
-      }
-
-      PathTSPTour tour = BestSolutionParameter.ActualValue;
-      if (tour == null) {
-        tour = new PathTSPTour(coordinates, (Permutation)permutations[i].Clone(), new DoubleValue(qualities[i].Value));
-        BestSolutionParameter.ActualValue = tour;
-        results.Add(new Result("Best TSP Solution", tour));
-      } else {
-        if (max && tour.Quality.Value < qualities[i].Value ||
-          !max && tour.Quality.Value > qualities[i].Value) {
-          tour.Coordinates = coordinates;
-          tour.Permutation = (Permutation)permutations[i].Clone();
-          tour.Quality.Value = qualities[i].Value;
-        }
-      }
-
-      return base.Apply();
-    }
-  }
-}
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPAlleleFrequencyAnalyzer.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPAlleleFrequencyAnalyzer.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPAlleleFrequencyAnalyzer.cs	(revision 17241)
@@ -20,12 +20,10 @@
 #endregion
 
-using System;
+using HEAL.Attic;
 using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
 using HeuristicLab.Encodings.PermutationEncoding;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
@@ -34,20 +32,17 @@
   /// </summary>
   [Item("TSPAlleleFrequencyAnalyzer", "An operator for analyzing the frequency of alleles in solutions of Traveling Salesman Problems given in path representation.")]
-  [StorableType("C1BBEC5A-27EF-4882-AEC6-0919FC2EF1DB")]
+  [StorableType("43a9ec34-c917-43f8-bd14-4d42e2d0a458")]
   public sealed class TSPAlleleFrequencyAnalyzer : AlleleFrequencyAnalyzer<Permutation> {
-    public LookupParameter<DoubleMatrix> CoordinatesParameter {
-      get { return (LookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
-    }
-    public LookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (LookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
+    [Storable] public ILookupParameter<ITSPData> TSPDataParameter { get; private set; }
 
     [StorableConstructor]
     private TSPAlleleFrequencyAnalyzer(StorableConstructorFlag _) : base(_) { }
-    private TSPAlleleFrequencyAnalyzer(TSPAlleleFrequencyAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    private TSPAlleleFrequencyAnalyzer(TSPAlleleFrequencyAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+      TSPDataParameter = cloner.Clone(original.TSPDataParameter);
+    }
     public TSPAlleleFrequencyAnalyzer()
       : base() {
-      Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The x- and y-coordinates of the cities."));
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
+      Parameters.Add(TSPDataParameter = new LookupParameter<ITSPData>("TSPData", "The main parameters of the TSP."));
     }
 
@@ -57,8 +52,6 @@
 
     protected override Allele[] CalculateAlleles(Permutation solution) {
+      var tspData = TSPDataParameter.ActualValue;
       Allele[] alleles = new Allele[solution.Length];
-      DoubleMatrix coords = CoordinatesParameter.ActualValue;
-      DistanceMatrix dm = DistanceMatrixParameter.ActualValue;
-      if (dm == null && coords == null) throw new InvalidOperationException("Neither a distance matrix nor coordinates were given.");
       int source, target, h;
       double impact;
@@ -68,5 +61,5 @@
         target = solution[i + 1];
         if (source > target) { h = source; source = target; target = h; }
-        impact = dm != null ? dm[source, target] : CalculateLength(coords[source, 0], coords[source, 1], coords[target, 0], coords[target, 1]);
+        impact = tspData.GetDistance(source, target);
         alleles[i] = new Allele(source.ToString() + "-" + target.ToString(), impact);
       }
@@ -74,13 +67,9 @@
       target = solution[0];
       if (source > target) { h = source; source = target; target = h; }
-      impact = dm != null ? dm[source, target] : CalculateLength(coords[source, 0], coords[source, 1], coords[target, 0], coords[target, 1]);
+      impact = tspData.GetDistance(source, target);
       alleles[alleles.Length - 1] = new Allele(source.ToString() + "-" + target.ToString(), impact);
 
       return alleles;
     }
-
-    private double CalculateLength(double x1, double y1, double x2, double y2) {
-      return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
-    }
   }
 }
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPPopulationDiversityAnalyzer.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPPopulationDiversityAnalyzer.cs	(revision 17240)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HEAL.Attic;
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  // BackwardsCompatibility3.3
-  #region Backwards compatible code, remove with 3.4
-  /// <summary>
-  /// An operator for analyzing the diversity of solutions of Traveling Salesman Problems given in path representation.
-  /// </summary>
-  [Obsolete]
-  [NonDiscoverableType]
-  [Item("TSPPopulationDiversityAnalyzer", "An operator for analyzing the diversity of solutions of Traveling Salesman Problems given in path representation.")]
-  [StorableType("B68CC721-AC64-44A7-BFEA-B4F0ABE1402D")]
-  public sealed class TSPPopulationDiversityAnalyzer : PopulationDiversityAnalyzer<Permutation> {
-    [StorableConstructor]
-    private TSPPopulationDiversityAnalyzer(StorableConstructorFlag _) : base(_) { }
-    private TSPPopulationDiversityAnalyzer(TSPPopulationDiversityAnalyzer original, Cloner cloner) : base(original, cloner) { }
-    public TSPPopulationDiversityAnalyzer() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPPopulationDiversityAnalyzer(this, cloner);
-    }
-
-    protected override double[,] CalculateSimilarities(Permutation[] solutions) {
-      int count = solutions.Length;
-      double[,] similarities = new double[count, count];
-      int[][] edges = new int[count][];
-
-      for (int i = 0; i < count; i++)
-        edges[i] = CalculateEdgesVector(solutions[i]);
-
-      for (int i = 0; i < count; i++) {
-        similarities[i, i] = 1;
-        for (int j = i + 1; j < count; j++) {
-          similarities[i, j] = CalculateSimilarity(edges[i], edges[j]);
-          similarities[j, i] = similarities[i, j];
-        }
-      }
-      return similarities;
-    }
-
-    private int[] CalculateEdgesVector(Permutation permutation) {
-      // transform path representation into adjacency representation
-      int[] edgesVector = new int[permutation.Length];
-      for (int i = 0; i < permutation.Length - 1; i++)
-        edgesVector[permutation[i]] = permutation[i + 1];
-      edgesVector[permutation[permutation.Length - 1]] = permutation[0];
-      return edgesVector;
-    }
-
-    private double CalculateSimilarity(int[] edgesA, int[] edgesB) {
-      // calculate relative number of identical edges
-      int identicalEdges = 0;
-      for (int i = 0; i < edgesA.Length; i++) {
-        if ((edgesA[i] == edgesB[i]) || (edgesA[edgesB[i]] == i))
-          identicalEdges++;
-      }
-      return ((double)identicalEdges) / edgesA.Length;
-    }
-  }
-  #endregion
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/DistanceMatrix.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/DistanceMatrix.cs	(revision 17240)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// Represents a distance matrix of a Traveling Salesman Problem.
-  /// </summary>
-  [Item("DistanceMatrix", "Represents a distance matrix of a Traveling Salesman Problem.")]
-  [StorableType("37D937BA-443B-44BC-AC89-C74D79D96D56")]
-  public sealed class DistanceMatrix : DoubleMatrix {
-    [StorableConstructor]
-    private DistanceMatrix(StorableConstructorFlag _) : base(_) { }
-    private DistanceMatrix(DistanceMatrix original, Cloner cloner) {
-      throw new NotSupportedException("Distance matrices cannot be cloned.");
-    }
-    public DistanceMatrix() : base() { }
-    public DistanceMatrix(int rows, int columns) : base(rows, columns) { }
-    public DistanceMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { }
-    public DistanceMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(rows, columns, columnNames, rowNames) { }
-    public DistanceMatrix(double[,] elements) : base(elements) { }
-    public DistanceMatrix(double[,] elements, IEnumerable<string> columnNames) : base(elements, columnNames) { }
-    public DistanceMatrix(double[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(elements, columnNames, rowNames) { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      // distance matrices are not cloned for performance reasons
-      cloner.RegisterClonedObject(this, this);
-      return this;
-    }
-  }
-}
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj	(revision 17241)
@@ -118,41 +118,13 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Analyzers\BestTSPSolutionAnalyzer.cs" />
-    <Compile Include="Analyzers\TSPPopulationDiversityAnalyzer.cs" />
     <Compile Include="Analyzers\TSPAlleleFrequencyAnalyzer.cs" />
-    <Compile Include="DistanceMatrix.cs" />
-    <Compile Include="Evaluators\TSPDistanceMatrixEvaluator.cs" />
-    <Compile Include="Evaluators\TSPEuclideanPathEvaluator.cs" />
-    <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" />
-    <Compile Include="Evaluators\TSPUpperEuclideanPathEvaluator.cs" />
     <Compile Include="Improvers\TSPImprovementOperator.cs" />
-    <Compile Include="Interfaces\ITSPDistanceMatrixEvaluator.cs" />
-    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveDistanceMatrixEvaluator.cs" />
-    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveEuclideanPathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveGeoPathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMovePathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveRoundedEuclideanPathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMoveEuclideanPathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMoveGeoPathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMoveDistanceMatrixEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMovePathEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMoveRoundedEuclideanPathEvaluator.cs" />
+    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveEvaluator.cs" />
+    <Compile Include="MoveEvaluators\TSPMoveEvaluator.cs" />
+    <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMoveEvaluator.cs" />
     <Compile Include="PathRelinkers\TSPMultipleGuidesPathRelinker.cs" />
     <Compile Include="PathRelinkers\TSPPathRelinker.cs" />
     <Compile Include="PathRelinkers\TSPSimultaneousPathRelinker.cs" />
     <Compile Include="Plugin.cs" />
-    <Compile Include="SimilarityCalculators\TSPSimilarityCalculator.cs" />
-    <Compile Include="TravelingSalesmanProblem.cs" />
-    <Compile Include="PathTSPTour.cs" />
-    <Compile Include="Evaluators\TSPCoordinatesPathEvaluator.cs" />
-    <Compile Include="Evaluators\TSPEvaluator.cs" />
-    <Compile Include="Evaluators\TSPRoundedEuclideanPathEvaluator.cs" />
-    <Compile Include="Interfaces\ITSPCoordinatesPathEvaluator.cs" />
-    <Compile Include="Interfaces\ITSPEvaluator.cs" />
-    <Compile Include="Interfaces\ITSPMoveEvaluator.cs" />
-    <Compile Include="Interfaces\ITSPPathEvaluator.cs" />
-    <Compile Include="Interfaces\ITSPPathMoveEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TSPPathMoveEvaluator.cs" />
-    <Compile Include="MoveEvaluators\TSPMoveEvaluator.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="TSP.cs" />
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Improvers/TSPImprovementOperator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Improvers/TSPImprovementOperator.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Improvers/TSPImprovementOperator.cs	(revision 17241)
@@ -21,4 +21,5 @@
 
 using System;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,5 +29,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
@@ -38,53 +38,33 @@
   /// </remarks>
   [Item("TSPImprovementOperator", "An operator that improves traveling salesman solutions. The operator tries to improve the traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")]
-  [StorableType("9C3B53A4-8FE7-45FC-833B-FF3DAE578010")]
+  [StorableType("1b3cbc66-6dcc-4f61-9cbe-8b50cc54413a")]
   public sealed class TSPImprovementOperator : SingleSuccessorOperator, ISingleObjectiveImprovementOperator {
-    #region Parameter properties
-    public ScopeParameter CurrentScopeParameter {
-      get { return (ScopeParameter)Parameters["CurrentScope"]; }
+    
+    [Storable] public ILookupParameter<ITSPData> TSPDataParameter { get; private set; }
+    [Storable] public IValueParameter<IntValue> ImprovementAttemptsParameter { get; private set; }
+    [Storable] public ILookupParameter<IRandom> RandomParameter { get; private set; }
+    [Storable] public IValueLookupParameter<IItem> SolutionParameter { get; private set; }
+
+    public int ImprovementAttempts {
+      get { return ImprovementAttemptsParameter.Value.Value; }
+      set { ImprovementAttemptsParameter.Value.Value = value; }
     }
-    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (ILookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    public IValueParameter<IntValue> ImprovementAttemptsParameter {
-      get { return (IValueParameter<IntValue>)Parameters["ImprovementAttempts"]; }
-    }
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
-    }
-    public IValueLookupParameter<IItem> SolutionParameter {
-      get { return (IValueLookupParameter<IItem>)Parameters["Solution"]; }
-    }
-    #endregion
-
-    #region Properties
-    public IScope CurrentScope {
-      get { return CurrentScopeParameter.ActualValue; }
-    }
-    public DistanceMatrix DistanceMatrix {
-      get { return DistanceMatrixParameter.ActualValue; }
-      set { DistanceMatrixParameter.ActualValue = value; }
-    }
-    public IntValue ImprovementAttempts {
-      get { return ImprovementAttemptsParameter.Value; }
-      set { ImprovementAttemptsParameter.Value = value; }
-    }
-    public IRandom Random {
-      get { return RandomParameter.ActualValue; }
-      set { RandomParameter.ActualValue = value; }
-    }
-    #endregion
 
     [StorableConstructor]
     private TSPImprovementOperator(StorableConstructorFlag _) : base(_) { }
-    private TSPImprovementOperator(TSPImprovementOperator original, Cloner cloner) : base(original, cloner) { }
+    private TSPImprovementOperator(TSPImprovementOperator original, Cloner cloner)
+      : base(original, cloner) {
+      TSPDataParameter = cloner.Clone(original.TSPDataParameter);
+      ImprovementAttemptsParameter = cloner.Clone(original.ImprovementAttemptsParameter);
+      RandomParameter = cloner.Clone(original.RandomParameter);
+      SolutionParameter = cloner.Clone(original.SolutionParameter);
+    }
     public TSPImprovementOperator()
       : base() {
       #region Create parameters
-      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope that contains the solution to be improved."));
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      Parameters.Add(new ValueParameter<IntValue>("ImprovementAttempts", "The number of improvement attempts the operator should perform.", new IntValue(100)));
-      Parameters.Add(new LookupParameter<IRandom>("Random", "A pseudo random number generator."));
-      Parameters.Add(new ValueLookupParameter<IItem>("Solution", "The solution to be improved. This parameter is used for name translation only."));
+      Parameters.Add(TSPDataParameter = new LookupParameter<ITSPData>("TSPData", "The main parameters of the TSP."));
+      Parameters.Add(ImprovementAttemptsParameter = new ValueParameter<IntValue>("ImprovementAttempts", "The number of improvement attempts the operator should perform.", new IntValue(100)));
+      Parameters.Add(RandomParameter = new LookupParameter<IRandom>("Random", "A pseudo random number generator."));
+      Parameters.Add(SolutionParameter = new ValueLookupParameter<IItem>("Solution", "The solution to be improved. This parameter is used for name translation only."));
       #endregion
     }
@@ -95,18 +75,20 @@
 
     public override IOperation Apply() {
-      var solution = CurrentScope.Variables[SolutionParameter.ActualName].Value as Permutation;
+      var random = RandomParameter.ActualValue;
+      var solution = ExecutionContext.Scope.Variables[SolutionParameter.ActualName].Value as Permutation;
       if (solution == null)
         throw new ArgumentException("Cannot improve solution because it has the wrong type.");
       if (solution.PermutationType != PermutationTypes.RelativeUndirected)
         throw new ArgumentException("Cannot improve solution because the permutation type is not supported.");
+      var tspData = TSPDataParameter.ActualValue;
 
-      for (int i = 0; i < ImprovementAttempts.Value; i++) {
-        var move = StochasticInversionSingleMoveGenerator.Apply(solution, Random);
-        double moveQualtiy = TSPInversionMovePathEvaluator.EvaluateByDistanceMatrix(solution, move, DistanceMatrix);
+      for (int i = 0; i < ImprovementAttempts; i++) {
+        var move = StochasticInversionSingleMoveGenerator.Apply(solution, random);
+        double moveQualtiy = TSPInversionMoveEvaluator.CalculateTourLengthDelta(tspData, solution, move);
         if (moveQualtiy < 0)
           InversionManipulator.Apply(solution, move.Index1, move.Index2);
       }
 
-      CurrentScope.Variables.Add(new Variable("LocalEvaluatedSolutions", ImprovementAttempts));
+      ExecutionContext.Scope.Variables.Add(new Variable("LocalEvaluatedSolutions", new IntValue(ImprovementAttempts)));
 
       return base.Apply();
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPMoveEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPMoveEvaluator.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPMoveEvaluator.cs	(revision 17241)
@@ -1,60 +1,54 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
 using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// A base class for operators which evaluate TSP solutions.
-  /// </summary>
-  [Item("TSPMoveEvaluator", "A base class for operators which evaluate TSP moves.")]
-  [StorableType("25573174-DE4B-4076-B439-CCB5F01CE652")]
-  public abstract class TSPMoveEvaluator : SingleSuccessorOperator, ITSPMoveEvaluator, IMoveOperator {
+  [StorableType("17477ad2-2c84-4b02-b5ac-f35ef6cc667f")]
+  public interface ITSPMoveEvaluator : IOperator {
+    ILookupParameter<Permutation> TSPTourParameter { get; }
+    ILookupParameter<ITSPData> TSPDataParameter { get; }
+    ILookupParameter<DoubleValue> TourLengthParameter { get; }
+    ILookupParameter<DoubleValue> TourLengthWithMoveParameter { get; }
+  }
 
-    public abstract Type EvaluatorType { get; }
-    public override bool CanChangeName {
-      get { return false; }
-    }
-
-    public ILookupParameter<DoubleValue> QualityParameter {
-      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
-    }
-    public ILookupParameter<DoubleValue> MoveQualityParameter {
-      get { return (ILookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
-    }
+  [Item("TSP Move Evaluator", "Base class for all move evaluators of the TSP.")]
+  [StorableType("44af3845-ccdf-4014-805a-5878c64f67f5")]
+  public abstract class TSPMoveEvaluator : SingleSuccessorOperator, ITSPMoveEvaluator {
+    [Storable] public ILookupParameter<Permutation> TSPTourParameter { get; private set; }
+    [Storable] public ILookupParameter<ITSPData> TSPDataParameter { get; private set; }
+    [Storable] public ILookupParameter<DoubleValue> TourLengthParameter { get; private set; }
+    [Storable] public ILookupParameter<DoubleValue> TourLengthWithMoveParameter { get; private set; }
 
     [StorableConstructor]
     protected TSPMoveEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPMoveEvaluator(TSPMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
-    protected TSPMoveEvaluator()
-      : base() {
-      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of a TSP solution."));
-      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The evaluated quality of a move on a TSP solution."));
+    protected TSPMoveEvaluator(TSPMoveEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+      TSPTourParameter = cloner.Clone(original.TSPTourParameter);
+      TSPDataParameter = cloner.Clone(original.TSPDataParameter);
+      TourLengthParameter = cloner.Clone(original.TourLengthParameter);
+      TourLengthWithMoveParameter = cloner.Clone(original.TourLengthWithMoveParameter);
     }
+    public TSPMoveEvaluator() {
+      Parameters.Add(TSPTourParameter = new LookupParameter<Permutation>("TSPTour", "The tour that describes a solution to the TSP."));
+      Parameters.Add(TSPDataParameter = new LookupParameter<ITSPData>("TSPData", "The main parameters of the TSP."));
+      Parameters.Add(TourLengthParameter = new LookupParameter<DoubleValue>("TourLength", "The length of a TSP tour."));
+      Parameters.Add(TourLengthWithMoveParameter = new LookupParameter<DoubleValue>("TourLengthWithMove", "The length of the TSP tour if the move was applied."));
+    }
+
+    public sealed override IOperation Apply() {
+      var tour = TSPTourParameter.ActualValue;
+      var tspData = TSPDataParameter.ActualValue;
+      var tourLength = TourLengthParameter.ActualValue.Value;
+      TourLengthWithMoveParameter.ActualValue = new DoubleValue(
+        CalculateTourLengthWithMove(tspData, tour, tourLength)
+      );
+      return base.Apply();
+    }
+
+    protected abstract double CalculateTourLengthWithMove(ITSPData tspData, Permutation tspTour, double tourLength);
   }
 }
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPPathMoveEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPPathMoveEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,109 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HeuristicLab.Parameters;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// A base class for operators which evaluate TSP solutions.
-  /// </summary>
-  [Item("TSPMoveEvaluator", "A base class for operators which evaluate TSP moves.")]
-  [StorableType("F4EEA3B3-BA91-4391-903B-2EDBD47CF439")]
-  public abstract class TSPPathMoveEvaluator : TSPMoveEvaluator, ITSPPathMoveEvaluator {
-    public ILookupParameter<Permutation> PermutationParameter {
-      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
-    }
-    public ILookupParameter<DoubleMatrix> CoordinatesParameter {
-      get { return (ILookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
-    }
-    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (ILookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    public ILookupParameter<BoolValue> UseDistanceMatrixParameter {
-      get { return (ILookupParameter<BoolValue>)Parameters["UseDistanceMatrix"]; }
-    }
-
-    [StorableConstructor]
-    protected TSPPathMoveEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPPathMoveEvaluator(TSPPathMoveEvaluator original, Cloner cloner) : base(original, cloner) { }
-    protected TSPPathMoveEvaluator()
-      : base() {
-      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
-      Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The city's coordinates."));
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      Parameters.Add(new LookupParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated (if it does not exist already) and used for evaluation, otherwise false."));
-    }
-
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      // BackwardsCompatibility3.3
-      #region Backwards compatible code (remove with 3.4)
-      LookupParameter<DoubleMatrix> oldDistanceMatrixParameter = Parameters["DistanceMatrix"] as LookupParameter<DoubleMatrix>;
-      if (oldDistanceMatrixParameter != null) {
-        Parameters.Remove(oldDistanceMatrixParameter);
-        Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-        DistanceMatrixParameter.ActualName = oldDistanceMatrixParameter.ActualName;
-      }
-      #endregion
-    }
-
-    public override IOperation Apply() {
-      Permutation permutation = PermutationParameter.ActualValue;
-      DoubleMatrix coordinates = CoordinatesParameter.ActualValue;
-      double relativeQualityDifference = 0;
-      if (UseDistanceMatrixParameter.ActualValue.Value) {
-        DistanceMatrix distanceMatrix = DistanceMatrixParameter.ActualValue;
-        if (distanceMatrix == null) {
-          if (coordinates == null) throw new InvalidOperationException("Neither a distance matrix nor coordinates were given.");
-          distanceMatrix = CalculateDistanceMatrix(coordinates);
-          DistanceMatrixParameter.ActualValue = distanceMatrix;
-        }
-        relativeQualityDifference = EvaluateByDistanceMatrix(permutation, distanceMatrix);
-      } else {
-        if (coordinates == null) throw new InvalidOperationException("No coordinates were given.");
-        relativeQualityDifference = EvaluateByCoordinates(permutation, coordinates);
-      }
-      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
-      if (moveQuality == null) MoveQualityParameter.ActualValue = new DoubleValue(QualityParameter.ActualValue.Value + relativeQualityDifference);
-      else moveQuality.Value = QualityParameter.ActualValue.Value + relativeQualityDifference;
-      return base.Apply();
-    }
-
-    protected abstract double CalculateDistance(double x1, double y1, double x2, double y2);
-    protected abstract double EvaluateByDistanceMatrix(Permutation permutation, DistanceMatrix distanceMatrix);
-    protected abstract double EvaluateByCoordinates(Permutation permutation, DoubleMatrix coordinates);
-
-    private DistanceMatrix CalculateDistanceMatrix(DoubleMatrix c) {
-      DistanceMatrix distanceMatrix = new DistanceMatrix(c.Rows, c.Rows);
-      for (int i = 0; i < distanceMatrix.Rows; i++) {
-        for (int j = 0; j < distanceMatrix.Columns; j++)
-          distanceMatrix[i, j] = CalculateDistance(c[i, 0], c[i, 1], c[j, 0], c[j, 1]);
-      }
-      return (DistanceMatrix)distanceMatrix.AsReadOnly();
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveDistanceMatrixEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveDistanceMatrixEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,79 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HeuristicLab.Parameters;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate inversion moves (2-opt).
-  /// </summary>
-  [Item("TSPTranslocationMoveDistanceMatrixEvaluator", "Evaluates a translocation or insertion move (3-opt).")]
-  [StorableType("895EF1F3-6FE0-43C0-A6D4-7EEAB7B06841")]
-  public class TSPTranslocationMoveDistanceMatrixEvaluator : TSPMoveEvaluator, IPermutationTranslocationMoveOperator {
-    public override Type EvaluatorType {
-      get { return typeof(TSPDistanceMatrixEvaluator); }
-    }
-
-    public ILookupParameter<Permutation> PermutationParameter {
-      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
-    }
-    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (ILookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
-      get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
-    }
-
-    [StorableConstructor]
-    protected TSPTranslocationMoveDistanceMatrixEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPTranslocationMoveDistanceMatrixEvaluator(TSPTranslocationMoveDistanceMatrixEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPTranslocationMoveDistanceMatrixEvaluator()
-      : base() {
-      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPTranslocationMoveDistanceMatrixEvaluator(this, cloner);
-    }
-
-    public override IOperation Apply() {
-      var permutation = PermutationParameter.ActualValue;
-      double relativeQualityDifference = 0;
-      var distanceMatrix = DistanceMatrixParameter.ActualValue;
-      if (distanceMatrix == null) throw new InvalidOperationException("The distance matrix is not given.");
-      var move = TranslocationMoveParameter.ActualValue;
-      relativeQualityDifference = TSPTranslocationMovePathEvaluator.EvaluateByDistanceMatrix(permutation, move, distanceMatrix);
-
-      var moveQuality = MoveQualityParameter.ActualValue;
-      if (moveQuality == null) MoveQualityParameter.ActualValue = new DoubleValue(QualityParameter.ActualValue.Value + relativeQualityDifference);
-      else moveQuality.Value = QualityParameter.ActualValue.Value + relativeQualityDifference;
-      return base.Apply();
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveEuclideanPathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveEuclideanPathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,51 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate translocation or insertion moves (3-opt).
-  /// </summary>
-  [Item("TSPTranslocationMoveEuclideanPathEvaluator", "Operator for evaluating a translocation or insertion move (3-opt) based on euclidean distances.")]
-  [StorableType("7686F16C-12E5-4FE8-8417-BA32B39D8817")]
-  public class TSPTranslocationMoveEuclideanPathEvaluator : TSPTranslocationMovePathEvaluator {
-    [StorableConstructor]
-    protected TSPTranslocationMoveEuclideanPathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPTranslocationMoveEuclideanPathEvaluator(TSPTranslocationMoveEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPTranslocationMoveEuclideanPathEvaluator() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPTranslocationMoveEuclideanPathEvaluator(this, cloner);
-    }
-    
-    public override Type EvaluatorType {
-      get { return typeof(TSPEuclideanPathEvaluator); }
-    }
-
-    protected override double CalculateDistance(double x1, double y1, double x2, double y2) {
-      return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
-    }
-  }
-}
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveEvaluator.cs	(revision 17241)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveEvaluator.cs	(revision 17241)
@@ -0,0 +1,89 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.TravelingSalesman {
+  /// <summary>
+  /// An operator to evaluate a translocation or insertion move.
+  /// </summary>
+  [Item("TSP Translocation Move Evaluator", "Evaluates a translocation or insertion move (3-opt) by an efficient delta computation.")]
+  [StorableType("3f13bc93-778e-4b9b-8285-1b807886a653")]
+  public class TSPTranslocationMoveEvaluator : TSPMoveEvaluator, IPermutationTranslocationMoveOperator {
+    [Storable] public ILookupParameter<TranslocationMove> MoveParameter { get; private set; }
+
+    ILookupParameter<TranslocationMove> IPermutationTranslocationMoveOperator.TranslocationMoveParameter => MoveParameter;
+    ILookupParameter<Permutation> IPermutationMoveOperator.PermutationParameter => TSPTourParameter;
+
+    [StorableConstructor]
+    protected TSPTranslocationMoveEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected TSPTranslocationMoveEvaluator(TSPTranslocationMoveEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+      MoveParameter = cloner.Clone(original.MoveParameter);
+    }
+    public TSPTranslocationMoveEvaluator()
+      : base() {
+      Parameters.Add(MoveParameter = new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TSPTranslocationMoveEvaluator(this, cloner);
+    }
+
+    protected override double CalculateTourLengthWithMove(ITSPData tspData, Permutation tspTour, double tourLength) {
+      var move = MoveParameter.ActualValue;
+      return CalculateTourLengthDelta(tspData, tspTour, move);
+    }
+
+    public static double CalculateTourLengthDelta(ITSPData tspData, Permutation tspTour, TranslocationMove move) {
+      if (move.Index1 == move.Index3
+        || move.Index2 == tspTour.Length - 1 && move.Index3 == 0
+        || move.Index1 == 0 && move.Index3 == tspTour.Length - 1 - move.Index2) return 0;
+
+      int edge1source = tspTour.GetCircular(move.Index1 - 1);
+      int edge1target = tspTour[move.Index1];
+      int edge2source = tspTour[move.Index2];
+      int edge2target = tspTour.GetCircular(move.Index2 + 1);
+      int edge3source, edge3target;
+      if (move.Index3 > move.Index1) {
+        edge3source = tspTour.GetCircular(move.Index3 + move.Index2 - move.Index1);
+        edge3target = tspTour.GetCircular(move.Index3 + move.Index2 - move.Index1 + 1);
+      } else {
+        edge3source = tspTour.GetCircular(move.Index3 - 1);
+        edge3target = tspTour[move.Index3];
+      }
+      double moveQuality = 0;
+      // remove three edges
+      moveQuality -= tspData.GetDistance(edge1source, edge1target);
+      moveQuality -= tspData.GetDistance(edge2source, edge2target);
+      moveQuality -= tspData.GetDistance(edge3source, edge3target);
+      // add three edges
+      moveQuality += tspData.GetDistance(edge3source, edge1target);
+      moveQuality += tspData.GetDistance(edge2source, edge3target);
+      moveQuality += tspData.GetDistance(edge1source, edge2target);
+      return moveQuality;
+    }
+  }
+}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveGeoPathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveGeoPathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,81 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate translocation or insertion moves (3-opt).
-  /// </summary>
-  [Item("TSPTranslocationMoveGeoPathEvaluator", "Operator for evaluating a translocation or insertion move (3-opt) based on geo (world) distances.")]
-  [StorableType("3CCF9099-547F-44A3-9279-99ED96F7ACCD")]
-  public class TSPTranslocationMoveGeoPathEvaluator : TSPTranslocationMovePathEvaluator {
-    public override Type EvaluatorType {
-      get { return typeof(TSPGeoPathEvaluator); }
-    }
-
-    private const double PI = 3.141592;
-    private const double RADIUS = 6378.388;
-
-    [StorableConstructor]
-    protected TSPTranslocationMoveGeoPathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPTranslocationMoveGeoPathEvaluator(TSPTranslocationMoveGeoPathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPTranslocationMoveGeoPathEvaluator() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPTranslocationMoveGeoPathEvaluator(this, cloner);
-    }
-    
-
-    /// <summary>
-    /// Calculates the distance between two points using the GEO distance metric (globe coordinates).
-    /// </summary>
-    /// <param name="x1">The x-coordinate of point 1.</param>
-    /// <param name="y1">The y-coordinate of point 1.</param>
-    /// <param name="x2">The x-coordinate of point 2.</param>
-    /// <param name="y2">The y-coordinate of point 2.</param>
-    /// <returns>The calculated distance.</returns>
-    protected override double CalculateDistance(double x1, double y1, double x2, double y2) {
-      double latitude1, longitude1, latitude2, longitude2;
-      double q1, q2, q3;
-      double length;
-
-      latitude1 = ConvertToRadian(x1);
-      longitude1 = ConvertToRadian(y1);
-      latitude2 = ConvertToRadian(x2);
-      longitude2 = ConvertToRadian(y2);
-
-      q1 = Math.Cos(longitude1 - longitude2);
-      q2 = Math.Cos(latitude1 - latitude2);
-      q3 = Math.Cos(latitude1 + latitude2);
-
-      length = (int)(RADIUS * Math.Acos(0.5 * ((1.0 + q1) * q2 - (1.0 - q1) * q3)) + 1.0);
-      return (length);
-    }
-
-    private double ConvertToRadian(double x) {
-      return PI * (Math.Truncate(x) + 5.0 * (x - Math.Truncate(x)) / 3.0) / 180.0;
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMovePathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMovePathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,120 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HeuristicLab.Parameters;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate a translocation or insertion move.
-  /// </summary>
-  [Item("TSPTranslocationMovePathEvaluator", "Evaluates a translocation or insertion move (3-opt) by summing up the length of all added edges and subtracting the length of all deleted edges.")]
-  [StorableType("DC2FBCA3-B75F-4DA2-974E-334083159D93")]
-  public abstract class TSPTranslocationMovePathEvaluator : TSPPathMoveEvaluator, IPermutationTranslocationMoveOperator {
-    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
-      get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
-    }
-
-    [StorableConstructor]
-    protected TSPTranslocationMovePathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPTranslocationMovePathEvaluator(TSPTranslocationMovePathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPTranslocationMovePathEvaluator()
-      : base() {
-      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate."));
-    }
-
-    public static double EvaluateByCoordinates(Permutation permutation, TranslocationMove move, DoubleMatrix coordinates, TSPTranslocationMovePathEvaluator evaluator) {
-      if (move.Index1 == move.Index3
-        || move.Index2 == permutation.Length - 1 && move.Index3 == 0
-        || move.Index1 == 0 && move.Index3 == permutation.Length - 1 - move.Index2) return 0;
-
-      int edge1source = permutation.GetCircular(move.Index1 - 1);
-      int edge1target = permutation[move.Index1];
-      int edge2source = permutation[move.Index2];
-      int edge2target = permutation.GetCircular(move.Index2 + 1);
-      int edge3source, edge3target;
-      if (move.Index3 > move.Index1) {
-        edge3source = permutation.GetCircular(move.Index3 + move.Index2 - move.Index1);
-        edge3target = permutation.GetCircular(move.Index3 + move.Index2 - move.Index1 + 1);
-      } else {
-        edge3source = permutation.GetCircular(move.Index3 - 1);
-        edge3target = permutation[move.Index3];
-      }
-      double moveQuality = 0;
-      // remove three edges
-      moveQuality -= evaluator.CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1],
-        coordinates[edge1target, 0], coordinates[edge1target, 1]);
-      moveQuality -= evaluator.CalculateDistance(coordinates[edge2source, 0], coordinates[edge2source, 1],
-        coordinates[edge2target, 0], coordinates[edge2target, 1]);
-      moveQuality -= evaluator.CalculateDistance(coordinates[edge3source, 0], coordinates[edge3source, 1],
-        coordinates[edge3target, 0], coordinates[edge3target, 1]);
-      // add three edges
-      moveQuality += evaluator.CalculateDistance(coordinates[edge3source, 0], coordinates[edge3source, 1],
-        coordinates[edge1target, 0], coordinates[edge1target, 1]);
-      moveQuality += evaluator.CalculateDistance(coordinates[edge2source, 0], coordinates[edge2source, 1],
-        coordinates[edge3target, 0], coordinates[edge3target, 1]);
-      moveQuality += evaluator.CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1],
-        coordinates[edge2target, 0], coordinates[edge2target, 1]);
-      return moveQuality;
-    }
-
-    public static double EvaluateByDistanceMatrix(Permutation permutation, TranslocationMove move, DistanceMatrix distanceMatrix) {
-      if (move.Index1 == move.Index3
-        || move.Index2 == permutation.Length - 1 && move.Index3 == 0
-        || move.Index1 == 0 && move.Index3 == permutation.Length - 1 - move.Index2) return 0;
-
-      int edge1source = permutation.GetCircular(move.Index1 - 1);
-      int edge1target = permutation[move.Index1];
-      int edge2source = permutation[move.Index2];
-      int edge2target = permutation.GetCircular(move.Index2 + 1);
-      int edge3source, edge3target;
-      if (move.Index3 > move.Index1) {
-        edge3source = permutation.GetCircular(move.Index3 + move.Index2 - move.Index1);
-        edge3target = permutation.GetCircular(move.Index3 + move.Index2 - move.Index1 + 1);
-      } else {
-        edge3source = permutation.GetCircular(move.Index3 - 1);
-        edge3target = permutation[move.Index3];
-      }
-      double moveQuality = 0;
-      // remove three edges
-      moveQuality -= distanceMatrix[edge1source, edge1target];
-      moveQuality -= distanceMatrix[edge2source, edge2target];
-      moveQuality -= distanceMatrix[edge3source, edge3target];
-      // add three edges
-      moveQuality += distanceMatrix[edge3source, edge1target];
-      moveQuality += distanceMatrix[edge2source, edge3target];
-      moveQuality += distanceMatrix[edge1source, edge2target];
-      return moveQuality;
-    }
-
-    protected override double EvaluateByCoordinates(Permutation permutation, DoubleMatrix coordinates) {
-      return EvaluateByCoordinates(permutation, TranslocationMoveParameter.ActualValue, coordinates, this);
-    }
-
-    protected override double EvaluateByDistanceMatrix(Permutation permutation, DistanceMatrix distanceMatrix) {
-      return EvaluateByDistanceMatrix(permutation, TranslocationMoveParameter.ActualValue, distanceMatrix);
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveRoundedEuclideanPathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveRoundedEuclideanPathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,51 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate translocation or insertion moves (3-opt).
-  /// </summary>
-  [Item("TSPTranslocationMoveRoundedEuclideanPathEvaluator", "Operator for evaluating a translocation or insertion move (3-opt) based on rounded euclidean distances.")]
-  [StorableType("AA52F35B-DEE3-4B21-A953-07773D4ED5BC")]
-  public class TSPTranslocationMoveRoundedEuclideanPathEvaluator : TSPTranslocationMovePathEvaluator {
-    [StorableConstructor]
-    protected TSPTranslocationMoveRoundedEuclideanPathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPTranslocationMoveRoundedEuclideanPathEvaluator(TSPTranslocationMoveRoundedEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPTranslocationMoveRoundedEuclideanPathEvaluator() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPTranslocationMoveRoundedEuclideanPathEvaluator(this, cloner);
-    }
-    
-    public override Type EvaluatorType {
-      get { return typeof(TSPRoundedEuclideanPathEvaluator); }
-    }
-
-    protected override double CalculateDistance(double x1, double y1, double x2, double y2) {
-      return Math.Round(Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveDistanceMatrixEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveDistanceMatrixEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,79 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HeuristicLab.Parameters;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate inversion moves (2-opt).
-  /// </summary>
-  [Item("TSPInversionMoveDistanceMatrixEvaluator", "Evaluates an inversion move (2-opt) by summing up the length of all added edges and subtracting the length of all deleted edges.")]
-  [StorableType("1EA2C5B2-96E0-4C64-9089-F08F6D2B1CAE")]
-  public class TSPInversionMoveDistanceMatrixEvaluator : TSPMoveEvaluator, IPermutationInversionMoveOperator {
-    public override Type EvaluatorType {
-      get { return typeof(TSPDistanceMatrixEvaluator); }
-    }
-
-    public ILookupParameter<Permutation> PermutationParameter {
-      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
-    }
-    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (ILookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    public ILookupParameter<InversionMove> InversionMoveParameter {
-      get { return (ILookupParameter<InversionMove>)Parameters["InversionMove"]; }
-    }
-
-    [StorableConstructor]
-    protected TSPInversionMoveDistanceMatrixEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPInversionMoveDistanceMatrixEvaluator(TSPInversionMoveDistanceMatrixEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPInversionMoveDistanceMatrixEvaluator()
-      : base() {
-      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate."));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPInversionMoveDistanceMatrixEvaluator(this, cloner);
-    }
-
-    public override IOperation Apply() {
-      var permutation = PermutationParameter.ActualValue;
-      double relativeQualityDifference = 0;
-      var distanceMatrix = DistanceMatrixParameter.ActualValue;
-      if (distanceMatrix == null) throw new InvalidOperationException("The distance matrix is not given.");
-      var move = InversionMoveParameter.ActualValue;
-      relativeQualityDifference = TSPInversionMovePathEvaluator.EvaluateByDistanceMatrix(permutation, move, distanceMatrix);
-
-      var moveQuality = MoveQualityParameter.ActualValue;
-      if (moveQuality == null) MoveQualityParameter.ActualValue = new DoubleValue(QualityParameter.ActualValue.Value + relativeQualityDifference);
-      else moveQuality.Value = QualityParameter.ActualValue.Value + relativeQualityDifference;
-      return base.Apply();
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveEuclideanPathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveEuclideanPathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,51 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate 2-opt moves.
-  /// </summary>
-  [Item("TSPInversionMoveEuclideanPathEvaluator", "Operator for evaluating an inversion move (2-opt) based on euclidean distances.")]
-  [StorableType("856F5D88-FBD5-4DC9-AC52-60C402B83F21")]
-  public class TSPInversionMoveEuclideanPathEvaluator : TSPInversionMovePathEvaluator {
-    [StorableConstructor]
-    protected TSPInversionMoveEuclideanPathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPInversionMoveEuclideanPathEvaluator(TSPInversionMoveEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPInversionMoveEuclideanPathEvaluator() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPInversionMoveEuclideanPathEvaluator(this, cloner);
-    }
-    
-    public override Type EvaluatorType {
-      get { return typeof(TSPEuclideanPathEvaluator); }
-    }
-
-    protected override double CalculateDistance(double x1, double y1, double x2, double y2) {
-      return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
-    }
-  }
-}
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveEvaluator.cs	(revision 17241)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveEvaluator.cs	(revision 17241)
@@ -0,0 +1,52 @@
+﻿using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Problems.TravelingSalesman {
+  [Item("TSP Inversion Move Evaluator", "Evaluates the quality of an inversion move based on an efficient delta computation.")]
+  [StorableType("74ac2d20-2371-4f4c-8796-1f318d1b33c0")]
+  public class TSPInversionMoveEvaluator : TSPMoveEvaluator, IPermutationInversionMoveOperator {
+    [Storable] public ILookupParameter<InversionMove> MoveParameter { get; private set; }
+
+    ILookupParameter<InversionMove> IPermutationInversionMoveOperator.InversionMoveParameter => MoveParameter;
+    ILookupParameter<Permutation> IPermutationMoveOperator.PermutationParameter => TSPTourParameter;
+
+    [StorableConstructor]
+    protected TSPInversionMoveEvaluator(StorableConstructorFlag _) : base(_) { }
+    protected TSPInversionMoveEvaluator(TSPInversionMoveEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+      MoveParameter = cloner.Clone(original.MoveParameter);
+    }
+    public TSPInversionMoveEvaluator()
+      : base() {
+      Parameters.Add(MoveParameter = new LookupParameter<InversionMove>("Move", "The inversion move that is to be evaluated."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TSPInversionMoveEvaluator(this, cloner);
+    }
+
+    protected override double CalculateTourLengthWithMove(ITSPData tspData, Permutation tspTour, double tourLength) {
+      var move = MoveParameter.ActualValue;
+      return CalculateTourLengthDelta(tspData, tspTour, move);
+    }
+
+    public static double CalculateTourLengthDelta(ITSPData tspData, Permutation tspTour, InversionMove move) {
+      int edge1source = tspTour.GetCircular(move.Index1 - 1);
+      int edge1target = tspTour[move.Index1];
+      int edge2source = tspTour[move.Index2];
+      int edge2target = tspTour.GetCircular(move.Index2 + 1);
+      if (move.Index2 - move.Index1 >= tspTour.Length - 2) return 0;
+      double moveQuality = 0;
+      // remove two edges
+      moveQuality -= tspData.GetDistance(edge1source, edge1target);
+      moveQuality -= tspData.GetDistance(edge2source, edge2target);
+      // add two edges
+      moveQuality += tspData.GetDistance(edge1source, edge2source);
+      moveQuality += tspData.GetDistance(edge1target, edge2target);
+      return moveQuality;
+    }
+  }
+}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveGeoPathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveGeoPathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,80 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate inversion moves (2-opt).
-  /// </summary>
-  [Item("TSPInversionMoveGeoPathEvaluator", "Operator for evaluating an inversion move (2-opt) based on geo (world) distances.")]
-  [StorableType("DCBB9049-6C89-4249-BB7D-314B7C62E9E6")]
-  public class TSPInversionMoveGeoPathEvaluator : TSPInversionMovePathEvaluator {
-    public override Type EvaluatorType {
-      get { return typeof(TSPGeoPathEvaluator); }
-    }
-
-    private const double PI = 3.141592;
-    private const double RADIUS = 6378.388;
-
-    [StorableConstructor]
-    protected TSPInversionMoveGeoPathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPInversionMoveGeoPathEvaluator(TSPInversionMoveGeoPathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPInversionMoveGeoPathEvaluator() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPInversionMoveGeoPathEvaluator(this, cloner);
-    }
-    
-    /// <summary>
-    /// Calculates the distance between two points using the GEO distance metric (globe coordinates).
-    /// </summary>
-    /// <param name="x1">The x-coordinate of point 1.</param>
-    /// <param name="y1">The y-coordinate of point 1.</param>
-    /// <param name="x2">The x-coordinate of point 2.</param>
-    /// <param name="y2">The y-coordinate of point 2.</param>
-    /// <returns>The calculated distance.</returns>
-    protected override double CalculateDistance(double x1, double y1, double x2, double y2) {
-      double latitude1, longitude1, latitude2, longitude2;
-      double q1, q2, q3;
-      double length;
-
-      latitude1 = ConvertToRadian(x1);
-      longitude1 = ConvertToRadian(y1);
-      latitude2 = ConvertToRadian(x2);
-      longitude2 = ConvertToRadian(y2);
-
-      q1 = Math.Cos(longitude1 - longitude2);
-      q2 = Math.Cos(latitude1 - latitude2);
-      q3 = Math.Cos(latitude1 + latitude2);
-
-      length = (int)(RADIUS * Math.Acos(0.5 * ((1.0 + q1) * q2 - (1.0 - q1) * q3)) + 1.0);
-      return (length);
-    }
-
-    private double ConvertToRadian(double x) {
-      return PI * (Math.Truncate(x) + 5.0 * (x - Math.Truncate(x)) / 3.0) / 180.0;
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMovePathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMovePathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,92 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Encodings.PermutationEncoding;
-using HeuristicLab.Parameters;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate inversion moves (2-opt).
-  /// </summary>
-  [Item("TSPInversionMovePathEvaluator", "Evaluates an inversion move (2-opt) by summing up the length of all added edges and subtracting the length of all deleted edges.")]
-  [StorableType("0D180690-C01E-4F64-94D9-C6F713EA195B")]
-  public abstract class TSPInversionMovePathEvaluator : TSPPathMoveEvaluator, IPermutationInversionMoveOperator {
-    public ILookupParameter<InversionMove> InversionMoveParameter {
-      get { return (ILookupParameter<InversionMove>)Parameters["InversionMove"]; }
-    }
-
-    [StorableConstructor]
-    protected TSPInversionMovePathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPInversionMovePathEvaluator(TSPInversionMovePathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPInversionMovePathEvaluator()
-      : base() {
-      Parameters.Add(new LookupParameter<InversionMove>("InversionMove", "The move to evaluate."));
-    }
-
-    public static double EvaluateByCoordinates(Permutation permutation, InversionMove move, DoubleMatrix coordinates, TSPInversionMovePathEvaluator evaluator) {
-      int edge1source = permutation.GetCircular(move.Index1 - 1);
-      int edge1target = permutation[move.Index1];
-      int edge2source = permutation[move.Index2];
-      int edge2target = permutation.GetCircular(move.Index2 + 1);
-      if (move.Index2 - move.Index1 >= permutation.Length - 2) return 0;
-      double moveQuality = 0;
-      // remove two edges
-      moveQuality -= evaluator.CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1],
-            coordinates[edge1target, 0], coordinates[edge1target, 1]);
-      moveQuality -= evaluator.CalculateDistance(coordinates[edge2source, 0], coordinates[edge2source, 1],
-        coordinates[edge2target, 0], coordinates[edge2target, 1]);
-      // add two edges
-      moveQuality += evaluator.CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1],
-        coordinates[edge2source, 0], coordinates[edge2source, 1]);
-      moveQuality += evaluator.CalculateDistance(coordinates[edge1target, 0], coordinates[edge1target, 1],
-        coordinates[edge2target, 0], coordinates[edge2target, 1]);
-      return moveQuality;
-    }
-
-    public static double EvaluateByDistanceMatrix(Permutation permutation, InversionMove move, DistanceMatrix distanceMatrix) {
-      int edge1source = permutation.GetCircular(move.Index1 - 1);
-      int edge1target = permutation[move.Index1];
-      int edge2source = permutation[move.Index2];
-      int edge2target = permutation.GetCircular(move.Index2 + 1);
-      if (move.Index2 - move.Index1 >= permutation.Length - 2) return 0;
-      double moveQuality = 0;
-      // remove two edges
-      moveQuality -= distanceMatrix[edge1source, edge1target];
-      moveQuality -= distanceMatrix[edge2source, edge2target];
-      // add two edges
-      moveQuality += distanceMatrix[edge1source, edge2source];
-      moveQuality += distanceMatrix[edge1target, edge2target];
-      return moveQuality;
-    }
-
-    protected override double EvaluateByCoordinates(Permutation permutation, DoubleMatrix coordinates) {
-      return EvaluateByCoordinates(permutation, InversionMoveParameter.ActualValue, coordinates, this);
-    }
-
-    protected override double EvaluateByDistanceMatrix(Permutation permutation, DistanceMatrix distanceMatrix) {
-      return EvaluateByDistanceMatrix(permutation, InversionMoveParameter.ActualValue, distanceMatrix);
-    }
-  }
-}
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveRoundedEuclideanPathEvaluator.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveRoundedEuclideanPathEvaluator.cs	(revision 17240)
+++ 	(revision )
@@ -1,51 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 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 HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// An operator to evaluate inversion moves (2-opt).
-  /// </summary>
-  [Item("TSPInversionMoveRoundedEuclideanPathEvaluator", "Operator for evaluating an inversion move (2-opt) based on rounded euclidean distances.")]
-  [StorableType("84BE355F-BC76-4765-885F-CFCAEDA93DFD")]
-  public class TSPInversionMoveRoundedEuclideanPathEvaluator : TSPInversionMovePathEvaluator {
-    [StorableConstructor]
-    protected TSPInversionMoveRoundedEuclideanPathEvaluator(StorableConstructorFlag _) : base(_) { }
-    protected TSPInversionMoveRoundedEuclideanPathEvaluator(TSPInversionMoveRoundedEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { }
-    public TSPInversionMoveRoundedEuclideanPathEvaluator() : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TSPInversionMoveRoundedEuclideanPathEvaluator(this, cloner);
-    }
-    
-    public override Type EvaluatorType {
-      get { return typeof(TSPRoundedEuclideanPathEvaluator); }
-    }
-
-    protected override double CalculateDistance(double x1, double y1, double x2, double y2) {
-      return Math.Round(Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
-    }
-  }
-}
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPMultipleGuidesPathRelinker.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPMultipleGuidesPathRelinker.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPMultipleGuidesPathRelinker.cs	(revision 17241)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -29,5 +30,4 @@
 using HeuristicLab.Optimization.Operators;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
@@ -39,26 +39,17 @@
   /// </remarks>
   [Item("TSPMultipleGuidesPathRelinker", "An operator that relinks paths between traveling salesman solutions using a multiple guiding strategy. The operator incrementally changes the initiating solution towards the guiding solution by correcting edges as needed. For each city it choses the best edge from all guiding solutions.")]
-  [StorableType("6B5B2622-AB1D-47E6-8BBC-C6088D393149")]
+  [StorableType("13e879fd-7621-402e-9345-7dbfdd78e3b6")]
   public sealed class TSPMultipleGuidesPathRelinker : SingleObjectivePathRelinker {
-    #region Parameter properties
-    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (ILookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    #endregion
-
-    #region Properties
-    public DistanceMatrix DistanceMatrix {
-      get { return DistanceMatrixParameter.ActualValue; }
-    }
-    #endregion
+    [Storable] public ILookupParameter<ITSPData> TSPDataParameter { get; private set; }
 
     [StorableConstructor]
     private TSPMultipleGuidesPathRelinker(StorableConstructorFlag _) : base(_) { }
-    private TSPMultipleGuidesPathRelinker(TSPMultipleGuidesPathRelinker original, Cloner cloner) : base(original, cloner) { }
+    private TSPMultipleGuidesPathRelinker(TSPMultipleGuidesPathRelinker original, Cloner cloner)
+      : base(original, cloner) {
+      TSPDataParameter = cloner.Clone(original.TSPDataParameter);
+    }
     public TSPMultipleGuidesPathRelinker()
       : base() {
-      #region Create parameters
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      #endregion
+      Parameters.Add(TSPDataParameter = new LookupParameter<ITSPData>("TSPData", "The main parameters of the TSP."));
     }
 
@@ -67,5 +58,5 @@
     }
 
-    public static ItemArray<IItem> Apply(IItem initiator, IItem[] guides, DistanceMatrix distances, PercentValue n) {
+    public static ItemArray<IItem> Apply(IItem initiator, IItem[] guides, ITSPData tspData, PercentValue n) {
       if (!(initiator is Permutation) || guides.Any(x => !(x is Permutation)))
         throw new ArgumentException("Cannot relink path because some of the provided solutions have the wrong type.");
@@ -84,5 +75,5 @@
         int currCityIndex = i;
         int bestCityIndex = (i + 1) % v1.Length;
-        double currDistance = distances[v1[currCityIndex], v1[bestCityIndex]];
+        double currDistance = tspData.GetDistance(v1[currCityIndex], v1[bestCityIndex]);
         // check each guiding solution
         targets.ToList().ForEach(solution => {
@@ -92,5 +83,5 @@
           int succ = solution[(node.Index + 1) % solution.Length];
           // get distances to neighbors
-          var results = new[] { pred, succ }.Select(x => new { Id = x, Distance = distances[x, node.Id] });
+          var results = new[] { pred, succ }.Select(x => new { Id = x, Distance = tspData.GetDistance(x, node.Id) });
           var bestCity = results.Where(x => x.Distance < currDistance).OrderBy(x => x.Distance).FirstOrDefault();
           if (bestCity != null) {
@@ -129,5 +120,5 @@
       if (parents.Length < 2)
         throw new ArgumentException("The number of parents is smaller than 2.");
-      return Apply(parents[0], parents.Skip(1).ToArray(), DistanceMatrix, n);
+      return Apply(parents[0], parents.Skip(1).ToArray(), TSPDataParameter.ActualValue, n);
     }
   }
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPPathRelinker.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPPathRelinker.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPPathRelinker.cs	(revision 17241)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,7 +29,7 @@
 using HeuristicLab.Encodings.PermutationEncoding;
 using HeuristicLab.Optimization.Operators;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
+
   /// <summary>
   /// An operator that relinks paths between traveling salesman solutions.
@@ -38,5 +39,5 @@
   /// </remarks>
   [Item("TSPPathRelinker", "An operator that relinks paths between traveling salesman solutions. The operator incrementally assimilates the initiating solution into the guiding solution by correcting edges as needed.")]
-  [StorableType("0997A24C-0592-4CE4-A681-70C97890D3F7")]
+  [StorableType("a2c5de50-a050-4269-b80e-1c995eb51626")]
   public sealed class TSPPathRelinker : SingleObjectivePathRelinker {
     [StorableConstructor]
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPSimultaneousPathRelinker.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPSimultaneousPathRelinker.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathRelinkers/TSPSimultaneousPathRelinker.cs	(revision 17241)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -28,5 +29,4 @@
 using HeuristicLab.Encodings.PermutationEncoding;
 using HeuristicLab.Optimization.Operators;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
@@ -38,5 +38,5 @@
   /// </remarks>
   [Item("TSPSimultaneousPathRelinker", "An operator that relinks paths between traveling salesman solutions starting from both ends. The operator incrementally assimilates the initiating solution into the guiding solution and vice versa by correcting edges as needed.")]
-  [StorableType("D44D112E-5139-4848-8A2B-66CFC5784EE4")]
+  [StorableType("73457ec0-1d71-4d9f-b646-2ba3639317e2")]
   public sealed class TSPSimultaneousPathRelinker : SingleObjectivePathRelinker {
     [StorableConstructor]
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs	(revision 17240)
+++ 	(revision )
@@ -1,185 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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.Drawing;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.PermutationEncoding;
-using HEAL.Attic;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  /// <summary>
-  /// Represents a tour of a Traveling Salesman Problem given in path representation which can be visualized in the GUI.
-  /// </summary>
-  [Item("PathTSPTour", "Represents a tour of a Traveling Salesman Problem given in path representation which can be visualized in the GUI.")]
-  [StorableType("2CAE7C49-751B-4802-9025-62E2268E47AE")]
-  public sealed class PathTSPTour : Item {
-    public static new Image StaticItemImage {
-      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
-    }
-
-    [Storable]
-    private DoubleMatrix coordinates;
-    public DoubleMatrix Coordinates {
-      get { return coordinates; }
-      set {
-        if (coordinates != value) {
-          if (coordinates != null) DeregisterCoordinatesEvents();
-          coordinates = value;
-          if (coordinates != null) RegisterCoordinatesEvents();
-          OnCoordinatesChanged();
-        }
-      }
-    }
-    [Storable]
-    private Permutation permutation;
-    public Permutation Permutation {
-      get { return permutation; }
-      set {
-        if (permutation != value) {
-          if (permutation != null) DeregisterPermutationEvents();
-          permutation = value;
-          if (permutation != null) RegisterPermutationEvents();
-          OnPermutationChanged();
-        }
-      }
-    }
-    [Storable]
-    private DoubleValue quality;
-    public DoubleValue Quality {
-      get { return quality; }
-      set {
-        if (quality != value) {
-          if (quality != null) DeregisterQualityEvents();
-          quality = value;
-          if (quality != null) RegisterQualityEvents();
-          OnQualityChanged();
-        }
-      }
-    }
-
-    [StorableConstructor]
-    private PathTSPTour(StorableConstructorFlag _) : base(_) { }
-    private PathTSPTour(PathTSPTour original, Cloner cloner)
-      : base(original, cloner) {
-      this.coordinates = cloner.Clone(original.coordinates);
-      this.permutation = cloner.Clone(original.permutation);
-      this.quality = cloner.Clone(original.quality);
-      Initialize();
-    }
-    public PathTSPTour() : base() { }
-    public PathTSPTour(DoubleMatrix coordinates)
-      : base() {
-      this.coordinates = coordinates;
-      Initialize();
-    }
-    public PathTSPTour(DoubleMatrix coordinates, Permutation permutation)
-      : base() {
-      this.coordinates = coordinates;
-      this.permutation = permutation;
-      Initialize();
-    }
-    public PathTSPTour(DoubleMatrix coordinates, Permutation permutation, DoubleValue quality)
-      : base() {
-      this.coordinates = coordinates;
-      this.permutation = permutation;
-      this.quality = quality;
-      Initialize();
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new PathTSPTour(this, cloner);
-    }
-
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      Initialize();
-    }
-
-    private void Initialize() {
-      if (coordinates != null) RegisterCoordinatesEvents();
-      if (permutation != null) RegisterPermutationEvents();
-      if (quality != null) RegisterQualityEvents();
-    }
-
-    #region Events
-    public event EventHandler CoordinatesChanged;
-    private void OnCoordinatesChanged() {
-      var changed = CoordinatesChanged;
-      if (changed != null)
-        changed(this, EventArgs.Empty);
-    }
-    public event EventHandler PermutationChanged;
-    private void OnPermutationChanged() {
-      var changed = PermutationChanged;
-      if (changed != null)
-        changed(this, EventArgs.Empty);
-    }
-    public event EventHandler QualityChanged;
-    private void OnQualityChanged() {
-      var changed = QualityChanged;
-      if (changed != null)
-        changed(this, EventArgs.Empty);
-    }
-
-    private void RegisterCoordinatesEvents() {
-      Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
-      Coordinates.Reset += new EventHandler(Coordinates_Reset);
-    }
-    private void DeregisterCoordinatesEvents() {
-      Coordinates.ItemChanged -= new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
-      Coordinates.Reset -= new EventHandler(Coordinates_Reset);
-    }
-    private void RegisterPermutationEvents() {
-      Permutation.ItemChanged += new EventHandler<EventArgs<int>>(Permutation_ItemChanged);
-      Permutation.Reset += new EventHandler(Permutation_Reset);
-    }
-    private void DeregisterPermutationEvents() {
-      Permutation.ItemChanged -= new EventHandler<EventArgs<int>>(Permutation_ItemChanged);
-      Permutation.Reset -= new EventHandler(Permutation_Reset);
-    }
-    private void RegisterQualityEvents() {
-      Quality.ValueChanged += new EventHandler(Quality_ValueChanged);
-    }
-    private void DeregisterQualityEvents() {
-      Quality.ValueChanged -= new EventHandler(Quality_ValueChanged);
-    }
-
-    private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) {
-      OnCoordinatesChanged();
-    }
-    private void Coordinates_Reset(object sender, EventArgs e) {
-      OnCoordinatesChanged();
-    }
-    private void Permutation_ItemChanged(object sender, EventArgs<int> e) {
-      OnPermutationChanged();
-    }
-    private void Permutation_Reset(object sender, EventArgs e) {
-      OnPermutationChanged();
-    }
-    private void Quality_ValueChanged(object sender, EventArgs e) {
-      OnQualityChanged();
-    }
-    #endregion
-  }
-}
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSP.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSP.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSP.cs	(revision 17241)
@@ -1,3 +1,4 @@
 ﻿using System;
+using System.Linq;
 using HEAL.Attic;
 using HeuristicLab.Common;
@@ -6,4 +7,6 @@
 using HeuristicLab.Encodings.PermutationEncoding;
 using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
 using HeuristicLab.Problems.Instances;
 
@@ -11,28 +14,24 @@
   [Item("Traveling Salesman Problem (TSP)", "Represents a symmetric Traveling Salesman Problem.")]
   [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 100)]
-  [StorableType("60511a03-b8b4-47cd-a119-78f97358a6b0")]
-  public class TSP : SingleObjectiveProblem<PermutationEncoding, Permutation>, IProblemInstanceConsumer<TSPData> {
+  [StorableType("8415476a-69de-45ad-95be-298ed7c97e84")]
+  public class TSP : PermutationProblem, IProblemInstanceConsumer<TSPData> {
+    /// <summary>
+    /// This limit governs when a distance matrix is used. For all problems smaller than that, the distance matrix is
+    /// computed. This greatly speeds up computation time.
+    /// </summary>
     public static int DistanceMatrixSizeLimit { get; set; } = 1000;
 
     public override bool Maximization => false;
 
-    [Storable]
-    private IValueParameter<ITSPData> tspDataParameter;
-    public IValueParameter<ITSPData> TSPDataParameter {
-      get { return tspDataParameter; }
-    }
-    [Storable]
-    private IValueParameter<Permutation> bestKnownSolutionParameter;
-    public IValueParameter<Permutation> BestKnownSolutionParameter {
-      get { return bestKnownSolutionParameter; }
-    }
+    [Storable] public IValueParameter<ITSPData> TSPDataParameter { get; private set; }
+    [Storable] public IValueParameter<Permutation> BestKnownSolutionParameter { get; private set; }
 
     public ITSPData TSPData {
-      get { return tspDataParameter.Value; }
-      set { tspDataParameter.Value = value; }
+      get { return TSPDataParameter.Value; }
+      set { TSPDataParameter.Value = value; }
     }
     public Permutation BestKnownSolution {
-      get { return bestKnownSolutionParameter.Value; }
-      set { bestKnownSolutionParameter.Value = value; }
+      get { return BestKnownSolutionParameter.Value; }
+      set { BestKnownSolutionParameter.Value = value; }
     }
 
@@ -42,10 +41,13 @@
     protected TSP(TSP original, Cloner cloner)
       : base(original, cloner) {
-      tspDataParameter = cloner.Clone(original.tspDataParameter);
-      bestKnownSolutionParameter = cloner.Clone(original.bestKnownSolutionParameter);
+      TSPDataParameter = cloner.Clone(original.TSPDataParameter);
+      BestKnownSolutionParameter = cloner.Clone(original.BestKnownSolutionParameter);
     }
 
     public TSP() : base(new PermutationEncoding("Tour", 16, PermutationTypes.RelativeUndirected)) {
-      TSPData = new RoundedEuclideanCoordinatesTSPData() {
+      Parameters.Add(TSPDataParameter = new ValueParameter<ITSPData>("TSPData", "The main parameters of the TSP."));
+      Parameters.Add(BestKnownSolutionParameter = new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution."));
+      
+      TSPData = new EuclideanTSPData() {
         Coordinates = new DoubleMatrix(new double[,] {
         { 100, 100 }, { 100, 200 }, { 100, 300 }, { 100, 400 },
@@ -53,6 +55,9 @@
         { 300, 100 }, { 300, 200 }, { 300, 300 }, { 300, 400 },
         { 400, 100 }, { 400, 200 }, { 400, 300 }, { 400, 400 }
-        })
+        }),
+        Rounding = EuclideanTSPData.RoundingMode.Midpoint
       };
+
+      InitializeOperators();
     }
 
@@ -72,4 +77,22 @@
       tourLength += TSPData.GetDistance(tour[tour.Length - 1], tour[0]);
       return tourLength;
+    }
+
+    public override void Analyze(Permutation[] solutions, double[] qualities, ResultCollection results, IRandom random) {
+      base.Analyze(solutions, qualities, results, random);
+      int i = -1;
+      if (!Maximization)
+        i = qualities.Select((x, index) => new { index, Fitness = x }).OrderBy(x => x.Fitness).First().index;
+      else i = qualities.Select((x, index) => new { index, Fitness = x }).OrderByDescending(x => x.Fitness).First().index;
+
+      if (double.IsNaN(BestKnownQuality) ||
+          Maximization && qualities[i] > BestKnownQuality ||
+          !Maximization && qualities[i] < BestKnownQuality) {
+        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i]);
+        BestKnownSolutionParameter.ActualValue = (Permutation)solutions[i].Clone();
+      }
+
+      var solution = TSPData.GetSolution(solutions[i], qualities[i]);
+      results.AddOrUpdateResult("Best TSP Solution", solution);
     }
 
@@ -84,4 +107,5 @@
         throw new System.IO.InvalidDataException("The coordinates of the given instance are not in the right format, there need to be one row for each customer and two columns for the x and y coordinates.");
 
+      Encoding.Length = data.Dimension;
       Name = data.Name;
       Description = data.Description;
@@ -97,14 +121,14 @@
         switch (data.DistanceMeasure) {
           case DistanceMeasure.Euclidean:
-            throw new NotImplementedException();
+            TSPData = new EuclideanTSPData(data.Coordinates) { Rounding = EuclideanTSPData.RoundingMode.None };
             break;
           case DistanceMeasure.RoundedEuclidean:
-            TSPData = new RoundedEuclideanCoordinatesTSPData(data.Coordinates);
+            TSPData = new EuclideanTSPData(data.Coordinates) { Rounding = EuclideanTSPData.RoundingMode.Midpoint };
             break;
           case DistanceMeasure.UpperEuclidean:
-            throw new NotImplementedException();
+            TSPData = new EuclideanTSPData(data.Coordinates) { Rounding = EuclideanTSPData.RoundingMode.Ceiling };
             break;
           case DistanceMeasure.Geo:
-            throw new NotImplementedException();
+            TSPData = new GeoTSPData(data.Coordinates);
             break;
           default:
@@ -128,4 +152,58 @@
       OnReset();
     }
+
+    protected override void OnEncodingChanged() {
+      base.OnEncodingChanged();
+      ParameterizeOperators();
+    }
+
+    protected override void OnEvaluatorChanged() {
+      base.OnEvaluatorChanged();
+      ParameterizeOperators();
+    }
+
+    private void InitializeOperators() {
+      Operators.Add(new TSPImprovementOperator());
+      Operators.Add(new TSPMultipleGuidesPathRelinker());
+      Operators.Add(new TSPPathRelinker());
+      Operators.Add(new TSPSimultaneousPathRelinker());
+
+      Operators.Add(new TSPAlleleFrequencyAnalyzer());
+      foreach (var op in ApplicationManager.Manager.GetInstances<ITSPMoveEvaluator>())
+        Operators.Add(op);
+
+      ParameterizeOperators();
+    }
+
+    private void ParameterizeOperators() {
+      foreach (var op in Operators.OfType<TSPAlleleFrequencyAnalyzer>()) {
+        op.MaximizationParameter.ActualName = MaximizationParameter.Name;
+        op.TSPDataParameter.ActualName = TSPDataParameter.Name;
+        op.SolutionParameter.ActualName = Encoding.Name;
+        op.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
+        op.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
+        op.ResultsParameter.ActualName = "Results";
+      }
+      foreach (var op in Operators.OfType<ITSPMoveEvaluator>()) {
+        op.TSPDataParameter.ActualName = TSPDataParameter.Name;
+        op.TSPDataParameter.Hidden = true;
+        op.TourLengthParameter.ActualName = Evaluator.QualityParameter.ActualName;
+        op.TourLengthParameter.Hidden = true;
+        op.TSPTourParameter.ActualName = Encoding.Name;
+        op.TSPTourParameter.Hidden = true;
+      }
+      foreach (var op in Operators.OfType<ISingleObjectiveImprovementOperator>()) {
+        op.SolutionParameter.ActualName = Encoding.Name;
+        op.SolutionParameter.Hidden = true;
+      }
+      foreach (ISingleObjectivePathRelinker op in Operators.OfType<ISingleObjectivePathRelinker>()) {
+        op.ParentsParameter.ActualName = Encoding.Name;
+        op.ParentsParameter.Hidden = true;
+      }
+      foreach (ISolutionSimilarityCalculator op in Operators.OfType<ISolutionSimilarityCalculator>()) {
+        op.SolutionVariableName = Encoding.Name;
+        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
+      }
+    }
   }
 }
Index: /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSPData.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSPData.cs	(revision 17240)
+++ /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSPData.cs	(revision 17241)
@@ -1,7 +1,10 @@
 ﻿using System;
+using System.ComponentModel;
+using System.Drawing;
 using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
 
 namespace HeuristicLab.Problems.TravelingSalesman {
@@ -9,51 +12,12 @@
   public interface ITSPData : IItem {
     double GetDistance(int fromCity, int toCity);
-  }
-
-  [Item("Coordinates-based TSP Data", "TSP that is represented by coordinates of cities.")]
-  [StorableType("3955d07a-d43c-4a01-9505-d2effb1ea865")]
-  public abstract class CoordinatesTSPData : Item, ITSPData {
-    [Storable]
-    public DoubleMatrix Coordinates { get; set; }
-
-    [StorableConstructor]
-    protected CoordinatesTSPData(StorableConstructorFlag _) : base(_) { }
-    protected CoordinatesTSPData(CoordinatesTSPData original, Cloner cloner) : base(original, cloner) {
-      Coordinates = cloner.Clone(original.Coordinates);
-    }
-    protected CoordinatesTSPData() : base() {
-      Coordinates = new DoubleMatrix();
-    }
-    protected CoordinatesTSPData(double[,] coordinates) : base() {
-      if (coordinates == null) throw new ArgumentNullException(nameof(coordinates));
-      if (coordinates.GetLength(1) != 2) throw new ArgumentException("Argument must have exactly two columns.", nameof(coordinates));
-      Coordinates = new DoubleMatrix(coordinates);
-    }
-
-    public double GetDistance(int fromCity, int toCity) {
-      return GetDistance(Coordinates[fromCity, 0], Coordinates[fromCity, 1],
-        Coordinates[toCity, 0], Coordinates[toCity, 1]);
-    }
-
-    public abstract double GetDistance(double fromX, double fromY, double toX, double toY);
-  }
-
-  [Item("Euclidean (rounded) TSP Data", "TSP that is represented by coordinates and a rounded euclidean distance measure.")]
-  [StorableType("4bf58348-cd98-46c5-a4c0-55f486ca88b4")]
-  public sealed class RoundedEuclideanCoordinatesTSPData : CoordinatesTSPData {
-
-    [StorableConstructor]
-    private RoundedEuclideanCoordinatesTSPData(StorableConstructorFlag _) : base(_) { }
-    private RoundedEuclideanCoordinatesTSPData(RoundedEuclideanCoordinatesTSPData original, Cloner cloner) : base(original, cloner) { }
-    public RoundedEuclideanCoordinatesTSPData() : base() { }
-    public RoundedEuclideanCoordinatesTSPData(double[,] coordinates) : base(coordinates) { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new RoundedEuclideanCoordinatesTSPData(this, cloner);
-    }
-
-    public override double GetDistance(double fromX, double fromY, double toX, double toY) {
-      return Math.Round(Math.Sqrt((fromX - toX) * (fromX - toX) + (fromY - toY) * (fromY - toY)));
-    }
+    ITSPSolution GetSolution(Permutation tspTour, double tourLength);
+  }
+
+  [StorableType("f08a63d9-0b83-4944-9251-42925baeb872")]
+  public interface ITSPSolution : IItem {
+    DoubleMatrix Coordinates { get; }
+    Permutation Tour { get; }
+    DoubleValue TourLength { get; }
   }
 
@@ -84,4 +48,8 @@
       if (DisplayCoordinates != null && DisplayCoordinates.Rows != Matrix.GetLength(0))
         throw new ArgumentException("Unequal number of rows in " + nameof(matrix) + " and " + nameof(coordinates) + ".");
+    }
+
+    public ITSPSolution GetSolution(Permutation tour, double tourLength) {
+      return new PathTSPTour(DisplayCoordinates, tour, new DoubleValue(tourLength));
     }
 
@@ -111,3 +79,181 @@
     public double GetDistance(int fromCity, int toCity) => Matrix[fromCity, toCity];
   }
+
+  [Item("Coordinates-based TSP Data", "TSP that is represented by coordinates of locations.")]
+  [StorableType("3955d07a-d43c-4a01-9505-d2effb1ea865")]
+  public abstract class CoordinatesTSPData : Item, ITSPData {
+    [Storable]
+    public DoubleMatrix Coordinates { get; set; }
+
+    [StorableConstructor]
+    protected CoordinatesTSPData(StorableConstructorFlag _) : base(_) { }
+    protected CoordinatesTSPData(CoordinatesTSPData original, Cloner cloner) : base(original, cloner) {
+      Coordinates = cloner.Clone(original.Coordinates);
+    }
+    protected CoordinatesTSPData() : base() {
+      Coordinates = new DoubleMatrix();
+    }
+    protected CoordinatesTSPData(double[,] coordinates) : base() {
+      if (coordinates == null) throw new ArgumentNullException(nameof(coordinates));
+      if (coordinates.GetLength(1) != 2) throw new ArgumentException("Argument must have exactly two columns.", nameof(coordinates));
+      Coordinates = new DoubleMatrix(coordinates);
+    }
+
+    public double GetDistance(int fromCity, int toCity) {
+      return GetDistance(Coordinates[fromCity, 0], Coordinates[fromCity, 1],
+        Coordinates[toCity, 0], Coordinates[toCity, 1]);
+    }
+
+    public abstract double GetDistance(double fromX, double fromY, double toX, double toY);
+
+    public ITSPSolution GetSolution(Permutation tour, double tourLength) {
+      return new PathTSPTour(Coordinates, tour, new DoubleValue(tourLength));
+    }
+  }
+
+  [Item("Euclidean TSP Data", "TSP that is represented by coordinates in an Euclidean plane.")]
+  [StorableType("4bf58348-cd98-46c5-a4c0-55f486ca88b4")]
+  public sealed class EuclideanTSPData : CoordinatesTSPData {
+    public enum RoundingMode { None, Midpoint, Ceiling }
+
+    [Storable]
+    public RoundingMode Rounding { get; set; }
+
+    [StorableConstructor]
+    private EuclideanTSPData(StorableConstructorFlag _) : base(_) { }
+    private EuclideanTSPData(EuclideanTSPData original, Cloner cloner) : base(original, cloner) {
+      Rounding = original.Rounding;
+    }
+    public EuclideanTSPData() : base() { }
+    public EuclideanTSPData(double[,] coordinates) : base(coordinates) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EuclideanTSPData(this, cloner);
+    }
+
+    public override double GetDistance(double fromX, double fromY, double toX, double toY) {
+      var dist = Math.Sqrt((fromX - toX) * (fromX - toX) + (fromY - toY) * (fromY - toY));
+      switch (Rounding) {
+        case RoundingMode.None: return dist;
+        case RoundingMode.Midpoint: return Math.Round(dist);
+        case RoundingMode.Ceiling: return Math.Ceiling(dist);
+        default: throw new InvalidOperationException("Unknown rounding mode " + Rounding);
+      }
+    }
+  }
+
+  [Item("Geo TSP Data", "TSP that is represented by geo coordinates.")]
+  [StorableType("4bf58348-cd98-46c5-a4c0-55f486ca88b4")]
+  public sealed class GeoTSPData : CoordinatesTSPData {
+    public const double PI = 3.141592;
+    public const double RADIUS = 6378.388;
+
+    [StorableConstructor]
+    private GeoTSPData(StorableConstructorFlag _) : base(_) { }
+    private GeoTSPData(GeoTSPData original, Cloner cloner) : base(original, cloner) { }
+    public GeoTSPData() : base() { }
+    public GeoTSPData(double[,] coordinates) : base(coordinates) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GeoTSPData(this, cloner);
+    }
+
+    public override double GetDistance(double fromX, double fromY, double toX, double toY) {
+      double latitude1, longitude1, latitude2, longitude2;
+      double q1, q2, q3;
+      double length;
+
+      latitude1 = ConvertToRadian(fromX);
+      longitude1 = ConvertToRadian(fromY);
+      latitude2 = ConvertToRadian(toX);
+      longitude2 = ConvertToRadian(toY);
+
+      q1 = Math.Cos(longitude1 - longitude2);
+      q2 = Math.Cos(latitude1 - latitude2);
+      q3 = Math.Cos(latitude1 + latitude2);
+
+      length = (int)(RADIUS * Math.Acos(0.5 * ((1.0 + q1) * q2 - (1.0 - q1) * q3)) + 1.0);
+      return (length);
+    }
+
+    private double ConvertToRadian(double x) {
+      return PI * (Math.Truncate(x) + 5.0 * (x - Math.Truncate(x)) / 3.0) / 180.0;
+    }
+  }
+  /// <summary>
+  /// Represents a tour of a Traveling Salesman Problem given in path representation which can be visualized in the GUI.
+  /// </summary>
+  [Item("PathTSPTour", "Represents a tour of a Traveling Salesman Problem given in path representation which can be visualized in the GUI.")]
+  [StorableType("2CAE7C49-751B-4802-9025-62E2268E47AE")]
+  public sealed class PathTSPTour : Item, ITSPSolution, INotifyPropertyChanged {
+    public static new Image StaticItemImage {
+      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
+    }
+
+    [Storable]
+    private DoubleMatrix coordinates;
+    public DoubleMatrix Coordinates {
+      get { return coordinates; }
+      set {
+        if (coordinates == value) return;
+        coordinates = value;
+        OnPropertyChanged(nameof(Coordinates));
+      }
+    }
+
+    [Storable(Name = "tour", OldName = "permutation")]
+    private Permutation tour;
+    public Permutation Tour {
+      get { return tour; }
+      set {
+        if (tour == value) return;
+        tour = value;
+        OnPropertyChanged(nameof(Tour));
+      }
+    }
+    [Storable(Name = "tourLength", OldName = "quality")]
+    private DoubleValue tourLength;
+    public DoubleValue TourLength {
+      get { return tourLength; }
+      set {
+        if (tourLength == value) return;
+        tourLength = value;
+        OnPropertyChanged(nameof(TourLength));
+      }
+    }
+
+    [StorableConstructor]
+    private PathTSPTour(StorableConstructorFlag _) : base(_) { }
+    private PathTSPTour(PathTSPTour original, Cloner cloner)
+      : base(original, cloner) {
+      this.coordinates = cloner.Clone(original.coordinates);
+      this.tour = cloner.Clone(original.tour);
+      this.tourLength = cloner.Clone(original.tourLength);
+    }
+    public PathTSPTour() : base() { }
+    public PathTSPTour(DoubleMatrix coordinates)
+      : base() {
+      this.coordinates = coordinates;
+    }
+    public PathTSPTour(DoubleMatrix coordinates, Permutation permutation)
+      : base() {
+      this.coordinates = coordinates;
+      this.tour = permutation;
+    }
+    public PathTSPTour(DoubleMatrix coordinates, Permutation permutation, DoubleValue quality)
+      : base() {
+      this.coordinates = coordinates;
+      this.tour = permutation;
+      this.tourLength = quality;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new PathTSPTour(this, cloner);
+    }
+
+    public event PropertyChangedEventHandler PropertyChanged;
+    private void OnPropertyChanged(string property) {
+      PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
+    }
+  }
 }
Index: anches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
===================================================================
--- /branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs	(revision 17240)
+++ 	(revision )
@@ -1,460 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 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.IO;
-using System.Linq;
-using HEAL.Attic;
-using HeuristicLab.Analysis;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.PermutationEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Optimization.Operators;
-using HeuristicLab.Parameters;
-using HeuristicLab.PluginInfrastructure;
-using HeuristicLab.Problems.Instances;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  [Item("Traveling Salesman Problem (TSP)", "Represents a symmetric Traveling Salesman Problem.")]
-  [StorableType("F0A3550C-2B8F-497D-BF32-5763F8D7592C")]
-  public sealed class TravelingSalesmanProblem : SingleObjectiveHeuristicOptimizationProblem<ITSPEvaluator, IPermutationCreator>,
-    ISingleObjectiveProblem<PermutationEncoding, Permutation>, IStorableContent, IProblemInstanceConsumer<TSPData> {
-
-    private static readonly int DistanceMatrixSizeLimit = 1000;
-    public string Filename { get; set; }
-
-    #region Parameter Properties
-    public OptionalValueParameter<DoubleMatrix> CoordinatesParameter {
-      get { return (OptionalValueParameter<DoubleMatrix>)Parameters["Coordinates"]; }
-    }
-    public OptionalValueParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (OptionalValueParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    public ValueParameter<BoolValue> UseDistanceMatrixParameter {
-      get { return (ValueParameter<BoolValue>)Parameters["UseDistanceMatrix"]; }
-    }
-    public OptionalValueParameter<Permutation> BestKnownSolutionParameter {
-      get { return (OptionalValueParameter<Permutation>)Parameters["BestKnownSolution"]; }
-    }
-    #endregion
-
-    #region Properties
-    public DoubleMatrix Coordinates {
-      get { return CoordinatesParameter.Value; }
-      set { CoordinatesParameter.Value = value; }
-    }
-    public DistanceMatrix DistanceMatrix {
-      get { return DistanceMatrixParameter.Value; }
-      set { DistanceMatrixParameter.Value = value; }
-    }
-    public BoolValue UseDistanceMatrix {
-      get { return UseDistanceMatrixParameter.Value; }
-      set { UseDistanceMatrixParameter.Value = value; }
-    }
-    public Permutation BestKnownSolution {
-      get { return BestKnownSolutionParameter.Value; }
-      set { BestKnownSolutionParameter.Value = value; }
-    }
-    private BestTSPSolutionAnalyzer BestTSPSolutionAnalyzer {
-      get { return Operators.OfType<BestTSPSolutionAnalyzer>().FirstOrDefault(); }
-    }
-    private TSPAlleleFrequencyAnalyzer TSPAlleleFrequencyAnalyzer {
-      get { return Operators.OfType<TSPAlleleFrequencyAnalyzer>().FirstOrDefault(); }
-    }
-    #endregion
-
-    // BackwardsCompatibility3.3
-    #region Backwards compatible code, remove with 3.4
-    [Obsolete]
-    [Storable(Name = "operators")]
-    private IEnumerable<IOperator> oldOperators {
-      get { return null; }
-      set {
-        if (value != null && value.Any())
-          Operators.AddRange(value);
-      }
-    }
-    #endregion
-
-    [StorableConstructor]
-    private TravelingSalesmanProblem(StorableConstructorFlag _) : base(_) { }
-    private TravelingSalesmanProblem(TravelingSalesmanProblem original, Cloner cloner)
-      : base(original, cloner) {
-      RegisterEventHandlers();
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TravelingSalesmanProblem(this, cloner);
-    }
-    public TravelingSalesmanProblem()
-      : base(new TSPRoundedEuclideanPathEvaluator(), new RandomPermutationCreator()) {
-      Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities."));
-      Parameters.Add(new OptionalValueParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if the coordinates based evaluators should calculate the distance matrix from the coordinates and use it for evaluation similar to the distance matrix evaluator, otherwise false.", new BoolValue(true)));
-      Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance."));
-
-      Maximization.Value = false;
-      MaximizationParameter.Hidden = true;
-      UseDistanceMatrixParameter.Hidden = true;
-      DistanceMatrixParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false;
-
-      Coordinates = new DoubleMatrix(new double[,] {
-        { 100, 100 }, { 100, 200 }, { 100, 300 }, { 100, 400 },
-        { 200, 100 }, { 200, 200 }, { 200, 300 }, { 200, 400 },
-        { 300, 100 }, { 300, 200 }, { 300, 300 }, { 300, 400 },
-        { 400, 100 }, { 400, 200 }, { 400, 300 }, { 400, 400 }
-      });
-
-      SolutionCreator.PermutationParameter.ActualName = "TSPTour";
-      Evaluator.QualityParameter.ActualName = "TSPTourLength";
-      ParameterizeSolutionCreator();
-      ParameterizeEvaluator();
-
-      InitializeOperators();
-      RegisterEventHandlers();
-    }
-
-    #region Events
-    protected override void OnSolutionCreatorChanged() {
-      base.OnSolutionCreatorChanged();
-      SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
-      ParameterizeSolutionCreator();
-      ParameterizeEvaluator();
-      ParameterizeAnalyzers();
-      ParameterizeOperators();
-    }
-    protected override void OnEvaluatorChanged() {
-      base.OnEvaluatorChanged();
-      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
-      ParameterizeEvaluator();
-      ParameterizeSolutionCreator();
-      UpdateMoveEvaluators();
-      ParameterizeAnalyzers();
-      if (Evaluator is ITSPCoordinatesPathEvaluator && Coordinates != null)
-        ClearDistanceMatrix();
-    }
-    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
-      if (Coordinates != null) {
-        Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
-        Coordinates.Reset += new EventHandler(Coordinates_Reset);
-      }
-      if (Evaluator is ITSPCoordinatesPathEvaluator) {
-        ParameterizeSolutionCreator();
-        ClearDistanceMatrix();
-      }
-    }
-    private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) {
-      if (Evaluator is ITSPCoordinatesPathEvaluator) {
-        ClearDistanceMatrix();
-      }
-    }
-    private void Coordinates_Reset(object sender, EventArgs e) {
-      if (Evaluator is ITSPCoordinatesPathEvaluator) {
-        ParameterizeSolutionCreator();
-        ClearDistanceMatrix();
-      }
-    }
-    private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) {
-      ParameterizeEvaluator();
-      ParameterizeAnalyzers();
-      ParameterizeOperators();
-    }
-    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
-      ParameterizeAnalyzers();
-    }
-    #endregion
-
-    #region Helpers
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      // BackwardsCompatibility3.3
-      #region Backwards compatible code (remove with 3.4)
-      OptionalValueParameter<DoubleMatrix> oldDistanceMatrixParameter = Parameters["DistanceMatrix"] as OptionalValueParameter<DoubleMatrix>;
-      if (oldDistanceMatrixParameter != null) {
-        Parameters.Remove(oldDistanceMatrixParameter);
-        Parameters.Add(new OptionalValueParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-        DistanceMatrixParameter.GetsCollected = oldDistanceMatrixParameter.GetsCollected;
-        DistanceMatrixParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false;
-        if (oldDistanceMatrixParameter.Value != null) {
-          DoubleMatrix oldDM = oldDistanceMatrixParameter.Value;
-          DistanceMatrix newDM = new DistanceMatrix(oldDM.Rows, oldDM.Columns, oldDM.ColumnNames, oldDM.RowNames);
-          newDM.SortableView = oldDM.SortableView;
-          for (int i = 0; i < newDM.Rows; i++)
-            for (int j = 0; j < newDM.Columns; j++)
-              newDM[i, j] = oldDM[i, j];
-          DistanceMatrixParameter.Value = (DistanceMatrix)newDM.AsReadOnly();
-        }
-      }
-
-      ValueParameter<DoubleMatrix> oldCoordinates = (Parameters["Coordinates"] as ValueParameter<DoubleMatrix>);
-      if (oldCoordinates != null) {
-        Parameters.Remove(oldCoordinates);
-        Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", oldCoordinates.Value) { GetsCollected = oldCoordinates.GetsCollected });
-      }
-
-      if (Operators.Count == 0) InitializeOperators();
-      #endregion
-      RegisterEventHandlers();
-    }
-
-    private void RegisterEventHandlers() {
-      CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
-      if (Coordinates != null) {
-        Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
-        Coordinates.Reset += new EventHandler(Coordinates_Reset);
-      }
-      SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
-      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
-    }
-
-    private void InitializeOperators() {
-      Operators.Add(new TSPImprovementOperator());
-      Operators.Add(new TSPMultipleGuidesPathRelinker());
-      Operators.Add(new TSPPathRelinker());
-      Operators.Add(new TSPSimultaneousPathRelinker());
-
-      Operators.Add(new HammingSimilarityCalculator());
-      Operators.Add(new QualitySimilarityCalculator());
-      Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>()));
-
-      Operators.Add(new BestTSPSolutionAnalyzer());
-      Operators.Add(new TSPAlleleFrequencyAnalyzer());
-      ParameterizeAnalyzers();
-      var operators = new HashSet<IPermutationOperator>(new IPermutationOperator[] {
-        new OrderCrossover2(),
-        new InversionManipulator(),
-        new StochasticInversionMultiMoveGenerator()
-      }, new TypeEqualityComparer<IPermutationOperator>());
-      foreach (var op in ApplicationManager.Manager.GetInstances<IPermutationOperator>())
-        operators.Add(op);
-      Operators.AddRange(operators);
-      ParameterizeOperators();
-      UpdateMoveEvaluators();
-    }
-    private void UpdateMoveEvaluators() {
-      Operators.RemoveAll(x => x is ISingleObjectiveMoveEvaluator);
-      foreach (var op in ApplicationManager.Manager.GetInstances<ITSPMoveEvaluator>())
-        if (op.EvaluatorType == Evaluator.GetType()) {
-          Operators.Add(op);
-        }
-      ParameterizeOperators();
-      OnOperatorsChanged();
-    }
-    private void ParameterizeSolutionCreator() {
-      if (Evaluator is ITSPDistanceMatrixEvaluator && DistanceMatrix != null)
-        SolutionCreator.LengthParameter.Value = new IntValue(DistanceMatrix.Rows);
-      else if (Evaluator is ITSPCoordinatesPathEvaluator && Coordinates != null)
-        SolutionCreator.LengthParameter.Value = new IntValue(Coordinates.Rows);
-      else {
-        SolutionCreator.LengthParameter.Value = null;
-        string error = "The given problem does not support the selected evaluator.";
-        if (Evaluator is ITSPDistanceMatrixEvaluator)
-          error += Environment.NewLine + "Please review that the " + DistanceMatrixParameter.Name + " parameter is defined or choose another evaluator.";
-        else error += Environment.NewLine + "Please review that the " + CoordinatesParameter.Name + " parameter is defined or choose another evaluator.";
-        PluginInfrastructure.ErrorHandling.ShowErrorDialog(error, null);
-      }
-      SolutionCreator.LengthParameter.Hidden = SolutionCreator.LengthParameter.Value != null;
-      SolutionCreator.PermutationTypeParameter.Value = new PermutationType(PermutationTypes.RelativeUndirected);
-      SolutionCreator.PermutationTypeParameter.Hidden = true;
-    }
-    private void ParameterizeEvaluator() {
-      if (Evaluator is ITSPPathEvaluator) {
-        ITSPPathEvaluator evaluator = (ITSPPathEvaluator)Evaluator;
-        evaluator.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        evaluator.PermutationParameter.Hidden = true;
-      }
-      if (Evaluator is ITSPCoordinatesPathEvaluator) {
-        ITSPCoordinatesPathEvaluator evaluator = (ITSPCoordinatesPathEvaluator)Evaluator;
-        evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        evaluator.CoordinatesParameter.Hidden = true;
-        evaluator.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
-        evaluator.DistanceMatrixParameter.Hidden = true;
-        evaluator.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
-        evaluator.UseDistanceMatrixParameter.Hidden = true;
-      }
-      if (Evaluator is ITSPDistanceMatrixEvaluator) {
-        var evaluator = (ITSPDistanceMatrixEvaluator)Evaluator;
-        evaluator.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
-        evaluator.DistanceMatrixParameter.Hidden = true;
-      }
-    }
-    private void ParameterizeAnalyzers() {
-      if (BestTSPSolutionAnalyzer != null) {
-        BestTSPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
-        BestTSPSolutionAnalyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        BestTSPSolutionAnalyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        BestTSPSolutionAnalyzer.ResultsParameter.ActualName = "Results";
-        BestTSPSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
-        BestTSPSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
-        BestTSPSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
-      }
-
-      if (TSPAlleleFrequencyAnalyzer != null) {
-        TSPAlleleFrequencyAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
-        TSPAlleleFrequencyAnalyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        TSPAlleleFrequencyAnalyzer.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
-        TSPAlleleFrequencyAnalyzer.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        TSPAlleleFrequencyAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
-        TSPAlleleFrequencyAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
-        TSPAlleleFrequencyAnalyzer.ResultsParameter.ActualName = "Results";
-      }
-    }
-    private void ParameterizeOperators() {
-      foreach (IPermutationCrossover op in Operators.OfType<IPermutationCrossover>()) {
-        op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.ParentsParameter.Hidden = true;
-        op.ChildParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.ChildParameter.Hidden = true;
-      }
-      foreach (IPermutationManipulator op in Operators.OfType<IPermutationManipulator>()) {
-        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.PermutationParameter.Hidden = true;
-      }
-      foreach (IPermutationMoveOperator op in Operators.OfType<IPermutationMoveOperator>()) {
-        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.PermutationParameter.Hidden = true;
-      }
-      foreach (ITSPPathMoveEvaluator op in Operators.OfType<ITSPPathMoveEvaluator>()) {
-        op.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        op.CoordinatesParameter.Hidden = true;
-        op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
-        op.DistanceMatrixParameter.Hidden = true;
-        op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
-        op.UseDistanceMatrixParameter.Hidden = true;
-        op.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
-        op.QualityParameter.Hidden = true;
-        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.PermutationParameter.Hidden = true;
-      }
-      foreach (IPermutationMultiNeighborhoodShakingOperator op in Operators.OfType<IPermutationMultiNeighborhoodShakingOperator>()) {
-        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.PermutationParameter.Hidden = true;
-      }
-      foreach (ISingleObjectiveImprovementOperator op in Operators.OfType<ISingleObjectiveImprovementOperator>()) {
-        op.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.SolutionParameter.Hidden = true;
-      }
-      foreach (ISingleObjectivePathRelinker op in Operators.OfType<ISingleObjectivePathRelinker>()) {
-        op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.ParentsParameter.Hidden = true;
-      }
-      foreach (ISolutionSimilarityCalculator op in Operators.OfType<ISolutionSimilarityCalculator>()) {
-        op.SolutionVariableName = SolutionCreator.PermutationParameter.ActualName;
-        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
-      }
-    }
-
-    private void ClearDistanceMatrix() {
-      DistanceMatrixParameter.Value = null;
-    }
-    #endregion
-
-    public void Load(TSPData data) {
-      if (data.Coordinates == null && data.Distances == null)
-        throw new System.IO.InvalidDataException("The given instance specifies neither coordinates nor distances!");
-      if (data.Dimension > DistanceMatrixSizeLimit && (data.DistanceMeasure == DistanceMeasure.Att
-        || data.DistanceMeasure == DistanceMeasure.Manhattan
-        || data.DistanceMeasure == DistanceMeasure.Maximum))
-        throw new System.IO.InvalidDataException("The given instance uses an unsupported distance measure and is too large for using a distance matrix.");
-      if (data.Coordinates != null && data.Coordinates.GetLength(1) != 2)
-        throw new System.IO.InvalidDataException("The coordinates of the given instance are not in the right format, there need to be one row for each customer and two columns for the x and y coordinates.");
-
-      Name = data.Name;
-      Description = data.Description;
-
-      bool clearCoordinates = false, clearDistanceMatrix = false;
-      if (data.Coordinates != null && data.Coordinates.GetLength(0) > 0)
-        Coordinates = new DoubleMatrix(data.Coordinates);
-      else clearCoordinates = true;
-
-      TSPEvaluator evaluator;
-      if (data.DistanceMeasure == DistanceMeasure.Att
-        || data.DistanceMeasure == DistanceMeasure.Manhattan
-        || data.DistanceMeasure == DistanceMeasure.Maximum) {
-        evaluator = new TSPDistanceMatrixEvaluator();
-        UseDistanceMatrix = new BoolValue(true);
-        DistanceMatrix = new DistanceMatrix(data.GetDistanceMatrix());
-      } else if (data.DistanceMeasure == DistanceMeasure.Direct && data.Distances != null) {
-        evaluator = new TSPDistanceMatrixEvaluator();
-        UseDistanceMatrix = new BoolValue(true);
-        DistanceMatrix = new DistanceMatrix(data.Distances);
-      } else {
-        clearDistanceMatrix = true;
-        UseDistanceMatrix = new BoolValue(data.Dimension <= DistanceMatrixSizeLimit);
-        switch (data.DistanceMeasure) {
-          case DistanceMeasure.Euclidean:
-            evaluator = new TSPEuclideanPathEvaluator();
-            break;
-          case DistanceMeasure.RoundedEuclidean:
-            evaluator = new TSPRoundedEuclideanPathEvaluator();
-            break;
-          case DistanceMeasure.UpperEuclidean:
-            evaluator = new TSPUpperEuclideanPathEvaluator();
-            break;
-          case DistanceMeasure.Geo:
-            evaluator = new TSPGeoPathEvaluator();
-            break;
-          default:
-            throw new InvalidDataException("An unknown distance measure is given in the instance!");
-        }
-      }
-      evaluator.QualityParameter.ActualName = "TSPTourLength";
-      Evaluator = evaluator;
-
-      // reset them after assigning the evaluator
-      if (clearCoordinates) Coordinates = null;
-      if (clearDistanceMatrix) DistanceMatrix = null;
-
-      BestKnownSolution = null;
-      BestKnownQuality = null;
-
-      if (data.BestKnownTour != null) {
-        try {
-          EvaluateAndLoadTour(data.BestKnownTour);
-        }
-        catch (InvalidOperationException) {
-          if (data.BestKnownQuality.HasValue)
-            BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
-        }
-      } else if (data.BestKnownQuality.HasValue) {
-        BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
-      }
-      OnReset();
-    }
-
-    public void EvaluateAndLoadTour(int[] tour) {
-      var route = new Permutation(PermutationTypes.RelativeUndirected, tour);
-      BestKnownSolution = route;
-
-      double quality;
-      if (Evaluator is ITSPDistanceMatrixEvaluator) {
-        quality = TSPDistanceMatrixEvaluator.Apply(DistanceMatrix, route);
-      } else if (Evaluator is ITSPCoordinatesPathEvaluator) {
-        quality = TSPCoordinatesPathEvaluator.Apply((TSPCoordinatesPathEvaluator)Evaluator, Coordinates, route);
-      } else {
-        throw new InvalidOperationException("Cannot calculate solution quality, evaluator type is unknown.");
-      }
-      BestKnownQuality = new DoubleValue(quality);
-    }
-  }
-}
