Ignore:
Timestamp:
08/19/17 02:43:11 (7 years ago)
Author:
Maciej Komosinski
Message:

Added three functions that may be useful in general

File:
1 edited

Legend:

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

    r670 r673  
    8787
    8888/**Used to perform initializations of Param parameters that are not handled by the Param itself
    89 (i.e. string parameters need to be initialized here)*/
     89(i.e. string parameters or fields that require some complex logic may be initialized here)*/
    9090   virtual void setDefaults() {}
    9191
     
    192192   static void linearMix(ParamInterface &p1, int i1, ParamInterface &p2, int i2, double proportion); ///<mixes i1'th and i2'th properties of p1 and p2; proportion should be within [0,1]; 0.5 causes both properties to become their average. For integer properties applies random "dithering" when necessary.
    193193   static NeuroClass* getRandomNeuroClass(); ///<returns random neuroclass or NULL when no active classes.
     194   static int getRandomNeuroClassWithOutput(const vector<NeuroClass*>& NClist); //returns index of random neuroclass from the NClist or -1 (no neurons on the list that provide output)
     195   static int getRandomNeuroClassWithInput(const vector<NeuroClass*>& NClist); //returns index of random neuroclass from the NClist or -1 (no neurons on the list that want input(s))
     196   static int getRandomChar(const char *choices, const char *excluded); ///<returns index of a random character from 'choices' excluding 'excluded', or -1 when everything is excluded or 'choices' is empty.
    194197   static NeuroClass* parseNeuroClass(char *&s); ///<returns longest matching neuroclass or NULL if the string does not begin with a valid neuroclass name. Advances \e s pointer.
    195198   static Neuro* findNeuro(const Model *m,const NeuroClass *nc); ///<returns pointer to first Neuro of class \e nc, or NULL if there is no such Neuro.
Note: See TracChangeset for help on using the changeset viewer.