Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj	(revision 3158)
+++ trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/HeuristicLab.Problems.TravelingSalesman.Views-3.3.csproj	(revision 3159)
@@ -92,4 +92,10 @@
       <DependentUpon>PathTSPTourView.cs</DependentUpon>
     </Compile>
+    <Compile Include="TravelingSalesmanProblemView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="TravelingSalesmanProblemView.Designer.cs">
+      <DependentUpon>TravelingSalesmanProblemView.cs</DependentUpon>
+    </Compile>
     <Compile Include="TSPLIBImportDialog.cs">
       <SubType>Form</SubType>
@@ -97,10 +103,4 @@
     <Compile Include="TSPLIBImportDialog.Designer.cs">
       <DependentUpon>TSPLIBImportDialog.cs</DependentUpon>
-    </Compile>
-    <Compile Include="TSPView.cs">
-      <SubType>UserControl</SubType>
-    </Compile>
-    <Compile Include="TSPView.Designer.cs">
-      <DependentUpon>TSPView.cs</DependentUpon>
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TSPView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TSPView.Designer.cs	(revision 3158)
+++ 	(revision )
@@ -1,174 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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 TSPView {
-    /// <summary> 
-    /// Required designer variable.
-    /// </summary>
-    private System.ComponentModel.IContainer components = null;
-
-    /// <summary> 
-    /// Clean up any resources being used.
-    /// </summary>
-    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-    protected override void Dispose(bool disposing) {
-      if (disposing) {
-        if (tsplibImportDialog != null) tsplibImportDialog.Dispose();
-        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.importButton = new System.Windows.Forms.Button();
-      this.tabControl = new System.Windows.Forms.TabControl();
-      this.parametersTabPage = new System.Windows.Forms.TabPage();
-      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
-      this.visualizationTabPage = new System.Windows.Forms.TabPage();
-      this.pathTSPTourView = new HeuristicLab.Problems.TravelingSalesman.Views.PathTSPTourView();
-      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
-      this.tabControl.SuspendLayout();
-      this.parametersTabPage.SuspendLayout();
-      this.visualizationTabPage.SuspendLayout();
-      this.SuspendLayout();
-      // 
-      // nameTextBox
-      // 
-      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
-      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
-      this.nameTextBox.Size = new System.Drawing.Size(457, 20);
-      // 
-      // descriptionTextBox
-      // 
-      this.descriptionTextBox.Size = new System.Drawing.Size(457, 20);
-      // 
-      // importButton
-      // 
-      this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
-                  | System.Windows.Forms.AnchorStyles.Right)));
-      this.importButton.Location = new System.Drawing.Point(0, 399);
-      this.importButton.Name = "importButton";
-      this.importButton.Size = new System.Drawing.Size(529, 23);
-      this.importButton.TabIndex = 5;
-      this.importButton.Text = "&Import from TSPLIB";
-      this.importButton.UseVisualStyleBackColor = true;
-      this.importButton.Click += new System.EventHandler(this.importButton_Click);
-      // 
-      // tabControl
-      // 
-      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, 52);
-      this.tabControl.Name = "tabControl";
-      this.tabControl.SelectedIndex = 0;
-      this.tabControl.Size = new System.Drawing.Size(529, 341);
-      this.tabControl.TabIndex = 4;
-      // 
-      // parametersTabPage
-      // 
-      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(521, 315);
-      this.parametersTabPage.TabIndex = 0;
-      this.parametersTabPage.Text = "Parameters";
-      this.parametersTabPage.UseVisualStyleBackColor = true;
-      // 
-      // parameterCollectionView
-      // 
-      this.parameterCollectionView.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.parameterCollectionView.Caption = "ParameterCollection";
-      this.parameterCollectionView.Content = null;
-      this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);
-      this.parameterCollectionView.Name = "parameterCollectionView";
-      this.parameterCollectionView.Size = new System.Drawing.Size(509, 303);
-      this.parameterCollectionView.TabIndex = 0;
-      // 
-      // visualizationTabPage
-      // 
-      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(521, 315);
-      this.visualizationTabPage.TabIndex = 1;
-      this.visualizationTabPage.Text = "Visualization";
-      this.visualizationTabPage.UseVisualStyleBackColor = true;
-      // 
-      // 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 = "View";
-      this.pathTSPTourView.Content = null;
-      this.pathTSPTourView.Location = new System.Drawing.Point(6, 6);
-      this.pathTSPTourView.Name = "pathTSPTourView";
-      this.pathTSPTourView.Size = new System.Drawing.Size(509, 303);
-      this.pathTSPTourView.TabIndex = 0;
-      // 
-      // TSPView
-      // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-      this.Controls.Add(this.tabControl);
-      this.Controls.Add(this.importButton);
-      this.Name = "TSPView";
-      this.Size = new System.Drawing.Size(529, 422);
-      this.Controls.SetChildIndex(this.importButton, 0);
-      this.Controls.SetChildIndex(this.tabControl, 0);
-      this.Controls.SetChildIndex(this.nameLabel, 0);
-      this.Controls.SetChildIndex(this.descriptionLabel, 0);
-      this.Controls.SetChildIndex(this.nameTextBox, 0);
-      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
-      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
-      this.tabControl.ResumeLayout(false);
-      this.parametersTabPage.ResumeLayout(false);
-      this.visualizationTabPage.ResumeLayout(false);
-      this.ResumeLayout(false);
-      this.PerformLayout();
-
-    }
-
-    #endregion
-
-    private System.Windows.Forms.Button importButton;
-    private System.Windows.Forms.TabControl tabControl;
-    private System.Windows.Forms.TabPage parametersTabPage;
-    private System.Windows.Forms.TabPage visualizationTabPage;
-    private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
-    private PathTSPTourView pathTSPTourView;
-
-  }
-}
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TSPView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TSPView.cs	(revision 3158)
+++ 	(revision )
@@ -1,108 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Core;
-using HeuristicLab.Core.Views;
-using HeuristicLab.MainForm;
-
-namespace HeuristicLab.Problems.TravelingSalesman.Views {
-  /// <summary>
-  /// The base class for visual representations of items.
-  /// </summary>
-  [View("TSP View")]
-  [Content(typeof(TSP), true)]
-  public sealed partial class TSPView : NamedItemView {
-    private TSPLIBImportDialog tsplibImportDialog;
-
-    public new TSP Content {
-      get { return (TSP)base.Content; }
-      set { base.Content = value; }
-    }
-
-    /// <summary>
-    /// Initializes a new instance of <see cref="ItemBaseView"/>.
-    /// </summary>
-    public TSPView() {
-      InitializeComponent();
-    }
-    /// <summary>
-    /// Intializes a new instance of <see cref="ItemBaseView"/> with the given <paramref name="item"/>.
-    /// </summary>
-    /// <param name="item">The item that should be displayed.</param>
-    public TSPView(TSP content)
-      : this() {
-      Content = content;
-    }
-
-    protected override void DeregisterContentEvents() {
-      Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
-      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
-      base.DeregisterContentEvents();
-    }
-    protected override void RegisterContentEvents() {
-      base.RegisterContentEvents();
-      Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
-      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
-    }
-
-    protected override void OnContentChanged() {
-      base.OnContentChanged();
-      if (Content == null) {
-        parameterCollectionView.Content = null;
-        parameterCollectionView.Enabled = false;
-        pathTSPTourView.Content = null;
-        pathTSPTourView.Enabled = false;
-        importButton.Enabled = false;
-      } else {
-        parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
-        parameterCollectionView.Enabled = true;
-        pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution);
-        pathTSPTourView.Enabled = true;
-        importButton.Enabled = true;
-      }
-    }
-
-    private void importButton_Click(object sender, System.EventArgs e) {
-      if (tsplibImportDialog == null) tsplibImportDialog = new TSPLIBImportDialog();
-
-      if (tsplibImportDialog.ShowDialog(this) == DialogResult.OK) {
-        try {
-          if (tsplibImportDialog.Quality == null)
-            Content.ImportFromTSPLIB(tsplibImportDialog.TSPFileName, tsplibImportDialog.TourFileName);
-          else
-            Content.ImportFromTSPLIB(tsplibImportDialog.TSPFileName, tsplibImportDialog.TourFileName, (double)tsplibImportDialog.Quality);
-        }
-        catch (Exception ex) {
-          Auxiliary.ShowErrorMessageBox(ex);
-        }
-      }
-    }
-
-    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
-      pathTSPTourView.Content.Coordinates = Content.Coordinates;
-    }
-    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
-      pathTSPTourView.Content.Permutation = Content.BestKnownSolution;
-    }
-  }
-}
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.Designer.cs	(revision 3159)
+++ trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.Designer.cs	(revision 3159)
@@ -0,0 +1,174 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing) {
+        if (tsplibImportDialog != null) tsplibImportDialog.Dispose();
+        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.importButton = new System.Windows.Forms.Button();
+      this.tabControl = new System.Windows.Forms.TabControl();
+      this.parametersTabPage = new System.Windows.Forms.TabPage();
+      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
+      this.visualizationTabPage = new System.Windows.Forms.TabPage();
+      this.pathTSPTourView = new HeuristicLab.Problems.TravelingSalesman.Views.PathTSPTourView();
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+      this.tabControl.SuspendLayout();
+      this.parametersTabPage.SuspendLayout();
+      this.visualizationTabPage.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // nameTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      this.nameTextBox.Size = new System.Drawing.Size(457, 20);
+      // 
+      // descriptionTextBox
+      // 
+      this.descriptionTextBox.Size = new System.Drawing.Size(457, 20);
+      // 
+      // importButton
+      // 
+      this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.importButton.Location = new System.Drawing.Point(0, 399);
+      this.importButton.Name = "importButton";
+      this.importButton.Size = new System.Drawing.Size(529, 23);
+      this.importButton.TabIndex = 5;
+      this.importButton.Text = "&Import from TSPLIB";
+      this.importButton.UseVisualStyleBackColor = true;
+      this.importButton.Click += new System.EventHandler(this.importButton_Click);
+      // 
+      // tabControl
+      // 
+      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, 52);
+      this.tabControl.Name = "tabControl";
+      this.tabControl.SelectedIndex = 0;
+      this.tabControl.Size = new System.Drawing.Size(529, 341);
+      this.tabControl.TabIndex = 4;
+      // 
+      // parametersTabPage
+      // 
+      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(521, 315);
+      this.parametersTabPage.TabIndex = 0;
+      this.parametersTabPage.Text = "Parameters";
+      this.parametersTabPage.UseVisualStyleBackColor = true;
+      // 
+      // parameterCollectionView
+      // 
+      this.parameterCollectionView.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.parameterCollectionView.Caption = "ParameterCollection";
+      this.parameterCollectionView.Content = null;
+      this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);
+      this.parameterCollectionView.Name = "parameterCollectionView";
+      this.parameterCollectionView.Size = new System.Drawing.Size(509, 303);
+      this.parameterCollectionView.TabIndex = 0;
+      // 
+      // visualizationTabPage
+      // 
+      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(521, 315);
+      this.visualizationTabPage.TabIndex = 1;
+      this.visualizationTabPage.Text = "Visualization";
+      this.visualizationTabPage.UseVisualStyleBackColor = true;
+      // 
+      // 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 = "View";
+      this.pathTSPTourView.Content = null;
+      this.pathTSPTourView.Location = new System.Drawing.Point(6, 6);
+      this.pathTSPTourView.Name = "pathTSPTourView";
+      this.pathTSPTourView.Size = new System.Drawing.Size(509, 303);
+      this.pathTSPTourView.TabIndex = 0;
+      // 
+      // TravelingSalesmanProblemView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.tabControl);
+      this.Controls.Add(this.importButton);
+      this.Name = "TravelingSalesmanProblemView";
+      this.Size = new System.Drawing.Size(529, 422);
+      this.Controls.SetChildIndex(this.importButton, 0);
+      this.Controls.SetChildIndex(this.tabControl, 0);
+      this.Controls.SetChildIndex(this.nameLabel, 0);
+      this.Controls.SetChildIndex(this.descriptionLabel, 0);
+      this.Controls.SetChildIndex(this.nameTextBox, 0);
+      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+      this.tabControl.ResumeLayout(false);
+      this.parametersTabPage.ResumeLayout(false);
+      this.visualizationTabPage.ResumeLayout(false);
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.Button importButton;
+    private System.Windows.Forms.TabControl tabControl;
+    private System.Windows.Forms.TabPage parametersTabPage;
+    private System.Windows.Forms.TabPage visualizationTabPage;
+    private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
+    private PathTSPTourView pathTSPTourView;
+
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs	(revision 3159)
+++ trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs	(revision 3159)
@@ -0,0 +1,108 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Core;
+using HeuristicLab.Core.Views;
+using HeuristicLab.MainForm;
+
+namespace HeuristicLab.Problems.TravelingSalesman.Views {
+  /// <summary>
+  /// The base class for visual representations of items.
+  /// </summary>
+  [View("Traveling Salesman Problem View")]
+  [Content(typeof(TravelingSalesmanProblem), true)]
+  public sealed partial class TravelingSalesmanProblemView : NamedItemView {
+    private TSPLIBImportDialog tsplibImportDialog;
+
+    public new TravelingSalesmanProblem Content {
+      get { return (TravelingSalesmanProblem)base.Content; }
+      set { base.Content = value; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="ItemBaseView"/>.
+    /// </summary>
+    public TravelingSalesmanProblemView() {
+      InitializeComponent();
+    }
+    /// <summary>
+    /// Intializes a new instance of <see cref="ItemBaseView"/> with the given <paramref name="item"/>.
+    /// </summary>
+    /// <param name="item">The item that should be displayed.</param>
+    public TravelingSalesmanProblemView(TravelingSalesmanProblem content)
+      : this() {
+      Content = content;
+    }
+
+    protected override void DeregisterContentEvents() {
+      Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
+      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
+      base.DeregisterContentEvents();
+    }
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
+      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content == null) {
+        parameterCollectionView.Content = null;
+        parameterCollectionView.Enabled = false;
+        pathTSPTourView.Content = null;
+        pathTSPTourView.Enabled = false;
+        importButton.Enabled = false;
+      } else {
+        parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
+        parameterCollectionView.Enabled = true;
+        pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution);
+        pathTSPTourView.Enabled = true;
+        importButton.Enabled = true;
+      }
+    }
+
+    private void importButton_Click(object sender, System.EventArgs e) {
+      if (tsplibImportDialog == null) tsplibImportDialog = new TSPLIBImportDialog();
+
+      if (tsplibImportDialog.ShowDialog(this) == DialogResult.OK) {
+        try {
+          if (tsplibImportDialog.Quality == null)
+            Content.ImportFromTSPLIB(tsplibImportDialog.TSPFileName, tsplibImportDialog.TourFileName);
+          else
+            Content.ImportFromTSPLIB(tsplibImportDialog.TSPFileName, tsplibImportDialog.TourFileName, (double)tsplibImportDialog.Quality);
+        }
+        catch (Exception ex) {
+          Auxiliary.ShowErrorMessageBox(ex);
+        }
+      }
+    }
+
+    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
+      pathTSPTourView.Content.Coordinates = Content.Coordinates;
+    }
+    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
+      pathTSPTourView.Content.Permutation = Content.BestKnownSolution;
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj	(revision 3158)
+++ trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj	(revision 3159)
@@ -87,4 +87,5 @@
     <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" />
     <Compile Include="HeuristicLabProblemsTravelingSalesmanPlugin.cs" />
