C# Class Accord.Fuzzy.Clause

This class represents a fuzzy clause, a linguistic expression of the type "Variable IS Value".

A Fuzzy Clause is used to verify if a linguistic variable can be considered as a specific value at a specific moment. Linguistic variables can only assume value of their linguistic labels. Because of the nature of the Fuzzy Logic, a Variable can be several of its labels at the same time, with different membership values.

For example, a linguistic variable "temperature" can be "hot" with a membership 0.3 and "warm" with a membership 0.7 at the same time. To obtain those memberships, Fuzzy Clauses "temperature is hot" and "temperature is war" can be built.

Typically Fuzzy Clauses are used to build Fuzzy Rules (Rule).

Sample usage:

// create a linguistic variable to represent temperature LinguisticVariable lvTemperature = new LinguisticVariable("Temperature", 0, 80 ); // create the linguistic labels (fuzzy sets) that compose the temperature TrapezoidalFunction function1 = new TrapezoidalFunction(10, 15, TrapezoidalFunction.EdgeType.Right); FuzzySet fsCold = new FuzzySet("Cold", function1); TrapezoidalFunction function2 = new TrapezoidalFunction(10, 15, 20, 25); FuzzySet fsCool = new FuzzySet("Cool", function2); TrapezoidalFunction function3 = new TrapezoidalFunction(20, 25, 30, 35); FuzzySet fsWarm = new FuzzySet("Warm", function3); TrapezoidalFunction function4 = new TrapezoidalFunction(30, 35, TrapezoidalFunction.EdgeType.Left); FuzzySet fsHot = new FuzzySet("Hot", function4); // adding labels to the variable lvTemperature.AddLabel(fsCold); lvTemperature.AddLabel(fsCool); lvTemperature.AddLabel(fsWarm); lvTemperature.AddLabel(fsHot); // creating the Clause Clause fuzzyClause = new Clause(lvTemperature, fsHot); // setting the numerical input of the variable to evaluate the Clause lvTemperature.NumericInput = 35; float result = fuzzyClause.Evaluate(); Console.WriteLine(result.ToString());
Exibir arquivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
Clause ( LinguisticVariable variable, FuzzySet label ) : System

Initializes a new instance of the Clause class.

Evaluate ( ) : float

Evaluates the fuzzy clause.

ToString ( ) : string

Returns the fuzzy clause in its linguistic representation.

Method Details

Clause() public method

Initializes a new instance of the Clause class.
The label indicated was not found in the linguistic variable.
public Clause ( LinguisticVariable variable, FuzzySet label ) : System
variable LinguisticVariable Linguistic variable of the clause.
label FuzzySet Label of the linguistic variable, a fuzzy set used as label into the linguistic variable.
return System

Evaluate() public method

Evaluates the fuzzy clause.
public Evaluate ( ) : float
return float

ToString() public method

Returns the fuzzy clause in its linguistic representation.
public ToString ( ) : string
return string