HGA Chromosome. More...

#include <rhga.h>

Inheritance diagram for RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >:
[legend]
Collaboration diagram for RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >:
[legend]

Public Member Functions

 RChromoH (cInst *inst, size_t id)
 
virtual void Init (cThreadData *thData)
 
virtual void Clear (void)
 
virtual void CleanUp (void)
 
virtual void RandomConstruct (void)
 
virtual void Crossover (cChromo *parent1, cChromo *parent2)
 
virtual void Mutation (void)
 
virtual void Print (void)
 
virtual void Verify (void)
 
virtual void Copy (const cChromo &chromo)
 
virtual ~RChromoH (void)
 
- Public Member Functions inherited from RChromo< cInst, cChromo, cFit, cThreadData >
 RChromo (cInst *inst, size_t id)
 
virtual void Evaluate (void)
 
virtual void StrongMutation (void)
 
virtual void Inversion (void)
 
virtual void Optimisation (void)
 
virtual ~RChromo (void)
 
- Public Member Functions inherited from RNodesGA< cNode, cObj, cChromo >
 RNodesGA (RCursor< cObj > objs, size_t maxnodes, size_t maxattr)
 
void Init (void)
 
size_t GetNbNodes (void) const
 
size_t GetNbTopNodes (void) const
 
size_t GetMaxDepth (void) const
 
cNode * ReserveNode (void)
 
void InsertNode (cNode *parent, cNode *node)
 
void DeleteNode (cNode *node)
 
virtual void DeleteNodes (cNode *node)
 
void MoveNode (cNode *to, cNode *node)
 
cNode * CopyExceptBranch (const cChromo *from, const cNode *excluded=0, RNumContainer< size_t, true > *objs=0, bool copyobjs=true)
 
cNode * CopyExceptBranch (cNode *to, const cNode *from, const cNode *excluded=0, RNumContainer< size_t, true > *objs=0, bool copyobjs=true)
 
void InsertObj (cNode *to, cObj *obj)
 
void DeleteObj (cNode *from, const cObj *obj)
 
void DeleteObj (const cObj *obj)
 
void DeleteObjs (cNode *node)
 
void MoveObjs (cNode *to, cNode *from)
 
RCursor< cObj > GetObjs (const cNode *node) const
 
bool VerifyNodes (bool complete)
 
void CopyTree (const cChromo &nodes)
 
void BuildFile (const RString &name)
 
virtual ~RNodesGA (void)
 
- Public Member Functions inherited from RTree< cChromo, cNode, false >
 RTree (void)
 
void ClearNode (cNode *node)
 
cNode * GetFirst (void) const
 
cNode * GetLast (void) const
 
size_t GetMaxDepth (void) const
 
cNode * GetTop (void)
 
const cNode * GetTop (void) const
 
size_t GetNbNodes (void) const
 
size_t GetNbTopNodes (void) const
 
size_t GetTab (cNode **tab, cNode *node, bool children=false)
 
void InsertNode (cNode *to, cNode *node)
 
void DeleteNodes (cNode *node, bool del=false)
 
void DeleteNode (cNode *node, bool del=false)
 
void UpdateDepth (cNode *node)
 
void MoveNode (cNode *to, cNode *node)
 
void Copy (const RTree< cChromo, cNode, a > &src)
 
void DeepCopy (cNode *src, cNode *newparent)
 
cNode * GetNode (const TUse &tag) const
 
double GetUpOperationsCost (const cNode *u, const cNode *v) const
 
virtual ~RTree (void)
 

Protected Attributes

RTreeHeuristic< cNode, cObj,
cChromo > * 
Heuristic
 
cNode ** thNodes1
 
cNode ** thNodes2
 
RNumContainer< size_t, true > * thObjects
 
- Protected Attributes inherited from RNodesGA< cNode, cObj, cChromo >
RContainer< cNode, true, false > Reserved
 
RContainer< cNode, false, true > Nodes
 
RCursor< cObj > Objs
 
size_t * ObjectsAss
 
RContainer< cObj, false, false > ObjsAss
 
RContainer< cObj, false, false > ObjsNoAss
 
size_t MaxAttr
 
- Protected Attributes inherited from RTree< cChromo, cNode, false >
cNode * First
 
cNode * Last
 
size_t NbTopNodes
 
size_t NbNodes
 
size_t MaxDepth
 

Additional Inherited Members

- Public Attributes inherited from RChromo< cInst, cChromo, cFit, cThreadData >
cInst * Instance
 
size_t Id
 
cFit * Fitness
 
bool ToEval
 

Detailed Description

template<class cInst, class cChromo, class cFit, class cThreadData, class cNode, class cObj>
singleton R::RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >

HGA Chromosome.

The RChromoH class proposes a generic chromosome for a Hierarchical Genetic Algorithm (HGA).

Constructor & Destructor Documentation

RChromoH ( cInst *  inst,
size_t  id 
)

Construct the chromosome.

Parameters
instThe instance.
idIdentifier of the chromosome.
virtual ~RChromoH ( void  )
virtual

Destruct the chromosome.

Member Function Documentation

virtual void Init ( cThreadData *  thData)
virtual

Initialization of the chromosome.

Parameters
thDataPointer to the "thread-dependent" data of the chromosome.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

virtual void Clear ( void  )
virtual

Clear all the information of the chromosome.

Reimplemented from RNodesGA< cNode, cObj, cChromo >.

virtual void CleanUp ( void  )
virtual

Clean up a chromosome by removing all the empty nodes.

virtual void RandomConstruct ( void  )
virtual

Construct a valid solution.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

virtual void Crossover ( cChromo *  parent1,
cChromo *  parent2 
)
virtual

Do a crossover by using the chromosome as child:

  1. Two nodes having the same attributes are chosen in each parent (crossing nodes).
  2. The first parent is copied except its nodes having objects attached to the node of the second parent and its crossing node.
  3. The node of the second parent is copied at the place of the node of the first parent.
  4. The objects which are not attached are placed using the heuristic.
    Parameters
    parent1First parent used.
    parent2Second parent used.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

virtual void Mutation ( void  )
virtual

Do a mutation with the chromosome. Choose randomly a node and remove it with all its subnodes.

Returns
The function must return true if the mutation has been done.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

virtual void Print ( void  )
virtual

Print information on screen.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

virtual void Verify ( void  )
virtual

Verify the validity of the chromosome.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

virtual void Copy ( const cChromo &  chromo)
virtual

The assignment operator.

Parameters
chromoThe chromosome used as source.

Reimplemented from RChromo< cInst, cChromo, cFit, cThreadData >.

Member Data Documentation

RTreeHeuristic<cNode,cObj,cChromo>* Heuristic
protected

Heuristic Used.

cNode** thNodes1
protected

Use for Nodes manipulation functions. Thread-depend data.

cNode** thNodes2
protected

Use for Nodes manipulation functions. Thread-depend data.

RNumContainer<size_t,true>* thObjects
protected

Use for objects manipulation functions. Thread-depend data.