Changeset 7871
- Timestamp:
- 05/22/12 17:37:33 (13 years ago)
- Location:
- branches/VRP
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/HeuristicLab.Problems.VehicleRouting.Views-3.4.csproj
r7090 r7871 163 163 <Private>False</Private> 164 164 </Reference> 165 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 165 166 <Reference Include="System" /> 166 167 <Reference Include="System.Core"> -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/Plugin.cs.frame
r7088 r7871 41 41 [PluginDependency("HeuristicLab.Parameters", "3.3")] 42 42 [PluginDependency("HeuristicLab.Problems.VehicleRouting", "3.4")] 43 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 43 44 public class HeuristicLabProblemsVehicleRoutingViewsPlugin : PluginBase { 44 45 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.Designer.cs
r5867 r7871 1 1 namespace HeuristicLab.Problems.VehicleRouting.Views { 2 2 partial class VehicleRoutingProblemView { 3 /// <summary> 3 /// <summary> 4 4 /// Required designer variable. 5 5 /// </summary> 6 6 private System.ComponentModel.IContainer components = null; 7 7 8 /// <summary> 8 /// <summary> 9 9 /// Clean up any resources being used. 10 10 /// </summary> … … 17 17 } 18 18 19 #region Windows FormDesigner generated code19 #region Component Designer generated code 20 20 21 /// <summary> 22 /// Required method for Designer support - do not modify 21 /// <summary> 22 /// Required method for Designer support - do not modify 23 23 /// the contents of this method with the code editor. 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.importButton = new System.Windows.Forms.Button(); 27 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 28 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 29 this.SuspendLayout(); 30 // 31 // nameTextBox 32 // 33 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 34 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 35 this.nameTextBox.Location = new System.Drawing.Point(60, 0); 36 this.nameTextBox.Size = new System.Drawing.Size(405, 20); 37 // 38 // infoLabel 39 // 40 this.infoLabel.Location = new System.Drawing.Point(471, 3); 41 // 42 // importButton 43 // 44 this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 45 | System.Windows.Forms.AnchorStyles.Right))); 46 this.importButton.Location = new System.Drawing.Point(0, 26); 47 this.importButton.Name = "importButton"; 48 this.importButton.Size = new System.Drawing.Size(490, 23); 49 this.importButton.TabIndex = 5; 50 this.importButton.Text = "Import"; 51 this.importButton.UseVisualStyleBackColor = true; 52 this.importButton.Click += new System.EventHandler(this.importButton_Click); 53 // 54 // parameterCollectionView 55 // 56 this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 57 | System.Windows.Forms.AnchorStyles.Left) 58 | System.Windows.Forms.AnchorStyles.Right))); 59 this.parameterCollectionView.Caption = "ParameterCollection View"; 60 this.parameterCollectionView.Content = null; 61 this.parameterCollectionView.Location = new System.Drawing.Point(0, 55); 62 this.parameterCollectionView.Name = "parameterCollectionView"; 63 this.parameterCollectionView.ReadOnly = false; 64 this.parameterCollectionView.Size = new System.Drawing.Size(490, 210); 65 this.parameterCollectionView.TabIndex = 9; 66 // 67 // VehicleRoutingProblemView 68 // 69 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 70 this.Controls.Add(this.parameterCollectionView); 71 this.Controls.Add(this.importButton); 72 this.Name = "VehicleRoutingProblemView"; 73 this.Size = new System.Drawing.Size(490, 275); 74 this.Controls.SetChildIndex(this.importButton, 0); 75 this.Controls.SetChildIndex(this.parameterCollectionView, 0); 76 this.Controls.SetChildIndex(this.nameTextBox, 0); 77 this.Controls.SetChildIndex(this.nameLabel, 0); 78 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 79 this.ResumeLayout(false); 80 this.PerformLayout(); 81 26 components = new System.ComponentModel.Container(); 27 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 82 28 } 83 29 84 30 #endregion 85 86 private System.Windows.Forms.Button importButton;87 private Core.Views.ParameterCollectionView parameterCollectionView;88 31 } 89 32 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.cs
r6851 r7871 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.ComponentModel; 25 using System.Drawing; 26 using System.Data; 27 using System.Linq; 28 using System.Text; 23 29 using System.Windows.Forms; 30 using HeuristicLab.Optimization.Views; 24 31 using HeuristicLab.MainForm; 25 using HeuristicLab.Optimization.Views;26 using HeuristicLab.Core.Views;27 using HeuristicLab.Core;28 using HeuristicLab.PluginInfrastructure;29 32 30 33 namespace HeuristicLab.Problems.VehicleRouting.Views { 31 [View("VehicleRouting Problem View")] 32 [Content(typeof(VehicleRoutingProblem), true)] 33 public partial class VehicleRoutingProblemView : NamedItemView { 34 private VRPImportDialog vrpImportDialog; 35 36 public new VehicleRoutingProblem Content { 37 get { return (VehicleRoutingProblem)base.Content; } 38 set { base.Content = value; } 39 } 40 34 [View("Vehicle Routing Problem View")] 35 [Content(typeof(VehicleRoutingProblem), IsDefaultView = true)] 36 public partial class VehicleRoutingProblemView : ProblemView { 41 37 public VehicleRoutingProblemView() { 42 38 InitializeComponent(); 43 39 } 44 45 protected override void DeregisterContentEvents() {46 base.DeregisterContentEvents();47 }48 protected override void RegisterContentEvents() {49 base.RegisterContentEvents();50 }51 52 protected override void OnContentChanged() {53 base.OnContentChanged();54 if (Content == null) {55 parameterCollectionView.Content = null;56 } else {57 parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;58 }59 }60 61 protected override void SetEnabledStateOfControls() {62 base.SetEnabledStateOfControls();63 parameterCollectionView.Enabled = Content != null;64 importButton.Enabled = Content != null && !ReadOnly;65 }66 67 private void importButton_Click(object sender, EventArgs e) {68 if (vrpImportDialog == null) vrpImportDialog = new VRPImportDialog();69 70 if (vrpImportDialog.ShowDialog(this) == DialogResult.OK) {71 try {72 switch (vrpImportDialog.Format) {73 case VRPFormat.TSPLib:74 Content.ImportFromTSPLib(vrpImportDialog.VRPFileName);75 break;76 77 case VRPFormat.Solomon:78 Content.ImportFromSolomon(vrpImportDialog.VRPFileName);79 break;80 81 case VRPFormat.ORLib:82 Content.ImportFromORLib(vrpImportDialog.VRPFileName);83 break;84 85 case VRPFormat.LiLim:86 Content.ImportFromLiLim(vrpImportDialog.VRPFileName);87 break;88 89 case VRPFormat.Cordeau:90 Content.ImportFromCordeau(vrpImportDialog.VRPFileName);91 break;92 }93 94 if (!string.IsNullOrEmpty(vrpImportDialog.TourFileName))95 Content.ImportSolution(vrpImportDialog.TourFileName);96 }97 catch (Exception ex) {98 ErrorHandling.ShowErrorDialog(this, ex);99 }100 }101 }102 40 } 103 41 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
r7865 r7871 150 150 <Private>False</Private> 151 151 </Reference> 152 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 152 153 <Reference Include="System" /> 153 154 <Reference Include="System.Core"> … … 191 192 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarSingleMoveGenerator.cs" /> 192 193 <Compile Include="Interfaces\IVRPLocalSearchManipulator.cs" /> 194 <Compile Include="Interpreters\CVRPInterpreter.cs" /> 195 <Compile Include="Interpreters\IVRPDataInterpreter.cs" /> 193 196 <Compile Include="Properties\AssemblyInfo.cs" /> 194 197 <Compile Include="Encodings\Alba\AlbaEncoding.cs" /> -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Plugin.cs.frame
r7088 r7871 40 40 [PluginDependency("HeuristicLab.Parameters", "3.3")] 41 41 [PluginDependency("HeuristicLab.Persistence", "3.3")] 42 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 42 43 public class HeuristicLabProblemsVehicleRoutingPlugin : PluginBase { 43 44 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs
r7861 r7871 36 36 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 37 37 using HeuristicLab.Problems.VehicleRouting.Variants; 38 using HeuristicLab.Problems.Instances; 39 using System.Reflection; 40 using HeuristicLab.Problems.VehicleRouting.Interpreters; 38 41 39 42 namespace HeuristicLab.Problems.VehicleRouting { … … 41 44 [Creatable("Problems")] 42 45 [StorableClass] 43 public sealed class VehicleRoutingProblem : ParameterizedNamedItem, ISingleObjectiveHeuristicOptimizationProblem, IStorableContent {46 public sealed class VehicleRoutingProblem : ParameterizedNamedItem, ISingleObjectiveHeuristicOptimizationProblem, IStorableContent, IProblemInstanceConsumer<IVRPData> { 44 47 public string Filename { get; set; } 45 48 … … 466 469 } 467 470 } 471 472 public void Load(IVRPData data) { 473 Type interpreterType = typeof(IVRPDataInterpreter<>).MakeGenericType(data.GetType()); 474 var interpreters = ApplicationManager.Manager.GetInstances(interpreterType); 475 if (interpreters.Count() > 0) { 476 IVRPDataInterpreter interpreter = interpreters.First() as IVRPDataInterpreter; 477 VRPInstanceDescription instance = interpreter.Interpret(data); 478 479 Name = instance.Name; 480 Description = instance.Description; 481 ProblemInstance = instance.ProblemInstance; 482 483 OnReset(); 484 485 if (instance.BestKnownQuality != null) { 486 BestKnownQuality = new DoubleValue((double)instance.BestKnownQuality); 487 } 488 489 if (instance.BestKnownSolution != null) { 490 VRPSolution solution = new VRPSolution(ProblemInstance, instance.BestKnownSolution, new DoubleValue(0)); 491 BestKnownSolutionParameter.Value = solution; 492 } 493 } else { 494 throw new Exception("Cannot find an interpreter for " + data.GetType()); 495 } 496 } 468 497 } 469 498 }
Note: See TracChangeset
for help on using the changeset viewer.