Graphviz 13.0.0~dev.20241222.1117
Loading...
Searching...
No Matches
constraint.cpp
Go to the documentation of this file.
1
19#include <vpsc/constraint.h>
20#include <cassert>
21Constraint::Constraint(Variable *left_, Variable *right_, double gap_)
22 : left(left_), right(right_), gap(gap_), timeStamp(0), active(false),
23 visited(false) {
24 left->out.push_back(this);
25 right->in.push_back(this);
26}
28 Constraints::iterator i;
29 for(i=left->out.begin(); i!=left->out.end(); i++) {
30 if(*i==this) break;
31 }
32 left->out.erase(i);
33 for(i=right->in.begin(); i!=right->in.end(); i++) {
34 if(*i==this) break;
35 }
36 right->in.erase(i);
37}
38std::ostream& operator <<(std::ostream &os, const Constraint &c)
39{
40 os<<*c.left<<"+"<<c.gap<<"<="<<*c.right<<"("<<c.slack()<<")"<<(c.active?"-active":"");
41 return os;
42}
#define right(i)
Definition closest.c:79
std::ostream & operator<<(std::ostream &os, const Constraint &c)
#define left
Definition dthdr.h:12
A constraint determines a minimum or exact spacing required between two variables.
Definition constraint.h:25
Variable * right
Definition constraint.h:29
double gap
Definition constraint.h:30
Variable * left
Definition constraint.h:28
bool active
Definition constraint.h:36
Constraint(Variable *left, Variable *right, double gap)
A constraint determines a minimum or exact spacing required between two variables.
double slack() const
Definition constraint.h:34
Constraints out
Definition variable.h:36
Constraints in
Definition variable.h:35