Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

MpsReader Class Reference

#include <MpsReader.h>

List of all members.

Public Methods

void numberOfNonZeros (int &nnzQ, int &nnzA, int &nnzC)
virtual void readQpBound (OoqpVector &c, SymMatrix &Q, OoqpVector &xlow, OoqpVector &ixlow, OoqpVector &xupp, OoqpVector &ixupp, int &ierr)
virtual void readQpGen (OoqpVector &c, SymMatrix &Q, OoqpVector &xlow, OoqpVector &ixlow, OoqpVector &xupp, OoqpVector &ixupp, GenMatrix &A, OoqpVector &b, GenMatrix &C, OoqpVector &clow, OoqpVector &iclow, OoqpVector &cupp, OoqpVector &icupp, int &ierr)
virtual void readQpGen (double c[], int irowQ[], int jcolQ[], double dQ[], double xlow[], char ixlow[], double xupp[], char ixupp[], int irowA[], int jcolA[], double dA[], double b[], int irowC[], int jcolC[], double dC[], double clow[], char iclow[], double cupp[], char icupp[], int &ierr)
virtual void getSizes (int &nx, int &my, int &mz)
virtual void releaseFile (int &ierr)
virtual ~MpsReader ()
void printSolution (double x[], int nx, double xlow[], char ixlow[], double xupp[], char ixupp[], double gamma[], double phi[], double y[], int my, double s[], int mz, double clow[], char iclow[], double cupp[], char icupp[], double lambda[], double pi[], double z[], double objectiveValue, int &iErr)

Static Public Methods

MpsReader * newReadingFile (char filename[], int &iErr)
void findFile (FILE *&file, char *&resolvedName, char filename[])

Public Attributes

int scalingOption
char objectiveSense [3]

Protected Methods

 MpsReader ()
 MpsReader (FILE *file)
virtual void scanFile (int &iErr)

Protected Attributes

char * infilename
int iline
int nnzA
int nnzC
int nnzQ
int my
int mz
FILE * file
char * boundType
HashTable * rowTable
HashTable * colTable


Detailed Description

A class for reading a Quadratic Programming problem from a file in modified MPS format.

The problem to be read is in QpGen format:

  minimize    c' x + ( 1/2 ) x' * Q x         ; 
  subject to                      A x  = b    ;
                         clow <=  C x <= cupp ;
                         xlow <=    x <= xupp ;
  

The general linear equality constraints must have either an upper or lower bound, but need not have both bounds. The variables may have no bounds; an upper bound; a lower bound or both an upper and lower bound.


Constructor & Destructor Documentation

MpsReader::MpsReader   [inline, protected]
 

protected constructor. Call the class method MpsReader::newReadingFile to obtain a new, initalized MpsReader.

See also:
MpsReader::newReadingFile

MpsReader::MpsReader FILE *    file [protected]
 

protected constructor. Call the class method MpsReader::newReadingFile to obtain a new, initalized MpsReader.

See also:
MpsReader::newReadingFile

virtual MpsReader::~MpsReader   [virtual]
 

Destructor


Member Function Documentation

void MpsReader::findFile FILE *&    file,
char *&    resolvedName,
char    filename[]
[static]
 

Locate an input file, given the user-supplied name and applying the MpsReader search rules

virtual void MpsReader::getSizes int &    nx,
int &    my,
int &    mz
[virtual]
 

Returns the sizes of the various components of the QP.

Parameters:
nx  the number of variables
my  the number of equality constraints
mz  the number of general inequality constraints (this number does not include simple bounds on the variables.)

MpsReader* MpsReader::newReadingFile char    filename[],
int &    iErr
[static]
 

Creates a new MpsReader that initializes itself from the data in a file.

Parameters:
filename  the name of the file to read. If filename == '-' standard input will be read.
iErr  iErr is non-zero if some error prevented the new MpsReader from initializing itself, for example if the file could not be read.
Returns:
the new MpsReader, or nil if there was an error.

void MpsReader::numberOfNonZeros int &    nnzQ,
int &    nnzA,
int &    nnzC
 

responds with the number of non-zeros in the QP data.

Parameters:
nnzQ  the number of non-zeros in Q
nnzA  the number of non-zeros in A
nnzC  the number of non-zeros in C

