Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

zeus::TGAChromosome Class Reference

#include <GAChromosome.h>

Inheritance diagram for zeus::TGAChromosome:
zeus::IGAChromosome

List of all members.

Public Types

enum  ECrossOverKind {
  etMultiPoint, etUniform, etInterIntRecombination, etLineIntRecombination,
  etInterFloatRecombination, etLineFloatRecombination, etCustom
}
typedef Retval(* FCrossFunction )(IGAChromosome &rParent1, IGAChromosome &rParent2, TGAChromosome &rNewChrom1, TGAChromosome &rNewChrom2)

Public Member Functions

 TGAChromosome (Uint uiID, Uint uiDNASize, Uint uiGeneSize)
ECrossOverKind getCrossOverKind () const
Int getMultiPointParameter () const
void setCrossOverKind (ECrossOverKind eKind, FCrossFunction pFunct=NULL)
void setMultiPointParameter (Int iValue)
void setMinMaxParameter (const Float &rfMin, const Float &rfMax)
virtual Uint MQUALIFIER getChromosomeID () const
virtual IByteArray &MQUALIFIER getDNA ()
virtual const IByteArray
&MQUALIFIER 
getDNAConst () const
virtual Int MQUALIFIER getGeneCount () const
virtual Int MQUALIFIER getGeneSize () const
virtual IGAGene &MQUALIFIER getGene (Int iIndex)
virtual const IGAGene &MQUALIFIER getGeneConst (Int iIndex) const
virtual Retval MQUALIFIER crossOver (IGAChromosome &rChrom, IGAChromosome *&rpNewChrom1, IGAChromosome *&rpNewChrom2)
virtual Retval MQUALIFIER clone (IGAChromosome *&rpNewChrom) const
virtual void MQUALIFIER mutate ()
virtual Retval MQUALIFIER askForInterface (const InterfaceID &rInterfaceID, IZUnknown *&rpIface)
virtual void MQUALIFIER addRef () const
virtual void MQUALIFIER release () const

Protected Member Functions

virtual ~TGAChromosome ()

Protected Attributes

Uint m_uiDNASize
 Size of DNA.
Uint m_uiGeneSize
 Size of a gene (in bytes)
ECrossOverKind m_eCrossKind
 Kind of crossover.
TByteArray m_lstDNA
 DNA of the chromosome.
TArrayList< TGAGene * > m_lstGenes
 Gene representation.
Int m_iMultiPointParam
 Multipoint parameter.
FCrossFunction m_Funct
 Cross function for customized crossing.
Float m_fMinValue
 Minimum value if recombination is used.
Float m_fMaxValue
 Maximum value if recombination is used.

Detailed Description

Implementation of a chromosone


Member Typedef Documentation

typedef Retval(* zeus::TGAChromosome::FCrossFunction)(IGAChromosome &rParent1, IGAChromosome &rParent2, TGAChromosome &rNewChrom1, TGAChromosome &rNewChrom2)

Member Enumeration Documentation

This enumeration represents the kind of the crossover.

Enumerator:
etMultiPoint 

Multi point crossover (randomly). Takes the parameter how many crossovers has to be made

etUniform 

Takes every chance for a crossover

etInterIntRecombination 

O1 = P1 + (P2 - P1)*a with a from -0.25 to 1.25 randomly for each gene value

etLineIntRecombination 

Same as inter recombination but the a is the same for all gene values

etInterFloatRecombination 

O1 = P1 + (P2 - P1)*a with a from -0.25 to 1.25 randomly for each gene value

etLineFloatRecombination 

Same as inter recombination but the a is the same for all gene values

etCustom 

Customized crossing


Constructor & Destructor Documentation

TGAChromosome::TGAChromosome ( Uint  uiID,
Uint  uiDNASize,
Uint  uiGeneSize 
)

Creates a chromosone

Parameters:
uiID: ID of the chromosome
uiDNASize: Size of the whole DNA
uiGeneSize: Size of a single gene
TGAChromosome::~TGAChromosome (  ) [protected, virtual]

Destroys the chromosone


Member Function Documentation

virtual void MQUALIFIER zeus::TGAChromosome::addRef (  ) const [virtual]
virtual Retval MQUALIFIER zeus::TGAChromosome::askForInterface ( const InterfaceID &  rInterfaceID,
IZUnknown *&  rpIface 
) [virtual]
Retval MQUALIFIER TGAChromosome::clone ( IGAChromosome *&  rpNewChrom ) const [virtual]
Retval MQUALIFIER TGAChromosome::crossOver ( IGAChromosome rChrom,
IGAChromosome *&  rpNewChrom1,
IGAChromosome *&  rpNewChrom2 
) [virtual]
Uint MQUALIFIER zeus::TGAChromosome::getChromosomeID (  ) const [inline, virtual]
TGAChromosome::ECrossOverKind zeus::TGAChromosome::getCrossOverKind (  ) const [inline]

Returns the kind of crossing over

IByteArray &MQUALIFIER zeus::TGAChromosome::getDNA (  ) [inline, virtual]
const IByteArray &MQUALIFIER zeus::TGAChromosome::getDNAConst (  ) const [inline, virtual]
IGAGene &MQUALIFIER zeus::TGAChromosome::getGene ( Int  iIndex ) [inline, virtual]
const IGAGene &MQUALIFIER zeus::TGAChromosome::getGeneConst ( Int  iIndex ) const [inline, virtual]
Int MQUALIFIER zeus::TGAChromosome::getGeneCount (  ) const [inline, virtual]
Int MQUALIFIER zeus::TGAChromosome::getGeneSize (  ) const [inline, virtual]
Int zeus::TGAChromosome::getMultiPointParameter (  ) const [inline]

Returns the number of crossover points

void MQUALIFIER TGAChromosome::mutate (  ) [virtual]
virtual void MQUALIFIER zeus::TGAChromosome::release (  ) const [virtual]
void TGAChromosome::setCrossOverKind ( ECrossOverKind  eKind,
FCrossFunction  pFunct = NULL 
)

Sets the kind of crossing over

void zeus::TGAChromosome::setMinMaxParameter ( const Float &  rfMin,
const Float &  rfMax 
) [inline]

sets the min and max value of the linear combination

void TGAChromosome::setMultiPointParameter ( Int  iValue )

Sets the multi point parameter, which controls how many times a cross over will be performed.

Parameters:
iValue: new value

Member Data Documentation

Kind of crossover.

Maximum value if recombination is used.

Minimum value if recombination is used.

Cross function for customized crossing.

Multipoint parameter.

TByteArray zeus::TGAChromosome::m_lstDNA [protected]

DNA of the chromosome.

TArrayList<TGAGene*> zeus::TGAChromosome::m_lstGenes [protected]

Gene representation.

Size of DNA.

Size of a gene (in bytes)


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:32:27