0% found this document useful (0 votes)
48 views102 pages

Fuzzy Logic

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views102 pages

Fuzzy Logic

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 102

Fuzzy Logic

Tushar B. Kute,
http://tusharkute.com
Fuzzy Logic

• Fuzzy Logic Systems (FLS) produce acceptable but


definite output in response to incomplete, ambiguous,
distorted, or inaccurate (fuzzy) input.
• Fuzzy Logic (FL) is a method of reasoning that resembles
human reasoning. The approach of FL imitates the way of
decision making in humans that involves all intermediate
possibilities between digital values YES and NO.
• The conventional logic block that a computer can
understand takes precise input and produces a definite
output as TRUE or FALSE, which is equivalent to human’s
YES or NO.
Fuzzy Logic

• The inventor of fuzzy logic, Lotfi Zadeh, observed


that unlike computers, the human decision making
includes a range of possibilities between YES and
NO, such as −

• The fuzzy logic works on the levels of possibilities of


input to achieve the definite output.
Implementation

• It can be implemented in systems with various


sizes and capabilities ranging from small micro-
controllers to large, networked, workstation-
based control systems.
• It can be implemented in hardware, software, or
a combination of both.
Why Fuzzy Logic?

• Fuzzy logic is useful for commercial and


practical purposes.
– It can control machines and consumer
products.
– It may not give accurate reasoning, but
acceptable reasoning.
– Fuzzy logic helps to deal with the uncertainty
in engineering.
Fuzzy Logic Systems Architecture

• It has four main parts as shown −


• Fuzzification Module − It transforms the system inputs,
which are crisp numbers, into fuzzy sets. It splits the
input signal into five steps such as −
Fuzzy Logic Systems Architecture

• Knowledge Base − It stores IF-THEN rules provided by


experts.
• Inference Engine − It simulates the human reasoning
process by making fuzzy inference on the inputs and IF-
THEN rules.
• Defuzzification Module − It transforms the fuzzy set
obtained by the inference engine into a crisp value.
Fuzzy Logic Systems Architecture
Membership Function

• Membership functions allow you to quantify linguistic term


and represent a fuzzy set graphically. A membership
function for a fuzzy set A on the universe of discourse X is
defined as
μA:X → [0,1].
• Here, each element of X is mapped to a value between 0
and 1. It is called membership value or degree of
membership. It quantifies the degree of membership of the
element in X to the fuzzy set A.
– x axis represents the universe of discourse.
– y axis represents the degrees of membership in the [0, 1]
interval.
Membership Function

• There can be multiple membership functions


applicable to fuzzify a numerical value.
• Simple membership functions are used as use of
complex functions does not add more precision
in the output.
• All membership functions for LP, MP, S, MN, and
LN are shown as below −
Membership Function

• The triangular membership function shapes are most


common among various other membership function
shapes such as trapezoidal, singleton, and Gaussian.
• Here, the input to 5-level fuzzifier varies from -10 volts
to +10 volts. Hence the corresponding output also
changes.
Example:
What is Set?

• A set is an unordered collection of different elements. It


can be written explicitly by listing its elements using the
set bracket.
• If the order of the elements is changed or any element
of a set is repeated, it does not make any changes in the
set.
• Example
– A set of all positive integers.
– A set of all the planets in the solar system.
– A set of all the states in India.
– A set of all the lowercase letters of the alphabet.
What is Set?

• Sets can be represented in two ways −


• Roster or Tabular Form
– In this form, a set is represented by listing all the
elements comprising it. The elements are enclosed
within braces and separated by commas.
– Following are the examples of set in Roster or
Tabular Form −
• Set of vowels in English alphabet, A = {a,e,i,o,u}
• Set of odd numbers less than 10, B = {1,3,5,7,9}
Fuzzy Set

• Fuzzy sets can be considered as an extension and gross


oversimplification of classical sets. It can be best
understood in the context of set membership.
• Basically it allows partial membership which means that it
contain elements that have varying degrees of
membership in the set.
• From this, we can understand the difference between
classical set and fuzzy set.
• Classical set contains elements that satisfy precise
properties of membership while fuzzy set contains
elements that satisfy imprecise properties of membership.
Fuzzy Set
Fuzzy Sets

