The Fuzzy Logic is discussed with three simple example problems all solved in MATLAB
1. Restaurant Problem
2. Temperature Controller
3. Washing Machine Problem
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Fuzzy logic
1. MINI PROJECT
ON
ADVANCED OPERATIONS RESEARCH
PSG COLLEGE OF TECHNOLOGY
COIMBATORE-641004
Presented by
S. Sanjay (18MF32)
Fuzzy Logic
1ADVANCED OPERATIONS RESEARCH
2. Contents
• Crisp Set
• Fuzzy History/ Introduction
• Fuzzy Set
• Shape of MF
• Linguistic variable
• IF Then rule
• Fuzzy Inference System
• Methodology in MATLAB
• Restaurant Problem 1*
• Temperature Problem 2*
• Washing Machine Problem 3*
• Backend calculation
• References
*Solved in MATLAB
2ADVANCED OPERATIONS RESEARCH
3. Crisp Set
• In crisp sets – either an element belongs to the set or it does not.
• Crisp logic is concerned with absolutes-true or false, there is no in-
between.
• Example
Tall = 1, Short = 0; No in-between values.
3ADVANCED OPERATIONS RESEARCH
4. Example for crispy set
Rule: If the temperature is higher than 80F, it is hot; otherwise, it is not
hot.
Cases:
• Temperature = 100F Hot
• Temperature = 80.1F Hot
• Temperature = 79.9F Not Hot
• Temperature = 50F Not Hot
4ADVANCED OPERATIONS RESEARCH
6. What we do in this case? [2]
6ADVANCED OPERATIONS RESEARCH
7. Fuzzy History
• “Fuzzy” as: not clear, distinct or precise i.e. blurred.
• Fuzzy logic was initiated in 1965 by Lotfi A. Zadeh , professor for
computer science at the university of California in Berkeley
• Mathematical tool for dealing with uncertainty .
• Fuzzy logic is a way to make use of natural language in logic.
7ADVANCED OPERATIONS RESEARCH
8. Fuzzy Logic Introduction [2]
• Fuzzy logic is a form of many-valued logic;
• It deals with reasoning that is approximate rather than fixed and
exact .
• Compared to traditional binary sets (where variables may take on
true or false values)
• Truth value that ranges in degree between 0 and 1
• Fuzzy logic refers fuzzy sets which are sets with blurred boundaries.
8ADVANCED OPERATIONS RESEARCH
9. Applications
• The applications of fuzzy logic
Expert systems,
Fuzzy controllers,
Pattern recognition,
Databases and information retrieval
Decision making
9ADVANCED OPERATIONS RESEARCH
10. Terminology in fuzzy logic [2]
Terminology used in fuzzy logic not used in
other methods are:
Very high,
Increasing,
Somewhat decreased,
Reasonable and
Very low.
10ADVANCED OPERATIONS RESEARCH
11. Fuzzy Sets [1]
• Fuzzy sets allow elements to be partially in a set.
• A fuzzy set has a graphical description that express how the transition
from one to another takes place
• This graphical description is called a membership function
• This MF can range from 0 (not an element of the set ) to 1 (a member
of set).
• Each element is given a degree of membership in a set.
• A membership function is the relationship between the values of an
element and its degree of membership in a set.
11ADVANCED OPERATIONS RESEARCH
12. Shapes of MF
• The Shape of the membership function (MF) used defines the fuzzy
set and so the decision on which type to use is dependent on the
purpose.
• There are many different types of membership functions used in
fuzzy logic.
Triangle,
Gaussian and
Trapezoid membership functions
12ADVANCED OPERATIONS RESEARCH
13. Linguistic variables [1]
• A fuzzy set can be used to describe the value of variable.
• A linguistic variable is a fuzzy variable .
• “A variable whose values are words or sentence in natural or
artificial language”.
• Qualities spanning a particular spectrum.
• Each linguistic variable may be assigned one or more linguistic
values
• Eg: The statement Jeba is Tall - implies that Jeba is
• linguistic variable take the linguistic value Tall.
13ADVANCED OPERATIONS RESEARCH
14. IF –THEN RULE [1]
• Human beings make decisions based on computer rules like if-then
statements.
• If the weather is fine, then we may decide to go out. If the forecast
says the weather will be bad today, but fine tomorrow, then we make
a decision not to go today, and postpone it till tomorrow.
• Fuzzy machines works the same way. The decision and the means
of choosing that decisions are replaced by fuzzy sets and the rules
are replaced by fuzzy rules.
• Fuzzy rules also operate using a series of if-then statements.
14ADVANCED OPERATIONS RESEARCH
15. Fuzzy logical operations
• AND, OR, NOT, etc.
• NOT A = A’ = 1 - µa(x) = Complement
• A AND B = A ∩ B = min(µa(x), µb(x)) = Intersection
• A OR B = A ∪B = max(µa(x), µb(x)) = Union
A ∪B A ∩ B A’
15ADVANCED OPERATIONS RESEARCH
16. FUZZY INFERENCE SYSTEM
• Fuzzy logic system - nonlinear mapping of an input data set to a
scalar output data.
• Fuzzy inference is actual process of mapping from given input to an
output using fuzzy logic.
• Fuzzy inference is a computer paradigm based on fuzzy theory,
fuzzy if- then- rules and fuzzy reasoning.
• Fuzzy logic is implemented with three stages:
1. Fuzzifier
2. Inference(Rule Definition)
3. Defuzzifier
16ADVANCED OPERATIONS RESEARCH
17. Block Diagram of Fuzzy Inference System [6]
Fuzzifier DefuzzifierInference
Fuzzy
Knowledge
Base
Fuzzy Input
Set
Fuzzy Output
Set
Crisp
Output
Crisp
Input
17ADVANCED OPERATIONS RESEARCH
18. FUZZIFIER
• Converts the crisp input to a linguistic variable using the
membership functions stored in the fuzzy knowledge base. This
process is known as fuzzification .
18ADVANCED OPERATIONS RESEARCH
19. INFERENCE
• Using If-Then type fuzzy rules converts the fuzzy input to the fuzzy
output.
19ADVANCED OPERATIONS RESEARCH
20. DEFUZZIFIER
• Converts the fuzzy output of the inference engine to crisp using
membership functions same to the ones used by the Fuzzifier. This
process is known as Defuzzification.
20ADVANCED OPERATIONS RESEARCH
21. Steps used by fuzzy logic system
Step 1:
• Fuzzification of input variables
• Defining the control objectives and criteria
Step 2:
• Application of Fuzzy operators (AND, OR, NOT) in the IF (antecedent) part of the rule
• Determine the output and input relationships and choose a minimum number of variables
for input to the fuzzy logic engine
Step 3:
• THEN part of the rule
• Implication from antecedent for the desired system, output response for a given with system
input conditions.
Step 4:
• Creating Fuzzy logic membership functions
• Aggregation of the consequents by creating the fuzzy logic MF across the rules by that
define the meaning (values) of input/output terms used in the rule.
Step 5:
• Defuzzification
• To obtain a crisp result
21ADVANCED OPERATIONS RESEARCH
22. Methodology in MATLAB
ADVANCED OPERATIONS RESEARCH 22
Problem Definition
Enter Fuzzy in Command Window
Enter Input in Fuzzy Logic Designer
Enter the type of Membership Function
Generate Rules for the Problem in Rule Editor
View the output in Rule Viewer/ Surface Viewer
Result can be obtained
23. Restaurant Problem Statement [1]
• Apply the Fuzzy Logic Technique in a non technical environment
for a such as for a restaurant tipping where food and service are the
inputs fuzzy variable (0 -10 range) and tip is the output variable
(0-25% range).
Reference: International Journal Of Engineering And Computer Science ISSN:2319-7242
Volume 3 Issue 11 November, 2014 Page No. 9160-9165.
Title: A Comprehensive Review On Fuzzy Logic System
23ADVANCED OPERATIONS RESEARCH
24. Non Fuzzy versus Fuzzy Output
The tip always equals 15% of the
total bill. Tip=?
Service is rated (0 to 10) tip go
linearly from 5% = service is bad to
25% = service is excellent. Tip=?
24ADVANCED OPERATIONS RESEARCH
25. Declaring variables and Inputs
Restaurant tipping
Service Food
poor deliciousexcellentgood Rancid
Problem
Inputs
Variables
2852 8
25ADVANCED OPERATIONS RESEARCH
26. Rules in Inference System
Fuzzy Inference for
Restaurant Tipping
Rule 3:
IF the Service is excellent or food is
delicious THEN tip is generous
Rule 2:
IF the Service is good, THEN tip is
average
Rule 1:
IF the Service is poor, THEN tip is cheap
26ADVANCED OPERATIONS RESEARCH
28. Possible Outcomes [5]
Rule 3:
IF the Service is excellent or food is
delicious THEN tip is generous
Rule 2:
IF the Service is good, THEN tip is
average
Rule 1:
IF the Service is poor, THEN tip is
cheapInput1
Service
(0-10)
Input1
Food
(0-10)
∑
Output
Tip
(0-25%)
28ADVANCED OPERATIONS RESEARCH
29. Steps [4]
Step 1:
• Fuzzification of input variables
• Quality of service is 3 which implies MF poor gives the output μ=0.3
• Food = 10, MF bad, the result of fuzzification is μ=0
Step 2:
• Application of Fuzzy operators (AND, OR, NOT) in the IF (antecedent) part of the rule
• If rule has been satisfied, the OR or max operator is specified and therefore between the
two values 0.3 and 0, the result of the operator is 0.3 [Degree of fulfillment (DOF)]
Step 3:
• THEN part of the rule & Implication Stage
• Helps to evaluate the consequent part of a rule.
• Output MF cheap is truncated at the value μ=0.3 to give a fuzzy output (step 3)
Step 4:
• Creating Fuzzy logic membership functions
• Rules are evaluated the same manner and their outputs are combined or aggregated in a
cumulative manner
Step 5:
• Defuzzification
• The fuzzy output (area) is converted into crisp.
29ADVANCED OPERATIONS RESEARCH
31. Fuzzy Approach problem [7]
• Tipping Problem — Both Service and Food Factors
If service is poor OR the food is rancid, then tip is cheap
If service is good, then tip is average
If service is excellent OR food is delicious, then tip is
generous
*Reference
Fuzzy Systems and Control
Günay Karlı, Ph.D.
31ADVANCED OPERATIONS RESEARCH
41. Temperature Controller Problem Definition [3]
• The problem is to change the speed of a heater fan, based off
the room temperature. A temperature control system has five
settings
• Very Cold, Cold, Warm, Hot and Very Hot.
• Using this we can define the fuzzy set.
41ADVANCED OPERATIONS RESEARCH
51. Washing Machine Problem [8]
• The total number of inputs variables are shown:
Types of clothes - silk, cotton, woolen, jeans
Types of dirt - greasy ,non greasy ,mix
Types of detergent -solid ,liquid
Mass of clothes- 1to 2 lb, 3-5lb, 7 to 10lb
Water level -1to 10
Water temp- cold, warm, hot
Dirtiness of cloths- small, medium, large
ADVANCED OPERATIONS RESEARCH 51
52. Output
• Total Membership Rules = 4*3*2*3*3*3*3 =1944 Rules
• “A Sample has been worked for the problem”.
• This will give us washing time as a output.
Very short
Short
Medium
Large
Very large
ADVANCED OPERATIONS RESEARCH 52
53. Step 1: Fuzzy Logic Designer
ADVANCED OPERATIONS RESEARCH 53
54. Step 2(a): Input 1Membership Function
ADVANCED OPERATIONS RESEARCH 54
55. Step 2(b): Input 2 Membership Function
ADVANCED OPERATIONS RESEARCH 55
56. Step 2(c): Input 3 Membership Function
ADVANCED OPERATIONS RESEARCH 56
57. Step 2(d): Input 4 Membership Function
ADVANCED OPERATIONS RESEARCH 57
58. Step 2(e): Input 5 Membership Function
ADVANCED OPERATIONS RESEARCH 58
59. Step 2(f): Input 6 Membership Function
ADVANCED OPERATIONS RESEARCH 59
60. Step 2(g): Input 7 Membership Function
ADVANCED OPERATIONS RESEARCH 60
61. Step 3: Output Membership Function
ADVANCED OPERATIONS RESEARCH 61
62. Step 4: Rules Editor
ADVANCED OPERATIONS RESEARCH 62
75. References
[1] Patil Pallavi D.1,Prof Patel J. J2 “A Comprehensive Review On Fuzzy Logic
System” Published in International Journal Of Engineering And Computer Science
Volume 3 Issue 11 November, 2014 Page No. 9160-9165.
[2] Lotfi A. Zadeh, ” Is there a need for fuzzy logic?”Science Direct, 2008.
[3] Temperature Control using Fuzzy Logic P. Singhala1, D. N. Shah2, B. Patel3
1,2,3Department of instrumentation and control, Sarvajanik College of Engineering and
Technology Surat, Gujarat, INDIA.
[4] Chukwuemeka C. Nwobi-Okoye, Member, IAENG , Stanley Okiy, Francis I.
Obidike “Fuzzy Based Solution to the Travelling Salesman Problem: A Case
Study” from “Proceedings of the World Congress on Engineering and Computer
Science 2017 Vol II .”
75ADVANCED OPERATIONS RESEARCH
76. References
[5] Fuzzy versus Non-fuzzy Logic - MATLAB & Simulink –MathWorks (Help)
[6] www.cs.princeton.edu/courses/archive/fall07/cos436/.../fuzzy 002.html- (Website)
[7] Shah, Prakash (2013) A Fuzzy Based Service Quality and Performance Evaluation
Model: A Case Study in Hostel Mess, NIT Rourkela.
[8] Video Lecuture by Rohit Salgotra https://www.youtube.com/watch?v=flWZEMDcl_A
ADVANCED OPERATIONS RESEARCH 76