Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Private Member Functions | List of all 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>

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...
 
CoinBuildoperator= (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...
 

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 27 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

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

int CoinBuild::numberRows ( ) const
inline

Return number of rows or maximum found so far.

Definition at line 48 of file CoinBuild.hpp.

int CoinBuild::numberColumns ( ) const
inline

Return number of columns or maximum found so far.

Definition at line 51 of file CoinBuild.hpp.

CoinBigIndex CoinBuild::numberElements ( ) const
inline

Return number of elements.

Definition at line 54 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.

int CoinBuild::type ( ) const
inline

Returns type.

Definition at line 84 of file CoinBuild.hpp.

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

int CoinBuild::numberOther_
private

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

Definition at line 135 of file CoinBuild.hpp.

CoinBigIndex CoinBuild::numberElements_
private

Current number of elements.

Definition at line 137 of file CoinBuild.hpp.

double* CoinBuild::currentItem_
mutableprivate

Current item pointer.

Definition at line 139 of file CoinBuild.hpp.

double* CoinBuild::firstItem_
private

First item pointer.

Definition at line 141 of file CoinBuild.hpp.

double* CoinBuild::lastItem_
private

Last item pointer.

Definition at line 143 of file CoinBuild.hpp.

int CoinBuild::type_
private

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

Definition at line 145 of file CoinBuild.hpp.


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