Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4315


Ignore:
Timestamp:
08/25/10 13:50:51 (14 years ago)
Author:
svonolfe
Message:

Added ORLIBParser (#1039)

Location:
branches/VRP
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.Designer.cs

    r4232 r4315  
    3131      this.vrpSolutionView = new HeuristicLab.Problems.VehicleRouting.Views.VRPSolutionView();
    3232      this.importButton2 = new System.Windows.Forms.Button();
     33      this.importButton3 = new System.Windows.Forms.Button();
    3334      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    3435      this.tabControl1.SuspendLayout();
     
    6162      this.tabControl1.Controls.Add(this.tabPage1);
    6263      this.tabControl1.Controls.Add(this.tabPage2);
    63       this.tabControl1.Location = new System.Drawing.Point(0, 109);
     64      this.tabControl1.Location = new System.Drawing.Point(0, 139);
    6465      this.tabControl1.Name = "tabControl1";
    6566      this.tabControl1.SelectedIndex = 0;
    66       this.tabControl1.Size = new System.Drawing.Size(490, 313);
     67      this.tabControl1.Size = new System.Drawing.Size(490, 283);
    6768      this.tabControl1.TabIndex = 6;
    6869      //
     
    7374      this.tabPage1.Name = "tabPage1";
    7475      this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
    75       this.tabPage1.Size = new System.Drawing.Size(482, 287);
     76      this.tabPage1.Size = new System.Drawing.Size(482, 257);
    7677      this.tabPage1.TabIndex = 0;
    7778      this.tabPage1.Text = "Parameters";
     
    8687      this.parameterCollectionView.Name = "parameterCollectionView";
    8788      this.parameterCollectionView.ReadOnly = false;
    88       this.parameterCollectionView.Size = new System.Drawing.Size(476, 281);
     89      this.parameterCollectionView.Size = new System.Drawing.Size(476, 251);
    8990      this.parameterCollectionView.TabIndex = 1;
    9091      //
     
    123124      this.importButton2.Click += new System.EventHandler(this.importButton2_Click);
    124125      //
     126      // importButton3
     127      //
     128      this.importButton3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     129                  | System.Windows.Forms.AnchorStyles.Right)));
     130      this.importButton3.Location = new System.Drawing.Point(0, 110);
     131      this.importButton3.Name = "importButton3";
     132      this.importButton3.Size = new System.Drawing.Size(490, 23);
     133      this.importButton3.TabIndex = 8;
     134      this.importButton3.Text = "Import from ORLib";
     135      this.importButton3.UseVisualStyleBackColor = true;
     136      this.importButton3.Click += new System.EventHandler(this.importButton3_Click);
     137      //
    125138      // VehicleRoutingProblemView
    126139      //
    127140      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     141      this.Controls.Add(this.importButton3);
    128142      this.Controls.Add(this.importButton2);
    129143      this.Controls.Add(this.importButton);
     
    138152      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    139153      this.Controls.SetChildIndex(this.importButton2, 0);
     154      this.Controls.SetChildIndex(this.importButton3, 0);
    140155      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    141156      this.tabControl1.ResumeLayout(false);
     
    156171    private VRPSolutionView vrpSolutionView;
    157172    private System.Windows.Forms.Button importButton2;
     173    private System.Windows.Forms.Button importButton3;
    158174  }
    159175}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs

    r4232 r4315  
    6969    private void importButton_Click(object sender, EventArgs e) {
    7070      OpenFileDialog dialog = new OpenFileDialog();
    71       dialog.DefaultExt = "txt";
     71      dialog.Filter = "Solomon files (*.txt)|*.txt";
    7272
    7373      if (dialog.ShowDialog() == DialogResult.OK) {
     
    7878    private void importButton2_Click(object sender, EventArgs e) {
    7979      OpenFileDialog dialog = new OpenFileDialog();
    80       dialog.DefaultExt = "vrp";
     80      dialog.DefaultExt = "TSPLib files (*.vrp)|*.vrp";
    8181
    8282      if (dialog.ShowDialog() == DialogResult.OK) {
     
    8585    }
    8686
     87    private void importButton3_Click(object sender, EventArgs e) {
     88      OpenFileDialog dialog = new OpenFileDialog();
     89      dialog.DefaultExt = "ORLib files (*.txt)|*.txt";
     90
     91      if (dialog.ShowDialog() == DialogResult.OK) {
     92        Content.ImportFromORLib(dialog.FileName);
     93      }
     94    } 
     95
    8796    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
    8897      vrpSolutionView.Content.Coordinates = Content.Coordinates;
    89     }   
     98    } 
    9099  }
    91100}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/HeuristicLab.Problems.VehicleRouting-3.3.csproj

    r4301 r4315  
    179179    <Compile Include="Encodings\Zhu\ZhuEncoding.cs" />
    180180    <Compile Include="Interfaces\IVRPMoveMaker.cs" />
     181    <Compile Include="ORLIBParser.cs" />
    181182    <Compile Include="TSPLIBParser.cs" />
    182183    <Compile Include="VRPUtilities.cs" />
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r4301 r4315  
    483483    }
    484484
     485    public void ImportFromORLib(string orFileName) {
     486      ORLIBParser parser = new ORLIBParser(orFileName);
     487      parser.Parse();
     488
     489      this.Name = parser.Name;
     490      int problemSize = parser.Demands.Length;
     491
     492      Coordinates = new DoubleMatrix(parser.Vertices);
     493      Vehicles.Value = problemSize - 1;
     494      Capacity.Value = parser.Capacity;
     495      Demand = new DoubleArray(parser.Demands);
     496      ReadyTime = new DoubleArray(problemSize);
     497      DueTime = new DoubleArray(problemSize);
     498      ServiceTime = new DoubleArray(problemSize);
     499
     500      ReadyTime[0] = 0;
     501      DueTime[0] = parser.MaxRouteTime;
     502      ServiceTime[0] = 0;
     503
     504      for (int i = 1; i < problemSize; i++) {
     505        ReadyTime[i] = 0;
     506        DueTime[i] = int.MaxValue;
     507        ServiceTime[i] = parser.ServiceTime;
     508      }
     509
     510      OnReset();
     511    }
     512
    485513    private void InitializeRandomVRPInstance() {
    486514      System.Random rand = new System.Random();
Note: See TracChangeset for help on using the changeset viewer.