CoinPrePostsolveMatrix

Collects all the information about the problem that is needed in both presolve and postsolve.

Collects all the information about the problem that is needed in both presolve and postsolve.

Derived classes: CoinPostsolveMatrix, CoinPresolveMatrix

Description

In a bit more detail, a column-major representation of the constraint matrix and upper and lower bounds on variables and constraints, plus row and column solutions, reduced costs, and status. There's also a set of arrays holding the original row and column numbers. As presolve and postsolve transform the matrix, it will occasionally be necessary to expand the number of entries in a column. There are two aspects: During postsolve, the constraint system is expected to grow as the smaller presolved system is transformed back to the original system. During both pre- and postsolve, transforms can increase the number of coefficients in a row or column. (See the variable substitution, doubleton, and tripleton transforms.) The first is addressed by the members ncols0_, nrows0_, and nelems0_. These should be set (via constructor parameters) to values large enough for the largest size taken on by the constraint system. Typically, this will be the size of the original constraint system. The second is addressed by a generous allocation of extra (empty) space for the arrays used to hold coefficients and row indices. When columns must be expanded, they are moved into the empty space. When it is used up, the arrays are compacted. When compaction fails to produce sufficient space, presolve/postsolve will fail. CoinPrePostsolveMatrix isn't really intended to be used bare the expectation is that it'll be used through CoinPresolveMatrix or CoinPostsolveMatrix. Some of the functions needed to load a problem are defined in the derived classes. When CoinPresolve is applied when reoptimising, we need to be prepared to accept a basis and modify it in step with the presolve actions (otherwise we throw away all the advantages of warm start for reoptimization). But other solution components (acts_, rowduals_, sol_, and rcosts_) are needed only for postsolve, where they're used in places to determine the proper action(s) when restoring rows or columns. If presolve is provided with a solution, it will modify it in step with the presolve actions. Moving the solution components from CoinPrePostsolveMatrix to CoinPostsolveMatrix would break a lot of code. It's not clear that it's worth it, and it would preclude upgrades to the presolve side that might make use of any of these. lh, 080501

Public Methods

CoinPrePostsolveMatrix

Native constructor

 CoinPrePostsolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc)

Parameters:

~CoinPrePostsolveMatrix

Destructor.

 ~CoinPrePostsolveMatrix()

messageHandler

Return message handler.

CoinMessageHandler * messageHandler()

setMessageHandler

Set message handler.

void setMessageHandler(CoinMessageHandler * handler)

Parameters:

messages

Return messages.

CoinMessages messages()

setRowStatus

Set row status (i.e., status of artificial for this row)

void setRowStatus(int sequence, Status status)

Parameters:

getRowStatus

Get row status.

Status getRowStatus(int sequence)

Parameters:

rowIsBasic

Check if artificial for this row is basic.

bool rowIsBasic(int sequence)

Parameters:

setColumnStatus

Set column status (i.e., status of primal variable)

void setColumnStatus(int sequence, Status status)

Parameters:

getColumnStatus

Get column (structural variable) status.

Status getColumnStatus(int sequence)

Parameters:

columnIsBasic

Check if column (structural variable) is basic.

bool columnIsBasic(int sequence)

Parameters:

setRowStatusUsingValue

Set status of row (artificial variable) to the correct nonbasic status given bounds and current value.

void setRowStatusUsingValue(int iRow)

Parameters:

setColumnStatusUsingValue

Set status of column (structural variable) to the correct nonbasic status given bounds and current value.

void setColumnStatusUsingValue(int iColumn)

Parameters:

setStructuralStatus

Set column (structural variable) status vector.

void setStructuralStatus(const char * strucStatus, int lenParam)

Parameters:

setArtificialStatus

Set row (artificial variable) status vector.

void setArtificialStatus(const char * artifStatus, int lenParam)

Parameters:

setStatus

Set the status of all variables from a basis.

void setStatus(const CoinWarmStartBasis * basis)

Parameters:

getStatus

Get status in the form of a CoinWarmStartBasis.

CoinWarmStartBasis * getStatus()

columnStatusString

Return a print string for status of a column (structural variable)

const char * columnStatusString(int j)

Parameters:

rowStatusString

Return a print string for status of a row (artificial variable)

const char * rowStatusString(int i)

Parameters:

setObjOffset

Set the objective function offset for the original system.

void setObjOffset(double offset)

Parameters:

setObjSense

Set the objective sense (max/min)

void setObjSense(double objSense)

Parameters:

setPrimalTolerance

Set the primal feasibility tolerance.

void setPrimalTolerance(double primTol)

Parameters:

setDualTolerance

Set the dual feasibility tolerance.

void setDualTolerance(double dualTol)

Parameters:

setColLower

Set column lower bounds.

void setColLower(const double * colLower, int lenParam)

Parameters:

setColUpper

Set column upper bounds.

void setColUpper(const double * colUpper, int lenParam)

Parameters:

setColSolution

Set column solution.

void setColSolution(const double * colSol, int lenParam)

Parameters:

setCost

