- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CoinBuild Class Reference

In many cases it is natural to build a model by adding one row at a time. More...

`#include <CoinBuild.hpp>`

List of all members.

## 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
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
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
int | numberRows () const
| Return number of rows or maximum found so far.
int | numberColumns () const
| Return number of columns or maximum found so far.
CoinBigIndex | numberElements () const
| Return number of elements.
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.
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.
void | setCurrentRow (int whichRow)
| Set current row.
int | currentRow () const
| Returns current row number.
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.
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.
void | setCurrentColumn (int whichColumn)
| Set current column.
int | currentColumn () const
| Returns current column number.
int | type () const
| Returns type.
Constructors, destructor
| CoinBuild ()
| Default constructor.
| CoinBuild (int type)
| Constructor with type 0==for addRow, 1== for addColumn.
| ~CoinBuild ()
| Destructor.
Copy method
| CoinBuild (const CoinBuild &)
| The copy constructor.
CoinBuild & | operator= (const CoinBuild &)
| =
## Private Member Functions
void | setMutableCurrent (int which) const
| Set current.
void | addItem (int numberInItem, const int *indices, const double *elements, double itemLower, double itemUpper, double objectiveValue)
| add a item
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.
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.
void | setCurrentItem (int whichItem)
| Set current item.
int | currentItem () const
| Returns current item number.
## Private Attributes
Data members
int | numberItems_
| Current number of items.
int | numberOther_
| Current number of other dimension i.e. Columns if addRow (i.e. max).
CoinBigIndex | numberElements_
| Current number of elements.
double * | currentItem_
| Current item pointer.
double * | firstItem_
| First item pointer.
double * | lastItem_
| Last item pointer.
int | type_
| Type of build - 0 for row, 1 for column, -1 unset.

## Detailed Description

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 24 of file CoinBuild.hpp.

## Constructor & Destructor Documentation

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.

## Member Function Documentation

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

Referenced by addCol().

void CoinBuild::addCol | ( | int | numberInColumn,
|  | const int * | rows,
|  | const double * | elements,
|  | double | columnLower = `0.0`,
|  | double | columnUpper = `COIN_DBL_MAX`,
|  | double | objectiveValue = `0.0` |
| ) |  |  | `[inline]`

add a column

Definition at line 39 of file CoinBuild.hpp.

References addColumn().

int CoinBuild::numberRows | ( |  | ) | const`[inline]`

Return number of rows or maximum found so far.

Definition at line 45 of file CoinBuild.hpp.

References numberItems_, numberOther_, and type_.

int CoinBuild::numberColumns | ( |  | ) | const`[inline]`

Return number of columns or maximum found so far.

Definition at line 48 of file CoinBuild.hpp.

References numberItems_, numberOther_, and type_.

CoinBigIndex CoinBuild::numberElements | ( |  | ) | const`[inline]`

Return number of elements.

Definition at line 51 of file CoinBuild.hpp.

References numberElements_.

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.

int CoinBuild::type | ( |  | ) | const`[inline]`

Returns type.

Definition at line 81 of file CoinBuild.hpp.

References type_.

CoinBuild& CoinBuild::operator= | ( | const CoinBuild & |  | ) |

=

void CoinBuild::setMutableCurrent | ( | int | which | ) | const`[private]`

Set current.

void CoinBuild::addItem | ( | int | numberInItem,
|  | const int * | indices,
|  | const double * | elements,
|  | double | itemLower,
|  | double | itemUpper,
|  | double | objectiveValue |
| ) |  |  | `[private]`

add a item

int CoinBuild::item | ( | int | whichItem,
|  | double & | itemLower,
|  | double & | itemUpper,
|  | double & | objectiveValue,
|  | const int *& | indices,
|  | const double *& | elements |
| ) |  |  | const`[private]`

Returns number of elements in a item and information in item.

int CoinBuild::currentItem | ( | double & | itemLower,
|  | double & | itemUpper,
|  | double & | objectiveValue,
|  | const int *& | indices,
|  | const double *& | elements |
| ) |  |  | const`[private]`

Returns number of elements in current item and information in item Used as items may be stored in a chain.

void CoinBuild::setCurrentItem | ( | int | whichItem | ) | `[private]`

Set current item.

int CoinBuild::currentItem | ( |  | ) | const`[private]`

Returns current item number.

## Member Data Documentation

int CoinBuild::numberItems_`[private]`

Current number of items.

Definition at line 130 of file CoinBuild.hpp.

Referenced by numberColumns(), and numberRows().

int CoinBuild::numberOther_`[private]`

Current number of other dimension i.e. Columns if addRow (i.e. max).

Definition at line 132 of file CoinBuild.hpp.

Referenced by numberColumns(), and numberRows().

CoinBigIndex CoinBuild::numberElements_`[private]`

Current number of elements.

Definition at line 134 of file CoinBuild.hpp.

Referenced by numberElements().

double* CoinBuild::currentItem_`[mutable, private]`

Current item pointer.

Definition at line 136 of file CoinBuild.hpp.

double* CoinBuild::firstItem_`[private]`

First item pointer.

Definition at line 138 of file CoinBuild.hpp.

double* CoinBuild::lastItem_`[private]`

Last item pointer.

Definition at line 140 of file CoinBuild.hpp.

int CoinBuild::type_`[private]`

Type of build - 0 for row, 1 for column, -1 unset.

Definition at line 142 of file CoinBuild.hpp.

Referenced by numberColumns(), numberRows(), and type().

The documentation for this class was generated from the following file:

- /home/coin/SVN-release/Cgl-0.55.0/CoinUtils/src/CoinBuild.hpp