- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CoinMpsIO Class Reference

MPS IO Interface. More...

`#include <CoinMpsIO.hpp>`

Collaboration diagram for CoinMpsIO:

[legend]
List of all members.

## Public Member Functions
Methods to retrieve problem information
These methods return information about the problem held by the CoinMpsIO object. Querying an object that has no data associated with it result in zeros for the number of rows and columns, and NULL pointers from the methods that return vectors. Const pointers returned from any data-query method are always valid
int | getNumCols () const
| Get number of columns.
int | getNumRows () const
| Get number of rows.
int | getNumElements () const
| Get number of nonzero elements.
const double * | getColLower () const
| Get pointer to array[getNumCols()] of column lower bounds.
const double * | getColUpper () const
| Get pointer to array[getNumCols()] of column upper bounds.
const char * | getRowSense () const
| Get pointer to array[getNumRows()] of constraint senses.
const double * | getRightHandSide () const
| Get pointer to array[getNumRows()] of constraint right-hand sides.
const double * | getRowRange () const
| Get pointer to array[getNumRows()] of row ranges.
const double * | getRowLower () const
| Get pointer to array[getNumRows()] of row lower bounds.
const double * | getRowUpper () const
| Get pointer to array[getNumRows()] of row upper bounds.
const double * | getObjCoefficients () const
| Get pointer to array[getNumCols()] of objective function coefficients.
const CoinPackedMatrix * | getMatrixByRow () const
| Get pointer to row-wise copy of the coefficient matrix.
const CoinPackedMatrix * | getMatrixByCol () const
| Get pointer to column-wise copy of the coefficient matrix.
bool | isContinuous (int colNumber) const
| Return true if column is a continuous variable.
bool | isInteger (int columnNumber) const
| Return true if a column is an integer variable.
const char * | integerColumns () const
| Returns array[getNumCols()] specifying if a variable is integer.
const char * | rowName (int index) const
| Returns the row name for the specified index.
const char * | columnName (int index) const
| Returns the column name for the specified index.
int | rowIndex (const char *name) const
| Returns the index for the specified row name.
int | columnIndex (const char *name) const
| Returns the index for the specified column name.
double | objectiveOffset () const
| Returns the (constant) objective offset.
void | setObjectiveOffset (double value)
| Set objective offset.
const char * | getProblemName () const
| Return the problem name.
const char * | getObjectiveName () const
| Return the objective name.
const char * | getRhsName () const
| Return the RHS vector name.
const char * | getRangeName () const
| Return the range vector name.
const char * | getBoundName () const
| Return the bound vector name.
int | numberStringElements () const
| Number of string elements.
const char * | stringElement (int i) const
| String element.
Methods to set problem information
Methods to load a problem into the CoinMpsIO object.
void | setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const double *rowlb, const double *rowub, char const *const *const colnames, char const *const *const rownames)
| Set the problem data.
void | setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const double *rowlb, const double *rowub, const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
| Set the problem data.
void | setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const char *rowsen, const double *rowrhs, const double *rowrng, char const *const *const colnames, char const *const *const rownames)
| Set the problem data.
void | setMpsData (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const char *rowsen, const double *rowrhs, const double *rowrng, const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
| Set the problem data.
void | copyInIntegerInformation (const char *integerInformation)
| Pass in an array[getNumCols()] specifying if a variable is integer.
void | setProblemName (const char *name)
| Set problem name.
Parameter set/get methods
Methods to set and retrieve MPS IO parameters.
void | setInfinity (double value)
| Set infinity.
double | getInfinity () const
| Get infinity.
void | setDefaultBound (int value)
| Set default upper bound for integer variables.
int | getDefaultBound () const
| Get default upper bound for integer variables.
int | allowStringElements () const
| Whether to allow string elements.
void | setAllowStringElements (int yesNo)
| Whether to allow string elements (0 no, 1 yes, 2 yes and try flip).
Methods for problem input and output
Methods to read and write MPS format problem files. The read and write methods return the number of errors that occurred during the IO operation, or -1 if no file is opened. Note: If the CoinMpsIO class was compiled with support for libz then readMps will automatically try to append .gz to the file name and open it as a compressed file if the specified file name cannot be opened. (Automatic append of the .bz2 suffix when libbz is used is on the TODO list.) Todo: Allow for file pointers and positioning
void | setFileName (const char *name)
| Set the current file name for the CoinMpsIO object.
const char * | getFileName () const
| Get the current file name for the CoinMpsIO object.
int | readMps (const char *filename, const char *extension="mps")
| Read a problem in MPS format from the given filename.
int | readMps (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
| Read a problem in MPS format from the given filename.
int | readMps ()
| Read a problem in MPS format from a previously opened file.
int | readMps (int &numberSets, CoinSet **&sets)
| and
int | readBasis (const char *filename, const char *extension, double *solution, unsigned char *rowStatus, unsigned char *columnStatus, const std::vector< std::string > &colnames, int numberColumns, const std::vector< std::string > &rownames, int numberRows)
| Read a basis in MPS format from the given filename.
int | readGms (const char *filename, const char *extension="gms", bool convertObjective=false)
| Read a problem in GAMS format from the given filename.
int | readGms (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
| Read a problem in GAMS format from the given filename.
int | readGms (int &numberSets, CoinSet **&sets)
| and
int | readGMPL (const char *modelName, const char *dataName=NULL, bool keepNames=false)
| Read a problem in GMPL (subset of AMPL) format from the given filenames.
int | writeMps (const char *filename, int compression=0, int formatType=0, int numberAcross=2, CoinPackedMatrix *quadratic=NULL, int numberSOS=0, const CoinSet *setInfo=NULL) const
| Write the problem in MPS format to a file with the given filename.
const CoinMpsCardReader * | reader () const
| Return card reader object so can see what last card was e.g. QUADOBJ.
int | readQuadraticMps (const char *filename, int *&columnStart, int *&column, double *&elements, int checkSymmetry)
| Read in a quadratic objective from the given filename.
int | readConicMps (const char *filename, int *&columnStart, int *&column, int &numberCones)
| Read in a list of cones from the given filename.
void | setConvertObjective (bool trueFalse)
| Set whether to move objective from matrix.
int | copyStringElements (const CoinModel *model)
| copies in strings from a CoinModel - returns number
Constructors and destructors
| CoinMpsIO ()
| Default Constructor.
| CoinMpsIO (const CoinMpsIO &)
| Copy constructor.
CoinMpsIO & | operator= (const CoinMpsIO &rhs)
| Assignment operator.
| ~CoinMpsIO ()
| Destructor.
Message handling
void | passInMessageHandler (CoinMessageHandler *handler)
| Pass in Message handler.
void | newLanguage (CoinMessages::Language language)
| Set the language for messages.
void | setLanguage (CoinMessages::Language language)
| Set the language for messages.
CoinMessageHandler * | messageHandler () const
| Return the message handler.
CoinMessages | messages ()
| Return the messages.
CoinMessages * | messagesPointer ()
| Return the messages pointer.
Methods to release storage
These methods allow the client to reduce the storage used by the CoinMpsIO object be selectively releasing unneeded problem information.
void | releaseRedundantInformation ()
| Release all information which can be re-calculated.
void | releaseRowInformation ()
| Release all row information (lower, upper).
void | releaseColumnInformation ()
| Release all column information (lower, upper, objective).
void | releaseIntegerInformation ()
| Release integer information.
void | releaseRowNames ()
| Release row names.
void | releaseColumnNames ()
| Release column names.
void | releaseMatrixInformation ()
| Release matrix information.
## Protected Member Functions
Miscellaneous helper functions
void | setMpsDataWithoutRowAndColNames (const CoinPackedMatrix &m, const double infinity, const double *collb, const double *colub, const double *obj, const char *integrality, const double *rowlb, const double *rowub)
| Utility method used several times to implement public methods.
void | setMpsDataColAndRowNames (const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
| Utility method used several times to implement public methods.
void | setMpsDataColAndRowNames (char const *const *const colnames, char const *const *const rownames)
| Utility method used several times to implement public methods.
void | gutsOfDestructor ()
| Does the heavy lifting for destruct and assignment.
void | gutsOfCopy (const CoinMpsIO &)
| Does the heavy lifting for copy and assignment.
void | freeAll ()
| Clears problem data from the CoinMpsIO object.
void | convertBoundToSense (const double lower, const double upper, char &sense, double &right, double &range) const
| A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style.
void | convertSenseToBound (const char sense, const double right, const double range, double &lower, double &upper) const
| A quick inlined function to convert from sense/rhs/range stryle constraint definition to lb/ub style.
int | dealWithFileName (const char *filename, const char *extension, CoinFileInput *&input)
| Deal with a filename.
void | addString (int iRow, int iColumn, const char *value)
| Add string to list iRow==numberRows is objective, nr+1 is lo, nr+2 is up iColumn==nc is rhs (can't cope with ranges at present).
void | decodeString (int iString, int &iRow, int &iColumn, const char *&value) const
| Decode string.
Hash table methods
void | startHash (char **names, const int number, int section)
| Creates hash list for names (section = 0 for rows, 1 columns).
void | startHash (int section) const
| This one does it when names are already in.
void | stopHash (int section)
| Deletes hash storage.
int | findHash (const char *name, int section) const
| Finds match using hash, -1 not found.
## Protected Attributes
Cached problem information
char * | problemName_
| Problem name.
char * | objectiveName_
| Objective row name.
char * | rhsName_
| Right-hand side vector name.
char * | rangeName_
| Range vector name.
char * | boundName_
| Bounds vector name.
int | numberRows_
| Number of rows.
int | numberColumns_
| Number of columns.
CoinBigIndex | numberElements_
| Number of coefficients.
char * | rowsense_
| Pointer to dense vector of row sense indicators.
double * | rhs_
| Pointer to dense vector of row right-hand side values.
double * | rowrange_
| Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range rows).
CoinPackedMatrix * | matrixByRow_
| Pointer to row-wise copy of problem matrix coefficients.
CoinPackedMatrix * | matrixByColumn_
| Pointer to column-wise copy of problem matrix coefficients.
double * | rowlower_
| Pointer to dense vector of row lower bounds.
double * | rowupper_
| Pointer to dense vector of row upper bounds.
double * | collower_
| Pointer to dense vector of column lower bounds.
double * | colupper_
| Pointer to dense vector of column upper bounds.
double * | objective_
| Pointer to dense vector of objective coefficients.
double | objectiveOffset_
| Constant offset for objective value (i.e., RHS value for OBJ row).
char * | integerType_
| Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
char ** | names_ [2]
| Row and column names Linked to hash table sections (0 - row names, 1 column names).
Hash tables
char * | fileName_
| Current file name.
int | numberHash_ [2]
| Number of entries in a hash table section.
CoinHashLink * | hash_ [2]
| Hash tables (two sections, 0 - row names, 1 - column names).
CoinMpsIO object parameters
int | defaultBound_
| Upper bound when no bounds for integers.
double | infinity_
| Value to use for infinity.
CoinMessageHandler * | handler_
| Message handler.
bool | defaultHandler_
| Flag to say if the message handler is the default handler.
CoinMessages | messages_
| Messages.
CoinMpsCardReader * | cardReader_
| Card reader.
bool | convertObjective_
| If .gms file should it be massaged to move objective.
int | allowStringElements_
| Whether to allow string elements.
int | maximumStringElements_
| Maximum number of string elements.
int | numberStringElements_
| Number of string elements.
char ** | stringElements_
| String elements.
## Friends
void | CoinMpsIOUnitTest (const std::string &mpsDir)
| A function that tests the methods in the CoinMpsIO class.
## Classes
struct | CoinHashLink

## Detailed Description

MPS IO Interface.

This class can be used to read in mps files without a solver. After reading the file, the CoinMpsIO object contains all relevant data, which may be more than a particular OsiSolverInterface allows for. Items may be deleted to allow for flexibility of data storage.

The implementation makes the CoinMpsIO object look very like a dummy solver, as the same conventions are used.

Definition at line 329 of file CoinMpsIO.hpp.

## Constructor & Destructor Documentation

CoinMpsIO::CoinMpsIO | ( |  | ) |

Default Constructor.

CoinMpsIO::CoinMpsIO | ( | const CoinMpsIO & |  | ) |

Copy constructor.

CoinMpsIO::~CoinMpsIO | ( |  | ) |

Destructor.

## Member Function Documentation

int CoinMpsIO::getNumCols | ( |  | ) | const

Get number of columns.

int CoinMpsIO::getNumRows | ( |  | ) | const

Get number of rows.

int CoinMpsIO::getNumElements | ( |  | ) | const

Get number of nonzero elements.

const double* CoinMpsIO::getColLower | ( |  | ) | const

Get pointer to array[getNumCols()] of column lower bounds.

const double* CoinMpsIO::getColUpper | ( |  | ) | const

Get pointer to array[getNumCols()] of column upper bounds.

const char* CoinMpsIO::getRowSense | ( |  | ) | const

Get pointer to array[getNumRows()] of constraint senses.

- 'L': <= constraint
- 'E': = constraint
- 'G': >= constraint
- 'R': ranged constraint
- 'N': free constraint

const double* CoinMpsIO::getRightHandSide | ( |  | ) | const

Get pointer to array[getNumRows()] of constraint right-hand sides.

Given constraints with upper (rowupper) and/or lower (rowlower) bounds, the constraint right-hand side (rhs) is set as

- if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
- if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
- if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
- if rowsense()[i] == 'N' then rhs()[i] == 0.0

const double* CoinMpsIO::getRowRange | ( |  | ) | const

Get pointer to array[getNumRows()] of row ranges.

Given constraints with upper (rowupper) and/or lower (rowlower) bounds, the constraint range (rowrange) is set as

- if rowsense()[i] == 'R' then rowrange()[i] == rowupper()[i] - rowlower()[i]
- if rowsense()[i] != 'R' then rowrange()[i] is 0.0

Put another way, only range constraints have a nontrivial value for rowrange.

const double* CoinMpsIO::getRowLower | ( |  | ) | const

Get pointer to array[getNumRows()] of row lower bounds.

const double* CoinMpsIO::getRowUpper | ( |  | ) | const

Get pointer to array[getNumRows()] of row upper bounds.

const double* CoinMpsIO::getObjCoefficients | ( |  | ) | const

Get pointer to array[getNumCols()] of objective function coefficients.

const CoinPackedMatrix* CoinMpsIO::getMatrixByRow | ( |  | ) | const

Get pointer to row-wise copy of the coefficient matrix.

const CoinPackedMatrix* CoinMpsIO::getMatrixByCol | ( |  | ) | const

Get pointer to column-wise copy of the coefficient matrix.

bool CoinMpsIO::isContinuous | ( | int | colNumber | ) | const

Return true if column is a continuous variable.

bool CoinMpsIO::isInteger | ( | int | columnNumber | ) | const

Return true if a column is an integer variable.

Note: This function returns true if the the column is a binary or general integer variable.

const char* CoinMpsIO::integerColumns | ( |  | ) | const

Returns array[getNumCols()] specifying if a variable is integer.

At present, simply coded as zero (continuous) and non-zero (integer) May be extended at a later date.

const char* CoinMpsIO::rowName | ( | int | index | ) | const

Returns the row name for the specified index.

Returns 0 if the index is out of range.

const char* CoinMpsIO::columnName | ( | int | index | ) | const

Returns the column name for the specified index.

Returns 0 if the index is out of range.

int CoinMpsIO::rowIndex | ( | const char * | name | ) | const

Returns the index for the specified row name.

Returns -1 if the name is not found. Returns numberRows for the objective row and > numberRows for dropped free rows.

int CoinMpsIO::columnIndex | ( | const char * | name | ) | const

Returns the index for the specified column name.

Returns -1 if the name is not found.

double CoinMpsIO::objectiveOffset | ( |  | ) | const

Returns the (constant) objective offset.

This is the RHS entry for the objective row

void CoinMpsIO::setObjectiveOffset | ( | double | value | ) | `[inline]`

Set objective offset.

Definition at line 463 of file CoinMpsIO.hpp.

References objectiveOffset_.

const char* CoinMpsIO::getProblemName | ( |  | ) | const

Return the problem name.

const char* CoinMpsIO::getObjectiveName | ( |  | ) | const

Return the objective name.

const char* CoinMpsIO::getRhsName | ( |  | ) | const

Return the RHS vector name.

const char* CoinMpsIO::getRangeName | ( |  | ) | const

Return the range vector name.

const char* CoinMpsIO::getBoundName | ( |  | ) | const

Return the bound vector name.

int CoinMpsIO::numberStringElements | ( |  | ) | const`[inline]`

Number of string elements.

Definition at line 481 of file CoinMpsIO.hpp.

References numberStringElements_.

const char* CoinMpsIO::stringElement | ( | int | i | ) | const`[inline]`

String element.

Definition at line 484 of file CoinMpsIO.hpp.

References stringElements_.

void CoinMpsIO::setMpsData | ( | const CoinPackedMatrix & | m,
|  | const double | infinity,
|  | const double * | collb,
|  | const double * | colub,
|  | const double * | obj,
|  | const char * | integrality,
|  | const double * | rowlb,
|  | const double * | rowub,
|  | char const *const *const | colnames,
|  | char const *const *const | rownames |
| ) |  |  |

Set the problem data.

void CoinMpsIO::setMpsData | ( | const CoinPackedMatrix & | m,
|  | const double | infinity,
|  | const double * | collb,
|  | const double * | colub,
|  | const double * | obj,
|  | const char * | integrality,
|  | const double * | rowlb,
|  | const double * | rowub,
|  | const std::vector< std::string > & | colnames,
|  | const std::vector< std::string > & | rownames |
| ) |  |  |

Set the problem data.

void CoinMpsIO::setMpsData | ( | const CoinPackedMatrix & | m,
|  | const double | infinity,
|  | const double * | collb,
|  | const double * | colub,
|  | const double * | obj,
|  | const char * | integrality,
|  | const char * | rowsen,
|  | const double * | rowrhs,
|  | const double * | rowrng,
|  | char const *const *const | colnames,
|  | char const *const *const | rownames |
| ) |  |  |

Set the problem data.

void CoinMpsIO::setMpsData | ( | const CoinPackedMatrix & | m,
|  | const double | infinity,
|  | const double * | collb,
|  | const double * | colub,
|  | const double * | obj,
|  | const char * | integrality,
|  | const char * | rowsen,
|  | const double * | rowrhs,
|  | const double * | rowrng,
|  | const std::vector< std::string > & | colnames,
|  | const std::vector< std::string > & | rownames |
| ) |  |  |

Set the problem data.

void CoinMpsIO::copyInIntegerInformation | ( | const char * | integerInformation | ) |

Pass in an array[getNumCols()] specifying if a variable is integer.

At present, simply coded as zero (continuous) and non-zero (integer) May be extended at a later date.

void CoinMpsIO::setProblemName | ( | const char * | name | ) |

Set problem name.

void CoinMpsIO::setInfinity | ( | double | value | ) |

Set infinity.

double CoinMpsIO::getInfinity | ( |  | ) | const

Get infinity.

void CoinMpsIO::setDefaultBound | ( | int | value | ) |

Set default upper bound for integer variables.

int CoinMpsIO::getDefaultBound | ( |  | ) | const

Get default upper bound for integer variables.

int CoinMpsIO::allowStringElements | ( |  | ) | const`[inline]`

Whether to allow string elements.

Definition at line 553 of file CoinMpsIO.hpp.

References allowStringElements_.

void CoinMpsIO::setAllowStringElements | ( | int | yesNo | ) | `[inline]`

Whether to allow string elements (0 no, 1 yes, 2 yes and try flip).

Definition at line 556 of file CoinMpsIO.hpp.

References allowStringElements_.

void CoinMpsIO::setFileName | ( | const char * | name | ) |

Set the current file name for the CoinMpsIO object.

const char* CoinMpsIO::getFileName | ( |  | ) | const

Get the current file name for the CoinMpsIO object.

int CoinMpsIO::readMps | ( | const char * | filename,
|  | const char * | extension = `"mps"` |
| ) |  |  |

Read a problem in MPS format from the given filename.

Use "stdin" or "-" to read from stdin.

int CoinMpsIO::readMps | ( | const char * | filename,
|  | const char * | extension,
|  | int & | numberSets,
|  | CoinSet **& | sets |
| ) |  |  |

Read a problem in MPS format from the given filename.

Use "stdin" or "-" to read from stdin. But do sets as well

int CoinMpsIO::readMps | ( |  | ) |

Read a problem in MPS format from a previously opened file.

More precisely, read a problem using a CoinMpsCardReader object already associated with this CoinMpsIO object.

Todo:
  Provide an interface that will allow a client to associate a CoinMpsCardReader object with a CoinMpsIO object by setting the cardReader_ field.

int CoinMpsIO::readMps | ( | int & | numberSets,
|  | CoinSet **& | sets |
| ) |  |  |

and

int CoinMpsIO::readBasis | ( | const char * | filename,
|  | const char * | extension,
|  | double * | solution,
|  | unsigned char * | rowStatus,
|  | unsigned char * | columnStatus,
|  | const std::vector< std::string > & | colnames,
|  | int | numberColumns,
|  | const std::vector< std::string > & | rownames,
|  | int | numberRows |
| ) |  |  |

Read a basis in MPS format from the given filename.

If VALUES on NAME card and solution not NULL fills in solution status values as for CoinWarmStartBasis (but one per char) -1 file error, 0 normal, 1 has solution values

Use "stdin" or "-" to read from stdin.

If sizes of names incorrect - read without names

int CoinMpsIO::readGms | ( | const char * | filename,
|  | const char * | extension = `"gms"`,
|  | bool | convertObjective = `false` |
| ) |  |  |

Read a problem in GAMS format from the given filename.

Use "stdin" or "-" to read from stdin. if convertObjective then massages objective column

int CoinMpsIO::readGms | ( | const char * | filename,
|  | const char * | extension,
|  | int & | numberSets,
|  | CoinSet **& | sets |
| ) |  |  |

Read a problem in GAMS format from the given filename.

Use "stdin" or "-" to read from stdin. But do sets as well

int CoinMpsIO::readGms | ( | int & | numberSets,
|  | CoinSet **& | sets |
| ) |  |  |

and

More precisely, read a problem using a CoinMpsCardReader object already associated with this CoinMpsIO object.

int CoinMpsIO::readGMPL | ( | const char * | modelName,
|  | const char * | dataName = `NULL`,
|  | bool | keepNames = `false` |
| ) |  |  |

Read a problem in GMPL (subset of AMPL) format from the given filenames.

int CoinMpsIO::writeMps | ( | const char * | filename,
|  | int | compression = `0`,
|  | int | formatType = `0`,
|  | int | numberAcross = `2`,
|  | CoinPackedMatrix * | quadratic = `NULL`,
|  | int | numberSOS = `0`,
|  | const CoinSet * | setInfo = `NULL` |
| ) |  |  | const

Write the problem in MPS format to a file with the given filename.

Parameters:

  | compression | can be set to three values to indicate what kind of file should be written 0: plain text (default) 1: gzip compressed (.gz is appended to `filename`) 2: bzip2 compressed (.bz2 is appended to `filename`) (TODO) If the library was not compiled with the requested compression then writeMps falls back to writing a plain text file.
  | formatType | specifies the precision to used for values in the MPS file 0: normal precision (default) 1: extra accuracy 2: IEEE hex
  | numberAcross | specifies whether 1 or 2 (default) values should be specified on every data line in the MPS file.
  | quadratic | specifies quadratic objective to be output

const CoinMpsCardReader* CoinMpsIO::reader | ( |  | ) | const`[inline]`

Return card reader object so can see what last card was e.g. QUADOBJ.

Definition at line 685 of file CoinMpsIO.hpp.

References cardReader_.

int CoinMpsIO::readQuadraticMps | ( | const char * | filename,
|  | int *& | columnStart,
|  | int *& | column,
|  | double *& | elements,
|  | int | checkSymmetry |
| ) |  |  |

Read in a quadratic objective from the given filename.

If filename is NULL (or the same as the currently open file) then reading continues from the current file. If not, the file is closed and the specified file is opened.

Code should be added to general MPS reader to read this if QSECTION Data is assumed to be Q and objective is c + 1/2 xT Q x No assumption is made for symmetry, positive definite, etc. No check is made for duplicates or non-triangular if checkSymmetry==0. If 1 checks lower triangular (so off diagonal should be 2*Q) if 2 makes lower triangular and assumes full Q (but adds off diagonals)

Arrays should be deleted by delete []

Returns number of errors:

- -1: bad file
- -2: no Quadratic section
- -3: an empty section
- +n: then matching errors etc (symmetry forced)
- -4: no matching errors but fails triangular test (triangularity forced)

columnStart is numberColumns+1 long, others numberNonZeros

int CoinMpsIO::readConicMps | ( | const char * | filename,
|  | int *& | columnStart,
|  | int *& | column,
|  | int & | numberCones |
| ) |  |  |

Read in a list of cones from the given filename.

If filename is NULL (or the same as the currently open file) then reading continues from the current file. If not, the file is closed and the specified file is opened.

Code should be added to general MPS reader to read this if CSECTION No checking is done that in unique cone

Arrays should be deleted by delete []

Returns number of errors, -1 bad file, -2 no conic section, -3 empty section

columnStart is numberCones+1 long, other number of columns in matrix

void CoinMpsIO::setConvertObjective | ( | bool | trueFalse | ) | `[inline]`

Set whether to move objective from matrix.

Definition at line 739 of file CoinMpsIO.hpp.

References convertObjective_.

int CoinMpsIO::copyStringElements | ( | const CoinModel * | model | ) |

copies in strings from a CoinModel - returns number

CoinMpsIO& CoinMpsIO::operator= | ( | const CoinMpsIO & | rhs | ) |

Assignment operator.

void CoinMpsIO::passInMessageHandler | ( | CoinMessageHandler * | handler | ) |

Pass in Message handler.

Supply a custom message handler. It will not be destroyed when the CoinMpsIO object is destroyed.

void CoinMpsIO::newLanguage | ( | CoinMessages::Language | language | ) |

Set the language for messages.

Referenced by setLanguage().

void CoinMpsIO::setLanguage | ( | CoinMessages::Language | language | ) | `[inline]`

Set the language for messages.

Definition at line 774 of file CoinMpsIO.hpp.

References newLanguage().

CoinMessageHandler* CoinMpsIO::messageHandler | ( |  | ) | const`[inline]`

Return the message handler.

Definition at line 777 of file CoinMpsIO.hpp.

References handler_.

CoinMessages CoinMpsIO::messages | ( |  | ) | `[inline]`

Return the messages.

Definition at line 780 of file CoinMpsIO.hpp.

References messages_.

CoinMessages* CoinMpsIO::messagesPointer | ( |  | ) | `[inline]`

Return the messages pointer.

Definition at line 782 of file CoinMpsIO.hpp.

References messages_.

void CoinMpsIO::releaseRedundantInformation | ( |  | ) |

Release all information which can be re-calculated.

E.g., row sense, copies of rows, hash tables for names.

void CoinMpsIO::releaseRowInformation | ( |  | ) |

Release all row information (lower, upper).

void CoinMpsIO::releaseColumnInformation | ( |  | ) |

Release all column information (lower, upper, objective).

void CoinMpsIO::releaseIntegerInformation | ( |  | ) |

Release integer information.

void CoinMpsIO::releaseRowNames | ( |  | ) |

Release row names.

void CoinMpsIO::releaseColumnNames | ( |  | ) |

Release column names.

void CoinMpsIO::releaseMatrixInformation | ( |  | ) |

Release matrix information.

void CoinMpsIO::setMpsDataWithoutRowAndColNames | ( | const CoinPackedMatrix & | m,
|  | const double | infinity,
|  | const double * | collb,
|  | const double * | colub,
|  | const double * | obj,
|  | const char * | integrality,
|  | const double * | rowlb,
|  | const double * | rowub |
| ) |  |  | `[protected]`

Utility method used several times to implement public methods.

void CoinMpsIO::setMpsDataColAndRowNames | ( | const std::vector< std::string > & | colnames,
|  | const std::vector< std::string > & | rownames |
| ) |  |  | `[protected]`

Utility method used several times to implement public methods.

void CoinMpsIO::setMpsDataColAndRowNames | ( | char const *const *const | colnames,
|  | char const *const *const | rownames |
| ) |  |  | `[protected]`

Utility method used several times to implement public methods.

void CoinMpsIO::gutsOfDestructor | ( |  | ) | `[protected]`

Does the heavy lifting for destruct and assignment.

void CoinMpsIO::gutsOfCopy | ( | const CoinMpsIO & |  | ) | `[protected]`

Does the heavy lifting for copy and assignment.

void CoinMpsIO::freeAll | ( |  | ) | `[protected]`

Clears problem data from the CoinMpsIO object.

void CoinMpsIO::convertBoundToSense | ( | const double | lower,
|  | const double | upper,
|  | char & | sense,
|  | double & | right,
|  | double & | range |
| ) |  |  | const`[inline, protected]`

A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style.

void CoinMpsIO::convertSenseToBound | ( | const char | sense,
|  | const double | right,
|  | const double | range,
|  | double & | lower,
|  | double & | upper |
| ) |  |  | const`[inline, protected]`

A quick inlined function to convert from sense/rhs/range stryle constraint definition to lb/ub style.

int CoinMpsIO::dealWithFileName | ( | const char * | filename,
|  | const char * | extension,
|  | CoinFileInput *& | input |
| ) |  |  | `[protected]`

Deal with a filename.

As the name says. Returns +1 if the file name is new, 0 if it's the same as before (i.e., matches fileName_), and -1 if there's an error and the file can't be opened. Handles automatic append of .gz suffix when compiled with libz.

Todo:
  Add automatic append of .bz2 suffix when compiled with libbz.

void CoinMpsIO::addString | ( | int | iRow,
|  | int | iColumn,
|  | const char * | value |
| ) |  |  | `[protected]`

Add string to list iRow==numberRows is objective, nr+1 is lo, nr+2 is up iColumn==nc is rhs (can't cope with ranges at present).

void CoinMpsIO::decodeString | ( | int | iString,
|  | int & | iRow,
|  | int & | iColumn,
|  | const char *& | value |
| ) |  |  | const`[protected]`

Decode string.

void CoinMpsIO::startHash | ( | char ** | names,
|  | const int | number,
|  | int | section |
| ) |  |  | `[protected]`

Creates hash list for names (section = 0 for rows, 1 columns).

void CoinMpsIO::startHash | ( | int | section | ) | const`[protected]`

This one does it when names are already in.

void CoinMpsIO::stopHash | ( | int | section | ) | `[protected]`

Deletes hash storage.

int CoinMpsIO::findHash | ( | const char * | name,
|  | int | section |
| ) |  |  | const`[protected]`

Finds match using hash, -1 not found.

## Friends And Related Function Documentation

void CoinMpsIOUnitTest | ( | const std::string & | mpsDir | ) | `[friend]`

A function that tests the methods in the CoinMpsIO class.

The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging. Also, if this method is compiled with optimization, the compilation takes 10-15 minutes and the machine pages (has 256M core memory!)...

## Member Data Documentation

char* CoinMpsIO::problemName_`[protected]`

Problem name.

Definition at line 905 of file CoinMpsIO.hpp.

char* CoinMpsIO::objectiveName_`[protected]`

Objective row name.

Definition at line 908 of file CoinMpsIO.hpp.

char* CoinMpsIO::rhsName_`[protected]`

Right-hand side vector name.

Definition at line 911 of file CoinMpsIO.hpp.

char* CoinMpsIO::rangeName_`[protected]`

Range vector name.

Definition at line 914 of file CoinMpsIO.hpp.

char* CoinMpsIO::boundName_`[protected]`

Bounds vector name.

Definition at line 917 of file CoinMpsIO.hpp.

int CoinMpsIO::numberRows_`[protected]`

Number of rows.

Definition at line 920 of file CoinMpsIO.hpp.

int CoinMpsIO::numberColumns_`[protected]`

Number of columns.

Definition at line 923 of file CoinMpsIO.hpp.

CoinBigIndex CoinMpsIO::numberElements_`[protected]`

Number of coefficients.

Definition at line 926 of file CoinMpsIO.hpp.

char* CoinMpsIO::rowsense_`[mutable, protected]`

Pointer to dense vector of row sense indicators.

Definition at line 929 of file CoinMpsIO.hpp.

double* CoinMpsIO::rhs_`[mutable, protected]`

Pointer to dense vector of row right-hand side values.

Definition at line 932 of file CoinMpsIO.hpp.

double* CoinMpsIO::rowrange_`[mutable, protected]`

Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range rows).

Definition at line 937 of file CoinMpsIO.hpp.

CoinPackedMatrix* CoinMpsIO::matrixByRow_`[mutable, protected]`

Pointer to row-wise copy of problem matrix coefficients.

Definition at line 940 of file CoinMpsIO.hpp.

CoinPackedMatrix* CoinMpsIO::matrixByColumn_`[protected]`

Pointer to column-wise copy of problem matrix coefficients.

Definition at line 943 of file CoinMpsIO.hpp.

double* CoinMpsIO::rowlower_`[protected]`

Pointer to dense vector of row lower bounds.

Definition at line 946 of file CoinMpsIO.hpp.

double* CoinMpsIO::rowupper_`[protected]`

Pointer to dense vector of row upper bounds.

Definition at line 949 of file CoinMpsIO.hpp.

double* CoinMpsIO::collower_`[protected]`

Pointer to dense vector of column lower bounds.

Definition at line 952 of file CoinMpsIO.hpp.

double* CoinMpsIO::colupper_`[protected]`

Pointer to dense vector of column upper bounds.

Definition at line 955 of file CoinMpsIO.hpp.

double* CoinMpsIO::objective_`[protected]`

Pointer to dense vector of objective coefficients.

Definition at line 958 of file CoinMpsIO.hpp.

double CoinMpsIO::objectiveOffset_`[protected]`

Constant offset for objective value (i.e., RHS value for OBJ row).

Definition at line 961 of file CoinMpsIO.hpp.

Referenced by setObjectiveOffset().

char* CoinMpsIO::integerType_`[protected]`

Pointer to dense vector specifying if a variable is continuous (0) or integer (1).

Definition at line 967 of file CoinMpsIO.hpp.

char** CoinMpsIO::names_[2]`[protected]`

Row and column names Linked to hash table sections (0 - row names, 1 column names).

Definition at line 972 of file CoinMpsIO.hpp.

char* CoinMpsIO::fileName_`[protected]`

Current file name.

Definition at line 978 of file CoinMpsIO.hpp.

int CoinMpsIO::numberHash_[2]`[protected]`

Number of entries in a hash table section.

Definition at line 981 of file CoinMpsIO.hpp.

CoinHashLink* CoinMpsIO::hash_[2]`[mutable, protected]`

Hash tables (two sections, 0 - row names, 1 - column names).

Definition at line 984 of file CoinMpsIO.hpp.

int CoinMpsIO::defaultBound_`[protected]`

Upper bound when no bounds for integers.

Definition at line 990 of file CoinMpsIO.hpp.

double CoinMpsIO::infinity_`[protected]`

Value to use for infinity.

Definition at line 993 of file CoinMpsIO.hpp.

CoinMessageHandler* CoinMpsIO::handler_`[protected]`

Message handler.

Definition at line 996 of file CoinMpsIO.hpp.

Referenced by messageHandler().

bool CoinMpsIO::defaultHandler_`[protected]`

Flag to say if the message handler is the default handler.

If true, the handler will be destroyed when the CoinMpsIO object is destroyed; if false, it will not be destroyed.

Definition at line 1002 of file CoinMpsIO.hpp.

CoinMessages CoinMpsIO::messages_`[protected]`

Messages.

Definition at line 1004 of file CoinMpsIO.hpp.

Referenced by messages(), and messagesPointer().

CoinMpsCardReader* CoinMpsIO::cardReader_`[protected]`

Card reader.

Definition at line 1006 of file CoinMpsIO.hpp.

Referenced by reader().

bool CoinMpsIO::convertObjective_`[protected]`

If .gms file should it be massaged to move objective.

Definition at line 1008 of file CoinMpsIO.hpp.

Referenced by setConvertObjective().

int CoinMpsIO::allowStringElements_`[protected]`

Whether to allow string elements.

Definition at line 1010 of file CoinMpsIO.hpp.

Referenced by allowStringElements(), and setAllowStringElements().

int CoinMpsIO::maximumStringElements_`[protected]`

Maximum number of string elements.

Definition at line 1012 of file CoinMpsIO.hpp.

int CoinMpsIO::numberStringElements_`[protected]`

Number of string elements.

Definition at line 1014 of file CoinMpsIO.hpp.

Referenced by numberStringElements().

char** CoinMpsIO::stringElements_`[protected]`

String elements.

Definition at line 1016 of file CoinMpsIO.hpp.

Referenced by stringElement().

The documentation for this class was generated from the following file:

- /home/coin/SVN-release/Osi-0.98.1/CoinUtils/src/CoinMpsIO.hpp