• A fuzzy set A˜ in the universe of information U


can be defined as a set of ordered pairs and it
can be represented mathematically as −

A˜={(y,μA˜(y))|y∈U}

• Here μA˜(y) = degree of membership of y in A˜,


assumes values in the range from 0 to 1, i.e.,
μA˜(y)∈[0,1].
Representation Fuzzy Sets

• Let us now consider two cases of universe of


information and understand how a fuzzy set can
be represented.
• Case 1
– When universe of information U is discrete
and finite −
Representation Fuzzy Sets

• Case 2
– When universe of information U is continuous
and infinite −

• In the above representation, the summation


symbol represents the collection of each
element.
Operations on Fuzzy Sets

• Having two fuzzy sets A˜ and B˜, the universe of


information U and an element 𝑦 of the universe, the
following relations express the union, intersection
and complement operation on fuzzy sets.
• Union/Fuzzy ‘OR’
– Let us consider the following representation to
understand how the Union/Fuzzy ‘OR’ relation
works −
Operations on Fuzzy Sets
Operations on Fuzzy Sets

• Let us consider the following representation to


understand how the Intersection/Fuzzy ‘AND’
relation works −

• Here ∧ represents the ‘min’ operation.


Operations on Fuzzy Sets
Intersection/Fuzzy ‘AND’

• Let us consider the following representation to


understand how the Intersection/Fuzzy ‘AND’
relation works −

• Here ∧ represents the ‘min’ operation.


Intersection/Fuzzy ‘AND’
Complement/Fuzzy ‘NOT’

• Let us consider the following representation to


understand how the Complement/Fuzzy ‘NOT’
relation works −
Properties of Fuzzy Sets

• Let us discuss the different properties of fuzzy


sets.
• Commutative Property
– Having two fuzzy sets A˜ and B˜, this property
states −
Properties of Fuzzy Sets

• Distributive Property
– Having three fuzzy sets A˜, B˜ and C˜, this
property states −
Properties of Fuzzy Sets

• Idempotency Property
– For any fuzzy set A˜ , this property states −
Properties of Fuzzy Sets

• Identity Property
– For fuzzy set A˜ and universal set U, this
property states −
Properties of Fuzzy Sets

• Transitive Property
– Having three fuzzy sets A˜ , B˜ and C˜, this
property states −
Properties of Fuzzy Sets

• Involution Property
– For any fuzzy set A˜ , this property states −
Properties of Fuzzy Sets

• De Morgan’s Law
– This law plays a crucial role in proving
tautologies and contradiction.
– This law states −
Difference:
Difference:
Difference:
Difference:
Membership Function

• We already know that fuzzy logic is not logic that is


fuzzy but logic that is used to describe fuzziness.
• This fuzziness is best characterized by its
membership function.
• In other words, we can say that membership
function represents the degree of truth in fuzzy
logic.
Membership Function

• Following are a few important points relating to the


membership function −
– Membership functions were first introduced in 1965 by
Lofti A. Zadeh in his first research paper “fuzzy sets”.
– Membership functions characterize fuzziness (i.e., all the
information in fuzzy set), whether the elements in fuzzy
sets are discrete or continuous.
– Membership functions can be defined as a technique to
solve practical problems by experience rather than
knowledge.
– Membership functions are represented by graphical forms.
– Rules for defining fuzziness are fuzzy too.
Mathematical Notation

• We have already studied that a fuzzy set à in the universe


of information U can be defined as a set of ordered pairs
and it can be represented mathematically as −

• Here μA˜(∙) = membership function of A˜; this assumes


values in the range from 0 to 1, i.e., μA˜(∙) ∈[0,1]. The
membership function μA˜(∙) maps U to the membership
space M.
• The dot (∙) in the membership function described above,
represents the element in a fuzzy set; whether it is discrete
or continuous.
Features of Membership Functions

• Core
– For any fuzzy set A˜, the core of a
membership function is that region of
universe that is characterize by full
membership in the set.
– Hence, core consists of all those elements y
of the universe of information such that,
Features of Membership Functions

• Support
– For any fuzzy set A˜, the support of a
membership function is the region of
universe that is characterize by a nonzero
membership in the set.
– Hence core consists of all those elements y of
the universe of information such that,
Features of Membership Functions

• Boundary
– For any fuzzy set A˜ , the boundary of a
membership function is the region of
universe that is characterized by a nonzero
but incomplete membership in the set.
– Hence, core consists of all those elements y
of the universe of information such that,
Features of Membership Functions
Fuzzification

• It may be defined as the process of


transforming a crisp set to a fuzzy set or a fuzzy
set to fuzzier set.
• Basically, this operation translates accurate
crisp input values into linguistic variables.
Support Fuzzification(s-fuzzification) Method

• In this method, the fuzzified set can be expressed


with the help of the following relation −

• Here the fuzzy set Q(xi) is called as kernel of


fuzzification.
• This method is implemented by keeping μi
constant and xi being transformed to a fuzzy set
Q(xi).
Grade Fuzzification (g-fuzzification)

• It is quite similar to the above method but the


main difference is that it kept xi constant and μi
is expressed as a fuzzy set.
Defuzzification

• It may be defined as the process of reducing a fuzzy


set into a crisp set or to convert a fuzzy member into
a crisp member.
• We have already studied that the fuzzification
process involves conversion from crisp quantities to
fuzzy quantities.
• In a number of engineering applications, it is
necessary to defuzzify the result or rather “fuzzy
result” so that it must be converted to crisp result.
• Mathematically, the process of Defuzzification is also
called “rounding it off”.
Max-Membership Method

• This method is limited to peak output functions


and also known as height method.
Mathematically it can be represented as follows

• Here, x∗ is the defuzzified output.


Centroid Method

• This method is also known as the center of area


or the center of gravity method.
• Mathematically, the defuzzified output x∗ will
be represented as −
Weighted Average Method

• In this method, each membership function is


weighted by its maximum membership value.
• Mathematically, the defuzzified output x∗ will
be represented as −
Mean-Max Membership

• This method is also known as the middle of the


maxima. Mathematically, the defuzzified output
x∗ will be represented as −
Fuzzy Relation

• Fuzzy relation defines the mapping of variables


from one fuzzy set to another.
• Like crisp relation, we can also define the
relation over fuzzy sets.
• Let A be a fuzzy set on universe X and B be a
fuzzy set on universe Y, then the Cartesian
product between fuzzy sets A and B will result
in a fuzzy relation R which is contained with the
full Cartesian product space or it is subset of
cartesian product of fuzzy subsets.
Fuzzy Relation

• Formally, we can define fuzzy relation as,

• R=AxB
and
• R ⊂ (X x Y)

where the relation R has membership function,


• μR(x, y) = μA x B(x, y) = min( μA(x), μB(y) )
Fuzzy Relation

• A binary fuzzy relation R(X, Y) is called bipartite


graph if X ≠ Y.
• A binary fuzzy relation R(X, Y) is called directed
graph or digraph if X = Y. , which is denoted as
R(X, X) = R(X2)
Fuzzy Relation

• Let A = {a1, a2, …, an} and B = {b1, b2, .., bm}, then
fuzzy relation between A and B is described by the
fuzzy relation matrix as,

• We can also consider fuzzy relation as a mapping from


the cartesian space (X, Y) to the interval [0, 1]. The
strength of this mapping is represented by the
membership function of the relation for every tuple
μR(x, y)
Fuzzy Relation

• Given A = { (a1, 0.2), (a2, 0.7), (a3, 0.4) } and B =


{ (b1, 0.5), (b2, 0.6)}, find the relation over A x B
• Cartesian Product
Fuzzy Relation

• Fuzzy relations are very important because they


can describe interactions between variables.
• Example: A simple example of a binary fuzzy
relation on X = {1, 2, 3}, called ”approximately
equal” can be defined as
R(1, 1) = R(2, 2) = R(3, 3) = 1
R(1, 2) = R(2, 1) = R(2, 3) = R(3, 2) = 0.8
R(1, 3) = R(3, 1) = 0.3
Fuzzy Relation

• The membership function and relation matrix of


R is given by,
Fuzzy Relation Operations
Fuzzy Rule Based Systems

