Пример #1
0
        void makeKons(FS CurrentFS, List <Term> forClass)
        {
#if PClass
            string Kons = FuzzySystem.PittsburghClassifier.KNNClassName.NearestClass(CurrentFS, forClass);
            theRule = new Rule(thePositionOfBee.TermsSet, numOfTerms, Kons);
#elif SApprox
            double Kons = FuzzySystem.SingletoneApproximate.KNNConsequent.NearestApprox(CurrentFS, forClass);
            theRule = new Rule(thePositionOfBee.TermsSet, numOfTerms, Kons);
#elif TSApprox
            double[] koefs;
            double   val = FuzzySystem.TakagiSugenoApproximate.LSMWeghtReqursiveSimple.EvaluteConsiquent(CurrentFS, forClass, out koefs);
            theRule = new Rule(thePositionOfBee.TermsSet, numOfTerms, val, koefs);
#else
            double Kons = FuzzySystem.SingletoneApproximate.KNNConsequent.NearestApprox(CurrentFS, forClass);
            theRule = new Rule(thePositionOfBee.TermsSet, numOfTerms, Kons);
#endif
        }
Пример #2
0
        public void WorkerFly(int numOfRule, Random rand)
        {
            Rule   optimised = thePositionOfBee.RulesDatabase[numOfRule];
            double coust     = 0;



            for (int i = 0; i < optimised.ListTermsInRule.Count; i++)
            {
                int numOfFreature = optimised.ListTermsInRule[i].NumVar;
                for (int j = 0; j < optimised.ListTermsInRule[i].Parametrs.Count(); j++)
                {
                    coust = rand.Next(100) / 500.0;
                    if (rand.Next(2) > 0)
                    {
                        optimised.ListTermsInRule[i].Parametrs[j] *= (1 - coust);
                    }
                    else
                    {
                        optimised.ListTermsInRule[i].Parametrs[j] *= (1 + coust);
                    }
                }
            }
        }