CoinUtils  2.10.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | List of all members
CoinSnapshot Class Reference

NON Abstract Base Class for interfacing with cut generators or branching code or . More...

#include <CoinSnapshot.hpp>

Public Member Functions

Problem query methods

The Matrix pointers may be NULL

int getNumCols () const
 Get number of columns. More...
 
int getNumRows () const
 Get number of rows. More...
 
int getNumElements () const
 Get number of nonzero elements. More...
 
int getNumIntegers () const
 Get number of integer variables. More...
 
const double * getColLower () const
 Get pointer to array[getNumCols()] of column lower bounds. More...
 
const double * getColUpper () const
 Get pointer to array[getNumCols()] of column upper bounds. More...
 
const double * getRowLower () const
 Get pointer to array[getNumRows()] of row lower bounds. More...
 
const double * getRowUpper () const
 Get pointer to array[getNumRows()] of row upper bounds. More...
 
const double * getRightHandSide () const
 Get pointer to array[getNumRows()] of row right-hand sides This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i]. More...
 
const double * getObjCoefficients () const
 Get pointer to array[getNumCols()] of objective function coefficients. More...
 
double getObjSense () const
 Get objective function sense (1 for min (default), -1 for max) More...
 
bool isContinuous (int colIndex) const
 Return true if variable is continuous. More...
 
bool isBinary (int colIndex) const
 Return true if variable is binary. More...
 
bool isInteger (int colIndex) const
 Return true if column is integer. More...
 
bool isIntegerNonBinary (int colIndex) const
 Return true if variable is general integer. More...
 
bool isFreeBinary (int colIndex) const
 Return true if variable is binary and not fixed at either bound. More...
 
const char * getColType () const
 Get colType array ('B', 'I', or 'C' for Binary, Integer and Continuous) More...
 
const CoinPackedMatrixgetMatrixByRow () const
 Get pointer to row-wise copy of current matrix. More...
 
const CoinPackedMatrixgetMatrixByCol () const
 Get pointer to column-wise copy of current matrix. More...
 
const CoinPackedMatrixgetOriginalMatrixByRow () const
 Get pointer to row-wise copy of "original" matrix. More...
 
const CoinPackedMatrixgetOriginalMatrixByCol () const
 Get pointer to column-wise copy of "original" matrix. More...
 
Solution query methods
const double * getColSolution () const
 Get pointer to array[getNumCols()] of primal variable values. More...
 
const double * getRowPrice () const
 Get pointer to array[getNumRows()] of dual variable values. More...
 
const double * getReducedCost () const
 Get a pointer to array[getNumCols()] of reduced costs. More...
 
const double * getRowActivity () const
 Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector). More...
 
const double * getDoNotSeparateThis () const
 Get pointer to array[getNumCols()] of primal variable values which should not be separated (for debug) More...
 
Other scalar get methods
double getInfinity () const
 Get solver's value for infinity. More...
 
double getObjValue () const
 Get objective function value - includinbg any offset i.e. More...
 
double getObjOffset () const
 Get objective offset i.e. sum c sub j * x subj -objValue = objOffset. More...
 
double getDualTolerance () const
 Get dual tolerance. More...
 
double getPrimalTolerance () const
 Get primal tolerance. More...
 
double getIntegerTolerance () const
 Get integer tolerance. More...
 
double getIntegerUpperBound () const
 Get integer upper bound i.e. best solution * getObjSense. More...
 
double getIntegerLowerBound () const
 Get integer lower bound i.e. best possible solution * getObjSense. More...
 
Method to input a problem
void loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub, bool makeRowCopy=false)
 Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds). More...
 
Methods to set data
void setNumCols (int value)
 Set number of columns. More...
 
void setNumRows (int value)
 Set number of rows. More...
 
void setNumElements (int value)
 Set number of nonzero elements. More...
 
void setNumIntegers (int value)
 Set number of integer variables. More...
 
void setColLower (const double *array, bool copyIn=true)
 Set pointer to array[getNumCols()] of column lower bounds. More...
 
void setColUpper (const double *array, bool copyIn=true)
 Set pointer to array[getNumCols()] of column upper bounds. More...
 
void setRowLower (const double *array, bool copyIn=true)
 Set pointer to array[getNumRows()] of row lower bounds. More...
 
void setRowUpper (const double *array, bool copyIn=true)
 Set pointer to array[getNumRows()] of row upper bounds. More...
 
void setRightHandSide (const double *array, bool copyIn=true)
 Set pointer to array[getNumRows()] of row right-hand sides This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i]. More...
 
void createRightHandSide ()
 Create array[getNumRows()] of row right-hand sides using existing information This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i]. More...
 
