Changeset 7887 for branches/VRP
- Timestamp:
- 05/24/12 10:41:05 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/ChristofidesInstanceProvider.cs
r7883 r7887 31 31 public class ChristofidesInstanceProvider : GoldenFormatInstanceProvider { 32 32 public override string Name { 33 get { return "Christofides ( CVRP)"; }33 get { return "Christofides (DCVRP)"; } 34 34 } 35 35 -
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenFormatInstanceProvider.cs
r7883 r7887 30 30 31 31 namespace HeuristicLab.Problems.Instances.VehicleRouting { 32 public abstract class GoldenFormatInstanceProvider : VRPInstanceProvider<CVRP Data> {33 protected override CVRP Data LoadData(Stream stream) {32 public abstract class GoldenFormatInstanceProvider : VRPInstanceProvider<CVRPTWData> { 33 protected override CVRPTWData LoadData(Stream stream) { 34 34 return LoadInstance(new GoldenParser(stream)); 35 35 } 36 36 37 public override CVRP Data LoadData(string path) {37 public override CVRPTWData LoadData(string path) { 38 38 return LoadInstance(new GoldenParser(path)); 39 39 } 40 40 41 private CVRP Data LoadInstance(GoldenParser parser) {41 private CVRPTWData LoadInstance(GoldenParser parser) { 42 42 parser.Parse(); 43 43 44 var instance = new CVRP Data();44 var instance = new CVRPTWData(); 45 45 instance.Dimension = parser.Vertices.GetLength(0) + 1; 46 46 instance.Coordinates = parser.Vertices; … … 56 56 } 57 57 58 instance.ReadyTimes = new double[instance.Dimension]; 59 instance.ServiceTimes = new double[instance.Dimension]; 60 instance.DueTimes = new double[instance.Dimension]; 61 62 for (int i = 0; i < instance.Dimension; i++) { 63 instance.ReadyTimes[i] = 0; 64 instance.ServiceTimes[i] = 0; 65 instance.DueTimes[i] = double.MaxValue; 66 } 67 68 if(parser.Distance > 0) 69 instance.DueTimes[0] = parser.Distance; 70 71 if (parser.Vehicles > 0) 72 instance.MaximumVehicles = parser.Vehicles; 73 58 74 instance.Name = parser.ProblemName; 59 75 instance.Description = parser.Comment -
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenInstanceProvider.cs
r7883 r7887 31 31 public class GoldenInstanceProvider : GoldenFormatInstanceProvider { 32 32 public override string Name { 33 get { return "Golden ( CVRP)"; }33 get { return "Golden (DCVRP)"; } 34 34 } 35 35 -
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenParser.cs
r7883 r7887 48 48 private const int NODESECTION = 7; 49 49 private const int CAPACITY = 8; 50 private const int DISTANCE = 12; 50 51 private const int VEHICLES = 13; 51 52 private const int DEPOTSECTION = 9; … … 85 86 get { 86 87 return vehicles; 88 } 89 } 90 91 private double distance; 92 public double Distance { 93 get { 94 return distance; 87 95 } 88 96 } … … 113 121 capacity = -1; 114 122 vehicles = -1; 123 distance = -1; 115 124 demands = null; 116 125 } … … 179 188 case VEHICLES: 180 189 ReadVehicles(str); 190 break; 191 case DISTANCE: 192 ReadDistance(str); 181 193 break; 182 194 case DEPOTSECTION: … … 226 238 if (token.Equals("vehicles", StringComparison.OrdinalIgnoreCase)) 227 239 return VEHICLES; 240 if (token.Equals("distance", StringComparison.OrdinalIgnoreCase)) 241 return DISTANCE; 228 242 if (token.Equals("depot_section", StringComparison.OrdinalIgnoreCase)) 229 243 return DEPOTSECTION; … … 321 335 } 322 336 337 private void ReadDistance(string str) { 338 string[] tokens = str.Split(new string[] { ":" }, StringSplitOptions.None); 339 distance = double.Parse(tokens[tokens.Length - 1].Trim(), System.Globalization.CultureInfo.InvariantCulture); 340 } 341 323 342 private void ReadDepot(StreamReader reader) { 324 343 string[] tokens; -
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/KytojokiInstanceProvider.cs
r7883 r7887 31 31 public class KytojokiInstanceProvider : GoldenFormatInstanceProvider { 32 32 public override string Name { 33 get { return "Kytojoki ( CVRP)"; }33 get { return "Kytojoki (DCVRP)"; } 34 34 } 35 35
Note: See TracChangeset
for help on using the changeset viewer.