54 Offset(
unsigned ind,
double offset) :
89 fprintf(fp,
" BoundaryConstraint *boundary%llu = "
90 "new BoundaryConstraint(vpsc::%cDIM);\n",
91 (
unsigned long long)
this, (
_primaryDim == 0) ?
'X' :
'Y');
95 Offset *info =
static_cast<Offset *
> (*o);
96 fprintf(fp,
" boundary%llu->addShape(%u, %g);\n",
97 (
unsigned long long)
this, info->varIndex, info->distOffset);
99 fprintf(fp,
" ccs.push_back(boundary%llu);\n\n",
100 (
unsigned long long)
this);
106 std::ostringstream stream;
107 stream <<
"BoundaryConstraint(";
108 stream <<
"dim: " << ((
_primaryDim == 0) ?
'X' :
'Y');
114 Offset *info =
static_cast<Offset *
> (*o);
119 stream <<
"(" <<
"rect: " << info->varIndex <<
", offset: " << info->distOffset <<
")";
151 Offset *info =
static_cast<Offset *
> (*o);
154 if (info->distOffset < 0)
166 vars[info->varIndex], info->distOffset);
169 cs.push_back(constraint);
180 Offset *info =
static_cast<Offset *
>
184 if (info->distOffset < 0)
290 Offset *info =
static_cast<Offset *
> (*o);
293 variable, vars[info->varIndex], info->distOffset,
true);
295 cs.push_back(constraint);
301 const std::vector<double>& offsets,
bool forward)
306 Offset *info =
static_cast<Offset *
> (*o);
307 if (offsets[info->varIndex] == 0)
314 info->distOffset -= offsets[info->varIndex];
318 info->distOffset += offsets[info->varIndex];
325 fprintf(fp,
" AlignmentConstraint *alignment%llu = "
326 "new AlignmentConstraint(vpsc::%cDIM, %g);\n",
327 (
unsigned long long)
this, (
_primaryDim == 0) ?
'X' :
'Y',
331 fprintf(fp,
" alignment%llu->fixPos(%g);\n",
337 Offset *info =
static_cast<Offset *
> (*o);
338 fprintf(fp,
" alignment%llu->addShape(%u, %g);\n",
339 (
unsigned long long)
this, info->varIndex, info->distOffset);
341 fprintf(fp,
" ccs.push_back(alignment%llu);\n\n",
342 (
unsigned long long)
this);
348 std::ostringstream stream;
349 stream <<
"AlignmentConstraint(";
350 stream <<
"dim: " << ((
_primaryDim == 0) ?
'X' :
'Y');
354 stream <<
", fixed: true";
368 Offset *info =
static_cast<Offset *
> (*o);
373 stream <<
"(" <<
"rect: " << info->varIndex <<
", offset: " << info->distOffset <<
")";
386 Offset *info =
static_cast<Offset *
>
391 info->distOffset,
true);
407 VarIndexPair(
unsigned ind1,
unsigned ind2)
409 lConstraint(nullptr),
410 rConstraint(nullptr),
414 VarIndexPair(AlignmentConstraint *l, AlignmentConstraint *r)
415 : SubConstraintInfo(0),
421 unsigned indexL(
void)
const
423 return (lConstraint) ?
424 (unsigned) lConstraint->variable->id :
varIndex;
426 unsigned indexR(
void)
const
428 return (rConstraint) ?
429 (unsigned) rConstraint->variable->id : varIndex2;
431 void updateVarIDsWithMapping(
const VariableIDMap& idMap,
bool forward)
434 varIndex2 = idMap.mappingForVariable(varIndex2, forward);
437 AlignmentConstraint *lConstraint;
438 AlignmentConstraint *rConstraint;
444 unsigned l,
unsigned r,
double g,
bool equality)
448 vpscConstraint(nullptr)
472 if (varIndexPair->lConstraint && varIndexPair->rConstraint)
474 fprintf(fp,
" SeparationConstraint *separation%llu = "
475 "new SeparationConstraint(vpsc::%cDIM, alignment%llu, "
476 "alignment%llu, %g, %s);\n",
477 (
unsigned long long)
this, (
_primaryDim == 0) ?
'X' :
'Y',
478 (
unsigned long long) varIndexPair->lConstraint,
479 (
unsigned long long) varIndexPair->rConstraint,
gap,
484 fprintf(fp,
" SeparationConstraint *separation%llu = "
485 "new SeparationConstraint(vpsc::%cDIM, %u, %u, %g, %s);\n",
486 (
unsigned long long)
this, (
_primaryDim == 0) ?
'X' :
'Y',
487 varIndexPair->indexL(), varIndexPair->indexR(),
gap,
490 fprintf(fp,
" ccs.push_back(separation%llu);\n\n",
491 (
unsigned long long)
this);
497 std::ostringstream stream;
498 stream <<
"SeparationConstraint(";
499 stream <<
"dim: " << ((
_primaryDim == 0) ?
'X' :
'Y');
500 stream <<
", sep: " <<
gap;
501 stream <<
", equality: " << ((
equality) ?
"true" :
"false");
504 if (varIndexPair->lConstraint && varIndexPair->rConstraint)
506 stream <<
"(alignment: " << varIndexPair->indexL() <<
"), ";
507 stream <<
"(alignment: " << varIndexPair->indexR() <<
"), ";
511 stream <<
"(rect: " << varIndexPair->indexL() <<
"), ";
512 stream <<
"(rect: " << varIndexPair->indexR() <<
"), ";
534 VarIndexPair *info =
static_cast<VarIndexPair *
>
558 unsigned left = info->indexL();
559 unsigned right = info->indexR();
575 return info->indexL();
584 return info->indexR();
603 unsigned l,
unsigned r)
607 vpscConstraint(nullptr)
624 fprintf(fp,
" /* OrthogonalEdgeConstraint *orthogonal%llu = nullptr; */\n\n",
625 (
unsigned long long)
this);
631 std::ostringstream stream;
632 stream <<
"OrthogonalEdgeConstraint()";
668 vector<vpsc::Constraint*> & cs)
672 double lBound, rBound, pos;
675 lBound =
rs[
left]->getCentreY();
676 rBound =
rs[
right]->getCentreY();
677 pos =
rs[
left]->getCentreX();
681 lBound =
rs[
left]->getCentreX();
682 rBound =
rs[
right]->getCentreX();
683 pos =
rs[
left]->getCentreY();
685 double minBound = std::min(lBound, rBound);
686 double maxBound = std::max(lBound, rBound);
687 for (
unsigned i = 0; i <
rs.size(); ++i)
692 double l, rMin, rMax, rCentre;
694 if ( ((rMin >= minBound) && (rMin <= maxBound)) ||
695 ((rMax >= minBound) && (rMax <= maxBound)))
713 double& centre,
double & l)
const
745 AlignmentConstraint *alignment1;
746 AlignmentConstraint *alignment2;
751 double minSep,
bool equality)
769 fprintf(fp,
" MultiSeparationConstraint *multiSep%llu = "
770 "new MultiSeparationConstraint(vpsc::%cDIM, %g, %s);\n",
776 AlignmentPair *pair =
static_cast<AlignmentPair *
> (*o);
777 fprintf(fp,
" multiSep%llu->addAlignmentPair("
778 "alignment%llu, alignment%llu);\n",
779 (
unsigned long long)
this,
780 (
unsigned long long) pair->alignment1,
781 (
unsigned long long) pair->alignment2);
783 fprintf(fp,
" ccs.push_back(multiSep%llu);\n\n",
784 (
unsigned long long)
this);
790 std::ostringstream stream;
791 stream <<
"MultiSeparationConstraint(";
792 stream <<
"dim: " << ((
_primaryDim == 0) ?
'X' :
'Y');
793 stream <<
", sep: " <<
sep;
794 stream <<
", equality: " << ((
equality) ?
"true" :
"false");
804 AlignmentPair *pair =
static_cast<AlignmentPair *
> (*o);
805 stream <<
"(alignment: " << pair->alignment1->variable->id
806 <<
", alignment: " << pair->alignment2->variable->id <<
")";
832 AlignmentPair *info =
static_cast<AlignmentPair *
>
867 AlignmentPair *info =
static_cast<AlignmentPair *
> (*o);
920 fprintf(fp,
" DistributionConstraint *distribution%llu = "
921 "new DistributionConstraint(vpsc::%cDIM);\n",
922 (
unsigned long long)
this, (
_primaryDim == 0) ?
'X' :
'Y');
923 fprintf(fp,
" distribution%llu->setSeparation(%g);\n",
924 (
unsigned long long)
this,
sep);
928 AlignmentPair *pair =
static_cast<AlignmentPair *
> (*o);
929 fprintf(fp,
" distribution%llu->addAlignmentPair("
930 "alignment%llu, alignment%llu);\n",
931 (
unsigned long long)
this,
932 (
unsigned long long) pair->alignment1,
933 (
unsigned long long) pair->alignment2);
935 fprintf(fp,
" ccs.push_back(distribution%llu);\n\n",
936 (
unsigned long long)
this);
942 std::ostringstream stream;
943 stream <<
"DistributionConstraint(";
944 stream <<
"dim: " << ((
_primaryDim == 0) ?
'X' :
'Y');
945 stream <<
", sep: " <<
sep;
955 AlignmentPair *pair =
static_cast<AlignmentPair *
> (*o);
956 stream <<
"(alignment: " << pair->alignment1->variable->id
957 <<
", alignment: " << pair->alignment2->variable->id <<
")";
972 AlignmentPair *info =
static_cast<AlignmentPair *
>
1001 AlignmentPair *info =
static_cast<AlignmentPair *
> (*o);
1021 (*Q)[make_pair(variable->id,variable->id)]+=
w;
1024 (*Q)[make_pair(c1->
variable->
id,variable->id)]+=
w;
1025 (*Q)[make_pair(variable->id,c1->
variable->
id)]+=
w;
1026 (*Q)[make_pair(c2->
variable->
id,variable->id)]-=
w;
1027 (*Q)[make_pair(variable->id,c2->
variable->
id)]-=
w;
1042 RelativeOffset(
unsigned indL,
unsigned indR,
vpsc::Dim dim,
1050 void updateVarIDsWithMapping(
const VariableIDMap& idMap,
bool forward)
1053 varIndex2 = idMap.mappingForVariable(varIndex2, forward);
1063 std::vector<unsigned> shapeIds,
const bool fixedPosition)
1065 m_fixed_position(fixedPosition),
1066 m_shape_vars(shapeIds)
1072 std::vector<unsigned>::iterator last =
1076 unsigned firstId = UINT_MAX;
1078 for (std::vector<unsigned>::iterator it =
m_shape_vars.begin();
1081 COLA_ASSERT(*it <
rs.size());
1089 unsigned thisId = *it;
1091 new RelativeOffset(firstId, thisId,
vpsc::XDIM,
1092 rs[thisId]->getCentreX() -
rs[firstId]->getCentreX()));
1094 new RelativeOffset(firstId, thisId,
vpsc::YDIM,
1095 rs[thisId]->getCentreY() -
rs[firstId]->getCentreY()));
1126 for (std::vector<unsigned>::iterator it =
m_shape_vars.begin();
1129 vars[*it]->fixedDesiredPosition =
true;
1130 vars[*it]->weight = 100000;
1138 fprintf(fp,
" std::vector<unsigned> fixedRelativeSet%llu;\n",
1139 (
unsigned long long)
this);
1140 for (std::vector<unsigned>::const_iterator it =
m_shape_vars.begin();
1143 fprintf(fp,
" fixedRelativeSet%llu.push_back(%u);\n",
1144 (
unsigned long long)
this, *it);
1146 fprintf(fp,
" FixedRelativeConstraint *fixedRelative%llu = "
1147 "new FixedRelativeConstraint(rs, fixedRelativeSet%llu, %s);\n",
1148 (
unsigned long long)
this, (
unsigned long long)
this,
1150 fprintf(fp,
" ccs.push_back(fixedRelative%llu);\n\n",
1151 (
unsigned long long)
this);
1157 std::ostringstream stream;
1158 stream <<
"FixedRelativeConstraint(";
1162 for (std::vector<unsigned>::const_iterator it =
m_shape_vars.begin();
1169 stream <<
"(rect: " << *it <<
")";
1173 return stream.str();
1184 RelativeOffset *
offset =
static_cast<RelativeOffset *
>
1193 return alternatives;
1207 RelativeOffset *
offset =
static_cast<RelativeOffset *
> (*o);
1231 PageBoundaryShapeOffsets(
unsigned ind,
double xOffset,
double yOffset) :
1234 halfDim[0] = xOffset;
1235 halfDim[1] = yOffset;
1242 double yLow,
double yHigh,
double weight)
1245 COLA_ASSERT(xLow < xHigh);
1246 COLA_ASSERT(yLow < yHigh);
1253 for (
unsigned i = 0; i < 2; ++i)
1273 fprintf(fp,
" PageBoundaryConstraints *pageBoundary%llu = "
1274 "new PageBoundaryConstraints(%g, %g, %g, %g, %g);\n",
1281 PageBoundaryShapeOffsets *offsets =
1282 static_cast<PageBoundaryShapeOffsets *
> (*o);
1283 fprintf(fp,
" pageBoundary%llu->addShape(%u, %g, %g);\n",
1284 (
unsigned long long)
this, offsets->varIndex,
1285 offsets->halfDim[XDIM], offsets->halfDim[YDIM]);
1287 fprintf(fp,
" ccs.push_back(pageBoundary%llu);\n\n",
1288 (
unsigned long long)
this);
1294 std::ostringstream stream;
1295 stream <<
"PageBoundaryConstraints(";
1310 PageBoundaryShapeOffsets *offsets =
1311 static_cast<PageBoundaryShapeOffsets *
> (*o);
1312 stream <<
"(rect: " << offsets->varIndex;
1313 stream <<
", halfWidth: " << offsets->halfDim[XDIM];
1314 stream <<
", halfHeight: " << offsets->halfDim[YDIM];
1319 return stream.str();
1390 PageBoundaryShapeOffsets *info =
1391 static_cast<PageBoundaryShapeOffsets *
> (*o);
1396 vs[info->varIndex], info->halfDim[dim]);
1398 cs.push_back(constraint);
1404 vs[info->varIndex],
vr[dim], info->halfDim[dim]);
1406 cs.push_back(constraint);
1417struct GenerateVariables
1424 void operator() (CompoundConstraint *
c)
1426 c->generateVariables(dim, vars);
1434struct GenerateSeparationConstraints
1444 void operator() (CompoundConstraint *
c)
1446 c->generateSeparationConstraints(dim, vars, cs, bbs);
1459 for_each(ccs.begin(), ccs.end(),
1460 GenerateVariables(dim, vars));
1461 for_each(ccs.begin(), ccs.end(),
1462 GenerateSeparationConstraints(dim, vars, cs, bbs));
1469 for_each(ccs.begin(), ccs.end(),
1470 GenerateVariables(dim, vars));
1475 unsigned int priority) :
1476 _primaryDim(primaryDim),
1477 _secondaryDim((
vpsc::Dim) ((primaryDim + 1) % 2)),
1478 _priority(priority),
1479 _combineSubConstraints(false),
1480 _currSubConstraintIndex(0)
1518 (*o)->updateVarIDsWithMapping(idMap, forward);
1525 std::list<unsigned> idList;
1559 const unsigned index)
1561 if (
index >= vars.size())
1576 : leftVarIndex(
c->left->id),
1577 rightVarIndex(
c->right->id),
1579 equality(
c->equality),
1606 if (ids.first == from)
1615 m_mapping.push_back(std::make_pair(from, to));
1624 fprintf(fp,
" cola::VariableIDMap idMap;\n");
1625 for (IDPairList::const_iterator it =
m_mapping.begin();
1628 fprintf(fp,
" idMap.addMappingForVariable(%u, %u);\n",
1629 it->first, it->second);
1637 for (IDPairList::const_iterator it =
m_mapping.begin();
1644 if (ids.first == var)
1651 if (ids.second == var)
An alignment constraint specifies a alignment line that a set of nodes must be constrained to by an e...
void printCreationCode(FILE *fp) const
double position(void) const
void fixPos(double pos)
Mark the alignment as ideally having a fixed position.
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &cs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
void addShape(const unsigned int index, const double offset)
Mark a node as being part of this alignment constraint.
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
void updateShapeOffsetsForDifferentCentres(const std::vector< double > &offsets, bool forward=true)
void unfixPos(void)
Mark the alignment as not having a fixed position.
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
bool isFixed(void) const
Indicates if the alignment position is marked as fixed.
void updatePosition(const vpsc::Dim dim)
Implemented by the compound constraint to send position information back to the interface.
vpsc::Variable * variable
std::string toString(void) const
Returns a textual description of the compound constraint.
AlignmentConstraint(const vpsc::Dim dim, double position=0.0)
Constructs a new AlignmentConstraint in the specified dimension.
void updatePosition(const vpsc::Dim dim)
Implemented by the compound constraint to send position information back to the interface.
double position
Holds the position of the boundary line, once layout is complete.
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &cs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
std::string toString(void) const
Returns a textual description of the compound constraint.
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
void addShape(const unsigned int index, const double offset)
Mark a node as being part of this boundary constraint.
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
void printCreationCode(FILE *fp) const
BoundaryConstraint(const vpsc::Dim dim)
Constructs a new BoundaryConstraint in the specified dimension.
vpsc::Variable * variable
An abstract base class for all high-level compound constraints.
unsigned int priority(void) const
virtual ~CompoundConstraint()
void assertValidVariableIndex(const vpsc::Variables &vars, const unsigned index)
virtual bool subConstraintsRemaining(void) const
size_t _currSubConstraintIndex
CompoundConstraint(vpsc::Dim primaryDim, unsigned int priority=DEFAULT_CONSTRAINT_PRIORITY)
virtual void printCreationCode(FILE *fp) const
virtual void updateVarIDsWithMapping(const VariableIDMap &idMap, bool forward=true)
vpsc::Dim dimension(void) const
std::list< unsigned > subConstraintObjIndexes(void) const
bool _combineSubConstraints
SubConstraintInfoList _subConstraintInfo
virtual void markAllSubConstraintsAsInactive(void)
virtual void markCurrSubConstraintAsActive(const bool satisfiable)
bool shouldCombineSubConstraints(void) const
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
DistributionConstraint(const vpsc::Dim dim)
Constructs a new empty DistributionConstraint with a minimum or exact spacing.
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &gcs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
void addAlignmentPair(AlignmentConstraint *ac1, AlignmentConstraint *ac2)
Mark a pair of alignment constraints as being part of this distribution constraint.
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
void setSeparation(double sep)
Alter the exact spacing between each pair of alignment constraints.
std::string toString(void) const
Returns a textual description of the compound constraint.
void printCreationCode(FILE *fp) const
std::vector< unsigned > m_shape_vars
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
FixedRelativeConstraint(const vpsc::Rectangles &rs, std::vector< unsigned > shapeIds, const bool fixedPosition=false)
Constructs a new FixedRelativeConstraint between a set of nodes, optionally with a fixed position.
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &gcs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
void printCreationCode(FILE *fp) const
void updateVarIDsWithMapping(const VariableIDMap &idMap, bool forward=true)
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
std::string toString(void) const
Returns a textual description of the compound constraint.
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vs, vpsc::Constraints &gcs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
void printCreationCode(FILE *fp) const
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
MultiSeparationConstraint(const vpsc::Dim dim, double minSep=0, bool equality=false)
Constructs a new empty MultiSeparationConstraint with a minimum or exact spacing.
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
void addAlignmentPair(AlignmentConstraint *ac1, AlignmentConstraint *ac2)
Mark a pair of alignment constraints as being part of this multi separation constraint.
void setSeparation(double sep)
Alter the minimum or exact spacing between each pair of alignment constraints.
std::string toString(void) const
Returns a textual description of the compound constraint.
void printCreationCode(FILE *fp) const
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
OrthogonalEdgeConstraint(const vpsc::Dim dim, unsigned l, unsigned r)
void rectBounds(const vpsc::Dim k, vpsc::Rectangle const *r, double &cmin, double &cmax, double ¢re, double &l) const
vpsc::Constraint * vpscConstraint
void generateTopologyConstraints(const vpsc::Dim k, vpsc::Rectangles const &rs, std::vector< vpsc::Variable * > const &vars, std::vector< vpsc::Constraint * > &cs)
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vs, vpsc::Constraints &cs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
std::string toString(void) const
Returns a textual description of the compound constraint.
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &gcs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
double actualRightMargin[2]
void updatePosition(const vpsc::Dim dim)
Implemented by the compound constraint to send position information back to the interface.
double getActualRightMargin(const vpsc::Dim dim)
double getActualLeftMargin(const vpsc::Dim dim)
double actualLeftMargin[2]
void printCreationCode(FILE *fp) const
PageBoundaryConstraints(double xLow, double xHigh, double yLow, double yHigh, double weight=100.0)
Constructs a new PageBoundaryConstraints object with given page boundary positions and weight.
std::string toString(void) const
Returns a textual description of the compound constraint.
void addShape(unsigned index, double halfW, double halfH)
Mark a node as being contained within this page boundary.
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
void generateSeparationConstraints(const vpsc::Dim dim, vpsc::Variables &vs, vpsc::Constraints &cs, vpsc::Rectangles &bbs)
Implemented by the compound constraint to generate the low-level separation constraints in the given ...
unsigned left(void) const
void generateVariables(const vpsc::Dim dim, vpsc::Variables &vars)
Implemented by the compound constraint to generate any additional required variables in the given dim...
std::string toString(void) const
Returns a textual description of the compound constraint.
SubConstraintAlternatives getCurrSubConstraintAlternatives(vpsc::Variables vs[])
unsigned right(void) const
SeparationConstraint(const vpsc::Dim dim, unsigned l, unsigned r, double g, bool equality=false)
Constructs a new SeparationConstraint between two nodes in the specified dimension.
void setSeparation(double gap)
void printCreationCode(FILE *fp) const
vpsc::Constraint * vpscConstraint
virtual void updateVarIDsWithMapping(const VariableIDMap &idMap, bool forward)
UnsatisfiableConstraintInfo(const vpsc::Constraint *c)
Holds a mapping between two sets of Variable indices.
std::list< std::pair< unsigned, unsigned > > m_mapping
unsigned mappingForVariable(const unsigned var, bool forward=true) const
bool addMappingForVariable(const unsigned from, const unsigned to)
Adds a mapping between a pair of variables.
void printCreationCode(FILE *fp) const
A constraint determines a minimum or exact spacing required between two Variable objects.
double gap
The minimum or exact distance to separate the variables by.
A rectangle represents a fixed-size shape in the diagram that may be moved to prevent overlaps and sa...
double getCentreY() const
double getCentreX() const
A variable is comprised of an ideal position, final position and a weight.
bool fixedDesiredPosition
vector< vpsc::Rectangle * > rs
libcola: Force-directed network layout subject to separation constraints library.
std::vector< CompoundConstraint * > CompoundConstraints
A vector of pointers to CompoundConstraint objects.
static const double freeWeight
void generateVariablesAndConstraints(CompoundConstraints &ccs, const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &cs, vpsc::Rectangles &bbs)
Generate all the variables and constraints for a collection of CompoundConstraints.
void generateVariables(CompoundConstraints &ccs, const vpsc::Dim dim, vpsc::Variables &vars)
Generate just all the variables for a collection of CompoundConstraints.
std::pair< unsigned, unsigned > IDPair
std::list< IDPair > IDPairList
std::list< SubConstraint > SubConstraintAlternatives
libvpsc: Variable Placement with Separation Constraints quadratic program solver library.
Dim
Indicates the x- or y-dimension.
@ HORIZONTAL
The x-dimension (0).
@ XDIM
The x-dimension (0).
@ YDIM
The y-dimension (1).
std::vector< vpsc::Variable * > Variables
A vector of pointers to Variable objects.
std::vector< vpsc::Constraint * > Constraints
A vector of pointers to Constraint objects.
std::vector< Rectangle * > Rectangles
A vector of pointers to Rectangle objects.