Cgl 0.59.7

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Friends | List of all members
CoinMpsIO Class Reference

MPS IO Interface. More...

`#include <CoinMpsIO.hpp>`

Collaboration diagram for CoinMpsIO:
[legend]

## Classes
struct | CoinHashLink

## 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. More...
int | getNumRows () const
| Get number of rows. More...
int | getNumElements () const
| Get number of nonzero elements. More...
const double * | getColLower () const
| Get pointer to array[getNumCols()] of column lower bounds. More...
const double * | getColUpper () const
| Get pointer to array[getNumCols()] of column upper bounds. More...
const char * | getRowSense () const
| Get pointer to array[getNumRows()] of constraint senses. More...
const double * | getRightHandSide () const
| Get pointer to array[getNumRows()] of constraint right-hand sides. More...
const double * | getRowRange () const
| Get pointer to array[getNumRows()] of row ranges. More...
const double * | getRowLower () const
| Get pointer to array[getNumRows()] of row lower bounds. More...
const double * | getRowUpper () const
| Get pointer to array[getNumRows()] of row upper bounds. More...
const double * | getObjCoefficients () const
| Get pointer to array[getNumCols()] of objective function coefficients. More...
const CoinPackedMatrix * | getMatrixByRow () const
| Get pointer to row-wise copy of the coefficient matrix. More...
const CoinPackedMatrix * | getMatrixByCol () const
| Get pointer to column-wise copy of the coefficient matrix. More...
bool | isContinuous (int colNumber) const
| Return true if column is a continuous variable. More...
bool | isInteger (int columnNumber) const
| Return true if a column is an integer variable. More...
const char * | integerColumns () const
| Returns array[getNumCols()] specifying if a variable is integer. More...
const char * | rowName (int index) const
| Returns the row name for the specified index. More...
const char * | columnName (int index) const
| Returns the column name for the specified index. More...
int | rowIndex (const char *name) const
| Returns the index for the specified row name. More...
int | columnIndex (const char *name) const
| Returns the index for the specified column name. More...
double | objectiveOffset () const
| Returns the (constant) objective offset. More...
void | setObjectiveOffset (double value)
| Set objective offset. More...
const char * | getProblemName () const
| Return the problem name. More...
const char * | getObjectiveName () const
| Return the objective name. More...
const char * | getRhsName () const
| Return the RHS vector name. More...
const char * | getRangeName () const
| Return the range vector name. More...
const char * | getBoundName () const
| Return the bound vector name. More...
int | numberStringElements () const
| Number of string elements. More...
const char * | stringElement (int i) const
| String element. More...
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. More...
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)
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)
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)
void | copyInIntegerInformation (const char *integerInformation)
| Pass in an array[getNumCols()] specifying if a variable is integer. More...
void | setProblemName (const char *name)
| Set problem name. More...
void | setObjectiveName (const char *name)
| Set objective name. More...
Parameter set/get methods
Methods to set and retrieve MPS IO parameters.
void | setInfinity (double value)
| Set infinity. More...
double | getInfinity () const
| Get infinity. More...
void | setDefaultBound (int value)
| Set default upper bound for integer variables. More...
int | getDefaultBound () const
| Get default upper bound for integer variables. More...
int | allowStringElements () const
| Whether to allow string elements. More...
void | setAllowStringElements (int yesNo)
| Whether to allow string elements (0 no, 1 yes, 2 yes and try flip) More...
double | getSmallElementValue () const
| Small element value - elements less than this set to zero on input default is 1.0e-14. More...
void | setSmallElementValue (double value)
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. More...
const char * | getFileName () const
| Get the current file name for the CoinMpsIO object. More...
int | readMps (const char *filename, const char *extension="mps")
| Read a problem in MPS format from the given filename. More...
int | readMps (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
| Read a problem in MPS format from the given filename. More...
int | readMps ()
| Read a problem in MPS format from a previously opened file. More...
int | readMps (int &numberSets, CoinSet **&sets)
| and More...
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. More...
int | readGms (const char *filename, const char *extension="gms", bool convertObjective=false)
| Read a problem in GAMS format from the given filename. More...
int | readGms (const char *filename, const char *extension, int &numberSets, CoinSet **&sets)
| Read a problem in GAMS format from the given filename. More...
int | readGms (int &numberSets, CoinSet **&sets)
| Read a problem in GAMS format from a previously opened file. More...
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. More...
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. More...
const CoinMpsCardReader * | reader () const
| Return card reader object so can see what last card was e.g. QUADOBJ. More...
int | readQuadraticMps (const char *filename, int *&columnStart, int *&column, double *&elements, int checkSymmetry)
| Read in a quadratic objective from the given filename. More...
int | readConicMps (const char *filename, int *&columnStart, int *&column, int *&coneType, int &numberCones)
| Read in a list of cones from the given filename. More...
void | setConvertObjective (bool trueFalse)
| Set whether to move objective from matrix. More...
int | copyStringElements (const CoinModel *model)
| copies in strings from a CoinModel - returns number More...
Constructors and destructors
| CoinMpsIO ()
| Default Constructor. More...
| CoinMpsIO (const CoinMpsIO &)
| Copy constructor. More...
CoinMpsIO & | operator= (const CoinMpsIO &rhs)
| Assignment operator. More...
| ~CoinMpsIO ()
| Destructor. More...
Message handling
void | passInMessageHandler (CoinMessageHandler *handler)
| Pass in Message handler. More...
void | newLanguage (CoinMessages::Language language)
| Set the language for messages. More...
void | setLanguage (CoinMessages::Language language)
| Set the language for messages. More...
CoinMessageHandler * | messageHandler () const
| Return the message handler. More...
CoinMessages | messages ()
| Return the messages. More...
CoinMessages * | messagesPointer ()
| Return the messages pointer. More...
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. More...
void | releaseRowInformation ()
| Release all row information (lower, upper) More...
void | releaseColumnInformation ()
| Release all column information (lower, upper, objective) More...
void | releaseIntegerInformation ()
| Release integer information. More...
void | releaseRowNames ()
| Release row names. More...
void | releaseColumnNames ()
| Release column names. More...
void | releaseMatrixInformation ()
| Release matrix information. More...

## 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. More...
void | setMpsDataColAndRowNames (const std::vector< std::string > &colnames, const std::vector< std::string > &rownames)
void | setMpsDataColAndRowNames (char const *const *const colnames, char const *const *const rownames)
void | gutsOfDestructor ()
| Does the heavy lifting for destruct and assignment. More...
void | gutsOfCopy (const CoinMpsIO &)
| Does the heavy lifting for copy and assignment. More...
void | freeAll ()
| Clears problem data from the CoinMpsIO object. More...
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. More...
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. More...
int | dealWithFileName (const char *filename, const char *extension, CoinFileInput *&input)
| Deal with a filename. More...
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) More...
void | decodeString (int iString, int &iRow, int &iColumn, const char *&value) const
| Decode string. More...
Hash table methods
void | startHash (char **names, const int number, int section)
| Creates hash list for names (section = 0 for rows, 1 columns) More...
void | startHash (int section) const
| This one does it when names are already in. More...
void | stopHash (int section)
| Deletes hash storage. More...
int | findHash (const char *name, int section) const
| Finds match using hash, -1 not found. More...

