mc2lib
|
Simple Genome interface. More...
#include <simplega.hpp>
Public Types | |
typedef std::vector< T > | Container |
Public Member Functions | |
Genome () | |
Default constructor. More... | |
Genome (Container g) | |
Converting constructor. More... | |
virtual | ~Genome () |
const Container & | get () const |
Read-only genome accessor. More... | |
Container * | get_ptr () |
Modifiable genome accessor. More... | |
virtual bool | operator< (const Genome &rhs) const |
Less than comparison operator. More... | |
virtual void | Mutate (float rate)=0 |
Mutate this Genome. More... | |
virtual float | Fitness () const =0 |
Fitness accessor. More... | |
virtual | operator float () const |
Converting operator to float. More... | |
virtual | operator std::string () const |
Converting operator to std::string. More... | |
Protected Attributes | |
Container | genome_ |
Raw genome of individual genes of T. More... | |
Simple Genome interface.
Use as a baseclass for genome implementations, but this is optional, as long as the interface is implemented (see GenePool).
Note that this class is virtual, as it is possible that we could have a heterogeneous collection of genomes, all based off of the same baseclass, e.g., where a specialized crossover_mutate operator yields children of different classes.
T | The type of genes in this Genome. |
typedef std::vector<T> mc2lib::simplega::Genome< T >::Container |
|
inline |
Default constructor.
Yields an empty genome.
|
inlineexplicit |
Converting constructor.
g | A raw vector of type T genes forming this new Genome. |
|
inlinevirtual |
|
pure virtual |
Fitness accessor.
Implemented in mc2lib::codegen::RandInstTest< URNG, OperationFactory >.
|
inline |
Read-only genome accessor.
|
inline |
Modifiable genome accessor.
|
pure virtual |
Mutate this Genome.
rate | Mutation rate. |
Implemented in mc2lib::codegen::RandInstTest< URNG, OperationFactory >.
|
inlinevirtual |
Converting operator to float.
As this is also used for the roulette selection, the assumption is that higher fitness means better.
|
inlinevirtual |
Converting operator to std::string.
|
inlinevirtual |
Less than comparison operator.
Use to rank genomes from best fitness to worst fitness. Assumes higher fitness means better.
|
protected |
Raw genome of individual genes of T.