You are on page 1of 19

Soft Computing (22MCA213)

(An off-Campus Institution of NITTE (DEEMED TO BE UNIVERSITY), MANGALORE)

Department of MCA

Subject: Soft Computing


Subject Code: 22MCA213
Semester: II
Unit: II (Fuzzy Logic)

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Introduction to fuzzy logic


➔ The term fuzzy refers to things that are not clear
➔ Sometimes, we cannot decide in real life that the given problem or statement is either true or false.
At that time, this concept provides many values between the true and false and gives the flexibility
to find the best solution to that problem.

→This concept was introduced by Lotfi Zadeh in 1965


→In the Boolean system, only two possibilities (0 and 1) exist, where 1 denotes the absolute truth
value and 0 denotes the absolute false value. But in the fuzzy system, there are multiple
possibilities present between the 0 and 1, which are partially false and partially true.

Characteristics of fuzzy logic:


➔ flexible and we can easily understand and implement it.
➔ It is the best method for finding the solution of those problems which are suitable for approximate
or uncertain reasoning.
➔ In fuzzy logic, everything is a matter of degree.
➔ It is used for helping the minimization of the logics created by the human.
➔ It also allows users to integrate with the programming.

Advantages of fuzzy logic:


➔ This system can work with any type of inputs whether it is imprecise, distorted or noisy input
information.
➔ The construction of Fuzzy Logic Systems is easy and understandable.
➔ Fuzzy logic comes with mathematical concepts of set theory and the reasoning of that is quite
simple.
➔ It provides a very efficient solution to complex problems in all fields of life as it resembles
human reasoning and decision-making.

Disadvantages of Fuzzy Logic Systems


➔ As fuzzy logic works on precise as well as imprecise data so most of the time accuracy is
compromised.
➔ Many researchers proposed different ways to solve a given problem through fuzzy logic which
leads to ambiguity.

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Classical set and fuzzy set


A classical set is defined by crisp boundaries.
Usually an ordinary set( classical/crisp set) is called a collection of objects which have some properties
distinguishing them from other objects which do not posses these properties.
Fuzzy set has ambiguous properties

Classical set:
A classical set is a collection of distinct objects all having the same characteristics
➔ Example for classical set:
Set of negative integers
Set of persons with height less than 6 feet
Days of the week
➔ Collection of elements within a universe are called sets
➔ Collection of elements within a set are called subsets
➔ There are several ways of defining a set:
A={2,4,6,8,10}
A={x| x is even number less than or equal to 10}
➔ {} is a null set or Empty set
➔ Following are some of the notations used:

Operations on classical set:


Let A and B be 2 sets on the universe X

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Example- Operations on classical set:


1. Let A = {1, 2, 3},
B= {3, 4, 5, 6}
A∪B = {1, 2, 3, 4, 5, 6}.
2. Let A = {11, 12, 13},
B = {13, 14, 15}
A ∩ B = {13}.
3. Let A = {1, 2, 3, 4}
B = {3, 4, 5, 6}
A - B = {3, 4}
B - A = {5, 6}
4. Let U is the set of all natural numbers.
A = {1, 2, 3}

A = {all natural numbers except 1, 2, and 3}.

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Properties of classical set

Fuzzy set
Fuzziness occurs when a piece of information is not clear cut
Words like young, tall, good, high are fuzzy
Fuzzy set theory is an extension of classical set theory where elements have degree of membership

Membership function
Membership function represents the degree of truth in fuzzy logic.
A membership function (MF) is a curve that defines how each point in the input space is mapped to a
membership value (or degree of membership) between 0 and 1.
Membership function allows us to graphically represent a fuzzy set
X axis represent the Universe of Discourse
Y axis represent the degree of membership in the interval [0,1] interval

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

They may have different shapes like Singleton, triangular, trapezoidal, gaussian etc.
Singleton membership function
The Singleton membership function assigns membership value 1 to a particular value of x and assigns
value 0 to the rest of all.

Example:
Membership Functions for T (temperature)

Triangular Membership function


The triangle which fuzzifies the input can be defined by three parameters a, b and c, where c defines the
base and b defines the height of the triangle.

If input x = b, then it is having full membership in the given set. So,


μ(x) = 1, if x = b
And if the input is less than a or greater than c, then it does belong to the fuzzy set at all, and its membership
value will be 0

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

