Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/HeuristicLab.Problems.PTSP.Tests-3.3.csproj
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/HeuristicLab.Problems.PTSP.Tests-3.3.csproj (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/HeuristicLab.Problems.PTSP.Tests-3.3.csproj (revision 12269)
@@ -0,0 +1,116 @@
+
+
+
+ Debug
+ AnyCPU
+ {CBEC171A-F7EC-460D-94E2-D58625811D99}
+ Library
+ Properties
+ HeuristicLab.Problems.PTSP.Tests_3._3
+ HeuristicLab.Problems.PTSP.Tests-3.3
+ v4.5
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 10.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+ true
+ full
+ false
+ ..\..\..\trunk\sources\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Problems.PTSP-3.3.dll
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/PTSPMoveEvaluatorTest.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/PTSPMoveEvaluatorTest.cs (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/PTSPMoveEvaluatorTest.cs (revision 12269)
@@ -0,0 +1,138 @@
+using System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Random;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Diagnostics;
+
+namespace HeuristicLab.Problems.PTSP.Tests_3._3 {
+ ///
+ ///This is a test class for PTSP move evaluators
+ ///
+ [TestClass()]
+ public class PTSPMoveEvaluatorTest {
+ private const int ProblemSize = 10;
+ private static DoubleMatrix coordinates;
+ private static DistanceMatrix distances;
+ private static Permutation tour;
+ private static MersenneTwister random;
+ private static ItemList> realizations;
+ private static DoubleArray ProbabilityMatrix;
+
+ [ClassInitialize]
+ public static void MyClassInitialize(TestContext testContext) {
+ random = new MersenneTwister();
+ coordinates = new DoubleMatrix(ProblemSize, 2);
+ distances = new DistanceMatrix(ProblemSize, ProblemSize);
+ for (int i = 0; i < ProblemSize; i++) {
+ coordinates[i, 0] = random.Next(ProblemSize * 10);
+ coordinates[i, 1] = random.Next(ProblemSize * 10);
+ }
+ for (int i = 0; i < ProblemSize - 1; i++) {
+ for (int j = i + 1; j < ProblemSize; j++) {
+ distances[i, j] = Math.Round(Math.Sqrt(Math.Pow(coordinates[i, 0] - coordinates[j, 0], 2) + Math.Pow(coordinates[i, 1] - coordinates[j, 1], 2)));
+ distances[j, i] = distances[i, j];
+ }
+ }
+
+ ProbabilityMatrix = new DoubleArray(ProblemSize);
+ for (int i = 0; i < ProblemSize; i++) {
+ ProbabilityMatrix[i] = random.NextDouble();
+ }
+
+ int numRealizations = 100;
+ int countOnes = 0;
+ realizations = new ItemList>(numRealizations);
+ for (int i = 0; i < numRealizations; i++) {
+ ItemList newRealization = new ItemList();
+ while (countOnes < 4) { //only generate realizations with at least 4 cities visited
+ countOnes = 0;
+ newRealization.Clear();
+ for (int j = 0; j < ProblemSize; j++) {
+ if (ProbabilityMatrix[j] > random.NextDouble()) {
+ newRealization.Add(new IntValue(1));
+ countOnes++;
+ } else {
+ newRealization.Add(new IntValue(0));
+ }
+ }
+ }
+ countOnes = 0;
+ realizations.Add(newRealization);
+ }
+
+ tour = new Permutation(PermutationTypes.RelativeUndirected, ProblemSize, random);
+ }
+
+ [TestMethod]
+ [TestCategory("Problems.TravelingSalesman")]
+ [TestProperty("Time", "short")]
+ public void InversionMoveEvaluatorTest() {
+
+ EstimatedProbabilisticTravelingSalesmanProblem ePTSP = new EstimatedProbabilisticTravelingSalesmanProblem();
+
+ double beforeMatrix = ePTSP.EvaluateWithParams(distances, ProbabilityMatrix, realizations, tour)[0];
+
+ for (int i = 0; i < 500; i++) {
+ var move = StochasticInversionSingleMoveGenerator.Apply(tour, random);
+
+ double moveMatrix = PTSPEstimatedInversionMovePathEvaluator.EvaluateByDistanceMatrix(tour, move, distances,realizations);
+
+ string failureString = string.Format(@"Inversion move is calculated with quality {0}, but actual difference is {4}.
+The move would invert the tour {1} between values {2} and {3}.", moveMatrix.ToString(), tour.ToString(), tour[move.Index1].ToString(), tour[move.Index2].ToString(), "{0}");
+
+ InversionManipulator.Apply(tour, move.Index1, move.Index2);
+
+ double afterMatrix = ePTSP.EvaluateWithParams(distances, ProbabilityMatrix, realizations, tour)[0];
+
+ Assert.IsTrue(moveMatrix.IsAlmost(Math.Abs(afterMatrix - beforeMatrix)), string.Format(failureString, (Math.Abs(afterMatrix - beforeMatrix)).ToString()));
+
+ beforeMatrix = afterMatrix;
+ }
+ }
+
+ [TestMethod]
+ [TestCategory("Problems.TravelingSalesman")]
+ [TestProperty("Time", "short")]
+ public void InsertionMoveEvaluatorTest() {
+
+ EstimatedProbabilisticTravelingSalesmanProblem ePTSP = new EstimatedProbabilisticTravelingSalesmanProblem();
+
+ double beforeMatrix = ePTSP.EvaluateWithParams(distances, ProbabilityMatrix, realizations, tour)[0];
+
+ for (int i = 0; i < 500; i++) {
+ var move = StochasticTranslocationSingleMoveGenerator.Apply(tour, random);
+
+ double moveMatrix = PTSPEstimatedInsertionEvaluator.EvaluateByDistanceMatrix(tour, move, distances, realizations);
+
+ string failureString = string.Format(@"Inversion move is calculated with quality {0}, but actual difference is {4}.
+The move would invert the tour {1} between values {2} and {3}.", moveMatrix.ToString(), tour.ToString(), tour[move.Index1].ToString(), tour[move.Index2].ToString(), "{0}");
+
+ TranslocationManipulator.Apply(tour, move.Index1, move.Index1, move.Index3);
+
+ double afterMatrix = ePTSP.EvaluateWithParams(distances, ProbabilityMatrix, realizations, tour)[0];
+
+ Assert.IsTrue(moveMatrix.IsAlmost(Math.Abs(afterMatrix - beforeMatrix)), string.Format(failureString, (Math.Abs(afterMatrix - beforeMatrix)).ToString()));
+
+ beforeMatrix = afterMatrix;
+ }
+ }
+
+ [TestMethod]
+ [TestCategory("Problems.TravelingSalesman")]
+ [TestProperty("Time", "short")]
+ public void AnalyticalTest() {
+ for (int i = 0; i < 10; i++) {
+ tour = new Permutation(PermutationTypes.RelativeUndirected, ProblemSize, random);
+ EstimatedProbabilisticTravelingSalesmanProblem ePTSP = new EstimatedProbabilisticTravelingSalesmanProblem();
+ double estimated = ePTSP.EvaluateWithParams(distances, ProbabilityMatrix, realizations, tour)[0];
+
+ AnalyticalProbabilisticTravelingSalesmanProblem aPTSP = new AnalyticalProbabilisticTravelingSalesmanProblem();
+ double analytical = aPTSP.EvaluateWithParams(distances, ProbabilityMatrix, tour);
+ Console.WriteLine(Math.Abs(analytical-estimated));
+ }
+ }
+ }
+}
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/Properties/AssemblyInfo.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/Properties/AssemblyInfo.cs (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Tests-3.3/Properties/AssemblyInfo.cs (revision 12269)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Problems.PTSP.Tests-3.3")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab.Problems.PTSP.Tests-3.3")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6d0dbf69-9fb0-4702-a81b-a93ca4806115")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/HeuristicLab.Problems.PTSP.Views-3.3.csproj
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/HeuristicLab.Problems.PTSP.Views-3.3.csproj (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/HeuristicLab.Problems.PTSP.Views-3.3.csproj (revision 12269)
@@ -0,0 +1,140 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {90B6CA12-9791-4430-B2D7-CD3ED7F75E2B}
+ Library
+ Properties
+ HeuristicLab.Problems.PTSP.Views
+ HeuristicLab.Problems.PTSP.Views-3.3
+ v4.5
+ 512
+
+
+ true
+ full
+ false
+ ..\..\..\..\trunk\sources\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+
+
+ pdbonly
+ true
+ ..\..\..\..\trunk\sources\bin\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Views-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll
+ False
+
+
+ ..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ PathPTSPTourView.cs
+
+
+
+
+ UserControl
+
+
+ ProbabilisticTravelingSalesmanProblemView.cs
+
+
+
+
+
+
+
+
+
+ {97198965-afea-496b-b3b1-316905c43fd6}
+ HeuristicLab.Problems.PTSP-3.3
+ False
+
+
+
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+
+
+
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/PathPTSPTourView.Designer.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/PathPTSPTourView.Designer.cs (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/PathPTSPTourView.Designer.cs (revision 12269)
@@ -0,0 +1,220 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 .
+ */
+#endregion
+
+namespace HeuristicLab.Problems.PTSP.Views {
+ partial class PathPTSPTourView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing) {
+ if (components != null) components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.pictureBox = new System.Windows.Forms.PictureBox();
+ this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
+ this.visualizationTabPage = new System.Windows.Forms.TabPage();
+ this.valueTabPage = new System.Windows.Forms.TabPage();
+ this.tourGroupBox = new System.Windows.Forms.GroupBox();
+ this.tourViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+ this.splitContainer = new System.Windows.Forms.SplitContainer();
+ this.qualityGroupBox = new System.Windows.Forms.GroupBox();
+ this.qualityViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+ this.tabControl.SuspendLayout();
+ this.visualizationTabPage.SuspendLayout();
+ this.valueTabPage.SuspendLayout();
+ this.tourGroupBox.SuspendLayout();
+ this.splitContainer.Panel1.SuspendLayout();
+ this.splitContainer.Panel2.SuspendLayout();
+ this.splitContainer.SuspendLayout();
+ this.qualityGroupBox.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // pictureBox
+ //
+ this.pictureBox.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.pictureBox.BackColor = System.Drawing.Color.White;
+ this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pictureBox.Location = new System.Drawing.Point(6, 6);
+ this.pictureBox.Name = "pictureBox";
+ this.pictureBox.Size = new System.Drawing.Size(403, 288);
+ this.pictureBox.TabIndex = 0;
+ this.pictureBox.TabStop = false;
+ this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged);
+ //
+ // 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.visualizationTabPage);
+ this.tabControl.Controls.Add(this.valueTabPage);
+ this.tabControl.Location = new System.Drawing.Point(0, 3);
+ this.tabControl.Name = "tabControl";
+ this.tabControl.SelectedIndex = 0;
+ this.tabControl.Size = new System.Drawing.Size(423, 326);
+ this.tabControl.TabIndex = 0;
+ //
+ // visualizationTabPage
+ //
+ this.visualizationTabPage.Controls.Add(this.pictureBox);
+ 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(415, 300);
+ this.visualizationTabPage.TabIndex = 0;
+ this.visualizationTabPage.Text = "Visualization";
+ this.visualizationTabPage.UseVisualStyleBackColor = true;
+ //
+ // valueTabPage
+ //
+ this.valueTabPage.Controls.Add(this.tourGroupBox);
+ this.valueTabPage.Location = new System.Drawing.Point(4, 22);
+ this.valueTabPage.Name = "valueTabPage";
+ this.valueTabPage.Padding = new System.Windows.Forms.Padding(3);
+ this.valueTabPage.Size = new System.Drawing.Size(415, 300);
+ this.valueTabPage.TabIndex = 1;
+ this.valueTabPage.Text = "Value";
+ this.valueTabPage.UseVisualStyleBackColor = true;
+ //
+ // tourGroupBox
+ //
+ this.tourGroupBox.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.tourGroupBox.Controls.Add(this.tourViewHost);
+ this.tourGroupBox.Location = new System.Drawing.Point(6, 6);
+ this.tourGroupBox.Name = "tourGroupBox";
+ this.tourGroupBox.Size = new System.Drawing.Size(403, 288);
+ this.tourGroupBox.TabIndex = 0;
+ this.tourGroupBox.TabStop = false;
+ this.tourGroupBox.Text = "Tour";
+ //
+ // tourViewHost
+ //
+ this.tourViewHost.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.tourViewHost.Content = null;
+ this.tourViewHost.Location = new System.Drawing.Point(6, 19);
+ this.tourViewHost.Name = "tourViewHost";
+ this.tourViewHost.ReadOnly = false;
+ this.tourViewHost.Size = new System.Drawing.Size(391, 263);
+ this.tourViewHost.TabIndex = 0;
+ this.tourViewHost.ViewType = null;
+ //
+ // splitContainer
+ //
+ this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer.Name = "splitContainer";
+ this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer.Panel1
+ //
+ this.splitContainer.Panel1.Controls.Add(this.qualityGroupBox);
+ //
+ // splitContainer.Panel2
+ //
+ this.splitContainer.Panel2.Controls.Add(this.tabControl);
+ this.splitContainer.Size = new System.Drawing.Size(423, 402);
+ this.splitContainer.SplitterDistance = 69;
+ this.splitContainer.TabIndex = 0;
+ //
+ // qualityGroupBox
+ //
+ this.qualityGroupBox.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.qualityGroupBox.Controls.Add(this.qualityViewHost);
+ this.qualityGroupBox.Location = new System.Drawing.Point(0, 0);
+ this.qualityGroupBox.Name = "qualityGroupBox";
+ this.qualityGroupBox.Size = new System.Drawing.Size(423, 66);
+ this.qualityGroupBox.TabIndex = 0;
+ this.qualityGroupBox.TabStop = false;
+ this.qualityGroupBox.Text = "Quality";
+ //
+ // qualityViewHost
+ //
+ this.qualityViewHost.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.qualityViewHost.Content = null;
+ this.qualityViewHost.Location = new System.Drawing.Point(6, 19);
+ this.qualityViewHost.Name = "qualityViewHost";
+ this.qualityViewHost.ReadOnly = false;
+ this.qualityViewHost.Size = new System.Drawing.Size(411, 41);
+ this.qualityViewHost.TabIndex = 0;
+ this.qualityViewHost.ViewType = null;
+ //
+ // PathTSPTourView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+ this.Controls.Add(this.splitContainer);
+ this.Name = "PathTSPTourView";
+ this.Size = new System.Drawing.Size(423, 402);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+ this.tabControl.ResumeLayout(false);
+ this.visualizationTabPage.ResumeLayout(false);
+ this.valueTabPage.ResumeLayout(false);
+ this.tourGroupBox.ResumeLayout(false);
+ this.splitContainer.Panel1.ResumeLayout(false);
+ this.splitContainer.Panel2.ResumeLayout(false);
+ this.splitContainer.ResumeLayout(false);
+ this.qualityGroupBox.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox;
+ private HeuristicLab.MainForm.WindowsForms.DragOverTabControl tabControl;
+ private System.Windows.Forms.TabPage visualizationTabPage;
+ private System.Windows.Forms.TabPage valueTabPage;
+ private System.Windows.Forms.GroupBox tourGroupBox;
+ private HeuristicLab.MainForm.WindowsForms.ViewHost tourViewHost;
+ private System.Windows.Forms.SplitContainer splitContainer;
+ private System.Windows.Forms.GroupBox qualityGroupBox;
+ private HeuristicLab.MainForm.WindowsForms.ViewHost qualityViewHost;
+
+
+ }
+}
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/PathPTSPTourView.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/PathPTSPTourView.cs (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/PathPTSPTourView.cs (revision 12269)
@@ -0,0 +1,171 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 .
+ */
+#endregion
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.MainForm;
+
+namespace HeuristicLab.Problems.PTSP.Views {
+ ///
+ /// The base class for visual representations of a path tour for a PTSP.
+ ///
+ [View("PathPTSPTour View")]
+ [Content(typeof(PathPTSPTour), true)]
+ public sealed partial class PathPTSPTourView : ItemView {
+ public new PathPTSPTour Content {
+ get { return (PathPTSPTour)base.Content; }
+ set { base.Content = value; }
+ }
+
+ ///
+ /// Initializes a new instance of .
+ ///
+ public PathPTSPTourView() {
+ InitializeComponent();
+ }
+
+ protected override void DeregisterContentEvents() {
+ Content.QualityChanged -= new EventHandler(Content_QualityChanged);
+ Content.CoordinatesChanged -= new EventHandler(Content_CoordinatesChanged);
+ Content.PermutationChanged -= new EventHandler(Content_PermutationChanged);
+ Content.ProbabilitiesChanged -= new EventHandler(Content_ProbabilitiesChanged);
+ 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.ProbabilitiesChanged += new EventHandler(Content_ProbabilitiesChanged);
+ }
+
+ protected override void OnContentChanged() {
+ base.OnContentChanged();
+ if (Content == null) {
+ qualityViewHost.Content = null;
+ pictureBox.Image = null;
+ tourViewHost.Content = null;
+ } else {
+ qualityViewHost.Content = Content.Quality;
+ GenerateImage();
+ tourViewHost.Content = Content.Permutation;
+ }
+ }
+
+ protected override void SetEnabledStateOfControls() {
+ base.SetEnabledStateOfControls();
+ qualityGroupBox.Enabled = Content != null;
+ pictureBox.Enabled = Content != null;
+ tourGroupBox.Enabled = Content != null;
+ }
+
+ private void GenerateImage() {
+ if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
+ if (Content == null) {
+ pictureBox.Image = null;
+ } else {
+ DoubleMatrix coordinates = Content.Coordinates;
+ Permutation permutation = Content.Permutation;
+ DoubleArray probabilities = Content.Probabilities;
+ Bitmap bitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+
+ if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2) && (probabilities.Length == coordinates.Rows)) {
+ double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue;
+ for (int i = 0; i < coordinates.Rows; i++) {
+ if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0];
+ if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1];
+ if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0];
+ if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1];
+ }
+
+ int border = 20;
+ double xStep = xMax != xMin ? (pictureBox.Width - 2 * border) / (xMax - xMin) : 1;
+ double yStep = yMax != yMin ? (pictureBox.Height - 2 * border) / (yMax - yMin) : 1;
+
+ Point[] points = new Point[coordinates.Rows];
+ for (int i = 0; i < coordinates.Rows; i++)
+ points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+ bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+
+ using (Graphics graphics = Graphics.FromImage(bitmap)) {
+ if (permutation != null && permutation.Length > 1) {
+ Point[] tour = new Point[permutation.Length];
+ for (int i = 0; i < permutation.Length; i++) {
+ if (permutation[i] >= 0 && permutation[i] < points.Length)
+ tour[i] = points[permutation[i]];
+ }
+ graphics.DrawPolygon(Pens.Black, tour);
+ }
+ for (int i = 0; i < points.Length; i++)
+ graphics.FillRectangle(Brushes.Red, points[i].X - 2, points[i].Y - 2, Convert.ToInt32(probabilities[i] * 10), Convert.ToInt32(probabilities[i] * 10));
+ }
+ } else {
+ using (Graphics graphics = Graphics.FromImage(bitmap)) {
+ graphics.Clear(Color.White);
+ Font font = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular);
+ string text = "No coordinates defined or in wrong format.";
+ SizeF strSize = graphics.MeasureString(text, font);
+ graphics.DrawString(text, font, Brushes.Black, (float)(pictureBox.Width - strSize.Width) / 2.0f, (float)(pictureBox.Height - strSize.Height) / 2.0f);
+ }
+ }
+ pictureBox.Image = bitmap;
+ }
+ }
+ }
+
+ private void Content_QualityChanged(object sender, EventArgs 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);
+ else {
+ GenerateImage();
+ tourViewHost.Content = Content.Permutation;
+ }
+ }
+
+ private void Content_ProbabilitiesChanged(object sender, EventArgs e) {
+ if (InvokeRequired)
+ Invoke(new EventHandler(Content_ProbabilitiesChanged), sender, e);
+ else {
+ GenerateImage();
+ }
+ }
+
+ private void pictureBox_SizeChanged(object sender, EventArgs e) {
+ GenerateImage();
+ }
+ }
+}
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/Plugin.cs.frame
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/Plugin.cs.frame (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/Plugin.cs.frame (revision 12269)
@@ -0,0 +1,7 @@
+using HeuristicLab.PluginInfrastructure;
+namespace HeuristicLab.Problems.PTSP.Views {
+ [Plugin("HeuristicLab.Problems.PTSP.Views", "3.3.11.$WCREV$")]
+ [PluginFile("HeuristicLab.Problems.PTSP.Views-3.3.dll", PluginFileType.Assembly)]
+ public class Plugin : PluginBase {
+ }
+}
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.Designer.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.Designer.cs (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.Designer.cs (revision 12269)
@@ -0,0 +1,151 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 .
+ */
+#endregion
+
+namespace HeuristicLab.Problems.PTSP.Views {
+ partial class ProbabilisticTravelingSalesmanProblemView {
+ ///
+ /// Required designer variable.
+ ///
+ 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
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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.pathPTSPTourView = new HeuristicLab.Problems.PTSP.Views.PathPTSPTourView();
+ ((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.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";
+ this.parametersTabPage.UseVisualStyleBackColor = true;
+ //
+ // visualizationTabPage
+ //
+ this.visualizationTabPage.Controls.Add(this.pathPTSPTourView);
+ 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";
+ this.visualizationTabPage.UseVisualStyleBackColor = true;
+ //
+ // pathPTSPTourView
+ //
+ this.pathPTSPTourView.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.pathPTSPTourView.Caption = "PathPTSPTour View";
+ this.pathPTSPTourView.Content = null;
+ this.pathPTSPTourView.Location = new System.Drawing.Point(6, 6);
+ this.pathPTSPTourView.Name = "pathPTSPTourView";
+ this.pathPTSPTourView.ReadOnly = false;
+ this.pathPTSPTourView.Size = new System.Drawing.Size(491, 268);
+ this.pathPTSPTourView.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 PathPTSPTourView pathPTSPTourView;
+ }
+}
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.cs (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.cs (revision 12269)
@@ -0,0 +1,90 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 .
+ */
+#endregion
+
+using System;
+using System.Windows.Forms;
+using HeuristicLab.MainForm;
+using HeuristicLab.Optimization.Views;
+using HeuristicLab.Problems.PTSP;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.PTSP.Views {
+ ///
+ /// A view for a Traveling Salesman Problem instance.
+ ///
+ [View("Probabilistic Traveling Salesman Problem View")]
+ [Content(typeof(ProbabilisticTravelingSalesmanProblem), true)]
+ public sealed partial class ProbabilisticTravelingSalesmanProblemView : ProblemView {
+ public new ProbabilisticTravelingSalesmanProblem Content {
+ get { return (ProbabilisticTravelingSalesmanProblem)base.Content; }
+ set { base.Content = value; }
+ }
+
+ ///
+ /// Initializes a new instance of .
+ ///
+ public ProbabilisticTravelingSalesmanProblemView() {
+ InitializeComponent();
+ }
+
+ protected override void DeregisterContentEvents() {
+ Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
+ Content.ProbabilityMatrixParameter.ValueChanged -= new EventHandler(ProbabilityParameter_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.ProbabilityMatrixParameter.ValueChanged += new EventHandler(ProbabilityParameter_ValueChanged);
+ //Content.BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged);
+ Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
+ }
+ protected override void OnContentChanged() {
+ base.OnContentChanged();
+ if (Content == null) {
+ pathPTSPTourView.Content = null;
+ } else {
+ pathPTSPTourView.Content = new PathPTSPTour(Content.Coordinates, Content.ProbabilityMatrix, Content.BestKnownSolution, new DoubleValue(Content.BestKnownQuality));
+ }
+ }
+
+ protected override void SetEnabledStateOfControls() {
+ base.SetEnabledStateOfControls();
+ pathPTSPTourView.Enabled = Content != null;
+ }
+
+ private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
+ pathPTSPTourView.Content.Coordinates = Content.Coordinates;
+ }
+
+ private void ProbabilityParameter_ValueChanged(object sender, EventArgs e) {
+ pathPTSPTourView.Content.Probabilities = Content.ProbabilityMatrix;
+ }
+ private void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) {
+ pathPTSPTourView.Content.Quality = new DoubleValue(Content.BestKnownQuality);
+ }
+ private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
+ pathPTSPTourView.Content.Permutation = Content.BestKnownSolution;
+ }
+ }
+}
Index: /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/Properties/AssemblyInfo.cs.frame (revision 12269)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/Properties/AssemblyInfo.cs.frame (revision 12269)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Problems.PTSP.Views")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HEAL")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("f26124c8-f9ae-4c86-9c42-d4a1898df780")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.11.$WCREV$")]
Index: /branches/PTSP/HeuristicLab.Problems.PTSP/3.3/AnalyticalPTSP.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP/3.3/AnalyticalPTSP.cs (revision 12268)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP/3.3/AnalyticalPTSP.cs (revision 12269)
@@ -95,4 +95,42 @@
}
+ public double EvaluateWithParams(DistanceMatrix distances, DoubleArray probabilities, Permutation individual) {
+ Permutation p = individual;
+ // Compute A and B matrices
+ DoubleMatrix A = new DoubleMatrix(p.Length, p.Length - 1);
+ DoubleMatrix B = new DoubleMatrix(p.Length, p.Length - 1);
+ // Analytical evaluation
+ double firstSum = 0;
+ for (int i = 0; i < p.Length; i++) {
+ for (int j = i + 1; j < p.Length; j++) {
+ double sum1 = distances[p[i], p[j]] * probabilities[p[i]] * probabilities[p[j]];
+ for (int k = i + 1; k < j; k++) {
+ sum1 = sum1 * (1 - probabilities[p[k]]);
+ }
+ A[i, j - 1] = sum1;
+ firstSum += sum1;
+ }
+ }
+ double secondSum = 0;
+ for (int j = 0; j < p.Length; j++) {
+ for (int i = 0; i < j; i++) {
+ double sum2 = distances[p[j], p[i]] * probabilities[p[i]] * probabilities[p[j]];
+ for (int k = j + 1; k < p.Length; k++) {
+ sum2 = sum2 * (1 - probabilities[p[k]]);
+ }
+ for (int k = 0; k < i; k++) {
+ sum2 = sum2 * (1 - probabilities[p[k]]);
+ }
+ B[j,i] = sum2;
+ secondSum += sum2;
+ }
+ }
+ foreach (var op in Operators.OfType()) {
+ op.AParameter.Value = A;
+ op.BParameter.Value = B;
+ }
+ return firstSum + secondSum;
+ }
+
public AnalyticalProbabilisticTravelingSalesmanProblem() {
Operators.Add(new PTSPAnalyticalInversionMovePathEvaluator());
Index: /branches/PTSP/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs
===================================================================
--- /branches/PTSP/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs (revision 12268)
+++ /branches/PTSP/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs (revision 12269)
@@ -128,5 +128,5 @@
// For now uses sample size of 20 but should use Student's t-test
//Ttest(data.Dimension);
- SampleSize = new IntValue(25);
+ SampleSize = new IntValue(100);
MersenneTwister r = new MersenneTwister();
int countOnes = 0;