2 #ifndef CoinSearchTree_H
3 #define CoinSearchTree_H
26 std::string
str()
const;
134 printf(
"prefs of sibligs: sibling[%i]: %s\n", i, pref.c_str());
147 static inline const char*
name() {
return "CoinSearchTreeComparePreferred"; }
157 }
else if (yPref < xPref) {
163 printf(
"Comparing xpref (%s) and ypref (%s) : %s\n",
164 xpref.str().c_str(), ypref.str().c_str(), retval ?
"T" :
"F");
173 static inline const char*
name() {
return "CoinSearchTreeCompareDepth"; }
192 static inline const char*
name() {
return "CoinSearchTreeCompareBreadth"; }
202 static inline const char*
name() {
return "CoinSearchTreeCompareBest"; }
227 virtual void fixTop() = 0;
231 virtual const char*
compName()
const = 0;
245 candidateList_.front()->currentNode()->getPreferred().print(output);
246 printf(
"top's pref: %s\n", output);
264 const bool incrInserted =
true) {
273 const bool incrInserted =
true) {
289 #ifdef CAN_TRUST_STL_HEAP
291 template <
class Comp>
319 const char*
compName()
const {
return Comp::name(); }
324 template <
class Comp>
345 for (ch = 2; ch <
size; pos = ch, ch *= 2) {
346 if (
comp_(candidates[ch+1], candidates[ch]))
348 if (
comp_(s, candidates[ch]))
350 candidates[pos] = candidates[ch];
353 if (
comp_(candidates[ch], s)) {
354 candidates[pos] = candidates[ch];
367 for (ch = pos/2; ch != 0; pos = ch, ch /= 2) {
368 if (
comp_(candidates[ch], s))
370 candidates[pos] = candidates[ch];
385 const char*
compName()
const {
return Comp::name(); }
443 const bool incrInserted =
true) {
bool recentlyReevaluatedSearchStrategy_
variable used to test whether we need to reevaluate search strategy
bool hasUB_
Whether there is an upper bound or not.
void reevaluateSearchStrategy()
double bestQuality() const
CoinTreeNode * top() const
CoinSearchTreeBase & operator=(const CoinSearchTreeBase &)
virtual ~CoinSearchTreeBase()
CoinTreeSiblings & operator=(const CoinTreeSiblings &)
void CoinDisjointCopyN(register const T *from, const int size, register T *to)
This helper function copies an array to another location.
CoinTreeNode(int d, int f=-1, double q=-COIN_DBL_MAX, double tlb=-COIN_DBL_MAX, BitVector128 p=BitVector128())
bool operator<(const BitVector128 &b0, const BitVector128 &b1)
size_t numInserted() const
CoinTreeNode * top() const
friend bool operator<(const BitVector128 &b0, const BitVector128 &b1)
void setQuality(double q)
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
CoinTreeNode(const CoinTreeNode &x)
void setTrueLB(double tlb)
virtual void realpush(CoinTreeSiblings *s)=0
static const char * name()
BitVector128 getPreferred() const
int fractionality_
A measure of fractionality, e.g., the number of unsatisfied integrality requirements.
void pop()
pop will advance the next pointer among the siblings on the top and then moves the top to its correct...
std::vector< CoinTreeSiblings * > candidateList_
CoinSearchTreeManager & operator=(const CoinSearchTreeManager &)
void setFractionality(int f)
#define COIN_DBL_MAX
This has #defines etc for the "C" interface to Coin.
CoinTreeNode * bestQualityCandidate() const
static const char * name()
int getFractionality() const
double true_lower_bound_
A true lower bound on the node.
void setTree(CoinSearchTreeBase *t)
void push(int numNodes, CoinTreeNode **nodes, const bool incrInserted=true)
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
const std::vector< CoinTreeSiblings * > & getCandidates() const
CoinTreeSiblings(const int n, CoinTreeNode **nodes)
void push(CoinTreeNode *node, const bool incrInserted=true)
const char * compName() const
bool advanceNode()
returns false if cannot be advanced
A class from which the real tree nodes should be derived from.
CoinSearchTreeBase * getTree() const
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
static const char * name()
virtual void realpush(CoinTreeSiblings *s)
static const char * name()
CoinTreeSiblings(const CoinTreeSiblings &s)
virtual const char * compName() const =0
CoinTreeNode ** siblings_
CoinSearchTree(const CoinSearchTreeBase &t)
void push(const CoinTreeSiblings &s, const bool incrInserted=true)
void push(const CoinTreeSiblings &sib, const bool incrInserted=true)
double getQuality() const
CoinTreeNode & operator=(const CoinTreeNode &x)
int depth_
The depth of the node in the tree.
void push(const int n, CoinTreeNode **nodes, const bool incrInserted=true)
double quality_
Some quality for the node.
bool operator()(const CoinTreeSiblings *x, const CoinTreeSiblings *y) const
Function objects to compare search tree nodes.
void setPreferred(BitVector128 p)
virtual void fixTop()
After changing data in the top node, fix the heap.
virtual ~CoinSearchTreeManager()
CoinSearchTreeBase * candidates_
CoinTreeNode * currentNode() const
void newSolution(double solValue)