## Protected Attributes
Cached problem information
char * | problemName_
| Problem name. More...
char * | objectiveName_
| Objective row name. More...
char * | rhsName_
| Right-hand side vector name. More...
char * | rangeName_
| Range vector name. More...
char * | boundName_
| Bounds vector name. More...
int | numberRows_
| Number of rows. More...
int | numberColumns_
| Number of columns. More...
CoinBigIndex | numberElements_
| Number of coefficients. More...
char * | rowsense_
| Pointer to dense vector of row sense indicators. More...
double * | rhs_
| Pointer to dense vector of row right-hand side values. More...
double * | rowrange_
| Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range rows) More...
CoinPackedMatrix * | matrixByRow_
| Pointer to row-wise copy of problem matrix coefficients. More...
CoinPackedMatrix * | matrixByColumn_
| Pointer to column-wise copy of problem matrix coefficients. More...
double * | rowlower_
| Pointer to dense vector of row lower bounds. More...
double * | rowupper_
| Pointer to dense vector of row upper bounds. More...
double * | collower_
| Pointer to dense vector of column lower bounds. More...
double * | colupper_
| Pointer to dense vector of column upper bounds. More...
double * | objective_
| Pointer to dense vector of objective coefficients. More...
double | objectiveOffset_
| Constant offset for objective value (i.e., RHS value for OBJ row) More...
char * | integerType_
| Pointer to dense vector specifying if a variable is continuous (0) or integer (1). More...
char ** | names_ [2]
| Row and column names Linked to hash table sections (0 - row names, 1 column names) More...
Hash tables
char * | fileName_
| Current file name. More...
int | numberHash_ [2]
| Number of entries in a hash table section. More...
CoinHashLink * | hash_ [2]
| Hash tables (two sections, 0 - row names, 1 - column names) More...
CoinMpsIO object parameters
int | defaultBound_
| Upper bound when no bounds for integers. More...
double | infinity_
| Value to use for infinity. More...
double | smallElement_
| Small element value. More...
CoinMessageHandler * | handler_
| Message handler. More...
bool | defaultHandler_
| Flag to say if the message handler is the default handler. More...
CoinMessages | messages_
| Messages. More...
CoinMpsCardReader * | cardReader_
| Card reader. More...
bool | convertObjective_
| If .gms file should it be massaged to move objective. More...
int | allowStringElements_
| Whether to allow string elements. More...
int | maximumStringElements_
| Maximum number of string elements. More...
int | numberStringElements_
| Number of string elements. More...
char ** | stringElements_
| String elements. More...

