Dip
0.92.4
|
Monitor a row or column for modification. More...
#include <CoinPresolveMonitor.hpp>
Public Member Functions | |
CoinPresolveMonitor () | |
Default constructor. More... | |
CoinPresolveMonitor (const CoinPresolveMatrix *mtx, bool isRow, int k) | |
Initialise from a CoinPresolveMatrix. More... | |
CoinPresolveMonitor (const CoinPostsolveMatrix *mtx, bool isRow, int k) | |
Initialise from a CoinPostsolveMatrix. More... | |
void | checkAndTell (const CoinPresolveMatrix *mtx) |
Compare the present row or column against the stored copy and report differences. More... | |
void | checkAndTell (const CoinPostsolveMatrix *mtx) |
Compare the present row or column against the stored copy and report differences. More... | |
Private Member Functions | |
CoinPackedVector * | extractRow (int i, const CoinPresolveMatrix *mtx) const |
Extract a row from a CoinPresolveMatrix. More... | |
CoinPackedVector * | extractCol (int j, const CoinPresolveMatrix *mtx) const |
Extract a column from a CoinPresolveMatrix. More... | |
CoinPackedVector * | extractRow (int i, const CoinPostsolveMatrix *mtx) const |
Extract a row from a CoinPostsolveMatrix. More... | |
CoinPackedVector * | extractCol (int j, const CoinPostsolveMatrix *mtx) const |
Extract a column from a CoinPostsolveMatrix. More... | |
void | checkAndTell (CoinPackedVector *curVec, double lb, double ub) |
Worker method underlying the public checkAndTell methods. More... | |
Private Attributes | |
bool | isRow_ |
True to monitor a row, false to monitor a column. More... | |
int | ndx_ |
Row or column index. More... | |
CoinPackedVector * | origVec_ |
double | lb_ |
Original row or column lower bound. More... | |
double | ub_ |
Original row or column upper bound. More... | |
Monitor a row or column for modification.
The purpose of this class is to monitor a row or column for modifications during presolve and postsolve. Each object can monitor one row or column. The initial copy of the row or column is loaded by the constructor. Each subsequent call to checkAndTell() compares the current state of the row or column with the stored state and reports any modifications.
Internally the row or column is held as a CoinPackedVector so that it's possible to follow a row or column through presolve (CoinPresolveMatrix) and postsolve (CoinPostsolveMatrix).
Do not underestimate the amount of work required here. Extracting a row from the CoinPostsolve matrix requires a scan of every element in the matrix. That's one scan by the constructor and one scan with every call to modify. But that's precisely why it's virtually impossible to debug presolve without aids.
Parameter overloads for CoinPresolveMatrix and CoinPostsolveMatrix are a little clumsy, but not a problem in use. The alternative is to add methods to the CoinPresolveMatrix and CoinPostsolveMatrix classes that will only be used for debugging. That's not too attractive either.
Definition at line 29 of file CoinPresolveMonitor.hpp.
CoinPresolveMonitor::CoinPresolveMonitor | ( | ) |
Default constructor.
Creates an empty monitor.
CoinPresolveMonitor::CoinPresolveMonitor | ( | const CoinPresolveMatrix * | mtx, |
bool | isRow, | ||
int | k | ||
) |
Initialise from a CoinPresolveMatrix.
Load the initial row or column from a CoinPresolveMatrix. Set isRow
true for a row, false for a column.
CoinPresolveMonitor::CoinPresolveMonitor | ( | const CoinPostsolveMatrix * | mtx, |
bool | isRow, | ||
int | k | ||
) |
Initialise from a CoinPostsolveMatrix.
Load the initial row or column from a CoinPostsolveMatrix. Set isRow
true for a row, false for a column.
void CoinPresolveMonitor::checkAndTell | ( | const CoinPresolveMatrix * | mtx | ) |
Compare the present row or column against the stored copy and report differences.
Load the current row or column from a CoinPresolveMatrix and compare. Differences are printed to std::cout.
void CoinPresolveMonitor::checkAndTell | ( | const CoinPostsolveMatrix * | mtx | ) |
Compare the present row or column against the stored copy and report differences.
Load the current row or column from a CoinPostsolveMatrix and compare. Differences are printed to std::cout.
|
private |
Extract a row from a CoinPresolveMatrix.
|
private |
Extract a column from a CoinPresolveMatrix.
|
private |
Extract a row from a CoinPostsolveMatrix.
|
private |
Extract a column from a CoinPostsolveMatrix.
|
private |
Worker method underlying the public checkAndTell methods.
|
private |
True to monitor a row, false to monitor a column.
Definition at line 84 of file CoinPresolveMonitor.hpp.
|
private |
Row or column index.
Definition at line 87 of file CoinPresolveMonitor.hpp.
|
private |
The original row or column
Sorted in increasing order of indices.
Definition at line 93 of file CoinPresolveMonitor.hpp.
|
private |
Original row or column lower bound.
Definition at line 96 of file CoinPresolveMonitor.hpp.
|
private |
Original row or column upper bound.
Definition at line 99 of file CoinPresolveMonitor.hpp.