Legacy Documentation

Fuzzy Logic (2004)

This is documentation for an obsolete product.
Current products and services

 Documentation /  Fuzzy Logic /  Manual /

Creating Fuzzy RelationsAggregation Operations

1.3 Fuzzy Operations

1.3.1 Introduction

Fuzzy Logic contains a wide variety of operations that can be performed on fuzzy sets and fuzzy relations. This chapter introduces these functions and demonstrates how to use them.

This loads the package.

In[1]:=

There are three groups of fuzzy operations, those that apply to fuzzy sets only, those that apply to fuzzy relations only, and those that apply to both fuzzy sets and fuzzy relations.

1.3.2 Fuzzy Set Operations

This section describes operations that can be performed on individual fuzzy sets.

Operations that apply to fuzzy sets only.

To demonstrate the various operations, we first create two fuzzy sets. We use the FuzzyTrapezoid function, described earlier in this manual, to create the fuzzy sets.

In[2]:=

Out[2]=

In[3]:=

To examine the fuzzy sets we created, we use the FuzzyPlot graphing function. The graphing functions are described in Chapter 1.5 Fuzzy Set Visualization.

In[4]:=

In this graph, the trapezoid-shaped fuzzy set represents FS1, and the triangular fuzzy set represents FS2. These fuzzy sets are plotted in red and blue, respectively, in a Mathematica session.

The function Height[A] returns the value of the largest membership grade in fuzzy set A. A fuzzy set with a height of 1 is called a normal fuzzy set.

In[5]:=

Out[5]=

We see that FS1 is a normal fuzzy set, while FS2 is a subnormal fuzzy set.

Cardinality[A] returns the sum of all of the membership grades in fuzzy set A.

In[6]:=

Out[6]=

RelativeCardinality[A] returns the cardinality of fuzzy set A divided by the total number of elements in the universal space of A.

In[7]:=

Out[7]=

FuzzyCardinality[A] returns the fuzzy cardinality of fuzzy set A. Here we compute the fuzzy cardinalities for FS1 and FS2.

In[8]:=

Out[8]=

In[9]:=

Out[9]=

CenterOfArea[A] returns the center of area defuzzification of fuzzy set A. We first find the centers of area of FS1 and FS2.

In[10]:=

Out[10]=

Option for CenterOfArea, MeanOfMax, SmallestOfMax, LargestOfMax, and BisectorOfArea.

CenterOfArea has an option, ShowGraph, that by default is set to False. If the option ShowGraph is set to True, this function returns a plot of a fuzzy set with a dot along the base axis indicating where the center of area is located. The graph produced by the ShowGraph option can be customized using any of the options available with Mathematica's standard Plot function. To demonstrate this, we give the plot a label with the PlotLabel option.

In[11]:=

In[12]:=

MeanOfMax[A] returns the mean of maximum defuzzification of fuzzy set A. This function also has a ShowGraph option for visualizing the defuzzification similarly to CenterOfArea.

In[13]:=

In[14]:=

SmallestOfMax[A] returns the smallest of maximum defuzzification of fuzzy set A. This function also has a ShowGraph option for visualizing the defuzzification (see CenterOfArea above).

In[15]:=

LargestOfMax[A] returns the largest of maximum defuzzification of fuzzy set A. This function also has a ShowGraph option for visualizing the defuzzification (see CenterOfArea above).

In[16]:=

BisectorOfArea[A] returns the bisector of area defuzzification of fuzzy set A. This function also has a ShowGraph option for visualizing the defuzzification (see CenterOfArea above).

In[17]:=

Support[A] returns a list of all elements of fuzzy set A with nonzero membership grades.

In[18]:=

Out[18]=

Core[A] returns a list of all elements of fuzzy set A with a membership grade equal to 1.

In[19]:=

Out[19]=

EquilibriumSet[A] returns a list of all elements of fuzzy set A with membership grades equal to 0.5.

In[20]:=

Out[20]=

1.3.3 Fuzzy Relation Operations

This section describes operations that can be performed on individual fuzzy relations. To demonstrate these operations, we create a new fuzzy relation with the FuzzyTrapezoid function. We use the FuzzySurfacePlot function to show the new fuzzy relation.

In[21]:=

In[22]:=

Operations that apply to fuzzy relations only.

FirstProjection[A] returns a fuzzy set that is the projection of fuzzy relation A onto the first space of the relation.

