23 #ifndef VPSC_CONSTRAINT_H 24 #define VPSC_CONSTRAINT_H 34 #include "libvpsc/variable.h" 39 typedef std::vector<Variable *>
Variables;
46 friend std::ostream& operator <<(std::ostream &os,
const Constraint &c);
70 std::stringstream stream;
71 stream <<
"Constraint: var(" <<
left->id <<
") ";
74 stream <<
"- " << -
gap <<
" ";
78 stream <<
"+ " <<
gap <<
" ";
80 stream << ((
equality) ?
"==" :
"<=");
81 stream <<
" var(" <<
right->id <<
") ";
85 inline double slack(
void)
const 96 COLA_ASSERT(
left->scale == 1);
97 COLA_ASSERT(
right->scale == 1);
98 return right->unscaledPosition() -
gap -
left->unscaledPosition();
119 class CompareConstraints {
139 #endif // VPSC_CONSTRAINT_H A variable is comprised of an ideal position, final position and a weight.
Definition: variable.h:44
Variable * right
The right Variable.
Definition: constraint.h:104
libvpsc: Variable Placement with Separation Constraints quadratic program solver library.
Definition: assertions.h:61
double gap
The minimum or exact distance to separate the variables by.
Definition: constraint.h:106
std::vector< Variable * > Variables
A vector of pointers to Variable objects.
Definition: constraint.h:38
std::string toString(void) const
Returns a textual description of the constraint.
Definition: constraint.h:68
std::vector< Constraint * > Constraints
A vector of pointers to Constraint objects.
Definition: constraint.h:125
Constraints constraintsRemovingRedundantEqualities(const Variables &vars, const Constraints &constraints)
Given a set of variables and constraints, returns a modified set of constraints with all redundant eq...
Definition: constraint.cpp:188
A constraint determines a minimum or exact spacing required between two Variable objects.
Definition: constraint.h:44
bool unsatisfiable
Denote whether this constraint was unsatisifable (once the VPSC instance has been solved or satisfied...
Definition: constraint.h:114
Constraint(Variable *left, Variable *right, double gap, bool equality=false)
Constructs a minimum or exact spacing constraint between two Variable objects.
Definition: constraint.cpp:35
Variable * left
The left Variable.
Definition: constraint.h:102
const bool equality
Whether the separation is an exact distance or not.
Definition: constraint.h:111