Graphviz
13.0.0~dev.20241222.1117
Loading...
Searching...
No Matches
constraint.h
Go to the documentation of this file.
1
19
#pragma once
20
21
#include <iostream>
22
#include <
vpsc/variable.h
>
23
24
struct
Constraint
25
{
26
friend
std::ostream&
operator <<
(std::ostream &os,
const
Constraint
&c);
27
public
:
28
Variable
*
left
;
29
Variable
*
right
;
30
double
gap
;
31
double
lm
;
32
Constraint
(
Variable
*
left
,
Variable
*
right
,
double
gap
);
33
~Constraint
();
34
double
slack
()
const
{
return
right
->
position
() -
gap
-
left
->
position
(); }
35
long
timeStamp
;
36
bool
active
;
37
bool
visited
;
38
};
39
#include <float.h>
40
#include <
vpsc/block.h
>
41
static
inline
bool
compareConstraints
(
const
Constraint
*
const
l,
42
const
Constraint
*
const
r) {
43
double
const
sl =
44
l->
left
->
block
->
timeStamp
> l->
timeStamp
45
||l->
left
->
block
==l->
right
->
block
46
?-DBL_MAX:l->
slack
();
47
double
const
sr =
48
r->
left
->
block
->
timeStamp
> r->
timeStamp
49
||r->
left
->
block
==r->
right
->
block
50
?-DBL_MAX:r->
slack
();
51
if
(sl==sr) {
52
// arbitrary choice based on id
53
if
(l->
left
->
id
==r->
left
->
id
) {
54
if
(l->
right
->
id
<r->
right
->
id
)
return
true
;
55
return
false
;
56
}
57
if
(l->
left
->
id
<r->
left
->
id
)
return
true
;
58
return
false
;
59
}
60
return
sl < sr;
61
}
Block::timeStamp
long timeStamp
Definition
block.h:54
compareConstraints
static bool compareConstraints(const Constraint *const l, const Constraint *const r)
Definition
constraint.h:41
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::visited
bool visited
Definition
constraint.h:37
Constraint::lm
double lm
Definition
constraint.h:31
Constraint::timeStamp
long timeStamp
Definition
constraint.h:35
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::slack
double slack() const
Definition
constraint.h:34
Constraint::~Constraint
~Constraint()
Definition
constraint.cpp:27
Constraint::operator<<
friend std::ostream & operator<<(std::ostream &os, const Constraint &c)
Definition
constraint.cpp:38
Variable
Definition
variable.h:26
Variable::id
const int id
Definition
variable.h:29
Variable::block
Block * block
Definition
variable.h:33
Variable::position
double position() const
Definition
variable.h:46
variable.h
block.h
lib
vpsc
constraint.h
Generated by
1.9.8