Generated on Tue Jul 27 2010 21:59:26 for Gecode by doxygen 1.7.1

A node of a search tree of Gecode spaces. More...

#include <spacenode.hh>

List of all members.

Public Member Functions

 SpaceNode (void)
 Construct node.
 SpaceNode (Space *root)
 Construct root node from Space root and branch-and-bound object better.
 ~SpaceNode (void)
 Destructor.
SpacegetSpace (BestNode *curBest, int c_d, int a_d)
 Return working space. Receiver must delete the space.
const SpacegetWorkingSpace (void) const
 Return working space (if present).
void purge (void)
 Clear working space and copy (if present and this is not the root).
bool isCurrentBest (BestNode *curBest)
 Return whether this node is the currently best solution.
int getNumberOfChildNodes (NodeAllocator &na, BestNode *curBest, Statistics &stats, int c_d, int a_d)
 Compute and return the number of children.
NodeStatus getStatus (void) const
 Return current status of the node.
bool isOpen (void)
 Return whether this node still has open children.
bool hasFailedChildren (void)
 Return whether the subtree of this node has any failed children.
bool hasSolvedChildren (void)
 Return whether the subtree of this node has any solved children.
bool hasOpenChildren (void)
 Return whether the subtree of this node has any open children.
int getNoOfOpenChildren (void)
 Return number of open children.
void setNoOfOpenChildren (int n)
 Set number of open children to n.
bool hasCopy (void)
 Return whether the node has a copy.
bool hasWorkingSpace (void)
 Return whether the node has a working space.
SpaceNodegetParent (void)
 Return the parent.
SpaceNodegetChild (int i)
 Return child i.
int getAlternative (void)
 Return alternative number of this node.
const ChoicegetChoice (void)
 Return choice of this node.

Protected Types

enum  SpaceNodeFlags { HASOPENCHILDREN = FIRSTBIT, HASFAILEDCHILDREN, HASSOLVEDCHILDREN }
 

Flags for SpaceNodes.

More...

Protected Member Functions

void setDistance (unsigned int d)
 Set distance from copy.
unsigned int getDistance (void) const
 Return distance from copy.
void setFlag (int flag, bool value)
 Set status flag.
bool getFlag (int flag) const
 Return status flag.
void setStatus (NodeStatus s)
 Set status to s.
void acquireSpace (BestNode *curBest, int c_d, int a_d)
 Acquire working space, either from parent or by recomputation.

Protected Attributes

Spacecopy
 A copy used for recomputation, or NULL.
SpaceworkingSpace
 Working space used for computing the status.
const Choicechoice

Static Protected Attributes

static const int LASTBIT = HASSOLVEDCHILDREN
 Last bit used for SpaceNode flags.

Detailed Description

A node of a search tree of Gecode spaces.

Definition at line 93 of file spacenode.hh.


Member Enumeration Documentation

Flags for SpaceNodes.

Enumerator:
HASOPENCHILDREN 
HASFAILEDCHILDREN 
HASSOLVEDCHILDREN 

Definition at line 125 of file spacenode.hh.


Constructor & Destructor Documentation

Gecode::Gist::SpaceNode::SpaceNode ( void   )  [inline]

Construct node.

Definition at line 103 of file spacenode.hpp.

Gecode::Gist::SpaceNode::SpaceNode ( Space root  ) 

Construct root node from Space root and branch-and-bound object better.

Definition at line 256 of file spacenode.cpp.

Gecode::Gist::SpaceNode::~SpaceNode ( void   ) 

Destructor.

Definition at line 276 of file spacenode.cpp.


Member Function Documentation

void Gecode::Gist::SpaceNode::setDistance ( unsigned int  d  )  [inline, protected]

Set distance from copy.

Definition at line 90 of file spacenode.hpp.

unsigned int Gecode::Gist::SpaceNode::getDistance ( void   )  const [inline, protected]

Return distance from copy.

Definition at line 98 of file spacenode.hpp.

void Gecode::Gist::SpaceNode::setFlag ( int  flag,
bool  value 
) [inline, protected]

Set status flag.

Definition at line 51 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::getFlag ( int  flag  )  const [inline, protected]

Return status flag.

Definition at line 59 of file spacenode.hpp.

