|
CoinUtils 2.11.13
|
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsolve. More...
#include <CoinPresolveMatrix.hpp>
Public Member Functions | |
| CoinPostsolveMatrix (ClpSimplex *si, int ncols0, int nrows0, CoinBigIndex nelems0, double maxmin_, double *sol, double *acts, unsigned char *colstat, unsigned char *rowstat) | |
| `Native' constructor | |
| CoinPostsolveMatrix (OsiSolverInterface *si, int ncols0, int nrows0, CoinBigIndex nelems0, double maxmin_, double *sol, double *acts, unsigned char *colstat, unsigned char *rowstat) | |
| Generic OSI constructor. | |
| void | assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) |
| Load an empty CoinPostsolveMatrix from a CoinPresolveMatrix. | |
| ~CoinPostsolveMatrix () | |
| Destructor. | |
Public Attributes | |
Column thread structures | |
As mentioned in the class documentation, the entries for a given column do not necessarily occupy a contiguous block of space. The link_ array is used to maintain the threading. There is one thread for each column, and a single thread for all free entries in hrow_ and colels_. The allocated size of link_ must be at least as large as the allocated size of hrow_ and colels_. | |
| CoinBigIndex | free_list_ |
| First entry in free entries thread. | |
| CoinBigIndex | maxlink_ |
| Allocated size of link_. | |
| CoinBigIndex * | link_ |
| Thread array. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| void | presolve_check_threads (const CoinPostsolveMatrix *obj) |
| Checks that column threads agree with column lengths. | |
| void | presolve_check_free_list (const CoinPostsolveMatrix *obj, bool chkElemCnt=false) |
| Checks the free list. | |
| void | presolve_check_reduced_costs (const CoinPostsolveMatrix *obj) |
| Check stored reduced costs for accuracy and consistency with variable status. | |
| void | presolve_check_duals (const CoinPostsolveMatrix *postObj) |
| Check the dual variables for consistency with row activity. | |
| void | presolve_check_sol (const CoinPostsolveMatrix *postObj, int chkColSol=2, int chkRowAct=2, int chkStatus=1) |
| Check primal solution and architectural variable status. | |
| void | presolve_check_nbasic (const CoinPostsolveMatrix *postObj) |
| Check for the proper number of basic variables. | |
Message handling | |
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. | |
| CoinBigIndex | presolve_find_col (int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol) |
| Find position of a column in a row in a row-major matrix. | |
| CoinBigIndex | presolve_find_minor2 (int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks) |
| Find position of a minor index in a major vector in a threaded matrix. | |
| CoinBigIndex | presolve_find_row2 (int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks) |
| Find position of a row in a column in a column-major threaded matrix. | |
| CoinBigIndex | presolve_find_minor3 (int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks) |
| Find position of a minor index in a major vector in a threaded matrix. | |
| CoinBigIndex | presolve_find_row3 (int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks) |
| Find position of a row in a column in a column-major threaded matrix. | |
| void | presolve_delete_from_major2 (int majndx, int minndx, CoinBigIndex *majstrts, int *majlens, int *minndxs, CoinBigIndex *majlinks, CoinBigIndex *free_listp) |
| Delete the entry for a minor index from a major vector in a threaded matrix. | |
| void | presolve_delete_from_col2 (int row, int col, CoinBigIndex *mcstrt, int *hincol, int *hrow, CoinBigIndex *clinks, CoinBigIndex *free_listp) |
Delete the entry for row row from column col in a column-major threaded matrix. | |
| Related Symbols inherited from CoinPrePostsolveMatrix | |
| 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. | |
Debugging aids | |
These arrays are allocated only when CoinPresolve is compiled with PRESOLVE_DEBUG defined. They hold codes which track the reason that a column or row is added to the problem during postsolve. | |
| char * | cdone_ |
| char * | rdone_ |
| void | check_nbasic () |
| debug | |
Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsolve.
The notable point is that the matrix representation is threaded. The representation is column-major and starts with the standard two pairs of arrays: one pair to hold the row indices and coefficients, the second pair to hold the column starting positions and lengths. But the row indices and coefficients for a column do not necessarily occupy a contiguous block in their respective arrays. Instead, a link array gives the position of the next (row index,coefficient) pair. If the row index and value of a coefficient a<p,j> occupy position kp in their arrays, then the position of the next coefficient a<q,j> is found as kq = link[kp].
This threaded representation allows for efficient expansion of columns as rows are reintroduced during postsolve transformations. The basic packed structures are allocated to the expected size of the postsolved matrix, and as new coefficients are added, their location is simply added to the thread for the column.
There is no provision to convert the threaded representation to a packed representation. In the context of postsolve, it's not required. (You did keep a copy of the original matrix, eh?)
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 –
Definition at line 1552 of file CoinPresolveMatrix.hpp.
| CoinPostsolveMatrix::CoinPostsolveMatrix | ( | ClpSimplex * | si, |
| int | ncols0, | ||
| int | nrows0, | ||
| CoinBigIndex | nelems0, | ||
| double | maxmin_, | ||
| double * | sol, | ||
| double * | acts, | ||
| unsigned char * | colstat, | ||
| unsigned char * | rowstat ) |
`Native' constructor
This constructor creates an empty object which must then be loaded. On the other hand, it doesn't assume that the client is an OsiSolverInterface. */ CoinPostsolveMatrix(int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc);
/*! Clp OSI constructor
See Clp code for the definition.
| CoinPostsolveMatrix::CoinPostsolveMatrix | ( | OsiSolverInterface * | si, |
| int | ncols0, | ||
| int | nrows0, | ||
| CoinBigIndex | nelems0, | ||
| double | maxmin_, | ||
| double * | sol, | ||
| double * | acts, | ||
| unsigned char * | colstat, | ||
| unsigned char * | rowstat ) |
Generic OSI constructor.
See OSI code for the definition.
| CoinPostsolveMatrix::~CoinPostsolveMatrix | ( | ) |
Destructor.
| void CoinPostsolveMatrix::assignPresolveToPostsolve | ( | CoinPresolveMatrix *& | preObj | ) |
Load an empty CoinPostsolveMatrix from a CoinPresolveMatrix.
This routine transfers the contents of the CoinPrePostsolveMatrix object from the CoinPresolveMatrix object to the CoinPostsolveMatrix object and completes initialisation of the CoinPostsolveMatrix object. The empty shell of the CoinPresolveMatrix object is destroyed.
The routine expects an empty CoinPostsolveMatrix object. If handed a loaded object, a lot of memory will leak.
| void CoinPostsolveMatrix::check_nbasic | ( | ) |
debug
|
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. It will abort if the entry does not exist.
Definition at line 1756 of file CoinPresolveMatrix.hpp.
|
Find position of a minor index in a major vector in a threaded matrix.
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 wrapper presolve_find_row2.
|
Find position of a row in a column in a column-major threaded 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 1816 of file CoinPresolveMatrix.hpp.
|
Find position of a minor index in a major vector in a threaded matrix.
The routine returns the position k in minndxs for the specified minor index tgt. It will return -1 if the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row3.
|
Find position of a row in a column in a column-major threaded matrix.
The routine returns the position k in hrow for the specified row. It will return -1 if the entry does not exist.
Definition at line 1842 of file CoinPresolveMatrix.hpp.
|
Delete the entry for a minor index from a major vector in a threaded matrix.
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. The thread for the major vector is relinked around the deleted entry and the space is returned to the free list.
|
Delete the entry for row row from column col in a column-major threaded 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. The thread for the major vector is relinked around the deleted entry and the space is returned to the free list.
Definition at line 1959 of file CoinPresolveMatrix.hpp.
|
Checks that column threads agree with column lengths.
|
Checks the free list.
Scans the thread of free locations in the bulk store and checks that all entries are reasonable (0 <= index < bulk0_). If chkElemCnt is true, it also checks that the total number of entries in the matrix plus the locations on the free list total to the size of the bulk store. Postsolve routines do not maintain an accurate element count, but this is useful for checking a newly constructed postsolve matrix.
|
Check stored reduced costs for accuracy and consistency with variable status.
The routine will check the value of the reduced costs for architectural variables (CoinPrePostsolveMatrix::rcosts_). It performs an accuracy check by recalculating the reduced cost from scratch. It will also check the value for consistency with the status information in CoinPrePostsolveMatrix::colstat_.
|
Check the dual variables for consistency with row activity.
The routine checks that the value of the dual variable is consistent with the state of the constraint (loose, tight at lower bound, or tight at upper bound).
|
Check primal solution and architectural variable status.
The architectural variables can be checked for bogus values, feasibility, and valid status. The row activity is checked for bogus values, accuracy, and feasibility. See the definitions in CoinPresolvePsdebug.cpp for more information.
|
Check for the proper number of basic variables.
| CoinBigIndex CoinPostsolveMatrix::free_list_ |
First entry in free entries thread.
Definition at line 1629 of file CoinPresolveMatrix.hpp.
| CoinBigIndex CoinPostsolveMatrix::maxlink_ |
Allocated size of link_.
Definition at line 1631 of file CoinPresolveMatrix.hpp.
| CoinBigIndex* CoinPostsolveMatrix::link_ |
Thread array.
Within a thread, link_[k] points to the next entry in the thread.
Definition at line 1636 of file CoinPresolveMatrix.hpp.
| char* CoinPostsolveMatrix::cdone_ |
Definition at line 1647 of file CoinPresolveMatrix.hpp.
| char* CoinPostsolveMatrix::rdone_ |
Definition at line 1648 of file CoinPresolveMatrix.hpp.