- Timestamp:
- 09/30/11 11:36:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Parsers/CordeauParser.cs
r6851 r6854 132 132 throw new InvalidDataException("File has wrong format!"); 133 133 134 bool timeWindows = int.Parse(m[0].Value) == 6; 134 135 vehicles = int.Parse(m[3].Value); 135 136 line = reader.ReadLine(); … … 146 147 List<double> depotXcoord = new List<double>(); 147 148 List<double> depotYcoord = new List<double>(); 149 List<double> depotReadyTime = new List<double>(); 150 List<double> depotDueTime = new List<double>(); 151 148 152 while ((line != null)) { 149 153 m = reg.Matches(line); 150 154 151 if (m.Count == 11) {155 if (m.Count >= 11) { 152 156 xCoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture)); 153 157 yCoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture)); 154 158 demand.Add((double)int.Parse(m[4].Value, System.Globalization.CultureInfo.InvariantCulture)); 155 } else if (m.Count == 7) { 159 160 if (timeWindows) { 161 serviceTime.Add(int.Parse(m[3].Value)); 162 readyTime.Add(int.Parse(m[m.Count - 2].Value)); 163 dueTime.Add(int.Parse(m[m.Count - 1].Value)); 164 } else { 165 serviceTime.Add(0); 166 readyTime.Add(0); 167 dueTime.Add(double.MaxValue); 168 } 169 } else if (m.Count >= 7) { 156 170 depotXcoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture)); 157 171 depotYcoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture)); 172 173 if (timeWindows) { 174 depotReadyTime.Add(int.Parse(m[m.Count - 2].Value)); 175 depotDueTime.Add(int.Parse(m[m.Count - 1].Value)); 176 } else { 177 depotReadyTime.Add(0); 178 depotDueTime.Add(double.MaxValue); 179 } 158 180 } 159 181 … … 163 185 xCoord.InsertRange(0, depotXcoord); 164 186 yCoord.InsertRange(0, depotYcoord); 187 readyTime.InsertRange(0, depotReadyTime); 188 dueTime.InsertRange(0, depotDueTime); 165 189 166 190 cities = demand.Count;
Note: See TracChangeset
for help on using the changeset viewer.