6 #ifndef CoinSearchTree_H
7 #define CoinSearchTree_H
31 void set(
unsigned int bits[4]);
34 std::string
str()
const;
156 printf(
"prefs of sibligs: sibling[%i]: %s\n", i, pref.c_str());
169 static inline const char *
name() {
return "CoinSearchTreeComparePreferred"; }
180 }
else if (yPref < xPref) {
186 printf(
"Comparing xpref (%s) and ypref (%s) : %s\n",
187 xpref.str().c_str(), ypref.str().c_str(), retval ?
"T" :
"F");
196 static inline const char *
name() {
return "CoinSearchTreeCompareDepth"; }
215 static inline const char *
name() {
return "CoinSearchTreeCompareBreadth"; }
226 static inline const char *
name() {
return "CoinSearchTreeCompareBest"; }
256 virtual void fixTop() = 0;
260 virtual const char *
compName()
const = 0;
276 candidateList_.front()->currentNode()->getPreferred().print(output);
277 printf(
"top's pref: %s\n", output);
296 const bool incrInserted =
true)
306 const bool incrInserted =
true)
323 #ifdef CAN_TRUST_STL_HEAP
325 template <
class Comp >
363 const char *
compName()
const {
return Comp::name(); }
368 template <
class Comp >
390 for (ch = 2; ch <
size; pos = ch, ch *= 2) {
391 if (
comp_(candidates[ch + 1], candidates[ch]))
393 if (
comp_(s, candidates[ch]))
395 candidates[pos] = candidates[ch];
398 if (
comp_(candidates[ch], s)) {
399 candidates[pos] = candidates[ch];
413 for (ch = pos / 2; ch != 0; pos = ch, ch /= 2) {
414 if (
comp_(candidates[ch], s))
416 candidates[pos] = candidates[ch];
437 const char *
compName()
const {
return Comp::name(); }
501 const bool incrInserted =
true)
const char * compName() const
CoinSearchTreeBase * candidates_
bool recentlyReevaluatedSearchStrategy_
variable used to test whether we need to reevaluate search strategy
bool operator<(const BitVector128 &b0, const BitVector128 &b1)
bool hasUB_
Whether there is an upper bound or not.
void CoinDisjointCopyN(const T *from, const CoinBigIndex size, T *to)
This helper function copies an array to another location.
int depth_
The depth of the node in the tree.
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
void set(unsigned int bits[4])
CoinTreeSiblings(const int n, CoinTreeNode **nodes)
virtual void fixTop()
After changing data in the top node, fix the heap.
std::vector< CoinTreeSiblings * > candidateList_
void push(CoinTreeNode *node, const bool incrInserted=true)
double quality_
Some quality for the node.
void setQuality(double q)
CoinSearchTreeManager & operator=(const CoinSearchTreeManager &)
CoinTreeNode * top() const
CoinSearchTree(const CoinSearchTreeBase &t)
Function objects to compare search tree nodes.
bool advanceNode()
returns false if cannot be advanced
CoinTreeNode * currentNode() const
double true_lower_bound_
A true lower bound on the node.
static const char * name()
void push(int numNodes, CoinTreeNode **nodes, const bool incrInserted=true)
virtual const char * compName() const =0
virtual ~CoinSearchTreeManager()
CoinTreeNode & operator=(const CoinTreeNode &x)
friend bool operator<(const BitVector128 &b0, const BitVector128 &b1)
static const char * name()
void push(const int n, CoinTreeNode **nodes, const bool incrInserted=true)
int getFractionality() const
void push(const CoinTreeSiblings &s, const bool incrInserted=true)
void newSolution(double solValue)
CoinSearchTreeBase & operator=(const CoinSearchTreeBase &)
CoinTreeNode ** siblings_
CoinTreeSiblings(const CoinTreeSiblings &s)
static const char * name()
CoinTreeNode(int d, int f=-1, double q=-COIN_DBL_MAX, double tlb=-COIN_DBL_MAX, BitVector128 p=BitVector128())
int fractionality_
A measure of fractionality, e.g., the number of unsatisfied integrality requirements.
virtual ~CoinSearchTree()
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
CoinSearchTreeBase * getTree() const
static const char * name()
void push(const CoinTreeSiblings &sib, const bool incrInserted=true)
#define pref(qqnme, qqref, qquflgs, qqoff, qqsep)
CoinTreeSiblings & operator=(const CoinTreeSiblings &)
void setTree(CoinSearchTreeBase *t)
CoinTreeNode(const CoinTreeNode &x)
A class from which the real tree nodes should be derived from.
void reevaluateSearchStrategy()
virtual void realpush(CoinTreeSiblings *s)
void setPreferred(BitVector128 p)
void setFractionality(int f)
void pop()
pop will advance the next pointer among the siblings on the top and then moves the top to its correct...
BitVector128 getPreferred() const
double bestQuality() const
const std::vector< CoinTreeSiblings * > & getCandidates() const
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
const double COIN_DBL_MAX
CoinTreeNode * bestQualityCandidate() const
double getQuality() const
CoinTreeNode * top() const
void setTrueLB(double tlb)
size_t numInserted() const
virtual void realpush(CoinTreeSiblings *s)=0
virtual ~CoinSearchTreeBase()
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const