## Friends
void | CoinMpsIOUnitTest (const std::string &mpsDir)
| A function that tests the methods in the CoinMpsIO class. More...

## 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.

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.

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

String element.

Definition at line 484 of file CoinMpsIO.hpp.

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
| ) |  |

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
| ) |  |

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
| ) |  |

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::setObjectiveName | ( | const char * | name | ) |

Set objective 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 556 of file CoinMpsIO.hpp.

void CoinMpsIO::setAllowStringElements | ( | int | yesNo | ) |
| inline

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

Definition at line 559 of file CoinMpsIO.hpp.

double CoinMpsIO::getSmallElementValue | ( |  | ) | const
| inline

Small element value - elements less than this set to zero on input default is 1.0e-14.

Definition at line 563 of file CoinMpsIO.hpp.

void CoinMpsIO::setSmallElementValue | ( | double | value | ) |
| inline

Definition at line 565 of file CoinMpsIO.hpp.

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
| ) |  |

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

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

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 694 of file CoinMpsIO.hpp.

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 *& | coneType,
|  | 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

    coneType is 1 for QUAD, 2 for RQUAD (numberCones long)

void CoinMpsIO::setConvertObjective | ( | bool | trueFalse | ) |
| inline

Set whether to move objective from matrix.

Definition at line 750 of file CoinMpsIO.hpp.

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.

void CoinMpsIO::setLanguage | ( | CoinMessages::Language | language | ) |
| inline

Set the language for messages.

Definition at line 785 of file CoinMpsIO.hpp.

CoinMessageHandler* CoinMpsIO::messageHandler | ( |  | ) | const
| inline

Return the message handler.

Definition at line 788 of file CoinMpsIO.hpp.

CoinMessages CoinMpsIO::messages | ( |  | ) |
| inline

Return the messages.

Definition at line 791 of file CoinMpsIO.hpp.

CoinMessages* CoinMpsIO::messagesPointer | ( |  | ) |
| inline

Return the messages pointer.

Definition at line 793 of file CoinMpsIO.hpp.

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

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

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 916 of file CoinMpsIO.hpp.

char* CoinMpsIO::objectiveName_
| protected

Objective row name.

Definition at line 919 of file CoinMpsIO.hpp.

char* CoinMpsIO::rhsName_
| protected

Right-hand side vector name.

Definition at line 922 of file CoinMpsIO.hpp.

char* CoinMpsIO::rangeName_
| protected

Range vector name.

Definition at line 925 of file CoinMpsIO.hpp.

char* CoinMpsIO::boundName_
| protected

Bounds vector name.

Definition at line 928 of file CoinMpsIO.hpp.

int CoinMpsIO::numberRows_
| protected

Number of rows.

