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>
21
Constraint::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
}
27
Constraint::~Constraint
() {
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
}
38
std::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
}
right
#define right(i)
Definition
closest.c:79
operator<<
std::ostream & operator<<(std::ostream &os, const Constraint &c)
Definition
constraint.cpp:38
constraint.h
left
#define left
Definition
dthdr.h:12
Constraint
A constraint determines a minimum or exact spacing required between two variables.
Definition
constraint.h:25
Constraint::right
Variable * right
Definition
constraint.h:29
Constraint::gap
double gap
Definition
constraint.h:30
Constraint::left
Variable * left
Definition
constraint.h:28
Constraint::active
bool active
Definition
constraint.h:36
Constraint::Constraint
Constraint(Variable *left, Variable *right, double gap)
A constraint determines a minimum or exact spacing required between two variables.
Definition
constraint.cpp:21
Constraint::slack
double slack() const
Definition
constraint.h:34
Constraint::~Constraint
~Constraint()
Definition
constraint.cpp:27
Variable
Definition
variable.h:26
Variable::out
Constraints out
Definition
variable.h:36
Variable::in
Constraints in
Definition
variable.h:35
lib
vpsc
constraint.cpp
Generated by
1.9.8