Set objective coefficients.

void setCost(const double * cost, int lenParam)

Parameters:

setReducedCost

Set reduced costs.

void setReducedCost(const double * redCost, int lenParam)

Parameters:

setRowLower

Set row lower bounds.

void setRowLower(const double * rowLower, int lenParam)

Parameters:

setRowUpper

Set row upper bounds.

void setRowUpper(const double * rowUpper, int lenParam)

Parameters:

setRowPrice

Set row solution.

void setRowPrice(const double * rowSol, int lenParam)

Parameters:

setRowActivity

Set row activity.

void setRowActivity(const double * rowAct, int lenParam)

Parameters:

getNumCols

Get current number of columns.

int getNumCols()

getNumRows

Get current number of rows.

int getNumRows()

getNumElems

Get current number of non-zero coefficients.

CoinBigIndex getNumElems()

getColStarts

Get column start vector for column-major packed matrix.

const CoinBigIndex * getColStarts()

getColLengths

Get column length vector for column-major packed matrix.

const int * getColLengths()

getRowIndicesByCol

Get vector of row indices for column-major packed matrix.

const int * getRowIndicesByCol()

getElementsByCol

Get vector of elements for column-major packed matrix.

const double * getElementsByCol()

getColLower

Get column lower bounds.

const double * getColLower()

getColUpper

Get column upper bounds.

const double * getColUpper()

getCost

Get objective coefficients.

const double * getCost()

getRowLower

Get row lower bounds.

const double * getRowLower()

getRowUpper

Get row upper bounds.

const double * getRowUpper()

getColSolution

Get column solution (primal variable values)

const double * getColSolution()

getRowActivity

Get row activity (constraint lhs values)

const double * getRowActivity()

getRowPrice

Get row solution (dual variables)

const double * getRowPrice()

getReducedCost

Get reduced costs.

const double * getReducedCost()

countEmptyCols

Count empty columns.

int countEmptyCols()

statusName

Generate a print string for a status code.

const char * statusName(CoinPrePostsolveMatrix::Status status)

Parameters:

presolve_make_memlists

Initialise linked list for major vector order in bulk storage.

COINUTILSLIB_EXPORT void presolve_make_memlists(int * lengths, presolvehlink * link, int n)

Parameters:

presolve_expand_major

Make sure a major-dimension vector k has room for one more coefficient.

bool presolve_expand_major(CoinBigIndex * majstrts, double * majels, int * minndxs, int * majlens, presolvehlink * majlinks, int nmaj, int k)

Parameters:

presolve_expand_col

Make sure a column (colx) in a column-major matrix has room for one more coefficient.

bool presolve_expand_col(CoinBigIndex * mcstrt, double * colels, int * hrow, int * hincol, presolvehlink * clink, int ncols, int colx)

Parameters:

presolve_expand_row

Make sure a row (rowx) in a row-major matrix has room for one more coefficient.

bool presolve_expand_row(CoinBigIndex * mrstrt, double * rowels, int * hcol, int * hinrow, presolvehlink * rlink, int nrows, int rowx)

Parameters:

presolve_find_minor

Find position of a minor index in a major vector.

CoinBigIndex presolve_find_minor(int tgt, CoinBigIndex ks, CoinBigIndex ke, const int * minndxs)

Parameters:

presolve_find_row

Find position of a row in a column in a column-major matrix.

CoinBigIndex presolve_find_row(int row, CoinBigIndex kcs, CoinBigIndex kce, const int * hrow)

Parameters:

presolve_find_minor1

Find position of a minor index in a major vector.

CoinBigIndex presolve_find_minor1(int tgt, CoinBigIndex ks, CoinBigIndex ke, const int * minndxs)

Parameters:

presolve_find_row1

Find position of a row in a column in a column-major matrix.

CoinBigIndex presolve_find_row1(int row, CoinBigIndex kcs, CoinBigIndex kce, const int * hrow)

Parameters:

presolve_find_col1

Find position of a column in a row in a row-major matrix.

CoinBigIndex presolve_find_col1(int col, CoinBigIndex krs, CoinBigIndex kre, const int * hcol)

Parameters:

presolve_delete_from_major

Delete the entry for a minor index from a major vector.

void presolve_delete_from_major(int majndx, int minndx, const CoinBigIndex * majstrts, int * majlens, int * minndxs, double * els)

Parameters:

presolve_delete_many_from_major

Delete marked entries.

void presolve_delete_many_from_major(int majndx, char * marked, const CoinBigIndex * majstrts, int * majlens, int * minndxs, double * els)

Parameters:

presolve_delete_from_col

Delete the entry for row row from column col in a column-major matrix.

void presolve_delete_from_col(int row, int col, const CoinBigIndex * mcstrt, int * hincol, int * hrow, double * colels)

Parameters:

presolve_delete_from_row

Delete the entry for column col from row row in a row-major matrix.

void presolve_delete_from_row(int row, int col, const CoinBigIndex * mrstrt, int * hinrow, int * hcol, double * rowels)

Parameters:

Source

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