AForge.Fuzzy.InferenceSystem.Evaluate C# (CSharp) Method

Evaluate() public method

Executes the fuzzy inference, obtaining a numerical output for a choosen output linguistic variable.
The variable indicated was not found in the database.
public Evaluate ( string variableName ) : float
variableName string Name of the to evaluate.
return float
        public float Evaluate( string variableName )
        {
            // call the defuzzification on fuzzy output 
            FuzzyOutput fuzzyOutput = ExecuteInference( variableName );
            float res = defuzzifier.Defuzzify( fuzzyOutput, normOperator );
            return res;
        }

Usage Example

Example #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <double>             NumInputs  = new List <double>();
            List <LinguisticVariable> InputVars  = new List <LinguisticVariable>();
            List <LinguisticVariable> OutputVars = new List <LinguisticVariable>();
            List <string>             Rules      = new List <string>();



            AForge.Fuzzy.InferenceSystem IS = null;
            string VarName     = null;
            double FailsafeVal = double.NaN;

            if (!DA.GetData(0, ref IS))
            {
                return;
            }
            if (!DA.GetData(1, ref VarName))
            {
                return;
            }
            if (!DA.GetData(2, ref FailsafeVal))
            {
                return;
            }

            try
            {
                double outVal = IS.Evaluate(VarName);
                DA.SetData(0, outVal);
                DA.SetData(1, false);
            }
            catch (Exception)
            {
                DA.SetData(0, FailsafeVal);
                DA.SetData(1, true);
            }
        }
All Usage Examples Of AForge.Fuzzy.InferenceSystem::Evaluate