void setObjCoefficients (const double *array, bool copyIn=true)
 Set pointer to array[getNumCols()] of objective function coefficients. More...
 
void setObjSense (double value)
 Set objective function sense (1 for min (default), -1 for max) More...
 
void setColType (const char *array, bool copyIn=true)
 Set colType array ('B', 'I', or 'C' for Binary, Integer and Continuous) More...
 
void setMatrixByRow (const CoinPackedMatrix *matrix, bool copyIn=true)
 Set pointer to row-wise copy of current matrix. More...
 
void createMatrixByRow ()
 Create row-wise copy from MatrixByCol. More...
 
void setMatrixByCol (const CoinPackedMatrix *matrix, bool copyIn=true)
 Set pointer to column-wise copy of current matrix. More...
 
void setOriginalMatrixByRow (const CoinPackedMatrix *matrix, bool copyIn=true)
 Set pointer to row-wise copy of "original" matrix. More...
 
void setOriginalMatrixByCol (const CoinPackedMatrix *matrix, bool copyIn=true)
 Set pointer to column-wise copy of "original" matrix. More...
 
void setColSolution (const double *array, bool copyIn=true)
 Set pointer to array[getNumCols()] of primal variable values. More...
 
void setRowPrice (const double *array, bool copyIn=true)
 Set pointer to array[getNumRows()] of dual variable values. More...
 
void setReducedCost (const double *array, bool copyIn=true)
 Set a pointer to array[getNumCols()] of reduced costs. More...
 
void setRowActivity (const double *array, bool copyIn=true)
 Set pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector). More...
 
void setDoNotSeparateThis (const double *array, bool copyIn=true)
 Set pointer to array[getNumCols()] of primal variable values which should not be separated (for debug) More...
 
void setInfinity (double value)
 Set solver's value for infinity. More...
 
void setObjValue (double value)
 Set objective function value (including any rhs offset) More...
 
void setObjOffset (double value)
 Set objective offset i.e. sum c sub j * x subj -objValue = objOffset. More...
 
void setDualTolerance (double value)
 Set dual tolerance. More...
 
void setPrimalTolerance (double value)
 Set primal tolerance. More...
 
void setIntegerTolerance (double value)
 Set integer tolerance. More...
 
void setIntegerUpperBound (double value)
 Set integer upper bound i.e. best solution * getObjSense. More...
 
void setIntegerLowerBound (double value)
 Set integer lower bound i.e. best possible solution * getObjSense. More...
 
Constructors and destructors
 CoinSnapshot ()
 Default Constructor. More...
 
 CoinSnapshot (const CoinSnapshot &)
 Copy constructor. More...
 
CoinSnapshotoperator= (const CoinSnapshot &rhs)
 Assignment operator. More...
 
virtual ~CoinSnapshot ()
 Destructor. More...
 

Detailed Description

NON Abstract Base Class for interfacing with cut generators or branching code or .

It is designed to be snapshot of a problem at a node in tree

The class may or may not own the arrays - see owned_

Querying a problem that has no data associated with it will result in zeros for the number of rows and columns, and NULL pointers from the methods that return arrays.

Definition at line 25 of file CoinSnapshot.hpp.

Constructor & Destructor Documentation

CoinSnapshot::CoinSnapshot ( )

Default Constructor.

CoinSnapshot::CoinSnapshot ( const CoinSnapshot )

Copy constructor.

virtual CoinSnapshot::~CoinSnapshot ( )
virtual

Destructor.

Member Function Documentation

int CoinSnapshot::getNumCols ( ) const
inline

Get number of columns.

Definition at line 36 of file CoinSnapshot.hpp.

int CoinSnapshot::getNumRows ( ) const
inline

Get number of rows.

Definition at line 40 of file CoinSnapshot.hpp.

int CoinSnapshot::getNumElements ( ) const
inline

Get number of nonzero elements.

Definition at line 44 of file CoinSnapshot.hpp.

int CoinSnapshot::getNumIntegers ( ) const
inline

Get number of integer variables.

Definition at line 48 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getColLower ( ) const
inline

Get pointer to array[getNumCols()] of column lower bounds.

Definition at line 52 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getColUpper ( ) const
inline

Get pointer to array[getNumCols()] of column upper bounds.

Definition at line 56 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getRowLower ( ) const
inline

Get pointer to array[getNumRows()] of row lower bounds.

Definition at line 60 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getRowUpper ( ) const
inline

Get pointer to array[getNumRows()] of row upper bounds.

Definition at line 64 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getRightHandSide ( ) const
inline

Get pointer to array[getNumRows()] of row right-hand sides This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i].

