Fuzzy Computations Library
AForge.NET framework provides set of classes, which allow to perform
different fuzzy computations, starting from using basic fuzzy sets and linguistic variables and
continuing with complete inference system, which is capable of running set
of fuzzy rules evaluating requested fuzzy variable.
 InferenceSystem  represents a complete fuzzy inference system,
with a data base, a rule base, a fuzzy output and a defuzzification method to calculate the numeric output.
 Database  a list with all the linguistic variables of the system.
 LinguisticVariable  variables used in fuzzy systems that can store a linguistic value (fuzzy set). They are set of labelled fuzzy sets.
 FuzzySet  the base of all fuzzy theory, represents a set where members have a degree of membership, usually between 0 and 1.
 IMembershipFunction  interface for the possible membership functions of the fuzzy sets.
 PicewiseLinearFunction  membership function composed by several linear functions.
 TrapezoidalFunction  typical membership function with a trapezoid's shape.
 Rulebase  a list with all the linguistic rules of the system.
 Rule  represents a fuzzy rule, generally formatted as ""if X is A and Y is B then Z is C". It contains fuzzy clauses and operators to combine these clauses.
 Clause  a fuzzy clause of the type "X is A", where "X" is a linguistic variable and "A" is a linguistic value to which the variable can be set.
 INorm  interface for the fuzzy norms, methods used to perform the "And" operations among fuzzy sets.
 ICoNorm  interface for the fuzzy conorms, methods used to perform the "Or" operations among fuzzy sets.
 MaximumCoNorm  conorm calculated using the maximum among two values.
 MiniumNorm  norm calculated using the minimum among two values.
 ProductNorm  norm calculated multiplying the two values.
 FuzzyOutput  the fuzzy output of a system, that can be used in its linguistic form or defuzzyfied.
 IDefuzzyfier  interface for the defuzyfication methods used to extract the numeric output from a fuzzy output.
 CentroidDefuzzifier  defuzyfication which calculates the centroid of the fuzzy output.
// 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 );
// showing the shape of the linguistic variable 
// the shape of its labels memberships from start to end
Console.WriteLine( "Cold; Cool; Warm; Hot" );
for ( double x = 0; x < 80; x += 0.2 )
{
double y1 = lvTemperature.GetLabelMembership( "Cold", x );
double y2 = lvTemperature.GetLabelMembership( "Cool", x );
double y3 = lvTemperature.GetLabelMembership( "Warm", x );
double y4 = lvTemperature.GetLabelMembership( "Hot" , x );
Console.WriteLine( String.Format( "{0:N}; {1:N}; {2:N}; {3:N}",
y1, y2, y3, y4 ) );
}
For additional information and sample codes check documentation of classes from the
AForge.Fuzzye namespace. In addition check
fuzzy systems' samples provided with AForge.NET framework and an introduction article about
Fuzzy Computing.
