Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/24/12 10:41:05 (12 years ago)
Author:
svonolfe
Message:

Added support for the DCVRP in the Golden format (#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting/3.4/GoldenFormat/GoldenParser.cs

    r7883 r7887  
    4848    private const int NODESECTION = 7;
    4949    private const int CAPACITY = 8;
     50    private const int DISTANCE = 12;
    5051    private const int VEHICLES = 13;
    5152    private const int DEPOTSECTION = 9;
     
    8586      get {
    8687        return vehicles;
     88      }
     89    }
     90
     91    private double distance;
     92    public double Distance {
     93      get {
     94        return distance;
    8795      }
    8896    }
     
    113121      capacity = -1;
    114122      vehicles = -1;
     123      distance = -1;
    115124      demands = null;
    116125    }
     
    179188              case VEHICLES:
    180189                ReadVehicles(str);
     190                break;
     191              case DISTANCE:
     192                ReadDistance(str);
    181193                break;
    182194              case DEPOTSECTION:
     
    226238      if (token.Equals("vehicles", StringComparison.OrdinalIgnoreCase))
    227239        return VEHICLES;
     240      if (token.Equals("distance", StringComparison.OrdinalIgnoreCase))
     241        return DISTANCE;
    228242      if (token.Equals("depot_section", StringComparison.OrdinalIgnoreCase))
    229243        return DEPOTSECTION;
     
    321335    }
    322336
     337    private void ReadDistance(string str) {
     338      string[] tokens = str.Split(new string[] { ":" }, StringSplitOptions.None);
     339      distance = double.Parse(tokens[tokens.Length - 1].Trim(), System.Globalization.CultureInfo.InvariantCulture);
     340    }
     341
    323342    private void ReadDepot(StreamReader reader) {
    324343      string[] tokens;
Note: See TracChangeset for help on using the changeset viewer.