Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Friends | List of all members
OsiRowCutDebugger Class Reference

Validate cuts against a known solution. More...

#include <OsiRowCutDebugger.hpp>

Public Member Functions

Validate Row Cuts

Check that the specified cuts do not cut off the known solution.

virtual int validateCuts (const OsiCuts &cs, int first, int last) const
 Check that the set of cuts does not cut off the solution known to the debugger. More...
 
virtual bool invalidCut (const OsiRowCut &rowcut) const
 Check that the cut does not cut off the solution known to the debugger. More...
 
bool onOptimalPath (const OsiSolverInterface &si) const
 Returns true if the solution held in the solver is compatible with the known solution. More...
 
Activate the Debugger

The debugger is considered to be active when it holds a known solution.

bool activate (const OsiSolverInterface &si, const char *model)
 Activate a debugger using the name of a problem. More...
 
bool activate (const OsiSolverInterface &si, const double *solution, bool keepContinuous=false)
 Activate a debugger using a full solution array. More...
 
bool active () const
 Returns true if the debugger is active. More...
 
Query or Manipulate the Known Solution
const double * optimalSolution () const
 Return the known solution. More...
 
int numberColumns () const
 Return the number of columns in the known solution. More...
 
double optimalValue () const
 Return the value of the objective for the known solution. More...
 
void redoSolution (int numberColumns, const int *originalColumns)
 Edit the known solution to reflect column changes. More...
 
int printOptimalSolution (const OsiSolverInterface &si) const
 Print optimal solution (returns -1 bad debug, 0 on optimal, 1 not) More...
 
Constructors and Destructors
 OsiRowCutDebugger ()
 Default constructor - no checking. More...
 
 OsiRowCutDebugger (const OsiSolverInterface &si, const char *model)
 Constructor with name of model. More...
 
 OsiRowCutDebugger (const OsiSolverInterface &si, const double *solution, bool enforceOptimality=false)
 Constructor with full solution. More...
 
 OsiRowCutDebugger (const OsiRowCutDebugger &)
 Copy constructor. More...
 
OsiRowCutDebuggeroperator= (const OsiRowCutDebugger &rhs)
 Assignment operator. More...
 
virtual ~OsiRowCutDebugger ()
 Destructor. More...
 

Private Attributes

Private member data
double knownValue_
 Value of known solution. More...
 
int numberColumns_
 Number of columns in known solution. More...
 
bool * integerVariable_
 array specifying integer variables More...
 
double * knownSolution_
 array specifying known solution More...
 

Friends

void OsiRowCutDebuggerUnitTest (const OsiSolverInterface *siP, const std::string &mpsDir)
 A function that tests the methods in the OsiRowCutDebugger class. More...
 

Detailed Description

Validate cuts against a known solution.

OsiRowCutDebugger provides a facility for validating cuts against a known solution for a problem. The debugger knows an optimal solution for many of the miplib3 problems. Check the source for activate(const OsiSolverInterface&,const char*) in OsiRowCutDebugger.cpp for the full set of known problems.

