First Node Heuristic. More...

#include <rhga.h>

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

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
 
RRandomRandom
 
RCursor< cObj > Objs
 
size_t NbObjs
 
size_t NbObjsOk
 
cNodes * Nodes
 
cObj ** Order
 
cObj * CurObj
 
cNode * CurNode
 
RDebugDebug
 

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.

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

Destruct the heuristic.

Member Function Documentation

virtual void Init ( cNodes *  nodes)
virtual

Initialize the heuristic.

Parameters
nodesPointer to the nodes.

Reimplemented from RTreeHeuristic< cNode, cObj, cNodes >.

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

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

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

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

Returns
Pointer to the node.

Implements RTreeHeuristic< cNode, cObj, cNodes >.

Member Data Documentation

cNode** tmpNodes
private

Temporary array of nodes.

RAttrList tmpAttrs
private

Temporary list of attributes.