Modernized GAlib
3.0.0 current
|
Public Member Functions | |
GADefineIdentity ("GA1DArrayAlleleGenome", GAID::ArrayAlleleGenome) | |
GA1DArrayAlleleGenome (unsigned int length, const GAAlleleSet< T > &s, GAGenome::Evaluator f=nullptr, void *u=nullptr) | |
GA1DArrayAlleleGenome (const GAAlleleSetArray< T > &sa, GAGenome::Evaluator f=nullptr, void *u=nullptr) | |
GA1DArrayAlleleGenome (const GA1DArrayAlleleGenome< T > &orig) | |
GA1DArrayAlleleGenome< T > & | operator= (const GAGenome &arr) |
GA1DArrayAlleleGenome< T > & | operator= (const T array[]) |
GAGenome * | clone (GAGenome::CloneMethod=GAGenome::CloneMethod::CONTENTS) const override |
void | copy (const GAGenome &orig) override |
int | read (std::istream &is) override |
int | write (std::ostream &os) const override |
bool | equal (const GAGenome &c) const override |
int | resize (int len) override |
If we resize to a larger length then we need to set the contents to a valid value (ie one of our alleles) More... | |
const GAAlleleSet< T > & | alleleset (unsigned int i=0) const |
int | size () const |
![]() | |
GADefineIdentity ("GA1DArrayGenome", GAID::ArrayGenome) | |
GA1DArrayGenome (unsigned int length, GAGenome::Evaluator f=nullptr, void *u=nullptr) | |
GA1DArrayGenome (const GA1DArrayGenome< T > &orig) | |
GA1DArrayGenome< T > & | operator= (const GAGenome &orig) |
GA1DArrayGenome< T > & | operator= (const T array[]) |
const T & | gene (unsigned int x=0) const |
T & | gene (unsigned int x, const T &value) |
int | length () const |
int | length (int x) |
int | resizeBehaviour (unsigned int lower, unsigned int upper) |
int | resizeBehaviour () const |
void | copy (const GA1DArrayGenome< T > &orig, unsigned int r, unsigned int x, unsigned int l) |
void | swap (unsigned int i, unsigned int j) |
![]() | |
GAArray (unsigned int s) | |
GAArray (const GAArray< T > &orig) | |
GAArray< T > & | operator= (const GAArray< T > &orig) |
GAArray< T > * | clone () |
const T & | operator[] (unsigned int i) const |
T & | operator[] (unsigned int i) |
void | copy (const GAArray< T > &orig) |
void | copy (const GAArray< T > &orig, unsigned int dest, unsigned int src, unsigned int length) |
void | move (unsigned int dest, unsigned int src, unsigned int length) |
void | swap (unsigned int i, unsigned int j) |
int | size () const |
int | size (unsigned int n) |
bool | equal (const GAArray< T > &b, unsigned int dest, unsigned int src, unsigned int length) const |
template<class U > | |
bool | operator== (const GAArray< U > &rhs) const |
template<class U > | |
bool | operator!= (const GAArray< U > &rhs) const |
![]() | |
GADefineIdentity ("GAGenome", GAID::Genome) | |
GAGenome (Initializer i=nullptr, Mutator m=nullptr, Comparator c=nullptr) | |
GAGenome (const GAGenome &orig) | |
GAGenome & | operator= (const GAGenome &arg) |
virtual bool | notequal (const GAGenome &g) const |
int | nevals () const |
float | score () const |
float | score (float s) |
float | fitness () |
float | fitness (float f) |
GAGeneticAlgorithm * | geneticAlgorithm () const |
GAGeneticAlgorithm * | geneticAlgorithm (GAGeneticAlgorithm &g) |
void * | userData () const |
void * | userData (void *u) |
GAEvalData * | evalData () const |
GAEvalData * | evalData (const GAEvalData &o) |
float | evaluate (bool flag=false) const |
Evaluator | evaluator () const |
Evaluator | evaluator (Evaluator f) |
void | initialize () |
Initializer | initializer () const |
Initializer | initializer (Initializer op) |
int | mutate (float p) |
Mutator | mutator () const |
Mutator | mutator (Mutator op) |
float | compare (const GAGenome &g) const |
Comparator | comparator () const |
Comparator | comparator (Comparator c) |
SexualCrossover | crossover (SexualCrossover f) |
SexualCrossover | sexual () const |
AsexualCrossover | crossover (AsexualCrossover f) |
AsexualCrossover | asexual () const |
![]() | |
bool | sameClass (const GAID &b) const |
virtual const char * | className () const |
virtual int | classID () const |
Static Public Member Functions | |
static void | UniformInitializer (GAGenome &c) |
static void | OrderedInitializer (GAGenome &c) |
static int | FlipMutator (GAGenome &c, float pmut) |
![]() | |
static int | SwapMutator (GAGenome &c, float pmut) |
Randomly swap elements in the array. More... | |
static float | ElementComparator (const GAGenome &a, const GAGenome &b) |
How similar are two genomes. More... | |
static int | UniformCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
Randomly take bits from each parent. More... | |
static int | OnePointCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
static int | TwoPointCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
static int | EvenOddCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
static int | PartialMatchCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
static int | OrderCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
static int | CycleCrossover (const GAGenome &p1, const GAGenome &p2, GAGenome *c1, GAGenome *c2) |
![]() | |
static void | NoInitializer (GAGenome &) |
static int | NoMutator (GAGenome &, float) |
static float | NoComparator (const GAGenome &, const GAGenome &) |
Protected Attributes | |
std::vector< GAAlleleSet< T > > | aset |
the allele set(s) for this genome | |
![]() | |
unsigned int | nx |
unsigned int | minX |
unsigned int | maxX |
![]() | |
std::vector< T > | a |
the contents of the array | |
![]() | |
float | _score |
float | _fitness |
bool | _evaluated |
unsigned int | _neval |
GAGeneticAlgorithm * | ga |
void * | ud |
Evaluator | eval |
GAEvalData * | evd |
Mutator | mutr |
Initializer | init |
Comparator | cmp |
SexualCrossover | sexcross |
AsexualCrossover | asexcross |
Additional Inherited Members | |
![]() | |
enum class | Dimension { LENGTH = 0 , WIDTH = 0 , HEIGHT = 1 , DEPTH = 2 } |
enum class | CloneMethod { CONTENTS = 0 , ATTRIBUTES = 1 } |
enum | { FIXED_SIZE = -1 , ANY_SIZE = -10 } |
using | Evaluator = float(*)(GAGenome &) |
using | Initializer = void(*)(GAGenome &) |
using | Mutator = int(*)(GAGenome &, float) |
using | Comparator = float(*)(const GAGenome &, const GAGenome &) |
using | SexualCrossover = int(*)(const GAGenome &, const GAGenome &, GAGenome *, GAGenome *) |
using | AsexualCrossover = int(*)(const GAGenome &, GAGenome *) |
![]() | |
enum | { BaseGA = 0 , SimpleGA , SteadyStateGA , IncrementalGA , DemeGA , Population = 10 , Scaling = 15 , NoScaling , LinearScaling , SigmaTruncationScaling , PowerLawScaling , Sharing , Selection = 40 , RankSelection , RouletteWheelSelection , TournamentSelection , UniformSelection , SRSSelection , DSSelection , Genome = 50 , BinaryStringGenome , BinaryStringGenome2D , BinaryStringGenome3D , Bin2DecGenome , ListGenome , TreeGenome , ArrayGenome , ArrayGenome2D , ArrayGenome3D , ArrayAlleleGenome , ArrayAlleleGenome2D , ArrayAlleleGenome3D , StringGenome , FloatGenome , IntGenome , DoubleGenome } |
|
inlineoverridevirtual |
If we resize to a larger length then we need to set the contents to a valid value (ie one of our alleles)
len |
Reimplemented from GA1DArrayGenome< T >.