Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7891


Ignore:
Timestamp:
05/24/12 11:12:39 (12 years ago)
Author:
svonolfe
Message:

Fixed issues in Cordeau parser (#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/CordeauFormat/CordeauParser.cs

    r7882 r7891  
    160160         bool timeWindows = type == 6;
    161161         vehicles = int.Parse(m[1].Value);
     162         cities = int.Parse(m[2].Value);
    162163         depots = int.Parse(m[3].Value);
    163164         line = reader.ReadLine();
     
    176177           m = reg.Matches(line);
    177178
    178            if (m.Count >= 11) {
     179           if (demand.Count < cities) {
    179180             xCoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture));
    180181             yCoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture));
     
    189190               dueTime.Add(double.MaxValue);
    190191             }
    191            } else if (m.Count >= 7) {
     192           } else {
    192193             depotXcoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture));
    193194             depotYcoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture));
     
    218219         dueTime.InsertRange(0, depotDueTime);
    219220
    220          cities = demand.Count;
    221          depots = depotXcoord.Count;
    222 
    223221         List<double> originalCapacities = new List<double>(capacity);
    224222         capacity.Clear();
    225          for (int i = 0; i < vehicles; i++) {
    226            for (int j = 0; j < depots; j++) {
     223         for (int i = 0; i < depots; i++) {
     224           for (int j = 0; j < vehicles; j++) {
    227225             capacity.Add(originalCapacities[i]);
    228226           }
Note: See TracChangeset for help on using the changeset viewer.