Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/25/10 16:29:06 (14 years ago)
Author:
svonolfe
Message:

Improved the parsers (#1039)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/ORLIBParser.cs

    r4315 r4317  
    2525using System.Text;
    2626using System.IO;
     27using System.Globalization;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting {
    2930  class ORLIBParser {
    3031    private StreamReader source;
     32    CultureInfo culture = new CultureInfo("en-US");
    3133   
    3234    private string name;
     
    101103        line = source.ReadLine();
    102104        tokens = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
    103         vertices[0, 0] = double.Parse(tokens[0]);
    104         vertices[0, 1] = double.Parse(tokens[1]);
     105        vertices[0, 0] = double.Parse(tokens[0], culture.NumberFormat);
     106        vertices[0, 1] = double.Parse(tokens[1], culture.NumberFormat);
    105107
    106108        for (int i = 0; i < customers; i++) {
    107109          line = source.ReadLine();
    108110          tokens = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
    109           vertices[i + 1, 0] = double.Parse(tokens[0]);
    110           vertices[i + 1, 1] = double.Parse(tokens[1]);
    111           demands[i + 1] = double.Parse(tokens[2]);
     111          vertices[i + 1, 0] = double.Parse(tokens[0], culture.NumberFormat);
     112          vertices[i + 1, 1] = double.Parse(tokens[1], culture.NumberFormat);
     113          demands[i + 1] = double.Parse(tokens[2], culture.NumberFormat);
    112114        }
    113115      }
Note: See TracChangeset for help on using the changeset viewer.