Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8795


Ignore:
Timestamp:
10/11/12 16:12:49 (12 years ago)
Author:
svonolfe
Message:

Fixed parsing of double values (#1955)

Location:
branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Parsers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Parsers/DefaultDynPDPParser.cs

    r8675 r8795  
    4747          Vehicle v = new Vehicle();
    4848
    49           v.xCoord = double.Parse(m[0].Value);
    50           v.yCoord = double.Parse(m[1].Value);
    51           v.capacity = double.Parse(m[2].Value);
    52           v.readyTime = double.Parse(m[3].Value);
    53           v.dueTime = double.Parse(m[4].Value);
     49          v.xCoord = double.Parse(m[0].Value, System.Globalization.CultureInfo.InvariantCulture);
     50          v.yCoord = double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture);
     51          v.capacity = double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture);
     52          v.readyTime = double.Parse(m[3].Value, System.Globalization.CultureInfo.InvariantCulture);
     53          v.dueTime = double.Parse(m[4].Value, System.Globalization.CultureInfo.InvariantCulture);
    5454
    5555          vehicles.Add(v);
     
    6464          Order o = new Order();
    6565
    66           o.revealedTime = double.Parse(m[0].Value);
    67           o.pickupXCoord = double.Parse(m[1].Value);
    68           o.pickupYCoord = double.Parse(m[2].Value);
    69           o.deliveryXCoord = double.Parse(m[3].Value);
    70           o.deliveryYCoord = double.Parse(m[4].Value);
    71           o.demand = double.Parse(m[5].Value);
    72           o.pickupServiceTime = double.Parse(m[6].Value);
    73           o.pickupReadyTime = double.Parse(m[7].Value);
    74           o.pickupDueTime = double.Parse(m[8].Value);
    75           o.deliveryServiceTime = double.Parse(m[9].Value);
    76           o.deliveryReadyTime = double.Parse(m[10].Value);
    77           o.deliveryDueTime = double.Parse(m[11].Value);
     66          o.revealedTime = double.Parse(m[0].Value, System.Globalization.CultureInfo.InvariantCulture);
     67          o.pickupXCoord = double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture);
     68          o.pickupYCoord = double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture);
     69          o.deliveryXCoord = double.Parse(m[3].Value, System.Globalization.CultureInfo.InvariantCulture);
     70          o.deliveryYCoord = double.Parse(m[4].Value, System.Globalization.CultureInfo.InvariantCulture);
     71          o.demand = double.Parse(m[5].Value, System.Globalization.CultureInfo.InvariantCulture);
     72          o.pickupServiceTime = double.Parse(m[6].Value, System.Globalization.CultureInfo.InvariantCulture);
     73          o.pickupReadyTime = double.Parse(m[7].Value, System.Globalization.CultureInfo.InvariantCulture);
     74          o.pickupDueTime = double.Parse(m[8].Value, System.Globalization.CultureInfo.InvariantCulture);
     75          o.deliveryServiceTime = double.Parse(m[9].Value, System.Globalization.CultureInfo.InvariantCulture);
     76          o.deliveryReadyTime = double.Parse(m[10].Value, System.Globalization.CultureInfo.InvariantCulture);
     77          o.deliveryDueTime = double.Parse(m[11].Value, System.Globalization.CultureInfo.InvariantCulture);
    7878
    7979          orders.Add(o);
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Parsers/TSPLibDynPDPParser.cs

    r8675 r8795  
    5959        m = reg.Matches(line);
    6060        while (m.Count == 3) {
    61           xCoord.Add(double.Parse(m[1].Value));
    62           yCoord.Add(double.Parse(m[2].Value));
     61          xCoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture));
     62          yCoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture));
    6363
    6464          line = reader.ReadLine();
     
    8484          Order o = new Order();
    8585
    86           int pickupId = int.Parse(m[1].Value);
    87           int deliveryId = int.Parse(m[2].Value);
    88           double pickupTWOpen = double.Parse(m[3].Value);
    89           double pickupTWClose = double.Parse(m[4].Value);
    90           double pickupServiceTime = double.Parse(m[5].Value);
    91           double deliveryTWOpen = double.Parse(m[6].Value);
    92           double deliveryTWClose = double.Parse(m[7].Value);
    93           double deliveryServiceTime = double.Parse(m[8].Value);
    94           double demand = double.Parse(m[9].Value);
    95           double revealed = double.Parse(m[10].Value);
     86          int pickupId = int.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture);
     87          int deliveryId = int.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture);
     88          double pickupTWOpen = double.Parse(m[3].Value, System.Globalization.CultureInfo.InvariantCulture);
     89          double pickupTWClose = double.Parse(m[4].Value, System.Globalization.CultureInfo.InvariantCulture);
     90          double pickupServiceTime = double.Parse(m[5].Value, System.Globalization.CultureInfo.InvariantCulture);
     91          double deliveryTWOpen = double.Parse(m[6].Value, System.Globalization.CultureInfo.InvariantCulture);
     92          double deliveryTWClose = double.Parse(m[7].Value, System.Globalization.CultureInfo.InvariantCulture);
     93          double deliveryServiceTime = double.Parse(m[8].Value, System.Globalization.CultureInfo.InvariantCulture);
     94          double demand = double.Parse(m[9].Value, System.Globalization.CultureInfo.InvariantCulture);
     95          double revealed = double.Parse(m[10].Value, System.Globalization.CultureInfo.InvariantCulture);
    9696
    9797          o.revealedTime = revealed;
Note: See TracChangeset for help on using the changeset viewer.