μ(x) = 0, x < a or x > c

If x is between a and b,its membership value varies from 0 to 1.


If it is near a, its membership value is close to 0, and if x is near c, its membership value gets close to 1.
We can compute the fuzzy value of x using a similar triangle rule,

If x is between b and c, its membership value varies from 0 to 1. If it is near b, its membership value is
close to 1, and if x is near c, its membership value gets close to 0.
We can compute the fuzzy value of x using a similar triangle rule,

Combining,

Example:

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

For the following data, determine μ, corresponding to x = 8.0

μ =0.5
Trapezoidal membership function:
The trapezoidal membership function is defined by four parameters: a, b, c and d.

b to c represents the highest membership value that element can take. And if x is between (a, b) or (c, d),
then it will have a membership value between 0 and 1.

Example:
Determine μ, corresponding to x = 3.5

μ =0.75
Gaussian membership function
A Gaussian MF is specified by two parameters {m, σ} and can be defined as follows.

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

m represents the mean / center of the gaussian curve and σ represents the spread of the curve.
Example:
Determine μ corresponding to x = 9, m = 10 and σ = 3.0

μ =0.9459
Sigmoid Membership function:
Sigmoid functions are widely used in classification tasks in machine learning.
It is controlled by parameters a and c. Where a control the slope at the crossover points x = c
Graphically, we can represent it as,

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Example:
Determine μ corresponding to x = 8

μ =0.999
Structure of fuzzification
Consider the following Fuzzy logic system architecture,

Fuzzification: the process of transforming a crisp set to a fuzzy set


Defuzzification: the process of reducing a fuzzy set into a crisp set
Following are the different techniques of Defuzzification:
1. Lambda-cut method
2. Maxima method
3. Weighted Average
4. Center of Sum
1. Lambda-cut method

Properties of lambda-cut
If A and B are two fuzzy sets,

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Consider the following Example:

Problem:

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

2. Maxima Method
This method relies on the position of maximum membership of element at particular position in
fuzzy set.
Different types of Maxima methods are:
*Height method
*First of Maxima (FOM)
*Last of Maxima (LOM)
*Mean of Maxima (MOM)
Height method
Height of the fuzzy set is the maximum value of the membership function in a fuzzy set A

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Here, x* has the maximum membership value.


This method is applicable when height is unique
Example:
Find the crisp value of the following fuzzy set using height method

X*=5.5
First of Maxima
This method determines the smallest value of the domain with maximum membership value

Example:

Last of Maxima:

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Determine the largest value of the domain with maximum membership value.

Example:
The defuzzified value for LOM method will be x*=8

Mean/Middle of maxima:
Determines Mean of FOM and LOM

MOM, x*=3.5
Consider the following example:
Young={(28,0.6),(20,0.8),(25,0.8),(30,0.5),(35,0.3)}
MOM, X*=(20+25)/2
22.5
Weighted Average:
x* is computed as:

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

Center of sum method:

Where A is the area of the fuzzy set


x represents the center of area.
Example:
Given the following three fuzzy output sets, find the crisp value corresponding to that.

A1 = 1/2 (3 + 5) × 0.3 = 1.2


A2 = 1/2 (2 + 4) × 0.5 = 1.5
A3 = 1/2 (1 + 3) × 1.0 = 2

Fuzzy rule generation


1. Fuzzy If then rule

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

A fuzzy if-then rule is of the form “If x is A then y is B” where A and B are linguistic values defined by
fuzzy sets on universes of discourse X and Y, respectively.

Also written as,

“x is A” is called antecedent and “y is B” is called consequent.


The rule is also called a “fuzzy implication” or fuzzy conditional statement.
If the road is slippery, then driving is dangerous.
If the fruit is ripe, then it is soft.
Classical vs. Fuzzy Rules
A classical IF-THEN rule uses binary logic, for example,

We can also represent the stopping distance rules in a fuzzy form:

In fuzzy rules, the linguistic variable speed also has the range (the universe of discourse) between 0 and
220km/h, but this range includes fuzzy sets, such as slow, medium and fast.
A fuzzy rule can have multiple antecedents, for example:

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte


Soft Computing (22MCA213)

The consequent of a fuzzy rule can also include multiple parts, for instance:

2. If then else rule


Example:

Ms Raksha Puthran, Assistant Professor Gd-II, NMAMIT, Nitte

You might also like