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

Augments CoinPrePostsolveMatrix with information about the problem that is only needed during postsolve. More...

#include <CoinPresolveMatrix.hpp>

Inheritance diagram for CoinPostsolveMatrix:
Collaboration diagram for CoinPostsolveMatrix:

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_.
CoinBigIndexlink_
 Thread array.

(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.

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.

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ CoinPostsolveMatrix() [1/2]

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() [2/2]

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::~CoinPostsolveMatrix ( )

Destructor.

Member Function Documentation

◆ assignPresolveToPostsolve()

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.

◆ check_nbasic()

void CoinPostsolveMatrix::check_nbasic ( )

debug

◆ presolve_find_col()

CoinBigIndex presolve_find_col ( 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. It will abort if the entry does not exist.

Definition at line 1756 of file CoinPresolveMatrix.hpp.

◆ presolve_find_minor2()

CoinBigIndex presolve_find_minor2 ( int tgt,
CoinBigIndex ks,
int majlen,
const int * minndxs,
const CoinBigIndex * majlinks )
related

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.

◆ presolve_find_row2()

CoinBigIndex presolve_find_row2 ( int row,
CoinBigIndex kcs,
int collen,
const int * hrow,
const CoinBigIndex * clinks )
related

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.

◆ presolve_find_minor3()

CoinBigIndex presolve_find_minor3 ( int tgt,
CoinBigIndex ks,
int majlen,
const int * minndxs,
const CoinBigIndex * majlinks )
related

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.

◆ presolve_find_row3()

CoinBigIndex presolve_find_row3 ( int row,
CoinBigIndex kcs,
int collen,
const int * hrow,
const CoinBigIndex * clinks )
related

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.

◆ presolve_delete_from_major2()

void presolve_delete_from_major2 ( int majndx,
int minndx,
CoinBigIndex * majstrts,
int * majlens,
int * minndxs,
CoinBigIndex * majlinks,
CoinBigIndex * free_listp )
related

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.

◆ presolve_delete_from_col2()

void presolve_delete_from_col2 ( int row,
int col,
CoinBigIndex * mcstrt,
int * hincol,
int * hrow,
CoinBigIndex * clinks,
CoinBigIndex * free_listp )
related

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.

◆ presolve_check_threads()

void presolve_check_threads ( const CoinPostsolveMatrix * obj)
related

Checks that column threads agree with column lengths.

◆ presolve_check_free_list()

void presolve_check_free_list ( const CoinPostsolveMatrix * obj,
bool chkElemCnt = false )
related

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.

◆ presolve_check_reduced_costs()

void presolve_check_reduced_costs ( const CoinPostsolveMatrix * obj)
related

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_.

◆ presolve_check_duals()

void presolve_check_duals ( const CoinPostsolveMatrix * postObj)
related

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).

◆ presolve_check_sol()

void presolve_check_sol ( const CoinPostsolveMatrix * postObj,
int chkColSol = 2,
int chkRowAct = 2,
int chkStatus = 1 )
related

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.

◆ presolve_check_nbasic()

void presolve_check_nbasic ( const CoinPostsolveMatrix * postObj)
related

Check for the proper number of basic variables.

Member Data Documentation

◆ free_list_

CoinBigIndex CoinPostsolveMatrix::free_list_

First entry in free entries thread.

Definition at line 1629 of file CoinPresolveMatrix.hpp.

◆ maxlink_

CoinBigIndex CoinPostsolveMatrix::maxlink_

Allocated size of link_.

Definition at line 1631 of file CoinPresolveMatrix.hpp.

◆ link_

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.

◆ cdone_

char* CoinPostsolveMatrix::cdone_

Definition at line 1647 of file CoinPresolveMatrix.hpp.

◆ rdone_

char* CoinPostsolveMatrix::rdone_

Definition at line 1648 of file CoinPresolveMatrix.hpp.


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