#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. | |
int | addBlock (const CoinBaseModel &block) |
add a block from a CoinModel with names in model returns number of errors (e.g. | |
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. | |
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 | |
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. | |
int | decompose (const CoinModel &model, int type, int maxBlocks=50) |
Decompose a CoinModel 1 - try D-W 2 - try Benders 3 - try Staircase Returns number of blocks or zero if no structure. | |
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, 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. | |
For getting information | |
int | numberRowBlocks () const |
Return number of row blocks. | |
int | numberColumnBlocks () const |
Return number of column blocks. | |
CoinBigIndex | numberElementBlocks () const |
Return number of elementBlocks. | |
CoinBigIndex | numberElements () const |
Return number of elements. | |
const std::string & | getRowBlock (int i) const |
Return the i'th row block name. | |
void | setRowBlock (int i, const std::string &name) |
Set i'th row block name. | |
int | addRowBlock (int numberRows, const std::string &name) |
Add or check a row block name and number of rows. | |
int | rowBlock (const std::string &name) const |
Return a row block index given a row block name. | |
const std::string & | getColumnBlock (int i) const |
Return i'th the column block name. | |
void | setColumnBlock (int i, const std::string &name) |
Set i'th column block name. | |
int | addColumnBlock (int numberColumns, const std::string &name) |
Add or check a column block name and number of columns. | |
int | columnBlock (const std::string &name) const |
Return a column block index given a column block name. | |
const CoinModelBlockInfo & | blockType (int i) const |
Return i'th block type. | |
CoinBaseModel * | block (int i) const |
Return i'th block. | |
const CoinBaseModel * | block (int row, int column) const |
Return block corresponding to row and column. | |
CoinModel * | coinBlock (int i) const |
Return i'th block as CoinModel (or NULL). | |
const CoinBaseModel * | coinBlock (int row, int column) const |
Return block corresponding to row and column as CoinModel. | |
int | blockIndex (int row, int column) const |
Return block number corresponding to row and column. | |
CoinModel * | coinModelBlock (CoinModelBlockInfo &info) |
Return model as a CoinModel block and fill in info structure and update counts. | |
void | setCoinModel (CoinModel *block, int iBlock) |
Sets given block into coinModelBlocks_. | |
void | refresh (int iBlock) |
Refresh info in blockType_. | |
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. | |
double | optimizationDirection () const |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. | |
void | setOptimizationDirection (double value) |
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore. | |
Constructors, destructor | |
CoinStructuredModel () | |
Default constructor. | |
CoinStructuredModel (const char *fileName, int decompose=0, int maxBlocks=50) | |
Read a problem in MPS format from the given filename. | |
virtual | ~CoinStructuredModel () |
Destructor. | |
Copy method | |
CoinStructuredModel (const CoinStructuredModel &) | |
The copy constructor. | |
CoinStructuredModel & | operator= (const CoinStructuredModel &) |
= | |
virtual CoinBaseModel * | clone () const |
Clone. | |
Private Member Functions | |
int | fillInfo (CoinModelBlockInfo &info, const CoinModel *block) |
Fill in info structure and update counts Returns number of inconsistencies on border. | |
void | fillInfo (CoinModelBlockInfo &info, const CoinStructuredModel *block) |
Fill in info structure and update counts. | |
Private Attributes | |
Data members | |
int | numberRowBlocks_ |
Current number of row blocks. | |
int | numberColumnBlocks_ |
Current number of column blocks. | |
int | numberElementBlocks_ |
Current number of element blocks. | |
int | maximumElementBlocks_ |
Maximum number of element blocks. | |
std::vector< std::string > | rowBlockNames_ |
Rowblock name. | |
std::vector< std::string > | columnBlockNames_ |
Columnblock name. | |
CoinBaseModel ** | blocks_ |
Blocks. | |
CoinModel ** | coinModelBlocks_ |
CoinModel copies of blocks or NULL if original CoinModel. | |
CoinModelBlockInfo * | blockType_ |
Which parts of model are set in block. |
Definition at line 33 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 CoinStructuredModel::~CoinStructuredModel | ( | ) | [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
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
| |
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::decompose | ( | const CoinModel & | model, | |
int | type, | |||
int | maxBlocks = 50 | |||
) |
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 , |
|||
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.
int CoinStructuredModel::numberRowBlocks | ( | ) | const [inline] |
Return number of row blocks.
Definition at line 117 of file CoinStructuredModel.hpp.
int CoinStructuredModel::numberColumnBlocks | ( | ) | const [inline] |
Return number of column blocks.
Definition at line 120 of file CoinStructuredModel.hpp.
CoinBigIndex CoinStructuredModel::numberElementBlocks | ( | ) | const [inline] |
Return number of elementBlocks.
Definition at line 123 of file CoinStructuredModel.hpp.
CoinBigIndex CoinStructuredModel::numberElements | ( | ) | const [virtual] |
Return number of elements.
Implements CoinBaseModel.
const std::string& CoinStructuredModel::getRowBlock | ( | int | i | ) | const [inline] |
Return the i'th row block name.
Definition at line 128 of file CoinStructuredModel.hpp.
void CoinStructuredModel::setRowBlock | ( | int | i, | |
const std::string & | name | |||
) | [inline] |
Set i'th row block name.
Definition at line 131 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.
const std::string& CoinStructuredModel::getColumnBlock | ( | int | i | ) | const [inline] |
Return i'th the column block name.
Definition at line 138 of file CoinStructuredModel.hpp.
void CoinStructuredModel::setColumnBlock | ( | int | i, | |
const std::string & | name | |||
) | [inline] |
Set i'th column block name.
Definition at line 141 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.
const CoinModelBlockInfo& CoinStructuredModel::blockType | ( | int | i | ) | const [inline] |
Return i'th block type.
Definition at line 148 of file CoinStructuredModel.hpp.
CoinBaseModel* CoinStructuredModel::block | ( | int | i | ) | const [inline] |
Return i'th block.
Definition at line 151 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.
void CoinStructuredModel::setCoinModel | ( | CoinModel * | block, | |
int | iBlock | |||
) |
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.
double CoinStructuredModel::optimizationDirection | ( | ) | const [inline] |
Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
Reimplemented from CoinBaseModel.
Definition at line 176 of file CoinStructuredModel.hpp.
void CoinStructuredModel::setOptimizationDirection | ( | double | value | ) | [inline] |
Set direction of optimization (1 - minimize, -1 - maximize, 0 - ignore.
Reimplemented from CoinBaseModel.
Definition at line 180 of file CoinStructuredModel.hpp.
CoinStructuredModel& CoinStructuredModel::operator= | ( | const CoinStructuredModel & | ) |
=
Reimplemented from CoinBaseModel.
virtual CoinBaseModel* CoinStructuredModel::clone | ( | ) | const [virtual] |
Clone.
Implements CoinBaseModel.
int CoinStructuredModel::fillInfo | ( | CoinModelBlockInfo & | info, | |
const CoinModel * | block | |||
) | [private] |
Fill in info structure and update counts Returns number of inconsistencies on border.
void CoinStructuredModel::fillInfo | ( | CoinModelBlockInfo & | info, | |
const CoinStructuredModel * | block | |||
) | [private] |
Fill in info structure and update counts.
int CoinStructuredModel::numberRowBlocks_ [private] |
Current number of row blocks.
Definition at line 219 of file CoinStructuredModel.hpp.
int CoinStructuredModel::numberColumnBlocks_ [private] |
Current number of column blocks.
Definition at line 221 of file CoinStructuredModel.hpp.
int CoinStructuredModel::numberElementBlocks_ [private] |
Current number of element blocks.
Definition at line 223 of file CoinStructuredModel.hpp.
int CoinStructuredModel::maximumElementBlocks_ [private] |
Maximum number of element blocks.
Definition at line 225 of file CoinStructuredModel.hpp.
std::vector<std::string> CoinStructuredModel::rowBlockNames_ [private] |
Rowblock name.
Definition at line 227 of file CoinStructuredModel.hpp.
std::vector<std::string> CoinStructuredModel::columnBlockNames_ [private] |
Columnblock name.
Definition at line 229 of file CoinStructuredModel.hpp.
CoinBaseModel** CoinStructuredModel::blocks_ [private] |
Blocks.
Definition at line 231 of file CoinStructuredModel.hpp.
CoinModel** CoinStructuredModel::coinModelBlocks_ [private] |
CoinModel copies of blocks or NULL if original CoinModel.
Definition at line 233 of file CoinStructuredModel.hpp.
Which parts of model are set in block.
Definition at line 235 of file CoinStructuredModel.hpp.