CoinBuild

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

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

Description

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.

Public Methods

addRow

add a row

void addRow(int numberInRow, const int * columns, const double * elements, double rowLower = -, double rowUpper)

Parameters:

addColumn

add a column

void addColumn(int numberInColumn, const int * rows, const double * elements, double columnLower = 0.0, double columnUpper, double objectiveValue = 0.0)

Parameters:

addCol

add a column

void addCol(int numberInColumn, const int * rows, const double * elements, double columnLower = 0.0, double columnUpper, double objectiveValue = 0.0)

Parameters:

numberRows

Return number of rows or maximum found so far.

int numberRows()

numberColumns

Return number of columns or maximum found so far.

int numberColumns()

numberElements

Return number of elements.

CoinBigIndex numberElements()

row

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

int row(int whichRow, double & rowLower, double & rowUpper, const int *& indices, const double *& elements)

Parameters:

currentRow

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

int currentRow(double & rowLower, double & rowUpper, const int *& indices, const double *& elements)

Parameters:

setCurrentRow

Set current row.

void setCurrentRow(int whichRow)

Parameters:

currentRow

Returns current row number.

int currentRow()

column

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

int column(int whichColumn, double & columnLower, double & columnUpper, double & objectiveValue, const int *& indices, const double *& elements)

Parameters:

currentColumn

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

int currentColumn(double & columnLower, double & columnUpper, double & objectiveValue, const int *& indices, const double *& elements)

Parameters:

setCurrentColumn

Set current column.

void setCurrentColumn(int whichColumn)

Parameters:

currentColumn

Returns current column number.

int currentColumn()

type

Returns type.

Type type()

CoinBuild

Default constructor.

 CoinBuild()

CoinBuild

Constructor with type Type::Row == for addRow, Type::Column == for addColumn.

 CoinBuild(Type type)

Parameters:

~CoinBuild

Destructor.

 ~CoinBuild()

CoinBuild

The copy constructor.

 CoinBuild(const CoinBuild & )

Parameters:

operator=

=

CoinBuild & operator=(const CoinBuild & )

Parameters:

Source

Header: layer-0/CoinUtils/src/CoinBuild.hpp