#include <BonDiver.hpp>
Public Types | |
Enlarge | |
At the very beginning we might want to enlarge the tree just a bit. | |
FindSolutions | |
CloseBound | |
LimitTreeSize | |
enum | ComparisonModes { Enlarge, FindSolutions, CloseBound, LimitTreeSize } |
Public Member Functions | |
CbcDfsDiver () | |
Default constructor. | |
CbcDfsDiver (const CbcDfsDiver &rhs) | |
Copy constructor. | |
CbcDfsDiver & | operator= (const CbcDfsDiver &rhs) |
Assignment operator. | |
virtual | ~CbcDfsDiver () |
Destructor. | |
virtual CbcTree * | clone () const |
copy constructor. | |
virtual void | cleanTree (CbcModel *model, double cutoff, double &bestPossibleObjective) |
Prune the tree using an objective function cutoff if nextOnBranch_ exists we push it on the heap and call CbcTree function. | |
virtual double | getBestPossibleObjective () |
Get best possible objective function in the tree. | |
void | initialize (Ipopt::SmartPtr< Ipopt::OptionsList > options) |
Initialize the method (get options). | |
virtual void | endSearch () |
Don't know what this is yet? | |
void | setComparisonMode (ComparisonModes newMode) |
Changes the mode of comparison of the tree for "safety reasons" if the mode really changes we always finish the current dive and put all the node back onto the heap. | |
ComparisonModes | getComparisonMode () |
get the mode of comparison of the tree. | |
Heap access and maintenance methods. | |
virtual CbcNode * | top () const |
Return top node (next node to process.*/. | |
virtual void | push (CbcNode *x) |
Add node to the heap. | |
virtual void | pop () |
Remove the top node of the heap. | |
virtual CbcNode * | bestNode (double cutoff) |
Remove the best node from the heap and return it. | |
vector methods | |
virtual bool | empty () |
Test if empty. | |
virtual int | size () |
Give size of the tree. | |
Static Public Member Functions | |
static void | registerOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions) |
Register the options of the method. | |
Protected Attributes | |
int | treeCleaning_ |
Flag to say that we are currently cleaning the tree and should work only on the heap. | |
std::list< CbcNode * > | dive_ |
List of the nodes in the current dive. | |
int | diveListSize_ |
Record dive list size for constant time access. | |
int | divingBoardDepth_ |
Depth of the node from which diving was started (we call this node the diving board). | |
double | cutoff_ |
Last reported cutoff. | |
int | nBacktracks_ |
number of backtracks done in current dive. | |
Parameters of the method. | |
int | maxDepthBFS_ |
Maximum depth until which we'll do a bredth-first-search. | |
int | maxDiveBacktracks_ |
Maximum number of backtrack in one dive. | |
int | maxDiveDepth_ |
Maximum depth to go from divingBoard. | |
ComparisonModes | mode_ |
Current mode of the diving strategy. | |
Private Member Functions | |
void | pushDiveOntoHeap (double cutoff) |
Pushes onto heap all the nodes with objective value > cutoff. |
First there are several modes which can be commanded by the Comparison class below. In particular can command to dive to find solutions, to try to close the bound as possible or to limit the size of the tree.
The diving goes into the tree doing depth-first search until one of the following happens:
maxDiveBacktrack_
number of backtracking are performed. maxDiveDepth_
Definition at line 198 of file BonDiver.hpp.
Enlarge | At the very beginning we might want to enlarge the tree just a bit. |
FindSolutions | |
CloseBound | |
LimitTreeSize |
Definition at line 201 of file BonDiver.hpp.
Bonmin::CbcDfsDiver::CbcDfsDiver | ( | ) |
Bonmin::CbcDfsDiver::CbcDfsDiver | ( | const CbcDfsDiver & | rhs | ) |
Bonmin::CbcDfsDiver::~CbcDfsDiver | ( | ) | [virtual] |
CbcDfsDiver & Bonmin::CbcDfsDiver::operator= | ( | const CbcDfsDiver & | rhs | ) |
Assignment operator.
Definition at line 476 of file BonDiver.cpp.
References cutoff_, dive_, diveListSize_, divingBoardDepth_, maxDepthBFS_, maxDiveBacktracks_, maxDiveDepth_, mode_, nBacktracks_, and treeCleaning_.
CbcTree * Bonmin::CbcDfsDiver::clone | ( | ) | const [virtual] |
CbcNode * Bonmin::CbcDfsDiver::top | ( | ) | const [virtual] |
Return top node (next node to process.*/.
Definition at line 507 of file BonDiver.cpp.
References dive_, diveListSize_, FindSolutions, mode_, and treeCleaning_.
void Bonmin::CbcDfsDiver::push | ( | CbcNode * | x | ) | [virtual] |
Add node to the heap.
Definition at line 525 of file BonDiver.cpp.
References dive_, diveListSize_, FindSolutions, mode_, and treeCleaning_.
void Bonmin::CbcDfsDiver::pop | ( | ) | [virtual] |
Remove the top node of the heap.
Definition at line 547 of file BonDiver.cpp.
References dive_, diveListSize_, FindSolutions, mode_, and treeCleaning_.
CbcNode * Bonmin::CbcDfsDiver::bestNode | ( | double | cutoff | ) | [virtual] |
Remove the best node from the heap and return it.
Definition at line 566 of file BonDiver.cpp.
References dive_, diveListSize_, divingBoardDepth_, Enlarge, FindSolutions, maxDepthBFS_, maxDiveBacktracks_, maxDiveDepth_, mode_, nBacktracks_, pushDiveOntoHeap(), setComparisonMode(), and treeCleaning_.
bool Bonmin::CbcDfsDiver::empty | ( | ) | [virtual] |
virtual int Bonmin::CbcDfsDiver::size | ( | ) | [inline, virtual] |
void Bonmin::CbcDfsDiver::cleanTree | ( | CbcModel * | model, | |
double | cutoff, | |||
double & | bestPossibleObjective | |||
) | [virtual] |
Prune the tree using an objective function cutoff if nextOnBranch_ exists we push it on the heap and call CbcTree function.
This routine removes all nodes with objective worst than the specified cutoff value. It also sets bestPossibleObjective to best of all on tree before deleting.
Definition at line 695 of file BonDiver.cpp.
References pushDiveOntoHeap(), and treeCleaning_.
double Bonmin::CbcDfsDiver::getBestPossibleObjective | ( | ) | [virtual] |
Get best possible objective function in the tree.
Definition at line 709 of file BonDiver.cpp.
References dive_.
void Bonmin::CbcDfsDiver::registerOptions | ( | Ipopt::SmartPtr< Bonmin::RegisteredOptions > | roptions | ) | [static] |
Register the options of the method.
Definition at line 727 of file BonDiver.cpp.
References Bonmin::RegisteredOptions::BonminCategory.
Referenced by Bonmin::BabSetupBase::registerAllOptions().
void Bonmin::CbcDfsDiver::initialize | ( | Ipopt::SmartPtr< Ipopt::OptionsList > | options | ) |
Initialize the method (get options).
Definition at line 746 of file BonDiver.cpp.
References maxDiveBacktracks_, and maxDiveDepth_.
virtual void Bonmin::CbcDfsDiver::endSearch | ( | ) | [inline, virtual] |
void Bonmin::CbcDfsDiver::setComparisonMode | ( | ComparisonModes | newMode | ) |
Changes the mode of comparison of the tree for "safety reasons" if the mode really changes we always finish the current dive and put all the node back onto the heap.
Definition at line 756 of file BonDiver.cpp.
References CloseBound, Enlarge, FindSolutions, LimitTreeSize, maxDiveBacktracks_, mode_, nBacktracks_, and pushDiveOntoHeap().
Referenced by bestNode(), Bonmin::DiverCompare::every1000Nodes(), and Bonmin::DiverCompare::newSolution().
ComparisonModes Bonmin::CbcDfsDiver::getComparisonMode | ( | ) | [inline] |
get the mode of comparison of the tree.
Definition at line 273 of file BonDiver.hpp.
References mode_.
Referenced by Bonmin::DiverCompare::every1000Nodes(), Bonmin::DiverCompare::newSolution(), and Bonmin::DiverCompare::test().
void Bonmin::CbcDfsDiver::pushDiveOntoHeap | ( | double | cutoff | ) | [private] |
Pushes onto heap all the nodes with objective value > cutoff.
Definition at line 673 of file BonDiver.cpp.
References dive_, and diveListSize_.
Referenced by bestNode(), cleanTree(), and setComparisonMode().
int Bonmin::CbcDfsDiver::treeCleaning_ [protected] |
Flag to say that we are currently cleaning the tree and should work only on the heap.
Definition at line 280 of file BonDiver.hpp.
Referenced by bestNode(), cleanTree(), operator=(), pop(), push(), and top().
std::list<CbcNode *> Bonmin::CbcDfsDiver::dive_ [protected] |
List of the nodes in the current dive.
Definition at line 282 of file BonDiver.hpp.
Referenced by bestNode(), empty(), getBestPossibleObjective(), operator=(), pop(), push(), pushDiveOntoHeap(), and top().
int Bonmin::CbcDfsDiver::diveListSize_ [protected] |
Record dive list size for constant time access.
Definition at line 284 of file BonDiver.hpp.
Referenced by bestNode(), operator=(), pop(), push(), pushDiveOntoHeap(), size(), and top().
int Bonmin::CbcDfsDiver::divingBoardDepth_ [protected] |
Depth of the node from which diving was started (we call this node the diving board).
Definition at line 286 of file BonDiver.hpp.
Referenced by bestNode(), and operator=().
double Bonmin::CbcDfsDiver::cutoff_ [protected] |
int Bonmin::CbcDfsDiver::nBacktracks_ [protected] |
number of backtracks done in current dive.
Definition at line 290 of file BonDiver.hpp.
Referenced by bestNode(), operator=(), and setComparisonMode().
int Bonmin::CbcDfsDiver::maxDepthBFS_ [protected] |
Maximum depth until which we'll do a bredth-first-search.
Definition at line 294 of file BonDiver.hpp.
Referenced by bestNode(), and operator=().
int Bonmin::CbcDfsDiver::maxDiveBacktracks_ [protected] |
Maximum number of backtrack in one dive.
Definition at line 296 of file BonDiver.hpp.
Referenced by bestNode(), initialize(), operator=(), and setComparisonMode().
int Bonmin::CbcDfsDiver::maxDiveDepth_ [protected] |
Maximum depth to go from divingBoard.
Definition at line 298 of file BonDiver.hpp.
Referenced by bestNode(), initialize(), and operator=().
ComparisonModes Bonmin::CbcDfsDiver::mode_ [protected] |
Current mode of the diving strategy.
Definition at line 300 of file BonDiver.hpp.
Referenced by bestNode(), getComparisonMode(), operator=(), pop(), push(), setComparisonMode(), and top().