22 #ifndef VPSC_VARIABLE_H 23 #define VPSC_VARIABLE_H 28 #include "libvpsc/block.h" 29 #include "libvpsc/assertions.h" 46 friend std::ostream& operator <<(std::ostream &os,
const Variable &v);
52 double desiredPosition;
60 bool fixedDesiredPosition;
64 inline Variable(
const int id,
const double desiredPos=-1.0,
65 const double weight=1.0,
const double scale=1.0)
67 , desiredPosition(desiredPos)
68 , finalPosition(desiredPos)
74 , fixedDesiredPosition(
false)
77 double dfdv(
void)
const {
78 return 2. * weight * ( position() - desiredPosition );
81 inline double position(
void)
const {
82 return (block->ps.scale*block->posn+offset)/scale;
84 inline double unscaledPosition(
void)
const {
85 COLA_ASSERT(block->ps.scale == 1);
86 COLA_ASSERT(scale == 1);
87 return block->posn + offset;
95 #endif // VPSC_VARIABLE_H A variable is comprised of an ideal position, final position and a weight.
Definition: variable.h:44
libvpsc: Variable Placement with Separation Constraints quadratic program solver library.
Definition: assertions.h:61
Static solver for Variable Placement with Separation Constraints problem instance.
Definition: solve_VPSC.h:60
std::vector< Variable * > Variables
A vector of pointers to Variable objects.
Definition: constraint.h:38
std::vector< Constraint * > Constraints
A vector of pointers to Constraint objects.
Definition: constraint.h:125
A constraint determines a minimum or exact spacing required between two Variable objects.
Definition: constraint.h:44