Go to the documentation of this file.
6 #ifndef CoinSearchTree_H
7 #define CoinSearchTree_H
29 void set(
unsigned int bits[4]);
32 std::string
str()
const;
140 printf(
"prefs of sibligs: sibling[%i]: %s\n", i, pref.c_str());
153 static inline const char*
name() {
return "CoinSearchTreeComparePreferred"; }
163 }
else if (yPref < xPref) {
169 printf(
"Comparing xpref (%s) and ypref (%s) : %s\n",
170 xpref.str().c_str(), ypref.str().c_str(), retval ?
"T" :
"F");
179 static inline const char*
name() {
return "CoinSearchTreeCompareDepth"; }
198 static inline const char*
name() {
return "CoinSearchTreeCompareBreadth"; }
208 static inline const char*
name() {
return "CoinSearchTreeCompareBest"; }
251 candidateList_.front()->currentNode()->getPreferred().print(output);
252 printf(
"top's pref: %s\n", output);
270 const bool incrInserted =
true) {
279 const bool incrInserted =
true) {
295 #ifdef CAN_TRUST_STL_HEAP
297 template <
class Comp>
325 const char*
compName()
const {
return Comp::name(); }
330 template <
class Comp>
351 for (ch = 2; ch <
size; pos = ch, ch *= 2) {
352 if (
comp_(candidates[ch+1], candidates[ch]))
354 if (
comp_(s, candidates[ch]))
356 candidates[pos] = candidates[ch];
359 if (
comp_(candidates[ch], s)) {
360 candidates[pos] = candidates[ch];
373 for (ch = pos/2; ch != 0; pos = ch, ch /= 2) {
374 if (
comp_(candidates[ch], s))
376 candidates[pos] = candidates[ch];
391 const char*
compName()
const {
return Comp::name(); }
449 const bool incrInserted =
true) {
static const char * name()
void newSolution(double solValue)
const double COIN_DBL_MAX
virtual ~CoinSearchTreeBase()
A class from which the real tree nodes should be derived from.
friend bool operator<(const BitVector128 &b0, const BitVector128 &b1)
virtual void realpush(CoinTreeSiblings *s)
CoinSearchTreeBase * getTree() const
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
void setTrueLB(double tlb)
static const char * name()
double quality_
Some quality for the node.
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
void CoinDisjointCopyN(register const T *from, const int size, register T *to)
This helper function copies an array to another location.
CoinTreeNode * bestQualityCandidate() const
CoinSearchTreeManager & operator=(const CoinSearchTreeManager &)
bool advanceNode()
returns false if cannot be advanced
CoinTreeNode(const CoinTreeNode &x)
double getQuality() const
int getFractionality() const
void push(const CoinTreeSiblings &s, const bool incrInserted=true)
CoinTreeSiblings & operator=(const CoinTreeSiblings &)
int fractionality_
A measure of fractionality, e.g., the number of unsatisfied integrality requirements.
Function objects to compare search tree nodes.
static const char * name()
CoinSearchTree(const CoinSearchTreeBase &t)
virtual void realpush(CoinTreeSiblings *s)=0
virtual const char * compName() const =0
int depth_
The depth of the node in the tree.
double true_lower_bound_
A true lower bound on the node.
std::vector< CoinTreeSiblings * > candidateList_
static const char * name()
void reevaluateSearchStrategy()
const std::vector< CoinTreeSiblings * > & getCandidates() const
CoinTreeNode * top() const
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
CoinTreeNode * top() const
CoinSearchTreeBase & operator=(const CoinSearchTreeBase &)
BitVector128(unsigned int bits[4])
bool recentlyReevaluatedSearchStrategy_
variable used to test whether we need to reevaluate search strategy
CoinTreeNode * currentNode() const
CoinSearchTreeBase(const CoinSearchTreeBase &)
CoinSearchTreeBase * candidates_
void push(int numNodes, CoinTreeNode **nodes, const bool incrInserted=true)
void push(CoinTreeNode *node, const bool incrInserted=true)
size_t numInserted() const
virtual void fixTop()
After changing data in the top node, fix the heap.
void setTree(CoinSearchTreeBase *t)
CoinSearchTreeManager(const CoinSearchTreeManager &)
CoinTreeNode ** siblings_
CoinTreeSiblings(const CoinTreeSiblings &s)
@ CoinAddNodeToCandidates
void setQuality(double q)
void pop()
pop will advance the next pointer among the siblings on the top and then moves the top to its correct...
CoinTreeNode(int d, int f=-1, double q=-COIN_DBL_MAX, double tlb=-COIN_DBL_MAX, BitVector128 p=BitVector128())
void setFractionality(int f)
virtual ~CoinSearchTreeManager()
void set(unsigned int bits[4])
bool hasUB_
Whether there is an upper bound or not.
CoinTreeSiblings(const int n, CoinTreeNode **nodes)
const char * compName() const
void push(const int n, CoinTreeNode **nodes, const bool incrInserted=true)
void setPreferred(BitVector128 p)
bool operator<(const BitVector128 &b0, const BitVector128 &b1)
void push(const CoinTreeSiblings &sib, const bool incrInserted=true)
BitVector128 getPreferred() const
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
CoinTreeNode & operator=(const CoinTreeNode &x)
virtual ~CoinSearchTree()
double bestQuality() const