|
Osi
0.108.1
|
In many cases it is natural to build a model by adding one row at a time. More...
#include <CoinBuild.hpp>
Public Member Functions | |
Useful methods | |
| void | addRow (int numberInRow, const int *columns, const double *elements, double rowLower=-COIN_DBL_MAX, double rowUpper=COIN_DBL_MAX) |
| add a row More... | |
| void | addColumn (int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0) |
| add a column More... | |
| void | addCol (int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0) |
| add a column More... | |
| int | numberRows () const |
| Return number of rows or maximum found so far. More... | |
| int | numberColumns () const |
| Return number of columns or maximum found so far. More... | |
| CoinBigIndex | numberElements () const |
| Return number of elements. More... | |
| int | row (int whichRow, double &rowLower, double &rowUpper, const int *&indices, const double *&elements) const |
| Returns number of elements in a row and information in row. More... | |
| int | currentRow (double &rowLower, double &rowUpper, const int *&indices, const double *&elements) const |
| Returns number of elements in current row and information in row Used as rows may be stored in a chain. More... | |
| void | setCurrentRow (int whichRow) |
| Set current row. More... | |
| int | currentRow () const |
| Returns current row number. More... | |
| int | column (int whichColumn, double &columnLower, double &columnUpper, double &objectiveValue, const int *&indices, const double *&elements) const |
| Returns number of elements in a column and information in column. More... | |
| int | currentColumn (double &columnLower, double &columnUpper, double &objectiveValue, const int *&indices, const double *&elements) const |
| Returns number of elements in current column and information in column Used as columns may be stored in a chain. More... | |
| void | setCurrentColumn (int whichColumn) |
| Set current column. More... | |
| int | currentColumn () const |
| Returns current column number. More... | |
| int | type () const |
| Returns type. More... | |
Constructors, destructor | |
| CoinBuild () | |
| Default constructor. More... | |
| CoinBuild (int type) | |
| Constructor with type 0==for addRow, 1== for addColumn. More... | |
| ~CoinBuild () | |
| Destructor. More... | |
Copy method | |
| CoinBuild (const CoinBuild &) | |
| The copy constructor. More... | |
| CoinBuild & | operator= (const CoinBuild &) |
| = More... | |
Private Member Functions | |
| void | setMutableCurrent (int which) const |
| Set current. More... | |
| void | addItem (int numberInItem, const int *indices, const double *elements, double itemLower, double itemUpper, double objectiveValue) |
| add a item More... | |
| int | item (int whichItem, double &itemLower, double &itemUpper, double &objectiveValue, const int *&indices, const double *&elements) const |
| Returns number of elements in a item and information in item. More... | |
| int | currentItem (double &itemLower, double &itemUpper, double &objectiveValue, const int *&indices, const double *&elements) const |
| Returns number of elements in current item and information in item Used as items may be stored in a chain. More... | |
| void | setCurrentItem (int whichItem) |
| Set current item. More... | |
| int | currentItem () const |
| Returns current item number. More... | |
Private Attributes | |
Data members | |
| int | numberItems_ |
| Current number of items. More... | |
| int | numberOther_ |
| Current number of other dimension i.e. Columns if addRow (i.e. max) More... | |
| CoinBigIndex | numberElements_ |
| Current number of elements. More... | |
| double * | currentItem_ |
| Current item pointer. More... | |
| double * | firstItem_ |
| First item pointer. More... | |
| double * | lastItem_ |
| Last item pointer. More... | |
| int | type_ |
| Type of build - 0 for row, 1 for column, -1 unset. More... | |
In many cases it is natural to build a model by adding one row at a time.
In Coin this is inefficient so this class gives some help. An instance of CoinBuild can be built up more efficiently and then added to the Clp/OsiModel in one go.
It may be more efficient to have fewer arrays and re-allocate them but this should give a large gain over addRow.
I have now extended it to columns.
Definition at line 25 of file CoinBuild.hpp.
| CoinBuild::CoinBuild | ( | ) |
Default constructor.
| CoinBuild::CoinBuild | ( | int | type | ) |
Constructor with type 0==for addRow, 1== for addColumn.
| CoinBuild::~CoinBuild | ( | ) |
Destructor.
| CoinBuild::CoinBuild | ( | const CoinBuild & | ) |
The copy constructor.
| void CoinBuild::addRow | ( | int | numberInRow, |
| const int * | columns, | ||
| const double * | elements, | ||
| double | rowLower = -COIN_DBL_MAX, |
||
| double | rowUpper = COIN_DBL_MAX |
||
| ) |
add a row
| void CoinBuild::addColumn | ( | int | numberInColumn, |
| const int * | rows, | ||
| const double * | elements, | ||
| double | columnLower = 0.0, |
||
| double | columnUpper = COIN_DBL_MAX, |
||
| double | objectiveValue = 0.0 |
||
| ) |
add a column
|
inline |
add a column
Definition at line 40 of file CoinBuild.hpp.
|
inline |
Return number of rows or maximum found so far.
Definition at line 48 of file CoinBuild.hpp.
|
inline |
Return number of columns or maximum found so far.
Definition at line 53 of file CoinBuild.hpp.
|
inline |
Return number of elements.
Definition at line 58 of file CoinBuild.hpp.
| int CoinBuild::row | ( | int | whichRow, |
| double & | rowLower, | ||
| double & | rowUpper, | ||
| const int *& | indices, | ||
| const double *& | elements | ||
| ) | const |
Returns number of elements in a row and information in row.
| int CoinBuild::currentRow | ( | double & | rowLower, |
| double & | rowUpper, | ||
| const int *& | indices, | ||
| const double *& | elements | ||
| ) | const |
Returns number of elements in current row and information in row Used as rows may be stored in a chain.
| void CoinBuild::setCurrentRow | ( | int | whichRow | ) |
Set current row.
| int CoinBuild::currentRow | ( | ) | const |
Returns current row number.
| int CoinBuild::column | ( | int | whichColumn, |
| double & | columnLower, | ||
| double & | columnUpper, | ||
| double & | objectiveValue, | ||
| const int *& | indices, | ||
| const double *& | elements | ||
| ) | const |
Returns number of elements in a column and information in column.
| int CoinBuild::currentColumn | ( | double & | columnLower, |
| double & | columnUpper, | ||
| double & | objectiveValue, | ||
| const int *& | indices, | ||
| const double *& | elements | ||
| ) | const |
Returns number of elements in current column and information in column Used as columns may be stored in a chain.
| void CoinBuild::setCurrentColumn | ( | int | whichColumn | ) |
Set current column.
| int CoinBuild::currentColumn | ( | ) | const |
Returns current column number.
|
inline |
Returns type.
Definition at line 90 of file CoinBuild.hpp.
|
private |
Set current.
|
private |
add a item
|
private |
Returns number of elements in a item and information in item.
|
private |
Returns number of elements in current item and information in item Used as items may be stored in a chain.
|
private |
Set current item.
|
private |
Returns current item number.
|
private |
Current number of items.
Definition at line 140 of file CoinBuild.hpp.
|
private |
Current number of other dimension i.e. Columns if addRow (i.e. max)
Definition at line 142 of file CoinBuild.hpp.
|
private |
Current number of elements.
Definition at line 144 of file CoinBuild.hpp.
|
mutableprivate |
Current item pointer.
Definition at line 146 of file CoinBuild.hpp.
|
private |
First item pointer.
Definition at line 148 of file CoinBuild.hpp.
|
private |
Last item pointer.
Definition at line 150 of file CoinBuild.hpp.
|
private |
Type of build - 0 for row, 1 for column, -1 unset.
Definition at line 152 of file CoinBuild.hpp.
1.8.5