Changeset 4232
- Timestamp:
- 08/16/10 17:05:23 (14 years ago)
- Location:
- branches/VRP
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.Designer.cs
r4185 r4232 30 30 this.tabPage2 = new System.Windows.Forms.TabPage(); 31 31 this.vrpSolutionView = new HeuristicLab.Problems.VehicleRouting.Views.VRPSolutionView(); 32 this.importButton2 = new System.Windows.Forms.Button(); 32 33 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 33 34 this.tabControl1.SuspendLayout(); … … 60 61 this.tabControl1.Controls.Add(this.tabPage1); 61 62 this.tabControl1.Controls.Add(this.tabPage2); 62 this.tabControl1.Location = new System.Drawing.Point(0, 84);63 this.tabControl1.Location = new System.Drawing.Point(0, 109); 63 64 this.tabControl1.Name = "tabControl1"; 64 65 this.tabControl1.SelectedIndex = 0; 65 this.tabControl1.Size = new System.Drawing.Size(490, 3 38);66 this.tabControl1.Size = new System.Drawing.Size(490, 313); 66 67 this.tabControl1.TabIndex = 6; 67 68 // … … 72 73 this.tabPage1.Name = "tabPage1"; 73 74 this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 74 this.tabPage1.Size = new System.Drawing.Size(482, 312);75 this.tabPage1.Size = new System.Drawing.Size(482, 287); 75 76 this.tabPage1.TabIndex = 0; 76 77 this.tabPage1.Text = "Parameters"; … … 85 86 this.parameterCollectionView.Name = "parameterCollectionView"; 86 87 this.parameterCollectionView.ReadOnly = false; 87 this.parameterCollectionView.Size = new System.Drawing.Size(476, 306);88 this.parameterCollectionView.Size = new System.Drawing.Size(476, 281); 88 89 this.parameterCollectionView.TabIndex = 1; 89 90 // … … 94 95 this.tabPage2.Name = "tabPage2"; 95 96 this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 96 this.tabPage2.Size = new System.Drawing.Size(482, 312);97 this.tabPage2.Size = new System.Drawing.Size(482, 287); 97 98 this.tabPage2.TabIndex = 1; 98 99 this.tabPage2.Text = "Visualization"; … … 110 111 this.vrpSolutionView.TabIndex = 0; 111 112 // 113 // importButton2 114 // 115 this.importButton2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 116 | System.Windows.Forms.AnchorStyles.Right))); 117 this.importButton2.Location = new System.Drawing.Point(0, 81); 118 this.importButton2.Name = "importButton2"; 119 this.importButton2.Size = new System.Drawing.Size(490, 23); 120 this.importButton2.TabIndex = 7; 121 this.importButton2.Text = "Import from TSPLib"; 122 this.importButton2.UseVisualStyleBackColor = true; 123 this.importButton2.Click += new System.EventHandler(this.importButton2_Click); 124 // 112 125 // VehicleRoutingProblemView 113 126 // 114 127 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 128 this.Controls.Add(this.importButton2); 115 129 this.Controls.Add(this.importButton); 116 130 this.Controls.Add(this.tabControl1); … … 123 137 this.Controls.SetChildIndex(this.descriptionLabel, 0); 124 138 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 139 this.Controls.SetChildIndex(this.importButton2, 0); 125 140 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 126 141 this.tabControl1.ResumeLayout(false); … … 140 155 private Core.Views.ParameterCollectionView parameterCollectionView; 141 156 private VRPSolutionView vrpSolutionView; 157 private System.Windows.Forms.Button importButton2; 142 158 } 143 159 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs
r4185 r4232 64 64 parameterCollectionView.Enabled = Content != null; 65 65 vrpSolutionView.Enabled = Content != null; 66 importButton.Enabled = Content != null && !ReadOnly;66 importButton.Enabled = importButton2.Enabled = Content != null && !ReadOnly; 67 67 } 68 68 … … 76 76 } 77 77 78 private void importButton2_Click(object sender, EventArgs e) { 79 OpenFileDialog dialog = new OpenFileDialog(); 80 dialog.DefaultExt = "vrp"; 81 82 if (dialog.ShowDialog() == DialogResult.OK) { 83 Content.ImportFromTSPLib(dialog.FileName); 84 } 85 } 86 78 87 private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) { 79 88 vrpSolutionView.Content.Coordinates = Content.Coordinates; 80 } 89 } 81 90 } 82 91 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/HeuristicLab.Problems.VehicleRouting-3.3.csproj
r4230 r4232 156 156 <Compile Include="Encodings\Potvin\Manipulators\PotvinManipulator.cs" /> 157 157 <Compile Include="Interfaces\IVRPMoveMaker.cs" /> 158 <Compile Include="TSPLIBParser.cs" /> 158 159 <Compile Include="VRPUtilities.cs" /> 159 160 <Compile Include="VRPOperator.cs" /> -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs
r4179 r4232 431 431 } 432 432 433 public void ImportFromTSPLib(string tspFileName) { 434 TSPLIBParser parser = new TSPLIBParser(tspFileName); 435 parser.Parse(); 436 437 this.Name = parser.Name; 438 439 int problemSize = parser.Demands.Length; 440 441 Coordinates = new DoubleMatrix(parser.Vertices); 442 Vehicles.Value = problemSize - 1; 443 Capacity.Value = parser.Capacity; 444 Demand = new DoubleArray(parser.Demands); 445 ReadyTime = new DoubleArray(problemSize); 446 DueTime = new DoubleArray(problemSize); 447 ServiceTime = new DoubleArray(problemSize); 448 449 for (int i = 0; i < problemSize; i++) { 450 ReadyTime[i] = 0; 451 DueTime[i] = int.MaxValue; 452 ServiceTime[i] = 0; 453 } 454 455 if (parser.Depot != 1) 456 throw new Exception("Invalid depot specification"); 457 458 if (parser.WeightType != TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D) 459 throw new Exception("Invalid weight type"); 460 461 OnReset(); 462 } 463 433 464 private void InitializeRandomVRPInstance() { 434 465 System.Random rand = new System.Random();
Note: See TracChangeset
for help on using the changeset viewer.