DyLP
1.10.4
|
MPS IO Interface. More...
#include <CoinMpsIO.hpp>
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... | |
CoinBigIndex | 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... | |
int | isIntegerOrSemiContinuous (int columnNumber) const |
Return 1 if a column is an integer variable, 2 if semi-continuous. 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.
| |
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, CoinBigIndex *&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... | |
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 401 of file CoinMpsIO.hpp.
CoinMpsIO::CoinMpsIO | ( | ) |
Default Constructor.
CoinMpsIO::CoinMpsIO | ( | const CoinMpsIO & | ) |
Copy constructor.
CoinMpsIO::~CoinMpsIO | ( | ) |
Destructor.
int CoinMpsIO::getNumCols | ( | ) | const |
Get number of columns.
int CoinMpsIO::getNumRows | ( | ) | const |
Get number of rows.
CoinBigIndex 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.
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
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
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.
int CoinMpsIO::isIntegerOrSemiContinuous | ( | int | columnNumber | ) | const |
Return 1 if a column is an integer variable, 2 if semi-continuous.
Note: This function returns 1 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
|
inline |
Set objective offset.
Definition at line 541 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.
|
inline |
Number of string elements.
Definition at line 561 of file CoinMpsIO.hpp.
|
inline |
String element.
Definition at line 566 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.
|
inline |
Whether to allow string elements.
Definition at line 639 of file CoinMpsIO.hpp.
|
inline |
Whether to allow string elements (0 no, 1 yes, 2 yes and try flip)
Definition at line 644 of file CoinMpsIO.hpp.
|
inline |
Small element value - elements less than this set to zero on input default is 1.0e-14.
Definition at line 650 of file CoinMpsIO.hpp.
|
inline |
Definition at line 654 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.
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.
compression | can be set to three values to indicate what kind of file should be written
|
formatType | specifies the precision to used for values in the MPS file
|
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 |
|
inline |
Return card reader object so can see what last card was e.g. QUADOBJ.
Definition at line 784 of file CoinMpsIO.hpp.
int CoinMpsIO::readQuadraticMps | ( | const char * | filename, |
CoinBigIndex *& | 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:
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)
|
inline |
Set whether to move objective from matrix.
Definition at line 842 of file CoinMpsIO.hpp.
int CoinMpsIO::copyStringElements | ( | const CoinModel * | model | ) |
copies in strings from a CoinModel - returns number
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.
|
inline |
Set the language for messages.
Definition at line 878 of file CoinMpsIO.hpp.
|
inline |
Return the message handler.
Definition at line 881 of file CoinMpsIO.hpp.
|
inline |
Return the messages.
Definition at line 884 of file CoinMpsIO.hpp.
|
inline |
Return the messages pointer.
Definition at line 886 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.
|
protected |
Utility method used several times to implement public methods.
|
protected |
|
protected |
|
protected |
Does the heavy lifting for destruct and assignment.
|
protected |
Does the heavy lifting for copy and assignment.
|
protected |
Clears problem data from the CoinMpsIO object.
|
inlineprotected |
A quick inlined function to convert from lb/ub style constraint definition to sense/rhs/range style.
|
inlineprotected |
A quick inlined function to convert from sense/rhs/range stryle constraint definition to lb/ub style.
|
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.
|
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)
|
protected |
Decode string.
|
protected |
Creates hash list for names (section = 0 for rows, 1 columns)
|
protected |
This one does it when names are already in.
|
protected |
Deletes hash storage.
|
protected |
Finds match using hash, -1 not found.
|
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!)...
|
protected |
Problem name.
Definition at line 1004 of file CoinMpsIO.hpp.
|
protected |
Objective row name.
Definition at line 1007 of file CoinMpsIO.hpp.
|
protected |
Right-hand side vector name.
Definition at line 1010 of file CoinMpsIO.hpp.
|
protected |
Range vector name.
Definition at line 1013 of file CoinMpsIO.hpp.
|
protected |
Bounds vector name.
Definition at line 1016 of file CoinMpsIO.hpp.
|
protected |
Number of rows.
Definition at line 1019 of file CoinMpsIO.hpp.
|
protected |
Number of columns.
Definition at line 1022 of file CoinMpsIO.hpp.
|
protected |
Number of coefficients.
Definition at line 1025 of file CoinMpsIO.hpp.
|
mutableprotected |
Pointer to dense vector of row sense indicators.
Definition at line 1028 of file CoinMpsIO.hpp.
|
mutableprotected |
Pointer to dense vector of row right-hand side values.
Definition at line 1031 of file CoinMpsIO.hpp.
|
mutableprotected |
Pointer to dense vector of slack variable upper bounds for range constraints (undefined for non-range rows)
Definition at line 1036 of file CoinMpsIO.hpp.
|
mutableprotected |
Pointer to row-wise copy of problem matrix coefficients.
Definition at line 1039 of file CoinMpsIO.hpp.
|
protected |
Pointer to column-wise copy of problem matrix coefficients.
Definition at line 1042 of file CoinMpsIO.hpp.
|
protected |
Pointer to dense vector of row lower bounds.
Definition at line 1045 of file CoinMpsIO.hpp.
|
protected |
Pointer to dense vector of row upper bounds.
Definition at line 1048 of file CoinMpsIO.hpp.
|
protected |
Pointer to dense vector of column lower bounds.
Definition at line 1051 of file CoinMpsIO.hpp.
|
protected |
Pointer to dense vector of column upper bounds.
Definition at line 1054 of file CoinMpsIO.hpp.
|
protected |
Pointer to dense vector of objective coefficients.
Definition at line 1057 of file CoinMpsIO.hpp.
|
protected |
Constant offset for objective value (i.e., RHS value for OBJ row)
Definition at line 1060 of file CoinMpsIO.hpp.
|
protected |
Pointer to dense vector specifying if a variable is continuous (0) or integer (1).
Definition at line 1065 of file CoinMpsIO.hpp.
|
protected |
Row and column names Linked to hash table sections (0 - row names, 1 column names)
Definition at line 1070 of file CoinMpsIO.hpp.
|
protected |
Current file name.
Definition at line 1076 of file CoinMpsIO.hpp.
|
protected |
Number of entries in a hash table section.
Definition at line 1079 of file CoinMpsIO.hpp.
|
mutableprotected |
Hash tables (two sections, 0 - row names, 1 - column names)
Definition at line 1082 of file CoinMpsIO.hpp.
|
protected |
Upper bound when no bounds for integers.
Definition at line 1088 of file CoinMpsIO.hpp.
|
protected |
Value to use for infinity.
Definition at line 1091 of file CoinMpsIO.hpp.
|
protected |
Small element value.
Definition at line 1093 of file CoinMpsIO.hpp.
|
protected |
Message handler.
Definition at line 1096 of file CoinMpsIO.hpp.
|
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 1102 of file CoinMpsIO.hpp.
|
protected |
Messages.
Definition at line 1104 of file CoinMpsIO.hpp.
|
protected |
Card reader.
Definition at line 1106 of file CoinMpsIO.hpp.
|
protected |
If .gms file should it be massaged to move objective.
Definition at line 1108 of file CoinMpsIO.hpp.
|
protected |
Whether to allow string elements.
Definition at line 1110 of file CoinMpsIO.hpp.
|
protected |
Maximum number of string elements.
Definition at line 1112 of file CoinMpsIO.hpp.
|
protected |
Number of string elements.
Definition at line 1114 of file CoinMpsIO.hpp.
|
protected |
String elements.
Definition at line 1116 of file CoinMpsIO.hpp.