Changeset 11303 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/CordeauFormat
- Timestamp:
- 08/26/14 13:05:22 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 1 deleted
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering
- Property svn:mergeinfo changed
/trunk/sources merged: 11214,11241,11248-11251,11256,11263,11274,11280,11282-11283,11290,11292,11294-11296,11298,11300,11302
- Property svn:mergeinfo changed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.VehicleRouting/3.4/CordeauFormat/CordeauFormatInstanceProvider.cs
r11289 r11303 23 23 24 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { 25 public abstract class CordeauFormatInstanceProvider : VRPInstanceProvider<MDCVRPTWData>{26 protected override MDCVRPTWDataLoadData(Stream stream) {25 public abstract class CordeauFormatInstanceProvider<T> : VRPInstanceProvider<T> where T : MDCVRPData { 26 protected override T LoadData(Stream stream) { 27 27 return LoadInstance(new CordeauParser(stream)); 28 28 } … … 31 31 get { return true; } 32 32 } 33 public override MDCVRPTWDataImportData(string path) {33 public override T ImportData(string path) { 34 34 return LoadInstance(new CordeauParser(path)); 35 35 } 36 36 37 private MDCVRPTWData LoadInstance(CordeauParser parser) { 38 parser.Parse(); 39 40 var instance = new MDCVRPTWData(); 41 instance.Dimension = parser.Cities + 1; 42 instance.Depots = parser.Depots; 43 instance.Coordinates = parser.Coordinates; 44 instance.Capacity = parser.Capacity; 45 instance.Demands = parser.Demands; 46 instance.DistanceMeasure = DistanceMeasure.Euclidean; 47 instance.ReadyTimes = parser.Readytimes; 48 instance.ServiceTimes = parser.Servicetimes; 49 instance.DueTimes = parser.Duetimes; 50 instance.MaximumVehicles = parser.Vehicles; 51 52 int depots = parser.Depots; 53 int vehicles = parser.Vehicles / parser.Depots; 54 instance.VehicleDepotAssignment = new int[depots * vehicles]; 55 int index = 0; 56 57 for (int i = 0; i < depots; i++) 58 for (int j = 0; j < vehicles; j++) { 59 instance.VehicleDepotAssignment[index] = i; 60 index++; 61 } 62 63 instance.Name = parser.ProblemName; 64 65 return instance; 66 } 37 internal abstract T LoadInstance(CordeauParser parser); 67 38 } 68 39 }
Note: See TracChangeset
for help on using the changeset viewer.