AForge.Fuzzy.InferenceSystem.ExecuteInference C# (CSharp) Метод

ExecuteInference() публичный Метод

Executes the fuzzy inference, obtaining the FuzzyOutput of the system for the required LinguisticVariable.
The variable indicated was not found in the database.
public ExecuteInference ( string variableName ) : FuzzyOutput
variableName string Name of the to evaluate.
Результат FuzzyOutput
        public FuzzyOutput ExecuteInference( string variableName )
        {
            // gets the variable
            LinguisticVariable lingVar = database.GetVariable( variableName );

            // object to store the fuzzy output
            FuzzyOutput fuzzyOutput = new FuzzyOutput( lingVar );

            // select only rules with the variable as output
            Rule[] rules = rulebase.GetRules( );
            foreach ( Rule r in rules )
            {
                if ( r.Output.Variable.Name == variableName )
                {
                    string labelName = r.Output.Label.Name;
                    float firingStrength = r.EvaluateFiringStrength( );
                    if ( firingStrength > 0 )
                        fuzzyOutput.AddOutput( labelName, firingStrength );
                }
            }

            // returns the fuzzy output obtained
            return fuzzyOutput;
        }
    }