void Gecode::Gist::SpaceNode::setStatus ( NodeStatus  s  )  [inline, protected]

Set status to s.

Definition at line 79 of file spacenode.hpp.

void Gecode::Gist::SpaceNode::acquireSpace ( BestNode curBest,
int  c_d,
int  a_d 
) [protected]

Acquire working space, either from parent or by recomputation.

Definition at line 136 of file spacenode.cpp.

Space * Gecode::Gist::SpaceNode::getSpace ( BestNode curBest,
int  c_d,
int  a_d 
) [inline]

Return working space. Receiver must delete the space.

Definition at line 112 of file spacenode.hpp.

const Space * Gecode::Gist::SpaceNode::getWorkingSpace ( void   )  const [inline]

Return working space (if present).

Definition at line 120 of file spacenode.hpp.

void Gecode::Gist::SpaceNode::purge ( void   )  [inline]

Clear working space and copy (if present and this is not the root).

Definition at line 125 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::isCurrentBest ( BestNode curBest  )  [inline]

Return whether this node is the currently best solution.

Definition at line 139 of file spacenode.hpp.

int Gecode::Gist::SpaceNode::getNumberOfChildNodes ( NodeAllocator na,
BestNode curBest,
Statistics stats,
int  c_d,
int  a_d 
)

Compute and return the number of children.

On a node whose status is already determined, this function just returns the number of children. On an undetermined node, it first acquires a Space (possibly through recomputation), and then asks for its status. If the space is solved or failed, the node's status will be set accordingly, and 0 will be returned. Otherwise, the status is SS_BRANCH, and as many new children will be created as the branch has alternatives, and the number returned.

Definition at line 284 of file spacenode.cpp.

NodeStatus Gecode::Gist::SpaceNode::getStatus ( void   )  const [inline]

Return current status of the node.

Definition at line 85 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::isOpen ( void   )  [inline]

Return whether this node still has open children.

Definition at line 144 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::hasFailedChildren ( void   )  [inline]

Return whether the subtree of this node has any failed children.

Definition at line 150 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::hasSolvedChildren ( void   )  [inline]

Return whether the subtree of this node has any solved children.

Definition at line 155 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::hasOpenChildren ( void   )  [inline]

Return whether the subtree of this node has any open children.

Definition at line 160 of file spacenode.hpp.

int Gecode::Gist::SpaceNode::getNoOfOpenChildren ( void   ) 

Return number of open children.

Definition at line 352 of file spacenode.cpp.

void Gecode::Gist::SpaceNode::setNoOfOpenChildren ( int  n  ) 

Set number of open children to n.

bool Gecode::Gist::SpaceNode::hasCopy ( void   )  [inline]

Return whether the node has a copy.

Definition at line 165 of file spacenode.hpp.

bool Gecode::Gist::SpaceNode::hasWorkingSpace ( void   )  [inline]

Return whether the node has a working space.

Definition at line 170 of file spacenode.hpp.

SpaceNode * Gecode::Gist::SpaceNode::getParent ( void   )  [inline]

Return the parent.

Reimplemented from Gecode::Gist::Node.

Reimplemented in Gecode::Gist::VisualNode.

Definition at line 41 of file spacenode.hpp.

SpaceNode * Gecode::Gist::SpaceNode::getChild ( int  i  )  [inline]

Return child i.

Reimplemented in Gecode::Gist::VisualNode.

Definition at line 46 of file spacenode.hpp.

int Gecode::Gist::SpaceNode::getAlternative ( void   )  [inline]

Return alternative number of this node.

Definition at line 175 of file spacenode.hpp.

const Choice * Gecode::Gist::SpaceNode::getChoice ( void   )  [inline]

Return choice of this node.

Definition at line 186 of file spacenode.hpp.


Member Data Documentation

A copy used for recomputation, or NULL.

Definition at line 96 of file spacenode.hh.

Working space used for computing the status.

Definition at line 98 of file spacenode.hh.

Definition at line 110 of file spacenode.hh.

const int Gecode::Gist::SpaceNode::LASTBIT = HASSOLVEDCHILDREN [static, protected]

Last bit used for SpaceNode flags.

Definition at line 131 of file spacenode.hh.


The documentation for this class was generated from the following files: