Changeset 7871 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
- Timestamp:
- 05/22/12 17:37:33 (12 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.