GetMembership() public method

Calculate membership of a given value to the fuzzy set.
public GetMembership ( float x ) : float
x float Value which membership needs to be calculated.
return float
Beispiel #1
1
        // Testing basic functionality of fuzzy sets
        private void runFuzzySetTestButton_Click(object sender, EventArgs e)
        {
            ClearDataSeries();

            // create 2 fuzzy sets to represent the Cool and Warm temperatures
            FuzzySet fsCool = new FuzzySet("Cool", new TrapezoidalFunction(13, 18, 23, 28));
            FuzzySet fsWarm = new FuzzySet("Warm", new TrapezoidalFunction(23, 28, 33, 38));

            // get membership of some points to the cool fuzzy set
            double[,] coolValues = new double[20, 2];
            for (int i = 10; i < 30; i++)
            {
                coolValues[i - 10, 0] = i;
                coolValues[i - 10, 1] = fsCool.GetMembership(i);
            }

            // getting memberships of some points to the warm fuzzy set
            double[,] warmValues = new double[20, 2];
            for (int i = 20; i < 40; i++)
            {
                warmValues[i - 20, 0] = i;
                warmValues[i - 20, 1] = fsWarm.GetMembership(i);
            }

            // plot membership to a chart
            chart.UpdateDataSeries("COOL", coolValues);
            chart.UpdateDataSeries("WARM", warmValues);
        }
Beispiel #2
0
 /// <summary>
 /// Evaluates the fuzzy clause.
 /// </summary>
 ///
 /// <returns>Degree of membership [0..1] of the clause.</returns>
 ///
 public float Evaluate( )
 {
     return(label.GetMembership(variable.NumericInput));
 }
Beispiel #3
0
        /// <summary>
        /// Calculate the membership of a given value to a given label. Used to evaluate linguistics clauses like
        /// "X IS A", where X is a value and A is a linguistic label.
        /// </summary>
        ///
        /// <param name="labelName">Label (fuzzy set) to evaluate value's membership.</param>
        /// <param name="value">Value which label's membership will to be calculated.</param>
        ///
        /// <returns>Degree of membership [0..1] of the value to the label (fuzzy set).</returns>
        ///
        /// <exception cref="KeyNotFoundException">The label indicated in labelName was not found in the linguistic variable.</exception>
        ///
        public float GetLabelMembership(string labelName, float value)
        {
            FuzzySet fs = labels[labelName];

            return(fs.GetMembership(value));
        }