- Timestamp:
- 12/12/16 14:52:34 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonFormatInstanceProvider.cs
r14185 r14478 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.IO; 25 24 using System.Linq; … … 64 63 string date = ExtractValue(reader.ReadLine()); 65 64 string reference = ExtractValue(reader.ReadLine()); 66 reader.ReadLine(); // Solution 67 68 var routesQuery = 69 from line in reader.ReadAllLines() 70 where !string.IsNullOrEmpty(line) 71 let tokens = ExtractValue(line).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) 72 let stops = tokens.Select(int.Parse).Select(s => s - 1) 73 select stops; 74 75 var routes = routesQuery.Select(s => s.ToArray()).ToArray(); 76 77 instance.BestKnownTour = routes; 65 switch (reader.ReadLine().Trim()) { // "Solution" or "Distance" 66 case "Solution": 67 var routesQuery = from line in reader.ReadAllLines() 68 where !string.IsNullOrEmpty(line) 69 let tokens = ExtractValue(line).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) 70 let stops = tokens.Select(int.Parse).Select(s => s - 1) 71 select stops; 72 var routes = routesQuery.Select(s => s.ToArray()).ToArray(); 73 instance.BestKnownTour = routes; 74 break; 75 case "Distance": 76 double quality = double.Parse(reader.ReadLine()); 77 instance.BestKnownQuality = quality; 78 break; 79 } 78 80 } 79 81 }
Note: See TracChangeset
for help on using the changeset viewer.