Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsolve. More...
#include <CoinPresolveMatrix.hpp>
Public Member Functions | |
CoinPostsolveMatrix (int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) | |
`Native' constructor More... | |
CoinPostsolveMatrix (ClpSimplex *si, int ncols0, int nrows0, CoinBigIndex nelems0, double maxmin_, double *sol, double *acts, unsigned char *colstat, unsigned char *rowstat) | |
Clp OSI constructor. More... | |
CoinPostsolveMatrix (OsiSolverInterface *si, int ncols0, int nrows0, CoinBigIndex nelems0, double maxmin_, double *sol, double *acts, unsigned char *colstat, unsigned char *rowstat) | |
Generic OSI constructor. More... | |
void | assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) |
Load an empty CoinPostsolveMatrix from a CoinPresolveMatrix. More... | |
~CoinPostsolveMatrix () | |
Destructor. More... | |
void | check_nbasic () |
debug More... | |
![]() | |
CoinPrePostsolveMatrix (int ncols_alloc, int nrows_alloc, CoinBigIndex nelems_alloc) | |
`Native' constructor More... | |
CoinPrePostsolveMatrix (const OsiSolverInterface *si, int ncols_, int nrows_, CoinBigIndex nelems_) | |
Generic OSI constructor. More... | |
CoinPrePostsolveMatrix (const ClpSimplex *si, int ncols_, int nrows_, CoinBigIndex nelems_, double bulkRatio) | |
~CoinPrePostsolveMatrix () | |
Destructor. More... | |
void | setRowStatus (int sequence, Status status) |
Set row status (i.e., status of artificial for this row) More... | |
Status | getRowStatus (int sequence) const |
Get row status. More... | |
bool | rowIsBasic (int sequence) const |
Check if artificial for this row is basic. More... | |
void | setColumnStatus (int sequence, Status status) |
Set column status (i.e., status of primal variable) More... | |
Status | getColumnStatus (int sequence) const |
Get column (structural variable) status. More... | |
bool | columnIsBasic (int sequence) const |
Check if column (structural variable) is basic. More... | |
void | setRowStatusUsingValue (int iRow) |
Set status of row (artificial variable) to the correct nonbasic status given bounds and current value. More... | |
void | setColumnStatusUsingValue (int iColumn) |
Set status of column (structural variable) to the correct nonbasic status given bounds and current value. More... | |
void | setStructuralStatus (const char *strucStatus, int lenParam) |
Set column (structural variable) status vector. More... | |
void | setArtificialStatus (const char *artifStatus, int lenParam) |
Set row (artificial variable) status vector. More... | |
void | setStatus (const CoinWarmStartBasis *basis) |
Set the status of all variables from a basis. More... | |
CoinWarmStartBasis * | getStatus () |
Get status in the form of a CoinWarmStartBasis. More... | |
const char * | columnStatusString (int j) const |
Return a print string for status of a column (structural variable) More... | |
const char * | rowStatusString (int i) const |
Return a print string for status of a row (artificial variable) More... | |
void | setObjOffset (double offset) |
Set the objective function offset for the original system. More... | |
void | setObjSense (double objSense) |
Set the objective sense (max/min) More... | |
void | setPrimalTolerance (double primTol) |
Set the primal feasibility tolerance. More... | |
void | setDualTolerance (double dualTol) |
Set the dual feasibility tolerance. More... | |
void | setColLower (const double *colLower, int lenParam) |
Set column lower bounds. More... | |
void | setColUpper (const double *colUpper, int lenParam) |
Set column upper bounds. More... | |
void | setColSolution (const double *colSol, int lenParam) |
Set column solution. More... | |
void | setCost (const double *cost, int lenParam) |
Set objective coefficients. More... | |
void | setReducedCost (const double *redCost, int lenParam) |
Set reduced costs. More... | |
void | setRowLower (const double *rowLower, int lenParam) |
Set row lower bounds. More... | |
void | setRowUpper (const double *rowUpper, int lenParam) |
Set row upper bounds. More... | |
void | setRowPrice (const double *rowSol, int lenParam) |
Set row solution. More... | |
void | setRowActivity (const double *rowAct, int lenParam) |
Set row activity. More... | |
int | getNumCols () const |
Get current number of columns. More... | |
int | getNumRows () const |
Get current number of rows. More... | |
int | getNumElems () const |
Get current number of non-zero coefficients. More... | |
const CoinBigIndex * | getColStarts () const |
Get column start vector for column-major packed matrix. More... | |
const int * | getColLengths () const |
Get column length vector for column-major packed matrix. More... | |
const int * | getRowIndicesByCol () const |
Get vector of row indices for column-major packed matrix. More... | |
const double * | getElementsByCol () const |
Get vector of elements for column-major packed matrix. More... | |
const double * | getColLower () const |
Get column lower bounds. More... | |
const double * | getColUpper () const |
Get column upper bounds. More... | |
const double * | getCost () const |
Get objective coefficients. More... | |
const double * | getRowLower () const |
Get row lower bounds. More... | |
const double * | getRowUpper () const |
Get row upper bounds. More... | |
const double * | getColSolution () const |
Get column solution (primal variable values) More... | |
const double * | getRowActivity () const |
Get row activity (constraint lhs values) More... | |
const double * | getRowPrice () const |
Get row solution (dual variables) More... | |
const double * | getReducedCost () const |
Get reduced costs. More... | |
int | countEmptyCols () |
Count empty columns. More... | |
CoinMessageHandler * | messageHandler () const |
Return message handler. More... | |
void | setMessageHandler (CoinMessageHandler *handler) |
Set message handler. More... | |
CoinMessages | messages () const |
Return messages. More... | |
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. More... | |
int | maxlink_ |
Allocated size of link_. More... | |
CoinBigIndex * | link_ |
Thread array. More... | |
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_ |
![]() | |
int | ncols_ |
current number of columns More... | |
int | nrows_ |
current number of rows More... | |
CoinBigIndex | nelems_ |
current number of coefficients More... | |
int | ncols0_ |
Allocated number of columns. More... | |
int | nrows0_ |
Allocated number of rows. More... | |
CoinBigIndex | nelems0_ |
Allocated number of coefficients. More... | |
CoinBigIndex | bulk0_ |
Allocated size of bulk storage for row indices and coefficients. More... | |
double | bulkRatio_ |
Ratio of bulk0_ to nelems0_; default is 2. More... | |
CoinBigIndex * | mcstrt_ |
Vector of column start positions in hrow_, colels_. More... | |
int * | hincol_ |
Vector of column lengths. More... | |
int * | hrow_ |
Row indices (positional correspondence with colels_) More... | |
double * | colels_ |
Coefficients (positional correspondence with hrow_) More... | |
double * | cost_ |
Objective coefficients. More... | |
double | originalOffset_ |
Original objective offset. More... | |
double * | clo_ |
Column (primal variable) lower bounds. More... | |
double * | cup_ |
Column (primal variable) upper bounds. More... | |
double * | rlo_ |
Row (constraint) lower bounds. More... | |
double * | rup_ |
Row (constraint) upper bounds. More... | |
int * | originalColumn_ |
Original column numbers. More... | |
int * | originalRow_ |
Original row numbers. More... | |
double | ztolzb_ |
Primal feasibility tolerance. More... | |
double | ztoldj_ |
Dual feasibility tolerance. More... | |
double | maxmin_ |
Maximization/minimization. More... | |
double * | sol_ |
Vector of primal variable values. More... | |
double * | rowduals_ |
Vector of dual variable values. More... | |
double * | acts_ |
Vector of constraint left-hand-side values (row activity) More... | |
double * | rcosts_ |
Vector of reduced costs. More... | |
unsigned char * | colstat_ |
Status of primal variables. More... | |
unsigned char * | rowstat_ |
Status of constraints. More... | |
CoinMessageHandler * | handler_ |
Message handler. More... | |
bool | defaultHandler_ |
Indicates if the current handler_ is default (true) or not (false). More... | |
CoinMessage | messages_ |
Standard COIN messages. More... | |
Related Functions | |
(Note that these are not member functions.) | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | presolve_delete_from_major2 (int majndx, int minndx, CoinBigIndex *majstrts, int *majlens, int *minndxs, int *majlinks, CoinBigIndex *free_listp) |
Delete the entry for a minor index from a major vector in a threaded matrix. More... | |
void | presolve_delete_from_col2 (int row, int col, CoinBigIndex *mcstrt, int *hincol, int *hrow, int *clinks, CoinBigIndex *free_listp) |
Delete the entry for row row from column col in a column-major threaded matrix. More... | |
void | presolve_check_threads (const CoinPostsolveMatrix *obj) |
Checks that column threads agree with column lengths. More... | |
void | presolve_check_free_list (const CoinPostsolveMatrix *obj, bool chkElemCnt=false) |
Checks the free list. More... | |
void | presolve_check_reduced_costs (const CoinPostsolveMatrix *obj) |
Check stored reduced costs for accuracy and consistency with variable status. More... | |
void | presolve_check_duals (const CoinPostsolveMatrix *postObj) |
Check the dual variables for consistency with row activity. More... | |
void | presolve_check_sol (const CoinPostsolveMatrix *postObj, int chkColSol=2, int chkRowAct=2, int chkStatus=1) |
Check primal solution and architectural variable status. More... | |
void | presolve_check_nbasic (const CoinPostsolveMatrix *postObj) |
Check for the proper number of basic variables. More... | |
![]() | |
const char * | statusName (CoinPrePostsolveMatrix::Status status) |
Generate a print string for a status code. More... | |
void | presolve_make_memlists (int *lengths, presolvehlink *link, int n) |
Initialise linked list for major vector order in bulk storage. More... | |
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. More... | |
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. More... | |
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. More... | |
CoinBigIndex | presolve_find_minor (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs) |
Find position of a minor index in a major vector. More... | |
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. More... | |
CoinBigIndex | presolve_find_minor1 (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs) |
Find position of a minor index in a major vector. More... | |
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. More... | |
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. More... | |
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. More... | |
void | presolve_delete_many_from_major (int majndx, char *marked, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els) |
Delete marked entries. More... | |
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. More... | |
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. More... | |
Additional Inherited Members | |
![]() | |
enum | Status { isFree = 0x00, basic = 0x01, atUpperBound = 0x02, atLowerBound = 0x03, superBasic = 0x04 } |
Enum for status of various sorts. More... | |
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 1421 of file CoinPresolveMatrix.hpp.
CoinPostsolveMatrix::CoinPostsolveMatrix | ( | int | ncols_alloc, |
int | nrows_alloc, | ||
CoinBigIndex | nelems_alloc | ||
) |
`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::CoinPostsolveMatrix | ( | ClpSimplex * | si, |
int | ncols0, | ||
int | nrows0, | ||
CoinBigIndex | nelems0, | ||
double | maxmin_, | ||
double * | sol, | ||
double * | acts, | ||
unsigned char * | colstat, | ||
unsigned char * | rowstat | ||
) |
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
CoinBigIndex CoinPostsolveMatrix::free_list_ |
First entry in free entries thread.
Definition at line 1501 of file CoinPresolveMatrix.hpp.
int CoinPostsolveMatrix::maxlink_ |
Allocated size of link_.
Definition at line 1503 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 1508 of file CoinPresolveMatrix.hpp.
char* CoinPostsolveMatrix::cdone_ |
Definition at line 1519 of file CoinPresolveMatrix.hpp.
char* CoinPostsolveMatrix::rdone_ |
Definition at line 1520 of file CoinPresolveMatrix.hpp.