Abstract base class of all presolve routines. More...
#include <CoinPresolveMatrix.hpp>
Public Member Functions | |
CoinPresolveAction (const CoinPresolveAction *next) | |
Construct a postsolve object and add it to the transformation list. | |
virtual const char * | name () const =0 |
A name for debug printing. | |
virtual void | postsolve (CoinPostsolveMatrix *prob) const =0 |
Apply the postsolve transformation for this particular presolve action. | |
virtual | ~CoinPresolveAction () |
Virtual destructor. | |
Static Public Member Functions | |
static void | throwCoinError (const char *error, const char *ps_routine) |
Stub routine to throw exceptions. | |
Public Attributes | |
const CoinPresolveAction * | next |
The next presolve transformation. |
Abstract base class of all presolve routines.
The details will make more sense after a quick overview of the grand plan: A presolve object is handed a problem object, which it is expected to modify in some useful way. Assuming that it succeeds, the presolve object should create a postsolve object, i.e., an object that contains instructions for backing out the presolve transform to recover the original problem. These postsolve objects are accumlated in a linked list, with each successive presolve action adding its postsolve action to the head of the list. The end result of all this is a presolved problem object, and a list of postsolve objects. The presolved problem object is then handed to a solver for optimization, and the problem object augmented with the results. The list of postsolve objects is then traversed. Each of them (un)modifies the problem object, with the end result being the original problem, augmented with solution information.
The problem object representation is CoinPrePostsolveMatrix and subclasses. Check there for details. The CoinPresolveAction
class and subclasses represent the presolve and postsolve objects.
In spite of the name, the only information held in a CoinPresolveAction
object is the information needed to postsolve (i.e., the information needed to back out the presolve transformation). This information is not expected to change, so the fields are all const
.
A subclass of CoinPresolveAction
, implementing a specific pre/postsolve action, is expected to declare a static function that attempts to perform a presolve transformation. This function will be handed a CoinPresolveMatrix to transform, and a pointer to the head of the list of postsolve objects. If the transform is successful, the function will create a new CoinPresolveAction
object, link it at the head of the list of postsolve objects, and return a pointer to the postsolve object it has just created. Otherwise, it should return 0. It is expected that these static functions will be the only things that can create new CoinPresolveAction
objects; this is expressed by making each subclass' constructor(s) private.
Every subclass must also define a postsolve
method. This function will be handed a CoinPostsolveMatrix to transform.
It is the client's responsibility to implement presolve and postsolve driver routines. See OsiPresolve for examples.
CoinPresolveAction
are const
, anything one can do with a variable declared CoinPresolveAction*
can also be done with a variable declared const
CoinPresolveAction*
It is expected that all derived subclasses of CoinPresolveAction
also have this property. Definition at line 130 of file CoinPresolveMatrix.hpp.
CoinPresolveAction::CoinPresolveAction | ( | const CoinPresolveAction * | next | ) | [inline] |
Construct a postsolve object and add it to the transformation list.
This is an `add to head' operation. This object will point to the one passed as the parameter.
Definition at line 154 of file CoinPresolveMatrix.hpp.
virtual CoinPresolveAction::~CoinPresolveAction | ( | ) | [inline, virtual] |
Virtual destructor.
Definition at line 168 of file CoinPresolveMatrix.hpp.
static void CoinPresolveAction::throwCoinError | ( | const char * | error, | |
const char * | ps_routine | |||
) | [inline, static] |
Stub routine to throw exceptions.
Exceptions are inefficient, particularly with g++. Even with xlC, the use of exceptions adds a long prologue to a routine. Therefore, rather than use throw directly in the routine, I use it in a stub routine.
Definition at line 139 of file CoinPresolveMatrix.hpp.
virtual const char* CoinPresolveAction::name | ( | ) | const [pure virtual] |
A name for debug printing.
It is expected that the name is not stored in the transform itself.
Implemented in doubleton_action, dupcol_action, duprow_action, drop_empty_cols_action, drop_empty_rows_action, remove_fixed_action, make_fixed_action, forcing_constraint_action, implied_free_action, isolated_constraint_action, slack_doubleton_action, slack_singleton_action, subst_constraint_action, do_tighten_action, tripleton_action, useless_constraint_action, and drop_zero_coefficients_action.
virtual void CoinPresolveAction::postsolve | ( | CoinPostsolveMatrix * | prob | ) | const [pure virtual] |
Apply the postsolve transformation for this particular presolve action.
Implemented in doubleton_action, dupcol_action, duprow_action, drop_empty_cols_action, drop_empty_rows_action, remove_fixed_action, make_fixed_action, forcing_constraint_action, implied_free_action, isolated_constraint_action, slack_doubleton_action, slack_singleton_action, subst_constraint_action, do_tighten_action, tripleton_action, useless_constraint_action, and drop_zero_coefficients_action.
The next presolve transformation.
Set at object construction.
Definition at line 147 of file CoinPresolveMatrix.hpp.