void MpsReader::printSolution double    x[],
int    nx,
double    xlow[],
char    ixlow[],
double    xupp[],
char    ixupp[],
double    gamma[],
double    phi[],
double    y[],
int    my,
double    s[],
int    mz,
double    clow[],
char    iclow[],
double    cupp[],
char    icupp[],
double    lambda[],
double    pi[],
double    z[],
double    objectiveValue,
int &    iErr
 

print the solution contained in the individual arrays of the QpGenVars "variables" object as an ascii file,associating the numerical values with the names stored in the MpsReader structure

virtual void MpsReader::readQpBound OoqpVector   c,
SymMatrix   Q,
OoqpVector   xlow,
OoqpVector   ixlow,
OoqpVector   xupp,
OoqpVector   ixupp,
int &    ierr
[virtual]
 

Reads the various components of a QP in the "general" formulation into their respective matrices and vectors, stored as objects from OOQP's linear algebra classes. See the class comments for the meaning of the variables.

Parameters:
iErr  iErr is non-zero if there was some error reading the data, in partical if this QP has more than simple bounds.

virtual void MpsReader::readQpGen double    c[],
int    irowQ[],
int    jcolQ[],
double    dQ[],
double    xlow[],
char    ixlow[],
double    xupp[],
char    ixupp[],
int    irowA[],
int    jcolA[],
double    dA[],
double    b[],
int    irowC[],
int    jcolC[],
double    dC[],
double    clow[],
char    iclow[],
double    cupp[],
char    icupp[],
int &    ierr
[virtual]
 

Reads the various components of a QP in the "general" formulation into data representaions consisting of arrays of doubles and ints. For instance, the matrices Q, A, and C from this formulation each are represented in three arrays, in Harwell-Boeing format. See the class comments for the meaning of the various variables.

Parameters:
iErr  iErr is non-zero if there was some error reading the data.

virtual void MpsReader::readQpGen OoqpVector   c,
SymMatrix   Q,
OoqpVector   xlow,
OoqpVector   ixlow,
OoqpVector   xupp,
OoqpVector   ixupp,
GenMatrix   A,
OoqpVector   b,
GenMatrix   C,
OoqpVector   clow,
OoqpVector   iclow,
OoqpVector   cupp,
OoqpVector   icupp,
int &    ierr
[virtual]
 

Reads the various components of a QP in the "general" formulation into their respective matrices and vectors, stored as objects from OOQP's linear algebra classes. See the class comments for the meaning of the variables.

Parameters:
iErr  iErr is non-zero if there was some error reading the data.

virtual void MpsReader::releaseFile int &    ierr [virtual]
 

Closes the data file if necessary, and forgets all references to it. Call this method immediately before deleting the MpsReader. We do not close the data file in the destructor, because that operation can fail!

Call this method even when reading from stdin. This method will not close stdin.

Parameters:
iErr  iErr is non-zero if there was some error closing the file.

virtual void MpsReader::scanFile int &    iErr [protected, virtual]
 

protected method for scanning the file while initializing the MpsReader. Once the dimensions of the problem have been determined, it calls the class method MpsReader::newReadingFile to obtain an MpsReader with the dimensions appropriately initialized.

Parameters:
iErr  iErr is non-zero if there was some error scanning the file.
See also:
MpsReader::newReadingFile


Member Data Documentation

char* MpsReader::boundType [protected]
 

the type of bound on each variable, normal, free, upper, lower, upperlower, fix, minfty

HashTable* MpsReader::colTable [protected]
 

has table containing column names

FILE* MpsReader::file [protected]
 

the file to be read

int MpsReader::iline [protected]
 

Input file line number

char* MpsReader::infilename [protected]
 

root of the filename for input (and possibly output) files

int MpsReader::my [protected]
 

cached values for the sizes of the parts of this QP

int MpsReader::mz [protected]
 

cached values for the sizes of the parts of this QP

int MpsReader::nnzA [protected]
 

cached values for the number of non-zeros in the parts of this QP

int MpsReader::nnzC [protected]
 

cached values for the number of non-zeros in the parts of this QP

int MpsReader::nnzQ [protected]
 

cached values for the number of non-zeros in the parts of this QP

char MpsReader::objectiveSense[3]
 

Objective sense is either MAX or MIN

HashTable* MpsReader::rowTable [protected]
 

hash tables containing row names

int MpsReader::scalingOption
 

The scaling option allows solution of problems in which the variables or equations have a vast range of values. By default, we do not scale unless the user requests it via the commandline argument.


The documentation for this class was generated from the following file:
Generated on Mon May 24 17:40:46 2004 for OOQP by doxygen1.2.18