A full solution vector can be supplied as a parameter with (activate(const OsiSolverInterface&,const double*,bool)). Only the integer values need to be valid. The default behaviour is to solve an lp relaxation with the integer variables fixed to the specified values and use the optimal solution to fill in the continuous variables in the solution. The debugger can be instructed to preserve the continuous variables (useful when debugging solvers where the linear relaxation doesn't capture all the constraints).

Note that the solution must match the problem held in the solver interface. If you want to use the row cut debugger on a problem after applying presolve transformations, your solution must match the presolved problem. (But see redoSolution().)

Definition at line 42 of file OsiRowCutDebugger.hpp.

Constructor & Destructor Documentation

OsiRowCutDebugger::OsiRowCutDebugger ( )

Default constructor - no checking.

OsiRowCutDebugger::OsiRowCutDebugger ( const OsiSolverInterface si,
const char *  model 
)

Constructor with name of model.

See activate(const OsiSolverInterface&,const char*).

OsiRowCutDebugger::OsiRowCutDebugger ( const OsiSolverInterface si,
const double *  solution,
bool  enforceOptimality = false 
)

Constructor with full solution.

See activate(const OsiSolverInterface&,const double*,bool).

OsiRowCutDebugger::OsiRowCutDebugger ( const OsiRowCutDebugger )

Copy constructor.

virtual OsiRowCutDebugger::~OsiRowCutDebugger ( )
virtual

Destructor.

Member Function Documentation

virtual int OsiRowCutDebugger::validateCuts ( const OsiCuts cs,
int  first,
int  last 
) const
virtual

Check that the set of cuts does not cut off the solution known to the debugger.

Check if any generated cuts cut off the solution known to the debugger! If so then print offending cuts. Return the number of invalid cuts.

virtual bool OsiRowCutDebugger::invalidCut ( const OsiRowCut rowcut) const
virtual

Check that the cut does not cut off the solution known to the debugger.

Return true if cut is invalid

bool OsiRowCutDebugger::onOptimalPath ( const OsiSolverInterface si) const

Returns true if the solution held in the solver is compatible with the known solution.

More specifically, returns true if the known solution satisfies the column bounds held in the solver.

bool OsiRowCutDebugger::activate ( const OsiSolverInterface si,
const char *  model 
)

Activate a debugger using the name of a problem.

The debugger knows an optimal solution for most of miplib3. Check the source code for the full list. Returns true if the debugger is successfully activated.

bool OsiRowCutDebugger::activate ( const OsiSolverInterface si,
const double *  solution,
bool  keepContinuous = false 
)

Activate a debugger using a full solution array.

The solution must have one entry for every variable, but only the entries for integer values are used. By default the debugger will solve an lp relaxation with the integer variables fixed and fill in values for the continuous variables from this solution. If the debugger should preserve the given values for the continuous variables, set keepContinuous to true.

Returns true if debugger activates successfully.

bool OsiRowCutDebugger::active ( ) const

Returns true if the debugger is active.

const double* OsiRowCutDebugger::optimalSolution ( ) const
inline

Return the known solution.

Definition at line 110 of file OsiRowCutDebugger.hpp.

int OsiRowCutDebugger::numberColumns ( ) const
inline

Return the number of columns in the known solution.

Definition at line 116 of file OsiRowCutDebugger.hpp.

double OsiRowCutDebugger::optimalValue ( ) const
inline

Return the value of the objective for the known solution.

Definition at line 119 of file OsiRowCutDebugger.hpp.

void OsiRowCutDebugger::redoSolution ( int  numberColumns,
const int *  originalColumns 
)

Edit the known solution to reflect column changes.

Given a translation array originalColumns[numberColumns] which can translate current column indices to original column indices, this method will edit the solution held in the debugger so that it matches the current set of columns.

Useful when the original problem is preprocessed prior to cut generation. The debugger does keep a record of the changes.

int OsiRowCutDebugger::printOptimalSolution ( const OsiSolverInterface si) const

Print optimal solution (returns -1 bad debug, 0 on optimal, 1 not)

OsiRowCutDebugger& OsiRowCutDebugger::operator= ( const OsiRowCutDebugger rhs)

Assignment operator.

Friends And Related Function Documentation

void OsiRowCutDebuggerUnitTest ( const OsiSolverInterface siP,
const std::string &  mpsDir 
)
friend

A function that tests the methods in the OsiRowCutDebugger class.

Member Data Documentation

double OsiRowCutDebugger::knownValue_
private

Value of known solution.

Definition at line 171 of file OsiRowCutDebugger.hpp.

int OsiRowCutDebugger::numberColumns_
private

Number of columns in known solution.

This must match the number of columns reported by the solver.

Definition at line 177 of file OsiRowCutDebugger.hpp.

bool* OsiRowCutDebugger::integerVariable_
private

array specifying integer variables

Definition at line 180 of file OsiRowCutDebugger.hpp.

double* OsiRowCutDebugger::knownSolution_
private

array specifying known solution

Definition at line 183 of file OsiRowCutDebugger.hpp.


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