+    <Compile Include="TravelingSalesmanProblem.cs" />
     <Compile Include="TSPLIBTourParser.cs" />
     <Compile Include="Interfaces\ICoordinatesTSPSolutionsVisualizer.cs" />
@@ -108,5 +109,4 @@
     </Compile>
     <Compile Include="TSPLIBParser.cs" />
-    <Compile Include="TSP.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TSP.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TSP.cs	(revision 3158)
+++ 	(revision )
@@ -1,359 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Drawing;
-using System.IO;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.PermutationEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.Problems.TravelingSalesman {
-  [Item("TSP", "Represents a symmetric Traveling Salesman Problem.")]
-  [Creatable("Problems")]
-  [StorableClass]
-  public sealed class TSP : ParameterizedNamedItem, ISingleObjectiveProblem {
-    public override Image ItemImage {
-      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
-    }
-
-    #region Parameter Properties
-    public ValueParameter<BoolValue> MaximizationParameter {
-      get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; }
-    }
-    IParameter ISingleObjectiveProblem.MaximizationParameter {
-      get { return MaximizationParameter; }
-    }
-    public ValueParameter<DoubleMatrix> CoordinatesParameter {
-      get { return (ValueParameter<DoubleMatrix>)Parameters["Coordinates"]; }
-    }
-    public OptionalValueParameter<DoubleMatrix> DistanceMatrixParameter {
-      get { return (OptionalValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]; }
-    }
-    public ValueParameter<BoolValue> UseDistanceMatrixParameter {
-      get { return (ValueParameter<BoolValue>)Parameters["UseDistanceMatrix"]; }
-    }
-    public ValueParameter<IPermutationCreator> SolutionCreatorParameter {
-      get { return (ValueParameter<IPermutationCreator>)Parameters["SolutionCreator"]; }
-    }
-    IParameter IProblem.SolutionCreatorParameter {
-      get { return SolutionCreatorParameter; }
-    }
-    public ValueParameter<ITSPEvaluator> EvaluatorParameter {
-      get { return (ValueParameter<ITSPEvaluator>)Parameters["Evaluator"]; }
-    }
-    IParameter IProblem.EvaluatorParameter {
-      get { return EvaluatorParameter; }
-    }
-    public OptionalValueParameter<ITSPSolutionsVisualizer> VisualizerParameter {
-      get { return (OptionalValueParameter<ITSPSolutionsVisualizer>)Parameters["Visualizer"]; }
-    }
-    IParameter IProblem.VisualizerParameter {
-      get { return VisualizerParameter; }
-    }
-    public OptionalValueParameter<DoubleValue> BestKnownQualityParameter {
-      get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
-    }
-    IParameter ISingleObjectiveProblem.BestKnownQualityParameter {
-      get { return BestKnownQualityParameter; }
-    }
-    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 DoubleMatrix DistanceMatrix {
-      get { return DistanceMatrixParameter.Value; }
-      set { DistanceMatrixParameter.Value = value; }
-    }
-    public BoolValue UseDistanceMatrix {
-      get { return UseDistanceMatrixParameter.Value; }
-      set { UseDistanceMatrixParameter.Value = value; }
-    }
-    public IPermutationCreator SolutionCreator {
-      get { return SolutionCreatorParameter.Value; }
-      set { SolutionCreatorParameter.Value = value; }
-    }
-    ISolutionCreator IProblem.SolutionCreator {
-      get { return SolutionCreatorParameter.Value; }
-    }
-    public ITSPEvaluator Evaluator {
-      get { return EvaluatorParameter.Value; }
-      set { EvaluatorParameter.Value = value; }
-    }
-    ISingleObjectiveEvaluator ISingleObjectiveProblem.Evaluator {
-      get { return EvaluatorParameter.Value; }
-    }
-    IEvaluator IProblem.Evaluator {
-      get { return EvaluatorParameter.Value; }
-    }
-    public ITSPSolutionsVisualizer Visualizer {
-      get { return VisualizerParameter.Value; }
-      set { VisualizerParameter.Value = value; }
-    }
-    ISolutionsVisualizer IProblem.Visualizer {
-      get { return VisualizerParameter.Value; }
-    }
-    public DoubleValue BestKnownQuality {
-      get { return BestKnownQualityParameter.Value; }
-      set { BestKnownQualityParameter.Value = value; }
-    }
-    public Permutation BestKnownSolution {
-      get { return BestKnownSolutionParameter.Value; }
-      set { BestKnownSolutionParameter.Value = value; }
-    }
-    private List<IPermutationOperator> operators;
-    public IEnumerable<IOperator> Operators {
-      get { return operators.Cast<IOperator>(); }
-    }
-    #endregion
-
-    public TSP()
-      : base() {
-      RandomPermutationCreator creator = new RandomPermutationCreator();
-      TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
-      BestPathTSPTourVisualizer visualizer = new BestPathTSPTourVisualizer();
-
-      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolValue(false)));
-      Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrix(0, 0)));
-      Parameters.Add(new OptionalValueParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
-      Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false.", new BoolValue(true)));
-      Parameters.Add(new ValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator));
-      Parameters.Add(new ValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator));
-      Parameters.Add(new OptionalValueParameter<ITSPSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize TSP solutions.", visualizer));
-      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance."));
-      Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance."));
-
-      creator.PermutationParameter.ActualName = "TSPTour";
-      evaluator.QualityParameter.ActualName = "TSPTourLength";
-      ParameterizeSolutionCreator();
-      ParameterizeEvaluator();
-      ParameterizeVisualizer();
-
-      Initialize();
-    }
-    [StorableConstructor]
-    private TSP(bool deserializing) : base() { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      TSP clone = (TSP)base.Clone(cloner);
-      clone.Initialize();
-      return clone;
-    }
-
-    public void ImportFromTSPLIB(string tspFileName, string optimalTourFileName) {
-      TSPLIBParser tspParser = new TSPLIBParser(tspFileName);
-      tspParser.Parse();
-      Name = tspParser.Name + " TSP (imported from TSPLIB)";
-      if (!string.IsNullOrEmpty(tspParser.Comment)) Description = tspParser.Comment;
-      Coordinates = new DoubleMatrix(tspParser.Vertices);
-      if (tspParser.WeightType == TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D) {
-        TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
-        evaluator.QualityParameter.ActualName = "TSPTourLength";
-        Evaluator = evaluator;
-      } else if (tspParser.WeightType == TSPLIBParser.TSPLIBEdgeWeightType.GEO) {
-        TSPGeoPathEvaluator evaluator = new TSPGeoPathEvaluator();
-        evaluator.QualityParameter.ActualName = "TSPTourLength";
-        Evaluator = evaluator;
-      }
-      BestKnownQuality = null;
-      BestKnownSolution = null;
-
-      if (!string.IsNullOrEmpty(optimalTourFileName)) {
-        TSPLIBTourParser tourParser = new TSPLIBTourParser(optimalTourFileName);
-        tourParser.Parse();
-        if (tourParser.Tour.Length != Coordinates.Rows) throw new InvalidDataException("Length of optimal tour is not equal to number of cities.");
-        BestKnownSolution = new Permutation(tourParser.Tour);
-      }
-    }
-    public void ImportFromTSPLIB(string tspFileName, string optimalTourFileName, double bestKnownQuality) {
-      ImportFromTSPLIB(tspFileName, optimalTourFileName);
-      BestKnownQuality = new DoubleValue(bestKnownQuality);
-    }
-
-    #region Events
-    public event EventHandler SolutionCreatorChanged;
-    private void OnSolutionCreatorChanged() {
-      if (SolutionCreatorChanged != null)
-        SolutionCreatorChanged(this, EventArgs.Empty);
-    }
-    public event EventHandler EvaluatorChanged;
-    private void OnEvaluatorChanged() {
-      if (EvaluatorChanged != null)
-        EvaluatorChanged(this, EventArgs.Empty);
-    }
-    public event EventHandler VisualizerChanged;
-    private void OnVisualizerChanged() {
-      if (VisualizerChanged != null)
-        VisualizerChanged(this, EventArgs.Empty);
-    }
-    public event EventHandler OperatorsChanged;
-    private void OnOperatorsChanged() {
-      if (OperatorsChanged != null)
-        OperatorsChanged(this, EventArgs.Empty);
-    }
-
-    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
-      Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
-      Coordinates.Reset += new EventHandler(Coordinates_Reset);
-      ParameterizeSolutionCreator();
-      ClearDistanceMatrix();
-    }
-    private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) {
-      ClearDistanceMatrix();
-    }
-    private void Coordinates_Reset(object sender, EventArgs e) {
-      ParameterizeSolutionCreator();
-      ClearDistanceMatrix();
-    }
-    private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
-      SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
-      ParameterizeSolutionCreator();
-      ParameterizeEvaluator();
-      ParameterizeVisualizer();
-      ParameterizeOperators();
-      OnSolutionCreatorChanged();
-    }
-    private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) {
-      ParameterizeEvaluator();
-      ParameterizeVisualizer();
-      ParameterizeOperators();
-    }
-    private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
-      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
-      ParameterizeEvaluator();
-      ParameterizeVisualizer();
-      ClearDistanceMatrix();
-      OnEvaluatorChanged();
-    }
-    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
-      ParameterizeVisualizer();
-    }
-    private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {
-      ParameterizeVisualizer();
-      OnVisualizerChanged();
-    }
-    private void MoveGenerator_TwoOptMoveParameter_ActualNameChanged(object sender, EventArgs e) {
-      string name = ((ILookupParameter<TwoOptMove>)sender).ActualName;
-      foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
-        op.TwoOptMoveParameter.ActualName = name;
-      }
-    }
-    private void MoveGenerator_ThreeOptMoveParameter_ActualNameChanged(object sender, EventArgs e) {
-      string name = ((ILookupParameter<ThreeOptMove>)sender).ActualName;
-      foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
-        op.ThreeOptMoveParameter.ActualName = name;
-      }
-    }
-    #endregion
-
-    #region Helpers
-    [StorableHook(HookType.AfterDeserialization)]
-    private void Initialize() {
-      InitializeOperators();
-      CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
-      Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
-      Coordinates.Reset += new EventHandler(Coordinates_Reset);
-      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
-      SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
-      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
-      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
-      VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);
-    }
-
-    private void InitializeOperators() {
-      operators = new List<IPermutationOperator>();
-      if (ApplicationManager.Manager != null) {
-        operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>());
-        ParameterizeOperators();
-      }
-      InitializeMoveGenerators();
-    }
-    private void InitializeMoveGenerators() {
-      foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
-        if (op is IMoveGenerator) {
-          op.TwoOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_TwoOptMoveParameter_ActualNameChanged);
-        }
-      }
-      foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
-        if (op is IMoveGenerator) {
-          op.ThreeOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_ThreeOptMoveParameter_ActualNameChanged);
-        }
-      }
-    }
-    private void ParameterizeSolutionCreator() {
-      SolutionCreator.LengthParameter.Value = new IntValue(Coordinates.Rows);
-    }
-    private void ParameterizeEvaluator() {
-      if (Evaluator is ITSPPathEvaluator)
-        ((ITSPPathEvaluator)Evaluator).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-      if (Evaluator is ITSPCoordinatesPathEvaluator) {
-        ITSPCoordinatesPathEvaluator evaluator = (ITSPCoordinatesPathEvaluator)Evaluator;
-        evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        evaluator.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
-        evaluator.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
-      }
-    }
-    private void ParameterizeVisualizer() {
-      if (Visualizer != null) {
-        Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
-        if (Visualizer is ICoordinatesTSPSolutionsVisualizer)
-          ((ICoordinatesTSPSolutionsVisualizer)Visualizer).CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        if (Visualizer is IPathCoordinatesTSPSolutionsVisualizer)
-          ((IPathCoordinatesTSPSolutionsVisualizer)Visualizer).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-      }
-    }
-    private void ParameterizeOperators() {
-      foreach (IPermutationCrossover op in Operators.OfType<IPermutationCrossover>()) {
-        op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-        op.ChildParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-      }
-      foreach (IPermutationManipulator op in Operators.OfType<IPermutationManipulator>()) {
-        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-      }
-      foreach (IPermutationMoveOperator op in Operators.OfType<IPermutationMoveOperator>()) {
-        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
-      }
-      foreach (ITSPPathMoveEvaluator op in Operators.OfType<ITSPPathMoveEvaluator>()) {
-        op.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
-        op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
-        op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
-      }
-    }
-
-    private void ClearDistanceMatrix() {
-      DistanceMatrixParameter.Value = null;
-    }
-    #endregion
-  }
-}
Index: trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs	(revision 3159)
+++ trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs	(revision 3159)
@@ -0,0 +1,359 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Drawing;
+using System.IO;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.TravelingSalesman {
+  [Item("Traveling Salesman Problem", "Represents a symmetric Traveling Salesman Problem.")]
+  [Creatable("Problems")]
+  [StorableClass]
+  public sealed class TravelingSalesmanProblem : ParameterizedNamedItem, ISingleObjectiveProblem {
+    public override Image ItemImage {
+      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
+    }
+
+    #region Parameter Properties
+    public ValueParameter<BoolValue> MaximizationParameter {
+      get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    IParameter ISingleObjectiveProblem.MaximizationParameter {
+      get { return MaximizationParameter; }
+    }
+    public ValueParameter<DoubleMatrix> CoordinatesParameter {
+      get { return (ValueParameter<DoubleMatrix>)Parameters["Coordinates"]; }
+    }
+    public OptionalValueParameter<DoubleMatrix> DistanceMatrixParameter {
+      get { return (OptionalValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]; }
+    }
+    public ValueParameter<BoolValue> UseDistanceMatrixParameter {
+      get { return (ValueParameter<BoolValue>)Parameters["UseDistanceMatrix"]; }
+    }
+    public ValueParameter<IPermutationCreator> SolutionCreatorParameter {
+      get { return (ValueParameter<IPermutationCreator>)Parameters["SolutionCreator"]; }
+    }
+    IParameter IProblem.SolutionCreatorParameter {
+      get { return SolutionCreatorParameter; }
+    }
+    public ValueParameter<ITSPEvaluator> EvaluatorParameter {
+      get { return (ValueParameter<ITSPEvaluator>)Parameters["Evaluator"]; }
+    }
+    IParameter IProblem.EvaluatorParameter {
+      get { return EvaluatorParameter; }
+    }
+    public OptionalValueParameter<ITSPSolutionsVisualizer> VisualizerParameter {
+      get { return (OptionalValueParameter<ITSPSolutionsVisualizer>)Parameters["Visualizer"]; }
+    }
+    IParameter IProblem.VisualizerParameter {
+      get { return VisualizerParameter; }
+    }
+    public OptionalValueParameter<DoubleValue> BestKnownQualityParameter {
+      get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
+    }
+    IParameter ISingleObjectiveProblem.BestKnownQualityParameter {
+      get { return BestKnownQualityParameter; }
+    }
+    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 DoubleMatrix DistanceMatrix {
+      get { return DistanceMatrixParameter.Value; }
+      set { DistanceMatrixParameter.Value = value; }
+    }
+    public BoolValue UseDistanceMatrix {
+      get { return UseDistanceMatrixParameter.Value; }
+      set { UseDistanceMatrixParameter.Value = value; }
+    }
+    public IPermutationCreator SolutionCreator {
+      get { return SolutionCreatorParameter.Value; }
+      set { SolutionCreatorParameter.Value = value; }
+    }
+    ISolutionCreator IProblem.SolutionCreator {
+      get { return SolutionCreatorParameter.Value; }
+    }
+    public ITSPEvaluator Evaluator {
+      get { return EvaluatorParameter.Value; }
+      set { EvaluatorParameter.Value = value; }
+    }
+    ISingleObjectiveEvaluator ISingleObjectiveProblem.Evaluator {
+      get { return EvaluatorParameter.Value; }
+    }
+    IEvaluator IProblem.Evaluator {
+      get { return EvaluatorParameter.Value; }
+    }
+    public ITSPSolutionsVisualizer Visualizer {
+      get { return VisualizerParameter.Value; }
+      set { VisualizerParameter.Value = value; }
+    }
+    ISolutionsVisualizer IProblem.Visualizer {
+      get { return VisualizerParameter.Value; }
+    }
+    public DoubleValue BestKnownQuality {
+      get { return BestKnownQualityParameter.Value; }
+      set { BestKnownQualityParameter.Value = value; }
+    }
+    public Permutation BestKnownSolution {
+      get { return BestKnownSolutionParameter.Value; }
+      set { BestKnownSolutionParameter.Value = value; }
+    }
+    private List<IPermutationOperator> operators;
+    public IEnumerable<IOperator> Operators {
+      get { return operators.Cast<IOperator>(); }
+    }
+    #endregion
+
+    public TravelingSalesmanProblem()
+      : base() {
+      RandomPermutationCreator creator = new RandomPermutationCreator();
+      TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
+      BestPathTSPTourVisualizer visualizer = new BestPathTSPTourVisualizer();
+
+      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolValue(false)));
+      Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrix(0, 0)));
+      Parameters.Add(new OptionalValueParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
+      Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator));
+      Parameters.Add(new ValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator));
+      Parameters.Add(new OptionalValueParameter<ITSPSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize TSP solutions.", visualizer));
+      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance."));
+      Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance."));
+
+      creator.PermutationParameter.ActualName = "TSPTour";
+      evaluator.QualityParameter.ActualName = "TSPTourLength";
+      ParameterizeSolutionCreator();
+      ParameterizeEvaluator();
+      ParameterizeVisualizer();
+
+      Initialize();
+    }
+    [StorableConstructor]
+    private TravelingSalesmanProblem(bool deserializing) : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      TravelingSalesmanProblem clone = (TravelingSalesmanProblem)base.Clone(cloner);
+      clone.Initialize();
+      return clone;
+    }
+
+    public void ImportFromTSPLIB(string tspFileName, string optimalTourFileName) {
+      TSPLIBParser tspParser = new TSPLIBParser(tspFileName);
+      tspParser.Parse();
+      Name = tspParser.Name + " TSP (imported from TSPLIB)";
+      if (!string.IsNullOrEmpty(tspParser.Comment)) Description = tspParser.Comment;
+      Coordinates = new DoubleMatrix(tspParser.Vertices);
+      if (tspParser.WeightType == TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D) {
+        TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
+        evaluator.QualityParameter.ActualName = "TSPTourLength";
+        Evaluator = evaluator;
+      } else if (tspParser.WeightType == TSPLIBParser.TSPLIBEdgeWeightType.GEO) {
+        TSPGeoPathEvaluator evaluator = new TSPGeoPathEvaluator();
+        evaluator.QualityParameter.ActualName = "TSPTourLength";
+        Evaluator = evaluator;
+      }
+      BestKnownQuality = null;
+      BestKnownSolution = null;
+
+      if (!string.IsNullOrEmpty(optimalTourFileName)) {
+        TSPLIBTourParser tourParser = new TSPLIBTourParser(optimalTourFileName);
+        tourParser.Parse();
+        if (tourParser.Tour.Length != Coordinates.Rows) throw new InvalidDataException("Length of optimal tour is not equal to number of cities.");
+        BestKnownSolution = new Permutation(tourParser.Tour);
+      }
+    }
+    public void ImportFromTSPLIB(string tspFileName, string optimalTourFileName, double bestKnownQuality) {
+      ImportFromTSPLIB(tspFileName, optimalTourFileName);
+      BestKnownQuality = new DoubleValue(bestKnownQuality);
+    }
+
+    #region Events
+    public event EventHandler SolutionCreatorChanged;
+    private void OnSolutionCreatorChanged() {
+      if (SolutionCreatorChanged != null)
+        SolutionCreatorChanged(this, EventArgs.Empty);
+    }
+    public event EventHandler EvaluatorChanged;
+    private void OnEvaluatorChanged() {
+      if (EvaluatorChanged != null)
+        EvaluatorChanged(this, EventArgs.Empty);
+    }
+    public event EventHandler VisualizerChanged;
+    private void OnVisualizerChanged() {
+      if (VisualizerChanged != null)
+        VisualizerChanged(this, EventArgs.Empty);
+    }
+    public event EventHandler OperatorsChanged;
+    private void OnOperatorsChanged() {
+      if (OperatorsChanged != null)
+        OperatorsChanged(this, EventArgs.Empty);
+    }
+
+    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
+      Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
+      Coordinates.Reset += new EventHandler(Coordinates_Reset);
+      ParameterizeSolutionCreator();
+      ClearDistanceMatrix();
+    }
+    private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) {
+      ClearDistanceMatrix();
+    }
+    private void Coordinates_Reset(object sender, EventArgs e) {
+      ParameterizeSolutionCreator();
+      ClearDistanceMatrix();
+    }
+    private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
+      SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
+      ParameterizeSolutionCreator();
+      ParameterizeEvaluator();
+      ParameterizeVisualizer();
+      ParameterizeOperators();
+      OnSolutionCreatorChanged();
+    }
+    private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) {
+      ParameterizeEvaluator();
+      ParameterizeVisualizer();
+      ParameterizeOperators();
+    }
+    private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
+      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+      ParameterizeEvaluator();
+      ParameterizeVisualizer();
+      ClearDistanceMatrix();
+      OnEvaluatorChanged();
+    }
+    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
+      ParameterizeVisualizer();
+    }
+    private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {
+      ParameterizeVisualizer();
+      OnVisualizerChanged();
+    }
+    private void MoveGenerator_TwoOptMoveParameter_ActualNameChanged(object sender, EventArgs e) {
+      string name = ((ILookupParameter<TwoOptMove>)sender).ActualName;
+      foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
+        op.TwoOptMoveParameter.ActualName = name;
+      }
+    }
+    private void MoveGenerator_ThreeOptMoveParameter_ActualNameChanged(object sender, EventArgs e) {
+      string name = ((ILookupParameter<ThreeOptMove>)sender).ActualName;
+      foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
+        op.ThreeOptMoveParameter.ActualName = name;
+      }
+    }
+    #endregion
+
+    #region Helpers
+    [StorableHook(HookType.AfterDeserialization)]
+    private void Initialize() {
+      InitializeOperators();
+      CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
+      Coordinates.ItemChanged += new EventHandler<EventArgs<int, int>>(Coordinates_ItemChanged);
+      Coordinates.Reset += new EventHandler(Coordinates_Reset);
+      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
+      SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
+      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
+      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+      VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);
+    }
+
+    private void InitializeOperators() {
+      operators = new List<IPermutationOperator>();
+      if (ApplicationManager.Manager != null) {
+        operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>());
+        ParameterizeOperators();
+      }
+      InitializeMoveGenerators();
+    }
+    private void InitializeMoveGenerators() {
+      foreach (ITwoOptPermutationMoveOperator op in Operators.OfType<ITwoOptPermutationMoveOperator>()) {
+        if (op is IMoveGenerator) {
+          op.TwoOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_TwoOptMoveParameter_ActualNameChanged);
+        }
+      }
+      foreach (IThreeOptPermutationMoveOperator op in Operators.OfType<IThreeOptPermutationMoveOperator>()) {
+        if (op is IMoveGenerator) {
+          op.ThreeOptMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_ThreeOptMoveParameter_ActualNameChanged);
+        }
+      }
+    }
+    private void ParameterizeSolutionCreator() {
+      SolutionCreator.LengthParameter.Value = new IntValue(Coordinates.Rows);
+    }
+    private void ParameterizeEvaluator() {
+      if (Evaluator is ITSPPathEvaluator)
+        ((ITSPPathEvaluator)Evaluator).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+      if (Evaluator is ITSPCoordinatesPathEvaluator) {
+        ITSPCoordinatesPathEvaluator evaluator = (ITSPCoordinatesPathEvaluator)Evaluator;
+        evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
+        evaluator.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
+        evaluator.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
+      }
+    }
+    private void ParameterizeVisualizer() {
+      if (Visualizer != null) {
+        Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
+        if (Visualizer is ICoordinatesTSPSolutionsVisualizer)
+          ((ICoordinatesTSPSolutionsVisualizer)Visualizer).CoordinatesParameter.ActualName = CoordinatesParameter.Name;
+        if (Visualizer is IPathCoordinatesTSPSolutionsVisualizer)
+          ((IPathCoordinatesTSPSolutionsVisualizer)Visualizer).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+      }
+    }
+    private void ParameterizeOperators() {
+      foreach (IPermutationCrossover op in Operators.OfType<IPermutationCrossover>()) {
+        op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+        op.ChildParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+      }
+      foreach (IPermutationManipulator op in Operators.OfType<IPermutationManipulator>()) {
+        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+      }
+      foreach (IPermutationMoveOperator op in Operators.OfType<IPermutationMoveOperator>()) {
+        op.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+      }
+      foreach (ITSPPathMoveEvaluator op in Operators.OfType<ITSPPathMoveEvaluator>()) {
+        op.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
+        op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;
+        op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;
+      }
+    }
+
+    private void ClearDistanceMatrix() {
+      DistanceMatrixParameter.Value = null;
+    }
+    #endregion
+  }
+}