Definition at line 931 of file CoinMpsIO.hpp.

int CoinMpsIO::numberColumns_
| protected

Number of columns.

Definition at line 934 of file CoinMpsIO.hpp.

CoinBigIndex CoinMpsIO::numberElements_
| protected

Number of coefficients.

Definition at line 937 of file CoinMpsIO.hpp.

char* CoinMpsIO::rowsense_
| mutable protected

Pointer to dense vector of row sense indicators.

Definition at line 940 of file CoinMpsIO.hpp.

double* CoinMpsIO::rhs_
| mutable protected

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

Definition at line 943 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 948 of file CoinMpsIO.hpp.

CoinPackedMatrix* CoinMpsIO::matrixByRow_
| mutable protected

Pointer to row-wise copy of problem matrix coefficients.

Definition at line 951 of file CoinMpsIO.hpp.

CoinPackedMatrix* CoinMpsIO::matrixByColumn_
| protected

Pointer to column-wise copy of problem matrix coefficients.

Definition at line 954 of file CoinMpsIO.hpp.

double* CoinMpsIO::rowlower_
| protected

Pointer to dense vector of row lower bounds.

Definition at line 957 of file CoinMpsIO.hpp.

double* CoinMpsIO::rowupper_
| protected

Pointer to dense vector of row upper bounds.

Definition at line 960 of file CoinMpsIO.hpp.

double* CoinMpsIO::collower_
| protected

Pointer to dense vector of column lower bounds.

Definition at line 963 of file CoinMpsIO.hpp.

double* CoinMpsIO::colupper_
| protected

Pointer to dense vector of column upper bounds.

Definition at line 966 of file CoinMpsIO.hpp.

double* CoinMpsIO::objective_
| protected

Pointer to dense vector of objective coefficients.

Definition at line 969 of file CoinMpsIO.hpp.

double CoinMpsIO::objectiveOffset_
| protected

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

Definition at line 972 of file CoinMpsIO.hpp.

char* CoinMpsIO::integerType_
| protected

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

Definition at line 978 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 983 of file CoinMpsIO.hpp.

char* CoinMpsIO::fileName_
| protected

Current file name.

Definition at line 989 of file CoinMpsIO.hpp.

int CoinMpsIO::numberHash_[2]
| protected

Number of entries in a hash table section.

Definition at line 992 of file CoinMpsIO.hpp.

CoinHashLink* CoinMpsIO::hash_[2]
| mutable protected

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

Definition at line 995 of file CoinMpsIO.hpp.

int CoinMpsIO::defaultBound_
| protected

Upper bound when no bounds for integers.

Definition at line 1001 of file CoinMpsIO.hpp.

double CoinMpsIO::infinity_
| protected

Value to use for infinity.

Definition at line 1004 of file CoinMpsIO.hpp.

double CoinMpsIO::smallElement_
| protected

Small element value.

Definition at line 1006 of file CoinMpsIO.hpp.

CoinMessageHandler* CoinMpsIO::handler_
| protected

Message handler.

Definition at line 1009 of file CoinMpsIO.hpp.

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 1015 of file CoinMpsIO.hpp.

CoinMessages CoinMpsIO::messages_
| protected

Messages.

Definition at line 1017 of file CoinMpsIO.hpp.

CoinMpsCardReader* CoinMpsIO::cardReader_
| protected

Card reader.

Definition at line 1019 of file CoinMpsIO.hpp.

bool CoinMpsIO::convertObjective_
| protected

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

Definition at line 1021 of file CoinMpsIO.hpp.

int CoinMpsIO::allowStringElements_
| protected

Whether to allow string elements.

Definition at line 1023 of file CoinMpsIO.hpp.

int CoinMpsIO::maximumStringElements_
| protected

Maximum number of string elements.

Definition at line 1025 of file CoinMpsIO.hpp.

int CoinMpsIO::numberStringElements_
| protected

Number of string elements.

Definition at line 1027 of file CoinMpsIO.hpp.

char** CoinMpsIO::stringElements_
| protected

String elements.

Definition at line 1029 of file CoinMpsIO.hpp.

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

- /home/coin/svn-release/Cgl-0.59.7/CoinUtils/src/CoinMpsIO.hpp