• Let us consider an air conditioning system with


5-level fuzzy logic system.
• This system adjusts the temperature of air
conditioner by comparing the room
temperature and the target temperature value.
Fuzzy Rule Based Systems
Fuzzy Rule Based Systems

• Define linguistic Variables and terms (start)


• Construct membership functions for them. (start)
• Construct knowledge base of rules (start)
• Convert crisp data into fuzzy data sets using
membership functions. (fuzzification)
• Evaluate rules in the rule base. (Inference Engine)
• Combine results from each rule. (Inference Engine)
• Convert output data into non-fuzzy values.
(defuzzification)
Development

• Step 1 − Define linguistic variables and terms


– Linguistic variables are input and output
variables in the form of simple words or
sentences. For room temperature, cold, warm,
hot, etc., are linguistic terms.
– Temperature (t) = {very-cold, cold, warm, very-
warm, hot}
– Every member of this set is a linguistic term
and it can cover some portion of overall
temperature values.
Development

• Step 2 − Construct membership functions for


them
• The membership functions of temperature
variable are as shown −
Development

• Step3 − Construct knowledge base rules


– Create a matrix of room temperature values
versus target temperature values that an air
conditioning system is expected to provide.
Development

• Build a set of rules into the knowledge base in


the form of IF-THEN-ELSE structures.
Development

• Step 4 − Obtain fuzzy value


– Fuzzy set operations perform evaluation of
rules. The operations used for OR and AND
are Max and Min respectively.
– Combine all results of evaluation to form a
final result. This result is a fuzzy value.
Development

• Step 5 − Perform defuzzification


– Defuzzification is then performed according
to membership function for output variable.
First Order Logic

• Consider the following sentence, which we cannot


represent using PL logic.
– "Some humans are intelligent", or
– "Sachin likes cricket."
• To represent the above statements, PL logic is not
sufficient, so we required some more powerful
logic, such as first-order logic.
First Order Logic

• First-order logic is another way of knowledge


representation in artificial intelligence. It is an
extension to propositional logic.
• FOL is sufficiently expressive to represent the natural
language statements in a concise way.
• First-order logic is also known as Predicate logic or
First-order predicate logic.
• First-order logic is a powerful language that develops
information about the objects in a more easy way and
can also express the relationship between those
objects.
First Order Logic

• First-order logic (like natural language) does not only assume


that the world contains facts like propositional logic but also
assumes the following things in the world:
– Objects: A, B, people, numbers, colors, wars, theories,
squares, pits, wumpus, ......
– Relations: It can be unary relation such as: red, round, is
adjacent, or n-any relation such as: the sister of, brother of,
has color, comes between
– Function: Father of, best friend, third inning of, end of, ......
• As a natural language, first-order logic also has two main parts:
– Syntax
– Semantics
First Order Logic

• Following are the basic elements of FOL syntax:


– Constant 1, 2, A, John, Mumbai, cat,....
– Variables x, y, z, a, b,....
– Predicates Brother, Father, >,....
– Function sqrt, LeftLegOf, ....
– Connectives ∧, ∨, ¬, ⇒, ⇔
– Equality ==
– Quantifier ∀, ∃
First Order Logic

• Atomic sentences:
– Atomic sentences are the most basic sentences
of first-order logic. These sentences are formed
from a predicate symbol followed by a
parenthesis with a sequence of terms.
– We can represent atomic sentences as
Predicate (term1, term2, ......, term n).
– Example: Ravi and Ajay are brothers: =>
Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
First Order Logic

• Complex Sentences:
– Complex sentences are made by combining atomic
sentences using connectives.
• First-order logic statements can be divided into two
parts:
– Subject: Subject is the main part of the statement.
– Predicate: A predicate can be defined as a relation,
which binds two atoms together in a statement.
First Order Logic

• Consider the statement: "x is an integer.", it


consists of two parts, the first part x is the
subject of the statement and second part "is an
integer," is known as a predicate.
Predicate Logic

• Predicate Logic deals with predicates, which are


propositions, consist of variables.
• A predicate is an expression of one or more
variables determined on some specific domain.
• A predicate with variables can be made a
proposition by either authorizing a value to the
variable or by quantifying the variable.
Predicate Logic

