CoinMpsIO

MPS IO Interface.

MPS IO Interface.

Description

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.

Public Methods

getNumCols

Get number of columns.

int getNumCols()

getNumRows

Get number of rows.

int getNumRows()

getNumElements

Get number of nonzero elements.

CoinBigIndex getNumElements()

getColLower

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

const double * getColLower()

getColUpper

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

const double * getColUpper()

getRowSense

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

const char * getRowSense()

getRightHandSide

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

const double * getRightHandSide()

getRowRange

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

const double * getRowRange()

getRowLower

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

const double * getRowLower()

getRowUpper

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

const double * getRowUpper()

getObjCoefficients

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

const double * getObjCoefficients()

getMatrixByRow

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

const CoinPackedMatrix * getMatrixByRow()

getMatrixByCol

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

const CoinPackedMatrix * getMatrixByCol()

isContinuous

Return true if column is a continuous variable.

bool isContinuous(int colNumber)

Parameters:

isInteger

Return true if a column is an integer variable.

bool isInteger(int columnNumber)

Parameters:

isIntegerOrSemiContinuous

Return 1 if a column is an integer variable, 2 if semi-continuous.

int isIntegerOrSemiContinuous(int columnNumber)

Parameters:

integerColumns

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

const char * integerColumns()

rowName

Returns the row name for the specified index.

const char * rowName(int index)

Parameters:

columnName

Returns the column name for the specified index.

const char * columnName(int index)

Parameters:

rowIndex

Returns the index for the specified row name.

int rowIndex(const char * name)

Parameters:

columnIndex

Returns the index for the specified column name.

int columnIndex(const char * name)

Parameters:

objectiveOffset

Returns the (constant) objective offset.

double objectiveOffset()

setObjectiveOffset

Set objective offset.

void setObjectiveOffset(double value)

Parameters:

getProblemName

Return the problem name.

const char * getProblemName()

getObjectiveName

Return the objective name.

const char * getObjectiveName()

getRhsName

Return the RHS vector name.

const char * getRhsName()

getRangeName

Return the range vector name.

const char * getRangeName()

getBoundName

Return the bound vector name.

const char * getBoundName()

numberStringElements

Number of string elements.

int numberStringElements()

stringElement

String element.

const char * stringElement(int i)

Parameters:

setMpsData

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, char const *const *const colnames, char const *const *const rownames)

Parameters:

setMpsData

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)

Parameters:

setMpsData

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)

Parameters:

setMpsData

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)

Parameters:

copyInIntegerInformation

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

void copyInIntegerInformation(const char * integerInformation)

Parameters:

setProblemName

Set problem name.

void setProblemName(const char * name)

Parameters:

setObjectiveName

Set objective name.

void setObjectiveName(const char * name)

Parameters:

setInfinity

Set infinity.

void setInfinity(double value)

Parameters:

getInfinity

Get infinity.

double getInfinity()

setDefaultBound

Set default upper bound for integer variables.

void setDefaultBound(int value)

Parameters:

getDefaultBound

Get default upper bound for integer variables.

int getDefaultBound()

allowStringElements

Whether to allow string elements.

int allowStringElements()

setAllowStringElements

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

void setAllowStringElements(int yesNo)

Parameters:

getSmallElementValue

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

double getSmallElementValue()

setSmallElementValue

void setSmallElementValue(double value)

Parameters:

wasMaximization

Return true if maximization problem reformulated as minimization.

bool wasMaximization()

isMaximization

Return true if maximization problem and still formulated as maximization.

bool isMaximization()

setFileName

Set the current file name for the CoinMpsIO object.

void setFileName(const char * name)

Parameters:

getFileName

Get the current file name for the CoinMpsIO object.

const char * getFileName()

readMps

Read a problem in MPS format from the given filename.

int readMps(const char * filename, const char * extension = "mps")

Parameters:

readMps

Read a problem in MPS format from the given filename.

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

Parameters:

readMps

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

int readMps()

readMps

and

int readMps(int & numberSets, CoinSet **& sets)

Parameters:

readBasis

Read a basis in MPS format from the given filename.

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)

Parameters:

readGms

Read a problem in GAMS format from the given filename.

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

Parameters:

readGms

Read a problem in GAMS format from the given filename.

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

Parameters:

readGms

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

int readGms(int & numberSets, CoinSet **& sets)

Parameters:

writeMps

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

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

Parameters:

reader

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

const CoinMpsCardReader * reader()

readQuadraticMps

Read in a quadratic objective from the given filename.

int readQuadraticMps(const char * filename, CoinBigIndex *& columnStart, int *& column, double *& elements, int checkSymmetry)

Parameters:

readConicMps

Read in a list of cones from the given filename.

int readConicMps(const char * filename, int *& columnStart, int *& column, int *& coneType, int & numberCones)

Parameters:

setConvertObjective

Set whether to move objective from matrix.

void setConvertObjective(bool trueFalse)

Parameters:

copyStringElements

copies in strings from a CoinModel - returns number

int copyStringElements(const CoinModel * model)

Parameters:

CoinMpsIO

Default Constructor.

 CoinMpsIO()

CoinMpsIO

Copy constructor.

 CoinMpsIO(const CoinMpsIO & )

Parameters:

operator=

Assignment operator.

CoinMpsIO & operator=(const CoinMpsIO & rhs)

Parameters:

~CoinMpsIO

Destructor.

 ~CoinMpsIO()

passInMessageHandler

Pass in Message handler.

void passInMessageHandler(CoinMessageHandler * handler)

Parameters:

newLanguage

Set the language for messages.

void newLanguage(CoinMessages::Language language)

Parameters:

setLanguage

Set the language for messages.

void setLanguage(CoinMessages::Language language)

Parameters:

messageHandler

Return the message handler.

CoinMessageHandler * messageHandler()

messages

Return the messages.

CoinMessages messages()

messagesPointer

Return the messages pointer.

CoinMessages * messagesPointer()

releaseRedundantInformation

Release all information which can be re-calculated.

void releaseRedundantInformation()

releaseRowInformation

Release all row information (lower, upper)

void releaseRowInformation()

releaseColumnInformation

Release all column information (lower, upper, objective)

void releaseColumnInformation()

releaseIntegerInformation

Release integer information.

void releaseIntegerInformation()

releaseRowNames

Release row names.

void releaseRowNames()

releaseColumnNames

Release column names.

void releaseColumnNames()

releaseMatrixInformation

Release matrix information.

void releaseMatrixInformation()

Source

Header: layer-0/CoinUtils/src/CoinMpsIO.hpp