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_;
virtual CbcNode * bestNode(double cutoff)
Remove the best node from the heap and return it.
void setComparisonBound(const CbcCompareBase &val)
Set comparison method when closing bound.
void setNumberSolToStopDive(int val)
Set numberSolToStopDive_.
void initialize(BabSetupBase &b)
Initialize the method (get options)
virtual void pop()
Remove the top node of the heap.
DiverCompare(const DiverCompare &rhs)
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 nBacktracks_
number of backtracks done in current dive.
virtual bool empty()
Test if empty.
CbcDiver & operator=(const CbcDiver &rhs)
Assignment operator.
virtual CbcCompareBase * clone() const
Clone.
ComparisonModes mode_
Current mode of the diving strategy.
virtual CbcNode * bestNode(double cutoff)
Remove the best node from the heap and return it.
int diveListSize_
Record dive list size for constant time access.
double cutoff_
Last reported cutoff.
virtual CbcTree * clone() const
Virtual copy constructor.
virtual void endSearch()
Don't know what this is yet?
CbcProbedDiver & operator=(const CbcProbedDiver &rhs)
Assignment operator.
virtual void endSearch()
Don't know what this is yet?
(C) Copyright International Business Machines Corporation 2007
virtual double getBestPossibleObjective()
Get best possible objective function in the tree.
virtual double getBestPossibleObjective()
Get best possible objective function in the tree.
virtual ~CbcDfsDiver()
Destructor.
virtual void push(CbcNode *x)
Add node to the heap.
virtual int size()
Give size of the tree.
virtual bool every1000Nodes(CbcModel *model, int numberNodes)
Called 1000 nodes.
void setComparisonMode(ComparisonModes newMode)
Changes the mode of comparison of the tree for "safety reasons" if the mode really changes we always ...
virtual void endSearch()
Don't know what this is yet?
virtual CbcNode * bestNode(double cutoff)
Remove the best node from the heap and return it.
virtual bool empty()
Test if empty.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options of the method.
virtual CbcTree * clone() const
Virtual copy constructor.
virtual void push(CbcNode *x)
Add node to the heap.
virtual ~CbcDiver()
Destructor.
virtual int size()
Give size of the tree.
void initialize(BabSetupBase &b)
Initialize the method (get options)
At the very beginning we might want to enlarge the tree just a bit.
void setComparisonDive(const CbcCompareBase &val)
Set comparison method when diving.
CbcDfsDiver & operator=(const CbcDfsDiver &rhs)
Assignment operator.
virtual CbcNode * top() const
Return top node (next node to process.*/.
virtual ~CbcProbedDiver()
Destructor.
CbcProbedDiver()
Default constructor.
virtual double getBestPossibleObjective()
Get best possible objective function in the tree.
DiverCompare & operator=(const DiverCompare &rhs)
int maxDiveDepth_
Maximum depth to go from divingBoard.
void setDiver(CbcDfsDiver *diver)
Set the dfs diver to use.
virtual bool empty()
Test if empty.
Class to do diving in the tree.
A class to have all elements necessary to setup a branch-and-bound.
virtual bool test(CbcNode *x, CbcNode *y)
This is test function.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options of the method.
virtual int size()
Give size of the tree.
void initialize(BabSetupBase &b)
Initialize the method (get options)
virtual void cleanTree(CbcModel *model, double cutoff, double &bestPossibleObjective)
Prune the tree using an objective function cutoff.
virtual void cleanTree(CbcModel *model, double cutoff, double &bestPossibleObjective)
Prune the tree using an objective function cutoff.
Class to do probed diving in the tree.
virtual void cleanTree(CbcModel *model, double cutoff, double &bestPossibleObjective)
Prune the tree using an objective function cutoff.
void setNumberNodesToLimitTreeSize(int val)
Set numberNodesToLimitTreeSize_.
virtual void push(CbcNode *x)
Add node to the heap.
CbcDiver()
Default constructor.
A more elaborate diving class.
virtual void pop()
Remove the top node of the heap.
int maxDepthBFS_
Maximum depth until which we'll do a bredth-first-search.
int maxDiveBacktracks_
Maximum number of backtrack in one dive.
virtual CbcTree * clone() const
Virtual copy constructor.
ComparisonModes getComparisonMode()
get the mode of comparison of the tree.
virtual CbcNode * top() const
Return top node (next node to process.*/.
virtual void pop()
Remove the top node of the heap.
CbcDfsDiver()
Default constructor.
int divingBoardDepth_
Depth of the node from which diving was started (we call this node the diving board).
virtual CbcNode * top() const
Return top node (next node to process.*/.
virtual bool newSolution(CbcModel *model)
Called after each new solution.