visualnode.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Guido Tack, 2006
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <gecode/gist/visualnode.hh>
#include <gecode/gist/layoutcursor.hh>
#include <gecode/gist/nodevisitor.hh>
#include <utility>
namespace Gecode { namespace Gist {
Shape* Shape::leaf;
Shape* Shape::hidden;
class ShapeAllocator {
public:
ShapeAllocator(void) {
Shape::leaf = Shape::allocate(1);
(*Shape::leaf)[0] = Extent(Layout::extent);
Shape::leaf->computeBoundingBox();
Shape::hidden = Shape::allocate(2);
(*Shape::hidden)[0] = Extent(Layout::extent);
(*Shape::hidden)[1] = Extent(Layout::extent);
Shape::hidden->computeBoundingBox();
}
~ShapeAllocator(void) {
Shape::deallocate(Shape::leaf);
Shape::deallocate(Shape::hidden);
}
};
ShapeAllocator shapeAllocator;
VisualNode::VisualNode(int p)
: SpaceNode(p)
, offset(0)
{
shape = NULL;
setDirty(true);
setChildrenLayoutDone(false);
setHidden(false);
setMarked(false);
setOnPath(false);
setBookmarked(false);
}
VisualNode::VisualNode(Space* root)
: SpaceNode(root)
, offset(0)
{
shape = NULL;
setDirty(true);
setChildrenLayoutDone(false);
setHidden(false);
setMarked(false);
setOnPath(false);
setBookmarked(false);
}
void
VisualNode::dispose(void) {
Shape::deallocate(shape);
SpaceNode::dispose();
}
void
VisualNode::dirtyUp(const NodeAllocator& na) {
VisualNode* cur = this;
while (!cur->isDirty()) {
cur->setDirty(true);
if (! cur->isRoot()) {
cur = cur->getParent(na);
}
}
}
void
VisualNode::layout(const NodeAllocator& na) {
LayoutCursor l(this,na);
PostorderNodeVisitor<LayoutCursor>(l).run();
// int nodesLayouted = 1;
// clock_t t0 = clock();
// while (p.next()) {}
// while (p.next()) { nodesLayouted++; }
// double t = (static_cast<double>(clock()-t0) / CLOCKS_PER_SEC) * 1000.0;
// double nps = static_cast<double>(nodesLayouted) /
// (static_cast<double>(clock()-t0) / CLOCKS_PER_SEC);
// std::cout << "Layout done. " << nodesLayouted << " nodes in "
// << t << " ms. " << nps << " nodes/s." << std::endl;
}
void VisualNode::pathUp(const NodeAllocator& na) {
VisualNode* cur = this;
while (cur) {
cur->setOnPath(true);
cur = cur->getParent(na);
}
}
void VisualNode::unPathUp(const NodeAllocator& na) {
VisualNode* cur = this;
while (!cur->isRoot()) {
cur->setOnPath(false);
cur = cur->getParent(na);
}
}
int
VisualNode::getPathAlternative(const NodeAllocator& na) {
for (int i=getNumberOfChildren(); i--;) {
if (getChild(na,i)->isOnPath())
return i;
}
return -1;
}
void
VisualNode::toggleHidden(const NodeAllocator& na) {
setHidden(!isHidden());
dirtyUp(na);
}
void
VisualNode::hideFailed(const NodeAllocator& na, bool onlyDirty) {
HideFailedCursor c(this,na,onlyDirty);
PreorderNodeVisitor<HideFailedCursor>(c).run();
dirtyUp(na);
}
void
VisualNode::labelBranches(NodeAllocator& na,
BestNode* curBest, int c_d, int a_d) {
bool clear = na.hasLabel(this);
BranchLabelCursor c(this,curBest,c_d,a_d,clear,na);
PreorderNodeVisitor<BranchLabelCursor>(c).run();
dirtyUp(na);
}
void
VisualNode::labelPath(NodeAllocator& na,
BestNode* curBest, int c_d, int a_d) {
if (na.hasLabel(this)) {
// clear labels on path to root
VisualNode* p = this;
while (p) {
na.clearLabel(p);
p = p->getParent(na);
}
} else {
// set labels on path to root
std::vector<std::pair<VisualNode*,int> > path;
VisualNode* p = this;
while (p) {
path.push_back(std::pair<VisualNode*,int>(p,p->getAlternative(na)));
p = p->getParent(na);
}
while (!path.empty()) {
std::pair<VisualNode*,int> cur = path.back(); path.pop_back();
if (p) {
std::string l =
cur.first->getBranchLabel(na,p,p->getChoice(),
curBest,c_d,a_d,cur.second);
na.setLabel(cur.first,QString(l.c_str()));
}
p = cur.first;
}
}
dirtyUp(na);
}
void
VisualNode::unhideAll(const NodeAllocator& na) {
UnhideAllCursor c(this,na);
PreorderNodeVisitor<UnhideAllCursor>(c).run();
dirtyUp(na);
}
void
VisualNode::toggleStop(const NodeAllocator& na) {
if (getStatus() == STOP)
setStatus(UNSTOP);
else if (getStatus() == UNSTOP)
setStatus(STOP);
dirtyUp(na);
}
void
VisualNode::unstopAll(const NodeAllocator& na) {
UnstopAllCursor c(this,na);
PreorderNodeVisitor<UnstopAllCursor>(c).run();
dirtyUp(na);
}
void
VisualNode::changedStatus(const NodeAllocator& na) { dirtyUp(na); }
bool
VisualNode::containsCoordinateAtDepth(int x, int depth) {
BoundingBox box = getShape()->getBoundingBox();
if (x < box.left ||
x > box.right ||
depth >= getShape()->depth()) {
return false;
}
Extent theExtent;
if (getShape()->getExtentAtDepth(depth, theExtent)) {
return (theExtent.l <= x && x <= theExtent.r);
} else {
return false;
}
}
VisualNode*
VisualNode::findNode(const NodeAllocator& na, int x, int y) {
VisualNode* cur = this;
int depth = y / Layout::dist_y;
while (depth > 0 && cur != NULL) {
if (cur->isHidden()) {
break;
}
VisualNode* oldCur = cur;
cur = NULL;
for (unsigned int i=0; i<oldCur->getNumberOfChildren(); i++) {
VisualNode* nextChild = oldCur->getChild(na,i);
int newX = x - nextChild->getOffset();
if (nextChild->containsCoordinateAtDepth(newX, depth - 1)) {
cur = nextChild;
x = newX;
break;
}
}
depth--;
y -= Layout::dist_y;
}
if(cur == this && !cur->containsCoordinateAtDepth(x, 0)) {
return NULL;
}
return cur;
}
std::string
VisualNode::toolTip(NodeAllocator&, BestNode*, int, int) {
return "";
}
std::string
VisualNode::getBranchLabel(NodeAllocator& na,
VisualNode* p, const Choice* c,
BestNode* curBest, int c_d, int a_d, int alt) {
std::ostringstream oss;
p->acquireSpace(na,curBest,c_d,a_d);
p->getWorkingSpace()->print(*c,alt,oss);
return oss.str();
}
class Layouter {
public:
template<class S1, class S2>
static int getAlpha(const S1& shape1, int depth1,
const S2& shape2, int depth2);
template<class S1, class S2>
static void merge(Extent* result,
const S1& shape1, int depth1,
const S2& shape2, int depth2, int alpha);
};
template<class S1, class S2>
int
Layouter::getAlpha(const S1& shape1, int depth1,
const S2& shape2, int depth2) {
int alpha = Layout::minimalSeparation;
int extentR = 0;
int extentL = 0;
for (int i=0; i<depth1 && i<depth2; i++) {
extentR += shape1[i].r;
extentL += shape2[i].l;
alpha = std::max(alpha, extentR - extentL + Layout::minimalSeparation);
}
return alpha;
}
template<class S1, class S2>
void
Layouter::merge(Extent* result,
const S1& shape1, int depth1,
const S2& shape2, int depth2, int alpha) {
if (depth1 == 0) {
for (int i=depth2; i--;)
result[i] = shape2[i];
} else if (depth2 == 0) {
for (int i=depth1; i--;)
result[i] = shape1[i];
} else {
// Extend the topmost right extent by alpha. This, in effect,
// moves the second shape to the right by alpha units.
int topmostL = shape1[0].l;
int topmostR = shape2[0].r;
int backoffTo1 =
shape1[0].r - alpha - shape2[0].r;
int backoffTo2 =
shape2[0].l + alpha - shape1[0].l;
result[0] = Extent(topmostL, topmostR+alpha);
// Now, since extents are given in relative units, in order to
// compute the extents of the merged shape, we can just collect the
// extents of shape1 and shape2, until one of the shapes ends. If
// this happens, we need to "back-off" to the axis of the deeper
// shape in order to properly determine the remaining extents.
int i=1;
for (; i<depth1 && i<depth2; i++) {
Extent currentExtent1 = shape1[i];
Extent currentExtent2 = shape2[i];
int newExtentL = currentExtent1.l;
int newExtentR = currentExtent2.r;
result[i] = Extent(newExtentL, newExtentR);
backoffTo1 += currentExtent1.r - currentExtent2.r;
backoffTo2 += currentExtent2.l - currentExtent1.l;
}
// If shape1 is deeper than shape2, back off to the axis of shape1,
// and process the remaining extents of shape1.
if (i<depth1) {
Extent currentExtent1 = shape1[i];
int newExtentL = currentExtent1.l;
int newExtentR = currentExtent1.r;
result[i] = Extent(newExtentL, newExtentR+backoffTo1);
++i;
for (; i<depth1; i++) {
result[i] = shape1[i];
}
}
// Vice versa, if shape2 is deeper than shape1, back off to the
// axis of shape2, and process the remaining extents of shape2.
if (i<depth2) {
Extent currentExtent2 = shape2[i];
int newExtentL = currentExtent2.l;
int newExtentR = currentExtent2.r;
result[i] = Extent(newExtentL+backoffTo2, newExtentR);
++i;
for (; i<depth2; i++) {
result[i] = shape2[i];
}
}
}
}
void
VisualNode::setShape(Shape* s) {
if (shape != s)
Shape::deallocate(shape);
shape = s;
shape->computeBoundingBox();
}
void
VisualNode::computeShape(const NodeAllocator& na) {
int numberOfShapes = getNumberOfChildren();
Extent extent;
if (na.hasLabel(this)) {
int ll = na.getLabel(this).length();
ll *= 7;
VisualNode* p = getParent(na);
int alt = 0;
int n_alt = 1;
if (p) {
alt = getAlternative(na);
n_alt = p->getNumberOfChildren();
}
extent = Extent(Layout::extent);
if (alt==0 && n_alt > 1) {
extent.l = std::min(extent.l, -ll);
} else if (alt==n_alt-1 && n_alt > 1) {
extent.r = std::max(extent.r, ll);
} else {
extent.l = std::min(extent.l, -ll);
extent.r = std::max(extent.r, ll);
}
} else {
if (numberOfShapes==0) {
setShape(Shape::leaf);
return;
} else {
extent = Extent(Layout::extent);
}
}
int maxDepth = 0;
for (int i = numberOfShapes; i--;)
maxDepth = std::max(maxDepth, getChild(na,i)->getShape()->depth());
Shape* mergedShape;
if (getShape() && getShape() != Shape::leaf &&
getShape()->depth() >= maxDepth+1) {
mergedShape = getShape();
mergedShape->setDepth(maxDepth+1);
} else {
mergedShape = Shape::allocate(maxDepth+1);
}
(*mergedShape)[0] = extent;
if (numberOfShapes < 1) {
setShape(mergedShape);
} else if (numberOfShapes == 1) {
getChild(na,0)->setOffset(0);
const Shape* childShape = getChild(na,0)->getShape();
for (int i=childShape->depth(); i--;)
(*mergedShape)[i+1] = (*childShape)[i];
(*mergedShape)[1].extend(- extent.l, - extent.r);
setShape(mergedShape);
} else {
// alpha stores the necessary distances between the
// axes of the shapes in the list: alpha[i].first gives the distance
// between shape[i] and shape[i-1], when shape[i-1] and shape[i]
// are merged left-to-right; alpha[i].second gives the distance between
// shape[i] and shape[i+1], when shape[i] and shape[i+1] are merged
// right-to-left.
Region r;
std::pair<int,int>* alpha =
r.alloc<std::pair<int,int> >(numberOfShapes);
// distance between the leftmost and the rightmost axis in the list
int width = 0;
Extent* currentShapeL = r.alloc<Extent>(maxDepth);
int ldepth = getChild(na,0)->getShape()->depth();
for (int i=ldepth; i--;)
currentShapeL[i] = (*getChild(na,0)->getShape())[i];
// After merging, we can pick the result of either merging left or right
// Here we chose the result of merging right
Shape* rShape = getChild(na,numberOfShapes-1)->getShape();
int rdepth = rShape->depth();
for (int i=rdepth; i--;)
(*mergedShape)[i+1] = (*rShape)[i];
Extent* currentShapeR = &(*mergedShape)[1];
for (int i = 1; i < numberOfShapes; i++) {
// Merge left-to-right. Note that due to the asymmetry of the
// merge operation, nextAlphaL is the distance between the
// *leftmost* axis in the shape list, and the axis of
// nextShapeL; what we are really interested in is the distance
// between the *previous* axis and the axis of nextShapeL.
// This explains the correction.
Shape* nextShapeL = getChild(na,i)->getShape();
int nextAlphaL =
Layouter::getAlpha<Extent*,Shape>(&currentShapeL[0], ldepth,
*nextShapeL, nextShapeL->depth());
Layouter::merge<Extent*,Shape>(&currentShapeL[0],
&currentShapeL[0], ldepth,
*nextShapeL, nextShapeL->depth(),
nextAlphaL);
ldepth = std::max(ldepth,nextShapeL->depth());
alpha[i].first = nextAlphaL - width;
width = nextAlphaL;
// Merge right-to-left. Here, a correction of nextAlphaR is
// not required.
Shape* nextShapeR = getChild(na,numberOfShapes-1-i)->getShape();
int nextAlphaR =
Layouter::getAlpha<Shape,Extent*>(*nextShapeR, nextShapeR->depth(),
&currentShapeR[0], rdepth);
Layouter::merge<Shape,Extent*>(&currentShapeR[0],
*nextShapeR, nextShapeR->depth(),
&currentShapeR[0], rdepth,
nextAlphaR);
rdepth = std::max(rdepth,nextShapeR->depth());
alpha[numberOfShapes - i].second = nextAlphaR;
}
// The merged shape has to be adjusted to its topmost extent
(*mergedShape)[1].extend(- extent.l, - extent.r);
// After the loop, the merged shape has the same axis as the
// leftmost shape in the list. What we want is to move the axis
// such that it is the center of the axis of the leftmost shape in
// the list and the axis of the rightmost shape.
int halfWidth = false ? 0 : width / 2;
(*mergedShape)[1].move(- halfWidth);
// Finally, for the offset lists. Now that the axis of the merged
// shape is at the center of the two extreme axes, the first shape
// needs to be offset by -halfWidth units with respect to the new
// axis. As for the offsets for the other shapes, we take the
// median of the alphaL and alphaR values, as suggested in
// Kennedy's paper.
int offset = - halfWidth;
getChild(na,0)->setOffset(offset);
for (int i = 1; i < numberOfShapes; i++) {
offset += (alpha[i].first + alpha[i].second) / 2;
getChild(na,i)->setOffset(offset);
}
setShape(mergedShape);
}
}
}}
// STATISTICS: gist-any
Gecode::Choice
Choice for performing commit
Definition core.hpp:1412
Gecode::Gist::BestNode
Static reference to the currently best space.
Definition spacenode.hh:80
Gecode::Gist::BoundingBox
Bounding box.
Definition visualnode.hh:52
Gecode::Gist::BoundingBox::right
int right
Right coordinate.
Definition visualnode.hh:57
Gecode::Gist::BoundingBox::left
int left
Left coordinate.
Definition visualnode.hh:55
Gecode::Gist::BranchLabelCursor
A cursor that labels branches.
Definition nodecursor.hh:191
Gecode::Gist::Extent
Extent representing shape of a tree at one depth level
Definition visualnode.hh:63
Gecode::Gist::Extent::l
int l
Left extent.
Definition visualnode.hh:66
Gecode::Gist::Extent::r
int r
Right extent.
Definition visualnode.hh:68
Gecode::Gist::Extent::extend
void extend(int deltaL, int deltaR)
Extend extent by deltaL and deltaR.
Definition visualnode.hpp:50
Gecode::Gist::HideFailedCursor
A cursor that marks failed subtrees as hidden.
Definition nodecursor.hh:86
Gecode::Gist::LayoutCursor
A cursor that computes a tree layout for VisualNodes.
Definition layoutcursor.hh:44
Gecode::Gist::Layout::dist_y
static const int dist_y
Definition visualnode.hh:46
Gecode::Gist::Layout::extent
static const int extent
Definition visualnode.hh:47
Gecode::Gist::Layout::minimalSeparation
static const int minimalSeparation
Definition visualnode.hh:48
Gecode::Gist::Layouter
Helper functions for the layout algorithm.
Definition visualnode.cpp:295
Gecode::Gist::Layouter::getAlpha
static int getAlpha(const S1 &shape1, int depth1, const S2 &shape2, int depth2)
Compute distance needed between shape1 and shape2.
Definition visualnode.cpp:310
Gecode::Gist::Layouter::merge
static void merge(Extent *result, const S1 &shape1, int depth1, const S2 &shape2, int depth2, int alpha)
Merge shape1 and shape2 into result with distance alpha.
Definition visualnode.cpp:325
Gecode::Gist::NodeAllocatorBase::getLabel
QString getLabel(T *n) const
Get label of node n.
Definition node.hpp:144
Gecode::Gist::NodeAllocatorBase::hasLabel
bool hasLabel(T *n) const
Return whether node n has a label.
Definition node.hpp:126
Gecode::Gist::NodeAllocatorBase::setLabel
void setLabel(T *n, const QString &l)
Set label of node n to l.
Definition node.hpp:132
Gecode::Gist::NodeAllocatorBase::clearLabel
void clearLabel(T *n)
Remove label of node n.
Definition node.hpp:138
Gecode::Gist::Node::NodeAllocator
NodeAllocatorBase< VisualNode > NodeAllocator
Definition node.hh:143
Gecode::Gist::Node::getNumberOfChildren
unsigned int getNumberOfChildren(void) const
Return the number of children.
Definition node.hpp:214
Gecode::Gist::Node::getParent
int getParent(void) const
Return the parent.
Definition node.hpp:182
Gecode::Gist::Node::getChild
int getChild(int n) const
Return index of child no n.
Definition node.hpp:195
Gecode::Gist::Node::isRoot
bool isRoot(void) const
Check if this node is the root of a tree.
Definition node.hpp:211
Gecode::Gist::PostorderNodeVisitor
Run a cursor over a tree, processing nodes in post-order.
Definition nodevisitor.hh:56
Gecode::Gist::PostorderNodeVisitor::run
void run(void)
Execute visitor.
Definition nodevisitor.hpp:79
Gecode::Gist::PreorderNodeVisitor
Run a cursor over a tree, processing nodes in pre-order.
Definition nodevisitor.hh:72
Gecode::Gist::PreorderNodeVisitor::run
void run(void)
Execute visitor.
Definition nodevisitor.hpp:117
Gecode::Gist::ShapeAllocator
Allocate shapes statically.
Definition visualnode.cpp:47
Gecode::Gist::ShapeAllocator::~ShapeAllocator
~ShapeAllocator(void)
Definition visualnode.cpp:60
Gecode::Gist::ShapeAllocator::ShapeAllocator
ShapeAllocator(void)
Constructor.
Definition visualnode.cpp:50
Gecode::Gist::Shape
The shape of a subtree.
Definition visualnode.hh:83
Gecode::Gist::Shape::getBoundingBox
const BoundingBox & getBoundingBox(void) const
Return bounding box.
Definition visualnode.hpp:124
Gecode::Gist::Shape::allocate
static Shape * allocate(int d)
Construct shape of depth d.
Definition visualnode.hpp:81
Gecode::Gist::Shape::depth
int depth(void) const
Return depth of the shape.
Definition visualnode.hpp:60
Gecode::Gist::Shape::leaf
static Shape * leaf
Static shape for leaf nodes.
Definition visualnode.hh:104
Gecode::Gist::Shape::hidden
static Shape * hidden
Static shape for hidden nodes.
Definition visualnode.hh:106
Gecode::Gist::Shape::deallocate
static void deallocate(Shape *)
Definition visualnode.hpp:91
Gecode::Gist::Shape::setDepth
void setDepth(int d)
Set depth of the shape to d (must be smaller than original depth).
Definition visualnode.hpp:63
Gecode::Gist::SpaceNode::getChoice
const Choice * getChoice(void)
Return choice of this node.
Definition spacenode.hpp:181
Gecode::Gist::SpaceNode::getWorkingSpace
const Space * getWorkingSpace(void) const
Return working space (if present).
Definition spacenode.hpp:112
Gecode::Gist::SpaceNode::setStatus
void setStatus(NodeStatus s)
Set status to s.
Definition spacenode.hpp:65
Gecode::Gist::SpaceNode::dispose
void dispose(void)
Free allocated memory.
Definition spacenode.cpp:291
Gecode::Gist::SpaceNode::acquireSpace
void acquireSpace(NodeAllocator &na, BestNode *curBest, int c_d, int a_d)
Acquire working space, either from parent or by recomputation.
Definition spacenode.cpp:156
Gecode::Gist::SpaceNode::getAlternative
int getAlternative(const NodeAllocator &na) const
Return alternative number of this node.
Definition spacenode.hpp:169
Gecode::Gist::SpaceNode::getStatus
NodeStatus getStatus(void) const
Return current status of the node.
Definition spacenode.hpp:71
Gecode::Gist::SpaceNode::SpaceNode
SpaceNode(int p)
Construct node with parent p.
Definition spacenode.hpp:89
Gecode::Gist::UnhideAllCursor
A cursor that marks all nodes in the tree as not hidden.
Definition nodecursor.hh:104
Gecode::Gist::UnstopAllCursor
A cursor that marks all nodes in the tree as not stopping.
Definition nodecursor.hh:117
Gecode::Gist::VisualNode
Node class that supports visual layout
Definition visualnode.hh:125
Gecode::Gist::VisualNode::unstopAll
void unstopAll(const NodeAllocator &na)
Do not stop at any stop node in the subtree of this node.
Definition visualnode.cpp:223
Gecode::Gist::VisualNode::offset
int offset
Relative offset from the parent node.
Definition visualnode.hh:138
Gecode::Gist::VisualNode::getPathAlternative
int getPathAlternative(const NodeAllocator &na)
Return the alternative of the child that is on the path (-1 if none).
Definition visualnode.cpp:144
Gecode::Gist::VisualNode::unPathUp
void unPathUp(const NodeAllocator &na)
Set all nodes from the node to the root not to be on the path.
Definition visualnode.cpp:135
Gecode::Gist::VisualNode::unhideAll
void unhideAll(const NodeAllocator &na)
Unhide all nodes in the subtree of this node.
Definition visualnode.cpp:207
Gecode::Gist::VisualNode::setShape
void setShape(Shape *s)
Set the shape of this node.
Definition visualnode.cpp:391
Gecode::Gist::VisualNode::setOnPath
void setOnPath(bool onPath0)
Set whether node is on the path.
Definition visualnode.hpp:198
Gecode::Gist::VisualNode::getOffset
int getOffset(void)
Return offset off this node from its parent.
Definition visualnode.hpp:147
Gecode::Gist::VisualNode::isHidden
bool isHidden(void)
Return if node is hidden.
Definition visualnode.hpp:129
Gecode::Gist::VisualNode::toggleStop
void toggleStop(const NodeAllocator &na)
Do not stop at this node.
Definition visualnode.cpp:214
Gecode::Gist::VisualNode::labelBranches
void labelBranches(NodeAllocator &na, BestNode *curBest, int c_d, int a_d)
Create or clear branch labels in subtree.
Definition visualnode.cpp:166
Gecode::Gist::VisualNode::setBookmarked
void setBookmarked(bool m)
Set bookmark of this node.
Definition visualnode.hpp:188
Gecode::Gist::VisualNode::computeShape
void computeShape(const NodeAllocator &na)
Compute the shape according to the shapes of the children.
Definition visualnode.cpp:399
Gecode::Gist::VisualNode::shape
Shape * shape
Shape of this node.
Definition visualnode.hh:140
Gecode::Gist::VisualNode::dispose
void dispose(void)
Free allocated memory.
Definition visualnode.cpp:96
Gecode::Gist::VisualNode::toggleHidden
void toggleHidden(const NodeAllocator &na)
Toggle whether this node is hidden.
Definition visualnode.cpp:153
Gecode::Gist::VisualNode::setHidden
void setHidden(bool h)
Set hidden state to h.
Definition visualnode.hpp:134
Gecode::Gist::VisualNode::getBranchLabel
std::string getBranchLabel(NodeAllocator &na, VisualNode *p, const Choice *c, BestNode *curBest, int c_d, int a_d, int alt)
Return string that describes the branch.
Definition visualnode.cpp:284
Gecode::Gist::VisualNode::labelPath
void labelPath(NodeAllocator &na, BestNode *curBest, int c_d, int a_d)
Create or clear branch labels on path to root.
Definition visualnode.cpp:175
Gecode::Gist::VisualNode::pathUp
void pathUp(const NodeAllocator &na)
Set all nodes from the node to the root to be on the path.
Definition visualnode.cpp:127
Gecode::Gist::VisualNode::dirtyUp
void dirtyUp(const NodeAllocator &na)
Mark all nodes up the path to the parent as dirty.
Definition visualnode.cpp:102
Gecode::Gist::VisualNode::changedStatus
void changedStatus(const NodeAllocator &na)
Signal that the status has changed.
Definition visualnode.cpp:230
Gecode::Gist::VisualNode::layout
void layout(const NodeAllocator &na)
Compute layout for the subtree of this node.
Definition visualnode.cpp:113
Gecode::Gist::VisualNode::setDirty
void setDirty(bool d)
Mark node as dirty.
Definition visualnode.hpp:158
Gecode::Gist::VisualNode::toolTip
std::string toolTip(NodeAllocator &na, BestNode *curBest, int c_d, int a_d)
Return string that is used as a tool tip.
Definition visualnode.cpp:279
Gecode::Gist::VisualNode::VisualNode
VisualNode(int p)
Construct with parent p.
Definition visualnode.cpp:69
Gecode::Gist::VisualNode::hideFailed
void hideFailed(const NodeAllocator &na, bool onlyDirty=false)
Hide all failed subtrees of this node.
Definition visualnode.cpp:159
Gecode::Gist::VisualNode::findNode
VisualNode * findNode(const NodeAllocator &na, int x, int y)
Find a node in this subtree at coordinates x, y.
Definition visualnode.cpp:249
Gecode::Gist::VisualNode::isDirty
bool isDirty(void)
Return whether node is marked as dirty.
Definition visualnode.hpp:153
Gecode::Gist::VisualNode::isOnPath
bool isOnPath(void)
Return whether node is on the path.
Definition visualnode.hpp:193
Gecode::Gist::VisualNode::containsCoordinateAtDepth
bool containsCoordinateAtDepth(int x, int depth)
Check if the x at depth depth lies in this subtree.
Definition visualnode.cpp:233
Gecode::Gist::VisualNode::setMarked
void setMarked(bool m)
Set mark of this node.
Definition visualnode.hpp:178
Gecode::Gist::VisualNode::setChildrenLayoutDone
void setChildrenLayoutDone(bool d)
Mark node whether the layout of the node's children has been completed.
Definition visualnode.hpp:168
Gecode::Gist::VisualNode::getShape
Shape * getShape(void)
Return the shape of this node.
Definition visualnode.hpp:203
Gecode::Region
Handle to region.
Definition region.hpp:55
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Space::print
void print(const Choice &c, unsigned int a, std::ostream &o) const
Print branch for choice c and alternative a.
Definition core.cpp:655
layoutcursor.hh
Gecode::Gist
The Gecode Interactive Search Tool.
Gecode::Gist::shapeAllocator
ShapeAllocator shapeAllocator
Allocate shapes statically.
Definition visualnode.cpp:67
Gecode::Gist::UNSTOP
@ UNSTOP
Node representing ignored stop point.
Definition spacenode.hh:50
Gecode::Gist::STOP
@ STOP
Node representing stop point.
Definition spacenode.hh:49
Gecode
Gecode toplevel namespace
Gecode::path
void path(Home home, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl=IPL_DEF)
Post propagator such that x forms a Hamiltonian path.
Definition circuit.cpp:169
nodevisitor.hh
visualnode.hh