The class represents a fuzzy set.

Namespace:  AForge.Fuzzy
Assembly:  AForge.Fuzzy (in AForge.Fuzzy.dll) Version: (


public class FuzzySet


The fuzzy sets are the base for all fuzzy applications. In a classical set, the membership of a given value to the set can always be defined as true (1) or false (0). In fuzzy sets, this membership can be a value in the range [0..1], representing the imprecision existent in many real world applications.

Let us consider, for example, fuzzy sets representing some temperature. In a given application, there is the need to represent a cool and warm temperature. Like in real life, the precise point when the temperature changes from cool to warm is not easy to find, and does not makes sense. If we consider the cool around 20 degrees and warm around 30 degrees, it is not simple to find a break point. If we take the mean, we can consider values greater than or equal 25 to be warm. But we can still consider 25 a bit cool. And a bit warm at the same time. This is where fuzzy sets can help.

Fuzzy sets are often used to compose Linguistic Variables, used in Fuzzy Inference Systems.

Sample usage:

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

// show membership to the Cool set for some values 
Console.WriteLine( "COOL" );
for ( int i = 13; i <= 28; i++ )
    Console.WriteLine( fsCool.GetMembership( i ) );

// show membership to the Warm set for some values 
Console.WriteLine( "WARM" );
for ( int i = 23; i <= 38; i++ )
    Console.WriteLine( fsWarm.GetMembership( i ) );

Inheritance Hierarchy


See Also