Go to the documentation of this file.
34 namespace Gecode {
namespace Gist {
40 : _startNode(theNode), _node(theNode),
41 _alternative(theNode->getAlternative(na0)),
67 return _node != _startNode && !_node->isRoot();
73 _node =
static_cast<Node*
>(_node->getParent(na));
74 if (_node->isRoot()) {
78 for (
int i=
p->getNumberOfChildren();
i--;) {
79 if (
p->getChild(na,
i) == _node) {
90 return _node->getNumberOfChildren() > 0;
97 _node = _node->getChild(na,0);
103 return (!_node->isRoot()) && (_node != _startNode) &&
104 (_alternative < _node->getParent(na)->getNumberOfChildren() - 1);
111 static_cast<Node*
>(_node->getParent(na)->getChild(na,++_alternative));
117 return (!onlyDirty ||
n->isDirty()) &&
119 (
n->hasSolvedChildren() ||
n->getNoOfOpenChildren(
na) > 0) &&
132 if (
n->getStatus() ==
BRANCH &&
133 !
n->hasSolvedChildren() &&
134 n->getNoOfOpenChildren(
na) == 0) {
136 n->setChildrenLayoutDone(
false);
163 if (
n->getStatus() ==
STOP) {
178 NextSolCursor::notOnSol(
void) {
228 curDepth(0), depth(0), failed(0), solved(0), choice(0), open(0) {}
233 switch (
n->getStatus()) {
257 int c_d,
int a_d,
bool clear,
260 _c_d(
c_d), _a_d(
a_d), _clear(clear) {}
270 n->getBranchLabel(_na,
p,
p->getChoice(),
273 if (
n->getNumberOfChildren() < 1 &&
void moveDownwards(void)
Move cursor to the first child node.
int choice
Number of choice nodes.
@ UNDETERMINED
Node that has not been explored yet.
int open
Number of open nodes.
void moveSidewards(void)
Move cursor to the first sibling.
int depth
Depth of the search tree.
A cursor that can be run over a tree.
bool mayMoveSidewards(void)
Test if cursor may move to the first sibling.
DisposeCursor(VisualNode *theNode, const VisualNode::NodeAllocator &na)
Constructor.
@ STOP
Node representing stop point.
void moveDownwards(void)
Move cursor to the first child node.
bool hasSolvedChildren(void)
Return whether the subtree of this node has any solved children.
Node class that supports visual layout
StatCursor(VisualNode *theNode, const VisualNode::NodeAllocator &na)
Constructor.
NodeStatus getStatus(void) const
Return current status of the node.
void moveUpwards(void)
Move cursor to the parent node.
bool mayMoveDownwards(void)
Test if the cursor may move to the first child node.
void moveDownwards(void)
Move cursor to the first child node.
NextSolCursor(VisualNode *theNode, bool backwards, const VisualNode::NodeAllocator &na)
Constructor.
bool isRoot(void) const
Check if this node is the root of a tree.
bool mayMoveUpwards(void)
Test if the cursor may move to the parent node.
bool hasLabel(T *n) const
Return whether node n has a label.
Base class for nodes of the search tree.
Gecode toplevel namespace
const Node::NodeAllocator & na
The node allocator.
BranchLabelCursor(VisualNode *theNode, BestNode *curBest, int c_d, int a_d, bool clear, VisualNode::NodeAllocator &na)
Constructor.
bool mayMoveSidewards(void)
Test if cursor may move to the first sibling.
void processCurrentNode(void)
Process node.
void processCurrentNode(void)
Collect statistics.
void clearLabel(T *n)
Remove label of node n.
HideFailedCursor(VisualNode *theNode, const VisualNode::NodeAllocator &na, bool onlyDirtyNodes)
Constructor.
bool mayMoveDownwards(void)
Test if cursor may move to the first child node.
bool mayMoveUpwards(void)
Test if the cursor may move to the parent node.
Static reference to the currently best space.
int solved
Number of solved nodes.
@ BRANCH
Node representing a branch.
int getParent(void) const
Return the parent.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
void dispose(void)
Free allocated memory.
UnhideAllCursor(VisualNode *theNode, const VisualNode::NodeAllocator &na)
Constructor.
void processCurrentNode(void)
Process node.
void processCurrentNode(void)
Process node.
void moveSidewards(void)
Move cursor to the first sibling.
NodeCursor(Node *theNode, const typename Node::NodeAllocator &na)
Construct cursor, initially set to theNode.
void processCurrentNode(void)
Do nothing.
Node * startNode(void)
Return start node.
void processCurrentNode(void)
UnstopAllCursor(VisualNode *theNode, const VisualNode::NodeAllocator &na)
Constructor.
void processCurrentNode(void)
Dispose node.
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
bool mayMoveDownwards(void)
Test if cursor may move to the first child node.
int n
Number of negative literals for node type.
@ FAILED
Node representing failure.
Gecode::IntArgs i({1, 2, 3, 4})
int p
Number of positive literals for node type.
unsigned int alternative(void)
Return current alternative.
int failed
Number of failed nodes.
const FloatNum max
Largest allowed float value.
@ SOLVED
Node representing a solution.
void moveUpwards(void)
Move cursor to the parent node.
void setLabel(T *n, const QString &l)
Set label of node n to l.
Node * node(void)
Return current node.