Ignore:
Timestamp:
05/29/18 16:24:39 (6 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/neuro/impl/neuroimpl-fuzzy.h

    r286 r791  
    2020private:
    2121
    22   double *fuzzySets;    /// list of four digits which represents fuzzy sets: [0]-l, [1]-m, [2]-n, [3]-r, ...  fuzzySet[4*i] = left, fuzzySet[4*i + 1] = midleft, fuzzySet[4*i + 2] = midright, fuzzySet[4*i + 3] = right
     22        double *fuzzySets;    /// list of four digits which represents fuzzy sets: [0]-l, [1]-m, [2]-n, [3]-r, ...  fuzzySet[4*i] = left, fuzzySet[4*i + 1] = midleft, fuzzySet[4*i + 2] = midright, fuzzySet[4*i + 3] = right
    2323
    24   /** Determines, which fuzzy set is connected with each input of neuron. For instance third rule:
    25   *   'IF input3 = fuzzy set #3 AND input5 = fuzzy set #1 then output2 = fuzzy set #6 AND output7 = fuzzy set #5'
    26   *   the variables shoul have values as shown below:
    27   *   RulesDef[4]=2; RulesDef[5]=2; //rule 3: 2 inputs, 2 outputs
    28   *   Rules[2][0]=3, Rules[2][1]=3, Rules[2][2]=5, Rules[2][3]=1, Rules[2][4]=2, Rules[2][5]=6, Rules[2][6]=7, Rules[2][3]=5
    29   */
    30   int *rulesDef;    ///list of rules definitions: nr of inputs in rule 1, nr of outputs in rule 1, ... and so on for each rule
    31   int **rules;      ///list of rules body: input nr, fuzzy set nr, ... , output nr, fuzzy set nr, ... and so on for each rule
     24        /** Determines, which fuzzy set is connected with each input of neuron. For instance third rule:
     25        *   'IF input3 = fuzzy set #3 AND input5 = fuzzy set #1 then output2 = fuzzy set #6 AND output7 = fuzzy set #5'
     26        *   the variables shoul have values as shown below:
     27        *   RulesDef[4]=2; RulesDef[5]=2; //rule 3: 2 inputs, 2 outputs
     28        *   Rules[2][0]=3, Rules[2][1]=3, Rules[2][2]=5, Rules[2][3]=1, Rules[2][4]=2, Rules[2][5]=6, Rules[2][6]=7, Rules[2][3]=5
     29        */
     30        int *rulesDef;    ///list of rules definitions: nr of inputs in rule 1, nr of outputs in rule 1, ... and so on for each rule
     31        int **rules;      ///list of rules body: input nr, fuzzy set nr, ... , output nr, fuzzy set nr, ... and so on for each rule
    3232
    33   /**
    34   *  Sets defuzzyfication parameters: determines - for each rule - cut level <0;1> (minimum membership function of current rule).
    35   *  In fact, defuzzParam remembers the values from 'first layer' - fuzzyfication layer (see neuron at documentation)
    36   *  i.e. rule 1: defuzzParam[0] = 0.3522
    37   */
    38   double *defuzzParam; /// i.e.: defuzParam[5] = 0.455 means that rule #6 has got a minimum membership function (of given inputs set for this rule) at value 0.455 (it's cut level)
     33        /**
     34        *  Sets defuzzyfication parameters: determines - for each rule - cut level <0;1> (minimum membership function of current rule).
     35        *  In fact, defuzzParam remembers the values from 'first layer' - fuzzyfication layer (see neuron at documentation)
     36        *  i.e. rule 1: defuzzParam[0] = 0.3522
     37        */
     38        double *defuzzParam; /// i.e.: defuzParam[5] = 0.455 means that rule #6 has got a minimum membership function (of given inputs set for this rule) at value 0.455 (it's cut level)
    3939
    4040protected:
    4141
    42   ///Fuzzy functions
    43   double TrapeziumFuzz(int which_fuzzy_set, double input_val);
    44   int Fuzzyfication();
    45   int Defuzzyfication();
    46   int GetFuzzySetParam(int set_nr, double &left, double &midleft, double &midright, double &right);
     42        ///Fuzzy functions
     43        double TrapeziumFuzz(int which_fuzzy_set, double input_val);
     44        int Fuzzyfication();
     45        int Defuzzyfication();
     46        int GetFuzzySetParam(int set_nr, double &left, double &midleft, double &midright, double &right);
    4747
    4848public:
    4949
    50   int fuzzySetsNr;      /// number of fuzzy sets
    51   int rulesNr;      ///number of rules
    52   SString fuzzySetString; /// strings containing all fuzzy sets given in f0
    53   SString fuzzyRulesString; /// strings containing all fuzzy rules given in f0
     50        int fuzzySetsNr;      /// number of fuzzy sets
     51        int rulesNr;      ///number of rules
     52        SString fuzzySetString; /// strings containing all fuzzy sets given in f0
     53        SString fuzzyRulesString; /// strings containing all fuzzy rules given in f0
    5454
    55   NI_FuzzyNeuro() {paramentries=NI_FuzzyNeuro_tab; fuzzySets=defuzzParam=NULL; rulesDef=NULL; rules=NULL;}
    56   ~NI_FuzzyNeuro();
    57   NeuroImpl* makeNew() { return new NI_FuzzyNeuro(); };
    58   void go();
    59   int lateinit();
    60   /** Function build model based on given genotype and conts number of neurons connected with fuzzy neuro,
    61     also checks number of fuzzy neuron inputs.
    62     \param genotype genotype to be scanned
    63     \param inputs number of fuzzy neuron inputs
    64     \param output number of fuzzy neuron outputs (= number of neurons connected to fuzzy neuron)
    65     @return success or failure
    66   **/
    67   static int countOuts(const Model *m, const Neuro *fuzzy);
    68  
     55        NI_FuzzyNeuro() { paramentries = NI_FuzzyNeuro_tab; fuzzySets = defuzzParam = NULL; rulesDef = NULL; rules = NULL; }
     56        ~NI_FuzzyNeuro();
     57        NeuroImpl* makeNew() { return new NI_FuzzyNeuro(); };
     58        void go();
     59        int lateinit();
     60        /** Function build model based on given genotype and conts number of neurons connected with fuzzy neuro,
     61          also checks number of fuzzy neuron inputs.
     62          \param genotype genotype to be scanned
     63          \param inputs number of fuzzy neuron inputs
     64          \param output number of fuzzy neuron outputs (= number of neurons connected to fuzzy neuron)
     65          @return success or failure
     66          **/
     67        static int countOuts(const Model *m, const Neuro *fuzzy);
     68
    6969};
    7070
Note: See TracChangeset for help on using the changeset viewer.