Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/14 14:12:16 (10 years ago)
Author:
pfleck
Message:

#2208

  • Added Schilde instances zip
  • Implemented additional InstanceConsumer of OPData in OrienteeringProblem
Location:
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.Orienteering/3.3
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.Orienteering/3.3/HeuristicLab.Problems.Instances.Orienteering-3.3.csproj

    r11260 r11261  
    4545  <ItemGroup>
    4646    <Compile Include="SchildeOPParser.cs" />
     47    <EmbeddedResource Include="Data\SchildeOP.zip" />
    4748    <None Include="HeuristicLab.snk" />
    4849    <None Include="Plugin.cs.frame" />
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeOPParser.cs

    r11260 r11261  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
     24using System.Globalization;
    2325using System.IO;
    2426using System.Linq;
     
    2628namespace HeuristicLab.Problems.Instances.Orienteering {
    2729  public class SchildeOPParser {
     30    private static readonly IFormatProvider FormatProvider = new CultureInfo("en-US");
     31
    2832    private int currentPoint;
    2933    private int currentDistance;
     
    112116          inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    113117
    114           Coordinates[currentPoint, 0] = double.Parse(positionX);
    115           Coordinates[currentPoint, 1] = double.Parse(positionY);
     118          Coordinates[currentPoint, 0] = double.Parse(positionX, FormatProvider);
     119          Coordinates[currentPoint, 1] = double.Parse(positionY, FormatProvider);
    116120
    117121          // Extract all score values for this point
     
    122126              score = inputString.Substring(0, inputString.IndexOf(','));
    123127              inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    124               Scores[currentPoint, scoreIndex++] = int.Parse(score);
     128              Scores[currentPoint, scoreIndex++] = int.Parse(score, FormatProvider);
    125129            } else {
    126130              score = inputString;
    127               Scores[currentPoint, scoreIndex++] = int.Parse(score);
     131              Scores[currentPoint, scoreIndex++] = int.Parse(score, FormatProvider);
    128132              break;
    129133            }
     
    148152              distance = inputString.Substring(0, inputString.IndexOf(','));
    149153              inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    150               Distances[currentDistance, distanceIndex++] = double.Parse(distance);
     154              Distances[currentDistance, distanceIndex++] = double.Parse(distance, FormatProvider);
    151155            } else {
    152156              distance = inputString;
    153               Distances[currentDistance, distanceIndex++] = double.Parse(distance);
     157              Distances[currentDistance, distanceIndex++] = double.Parse(distance, FormatProvider);
    154158              break;
    155159            }
     
    165169          // Extract the number of points
    166170
    167           pointCount = int.Parse(inputString);
     171          pointCount = int.Parse(inputString, FormatProvider);
    168172          Coordinates = new double[pointCount, 2];
    169173          break;
     
    196200          // Remove the 's,'
    197201          inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    198           int scoreCount = int.Parse(inputString);
    199 
    200           pointCount = int.Parse(inputString);
     202          int scoreCount = int.Parse(inputString, FormatProvider);
     203
     204          pointCount = Coordinates.GetLength(0);
    201205          Scores = new double[pointCount, scoreCount];
    202206
     
    209213          // Remove the 'b,'
    210214          inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    211           StartingPoint = int.Parse(inputString);
     215          StartingPoint = int.Parse(inputString, FormatProvider);
    212216          break;
    213217
     
    218222          // Remove the 'e,'
    219223          inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    220           TerminusPoint = int.Parse(inputString);
     224          TerminusPoint = int.Parse(inputString, FormatProvider);
    221225          break;
    222226
     
    232236          inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    233237
    234           UpperBoundConstraint = double.Parse(inputString);
     238          UpperBoundConstraint = double.Parse(inputString, FormatProvider);
    235239          break;
    236240
     
    246250          inputString = inputString.Remove(0, inputString.IndexOf(',') + 1);
    247251
    248           LowerConstraint = double.Parse(inputString);
     252          LowerConstraint = double.Parse(inputString, FormatProvider);
    249253          break;
    250254
Note: See TracChangeset for help on using the changeset viewer.