Go to the documentation of this file.
14 #include "CbcCompareBase.hpp"
15 #include "CbcTree.hpp"
18 #include "CbcCompareActual.hpp"
42 virtual CbcTree *
clone()
const;
46 virtual CbcNode *
top()
const;
50 virtual void push(CbcNode * x);
54 virtual CbcNode *
bestNode(
double cutoff);
64 return (
static_cast<int>(nodes_.size()) + (nextOnBranch_ != NULL) );
75 virtual void cleanTree(CbcModel * model,
double cutoff,
double & bestPossibleObjective);
97 CbcNode * nextOnBranch_;
100 bool stop_diving_on_cutoff_;
124 virtual CbcTree *
clone()
const;
128 virtual CbcNode *
top()
const;
132 virtual void push(CbcNode * x);
136 virtual CbcNode *
bestNode(
double cutoff);
142 virtual bool empty();
146 return (
static_cast<int>(nodes_.size()) + (nextOnBranch_ != NULL) + (candidateChild_ != NULL) );
157 virtual void cleanTree(CbcModel * model,
double cutoff,
double & bestPossibleObjective);
166 nextOnBranch_ = NULL;
176 CbcNode * nextOnBranch_;
178 CbcNode * candidateChild_;
181 bool stop_diving_on_cutoff_;
220 virtual CbcTree *
clone()
const;
224 virtual CbcNode *
top()
const;
228 virtual void push(CbcNode * x);
232 virtual CbcNode *
bestNode(
double cutoff);
238 virtual bool empty();
254 virtual void cleanTree(CbcModel * model,
double cutoff,
double & bestPossibleObjective);
305 void pushDiveOntoHeap(
double cutoff);
316 numberSolToStopDive_(5),
317 numberNodesToLimitTreeSize_(1000000),
318 comparisonDive_(NULL),
319 comparisonBound_(NULL)
325 delete comparisonDive_;
326 delete comparisonBound_;
333 numberSolToStopDive_(rhs.numberSolToStopDive_),
334 numberNodesToLimitTreeSize_(rhs.numberNodesToLimitTreeSize_),
335 comparisonDive_(rhs.comparisonDive_->
clone()),
336 comparisonBound_(rhs.comparisonBound_->
clone())
343 CbcCompareBase::operator=(rhs);
345 numberSolToStopDive_ = rhs.numberSolToStopDive_;
346 numberNodesToLimitTreeSize_ = rhs.numberNodesToLimitTreeSize_;
347 delete comparisonDive_;
348 delete comparisonBound_;
349 comparisonDive_ = NULL;
350 comparisonBound_ = NULL;
351 if (rhs.comparisonDive_) comparisonDive_ = rhs.comparisonDive_->clone();
352 if (rhs.comparisonBound_) comparisonBound_ = rhs.comparisonBound_->clone();
358 virtual CbcCompareBase *
clone()
const
364 virtual bool test (CbcNode * x, CbcNode * y);
371 double objectiveAtContinuous,
372 int numberInfeasibilitiesAtContinuous);
387 numberSolToStopDive_ = val;
393 numberNodesToLimitTreeSize_ = val;
399 comparisonDive_ = val.clone();
404 comparisonBound_ = val.clone();
410 int numberSolToStopDive_;
412 int numberNodesToLimitTreeSize_;
414 CbcCompareBase * comparisonDive_;
416 CbcCompareBase * comparisonBound_;
418 CbcCompareDepth comparisonDepth_;
int maxDiveBacktracks_
Maximum number of backtrack in one dive.
int maxDiveDepth_
Maximum depth to go from divingBoard.
virtual void push(CbcNode *x)
Add node to the heap.
std::list< CbcNode * > dive_
List of the nodes in the current dive.
virtual double getBestPossibleObjective()
Get best possible objective function in the tree.
virtual bool newSolution(CbcModel *model)
Called after each new solution.
void setComparisonDive(const CbcCompareBase &val)
Set comparison method when diving.
(C) Copyright International Business Machines Corporation 2007
virtual ~CbcDfsDiver()
Destructor.
CbcProbedDiver()
Default constructor.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options of the method.
virtual void cleanTree(CbcModel *model, double cutoff, double &bestPossibleObjective)
Prune the tree using an objective function cutoff.
virtual bool test(CbcNode *x, CbcNode *y)
This is test function.
virtual void endSearch()
Don't know what this is yet?
virtual double getBestPossibleObjective()
Get best possible objective function in the tree.
virtual void endSearch()
Don't know what this is yet?
void setNumberSolToStopDive(int val)
Set numberSolToStopDive_.
virtual bool empty()
Test if empty.
A class to have all elements necessary to setup a branch-and-bound.
virtual void push(CbcNode *x)
Add node to the heap.
virtual CbcTree * clone() const
Virtual copy constructor.
virtual CbcNode * bestNode(double cutoff)
Remove the best node from the heap and return it.
virtual void pop()
Remove the top node of the heap.
void setNumberNodesToLimitTreeSize(int val)
Set numberNodesToLimitTreeSize_.
virtual bool every1000Nodes(CbcModel *model, int numberNodes)
Called 1000 nodes.
virtual ~CbcProbedDiver()
Destructor.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options of the method.
A more elaborate diving class.
void initialize(BabSetupBase &b)
Initialize the method (get options)
void setDiver(CbcDfsDiver *diver)
Set the dfs diver to use.
void initialize(BabSetupBase &b)
Initialize the method (get options)
void setComparisonMode(ComparisonModes newMode)
Changes the mode of comparison of the tree for "safety reasons" if the mode really changes we always ...
virtual bool empty()
Test if empty.
virtual int size()
Give size of the tree.
int maxDepthBFS_
Maximum depth until which we'll do a bredth-first-search.
virtual void pop()
Remove the top node of the heap.
Class to do probed diving in the tree.
virtual CbcTree * clone() const
Virtual copy constructor.
DiverCompare(const DiverCompare &rhs)
int treeCleaning_
Flag to say that we are currently cleaning the tree and should work only on the heap.
virtual void pop()
Remove the top node of the heap.
virtual CbcCompareBase * clone() const
Clone.
CbcDiver & operator=(const CbcDiver &rhs)
Assignment operator.
ComparisonModes getComparisonMode()
get the mode of comparison of the tree.
CbcProbedDiver & operator=(const CbcProbedDiver &rhs)
Assignment operator.
CbcDfsDiver()
Default constructor.
virtual CbcNode * top() const
Return top node (next node to process.*/.
ComparisonModes mode_
Current mode of the diving strategy.
virtual CbcTree * clone() const
Virtual copy constructor.
virtual void endSearch()
Don't know what this is yet?
virtual int size()
Give size of the tree.
virtual CbcNode * top() const
Return top node (next node to process.*/.
virtual ~CbcDiver()
Destructor.
virtual void cleanTree(CbcModel *model, double cutoff, double &bestPossibleObjective)
Prune the tree using an objective function cutoff.
virtual int size()
Give size of the tree.
virtual CbcNode * bestNode(double cutoff)
Remove the best node from the heap and return it.
virtual CbcNode * bestNode(double cutoff)
Remove the best node from the heap and return it.
void initialize(BabSetupBase &b)
Initialize the method (get options)
virtual void push(CbcNode *x)
Add node to the heap.
virtual double getBestPossibleObjective()
Get best possible objective function in the tree.
virtual bool empty()
Test if empty.
CbcDiver()
Default constructor.
void setComparisonBound(const CbcCompareBase &val)
Set comparison method when closing bound.
int nBacktracks_
number of backtracks done in current dive.
int divingBoardDepth_
Depth of the node from which diving was started (we call this node the diving board).
CbcDfsDiver & operator=(const CbcDfsDiver &rhs)
Assignment operator.
DiverCompare & operator=(const DiverCompare &rhs)
virtual CbcNode * top() const
Return top node (next node to process.*/.
double cutoff_
Last reported cutoff.
int diveListSize_
Record dive list size for constant time access.
@ Enlarge
At the very beginning we might want to enlarge the tree just a bit.
virtual void cleanTree(CbcModel *model, double cutoff, double &bestPossibleObjective)
Prune the tree using an objective function cutoff.
Class to do diving in the tree.