Ignore:
Timestamp:
06/26/20 01:30:10 (4 years ago)
Author:
Maciej Komosinski
Message:

Added a high-level neuron mutation function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/genooperators.h

    r957 r959  
    185185        static int roulette(const double *probtab, const int count);    ///<returns random index according to probabilities in the \e probtab table or -1 if all probs are zero. \e count is the number of elements in \e probtab.
    186186        static 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).
     187        static bool mutateRandomNeuronOrNeuroclassProperty(Neuro* n); ///<high-level neuron mutation function, will select and mutate a random property of a neuron or its neuroclass. Returns true if successful and some property was actually mutated. Could return false when the neuron and its neuroclass have no properties, or when a randomly selected property was not suitable for mutation (for example a string or another non-number type).
    187188        static int selectRandomNeuronProperty(Neuro* n); ///<selects random property (either 0-based extraproperty of Neuro or NEUROCLASS_PROP_OFFSET-based property of its NeuroClass). -1 if Neuro has no properties.
    188189        static double mutateNeuronProperty(double current, Neuro *n, int propindex); ///<returns value \e current mutated for the property \e propindex of NeuroClass \e nc or for extraproperty (\e propindex - NEUROCLASS_PROP_OFFSET) of Neuro. Neuro is used as read-only. Give \e propindex == -1 to mutate connection weight (\e nc is then ignored).
Note: See TracChangeset for help on using the changeset viewer.