#include <CbcBranchBase.hpp>
Inheritance diagram for CbcBranchingObject:
Public Member Functions | |
CbcBranchingObject () | |
Default Constructor. | |
CbcBranchingObject (CbcModel *model, int variable, int way, double value) | |
Constructor. | |
CbcBranchingObject (const CbcBranchingObject &) | |
Copy constructor. | |
CbcBranchingObject & | operator= (const CbcBranchingObject &rhs) |
Assignment operator. | |
virtual CbcBranchingObject * | clone () const =0 |
Clone. | |
virtual | ~CbcBranchingObject () |
Destructor. | |
virtual int | fillStrongInfo (CbcStrongInfo &info) |
Some branchingObjects may claim to be able to skip strong branching. | |
void | resetNumberBranchesLeft () |
Reset number of branches left to original. | |
void | setNumberBranches (int value) |
Set number of branches to do. | |
virtual double | branch ()=0 |
Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state. | |
virtual double | branch (OsiSolverInterface *solver) |
Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state. | |
virtual void | fix (OsiSolverInterface *solver, double *lower, double *upper, int branchState) const |
Update bounds in solver as in 'branch' and update given bounds. | |
virtual void | previousBranch () |
Reset every information so that the branching object appears to point to the previous child. | |
virtual void | print () const |
Print something about branch - only if log level high. | |
int | variable () const |
Index identifying the associated CbcObject within its class. | |
int | way () const |
Get the state of the branching object. | |
void | way (int way) |
Set the state of the branching object. | |
void | setModel (CbcModel *model) |
update model | |
CbcModel * | model () const |
Return model. | |
CbcObject * | object () const |
Return pointer back to object which created. | |
void | setOriginalObject (CbcObject *object) |
Set pointer back to object which created. | |
virtual int | type () const =0 |
Return the type (an integer identifier) of this . | |
virtual int | compareOriginalObject (const CbcBranchingObject *brObj) const |
Compare the original object of this with the original object of brObj . | |
virtual CbcRangeCompare | compareBranchingObject (const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)=0 |
Compare the this with brObj . | |
Protected Attributes | |
CbcModel * | model_ |
The model that owns this branching object. | |
CbcObject * | originalCbcObject_ |
Pointer back to object which created. | |
int | variable_ |
Branching variable (0 is first integer). | |
int | way_ |
The state of the branching object. |
In the abstract, an CbcBranchingObject contains instructions for how to branch. We want an abstract class so that we can describe how to branch on simple objects (e.g., integers) and more exotic objects (e.g., cliques or hyperplanes).
The branch() method is the crucial routine: it is expected to be able to step through a set of branch arms, executing the actions required to create each subproblem in turn. The base class is primarily virtual to allow for a wide range of problem modifications.
See CbcObject for an overview of the three classes (CbcObject, CbcBranchingObject, and CbcBranchDecision) which make up cbc's branching model.
Definition at line 264 of file CbcBranchBase.hpp.
CbcBranchingObject::CbcBranchingObject | ( | ) |
Default Constructor.
CbcBranchingObject::CbcBranchingObject | ( | CbcModel * | model, | |
int | variable, | |||
int | way, | |||
double | value | |||
) |
Constructor.
CbcBranchingObject::CbcBranchingObject | ( | const CbcBranchingObject & | ) |
Copy constructor.
virtual CbcBranchingObject::~CbcBranchingObject | ( | ) | [virtual] |
Destructor.
CbcBranchingObject& CbcBranchingObject::operator= | ( | const CbcBranchingObject & | rhs | ) |
Assignment operator.
virtual CbcBranchingObject* CbcBranchingObject::clone | ( | ) | const [pure virtual] |
Clone.
Implements OsiBranchingObject.
Implemented in CbcLinkBranchingObject, CbcIntegerBranchingObject, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSOSBranchingObject, CbcNWayBranchingObject, CbcFixingBranchingObject, CbcDummyBranchingObject, CbcCutBranchingObject, CbcDynamicPseudoCostBranchingObject, and CbcLotsizeBranchingObject.
virtual int CbcBranchingObject::fillStrongInfo | ( | CbcStrongInfo & | info | ) | [inline, virtual] |
Some branchingObjects may claim to be able to skip strong branching.
If so they ahve to fill in CbcStrongInfo. The object mention in incoming CbcStrongInfo must match. Returns nonzero if skip is wanted
Reimplemented in CbcDynamicPseudoCostBranchingObject.
Definition at line 290 of file CbcBranchBase.hpp.
void CbcBranchingObject::resetNumberBranchesLeft | ( | ) | [inline] |
Reset number of branches left to original.
Definition at line 292 of file CbcBranchBase.hpp.
References OsiBranchingObject::branchIndex_.
void CbcBranchingObject::setNumberBranches | ( | int | value | ) | [inline] |
Set number of branches to do.
Definition at line 295 of file CbcBranchBase.hpp.
References OsiBranchingObject::branchIndex_, and OsiBranchingObject::numberBranches_.
virtual double CbcBranchingObject::branch | ( | ) | [pure virtual] |
Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state.
Mainly for diagnostics, whether it is true branch or strong branching is also passed. Returns change in guessed objective on next branch
Reimplemented from OsiBranchingObject.
Implemented in CbcLinkBranchingObject, CbcIntegerBranchingObject, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSOSBranchingObject, CbcNWayBranchingObject, CbcFixingBranchingObject, CbcDummyBranchingObject, CbcCutBranchingObject, CbcDynamicPseudoCostBranchingObject, and CbcLotsizeBranchingObject.
Referenced by branch().
virtual double CbcBranchingObject::branch | ( | OsiSolverInterface * | solver | ) | [inline, virtual] |
Execute the actions required to branch, as specified by the current state of the branching object, and advance the object's state.
Mainly for diagnostics, whether it is true branch or strong branching is also passed. Returns change in guessed objective on next branch
Implements OsiBranchingObject.
Definition at line 311 of file CbcBranchBase.hpp.
References branch().
virtual void CbcBranchingObject::fix | ( | OsiSolverInterface * | solver, | |
double * | lower, | |||
double * | upper, | |||
int | branchState | |||
) | const [inline, virtual] |
Update bounds in solver as in 'branch' and update given bounds.
branchState is -1 for 'down' +1 for 'up'
Reimplemented in CbcIntegerBranchingObject, and CbcSOSBranchingObject.
Definition at line 315 of file CbcBranchBase.hpp.
virtual void CbcBranchingObject::previousBranch | ( | ) | [inline, virtual] |
Reset every information so that the branching object appears to point to the previous child.
This method does not need to modify anything in any solver.
Reimplemented in CbcSOSBranchingObject.
Definition at line 322 of file CbcBranchBase.hpp.
References OsiBranchingObject::branchIndex_, and way_.
Referenced by CbcSOSBranchingObject::previousBranch().
virtual void CbcBranchingObject::print | ( | ) | const [inline, virtual] |
Print something about branch - only if log level high.
Definition at line 331 of file CbcBranchBase.hpp.
int CbcBranchingObject::variable | ( | ) | const [inline] |
Index identifying the associated CbcObject within its class.
The name is misleading, and typically the index will not refer directly to a variable. Rather, it identifies an CbcObject within the class of similar CbcObjects
E.g., for an CbcSimpleInteger, variable() is the index of the integer variable in the set of integer variables (not the index of the variable in the set of all variables).
Definition at line 344 of file CbcBranchBase.hpp.
References variable_.
Referenced by compareOriginalObject().
int CbcBranchingObject::way | ( | ) | const [inline] |
Get the state of the branching object.
Returns a code indicating the active arm of the branching object. The precise meaning is defined in the derived class.
Definition at line 354 of file CbcBranchBase.hpp.
References way_.
void CbcBranchingObject::way | ( | int | way | ) | [inline] |
Set the state of the branching object.
See way()
Definition at line 361 of file CbcBranchBase.hpp.
References way_.
void CbcBranchingObject::setModel | ( | CbcModel * | model | ) | [inline] |
CbcModel* CbcBranchingObject::model | ( | ) | const [inline] |
Return model.
Definition at line 368 of file CbcBranchBase.hpp.
References model_.
Referenced by setModel().
CbcObject* CbcBranchingObject::object | ( | ) | const [inline] |
Return pointer back to object which created.
Reimplemented in CbcDynamicPseudoCostBranchingObject.
Definition at line 372 of file CbcBranchBase.hpp.
References originalCbcObject_.
Referenced by setOriginalObject().
void CbcBranchingObject::setOriginalObject | ( | CbcObject * | object | ) | [inline] |
Set pointer back to object which created.
Definition at line 375 of file CbcBranchBase.hpp.
References object(), and originalCbcObject_.
virtual int CbcBranchingObject::type | ( | ) | const [pure virtual] |
Return the type (an integer identifier) of this
.
Implemented in CbcLinkBranchingObject, CbcIntegerBranchingObject, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSOSBranchingObject, CbcNWayBranchingObject, CbcFixingBranchingObject, CbcDummyBranchingObject, CbcCutBranchingObject, CbcDynamicPseudoCostBranchingObject, and CbcLotsizeBranchingObject.
virtual int CbcBranchingObject::compareOriginalObject | ( | const CbcBranchingObject * | brObj | ) | const [inline, virtual] |
Compare the original object of this
with the original object of brObj
.
Assumes that there is an ordering of the original objects. This method should be invoked only if this
and brObj are of the same type. Return negative/0/positive depending on whether this
is smaller/same/larger than the argument.
Reimplemented in CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSOSBranchingObject, CbcNWayBranchingObject, CbcFixingBranchingObject, CbcDummyBranchingObject, and CbcCutBranchingObject.
Definition at line 390 of file CbcBranchBase.hpp.
References variable().
virtual CbcRangeCompare CbcBranchingObject::compareBranchingObject | ( | const CbcBranchingObject * | brObj, | |
const bool | replaceIfOverlap = false | |||
) | [pure virtual] |
Compare the this
with brObj
.
this
and brObj
must be os the same type and must have the same original object, but they may have different feasible regions. Return the appropriate CbcRangeCompare value (first argument being the sub/superset if that's the case). In case of overlap (and if replaceIfOverlap
is true) replace the current branching object with one whose feasible region is the overlap.
Implemented in CbcLinkBranchingObject, CbcIntegerBranchingObject, CbcIntegerPseudoCostBranchingObject, CbcCliqueBranchingObject, CbcLongCliqueBranchingObject, CbcSOSBranchingObject, CbcNWayBranchingObject, CbcFixingBranchingObject, CbcDummyBranchingObject, CbcCutBranchingObject, and CbcLotsizeBranchingObject.
CbcModel* CbcBranchingObject::model_ [protected] |
The model that owns this branching object.
Definition at line 410 of file CbcBranchBase.hpp.
Referenced by model(), and setModel().
CbcObject* CbcBranchingObject::originalCbcObject_ [protected] |
Pointer back to object which created.
Definition at line 412 of file CbcBranchBase.hpp.
Referenced by object(), and setOriginalObject().
int CbcBranchingObject::variable_ [protected] |
Branching variable (0 is first integer).
Definition at line 415 of file CbcBranchBase.hpp.
Referenced by variable().
int CbcBranchingObject::way_ [protected] |
The state of the branching object.
Specifies the active arm of the branching object. Coded as -1 to take the `down' arm, +1 for the `up' arm. `Down' and `up' are defined based on the natural meaning (floor and ceiling, respectively) for a simple integer. The precise meaning is defined in the derived class.
Definition at line 424 of file CbcBranchBase.hpp.
Referenced by previousBranch(), and way().