Definition at line 74 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getObjCoefficients ( ) const
inline

Get pointer to array[getNumCols()] of objective function coefficients.

Definition at line 78 of file CoinSnapshot.hpp.

double CoinSnapshot::getObjSense ( ) const
inline

Get objective function sense (1 for min (default), -1 for max)

Definition at line 82 of file CoinSnapshot.hpp.

bool CoinSnapshot::isContinuous ( int  colIndex) const
inline

Return true if variable is continuous.

Definition at line 86 of file CoinSnapshot.hpp.

bool CoinSnapshot::isBinary ( int  colIndex) const
inline

Return true if variable is binary.

Definition at line 90 of file CoinSnapshot.hpp.

bool CoinSnapshot::isInteger ( int  colIndex) const
inline

Return true if column is integer.

Definition at line 94 of file CoinSnapshot.hpp.

bool CoinSnapshot::isIntegerNonBinary ( int  colIndex) const
inline

Return true if variable is general integer.

Definition at line 98 of file CoinSnapshot.hpp.

bool CoinSnapshot::isFreeBinary ( int  colIndex) const
inline

Return true if variable is binary and not fixed at either bound.

Definition at line 102 of file CoinSnapshot.hpp.

const char* CoinSnapshot::getColType ( ) const
inline

Get colType array ('B', 'I', or 'C' for Binary, Integer and Continuous)

Definition at line 106 of file CoinSnapshot.hpp.

const CoinPackedMatrix* CoinSnapshot::getMatrixByRow ( ) const
inline

Get pointer to row-wise copy of current matrix.

Definition at line 110 of file CoinSnapshot.hpp.

const CoinPackedMatrix* CoinSnapshot::getMatrixByCol ( ) const
inline

Get pointer to column-wise copy of current matrix.

Definition at line 114 of file CoinSnapshot.hpp.

const CoinPackedMatrix* CoinSnapshot::getOriginalMatrixByRow ( ) const
inline

Get pointer to row-wise copy of "original" matrix.

Definition at line 118 of file CoinSnapshot.hpp.

const CoinPackedMatrix* CoinSnapshot::getOriginalMatrixByCol ( ) const
inline

Get pointer to column-wise copy of "original" matrix.

Definition at line 122 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getColSolution ( ) const
inline

Get pointer to array[getNumCols()] of primal variable values.

Definition at line 129 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getRowPrice ( ) const
inline

Get pointer to array[getNumRows()] of dual variable values.

Definition at line 133 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getReducedCost ( ) const
inline

Get a pointer to array[getNumCols()] of reduced costs.

Definition at line 137 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getRowActivity ( ) const
inline

Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector).

Definition at line 141 of file CoinSnapshot.hpp.

const double* CoinSnapshot::getDoNotSeparateThis ( ) const
inline

Get pointer to array[getNumCols()] of primal variable values which should not be separated (for debug)

Definition at line 145 of file CoinSnapshot.hpp.

double CoinSnapshot::getInfinity ( ) const
inline

Get solver's value for infinity.

Definition at line 152 of file CoinSnapshot.hpp.

double CoinSnapshot::getObjValue ( ) const
inline

Get objective function value - includinbg any offset i.e.

sum c sub j * x subj - objValue = objOffset

Definition at line 157 of file CoinSnapshot.hpp.

double CoinSnapshot::getObjOffset ( ) const
inline

Get objective offset i.e. sum c sub j * x subj -objValue = objOffset.

Definition at line 161 of file CoinSnapshot.hpp.

double CoinSnapshot::getDualTolerance ( ) const
inline

Get dual tolerance.

Definition at line 165 of file CoinSnapshot.hpp.

double CoinSnapshot::getPrimalTolerance ( ) const
inline

Get primal tolerance.

Definition at line 169 of file CoinSnapshot.hpp.

double CoinSnapshot::getIntegerTolerance ( ) const
inline

Get integer tolerance.

Definition at line 173 of file CoinSnapshot.hpp.

double CoinSnapshot::getIntegerUpperBound ( ) const
inline

Get integer upper bound i.e. best solution * getObjSense.

Definition at line 177 of file CoinSnapshot.hpp.

double CoinSnapshot::getIntegerLowerBound ( ) const
inline

Get integer lower bound i.e. best possible solution * getObjSense.

Definition at line 181 of file CoinSnapshot.hpp.

void CoinSnapshot::loadProblem ( const CoinPackedMatrix matrix,
const double *  collb,
const double *  colub,
const double *  obj,
const double *  rowlb,
const double *  rowub,
bool  makeRowCopy = false 
)

Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper bounds).