• Examples:
– Consider E(x, y) denote "x = y"
– Consider X(a, b, c) denote "a + b + c = 0"
– Consider M(x, y) denote "x is married to y."
Predicate Logic

• The variable of predicates is quantified by


quantifiers.
• There are two types of quantifier in predicate
logic - Existential Quantifier and Universal
Quantifier.
Existential Quantifier

• If p(x) is a proposition over the universe U. Then


it is denoted as ∃x p(x) and read as "There exists
at least one value in the universe of variable x
such that p(x) is true.
• The quantifier ∃ is called the existential
quantifier.
• There are several ways to write a proposition,
with an existential quantifier, i.e.,
(∃x∈A)p(x) or ∃x∈A such that p (x) or
(∃x)p(x) or p(x) is true for some x ∈A.
Universal Quantifier

• If p(x) is a proposition over the universe U. Then


it is denoted as ∀x,p(x) and read as "For every
x∈U,p(x) is true."
• The quantifier ∀ is called the Universal
Quantifier.
• There are several ways to write a proposition,
with a universal quantifier.
• ∀x∈A,p(x) or p(x), ∀x ∈A Or ∀x,p(x) or
p(x) is true for all x ∈A.
Negation of Quantified Propositions

• When we negate a quantified proposition, i.e.,


when a universally quantified proposition is
negated, we obtain an existentially quantified
proposition,and when an existentially
quantified proposition is negated, we obtain a
universally quantified proposition.
Fuzzy Decision Making

• It is an activity which includes the steps to be taken for


choosing a suitable alternative from those that are needed
for realizing a certain goal.
• Steps involved in the decision making process −
– Determining the Set of Alternatives − In this step, the
alternatives from which the decision has to be taken
must be determined.
– Evaluating Alternative − Here, the alternatives must be
evaluated so that the decision can be taken about one of
the alternatives.
– Comparison between Alternatives − In this step, a
comparison between the evaluated alternatives is done.
Individual Decision Making

• In this type of decision making, only a single


person is responsible for taking decisions. The
decision making model in this kind can be
characterized as −
– Set of possible actions
– Set of goals Gi(i∈Xn);
– Set of Constraints Cj(j∈Xm)
Individual Decision Making

• The goals and constraints stated above are


expressed in terms of fuzzy sets.
• Now consider a set A. Then, the goal and
constraints for this set are given by −

• The fuzzy decision in the above case is given by



Multi-Person Decision Making

• Decision making in this case includes several


persons so that the expert knowledge from
various persons is utilized to make decisions.
• Calculation for this can be given as follows −
• Number of persons preferring xi to xj = N(xi,xj)
• Total number of decision makers = n
• Then,
Multi-objective Decision Making

• Multi-objective decision making occurs when


there are several objectives to be realized.
There are following two issues in this type of
decision making −
– To acquire proper information related to the
satisfaction of the objectives by various
alternatives.
– To weigh the relative importance of each
objective.
Multi-objective Decision Making

• Mathematically we can define a universe of n


alternatives as −

A=[a1,a2,...,ai,...,an]

• And the set of “m” objectives a


O=[o1,o2,...,oi,...,on]
Multi-attribute Decision Making

• Multi-attribute decision making takes place


when the evaluation of alternatives can be
carried out based on several attributes of the
object.
• The attributes can be numerical data, linguistic
data and qualitative data.
• Mathematically, the multi-attribute evaluation is
carried out on the basis of linear equation as
follows −
Y=A1X1+A2X2+...+AiXi+...+ArXr
Fuzzy Control System

• Fuzzy logic is applied with great success in


various control application. Almost all the
consumer products have fuzzy control.
• Some of the examples include controlling your
room temperature with the help of air-
conditioner, anti-braking system used in
vehicles, control on traffic lights, washing
machines, large economic systems, etc.
Fuzzy Control System – Why?

• A control system is an arrangement of physical components


