Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/25/11 14:37:13 (14 years ago)
Author:
abeham
Message:

#1330

  • Added working version of QAP
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Parsers/QAPLIBParser.cs

    r5562 r5563  
    2121
    2222    public bool Parse(string file) {
     23      using (Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read)) {
     24        return Parse(stream);
     25      }
     26    }
     27
     28    /// <summary>
     29    /// Reads from the given stream data which is expected to be in the QAPLIB format.
     30    /// </summary>
     31    /// <remarks>
     32    /// The stream is not closed or disposed. The caller has to take care of that.
     33    /// </remarks>
     34    /// <param name="stream">The stream to read data from.</param>
     35    /// <returns>True if the file was successfully read or false otherwise.</returns>
     36    public bool Parse(Stream stream) {
    2337      Error = null;
    2438      try {
    25         StreamReader reader = new StreamReader(file);
     39        StreamReader reader = new StreamReader(stream);
    2640        Size = int.Parse(reader.ReadLine());
    2741        Distances = new double[Size, Size];
     
    6579        return false;
    6680      }
    67 
    6881    }
    6982  }
Note: See TracChangeset for help on using the changeset viewer.