Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/19/19 20:35:46 (5 years ago)
Author:
abeham
Message:

#2521: Finished refactoring pTSP

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  
    2424    /// </summary>
    2525    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();
    26117
    27118    }
     
    29120    #endregion
    30121
     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;
    31126  }
    32127}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/CoordinatesPTSPDataView.cs

    r17260 r17264  
    2020#endregion
    2121
     22using System;
     23using System.Drawing;
    2224using System.Windows.Forms;
     25using HeuristicLab.Data;
    2326using HeuristicLab.MainForm;
    2427using HeuristicLab.MainForm.WindowsForms;
     
    3740    public CoordinatesPTSPDataView() {
    3841      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);
    3948    }
    4049
     
    4251      base.OnContentChanged();
    4352      if (Content == null) {
     53        probabilitiesView.Content = null;
    4454      } else {
     55        probabilitiesView.Content = Content.Probabilities;
    4556      }
    4657    }
     
    4859    protected override void SetEnabledStateOfControls() {
    4960      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      }
    50107    }
    51108  }
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/EuclideanPTSPDataView.Designer.cs

    r17260 r17264  
    2424    /// </summary>
    2525    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();
    26116
    27117    }
     
    29119    #endregion
    30120
     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;
    31125  }
    32126}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/EuclideanPTSPDataView.cs

    r17260 r17264  
    2020#endregion
    2121
     22using System;
     23using System.Drawing;
     24using HeuristicLab.Data;
    2225using HeuristicLab.MainForm;
    2326using HeuristicLab.Problems.TravelingSalesman.Views;
     
    3538    public EuclideanPTSPDataView() {
    3639      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);
    3746    }
    3847
     
    4049      base.OnContentChanged();
    4150      if (Content == null) {
    42 
     51        probabilitiesView.Content = null;
    4352      } else {
    44 
     53        probabilitiesView.Content = Content.Probabilities;
    4554      }
    4655    }
     
    4857    protected override void SetEnabledStateOfControls() {
    4958      base.SetEnabledStateOfControls();
     59      probabilitiesView.Enabled = !ReadOnly && !Locked && Content != null;
     60    }
    5061
     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      }
    51105    }
    52106  }
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/HeuristicLab.Problems.PTSP.Views-3.3.csproj

    r17260 r17264  
    200200    <None Include="Plugin.cs.frame" />
    201201    <None Include="Properties\AssemblyInfo.cs.frame" />
    202   </ItemGroup>
    203   <ItemGroup>
    204     <EmbeddedResource Include="MatrixPTSPDataView.resx">
    205       <DependentUpon>MatrixPTSPDataView.cs</DependentUpon>
    206     </EmbeddedResource>
    207202  </ItemGroup>
    208203  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP.Views/3.3/MatrixPTSPDataView.Designer.cs

    r17260 r17264  
    3838      this.SuspendLayout();
    3939      //
     40      // distanceMatrixView
     41      //
     42      this.distanceMatrixView.ShowStatisticalInformation = false;
     43      //
    4044      // tabControl
    4145      //
     
    5559      // coordinatesMatrixView
    5660      //
     61      this.coordinatesMatrixView.ShowStatisticalInformation = false;
    5762      this.coordinatesMatrixView.Size = new System.Drawing.Size(252, 538);
    5863      //
     
    8893      this.probabilitiesView.TabIndex = 0;
    8994      //
    90       // MatrixProbabilisticTSPDataView
     95      // MatrixPTSPDataView
    9196      //
    9297      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    93       this.Name = "MatrixProbabilisticTSPDataView";
     98      this.Name = "MatrixPTSPDataView";
    9499      this.tabControl.ResumeLayout(false);
    95100      this.coordinatesTabPage.ResumeLayout(false);
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/AnalyticalPTSP.cs

    r17260 r17264  
    2020#endregion
    2121
    22 using System.Linq;
    2322using HEAL.Attic;
    2423using HeuristicLab.Common;
     
    4847      Operators.Add(new PTSPAnalyticalTwoPointFiveMoveEvaluator());
    4948
    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);
    5450    }
    5551
    5652    public override IDeepCloneable Clone(Cloner cloner) {
    5753      return new AnalyticalPTSP(this, cloner);
     54    }
     55
     56    protected override void OnEncodingChanged() {
     57      base.OnEncodingChanged();
     58      Encoding.ConfigureOperators(Operators);
    5859    }
    5960
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/EstimatedPTSP.cs

    r17260 r17264  
    2929using HeuristicLab.Encodings.PermutationEncoding;
    3030using HeuristicLab.Parameters;
     31using HeuristicLab.Problems.Instances;
    3132using HeuristicLab.Random;
    3233
     
    189190    }
    190191
     192    public override void Load(PTSPData data) {
     193      base.Load(data);
     194      UpdateRealizations();
     195    }
     196
    191197    private void UpdateRealizations() {
    192198      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) {
    195203        var cities = 0;
    196204        var r = new bool[ProbabilisticTSPData.Cities];
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPAnalyticalInsertionLocalImprovement.cs

    r17260 r17264  
    4040  [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.")]
    4141  [StorableType("5adca9d8-02b2-4937-9f79-a24d8ea8ea19")]
    42   public sealed class PTSPAnalyticalInsertionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, ILocalImprovementOperator {
     42  public sealed class PTSPAnalyticalInsertionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, IPermutationLocalImprovementOperator {
    4343
    4444    public ILookupParameter<IntValue> LocalIterationsParameter {
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPAnalyticalInversionLocalImprovement.cs

    r17260 r17264  
    4040  [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.")]
    4141  [StorableType("88147d6a-e843-4f65-8058-421453b5206a")]
    42   public sealed class PTSPAnalyticalInversionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, ILocalImprovementOperator {
     42  public sealed class PTSPAnalyticalInversionLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, IPermutationLocalImprovementOperator {
    4343
    4444    public ILookupParameter<IntValue> LocalIterationsParameter {
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPAnalyticalTwoPointFiveLocalImprovement.cs

    r17260 r17264  
    4040  [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.")]
    4141  [StorableType("6e07195e-0da7-45ea-9385-0c66594127db")]
    42   public sealed class PTSPAnalyticalTwoPointFiveLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, ILocalImprovementOperator {
     42  public sealed class PTSPAnalyticalTwoPointFiveLocalImprovement : SingleSuccessorOperator, IAnalyticalPTSPOperator, IPermutationLocalImprovementOperator {
    4343
    4444    public ILookupParameter<IntValue> LocalIterationsParameter {
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInsertionLocalImprovement.cs

    r17260 r17264  
    4242  [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.")]
    4343  [StorableType("B2D60579-A97D-4E44-B11C-61CDA6EBEBA7")]
    44   public sealed class PTSPEstimatedInsertionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, ILocalImprovementOperator {
     44  public sealed class PTSPEstimatedInsertionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, IPermutationLocalImprovementOperator {
    4545
    4646    public ILookupParameter<IntValue> LocalIterationsParameter {
     
    7676    }
    7777
    78     public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationsParameter {
    79       get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realizations"]; }
     78    public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter {
     79      get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; }
    8080    }
    8181
     
    9393      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized."));
    9494      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."));
    9696    }
    9797
     
    131131      var evaluations = EvaluatedSolutionsParameter.ActualValue;
    132132      var data = ProbabilisticTSPDataParameter.ActualValue;
    133       var realizations = RealizationsParameter.ActualValue;
     133      var realizations = RealizationDataParameter.ActualValue;
    134134      if (localIterations == null) {
    135135        localIterations = new IntValue(0);
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInversionLocalImprovement.cs

    r17260 r17264  
    4242  [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.")]
    4343  [StorableType("AA67F3B1-2667-4F0B-A79F-4A02B89EE977")]
    44   public sealed class PTSPEstimatedInversionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, ILocalImprovementOperator {
     44  public sealed class PTSPEstimatedInversionLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, IPermutationLocalImprovementOperator {
    4545
    4646    public ILookupParameter<IntValue> LocalIterationsParameter {
     
    7676    }
    7777
    78     public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationsParameter {
    79       get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realizations"]; }
     78    public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter {
     79      get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; }
    8080    }
    8181
     
    9393      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized."));
    9494      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."));
    9696    }
    9797
     
    131131      var evaluations = EvaluatedSolutionsParameter.ActualValue;
    132132      var data = ProbabilisticTSPDataParameter.ActualValue;
    133       var realizations = RealizationsParameter.ActualValue;
     133      var realizations = RealizationDataParameter.ActualValue;
    134134      if (localIterations == null) {
    135135        localIterations = new IntValue(0);
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedTwoPointFiveLocalImprovement.cs

    r17260 r17264  
    4242  [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.")]
    4343  [StorableType("8B04265A-50AD-4FAD-99F8-2357D6F10CC3")]
    44   public sealed class PTSPEstimatedTwoPointFiveLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, ILocalImprovementOperator {
     44  public sealed class PTSPEstimatedTwoPointFiveLocalImprovement : SingleSuccessorOperator, IEstimatedPTSPOperator, IPermutationLocalImprovementOperator {
    4545
    4646    public ILookupParameter<IntValue> LocalIterationsParameter {
     
    7575      get { return (ILookupParameter<IProbabilisticTSPData>)Parameters["PTSP Data"]; }
    7676    }
    77     public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationsParameter {
    78       get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realizations"]; }
     77    public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter {
     78      get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; }
    7979    }
    8080
     
    9292      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized."));
    9393      Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the pTSP."));
    94       Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("Realizations", "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."));
    9595    }
    9696
     
    131131      var evaluations = EvaluatedSolutionsParameter.ActualValue;
    132132      var data = ProbabilisticTSPDataParameter.ActualValue;
    133       var realizations = RealizationsParameter.ActualValue;
     133      var realizations = RealizationDataParameter.ActualValue;
    134134      if (localIterations == null) {
    135135        localIterations = new IntValue(0);
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Interfaces/IEstimatedPTSPOperator.cs

    r17253 r17264  
    2828  public interface IEstimatedPTSPOperator : IItem {
    2929    ILookupParameter<IProbabilisticTSPData> ProbabilisticTSPDataParameter { get; }
    30     ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationsParameter { get; }
     30    ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter { get; }
    3131  }
    3232}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Interfaces/ITwoPointFiveMoveOperator.cs

    r17226 r17264  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Optimization;
    24 using HEAL.Attic;
     24using HeuristicLab.Encodings.PermutationEncoding;
    2525
    2626namespace HeuristicLab.Problems.PTSP {
    2727  [StorableType("C21E0AC3-85BD-4F40-8DD6-E79A019278E1")]
    28   public interface ITwoPointFiveMoveOperator : IMoveOperator {
     28  public interface ITwoPointFiveMoveOperator : IPermutationMoveOperator {
    2929    ILookupParameter<TwoPointFiveMove> TwoPointFiveMoveParameter { get; }
    3030  }
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Moves/EstimatedPTSPMoveEvaluator.cs

    r17260 r17264  
    4343      get { return (ILookupParameter<IProbabilisticTSPData>)Parameters["PTSP Data"]; }
    4444    }
    45     public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationsParameter {
    46       get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realizations"]; }
     45    public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationDataParameter {
     46      get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["RealizationData"]; }
    4747    }
    4848    public ILookupParameter<DoubleValue> QualityParameter {
     
    6060      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The solution as permutation."));
    6161      Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the pTSP."));
    62       Parameters.Add(new LookupParameter<ReadOnlyItemList<BoolArray>>("Realizations", "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."));
    6363      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of a TSP solution."));
    6464      Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The evaluated quality of a move on a TSP solution."));
     
    6767    public override IOperation Apply() {
    6868      var permutation = PermutationParameter.ActualValue;
    69       var realizations = RealizationsParameter.ActualValue;
     69      var realizations = RealizationDataParameter.ActualValue;
    7070      var data = ProbabilisticTSPDataParameter.ActualValue;
    7171      var relativeQualityDifference = EvaluateMove(permutation, data, realizations);
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/ProbabilisticTSP.cs

    r17260 r17264  
    157157        try {
    158158          var tour = new Permutation(PermutationTypes.RelativeUndirected, data.BestKnownTour);
    159           var tourLength = Evaluate(tour, new FastRandom(1));
     159          var tourLength = Evaluate(tour, new MersenneTwister(1));
    160160          BestKnownSolution = new ProbabilisticTSPSolution(data.Coordinates != null ? new DoubleMatrix(data.Coordinates) : null, new PercentArray(data.Probabilities), tour, new DoubleValue(tourLength));
    161161          BestKnownQuality = tourLength;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/CoordinatesTSPDataView.Designer.cs

    r17251 r17264  
    7373      this.coordinatesMatrixView.ReadOnly = false;
    7474      this.coordinatesMatrixView.ShowRowsAndColumnsTextBox = true;
    75       this.coordinatesMatrixView.ShowStatisticalInformation = true;
     75      this.coordinatesMatrixView.ShowStatisticalInformation = false;
    7676      this.coordinatesMatrixView.Size = new System.Drawing.Size(256, 570);
    7777      this.coordinatesMatrixView.TabIndex = 1;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/EuclideanTSPDataView.Designer.cs

    r17260 r17264  
    3131      this.coordinatesSplitContainer.SuspendLayout();
    3232      ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).BeginInit();
     33      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    3334      this.SuspendLayout();
    3435      //
     
    4849      this.coordinatesMatrixView.Dock = System.Windows.Forms.DockStyle.None;
    4950      this.coordinatesMatrixView.Location = new System.Drawing.Point(0, 30);
     51      this.coordinatesMatrixView.ShowStatisticalInformation = false;
    5052      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);
    5158      //
    5259      // roundingModeLabel
     
    8188      this.coordinatesSplitContainer.ResumeLayout(false);
    8289      ((System.ComponentModel.ISupportInitialize)(this.coordinatesPictureBox)).EndInit();
     90      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    8391      this.ResumeLayout(false);
     92      this.PerformLayout();
    8493
    8594    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman.Views/3.3/MatrixTSPDataView.Designer.cs

    r17260 r17264  
    8585      this.distanceMatrixView.ReadOnly = false;
    8686      this.distanceMatrixView.ShowRowsAndColumnsTextBox = true;
    87       this.distanceMatrixView.ShowStatisticalInformation = true;
     87      this.distanceMatrixView.ShowStatisticalInformation = false;
    8888      this.distanceMatrixView.Size = new System.Drawing.Size(757, 538);
    8989      this.distanceMatrixView.TabIndex = 0;
     
    9595      this.coordinatesTabPage.Name = "coordinatesTabPage";
    9696      this.coordinatesTabPage.Padding = new System.Windows.Forms.Padding(3);
    97       this.coordinatesTabPage.Size = new System.Drawing.Size(763, 570);
     97      this.coordinatesTabPage.Size = new System.Drawing.Size(763, 544);
    9898      this.coordinatesTabPage.TabIndex = 1;
    9999      this.coordinatesTabPage.Text = "Display Coordinates";
     
    113113      //
    114114      this.coordinatesSplitContainer.Panel2.Controls.Add(this.coordinatesPictureBox);
    115       this.coordinatesSplitContainer.Size = new System.Drawing.Size(757, 564);
     115      this.coordinatesSplitContainer.Size = new System.Drawing.Size(757, 538);
    116116      this.coordinatesSplitContainer.SplitterDistance = 252;
    117117      this.coordinatesSplitContainer.TabIndex = 0;
     
    126126      this.coordinatesMatrixView.ReadOnly = false;
    127127      this.coordinatesMatrixView.ShowRowsAndColumnsTextBox = true;
    128       this.coordinatesMatrixView.ShowStatisticalInformation = true;
    129       this.coordinatesMatrixView.Size = new System.Drawing.Size(252, 564);
     128      this.coordinatesMatrixView.ShowStatisticalInformation = false;
     129      this.coordinatesMatrixView.Size = new System.Drawing.Size(252, 538);
    130130      this.coordinatesMatrixView.TabIndex = 1;
    131131      //
     
    135135      this.coordinatesPictureBox.Location = new System.Drawing.Point(0, 0);
    136136      this.coordinatesPictureBox.Name = "coordinatesPictureBox";
    137       this.coordinatesPictureBox.Size = new System.Drawing.Size(501, 564);
     137      this.coordinatesPictureBox.Size = new System.Drawing.Size(501, 538);
    138138      this.coordinatesPictureBox.TabIndex = 0;
    139139      this.coordinatesPictureBox.TabStop = false;
Note: See TracChangeset for help on using the changeset viewer.