Genome class. More...

Inheritance diagram for Genome:

List of all members.

Public Member Functions

 Genome ()
 Construct an un-initialized Genome with no genotypes.
 Genome (unsigned int numGenotype, unsigned int numBits)
 Construct a Genome with random Genotypes.
 Genome (const Genome &genome)
 Copy-Constructor.
 Genome (unsigned int numGenotype, const Genotype *prototype)
 Construct a Genome contains clones of Genotype prototype passed.
 ~Genome ()
 Destructor.
void append (const Genotype *)
 Append a clone of Genotype passed to this Genome.
Genotypeat (unsigned int i)
 Return the i-th Genotype.
const Genotypeat (unsigned int i) const
 Return the i-th Genotype (const version)
QVector< Genotype * >::iterator begin ()
 Return the begin iterator for use QtAlgorithms.
QVector< Genotype * >
::const_iterator 
begin () const
 Return the begin iterator for use QtAlgorithms.
void clearAll ()
 Erase all element and set the size to zero.
virtual void configure (ConfigurationParameters &params, QString prefix)
 Configure the object using the ConfigurationParameters specified.
QVector< Genotype * >
::const_iterator 
end () const
 Return the end iterator for use QtAlgorithms.
QVector< Genotype * >::iterator end ()
 Return the end iterator for use QtAlgorithms.
unsigned int find (const Genotype *g)
 Find the Genotype requested and return its index in this Genome.
const Genotypelast () const
 Return the last Genotype contained (i.e.
Genotypelast ()
 Return the last Genotype contained (i.e.
Genomeoperator= (const Genome &right)
 assignment operato
const Genotypeoperator[] (unsigned int i) const
 Return the i-th Genotype (const version)
Genotypeoperator[] (unsigned int i)
 Return the i-th Genotype (non-const version)
GenotypeprototypeGenotype ()
 Return the prototype used for creating all others Genotypes.
void randomize ()
 Randomize the Genotype inserted.
virtual void save (ConfigurationParameters &params, QString prefix)
 Save the actual status of parameters into the ConfigurationParameters object passed.
void set (unsigned int i, Genotype *g)
 Set the i-th Genotype.
unsigned int size () const
 Return the size of Genome, i.e.

Static Public Member Functions

static void describe (QString type)
 Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.

Detailed Description

Genome class.

Description
Contains Genotype
Warnings
When a Genotype is inserted into a Genome using append or set, then Genome will create an internal copy of such Genotype (so, it's responsability of the user to delete the copy passed to append (or set))

Definition at line 40 of file genome.h.


Constructor & Destructor Documentation

Genome ( )

Construct an un-initialized Genome with no genotypes.

Definition at line 26 of file genome.cpp.

Genome ( unsigned int  numGenotype,
unsigned int  numBits 
)

Construct a Genome with random Genotypes.

Parameters:
numGenotypeis the number of Genotype contained by this Genome
numBitsis the number of bits of Genotypes (see Genotype::size())

Definition at line 30 of file genome.cpp.

Genome ( unsigned int  numGenotype,
const Genotype prototype 
)

Construct a Genome contains clones of Genotype prototype passed.

After creation from prototype genomes are randomized

Parameters:
numGenotypeis the number of Genotype contained by this Genome
prototypeis the Genotype prototype that Genome contains

Definition at line 39 of file genome.cpp.

References Genotype::clone().

Genome ( const Genome genome)

Copy-Constructor.

Definition at line 48 of file genome.cpp.

References Genotype::clone().

~Genome ( )

Destructor.

This destroys the prototipe and all genotypes

Definition at line 56 of file genome.cpp.


Member Function Documentation

void append ( const Genotype genotype)

Append a clone of Genotype passed to this Genome.

Definition at line 126 of file genome.cpp.

References Genotype::clone().

Referenced by FixedSize::reproduction().

const Genotype * at ( unsigned int  i) const

Return the i-th Genotype (const version)

Definition at line 135 of file genome.cpp.

QVector<Genotype*>::iterator begin ( ) [inline]

Return the begin iterator for use QtAlgorithms.

Definition at line 115 of file genome.h.

QVector<Genotype*>::const_iterator begin ( ) const [inline]

Return the begin iterator for use QtAlgorithms.

Definition at line 119 of file genome.h.

void clearAll ( )

Erase all element and set the size to zero.

Warning:
It doesn't destroy Genotype, it only remove them from Genome

Definition at line 122 of file genome.cpp.

void configure ( ConfigurationParameters params,
QString  prefix 
) [virtual]

Configure the object using the ConfigurationParameters specified.

Parameters:
paramsthe object with configuration parameters
prefixthe group in which parameters are expected to be (this is terminated by a separator character). We expect to receive as prefix the group with genome parameters

Implements ParameterSettableWithConfigureFunction.

Definition at line 80 of file genome.cpp.

References Genotype::clone(), ConfigurationParameters::getGroupsWithPrefixList(), ConfigurationParameters::getObjectFromGroup(), and ConfigurationParameters::getValue().

QVector<Genotype*>::iterator end ( ) [inline]

Return the end iterator for use QtAlgorithms.

Definition at line 123 of file genome.h.

QVector<Genotype*>::const_iterator end ( ) const [inline]

Return the end iterator for use QtAlgorithms.

Definition at line 127 of file genome.h.

unsigned int find ( const Genotype g)

Find the Genotype requested and return its index in this Genome.

Returns:
-1 Genotype there isn't, the index if there is

Definition at line 147 of file genome.cpp.

Referenced by Evaluation::initialize().

Genotype * last ( )

Return the last Genotype contained (i.e.

: at( size()-1 )

Definition at line 139 of file genome.cpp.

Referenced by FixedSize::reproduction().

const Genotype * last ( ) const

Return the last Genotype contained (i.e.

: at( size()-1 )

Definition at line 143 of file genome.cpp.

Genome & operator= ( const Genome right)

assignment operato

Definition at line 67 of file genome.cpp.

References Genotype::clone(), and Genome::size().

Genotype * operator[] ( unsigned int  i)

Return the i-th Genotype (non-const version)

Definition at line 162 of file genome.cpp.

const Genotype * operator[] ( unsigned int  i) const

Return the i-th Genotype (const version)

Definition at line 158 of file genome.cpp.

Genotype* prototypeGenotype ( ) [inline]

Return the prototype used for creating all others Genotypes.

Definition at line 109 of file genome.h.

void randomize ( )

Randomize the Genotype inserted.

Definition at line 166 of file genome.cpp.

void save ( ConfigurationParameters params,
QString  prefix 
) [virtual]

Save the actual status of parameters into the ConfigurationParameters object passed.

Parameters:
paramsthe configuration parameters object on which save actual parameters
prefixthe prefix to use to access the object configuration parameters.

Implements ParameterSettable.

Definition at line 100 of file genome.cpp.

References ConfigurationParameters::createParameter(), ConfigurationParameters::createSubGroup(), and Genotype::save().

Referenced by StefanoSteadyStateGA::save(), SimpleGA::save(), ParallelGA::save(), NSGA2::save(), and LaralGA::save().

void set ( unsigned int  i,
Genotype g 
)

Set the i-th Genotype.

Definition at line 154 of file genome.cpp.

References Genotype::clone().

Referenced by NSGA2::gaStep().


The documentation for this class was generated from the following files: