Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CoinPresolveAction Class Referenceabstract

Abstract base class of all presolve routines. More...

#include <CoinPresolveMatrix.hpp>

+ Inheritance diagram for CoinPresolveAction:
+ Collaboration diagram for CoinPresolveAction:

Public Member Functions

 CoinPresolveAction (const CoinPresolveAction *next)
 Construct a postsolve object and add it to the transformation list. More...
 
void setNext (const CoinPresolveAction *nextAction)
 modify next (when building rather than passing) More...
 
virtual const char * name () const =0
 A name for debug printing. More...
 
virtual void postsolve (CoinPostsolveMatrix *prob) const =0
 Apply the postsolve transformation for this particular presolve action. More...
 
virtual ~CoinPresolveAction ()
 Virtual destructor. More...
 

Static Public Member Functions

static void throwCoinError (const char *error, const char *ps_routine)
 Stub routine to throw exceptions. More...
 

Public Attributes

const CoinPresolveActionnext
 The next presolve transformation. More...
 

Detailed Description

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

Note
Since the only fields in a 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 155 of file CoinPresolveMatrix.hpp.

Constructor & Destructor Documentation

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 178 of file CoinPresolveMatrix.hpp.

virtual CoinPresolveAction::~CoinPresolveAction ( )
inlinevirtual

Virtual destructor.

Definition at line 195 of file CoinPresolveMatrix.hpp.

Member Function Documentation

static void CoinPresolveAction::throwCoinError ( const char *  error,
const char *  ps_routine 
)
inlinestatic

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 164 of file CoinPresolveMatrix.hpp.

void CoinPresolveAction::setNext ( const CoinPresolveAction nextAction)
inline

modify next (when building rather than passing)

Definition at line 180 of file CoinPresolveMatrix.hpp.

virtual const char* CoinPresolveAction::name ( ) const
pure virtual
virtual void CoinPresolveAction::postsolve ( CoinPostsolveMatrix prob) const
pure virtual

Member Data Documentation

const CoinPresolveAction* CoinPresolveAction::next

The next presolve transformation.

Set at object construction.

Definition at line 171 of file CoinPresolveMatrix.hpp.


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