FUZZY LOGIC
UIET (Computer Science Deptt)
INRODUCTION
One of the most successful of today's technologies for developing sophisticated control systems.
Resembles human decision making with an ability to generate precise solutions from certain or approximate information.
INTRODUCTION
Fuzzy logic (FL) is focused on modes of reasoning which are approximate rather than exact.
A super set of Boolean logic. Graded truth - Truth values between True and False. Not everything is either/or, true/false, black/white, on/off etc.
Grades of membership - Class of tall men, class of far cities, class of expensive things, etc.
Fuzzy: everything is a matter of degree
BACKGROUND
Aristotle and his precedent philosophers brought about the "Law of the Excluded Middle" which stated that every proposition must either be TRUE/FALSE.
Lotfi Zadeh, UC/Berkely 1965. Introduced FL to model uncertainty in natural language. Tall, far, nice, large, hot,
Real World & Fuzzy Logic
Real world - Imprecision, uncertainty and partiality , especially partiality of truth, certainty and possibility
Real world - Everything is a matter of degree.
Role model for fuzzy logic - Human mind and its remarkable capability to operate on perceptionbased information without any measurements and any computations
Why use fuzzy logic?
PROS: Conceptually easy to understand - natural maths Tolerant of imprecise data Intuitive Based on linguistic terms
CONS: Not a cure-all Crisp/precise models can be more efficient and even convenient
WHAT IS FUZZY LOGIC?
Fuzzy logic (FL) is aimed at a formalization of modes of reasoning which are approximate rather than exact
Examples: Exact-
All men are mortal Socrates is a man Socrates is mortal Most Swedes are tall Magnus is a Swede It is likely that Magnus is tall
Approximate-
FUZZY SET
Boolean/Crisp set A is a mapping for the elements of S to the set {0, 1}, i.e., A: S -> {0, 1} Characteristic function: {A(x)=1 A(x) = 0 if x is an element of set A if x is not an element of set A }
__________________________________________________________ Fuzzy set F is a mapping for the elements of S to the interval [0, 1], i.e., F: S -> [0, 1]
Characteristic function: 0 F(x) 1 1 means full membership, 0 means no membership and anything in between, e.g., 0.5 is called graded membership
Example: Crisp set Tall
Fuzzy sets and concepts are commonly used in natural language
John is tall Dan is smart Alex is happy The class is hot E.g., the crisp set Tall can be defined as {x | height x > 1.8 meters}
But what about a person with a height = 1.79 meters? What about 1.78 meters? What about 1.52 meters?
Example: Fuzzy set Tall
In a fuzzy set a person with a height of 1.8 meters would be considered tall to a high degree A person with a height of 1.7 meters would be considered tall to a lesser degree etc.
BIVALENT SETS
FUZZY SET
Observation
VARIABLES AND LINGUISTIC VARIABLES
Variable -numerical (X=5; X=(3, 2); ) -linguistic (X is small; (X, Y) is much larger) Concept of a linguistic variable plays a central role in fuzzy logic and underlies most of its applications
Membership Function
Ex: A subset young to answer the question "to what degree is person x young? young(x) = { 1, if age(x) <= 20,
(30-age(x))/10, if 20 < age(x) <= 30,
0,
if age(x) > 30 }
PERSON
AGE
DEGREE OF YOUTH
Ram
Priya Preeti
10
21 25
1.00
0.90 0.50
Shweta
83
0.00
Degree of truth of the statement "Priya is YOUNG" is 0.90.
Types Of Membership Functions
Illustration of Triangular Membership Function
..Types Of Membership Functions
Illustration of Trapezoidal Membership Function
..Types Of Membership Functions
Illustration of Bell shaped or S- Membership Function
FUZZY SET OPERATIONS
Union:
Intersection:
Complement:
Rules which are common in set theory also apply to Fuzzy set theory :
De Morgans Law
Associativity Commutativity Distributivity
FUZZY RULES
Fuzzy rules operate using a series of if-then statements.
IF (a set of conditions are satisfied) THEN (a set of consequents can be inferred). IF (x1 is A1, x2 is A2 xn is An) THEN (y1 is B1, y2 is B2 yn is Bn)
Where linguistic variable Xi, Yj take the value of fuzzy sets Ai, Bj.
Evaluation of fuzzy rules
In Boolean logic: p q if p is true then q is true In fuzzy logic: p q if p is true to some degree then q is true to some degree. 0.5p => 0.5q (partial premise implies partially)
FUZZY CONTROL
Three steps are taken to create a fuzzy controlled machine:
1) Fuzzification (Using membership functions to graphically describe a situation) 2) Rule evaluation (Application of fuzzy rules)
3) Defuzzification (Obtaining the crisp or actual results)
Fuzzy Rules
Example: If our distance to the car in front is small, and the distance is decreasing slowly, then decelerate quite hard Fuzzy variables in blue Fuzzy sets in red
QUESTION: Given the distance and the change in the distance, what acceleration should we select?
FUZZIFICATION
Fuzzification: Instance
Fuzzification : Instance
IF distance is Small THEN Slow Down
DEFUZZICATION
We return as our acceleration the value of x coordinate of the center of mass of the merged area.
ADAPTIVE FUZZY SYSTEM
Performance of the fuzzy machines is restricted by the capabilities of the human brain. Therefore, how do we make the machines think for themselves and come up with rules of its own?
The machine should be able to produce its own rules through experience with the help of fuzzy rules ,similar as human. This can be done with the Data In Rules Out (DIRO) method.
Data In Rule Out:
Neural networks, which acts like the eyes and ears of an adaptive fuzzy system whose rules change with experience. The adaptive fuzzy system tunes its rules as it samples new data. At first the rules change fast .
Case Study: Fuzzy Traffic Light Controller
A Smart Traffic Light Controller
Smart controller - changes the cycle time depending upon the densities of cars behind green and red lights and the current cycle time. Conventional traffic light controller changes lights at constant cycle time.
Difficult Mathematical model. With fuzzy logic, it is relatively much easier.
FUZZY DESIGN
8 Incremental sensors are put in specific positions
Number of cars between the traffic lights = difference of reading of two sensors The distance between two sensors is fixed say 200 feet. Density of cars = number of cars/distance
Density of Cars between East & West street = (s1-s2)+(s5-s6)/400
FUZZY DESCISION PROCESS
Assumption: Red light is shown to both North & South streets and distance is constant. Step -1 (FUZZIFICATION) Inputs:
Cycle Time Cars behind red light Cars behind green light
Output: Probability of change of current cycle time
The input and output are divided into overlapping member functions Each function corresponds to different levels. For inputs (cycle time & cars behind red light) the levels and their ranges are: zero(0,1), low(0,7), medium(4,11), high(7,18), chaos(14,20). For input (cars behind green light) the levels are: v_short(0,14), short(0,34), medium(14,60), long(33,88), very long(65,100), limit(85,100).
For output the levels are: no(0), probably_no(0.25), maybe(0.5), probably_yes(0.75) and yes(1.0).
This one value (singleton position) is associated to each level instead of a range of values.
STEP- 2 (Rule Evaluation)
Rules are formulated using a series of if-then statements, combined with AND/OR operators.
Eg: If cycle time is medium AND Cars Behind Red is low AND Cars Behind Green is medium, then change is Probably Not. With three inputs, each having 5,5,and 6 membership functions, there are a combination of 150 rules.
Step 3 (Defuzzification)
Converts the fuzzy set output to crisp value. Method used : Centre Of Gravity
Crisp Output = {Sum (Membership Degree*Singleton Position} / Sum(Membership Degree)
Example Of Output
If the output membership degree, after rule evaluation are: Change Probability Yes=0, Change Probability Probably Yes=0.6, Change Probability Maybe=0.9, Change Probability Probably No= 0.3, Change Probability No=0.1
Crisp Output=(0.1*0.00) +(0.3*0.25) +(0.9*0.50) +(0.6*0.75) +(0*1.00)/ (0.1+0.3+0.9+0.6+0 )=0.51
Is Fuzzy Controller Better?
Testing: 7 different kinds of traffic conditions from very heavy traffic to very lean traffic.
35 random chosen car densities were grouped according to different periods of the day representing those traffic conditions.
Performance Evaluation
Comparison with a conventional controller and a human expert.
Criteria for comparison - number of cars allowed to pass at one time and average waiting time. A performance index which maximizes the traffic flow and reduces the average waiting time was developed. A means of calculating the average waiting time was also developed.
Performance Index for 7 different traffic categories
Fuzzy controller proved more efficient than a human or conventional controller
//Program for selecting - optimum cycle time and offset corresponding to min delay& max flow//
Using MATLAB 7.0.1
HIERARCHY OF DEFINITION LANGUAGES
PNL F.G language fuzzy-logic-based
F language
B language NL
NL: natural language B language: standard mathematical bivalent-logic-based language F language: fuzzy logic language without granulation F.G language: fuzzy logic language with granulation
bivalent-logic-based
PNL: Precisiated Natural Language
Note: the language of fuzzy if-then rules is a sublanguage of PNL Note: a language in the hierarchy subsumes all lower languages
SIMPLIFIED HIERARCHY
PNL B language NL
The expressive power of the B language the standard bivalence-logic-based definition language is insufficient fuzzy-logic-based bivalent-logic-based
Insufficiency of the expressive power of the B language is rooted in the fundamental conflict between bivalence and reality
LAZ 8-8-02
FUTURE APPLICATIONS
Smart washing machines, TVs Air Conditioner Controller Controlled steam engine Controlled cement kilns Controlled Nuclear Fusion Fuzzy Data Analysis in a Medical
How Far Can Fuzzy Logic Go?
Vast expert decision makers , theoretically able to distill the wisdom of every document ever written.
Sex robots with a humanlike repertoire of behavior. Computers that understand and respond to normal human language. Machines that write interesting novels and screenplays in a selected style , such as Hemingway's. Molecule-sized soldiers of health that will roam the blood-stream, killing cancer cells and slowing the aging process
With enormous research being going on there is no limit to where FUZZY LOGIC can go.. The future is bright.
The future is FUZZY!
THANKS.