Changeset 801


Ignore:
Timestamp:
06/07/18 17:40:49 (2 years ago)
Author:
Maciej Komosinski
Message:

Added a helper function that counts active neuron classes

Location:
cpp/frams/genetics
Files:
2 edited

Legend:

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

    r779 r801  
    223223}
    224224
     225int GenoOperators::getActiveNeuroClassCount()
     226{
     227        int count = 0;
     228        for (int i = 0; i < Neuro::getClassCount(); i++)
     229                if (Neuro::getClass(i)->genactive)
     230                        count++;
     231        return count;
     232}
     233
    225234NeuroClass* GenoOperators::getRandomNeuroClass()
    226235{
  • cpp/frams/genetics/genooperators.h

    r779 r801  
    193193        static void linearMix(vector<double> &p1, vector<double> &p2, double proportion); ///<mixes two real-valued vectors; inherited proportion should be within [0,1]; 1.0 does not change values (all inherited), 0.5 causes both vectors to become their average, 0.0 swaps values (none inherited).
    194194        static void linearMix(ParamInterface &p1, int i1, ParamInterface &p2, int i2, double proportion); ///<mixes i1'th and i2'th properties of p1 and p2; inherited proportion should be within [0,1]; 1.0 does not change values (all inherited), 0.5 causes both properties to become their average, 0.0 swaps values (none inherited). For integer properties applies random "dithering" when necessary.
     195        static int getActiveNeuroClassCount(); ///<returns active class count
    195196        static NeuroClass* getRandomNeuroClass(); ///<returns random neuroclass or NULL when no active classes.
    196197        static NeuroClass* getRandomNeuroClassWithOutput(); ///<returns random neuroclass with output or NULL when no active classes.
Note: See TracChangeset for help on using the changeset viewer.