2D GA chromosome. More...

#include <rga2d.h>

Inheritance diagram for RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >:
[legend]
Collaboration diagram for RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >:
[legend]

Public Member Functions

 RChromo2D (cInst *inst, size_t id)
 
virtual void Init (cThreadData *thData)
 
virtual void RandomConstruct (void)
 
virtual void Crossover (cChromo *parent1, cChromo *parent2)
 
virtual void Mutation (void)
 
virtual void Verify (void)
 
virtual void Copy (const cChromo &chromo)
 
RObj2DGetObj (tCoord X, tCoord Y)
 
cInfo * GetInfo (tCoord X, tCoord Y)
 
RPointGetActLimits (void)
 
virtual ~RChromo2D (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 void Print (void)
 
virtual ~RChromo (void)
 
- Public Member Functions inherited from RLayout
 RLayout (RProblem2D *prob, bool create)
 
void Boundary (RRect &rect)
 
void ClearInfos (void)
 
void Copy (const RLayout &infos, RGrid *grid)
 
RProblem2DGetProblem (void) const
 
RGeoInfooperator[] (size_t id)
 
const RGeoInfooperator[] (size_t id) const
 
const RGeoInfoGetBoard (void) const
 
void GetTab (RGeoInfo **tab)
 
RCursor< RGeoInfoGetInfos (void) const
 
size_t GetNbAggregators (void) const
 
RCursor< RGeoInfoConnectionGetConnections (void) const
 
RObj2DContainerGetNewAggregator (void)
 
void DestroyAggregators (void)
 
tCoord ComputeDist (RGeoInfo *info, bool weight, const RPoint &pos)
 
RGeoInfoGetMostConnected (RGeoInfo **order, size_t nbobjs, size_t nbok, bool weight)
 
void FillAggregator (RObj2DContainer *cont, bool *selected, RPromKernel *kernel, RRandom &random, bool weight)
 
tCoord ComputeConnections (bool weight)
 
RRect ComputeBoundary (void)
 
virtual ~RLayout (void)
 

Protected Attributes

RSize ActLimits
 
RPlacementHeuristicHeuristic
 
RGridGrid
 
bool * Selected
 
RPromKernelKernel
 
- Protected Attributes inherited from RLayout
RProblem2DProblem
 
RGeoInfo Board
 
RContainer< RGeoInfoConnection,
true, false > 
PlacedConnections
 
size_t NbAggregators
 

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 cInfo>
singleton R::RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >

2D GA chromosome.

This class represents a chromosome for the 2D placement GA.

Constructor & Destructor Documentation

RChromo2D ( cInst *  inst,
size_t  id 
)

Construct the chromosome.

Parameters
instPointer to the instance.
idIdentifier of the chromosome.
virtual ~RChromo2D ( void  )
virtual

Destruct the chromosome.

Member Function Documentation

virtual void Init ( cThreadData *  thData)
virtual

This function initializes some important data, in particular Infos and Selected.

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

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

virtual void RandomConstruct ( void  )
virtual

The random construction uses the heuristic to place all the objects.

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

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

Make the crossover for the chromosome. A set of objects is taken from the first parent. Then, the heuristic is used to place this object and the objects that aren't selected.

Parameters
parent1First parent used.
parent2Second parent used.

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

virtual void Mutation ( void  )
virtual

The mutation simply calls the heuristic with all the objects.

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

virtual void Verify ( void  )
virtual

This function verify the validity of the chromosome, in particular that no polygons are overlapped.

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

virtual void Copy ( const cChromo &  chromo)
virtual

The method copies a chromosome into another.

Parameters
chromoChromosome.

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

RObj2D* GetObj ( tCoord  X,
tCoord  Y 
)

Gives the object at position (X,Y).

Parameters
XX Position.
YY Position.
Returns
The function returns a pointer to the objects or 0.
cInfo* GetInfo ( tCoord  X,
tCoord  Y 
)

Gives the geometric information of the object at position (X,Y).

Parameters
XX Position.
YY Position.
Returns
The function returns a pointer to the information or 0.
RPoint& GetActLimits ( void  )

Return the actual limits of the chromosome.

Member Data Documentation

RSize ActLimits
protected

The actual limits of the solution represented by the chromosome.

RPlacementHeuristic* Heuristic
protected

Heuristic used for the placement.

RGrid* Grid
protected

A Grid representing the current placement.

bool* Selected
protected

Temporary array to remember which objects are selected.

RPromKernel* Kernel
protected

PROMETHEE kernel.