#include <BcpsBranchObject.h>
Inheritance diagram for BcpsBranchObject:
Public Member Functions | |
BcpsBranchObject () | |
Default Constructor. | |
BcpsBranchObject (BcpsModel *model, int objectIndex, int direction, double value) | |
Useful constructor. | |
BcpsBranchObject (BcpsModel *model, int objectIndex, int upScore, double downScore, int direction, double value) | |
Useful constructor. | |
BcpsBranchObject (const BcpsBranchObject &) | |
Copy constructor. | |
virtual | ~BcpsBranchObject () |
Destructor. | |
BcpsBranchObject & | operator= (const BcpsBranchObject &rhs) |
Assignment operator. | |
virtual BcpsBranchObject * | clone () const =0 |
Clone a object. | |
int | getType () |
Get type. | |
void | setType (int t) |
Set type. | |
virtual int | numBranches () const |
The number of branch arms created for this branch object. | |
virtual int | numBranchesLeft () const |
The number of branch arms left to be evaluated. | |
virtual double | branch (bool normalBranch=false)=0 |
Perform branching as specified by the branching object. | |
virtual void | print (bool normalBranch) |
Print information about this branching object. | |
virtual bool | boundBranch () const |
Return true if branching should fix object bounds. | |
int | getObjectIndex () const |
Object objectIndex. | |
void | setObjectIndex (int ind) |
Set object objectIndex. | |
double | getUpScore () const |
Get integer score. | |
void | setUpScore (double score) |
Set integer score. | |
double | getDownScore () const |
Get double score. | |
void | setDownScore (double score) |
Get double score. | |
int | getDirection () const |
Returns a code indicating the active arm of the branching object. | |
void | setDirection (int direction) |
Set the direction of the branching object. | |
double | getValue () const |
Return object branching value. | |
BcpsModel * | model () const |
Return model. | |
virtual AlpsReturnStatus | encode (AlpsEncoded *encoded) const |
Pack to an encoded object. | |
virtual AlpsReturnStatus | decode (AlpsEncoded &encoded) |
Unpack a branching object from an encoded object. | |
Protected Member Functions | |
AlpsReturnStatus | encodeBcps (AlpsEncoded *encoded) const |
Pack Bcps portion to an encoded object. | |
AlpsReturnStatus | decodeBcps (AlpsEncoded &encoded) |
Unpack Bcps portion from an encoded object. | |
Protected Attributes | |
int | type_ |
Type of branching. | |
BcpsModel * | model_ |
The model that owns this branch object. | |
int | objectIndex_ |
Branch object index. | |
double | upScore_ |
The score of branching up. | |
double | downScore_ |
The score of branching down. | |
int | direction_ |
The direction of the active branch. | |
double | value_ |
Current branching value. | |
int | numBranchesLeft_ |
Number of arms remaining to be evaluated. |
It also has the member funtions of to do branching by adjusting bounds, etc. in solver. Branching object can be simple integers or more complicated ones like SOS.
Definition at line 47 of file BcpsBranchObject.h.
BcpsBranchObject::BcpsBranchObject | ( | ) | [inline] |
BcpsBranchObject::BcpsBranchObject | ( | BcpsModel * | model, | |
int | objectIndex, | |||
int | direction, | |||
double | value | |||
) | [inline] |
BcpsBranchObject::BcpsBranchObject | ( | BcpsModel * | model, | |
int | objectIndex, | |||
int | upScore, | |||
double | downScore, | |||
int | direction, | |||
double | value | |||
) | [inline] |
BcpsBranchObject::BcpsBranchObject | ( | const BcpsBranchObject & | ) |
Copy constructor.
virtual BcpsBranchObject::~BcpsBranchObject | ( | ) | [inline, virtual] |
BcpsBranchObject& BcpsBranchObject::operator= | ( | const BcpsBranchObject & | rhs | ) |
Assignment operator.
virtual BcpsBranchObject* BcpsBranchObject::clone | ( | ) | const [pure virtual] |
int BcpsBranchObject::getType | ( | ) | [inline] |
Get type.
Definition at line 150 of file BcpsBranchObject.h.
References type_.
Referenced by BcpsTreeNode::encodeBcps().
void BcpsBranchObject::setType | ( | int | t | ) | [inline] |
virtual int BcpsBranchObject::numBranches | ( | ) | const [inline, virtual] |
The number of branch arms created for this branch object.
Definition at line 156 of file BcpsBranchObject.h.
virtual int BcpsBranchObject::numBranchesLeft | ( | ) | const [inline, virtual] |
The number of branch arms left to be evaluated.
Definition at line 159 of file BcpsBranchObject.h.
References numBranchesLeft_.
virtual double BcpsBranchObject::branch | ( | bool | normalBranch = false |
) | [pure virtual] |
Perform branching as specified by the branching object.
Also, update the status of this branching object.
Implemented in BlisBranchObjectInt, and BlisBranchObjectInt.
virtual void BcpsBranchObject::print | ( | bool | normalBranch | ) | [inline, virtual] |
Print information about this branching object.
Reimplemented in BlisBranchObjectInt, and BlisBranchObjectInt.
Definition at line 167 of file BcpsBranchObject.h.
virtual bool BcpsBranchObject::boundBranch | ( | ) | const [inline, virtual] |
Return true if branching should fix object bounds.
Definition at line 170 of file BcpsBranchObject.h.
int BcpsBranchObject::getObjectIndex | ( | ) | const [inline] |
void BcpsBranchObject::setObjectIndex | ( | int | ind | ) | [inline] |
double BcpsBranchObject::getUpScore | ( | ) | const [inline] |
void BcpsBranchObject::setUpScore | ( | double | score | ) | [inline] |
double BcpsBranchObject::getDownScore | ( | ) | const [inline] |
void BcpsBranchObject::setDownScore | ( | double | score | ) | [inline] |
int BcpsBranchObject::getDirection | ( | ) | const [inline] |
Returns a code indicating the active arm of the branching object.
Definition at line 191 of file BcpsBranchObject.h.
References direction_.
void BcpsBranchObject::setDirection | ( | int | direction | ) | [inline] |
Set the direction of the branching object.
Definition at line 194 of file BcpsBranchObject.h.
References direction_.
double BcpsBranchObject::getValue | ( | ) | const [inline] |
Return object branching value.
Definition at line 197 of file BcpsBranchObject.h.
References value_.
BcpsModel* BcpsBranchObject::model | ( | ) | const [inline] |
Return model.
Definition at line 200 of file BcpsBranchObject.h.
References model_.
Referenced by BlisBranchObjectInt::BlisBranchObjectInt().
AlpsReturnStatus BcpsBranchObject::encodeBcps | ( | AlpsEncoded * | encoded | ) | const [inline, protected] |
Pack Bcps portion to an encoded object.
Definition at line 205 of file BcpsBranchObject.h.
References AlpsReturnStatusOk, direction_, downScore_, numBranchesLeft_, objectIndex_, upScore_, value_, and AlpsEncoded::writeRep().
Referenced by BlisBranchObjectInt::encode().
AlpsReturnStatus BcpsBranchObject::decodeBcps | ( | AlpsEncoded & | encoded | ) | [inline, protected] |
Unpack Bcps portion from an encoded object.
Definition at line 219 of file BcpsBranchObject.h.
References AlpsReturnStatusOk, direction_, downScore_, numBranchesLeft_, objectIndex_, AlpsEncoded::readRep(), upScore_, and value_.
Referenced by BlisBranchObjectInt::decode().
virtual AlpsReturnStatus BcpsBranchObject::encode | ( | AlpsEncoded * | encoded | ) | const [inline, virtual] |
Pack to an encoded object.
Reimplemented in BlisBranchObjectInt, and BlisBranchObjectInt.
Definition at line 235 of file BcpsBranchObject.h.
References AlpsReturnStatusOk.
Referenced by BcpsTreeNode::encodeBcps().
virtual AlpsReturnStatus BcpsBranchObject::decode | ( | AlpsEncoded & | encoded | ) | [inline, virtual] |
Unpack a branching object from an encoded object.
Reimplemented in BlisBranchObjectInt, and BlisBranchObjectInt.
Definition at line 243 of file BcpsBranchObject.h.
References AlpsReturnStatusOk.
int BcpsBranchObject::type_ [protected] |
Type of branching.
Definition at line 52 of file BcpsBranchObject.h.
Referenced by BlisBranchObjectInt::BlisBranchObjectInt(), getType(), and setType().
BcpsModel* BcpsBranchObject::model_ [protected] |
The model that owns this branch object.
Definition at line 55 of file BcpsBranchObject.h.
Referenced by model().
int BcpsBranchObject::objectIndex_ [protected] |
Branch object index.
The index is not the same as variable index. For integer branching, the index refers to the position in the integer object array/vector.
Definition at line 60 of file BcpsBranchObject.h.
Referenced by BlisBranchObjectInt::BlisBranchObjectInt(), decodeBcps(), encodeBcps(), getObjectIndex(), and setObjectIndex().
double BcpsBranchObject::upScore_ [protected] |
The score of branching up.
Definition at line 69 of file BcpsBranchObject.h.
Referenced by decodeBcps(), encodeBcps(), getUpScore(), and setUpScore().
double BcpsBranchObject::downScore_ [protected] |
The score of branching down.
Definition at line 72 of file BcpsBranchObject.h.
Referenced by decodeBcps(), encodeBcps(), getDownScore(), and setDownScore().
int BcpsBranchObject::direction_ [protected] |
The direction of the active branch.
Down is -1, up is 1.
Definition at line 78 of file BcpsBranchObject.h.
Referenced by decodeBcps(), encodeBcps(), getDirection(), and setDirection().
double BcpsBranchObject::value_ [protected] |
Current branching value.
For integer, it can be fractional solution value.
Definition at line 82 of file BcpsBranchObject.h.
Referenced by BlisBranchObjectInt::BlisBranchObjectInt(), decodeBcps(), encodeBcps(), and getValue().
int BcpsBranchObject::numBranchesLeft_ [protected] |
Number of arms remaining to be evaluated.
Definition at line 85 of file BcpsBranchObject.h.
Referenced by BlisBranchObjectInt::BlisBranchObjectInt(), decodeBcps(), encodeBcps(), and numBranchesLeft().