If a pointer is NULL then the following values are the default:

  • colub: all columns have upper bound infinity
  • collb: all columns have lower bound 0
  • rowub: all rows have upper bound infinity
  • rowlb: all rows have lower bound -infinity
  • obj: all variables have 0 objective coefficient

All solution type arrays will be deleted

void CoinSnapshot::setNumCols ( int  value)
inline

Set number of columns.

Definition at line 214 of file CoinSnapshot.hpp.

void CoinSnapshot::setNumRows ( int  value)
inline

Set number of rows.

Definition at line 218 of file CoinSnapshot.hpp.

void CoinSnapshot::setNumElements ( int  value)
inline

Set number of nonzero elements.

Definition at line 222 of file CoinSnapshot.hpp.

void CoinSnapshot::setNumIntegers ( int  value)
inline

Set number of integer variables.

Definition at line 226 of file CoinSnapshot.hpp.

void CoinSnapshot::setColLower ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumCols()] of column lower bounds.

void CoinSnapshot::setColUpper ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumCols()] of column upper bounds.

void CoinSnapshot::setRowLower ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumRows()] of row lower bounds.

void CoinSnapshot::setRowUpper ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumRows()] of row upper bounds.

void CoinSnapshot::setRightHandSide ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumRows()] of row right-hand sides This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i].

void CoinSnapshot::createRightHandSide ( )

Create array[getNumRows()] of row right-hand sides using existing information This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i].

void CoinSnapshot::setObjCoefficients ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumCols()] of objective function coefficients.

void CoinSnapshot::setObjSense ( double  value)
inline

Set objective function sense (1 for min (default), -1 for max)

Definition at line 264 of file CoinSnapshot.hpp.

void CoinSnapshot::setColType ( const char *  array,
bool  copyIn = true 
)

Set colType array ('B', 'I', or 'C' for Binary, Integer and Continuous)

void CoinSnapshot::setMatrixByRow ( const CoinPackedMatrix matrix,
bool  copyIn = true 
)

Set pointer to row-wise copy of current matrix.

void CoinSnapshot::createMatrixByRow ( )

Create row-wise copy from MatrixByCol.

void CoinSnapshot::setMatrixByCol ( const CoinPackedMatrix matrix,
bool  copyIn = true 
)

Set pointer to column-wise copy of current matrix.

void CoinSnapshot::setOriginalMatrixByRow ( const CoinPackedMatrix matrix,
bool  copyIn = true 
)

Set pointer to row-wise copy of "original" matrix.

void CoinSnapshot::setOriginalMatrixByCol ( const CoinPackedMatrix matrix,
bool  copyIn = true 
)

Set pointer to column-wise copy of "original" matrix.

void CoinSnapshot::setColSolution ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumCols()] of primal variable values.

void CoinSnapshot::setRowPrice ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumRows()] of dual variable values.

void CoinSnapshot::setReducedCost ( const double *  array,
bool  copyIn = true 
)

Set a pointer to array[getNumCols()] of reduced costs.

void CoinSnapshot::setRowActivity ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector).

void CoinSnapshot::setDoNotSeparateThis ( const double *  array,
bool  copyIn = true 
)

Set pointer to array[getNumCols()] of primal variable values which should not be separated (for debug)

void CoinSnapshot::setInfinity ( double  value)
inline

Set solver's value for infinity.

Definition at line 301 of file CoinSnapshot.hpp.

void CoinSnapshot::setObjValue ( double  value)
inline

Set objective function value (including any rhs offset)

Definition at line 305 of file CoinSnapshot.hpp.

void CoinSnapshot::setObjOffset ( double  value)
inline

Set objective offset i.e. sum c sub j * x subj -objValue = objOffset.

Definition at line 309 of file CoinSnapshot.hpp.

void CoinSnapshot::setDualTolerance ( double  value)
inline

Set dual tolerance.

Definition at line 313 of file CoinSnapshot.hpp.

void CoinSnapshot::setPrimalTolerance ( double  value)
inline

Set primal tolerance.

Definition at line 317 of file CoinSnapshot.hpp.

void CoinSnapshot::setIntegerTolerance ( double  value)
inline

Set integer tolerance.

Definition at line 321 of file CoinSnapshot.hpp.

void CoinSnapshot::setIntegerUpperBound ( double  value)
inline

Set integer upper bound i.e. best solution * getObjSense.

Definition at line 325 of file CoinSnapshot.hpp.

void CoinSnapshot::setIntegerLowerBound ( double  value)
inline

Set integer lower bound i.e. best possible solution * getObjSense.

Definition at line 329 of file CoinSnapshot.hpp.

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

Assignment operator.


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