#include <CoinStructuredModel.hpp>
Public Member Functions | |
Useful methods for building model | |
int | addBlock (const std::string &rowBlock, const std::string &columnBlock, const CoinBaseModel &block) |
add a block from a CoinModel using names given as parameters returns number of errors (e.g. More... | |
int | addBlock (const CoinBaseModel &block) |
add a block from a CoinModel with names in model returns number of errors (e.g. More... | |
int | addBlock (const std::string &rowBlock, const std::string &columnBlock, CoinBaseModel *block) |
add a block from a CoinModel using names given as parameters returns number of errors (e.g. More... | |
int | addBlock (const std::string &rowBlock, const std::string &columnBlock, const CoinPackedMatrix &matrix, const double *rowLower, const double *rowUpper, const double *columnLower, const double *columnUpper, const double *objective) |
add a block using names More... | |
int | writeMps (const char *filename, int compression=0, int formatType=0, int numberAcross=2, bool keepStrings=false) |
Write the problem in MPS format to a file with the given filename. More... | |
int | readSmps (const char *filename, bool keepNames=false, bool ignoreErrors=false) |
Read SMPS model. More... | |
int | decompose (const CoinModel &model, int type, int maxBlocks=50, const char **starts=NULL) |
Decompose a CoinModel 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure. More... | |
int | decompose (const CoinPackedMatrix &matrix, const double *rowLower, const double *rowUpper, const double *columnLower, const double *columnUpper, const double *objective, int type, int maxBlocks=50, int *starts=NULL, double objectiveOffset=0.0) |
Decompose a model specified as arrays + CoinPackedMatrix 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure. More... | |
For getting information | |
int | numberRowBlocks () const |
Return number of row blocks. More... | |
int | numberColumnBlocks () const |
Return number of column blocks. More... | |
CoinBigIndex | numberElementBlocks () const |
Return number of elementBlocks. More... | |
CoinBigIndex | numberElements () const |
Return number of elements. More... | |
const std::string & | getRowBlock (int i) const |
Return the i'th row block name. More... | |
void | setRowBlock (int i, const std::string &name) |
Set i'th row block name. More... | |
int | addRowBlock (int numberRows, const std::string &name) |
Add or check a row block name and number of rows. More... | |
int | rowBlock (const std::string &name) const |
Return a row block index given a row block name. More... | |
const std::string & | getColumnBlock (int i) const |
Return i'th the column block name. More... | |
void | setColumnBlock (int i, const std::string &name) |
Set i'th column block name. More... | |
int | addColumnBlock (int numberColumns, const std::string &name) |
Add or check a column block name and number of columns. More... | |
int | columnBlock (const std::string &name) const |
Return a column block index given a column block name. More... | |
const CoinModelBlockInfo & | blockType (int i) const |
Return i'th block type. More... | |
CoinBaseModel * | block (int i) const |
Return i'th block. More... | |
const CoinBaseModel * | block (int row, int column) const |
Return block corresponding to row and column. More... | |
CoinModel * | coinBlock (int i) const |
Return i'th block as CoinModel (or NULL) More... | |
const CoinBaseModel * | coinBlock (int row, int column) const |
Return block corresponding to row and column as CoinModel. More... | |
int | blockIndex (int row, int column) const |
Return block number corresponding to row and column. More... | |
CoinModel * | coinModelBlock (CoinModelBlockInfo &info) |
Return model as a CoinModel block and fill in info structure and update counts. More... | |
void | setCoinModel (CoinModel *block, int iBlock) |
Sets given block into coinModelBlocks_. More... | |
void | refresh (int iBlock) |
Refresh info in blockType_. More... | |
CoinModelBlockInfo | block (int row, int column, const double *&rowLower, const double *&rowUpper, const double *&columnLower, const double *&columnUpper, const double *&objective) const |
Fill pointers corresponding to row and column. More... | |
double | optimizationDirection () const |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. More... | |
void | setOptimizationDirection (double value) |
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. More... | |
Constructors, destructor | |
CoinStructuredModel () | |
Default constructor. More... | |
CoinStructuredModel (const char *fileName, int decompose=0, int maxBlocks=50) | |
Read a problem in MPS format from the given filename. More... | |
virtual | ~CoinStructuredModel () |
Destructor. More... | |
Copy method | |
CoinStructuredModel (const CoinStructuredModel &) | |
The copy constructor. More... | |
CoinStructuredModel & | operator= (const CoinStructuredModel &) |
= More... | |
virtual CoinBaseModel * | clone () const |
Clone. More... | |
![]() | |
CoinBaseModel () | |
Default Constructor. More... | |
CoinBaseModel (const CoinBaseModel &rhs) | |
Copy constructor. More... | |
CoinBaseModel & | operator= (const CoinBaseModel &rhs) |
Assignment operator. More... | |
virtual | ~CoinBaseModel () |
Destructor. More... | |
int | numberRows () const |
Return number of rows. More... | |
int | numberColumns () const |
Return number of columns. More... | |
double | objectiveOffset () const |
Returns the (constant) objective offset This is the RHS entry for the objective row. More... | |
void | setObjectiveOffset (double value) |
Set objective offset. More... | |
double | optimizationDirection () const |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. More... | |
void | setOptimizationDirection (double value) |
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. More... | |
int | logLevel () const |
Get print level 0 - off, 1 - errors, 2 - more. More... | |
void | setLogLevel (int value) |
Set print level 0 - off, 1 - errors, 2 - more. More... | |
const char * | getProblemName () const |
Return the problem name. More... | |
void | setProblemName (const char *name) |
Set problem name. More... | |
void | setProblemName (const std::string &name) |
Set problem name. More... | |
const std::string & | getRowBlock () const |
Return the row block name. More... | |
void | setRowBlock (const std::string &name) |
Set row block name. More... | |
const std::string & | getColumnBlock () const |
Return the column block name. More... | |
void | setColumnBlock (const std::string &name) |
Set column block name. More... | |
void | setMessageHandler (CoinMessageHandler *handler) |
Pass in message handler. More... | |
Private Member Functions | |
int | fillInfo (CoinModelBlockInfo &info, const CoinModel *block) |
Fill in info structure and update counts Returns number of inconsistencies on border. More... | |
void | fillInfo (CoinModelBlockInfo &info, const CoinStructuredModel *block) |
Fill in info structure and update counts. More... | |
Private Attributes | |
Data members | |
int | numberRowBlocks_ |
Current number of row blocks. More... | |
int | numberColumnBlocks_ |
Current number of column blocks. More... | |
int | numberElementBlocks_ |
Current number of element blocks. More... | |
int | maximumElementBlocks_ |
Maximum number of element blocks. More... | |
std::vector< std::string > | rowBlockNames_ |
Rowblock name. More... | |
std::vector< std::string > | columnBlockNames_ |
Columnblock name. More... | |
CoinBaseModel ** | blocks_ |
Blocks. More... | |
CoinModel ** | coinModelBlocks_ |
CoinModel copies of blocks or NULL if original CoinModel. More... | |
CoinModelBlockInfo * | blockType_ |
Which parts of model are set in block. More... | |
Additional Inherited Members | |
![]() | |
int | numberRows_ |
Current number of rows. More... | |
int | numberColumns_ |
Current number of columns. More... | |
double | optimizationDirection_ |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. More... | |
double | objectiveOffset_ |
Objective offset to be passed on. More... | |
std::string | problemName_ |
Problem name. More... | |
std::string | rowBlockName_ |
Rowblock name. More... | |
std::string | columnBlockName_ |
Columnblock name. More... | |
CoinMessageHandler * | handler_ |
Message handler (Passed in) More... | |
CoinMessages | messages_ |
Messages. More... | |
int | logLevel_ |
Print level. More... | |
Definition at line 36 of file CoinStructuredModel.hpp.
CoinStructuredModel::CoinStructuredModel | ( | ) |
Default constructor.
CoinStructuredModel::CoinStructuredModel | ( | const char * | fileName, |
int | decompose = 0 , |
||
int | maxBlocks = 50 |
||
) |
Read a problem in MPS format from the given filename.
May try and decompose
|
virtual |
Destructor.
CoinStructuredModel::CoinStructuredModel | ( | const CoinStructuredModel & | ) |
The copy constructor.
int CoinStructuredModel::addBlock | ( | const std::string & | rowBlock, |
const std::string & | columnBlock, | ||
const CoinBaseModel & | block | ||
) |
add a block from a CoinModel using names given as parameters returns number of errors (e.g.
both have objectives but not same)
int CoinStructuredModel::addBlock | ( | const CoinBaseModel & | block | ) |
add a block from a CoinModel with names in model returns number of errors (e.g.
both have objectives but not same)
int CoinStructuredModel::addBlock | ( | const std::string & | rowBlock, |
const std::string & | columnBlock, | ||
CoinBaseModel * | block | ||
) |
add a block from a CoinModel using names given as parameters returns number of errors (e.g.
both have objectives but not same) This passes in block - structured model takes ownership
int CoinStructuredModel::addBlock | ( | const std::string & | rowBlock, |
const std::string & | columnBlock, | ||
const CoinPackedMatrix & | matrix, | ||
const double * | rowLower, | ||
const double * | rowUpper, | ||
const double * | columnLower, | ||
const double * | columnUpper, | ||
const double * | objective | ||
) |
add a block using names
int CoinStructuredModel::writeMps | ( | const char * | filename, |
int | compression = 0 , |
||
int | formatType = 0 , |
||
int | numberAcross = 2 , |
||
bool | keepStrings = false |
||
) |
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. |
not const as may change model e.g. fill in default bounds
int CoinStructuredModel::readSmps | ( | const char * | filename, |
bool | keepNames = false , |
||
bool | ignoreErrors = false |
||
) |
Read SMPS model.
int CoinStructuredModel::decompose | ( | const CoinModel & | model, |
int | type, | ||
int | maxBlocks = 50 , |
||
const char ** | starts = NULL |
||
) |
Decompose a CoinModel 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure.
int CoinStructuredModel::decompose | ( | const CoinPackedMatrix & | matrix, |
const double * | rowLower, | ||
const double * | rowUpper, | ||
const double * | columnLower, | ||
const double * | columnUpper, | ||
const double * | objective, | ||
int | type, | ||
int | maxBlocks = 50 , |
||
int * | starts = NULL , |
||
double | objectiveOffset = 0.0 |
||
) |
Decompose a model specified as arrays + CoinPackedMatrix 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure.
|
inline |
Return number of row blocks.
Definition at line 126 of file CoinStructuredModel.hpp.
|
inline |
Return number of column blocks.
Definition at line 129 of file CoinStructuredModel.hpp.
|
inline |
Return number of elementBlocks.
Definition at line 132 of file CoinStructuredModel.hpp.
|
virtual |
Return number of elements.
Implements CoinBaseModel.
|
inline |
Return the i'th row block name.
Definition at line 137 of file CoinStructuredModel.hpp.
|
inline |
Set i'th row block name.
Definition at line 140 of file CoinStructuredModel.hpp.
int CoinStructuredModel::addRowBlock | ( | int | numberRows, |
const std::string & | name | ||
) |
Add or check a row block name and number of rows.
int CoinStructuredModel::rowBlock | ( | const std::string & | name | ) | const |
Return a row block index given a row block name.
|
inline |
Return i'th the column block name.
Definition at line 147 of file CoinStructuredModel.hpp.
|
inline |
Set i'th column block name.
Definition at line 150 of file CoinStructuredModel.hpp.
int CoinStructuredModel::addColumnBlock | ( | int | numberColumns, |
const std::string & | name | ||
) |
Add or check a column block name and number of columns.
int CoinStructuredModel::columnBlock | ( | const std::string & | name | ) | const |
Return a column block index given a column block name.
|
inline |
Return i'th block type.
Definition at line 157 of file CoinStructuredModel.hpp.
|
inline |
Return i'th block.
Definition at line 160 of file CoinStructuredModel.hpp.
const CoinBaseModel* CoinStructuredModel::block | ( | int | row, |
int | column | ||
) | const |
Return block corresponding to row and column.
const CoinBaseModel* CoinStructuredModel::coinBlock | ( | int | row, |
int | column | ||
) | const |
Return block corresponding to row and column as CoinModel.
int CoinStructuredModel::blockIndex | ( | int | row, |
int | column | ||
) | const |
Return block number corresponding to row and column.
CoinModel* CoinStructuredModel::coinModelBlock | ( | CoinModelBlockInfo & | info | ) |
Return model as a CoinModel block and fill in info structure and update counts.
Sets given block into coinModelBlocks_.
void CoinStructuredModel::refresh | ( | int | iBlock | ) |
Refresh info in blockType_.
CoinModelBlockInfo CoinStructuredModel::block | ( | int | row, |
int | column, | ||
const double *& | rowLower, | ||
const double *& | rowUpper, | ||
const double *& | columnLower, | ||
const double *& | columnUpper, | ||
const double *& | objective | ||
) | const |
Fill pointers corresponding to row and column.
|
inline |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
Definition at line 185 of file CoinStructuredModel.hpp.
|
inline |
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
Definition at line 189 of file CoinStructuredModel.hpp.
CoinStructuredModel& CoinStructuredModel::operator= | ( | const CoinStructuredModel & | ) |
=
|
virtual |
Clone.
Implements CoinBaseModel.
|
private |
Fill in info structure and update counts Returns number of inconsistencies on border.
|
private |
Fill in info structure and update counts.
|
private |
Current number of row blocks.
Definition at line 228 of file CoinStructuredModel.hpp.
|
private |
Current number of column blocks.
Definition at line 230 of file CoinStructuredModel.hpp.
|
private |
Current number of element blocks.
Definition at line 232 of file CoinStructuredModel.hpp.
|
private |
Maximum number of element blocks.
Definition at line 234 of file CoinStructuredModel.hpp.
|
private |
Rowblock name.
Definition at line 236 of file CoinStructuredModel.hpp.
|
private |
Columnblock name.
Definition at line 238 of file CoinStructuredModel.hpp.
|
private |
Blocks.
Definition at line 240 of file CoinStructuredModel.hpp.
|
private |
CoinModel copies of blocks or NULL if original CoinModel.
Definition at line 242 of file CoinStructuredModel.hpp.
|
private |
Which parts of model are set in block.
Definition at line 244 of file CoinStructuredModel.hpp.