CoinUtils
2.10.13
|
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... | |
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.