CEL

Public API Reference

iPcEvolve Struct Reference

A property class implementing a genetic algorithm. More...

#include <propclass/evolve.h>

Inheritance diagram for iPcEvolve:

List of all members.

Public Member Functions

virtual void FitnessCallback (float fitness)=0
 Informs the property class that the fitness of a genome has been evaluated, as requested by the "pcevolve_fitness" message.
virtual void Generate ()=0
 Instructs the property class to begin the evolution of one generation.
virtual float GetFitness (size_t index) const =0
 Returns the fitness of the genome specified by the index parameter.
virtual size_t GetPopulationSize () const =0
 Returns the population size (number of individual genomes).
virtual iCelPropertyClassGetSubject ()=0
 Returns the subject property class (the property class being evolved by this one.
virtual void ResetPopulation ()=0
 Resets the property class to its initial state before Generate() was first called.
virtual void SelectGenome (size_t index)=0
 Stored the genome specified by the index parameter into the subject property class.
virtual void SetPopulationSize (size_t size)=0
 Sets the population size (number of individual genomes).
virtual void SetProbabilities (float select, float mutate)=0
 Sets the probability parameters for the stochastic (non-deterministic) randomness of the genetic algorithm.
virtual void SetSubject (iCelPropertyClass *pc)=0
 Sets the subject property class (the property class that will be evolved by this one).

Detailed Description

A property class implementing a genetic algorithm.

Currently the only thing that can be evolved using this is the celPcNeuralNet, but it would be fairly easy to extend it to support evolving other property classes where applicable.

The property class holds the following properties (add prefix "cel.property." to get a property ID):

And the following actions (add prefix "cel.action." or "cel.parameter." to get the ID of an action or parameter respectively):

And sends the following message to the behaviour:

Definition at line 62 of file evolve.h.


Member Function Documentation

virtual void iPcEvolve::FitnessCallback ( float  fitness  )  [pure virtual]

Informs the property class that the fitness of a genome has been evaluated, as requested by the "pcevolve_fitness" message.

Parameters:
fitness The fitness value. May not be less than zero.
virtual void iPcEvolve::Generate (  )  [pure virtual]

Instructs the property class to begin the evolution of one generation.

This will send the "pcevolve_fitness" message once for each individual genome in the population, to ask the behaviour to evaluate its fitness.

virtual float iPcEvolve::GetFitness ( size_t  index  )  const [pure virtual]

Returns the fitness of the genome specified by the index parameter.

This will be zero if its fitness has yet to be evaluated.

Parameters:
index The index into the population array, which is sorted in descending order of fitness (0 being the fittest).
virtual size_t iPcEvolve::GetPopulationSize (  )  const [pure virtual]

Returns the population size (number of individual genomes).

virtual iCelPropertyClass* iPcEvolve::GetSubject (  )  [pure virtual]

Returns the subject property class (the property class being evolved by this one.

virtual void iPcEvolve::ResetPopulation (  )  [pure virtual]

Resets the property class to its initial state before Generate() was first called.

virtual void iPcEvolve::SelectGenome ( size_t  index  )  [pure virtual]

Stored the genome specified by the index parameter into the subject property class.

Parameters:
index The index into the population array, which is sorted in descending order of fitness (0 being the fittest).
virtual void iPcEvolve::SetPopulationSize ( size_t  size  )  [pure virtual]

Sets the population size (number of individual genomes).

virtual void iPcEvolve::SetProbabilities ( float  select,
float  mutate 
) [pure virtual]

Sets the probability parameters for the stochastic (non-deterministic) randomness of the genetic algorithm.

Parameters:
select Genomes will be selected for crossover with a probability of p(1-p)^r, where p is this parameter and r is the genome's rank in descending order of fitness (0 being the fittest).
mutate The average number of genes to mutate in each genome. For example, 3.0 means that an average of 3 genes will be mutated, while 0.5 means that one gene will be mutated in every 2 genomes, on average.
virtual void iPcEvolve::SetSubject ( iCelPropertyClass pc  )  [pure virtual]

Sets the subject property class (the property class that will be evolved by this one).

It must be of a type supported by the genetic algorithm.


The documentation for this struct was generated from the following file:

Generated for CEL: Crystal Entity Layer 1.4.1 by doxygen 1.7.1