Changeset 17264
- Timestamp:
- 09/19/19 20:35:46 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 1 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/CoordinatesPTSPDataView.Designer.cs
r17260 r17264 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.tabControl = new System.Windows.Forms.TabControl(); 27 this.coordinatesTabPage = new System.Windows.Forms.TabPage(); 28 this.probabilitiesTabPage = new System.Windows.Forms.TabPage(); 29 this.probabilitiesView = new HeuristicLab.Data.Views.StringConvertibleArrayView(); 30 ((System.ComponentModel.ISupportInitialize)(this.coordinatesSplitContainer)).BeginInit(); 31 this.coordinatesSplitContainer.Panel1.SuspendLayout(); 32 this.coordinatesSplitContainer.Panel2.SuspendLayout(); 33 this.coordinatesSplitContainer.SuspendLayout(); 34 ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).BeginInit(); 35 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 36 this.tabControl.SuspendLayout(); 37 this.probabilitiesTabPage.SuspendLayout(); 38 this.SuspendLayout(); 39 // 40 // coordinatesSplitContainer 41 // 42 // 43 // coordinatesMatrixView 44 // 45 this.coordinatesMatrixView.ShowStatisticalInformation = false; 46 // 47 // nameTextBox 48 // 49 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 50 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 51 // 52 // tabControl 53 // 54 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 55 | System.Windows.Forms.AnchorStyles.Left) 56 | System.Windows.Forms.AnchorStyles.Right))); 57 this.tabControl.Controls.Add(this.coordinatesTabPage); 58 this.tabControl.Controls.Add(this.probabilitiesTabPage); 59 this.tabControl.Location = new System.Drawing.Point(0, 26); 60 this.tabControl.Name = "tabControl"; 61 this.tabControl.SelectedIndex = 0; 62 this.tabControl.Size = new System.Drawing.Size(256, 567); 63 this.tabControl.TabIndex = 2; 64 // 65 // coordinatesTabPage 66 // 67 this.coordinatesTabPage.Location = new System.Drawing.Point(4, 22); 68 this.coordinatesTabPage.Name = "coordinatesTabPage"; 69 this.coordinatesTabPage.Padding = new System.Windows.Forms.Padding(3); 70 this.coordinatesTabPage.Size = new System.Drawing.Size(248, 541); 71 this.coordinatesTabPage.TabIndex = 0; 72 this.coordinatesTabPage.Text = "Coordinates"; 73 this.coordinatesTabPage.UseVisualStyleBackColor = true; 74 // 75 // probabilitiesTabPage 76 // 77 this.probabilitiesTabPage.Controls.Add(this.probabilitiesView); 78 this.probabilitiesTabPage.Location = new System.Drawing.Point(4, 22); 79 this.probabilitiesTabPage.Name = "probabilitiesTabPage"; 80 this.probabilitiesTabPage.Padding = new System.Windows.Forms.Padding(3); 81 this.probabilitiesTabPage.Size = new System.Drawing.Size(248, 544); 82 this.probabilitiesTabPage.TabIndex = 1; 83 this.probabilitiesTabPage.Text = "Probabilities"; 84 this.probabilitiesTabPage.UseVisualStyleBackColor = true; 85 // 86 // probabilitiesView 87 // 88 this.probabilitiesView.Caption = "StringConvertibleArray View"; 89 this.probabilitiesView.Content = null; 90 this.probabilitiesView.Dock = System.Windows.Forms.DockStyle.Fill; 91 this.probabilitiesView.Location = new System.Drawing.Point(3, 3); 92 this.probabilitiesView.Name = "probabilitiesView"; 93 this.probabilitiesView.ReadOnly = false; 94 this.probabilitiesView.Size = new System.Drawing.Size(242, 538); 95 this.probabilitiesView.TabIndex = 0; 96 // 97 // CoordinatesPTSPDataView 98 // 99 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 100 this.Controls.Add(this.tabControl); 101 this.Name = "CoordinatesPTSPDataView"; 102 this.Controls.SetChildIndex(this.coordinatesSplitContainer, 0); 103 this.Controls.SetChildIndex(this.nameLabel, 0); 104 this.Controls.SetChildIndex(this.nameTextBox, 0); 105 this.Controls.SetChildIndex(this.infoLabel, 0); 106 this.Controls.SetChildIndex(this.tabControl, 0); 107 this.coordinatesSplitContainer.Panel1.ResumeLayout(false); 108 this.coordinatesSplitContainer.Panel2.ResumeLayout(false); 109 ((System.ComponentModel.ISupportInitialize)(this.coordinatesSplitContainer)).EndInit(); 110 this.coordinatesSplitContainer.ResumeLayout(false); 111 ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).EndInit(); 112 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 113 this.tabControl.ResumeLayout(false); 114 this.probabilitiesTabPage.ResumeLayout(false); 115 this.ResumeLayout(false); 116 this.PerformLayout(); 26 117 27 118 } … … 29 120 #endregion 30 121 122 private System.Windows.Forms.TabControl tabControl; 123 private System.Windows.Forms.TabPage coordinatesTabPage; 124 private System.Windows.Forms.TabPage probabilitiesTabPage; 125 private Data.Views.StringConvertibleArrayView probabilitiesView; 31 126 } 32 127 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/CoordinatesPTSPDataView.cs
r17260 r17264 20 20 #endregion 21 21 22 using System; 23 using System.Drawing; 22 24 using System.Windows.Forms; 25 using HeuristicLab.Data; 23 26 using HeuristicLab.MainForm; 24 27 using HeuristicLab.MainForm.WindowsForms; … … 37 40 public CoordinatesPTSPDataView() { 38 41 InitializeComponent(); 42 SuspendLayout(); 43 Controls.Remove(coordinatesMatrixView); 44 coordinatesMatrixView.Dock = System.Windows.Forms.DockStyle.None; 45 coordinatesTabPage.Controls.Add(coordinatesMatrixView); 46 coordinatesMatrixView.Dock = System.Windows.Forms.DockStyle.Fill; 47 ResumeLayout(true); 39 48 } 40 49 … … 42 51 base.OnContentChanged(); 43 52 if (Content == null) { 53 probabilitiesView.Content = null; 44 54 } else { 55 probabilitiesView.Content = Content.Probabilities; 45 56 } 46 57 } … … 48 59 protected override void SetEnabledStateOfControls() { 49 60 base.SetEnabledStateOfControls(); 61 probabilitiesView.Enabled = !ReadOnly && !Locked && Content != null; 62 } 63 64 protected override void GenerateImage() { 65 if ((coordinatesPictureBox.Width > 0) && (coordinatesPictureBox.Height > 0)) { 66 if (Content == null) { 67 coordinatesPictureBox.Image = null; 68 } else { 69 DoubleMatrix coordinates = Content.Coordinates; 70 DoubleArray probabilities = Content.Probabilities; 71 Bitmap bitmap = new Bitmap(coordinatesPictureBox.Width, coordinatesPictureBox.Height); 72 73 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2) && (probabilities.Length == coordinates.Rows)) { 74 double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue; 75 for (int i = 0; i < coordinates.Rows; i++) { 76 if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0]; 77 if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1]; 78 if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0]; 79 if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1]; 80 } 81 82 int border = 20; 83 double xStep = xMax != xMin ? (coordinatesPictureBox.Width - 2 * border) / (xMax - xMin) : 1; 84 double yStep = yMax != yMin ? (coordinatesPictureBox.Height - 2 * border) / (yMax - yMin) : 1; 85 86 Point[] points = new Point[coordinates.Rows]; 87 for (int i = 0; i < coordinates.Rows; i++) 88 points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)), 89 bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep)))); 90 91 using (Graphics graphics = Graphics.FromImage(bitmap)) { 92 for (int i = 0; i < points.Length; i++) 93 graphics.FillRectangle(Brushes.Red, points[i].X - 2, points[i].Y - 2, Convert.ToInt32(probabilities[i] * 20), Convert.ToInt32(probabilities[i] * 20)); 94 } 95 } else { 96 using (Graphics graphics = Graphics.FromImage(bitmap)) { 97 graphics.Clear(Color.White); 98 Font font = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular); 99 string text = "No coordinates defined or in wrong format."; 100 SizeF strSize = graphics.MeasureString(text, font); 101 graphics.DrawString(text, font, Brushes.Black, (float)(coordinatesPictureBox.Width - strSize.Width) / 2.0f, (float)(coordinatesPictureBox.Height - strSize.Height) / 2.0f); 102 } 103 } 104 coordinatesPictureBox.Image = bitmap; 105 } 106 } 50 107 } 51 108 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/EuclideanPTSPDataView.Designer.cs
r17260 r17264 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.tabControl = new System.Windows.Forms.TabControl(); 27 this.coordinatesTabPage = new System.Windows.Forms.TabPage(); 28 this.probabilitiesTabPage = new System.Windows.Forms.TabPage(); 29 this.probabilitiesView = new HeuristicLab.Data.Views.StringConvertibleArrayView(); 30 ((System.ComponentModel.ISupportInitialize)(this.coordinatesSplitContainer)).BeginInit(); 31 this.coordinatesSplitContainer.Panel1.SuspendLayout(); 32 this.coordinatesSplitContainer.Panel2.SuspendLayout(); 33 this.coordinatesSplitContainer.SuspendLayout(); 34 ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).BeginInit(); 35 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 36 this.tabControl.SuspendLayout(); 37 this.probabilitiesTabPage.SuspendLayout(); 38 this.SuspendLayout(); 39 // 40 // coordinatesSplitContainer 41 // 42 // 43 // coordinatesSplitContainer.Panel1 44 // 45 this.coordinatesSplitContainer.Panel1.Controls.Add(this.tabControl); 46 // 47 // coordinatesMatrixView 48 // 49 this.coordinatesMatrixView.ShowStatisticalInformation = false; 50 // 51 // nameTextBox 52 // 53 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 54 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 55 // 56 // tabControl 57 // 58 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 59 | System.Windows.Forms.AnchorStyles.Left) 60 | System.Windows.Forms.AnchorStyles.Right))); 61 this.tabControl.Controls.Add(this.coordinatesTabPage); 62 this.tabControl.Controls.Add(this.probabilitiesTabPage); 63 this.tabControl.Location = new System.Drawing.Point(0, 30); 64 this.tabControl.Name = "tabControl"; 65 this.tabControl.SelectedIndex = 0; 66 this.tabControl.Size = new System.Drawing.Size(256, 540); 67 this.tabControl.TabIndex = 4; 68 // 69 // coordinatesTabPage 70 // 71 this.coordinatesTabPage.Location = new System.Drawing.Point(4, 22); 72 this.coordinatesTabPage.Name = "coordinatesTabPage"; 73 this.coordinatesTabPage.Padding = new System.Windows.Forms.Padding(3); 74 this.coordinatesTabPage.Size = new System.Drawing.Size(248, 514); 75 this.coordinatesTabPage.TabIndex = 0; 76 this.coordinatesTabPage.Text = "Coordinates"; 77 this.coordinatesTabPage.UseVisualStyleBackColor = true; 78 // 79 // probabilitiesTabPage 80 // 81 this.probabilitiesTabPage.Controls.Add(this.probabilitiesView); 82 this.probabilitiesTabPage.Location = new System.Drawing.Point(4, 22); 83 this.probabilitiesTabPage.Name = "probabilitiesTabPage"; 84 this.probabilitiesTabPage.Padding = new System.Windows.Forms.Padding(3); 85 this.probabilitiesTabPage.Size = new System.Drawing.Size(248, 514); 86 this.probabilitiesTabPage.TabIndex = 1; 87 this.probabilitiesTabPage.Text = "Probabilities"; 88 this.probabilitiesTabPage.UseVisualStyleBackColor = true; 89 // 90 // probabilitiesView 91 // 92 this.probabilitiesView.Caption = "StringConvertibleArray View"; 93 this.probabilitiesView.Content = null; 94 this.probabilitiesView.Dock = System.Windows.Forms.DockStyle.Fill; 95 this.probabilitiesView.Location = new System.Drawing.Point(3, 3); 96 this.probabilitiesView.Name = "probabilitiesView"; 97 this.probabilitiesView.ReadOnly = false; 98 this.probabilitiesView.Size = new System.Drawing.Size(242, 508); 99 this.probabilitiesView.TabIndex = 0; 100 // 101 // EuclideanPTSPDataView 102 // 103 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 104 this.Name = "EuclideanPTSPDataView"; 105 this.coordinatesSplitContainer.Panel1.ResumeLayout(false); 106 this.coordinatesSplitContainer.Panel1.PerformLayout(); 107 this.coordinatesSplitContainer.Panel2.ResumeLayout(false); 108 ((System.ComponentModel.ISupportInitialize)(this.coordinatesSplitContainer)).EndInit(); 109 this.coordinatesSplitContainer.ResumeLayout(false); 110 ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).EndInit(); 111 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 112 this.tabControl.ResumeLayout(false); 113 this.probabilitiesTabPage.ResumeLayout(false); 114 this.ResumeLayout(false); 115 this.PerformLayout(); 26 116 27 117 } … … 29 119 #endregion 30 120 121 private System.Windows.Forms.TabControl tabControl; 122 private System.Windows.Forms.TabPage coordinatesTabPage; 123 private System.Windows.Forms.TabPage probabilitiesTabPage; 124 private Data.Views.StringConvertibleArrayView probabilitiesView; 31 125 } 32 126 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/EuclideanPTSPDataView.cs
r17260 r17264 20 20 #endregion 21 21 22 using System; 23 using System.Drawing; 24 using HeuristicLab.Data; 22 25 using HeuristicLab.MainForm; 23 26 using HeuristicLab.Problems.TravelingSalesman.Views; … … 35 38 public EuclideanPTSPDataView() { 36 39 InitializeComponent(); 40 SuspendLayout(); 41 Controls.Remove(coordinatesMatrixView); 42 coordinatesMatrixView.Dock = System.Windows.Forms.DockStyle.None; 43 coordinatesTabPage.Controls.Add(coordinatesMatrixView); 44 coordinatesMatrixView.Dock = System.Windows.Forms.DockStyle.Fill; 45 ResumeLayout(true); 37 46 } 38 47 … … 40 49 base.OnContentChanged(); 41 50 if (Content == null) { 42 51 probabilitiesView.Content = null; 43 52 } else { 44 53 probabilitiesView.Content = Content.Probabilities; 45 54 } 46 55 } … … 48 57 protected override void SetEnabledStateOfControls() { 49 58 base.SetEnabledStateOfControls(); 59 probabilitiesView.Enabled = !ReadOnly && !Locked && Content != null; 60 } 50 61 62 protected override void GenerateImage() { 63 if ((coordinatesPictureBox.Width > 0) && (coordinatesPictureBox.Height > 0)) { 64 if (Content == null) { 65 coordinatesPictureBox.Image = null; 66 } else { 67 DoubleMatrix coordinates = Content.Coordinates; 68 DoubleArray probabilities = Content.Probabilities; 69 Bitmap bitmap = new Bitmap(coordinatesPictureBox.Width, coordinatesPictureBox.Height); 70 71 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2) && (probabilities.Length == coordinates.Rows)) { 72 double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue; 73 for (int i = 0; i < coordinates.Rows; i++) { 74 if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0]; 75 if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1]; 76 if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0]; 77 if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1]; 78 } 79 80 int border = 20; 81 double xStep = xMax != xMin ? (coordinatesPictureBox.Width - 2 * border) / (xMax - xMin) : 1; 82 double yStep = yMax != yMin ? (coordinatesPictureBox.Height - 2 * border) / (yMax - yMin) : 1; 83 84 Point[] points = new Point[coordinates.Rows]; 85 for (int i = 0; i < coordinates.Rows; i++) 86 points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)), 87 bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep)))); 88 89 using (Graphics graphics = Graphics.FromImage(bitmap)) { 90 for (int i = 0; i < points.Length; i++) 91 graphics.FillRectangle(Brushes.Red, points[i].X - 2, points[i].Y - 2, Convert.ToInt32(probabilities[i] * 20), Convert.ToInt32(probabilities[i] * 20)); 92 } 93 } else { 94 using (Graphics graphics = Graphics.FromImage(bitmap)) { 95 graphics.Clear(Color.White); 96 Font font = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular); 97 string text = "No coordinates defined or in wrong format."; 98 SizeF strSize = graphics.MeasureString(text, font); 99 graphics.DrawString(text, font, Brushes.Black, (float)(coordinatesPictureBox.Width - strSize.Width) / 2.0f, (float)(coordinatesPictureBox.Height - strSize.Height) / 2.0f); 100 } 101 } 102 coordinatesPictureBox.Image = bitmap; 103 } 104 } 51 105 } 52 106 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/HeuristicLab.Problems.PTSP.Views-3.3.csproj
r17260 r17264 200 200 <None Include="Plugin.cs.frame" /> 201 201 <None Include="Properties\AssemblyInfo.cs.frame" /> 202 </ItemGroup>203 <ItemGroup>204 <EmbeddedResource Include="MatrixPTSPDataView.resx">205 <DependentUpon>MatrixPTSPDataView.cs</DependentUpon>206 </EmbeddedResource>207 202 </ItemGroup> 208 203 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/MatrixPTSPDataView.Designer.cs
r17260 r17264 38 38 this.SuspendLayout(); 39 39 // 40 // distanceMatrixView 41 // 42 this.distanceMatrixView.ShowStatisticalInformation = false; 43 // 40 44 // tabControl 41 45 // … … 55 59 // coordinatesMatrixView 56 60 // 61 this.coordinatesMatrixView.ShowStatisticalInformation = false; 57 62 this.coordinatesMatrixView.Size = new System.Drawing.Size(252, 538); 58 63 // … … 88 93 this.probabilitiesView.TabIndex = 0; 89 94 // 90 // MatrixP robabilisticTSPDataView95 // MatrixPTSPDataView 91 96 // 92 97 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 93 this.Name = "MatrixP robabilisticTSPDataView";98 this.Name = "MatrixPTSPDataView"; 94 99 this.tabControl.ResumeLayout(false); 95 100 this.coordinatesTabPage.ResumeLayout(false); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/AnalyticalPTSP.cs
r17260 r17264 20 20 #endregion 21 21 22 using System.Linq;23 22 using HEAL.Attic; 24 23 using HeuristicLab.Common; … … 48 47 Operators.Add(new PTSPAnalyticalTwoPointFiveMoveEvaluator()); 49 48 50 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); 51 foreach (var twopointfiveMoveOperator in Operators.OfType<ITwoPointFiveMoveOperator>()) { 52 twopointfiveMoveOperator.TwoPointFiveMoveParameter.ActualName = "Permutation.TwoPointFiveMove"; 53 } 49 Encoding.ConfigureOperators(Operators); 54 50 } 55 51 56 52 public override IDeepCloneable Clone(Cloner cloner) { 57 53 return new AnalyticalPTSP(this, cloner); 54 } 55 56 protected override void OnEncodingChanged() { 57 base.OnEncodingChanged(); 58 Encoding.ConfigureOperators(Operators); 58 59 } 59 60 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs
r17260 r17264 29 29 using HeuristicLab.Encodings.PermutationEncoding; 30 30 using HeuristicLab.Parameters; 31 using HeuristicLab.Problems.Instances; 31 32 using HeuristicLab.Random; 32 33 … … 189 190 } 190 191 192 public override void Load(PTSPData data) { 193 base.Load(data); 194 UpdateRealizations(); 195 } 196 191 197 private void UpdateRealizations() { 192 198 var data = new List<BoolArray>(Realizations); 193 var rng = new FastRandom(RealizationsSeed); 194 for (var i = 0; i < Realizations; i++) { 199 var rng = new MersenneTwister((uint)RealizationsSeed); 200 if (Enumerable.Range(0, ProbabilisticTSPData.Cities).All(c => ProbabilisticTSPData.GetProbability(c) <= 0)) 201 throw new InvalidOperationException("All probabilities are zero."); 202 while (data.Count < Realizations) { 195 203 var cities = 0; 196 204 var r = new bool[ProbabilisticTSPData.Cities]; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPAnalyticalInsertionLocalImprovement.cs
r17260 r17264 40 40 [Item("pTSP Analytical Insertion Local Improvement", "An operator that improves probabilistic traveling salesman solutions. The operator tries to improve the probabilistic traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")] 41 41 [StorableType("5adca9d8-02b2-4937-9f79-a24d8ea8ea19")] 42 public sealed class PTSPAnalyticalInsertionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, I LocalImprovementOperator {42 public sealed class PTSPAnalyticalInsertionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, IPermutationLocalImprovementOperator { 43 43 44 44 public ILookupParameter<IntValue> LocalIterationsParameter { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPAnalyticalInversionLocalImprovement.cs
r17260 r17264 40 40 [Item("pTSP Analytical Inversion Local Improvement", "An operator that improves probabilistic traveling salesman solutions. The operator tries to improve the probabilistic traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")] 41 41 [StorableType("88147d6a-e843-4f65-8058-421453b5206a")] 42 public sealed class PTSPAnalyticalInversionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, I LocalImprovementOperator {42 public sealed class PTSPAnalyticalInversionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, IPermutationLocalImprovementOperator { 43 43 44 44 public ILookupParameter<IntValue> LocalIterationsParameter { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPAnalyticalTwoPointFiveLocalImprovement.cs
r17260 r17264 40 40 [Item("pTSP Analytical 2.5 Local Improvement", "An operator that improves probabilistic traveling salesman solutions. The operator tries to improve the probabilistic traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")] 41 41 [StorableType("6e07195e-0da7-45ea-9385-0c66594127db")] 42 public sealed class PTSPAnalyticalTwoPointFiveLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, I LocalImprovementOperator {42 public sealed class PTSPAnalyticalTwoPointFiveLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, IPermutationLocalImprovementOperator { 43 43 44 44 public ILookupParameter<IntValue> LocalIterationsParameter { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInsertionLocalImprovement.cs
r17260 r17264 42 42 [Item("pTSP Estimated Insertion Local Improvement", "An operator that improves probabilistic traveling salesman solutions. The operator tries to improve the probabilistic traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")] 43 43 [StorableType("B2D60579-A97D-4E44-B11C-61CDA6EBEBA7")] 44 public sealed class PTSPEstimatedInsertionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, I LocalImprovementOperator {44 public sealed class PTSPEstimatedInsertionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, IPermutationLocalImprovementOperator { 45 45 46 46 public ILookupParameter<IntValue> LocalIterationsParameter { … … 76 76 } 77 77 78 public ILookupParameter<ReadOnlyItemList<BoolArray>> Realization sParameter {79 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realization s"]; }78 public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter { 79 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; } 80 80 } 81 81 … … 93 93 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized.")); 94 94 Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the pTSP.")); 95 Parameters.Add(new LookupParameter< ItemList<BoolArray>>("Realizations", "The list of samples drawn from all possible stochastic instances."));95 Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("RealizationData", "The list of samples drawn from all possible stochastic instances.")); 96 96 } 97 97 … … 131 131 var evaluations = EvaluatedSolutionsParameter.ActualValue; 132 132 var data = ProbabilisticTSPDataParameter.ActualValue; 133 var realizations = Realization sParameter.ActualValue;133 var realizations = RealizationDataParameter.ActualValue; 134 134 if (localIterations == null) { 135 135 localIterations = new IntValue(0); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInversionLocalImprovement.cs
r17260 r17264 42 42 [Item("PTSP Estimated Inversion Local Improvement", "An operator that improves probabilistic traveling salesman solutions. The operator tries to improve the probabilistic traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")] 43 43 [StorableType("AA67F3B1-2667-4F0B-A79F-4A02B89EE977")] 44 public sealed class PTSPEstimatedInversionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, I LocalImprovementOperator {44 public sealed class PTSPEstimatedInversionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, IPermutationLocalImprovementOperator { 45 45 46 46 public ILookupParameter<IntValue> LocalIterationsParameter { … … 76 76 } 77 77 78 public ILookupParameter<ReadOnlyItemList<BoolArray>> Realization sParameter {79 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realization s"]; }78 public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter { 79 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; } 80 80 } 81 81 … … 93 93 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized.")); 94 94 Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the pTSP.")); 95 Parameters.Add(new LookupParameter< ItemList<BoolArray>>("Realizations", "The list of samples drawn from all possible stochastic instances."));95 Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("RealizationData", "The list of samples drawn from all possible stochastic instances.")); 96 96 } 97 97 … … 131 131 var evaluations = EvaluatedSolutionsParameter.ActualValue; 132 132 var data = ProbabilisticTSPDataParameter.ActualValue; 133 var realizations = Realization sParameter.ActualValue;133 var realizations = RealizationDataParameter.ActualValue; 134 134 if (localIterations == null) { 135 135 localIterations = new IntValue(0); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedTwoPointFiveLocalImprovement.cs
r17260 r17264 42 42 [Item("PTSP Estimated 2.5 Local Improvement", "An operator that improves probabilistic traveling salesman solutions. The operator tries to improve the probabilistic traveling salesman solution by swapping two randomly chosen edges for a certain number of times.")] 43 43 [StorableType("8B04265A-50AD-4FAD-99F8-2357D6F10CC3")] 44 public sealed class PTSPEstimatedTwoPointFiveLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, I LocalImprovementOperator {44 public sealed class PTSPEstimatedTwoPointFiveLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, IPermutationLocalImprovementOperator { 45 45 46 46 public ILookupParameter<IntValue> LocalIterationsParameter { … … 75 75 get { return (ILookupParameter<IProbabilisticTSPData>)Parameters["PTSP Data"]; } 76 76 } 77 public ILookupParameter<ReadOnlyItemList<BoolArray>> Realization sParameter {78 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realization s"]; }77 public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter { 78 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; } 79 79 } 80 80 … … 92 92 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized.")); 93 93 Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the pTSP.")); 94 Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("Realization s", "The list of samples drawn from all possible stochastic instances."));94 Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("RealizationData", "The list of samples drawn from all possible stochastic instances.")); 95 95 } 96 96 … … 131 131 var evaluations = EvaluatedSolutionsParameter.ActualValue; 132 132 var data = ProbabilisticTSPDataParameter.ActualValue; 133 var realizations = Realization sParameter.ActualValue;133 var realizations = RealizationDataParameter.ActualValue; 134 134 if (localIterations == null) { 135 135 localIterations = new IntValue(0); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Interfaces/IEstimatedPTSPOperator.cs
r17253 r17264 28 28 public interface IEstimatedPTSPOperator : IItem { 29 29 ILookupParameter<IProbabilisticTSPData> ProbabilisticTSPDataParameter { get; } 30 ILookupParameter<ReadOnlyItemList<BoolArray>> Realization sParameter { get; }30 ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter { get; } 31 31 } 32 32 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Interfaces/ITwoPointFiveMoveOperator.cs
r17226 r17264 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Optimization; 24 using HEAL.Attic; 24 using HeuristicLab.Encodings.PermutationEncoding; 25 25 26 26 namespace HeuristicLab.Problems.PTSP { 27 27 [StorableType("C21E0AC3-85BD-4F40-8DD6-E79A019278E1")] 28 public interface ITwoPointFiveMoveOperator : I MoveOperator {28 public interface ITwoPointFiveMoveOperator : IPermutationMoveOperator { 29 29 ILookupParameter<TwoPointFiveMove> TwoPointFiveMoveParameter { get; } 30 30 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Moves/EstimatedPTSPMoveEvaluator.cs
r17260 r17264 43 43 get { return (ILookupParameter<IProbabilisticTSPData>)Parameters["PTSP Data"]; } 44 44 } 45 public ILookupParameter<ReadOnlyItemList<BoolArray>> Realization sParameter {46 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realization s"]; }45 public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter { 46 get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; } 47 47 } 48 48 public ILookupParameter<DoubleValue> QualityParameter { … … 60 60 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation.")); 61 61 Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the pTSP.")); 62 Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("Realization s", "The list of samples drawn from all possible stochastic instances."));62 Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("RealizationData", "The list of samples drawn from all possible stochastic instances.")); 63 63 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of a TSP solution.")); 64 64 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The evaluated quality of a move on a TSP solution.")); … … 67 67 public override IOperation Apply() { 68 68 var permutation = PermutationParameter.ActualValue; 69 var realizations = Realization sParameter.ActualValue;69 var realizations = RealizationDataParameter.ActualValue; 70 70 var data = ProbabilisticTSPDataParameter.ActualValue; 71 71 var relativeQualityDifference = EvaluateMove(permutation, data, realizations); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/ProbabilisticTSP.cs
r17260 r17264 157 157 try { 158 158 var tour = new Permutation(PermutationTypes.RelativeUndirected, data.BestKnownTour); 159 var tourLength = Evaluate(tour, new FastRandom(1));159 var tourLength = Evaluate(tour, new MersenneTwister(1)); 160 160 BestKnownSolution = new ProbabilisticTSPSolution(data.Coordinates != null ? new DoubleMatrix(data.Coordinates) : null, new PercentArray(data.Probabilities), tour, new DoubleValue(tourLength)); 161 161 BestKnownQuality = tourLength; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/CoordinatesTSPDataView.Designer.cs
r17251 r17264 73 73 this.coordinatesMatrixView.ReadOnly = false; 74 74 this.coordinatesMatrixView.ShowRowsAndColumnsTextBox = true; 75 this.coordinatesMatrixView.ShowStatisticalInformation = true;75 this.coordinatesMatrixView.ShowStatisticalInformation = false; 76 76 this.coordinatesMatrixView.Size = new System.Drawing.Size(256, 570); 77 77 this.coordinatesMatrixView.TabIndex = 1; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/EuclideanTSPDataView.Designer.cs
r17260 r17264 31 31 this.coordinatesSplitContainer.SuspendLayout(); 32 32 ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).BeginInit(); 33 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 33 34 this.SuspendLayout(); 34 35 // … … 48 49 this.coordinatesMatrixView.Dock = System.Windows.Forms.DockStyle.None; 49 50 this.coordinatesMatrixView.Location = new System.Drawing.Point(0, 30); 51 this.coordinatesMatrixView.ShowStatisticalInformation = false; 50 52 this.coordinatesMatrixView.Size = new System.Drawing.Size(256, 598); 53 // 54 // nameTextBox 55 // 56 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 57 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 51 58 // 52 59 // roundingModeLabel … … 81 88 this.coordinatesSplitContainer.ResumeLayout(false); 82 89 ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).EndInit(); 90 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 83 91 this.ResumeLayout(false); 92 this.PerformLayout(); 84 93 85 94 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/MatrixTSPDataView.Designer.cs
r17260 r17264 85 85 this.distanceMatrixView.ReadOnly = false; 86 86 this.distanceMatrixView.ShowRowsAndColumnsTextBox = true; 87 this.distanceMatrixView.ShowStatisticalInformation = true;87 this.distanceMatrixView.ShowStatisticalInformation = false; 88 88 this.distanceMatrixView.Size = new System.Drawing.Size(757, 538); 89 89 this.distanceMatrixView.TabIndex = 0; … … 95 95 this.coordinatesTabPage.Name = "coordinatesTabPage"; 96 96 this.coordinatesTabPage.Padding = new System.Windows.Forms.Padding(3); 97 this.coordinatesTabPage.Size = new System.Drawing.Size(763, 5 70);97 this.coordinatesTabPage.Size = new System.Drawing.Size(763, 544); 98 98 this.coordinatesTabPage.TabIndex = 1; 99 99 this.coordinatesTabPage.Text = "Display Coordinates"; … … 113 113 // 114 114 this.coordinatesSplitContainer.Panel2.Controls.Add(this.coordinatesPictureBox); 115 this.coordinatesSplitContainer.Size = new System.Drawing.Size(757, 5 64);115 this.coordinatesSplitContainer.Size = new System.Drawing.Size(757, 538); 116 116 this.coordinatesSplitContainer.SplitterDistance = 252; 117 117 this.coordinatesSplitContainer.TabIndex = 0; … … 126 126 this.coordinatesMatrixView.ReadOnly = false; 127 127 this.coordinatesMatrixView.ShowRowsAndColumnsTextBox = true; 128 this.coordinatesMatrixView.ShowStatisticalInformation = true;129 this.coordinatesMatrixView.Size = new System.Drawing.Size(252, 5 64);128 this.coordinatesMatrixView.ShowStatisticalInformation = false; 129 this.coordinatesMatrixView.Size = new System.Drawing.Size(252, 538); 130 130 this.coordinatesMatrixView.TabIndex = 1; 131 131 // … … 135 135 this.coordinatesPictureBox.Location = new System.Drawing.Point(0, 0); 136 136 this.coordinatesPictureBox.Name = "coordinatesPictureBox"; 137 this.coordinatesPictureBox.Size = new System.Drawing.Size(501, 5 64);137 this.coordinatesPictureBox.Size = new System.Drawing.Size(501, 538); 138 138 this.coordinatesPictureBox.TabIndex = 0; 139 139 this.coordinatesPictureBox.TabStop = false;
Note: See TracChangeset
for help on using the changeset viewer.