CoinUtils 2.11.12
Loading...
Searching...
No Matches
CoinPrePostsolveMatrix Class Reference

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

#include <CoinPresolveMatrix.hpp>

Inheritance diagram for CoinPrePostsolveMatrix:

(Note that these are not member symbols.)

Uses the standard COIN approach: a default handler is installed, and the CoinPrePostsolveMatrix object takes responsibility for it.

If the client replaces the handler with one of their own, it becomes their responsibility.

const char * statusName (CoinPrePostsolveMatrix::Status status)
 Generate a print string for a status code.
void presolve_make_memlists (int *lengths, presolvehlink *link, int n)
 Initialise linked list for major vector order in bulk storage.
bool presolve_expand_major (CoinBigIndex *majstrts, double *majels, int *minndxs, int *majlens, presolvehlink *majlinks, int nmaj, int k)
 Make sure a major-dimension vector k has room for one more coefficient.
bool presolve_expand_col (CoinBigIndex *mcstrt, double *colels, int *hrow, int *hincol, presolvehlink *clink, int ncols, int colx)
 Make sure a column (colx) in a column-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)
 Make sure a row (rowx) in a row-major matrix has room for one more coefficient.
CoinBigIndex presolve_find_minor (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs)
 Find position of a minor index in a major vector.
CoinBigIndex presolve_find_row (int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow)
 Find position of a row in a column in a column-major matrix.
CoinBigIndex presolve_find_minor1 (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs)
 Find position of a minor index in a major vector.
CoinBigIndex presolve_find_row1 (int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow)
 Find position of a row in a column in a column-major matrix.
CoinBigIndex presolve_find_col1 (int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol)
 Find position of a column in a row in a row-major matrix.
void presolve_delete_from_major (int majndx, int minndx, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els)
 Delete the entry for a minor index from a major vector.
void presolve_delete_many_from_major (int majndx, char *marked, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els)
 Delete marked entries.
void presolve_delete_from_col (int row, int col, const CoinBigIndex *mcstrt, int *hincol, int *hrow, double *colels)
 Delete the entry for row row from column col in a column-major matrix.
void presolve_delete_from_row (int row, int col, const CoinBigIndex *mrstrt, int *hinrow, int *hcol, double *rowels)
 Delete the entry for column col from row row in a row-major matrix.

Detailed Description

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

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 –

The constructors that take an OSI or ClpSimplex as a parameter really should not be here, but for historical reasons they will likely remain for the forseeable future. – lh, 111202 – */

class CoinPrePostsolveMatrix { public: /*!

◆ statusName()

const char * statusName ( CoinPrePostsolveMatrix::Status status)
related

Generate a print string for a status code.

◆ presolve_make_memlists()

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

Initialise linked list for major vector order in bulk storage.

◆ presolve_expand_major()

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

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

You can use this directly, or use the inline wrappers presolve_expand_col and presolve_expand_row

◆ presolve_expand_col()

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

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

Definition at line 1685 of file CoinPresolveMatrix.hpp.

◆ presolve_expand_row()

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

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

Definition at line 1698 of file CoinPresolveMatrix.hpp.

◆ presolve_find_minor()

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

Find position of a minor index in a major vector.

The routine returns the position k in minndxs for the specified minor index tgt. It will abort if the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row and presolve_find_col.

Definition at line 1714 of file CoinPresolveMatrix.hpp.

◆ presolve_find_row()

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

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

The routine returns the position k in hrow for the specified row. It will abort if the entry does not exist.

Definition at line 1744 of file CoinPresolveMatrix.hpp.

◆ presolve_find_minor1()

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

Find position of a minor index in a major vector.

The routine returns the position k in minndxs for the specified minor index tgt. A return value of ke means the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row1 and presolve_find_col1.

◆ presolve_find_row1()

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

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

The routine returns the position k in hrow for the specified row. A return value of kce means the entry does not exist.

Definition at line 1779 of file CoinPresolveMatrix.hpp.

◆ presolve_find_col1()

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

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

The routine returns the position k in hcol for the specified col. A return value of kre means the entry does not exist.

Definition at line 1791 of file CoinPresolveMatrix.hpp.

◆ presolve_delete_from_major()

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

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

Deletes the entry for minndx from the major vector majndx. Specifically, the relevant entries are removed from the minor index (minndxs) and coefficient (els) arrays and the vector length (majlens) is decremented. Loose packing is maintained by swapping the last entry in the row into the position occupied by the deleted entry.

Definition at line 1858 of file CoinPresolveMatrix.hpp.

◆ presolve_delete_many_from_major()

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

Delete marked entries.

Removes the entries specified in marked, compressing the major vector to maintain loose packing. marked is cleared in the process.

Definition at line 1880 of file CoinPresolveMatrix.hpp.

◆ presolve_delete_from_col()

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

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

Deletes the entry for row from the major vector for col. Specifically, the relevant entries are removed from the row index (hrow) and coefficient (colels) arrays and the vector length (hincol) is decremented. Loose packing is maintained by swapping the last entry in the row into the position occupied by the deleted entry.

Definition at line 1910 of file CoinPresolveMatrix.hpp.

◆ presolve_delete_from_row()

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

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

Deletes the entry for col from the major vector for row. Specifically, the relevant entries are removed from the column index (hcol) and coefficient (rowels) arrays and the vector length (hinrow) is decremented. Loose packing is maintained by swapping the last entry in the column into the position occupied by the deleted entry.

Definition at line 1927 of file CoinPresolveMatrix.hpp.


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