Graphviz 12.1.0~dev.20240716.0947
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(Constraint *const &l, Constraint *const &r) {
42 double const sl =
44 ||l->left->block==l->right->block
45 ?-DBL_MAX:l->slack();
46 double const sr =
48 ||r->left->block==r->right->block
49 ?-DBL_MAX:r->slack();
50 if(sl==sr) {
51 // arbitrary choice based on id
52 if(l->left->id==r->left->id) {
53 if(l->right->id<r->right->id) return true;
54 return false;
55 }
56 if(l->left->id<r->left->id) return true;
57 return false;
58 }
59 return sl < sr;
60}
long timeStamp
Definition block.h:56
static bool compareConstraints(Constraint *const &l, 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