summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b3898bd)
raw | patch | inline | side by side (parent: b3898bd)
author | tgdwyer <tgdwyer@users.sourceforge.net> | |
Mon, 6 Feb 2006 05:22:54 +0000 (05:22 +0000) | ||
committer | tgdwyer <tgdwyer@users.sourceforge.net> | |
Mon, 6 Feb 2006 05:22:54 +0000 (05:22 +0000) |
Fixes bug.
index ebf56ea9eeddae39dac66f553f52ea85a7f39dbb..7a2ab53af06afa0053f1d1d35e32452fa364051e 100644 (file)
findMinInConstraint();
b->findMinInConstraint();
in->merge(b->in);
+#ifdef RECTANGLE_OVERLAP_LOGGING
+ f<<" merged heap: "<<*in<<endl;
+#endif
}
void Block::mergeOut(Block *b) {
findMinOutConstraint();
}
void Block::deleteMinInConstraint() {
in->deleteMin();
+#ifdef RECTANGLE_OVERLAP_LOGGING
+ ofstream f(LOGFILE,ios::app);
+ f<<"deleteMinInConstraint... "<<endl;
+ f<<" result: "<<*in<<endl;
+#endif
}
void Block::deleteMinOutConstraint() {
out->deleteMin();
index e48775f8c594967e1b340fb5712377d13c941325..bb889c4d9c8c301b5ce31ffef88e7985cb08446b 100644 (file)
}
std::ostream& operator <<(std::ostream &os, const Constraint &c)
{
- os<<*c.left<<"+"<<c.gap<<"<="<<*c.right<<"("<<c.slack()<<")";
+ os<<*c.left<<"+"<<c.gap<<"<="<<*c.right<<"("<<c.slack()<<"):lts="<<c.left->block->timeStamp<<",cts="<<c.timeStamp;
return os;
}
index 683d66da3425a8345d9c666cd0a63e2f4f48ee73..c8273376b9fa2aae0ee66ad5831b735cefe5ee5b 100644 (file)
@@ -37,11 +37,11 @@ static inline bool compareConstraints(Constraint *const &l, Constraint *const &r
double const sl =
l->left->block->timeStamp > l->timeStamp
||l->left->block==l->right->block
- ?DBL_MIN:l->slack();
+ ?-DBL_MAX:l->slack();
double const sr =
r->left->block->timeStamp > r->timeStamp
||r->left->block==r->right->block
- ?DBL_MIN:r->slack();
+ ?-DBL_MAX:r->slack();
if(sl==sr) {
// arbitrary choice based on id
if(l->left->id==r->left->id) {
diff --git a/src/removeoverlap/pairingheap/PairingHeap.cpp b/src/removeoverlap/pairingheap/PairingHeap.cpp
index e0db8fdaf2889452487abf008040efc03a00c120..42d009c6aa6b063f177fcf138c470250880ca5e2 100644 (file)
*/
#include <vector>
-
+#include <list>
#include "dsexceptions.h"
#include "PairingHeap.h"
return p;
}
}
-
+template <class T>
+ostream& operator <<(ostream &os, const PairingHeap<T> &b)
+{
+ os<<"Heap:";
+ if (b.root != NULL) {
+ PairNode<T> *r = b.root;
+ list<PairNode<T>*> q;
+ q.push_back(r);
+ while (!q.empty()) {
+ r = q.front();
+ q.pop_front();
+ if (r->leftChild != NULL) {
+ os << *r->element << ">";
+ PairNode<T> *c = r->leftChild;
+ while (c != NULL) {
+ q.push_back(c);
+ os << "," << *c->element;
+ c = c->nextSibling;
+ }
+ os << "|";
+ }
+ }
+ }
+ return os;
+}
#endif
diff --git a/src/removeoverlap/pairingheap/PairingHeap.h b/src/removeoverlap/pairingheap/PairingHeap.h
index 5f57f2f1b3d9a0821a007e960e64b10be9fe831a..038a395f4876d29fa86fa92413e0d81fedbf3842 100644 (file)
template <class T>
class PairNode
{
+ friend std::ostream& operator <<(std::ostream &os,const PairingHeap<T> &b);
T element;
PairNode *leftChild;
PairNode *nextSibling;
template <class T>
class PairingHeap
{
+ friend std::ostream& operator <<(std::ostream &os,const PairingHeap<T> &b);
public:
PairingHeap( bool (*lessThan)(T const &lhs, T const &rhs) );
PairingHeap( const PairingHeap & rhs );