47#define __NOTNAN(p) (p)==(p)
55 for(
size_t i=0;i<
nvs;i++) {
63 for (
size_t i = 0; i < length; ++i)
75 list<Variable*> *
order =
new list<Variable*>;
76 for(
size_t i=0;i<
nvs;i++) {
79 for(
size_t i=0;i<
nvs;i++) {
80 if(
vs[i]->in.size()==0) {
90 vector<Constraint*>::iterator it=v->out.begin();
91 for(;it!=v->out.end();++it) {
93 if(!
c->right->visited) {
98 ofstream f(LOGFILE,ios::app);
99 f<<
" order="<<*v<<endl;
101 order->push_front(v);
108#ifdef LIBVPSC_LOGGING
109 ofstream f(LOGFILE,ios::app);
110 f<<
"mergeLeft called on "<<*r<<endl;
115 while (
c !=
nullptr &&
c->slack()<0) {
116#ifdef LIBVPSC_LOGGING
117 f<<
"mergeLeft on constraint: "<<*
c<<endl;
120 Block *l =
c->left->block;
122 double dist =
c->right->offset -
c->left->offset -
c->gap;
123 if (r->
vars->size() < l->
vars->size()) {
134#ifdef LIBVPSC_LOGGING
135 f<<
"merged "<<*r<<endl;
142#ifdef LIBVPSC_LOGGING
143 ofstream f(LOGFILE,ios::app);
144 f<<
"mergeRight called on "<<*l<<endl;
148 while (
c !=
nullptr &&
c->slack()<0) {
149#ifdef LIBVPSC_LOGGING
150 f<<
"mergeRight on constraint: "<<*
c<<endl;
153 Block *r =
c->right->block;
155 double dist =
c->left->offset +
c->gap -
c->right->offset;
156 if (l->
vars->size() > r->
vars->size()) {
165#ifdef LIBVPSC_LOGGING
166 f<<
"merged "<<*l<<endl;
185 for (
size_t j = 0; j < length; )
216#ifdef LIBVPSC_LOGGING
217 ofstream f(LOGFILE,ios::app);
218 f<<
"Split left: "<<*l<<endl;
219 f<<
"Split right: "<<*r<<endl;
232 COLA_ASSERT(__NOTNAN(l->
posn));
233 COLA_ASSERT(__NOTNAN(r->
posn));
242 for (
size_t i = 0; i < length; ++i)
PairingHeap< Constraint *, CompareConstraints > * in
void merge(Block *b, Constraint *c, double dist)
void setUpOutConstraints()
void deleteMinInConstraint()
void split(Block *&l, Block *&r, Constraint *c)
Constraint * findMinOutConstraint()
void updateWeightedPosition()
Constraint * findMinInConstraint()
void deleteMinOutConstraint()
void setUpInConstraints()
void split(Block *b, Block *&l, Block *&r, Constraint *c)
std::vector< Block * > m_blocks
void removeBlock(Block *doomed)
std::list< Variable * > * totalOrder()
Blocks(std::vector< Variable * > const &vs)
std::vector< Variable * > const & vs
void dfsVisit(Variable *v, std::list< Variable * > *order)
void mergeRight(Block *l)
A constraint determines a minimum or exact spacing required between two Variable objects.
A variable is comprised of an ideal position, final position and a weight.
libvpsc: Variable Placement with Separation Constraints quadratic program solver library.