Inheritance diagram for Geno_fx:
Public Methods | |
Geno_fx () | |
virtual int | checkValidity (const char *geno) |
virtual int | validate (char *&geno) |
virtual int | mutate (char *&geno, float &chg) |
virtual int | crossOver (char *&g1, char *&g2, float &chg1, float &chg2) |
virtual char * | getSimplest () |
virtual unsigned long | style (const char *geno, int pos) |
virtual float | similarity (const char *, const char *) |
currently not used (similarity of two genotypes) | |
virtual | ~Geno_fx () |
Static Public Methods | |
Some helpful methods for you | |
int | roulette (const double *probtab, int count) |
returns random index according to probabilities in the probtab table or -1 if all probs are zero. count is the number of elements in probtab. | |
bool | getMinMaxDef (ParamInterface *p, int propindex, double &mn, double &mx, double &def) |
perhaps a more useful (higher-level) way to obtain min/max/def info for integer and double properties. Returns true if min/max/def was really available (otherwise it is just invented). | |
int | selectRandomProperty (Neuro *n) |
selects random property (either 0-based extraproperty of Neuro or 100-based property of its NeuroClass). | |
double | mutateNeuProperty (double current, Neuro *n, int propindex) |
returns value current mutated for the property propindex of NeuroClass nc or for extraproperty (propindex - 100) of Neuro. Give propindex == -1 to mutate connection weight (nc is then ignored). | |
bool | mutateProperty (ParamInterface &p, int propindex) |
mutate selected property. Returns true when success. | |
double | mutateValue (double current, double vmin, double vmax) |
returns current value "creep"-mutated with Gaussian distribution within [ vmin , vmax ] interval. 3 digits after comma. | |
NeuroClass * | getRandomNeuroClass () |
returns random neuroclass or NULL when no active classes. | |
NeuroClass * | parseNeuroClass (char *&s) |
returns neuroclass or NULL if the string does not begin with a valid name. Advance s pointer. | |
int | neuroClassProp (char *&s, NeuroClass *nc, bool also_v1_N_props=false) |
returns 0-based property number for neuroclass, 100-based extraproperty number for Neuro, or -1 if the string does not begin with a valid property name. Advance s pointer if success. | |
bool | isWS (const char c) |
is c a whitespace char? | |
void | skipWS (char *&s) |
advances pointer s skipping whitespaces. | |
bool | areAlike (char *, char *) |
compares two text strings skipping whitespaces. Returns 1 when equal, 0 when different. | |
char * | strchrn0 (const char *str, char ch) |
like strchr, but does not find zero char in str. | |
bool | isNeuroClassName (const char firstchar) |
determines if firstchar may start NeuroClass name. If not, it may start NeuroClass' (or Neuro's) property name. | |
Public Attributes | |
Param | par |
char | supported_format |
genotype format which is supported by this class ('6' for Geno_f6, etc.). Must be initialized in constructor | |
SString | name |
name of this set of genetic operators |
All the methods you might define are:
Your code must not cause errors (like invalid memory access, memory leaks) on any arguments, even 'random' ones. GENOPER_OPFAIL should be returned when an operator cannot cope with its argument genotype.To compile your code, you may also need some GDK files. A simple example is Geno_ftest class (see C++ code for details). A more realistic example is Geno_f4 derived from Geno_fx: refer to the available source on developmental encoding and f4 genotype format.
|
Checks a genotype for minor mistakes and major errors.
Reimplemented in Geno_ftest. |
|
Crosses over two genotypes. It is sufficient to return only one child (in g1) and set chg1 only, then g2 must equal "". Avoid unnecessary calls in your code. Every genotype argument passed to this function is first checked, and validated if checkValidity() reported an error (or if there is no checkValidity() implemented). Every resulting genotype is subject to the same procedure, unless GENOPER_OPFAIL was returned. Thus you do not have to call these functions on input and output genotypes, because they are validated if needed.
Reimplemented in Geno_ftest. |
|
|
|
Mutates a genotype. Mutation should always change something. Avoid unnecessary calls in your code. Every genotype argument passed to this function is first checked, and validated if checkValidity() reported an error (or if there is no checkValidity() implemented). Every resulting genotype is subject to the same procedure, unless GENOPER_OPFAIL was returned. Thus you do not have to call these functions on input and output genotypes, because they are validated if needed.
Reimplemented in Geno_ftest. |
|
You may want to have your genotype colored. This method provides desired character styles for genes.
Reimplemented in Geno_ftest. |
|
Validates a genotype. The purpose of this function is to validate obvious/minor errors (range overruns, invalid links, etc.). Do not try to introduce entirely new genes in place of an error.
Reimplemented in Geno_ftest. |