Desc. & Idea | Warnings | Methods | Atributes | Operators | Specials |
Class representing a gene. In fact it contains binary string and methods supporting its editing.
TGen knows its parent population (parent) and its place in it (index) and uses it while moving from one population to another.
Public:
TGen(uint ilength, ini_type itype = all0, TPopulation* iparent = NULL, uint iindx = 0)
TGen()
TGen(BYTE** rawbytes,uint len,BOOL subclass=FALSE)
virtual ~TGen()
virtual char* Dump()
virtual uint GetSerSize(BOOL subclass=FALSE)
virtual uint Serialize(BYTE **rawbytes,BOOL subclass=FALSE)
BOOL SetFit(TFit fit)
TFit GetFit()
BOOL SetScaledFit(TFit fit)
TFit GetScaledFit()
uint GetLength()
uint GetByte(uint i,BYTE** byte)
BOOL SetBit(uint i, BOOL value = TRUE)
TFitness *GetFitFunc()
void SetDirty()
BOOL GetDirty()
Protected:
Private:
TFitness *GetFitFunc()
Gives access to the object responsible for fitness measuring. See TFitness class for more info.
Public:
TPopulation *parent
uint index
Protected:
BYTE *bitarray
TFit fitness
TFit scfitness
uint genlength
uint length
BOOL dirty
Private:
TPopulation *parent
Pointer to the population owning this individual.
uint index
Index of this individual in the parent population.
BYTE *bitarray
The bit string representing the genetic info of the individual.
TFit fitness
The current fitness evaluation value of the individual.
uint genlength
The length (in bits) of the string.
uint length
The length (in bytes) of the string.
Public:
int MyOper(void)
TGen& operator = (TGen& gen)
BOOL operator [] (uint i)
BOOL operator == (TGen& gen)
BOOL operator >> (TGen& gen)
Protected:
Private:
BOOL operator [] (uint i)
Gives acces to the value(!!) of bit in the bit string. Expression "gen[i] = 0;" isn't possible, use method SetBit instead.
None.