drasys.or.mp.util
Class MPSReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.BufferedReader
              |
              +--drasys.or.mp.util.MPSReader

public class MPSReader
extends java.io.BufferedReader
implements ProblemReaderI

Inputs a mathematical programming problem from an MPS stream. There are two predominate versions of the MPS format. An older format that uses fixed field records and a newer format that uses white-space delimited records. The fixed record format limits row/column names to eight characters and the delimited format allows names of arbitrary length. An MPS reader that reads delimited records can read fixed records with no changes if the row/column names don't contain embedded spaces. This class reads records using the newer delimited format which allows it to read both MPS versions. If the stream contains a NAME record it will be read into the 'lp.name' metadatum.

References:

Linear Programming
    Vasek Chvatal / Paperback / Published 1983
Integer and Combinatorial Optimization
    George L. Nemhauser, Laurence A. Wolsey / Paperback / Published 1988
Integer Programming
    Laurence A. Wolsey / Hardcover / Published 1998


Fields inherited from class java.io.Reader
lock
 
Constructor Summary
MPSReader(java.io.Reader in)
           
MPSReader(java.io.Reader in, int sz)
           
 
Method Summary
 boolean parseComment(SizableProblemI problem, int lineNumber, java.lang.String line)
          This method is called to parse comment lines.
 boolean parseLine(SizableProblemI problem, int lineNumber, java.lang.String line)
          This method is called to parse each line in the 'MPS' stream.
 SizableProblemI readProblem(SizableProblemI problem)
          Parses the MPS stream and puts the data into 'problem'.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MPSReader

public MPSReader(java.io.Reader in)

MPSReader

public MPSReader(java.io.Reader in,
                 int sz)
Method Detail

readProblem

public SizableProblemI readProblem(SizableProblemI problem)
                            throws java.io.IOException,
                                   SyntaxException
Parses the MPS stream and puts the data into 'problem'.
Specified by:
readProblem in interface ProblemReaderI

parseLine

public boolean parseLine(SizableProblemI problem,
                         int lineNumber,
                         java.lang.String line)
                  throws java.io.IOException,
                         DuplicateException,
                         SyntaxException,
                         NotFoundException,
                         InvalidException
This method is called to parse each line in the 'MPS' stream. It can be overridden to customize line parsing.
Returns:
'false' to stop reading or 'true' to continue reading.

parseComment

public boolean parseComment(SizableProblemI problem,
                            int lineNumber,
                            java.lang.String line)
                     throws SyntaxException
This method is called to parse comment lines. It can be overridden to customize comment parsing.
Returns:
'false' to stop reading or 'true' to continue reading.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com