In[23]:=

Out[23]=

We can plot the first projection using FuzzyPlot.

In[24]:=

SecondProjection[A] returns a fuzzy set that is the projection of fuzzy relation A onto the second space of the relation.

In[25]:=

Out[25]=

In[26]:=

GlobalProjection[A] returns a value that represents the maximum membership grade in fuzzy relation A. This is analogous to the Height function for fuzzy sets.

In[27]:=

Out[27]=

1.3.4 Fuzzy Set or Fuzzy Relation Operations

This section describes operations that can be performed on either individual fuzzy sets or individual fuzzy relations. To demonstrate these operations, we first create one new fuzzy set and one new fuzzy relation. In some of the examples that follow, we demonstrate functions operating on just a fuzzy set or just a fuzzy relation, but keep in mind that all the operators in this section work for both fuzzy sets and fuzzy relations.

In[28]:=

In[29]:=

In[30]:=

In[31]:=

Operations that apply to both fuzzy sets and fuzzy relations.

AlphaLevelSet[A, alpha] returns a list of all elements of fuzzy set A with membership grades greater than or equal to alpha.

In[32]:=

Out[32]=

StrongAlphaLevelSet[A, alpha] returns a list of all elements of fuzzy set A with membership grades greater than alpha.

In[33]:=

Out[33]=

LevelSet[A] returns a list of all alpha of A, where A is a fuzzy set .

In[34]:=

Out[34]=

Subsethood[A, B] returns the degree of subsethood of fuzzy set/fuzzy relation A in fuzzy set/fuzzy relation B. The value returned will be between 0 and 1, with values closer to 1 indicating that the second fuzzy set/fuzzy relation is closer to being a subset of the first fuzzy set/fuzzy relation.

In[35]:=

Out[35]=

In[36]:=

Out[36]=

HammingDistance[A, B] returns the Hamming distance from fuzzy set/fuzzy relation A to fuzzy set/fuzzy relation B.

In[37]:=

Out[37]=

Concentrate[A] concentrates the membership grades of A, where A is a fuzzy set or a fuzzy relation. The concentration function squares the membership grades for each element of A.

We find the concentration of our newly created fuzzy set here, and plot the original fuzzy set with its concentration on the same graph to show the effects of the operation.

In[38]:=

In[39]:=

In the graph, the concentrated fuzzy set is included in the original fuzzy set, and it looks like a concentrated version of the original fuzzy set.

Dilate[A] dilates the membership grades of A, where A is a fuzzy set or fuzzy relation. The dilation function takes the square root of the membership grades for each element in A.

In[40]:=

In[41]:=

From the graph we can clearly see that the new fuzzy relation is a dilated version of the original fuzzy relation.

IntensifyContrast[A] intensifies the contrast between the membership grades of A. The new membership grades are calculated as follows:

if ,

otherwise,

where is the original membership grade.

In[42]:=

In[43]:=

Normalize[A] adjusts the membership grades of A to create a normalized fuzzy set or fuzzy relation with a height of 1.

In[44]:=

In[45]:=

Complement[A] returns the complement (standard or nonstandard) of A, where A can be a fuzzy set or a fuzzy relation.

An option for Complement.

The Type option specifies the type of complement to be performed. The Standard complement is the default, but the following parameterized complements are also available.

Admissible values for Type for Complement for nonstandard cases.

We find the Complement of our fuzzy set. Since we have not specified a Type, the function performs the Standard complement.

In[46]:=

In[47]:=

Here we use a Yager complement of our fuzzy relation with the parameter w set to 2.

In[48]:=

In[49]:=

You can define your own operations with the help of FuzzyModify. FuzzyModify[func, A] modifies the membership grades of A according to the supplied function func. A may be either a fuzzy set or a fuzzy relation. In this example, we first define a function that cubes its input. We then perform the FuzzyModify operation using the cubing function to modify the membership grades of our original fuzzy set.

In[50]:=

In[51]:=

Out[51]=

In[52]:=

Distinctions for fuzzy sets and fuzzy relations.

Equality[A, B] returns True if A and B are equal, and False otherwise.

In[53]:=

Out[53]=

Included[A, B] returns True if A is included in B and False otherwise. To be included, the membership grades of A must be less than or equal to the membership grades of B for all elements.

In[54]:=

Out[54]=

Creating Fuzzy RelationsAggregation Operations