designed to alter another physical system so that this system
exhibits certain desired characteristics. Following are some
reasons of using Fuzzy Logic in Control Systems −
– While applying traditional control, one needs to know
about the model and the objective function formulated in
precise terms. This makes it very difficult to apply in many
cases.
– By applying fuzzy logic for control we can utilize the
human expertise and experience for designing a controller.
– The fuzzy control rules, basically the IF-THEN rules, can be
best utilized in designing a controller.
Fuzzy Control System – Architecture
Major Components

• Fuzzifier − The role of fuzzifier is to convert the crisp input


values into fuzzy values.
• Fuzzy Knowledge Base − It stores the knowledge about all the
input-output fuzzy relationships. It also has the membership
function which defines the input variables to the fuzzy rule base
and the output variables to the plant under control.
• Fuzzy Rule Base − It stores the knowledge about the operation
of the process of domain.
• Inference Engine − It acts as a kernel of any FLC. Basically it
simulates human decisions by performing approximate
reasoning.
• Defuzzifier − The role of defuzzifier is to convert the fuzzy
values into crisp values getting from fuzzy inference engine.
Design Steps

• Identification of variables − Here, the input, output


and state variables must be identified of the plant
which is under consideration.
• Fuzzy subset configuration − The universe of
information is divided into number of fuzzy subsets
and each subset is assigned a linguistic label. Always
make sure that these fuzzy subsets include all the
elements of universe.
• Obtaining membership function − Now obtain the
membership function for each fuzzy subset that we
get in the above step.
Design Steps

• Fuzzy rule base configuration − Now formulate


the fuzzy rule base by assigning relationship
between fuzzy input and output.
• Fuzzification − The fuzzification process is
initiated in this step.
• Combining fuzzy outputs − By applying fuzzy
approximate reasoning, locate the fuzzy output
and merge them.
• Defuzzification − Finally, initiate defuzzification
process to form a crisp output.
Advantages of FLC

• Cheaper − Developing a FLC is comparatively cheaper than


developing model based or other controller in terms of
performance.
• Robust − FLCs are more robust than PID controllers because of
their capability to cover a huge range of operating conditions.
• Customizable − FLCs are customizable.
• Emulate human deductive thinking − Basically FLC is designed to
emulate human deductive thinking, the process people use to
infer conclusion from what they know.
• Reliability − FLC is more reliable than conventional control
system.
• Efficiency − Fuzzy logic provides more efficiency when applied in
control system.
Fuzzy Classification

• A classifier is an algorithm that assigns a class label to an


object, based on the object description. It is also said that
the classifier predicts the class label.
• The object description comes in the form of a vector
containing values of the features (attributes) deemed to be
relevant for the classification task.
• Typically, the classifier learns to predict class labels using a
training algorithm and a training data set.
• When a training data set is not available, a classifier can be
designed from prior knowledge and expertise.
• Once trained, the classifier is ready for operation on unseen
objects.
Fuzzy Classification
Fuzzy rule-based classifiers

• Class label as the consequent


– The simplest fuzzy rule-based classifier is a fuzzy
if-then system, similar to that used in fuzzy
control. Consider a 2D example with 3 classes. A
fuzzy classifier can be constructed by specifying
classification rules, e.g.,
– IF x1 is medium AND x2 is small THEN class is 1
• IF x1 is medium AND x2 is large THEN class is 2
• IF x1 is large AND x2 is small THEN class is 2
• IF x1 is small AND x2 is large THEN class is 3
Fuzzy Decision Making

• It is an activity which includes the steps to be taken for choosing a suitable


alternative from those that are needed for realizing a certain goal.
• Steps for Decision Making

• Steps involved in the decision making process −

• Determining the Set of Alternatives − In this step, the alternatives from
which the decision has to be taken must be determined.

• Evaluating Alternative − Here, the alternatives must be evaluated so that
the decision can be taken about one of the alternatives.

• Comparison between Alternatives − In this step, a comparison between
the evaluated alternatives is done.


References:

• https://wisdomplexus.com
Thank you
This presentation is created using LibreOffice Impress 7.0.1.2, can be used freely as per GNU General Public License

/mITuSkillologies @mitu_group /company/mitu- MITUSkillologies


skillologies

Web Resources
https://mitu.co.in
http://tusharkute.com

[email protected]
[email protected]

You might also like