Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14478


Ignore:
Timestamp:
12/12/16 14:52:34 (8 years ago)
Author:
pfleck
Message:

#2705

Location:
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonFormatInstanceProvider.cs

    r14185 r14478  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.IO;
    2524using System.Linq;
     
    6463        string date = ExtractValue(reader.ReadLine());
    6564        string reference = ExtractValue(reader.ReadLine());
    66         reader.ReadLine(); // Solution
    67 
    68         var routesQuery =
    69           from line in reader.ReadAllLines()
    70           where !string.IsNullOrEmpty(line)
    71           let tokens = ExtractValue(line).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
    72           let stops = tokens.Select(int.Parse).Select(s => s - 1)
    73           select stops;
    74 
    75         var routes = routesQuery.Select(s => s.ToArray()).ToArray();
    76 
    77         instance.BestKnownTour = routes;
     65        switch (reader.ReadLine().Trim()) { // "Solution" or "Distance"
     66          case "Solution":
     67            var routesQuery = from line in reader.ReadAllLines()
     68                              where !string.IsNullOrEmpty(line)
     69                              let tokens = ExtractValue(line).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
     70                              let stops = tokens.Select(int.Parse).Select(s => s - 1)
     71                              select stops;
     72            var routes = routesQuery.Select(s => s.ToArray()).ToArray();
     73            instance.BestKnownTour = routes;
     74            break;
     75          case "Distance":
     76            double quality = double.Parse(reader.ReadLine());
     77            instance.BestKnownQuality = quality;
     78            break;
     79        }
    7880      }
    7981    }
Note: See TracChangeset for help on using the changeset viewer.