First Node Heuristic. More...

#include <rhga.h>

Inheritance diagram for RFirstNodeHeuristic< cNode, cObj, cNodes >:
Collaboration diagram for RFirstNodeHeuristic< cNode, cObj, cNodes >:

Public Member Functions

 RFirstNodeHeuristic (RRandom &r, RCursor< cObj > objs, RDebug *debug=0)
virtual void Init (cNodes *nodes)
virtual cNode * NewNode (const RAttrList &attr, cNode *parent)
virtual cNode * FindNode (void)
virtual ~RFirstNodeHeuristic (void)
- Public Member Functions inherited from RTreeHeuristic< cNode, cObj, cNodes >
 RTreeHeuristic (const RString &n, RRandom &r, RCursor< cObj > objs, RDebug *debug=0)
const RString GetName (void) const
void BuildFile (const RString &name, cObj *obj)
virtual void SelectNextObject (void)
cObj * GetNextObject (void)
cNode * GetNode (void)
void PutNextObject (void)
void Run (cNodes *nodes)
virtual void PostRun (void)
bool IsEnd (void)
size_t GetNbObjsOk (void)
long RRand (long max)
template<class T >
void RandOrder (T *arr, size_t size)
virtual ~RTreeHeuristic (void)

Private Attributes

cNode ** tmpNodes
RAttrList tmpAttrs

Additional Inherited Members

- Protected Attributes inherited from RTreeHeuristic< cNode, cObj, cNodes >
RString Name
RCursor< cObj > Objs
size_t NbObjs
size_t NbObjsOk
cNodes * Nodes
cObj ** Order
cObj * CurObj
cNode * CurNode

Detailed Description

template<class cNode, class cObj, class cNodes>
singleton R::RFirstNodeHeuristic< cNode, cObj, cNodes >

First Node Heuristic.

The RFitstNodeHeuristic class provides a first fit heuristic for trees.

Starting from the root node, the heuristic tries to find a branch where an object can be attached. It tries to find the highest node in the tree. If necessary, an intermediate node is created.

Constructor & Destructor Documentation

RFirstNodeHeuristic ( RRandom r,
RCursor< cObj >  objs,
RDebug debug = 0 

Construct the grouping heuristic.

rThe random generator to use.
objsPointer to the objects.
virtual ~RFirstNodeHeuristic ( void  )

Destruct the heuristic.

Member Function Documentation

virtual void Init ( cNodes *  nodes)

Initialize the heuristic.

nodesPointer to the nodes.

Reimplemented from RTreeHeuristic< cNode, cObj, cNodes >.

virtual cNode* NewNode ( const RAttrList attr,
cNode *  parent 

Create a new child node to the current node with the set of attributes to place.

attrAttributes for the node.
parentParent node.
virtual cNode* FindNode ( void  )

Find a node where to attach the next object to treat.

Pointer to the node.

Implements RTreeHeuristic< cNode, cObj, cNodes >.

Member Data Documentation

cNode** tmpNodes

Temporary array of nodes.

RAttrList tmpAttrs

Temporary list of attributes.