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
25{
26 friend std::ostream& operator <<(std::ostream &os,const Constraint &c);
27public:
30 double gap;
31 double lm;
34 double slack() const { return right->position() - gap - left->position(); }
36 bool active;
37 bool visited;
38};
39#include <float.h>
40#include <vpsc/block.h>
41static inline bool compareConstraints(const Constraint *const l,
42 const Constraint *const r) {
43 double const sl =
45 ||l->left->block==l->right->block
46 ?-DBL_MAX:l->slack();
47 double const sr =
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}
long timeStamp
Definition block.h:54
static bool compareConstraints(const Constraint *const l, const Constraint *const r)
Definition constraint.h:41
A constraint determines a minimum or exact spacing required between two variables.
Definition constraint.h:25
Variable * right
Definition constraint.h:29
bool visited
Definition constraint.h:37
double lm
Definition constraint.h:31
long timeStamp
Definition constraint.h:35
double gap
Definition constraint.h:30
Variable * left
Definition constraint.h:28
bool active
Definition constraint.h:36
double slack() const
Definition constraint.h:34
friend std::ostream & operator<<(std::ostream &os, const Constraint &c)
const int id
Definition variable.h:29
Block * block
Definition variable.h:33
double position() const
Definition variable.h:46