Handling Uncertainty using FUZZY LOGIC
Fuzzy Set Theory Conventional (Boolean) Set Theory: 38 C 40.1 C 41.4 C 38.7 C 39.3 C 37.2 C 42 C Strong Fever 38 C Fuzzy Set Theory: 38.7 C 40.1 C 41.4 C More-or-Less Rather Than Either-Or! 39.3 C 37.2 C 42 C Strong Fever INFORM 1990-1998 Slide 3
Fuzzy Variable: Old Membership 1 μ(25)= 0 (33)= 0.15 0 30 50 Age 75 90 μ(38)= 0.4 μ(44)= 0.7 μ(72)= 1.0
Crisp Logic vs Fuzzy Logic Crisp logic needs hard decisions Fuzzy Logic deals with membership in group functions
Probability and Possibility One cupboard A contains a number of bottles, some containing water, and others containing undesirable products. The label on one of the bottle reads, Probability of water being good is 0.93. Another cupboard B contains water from various sources, like mineral water, tap water, rain water, pond water, drain water etc. The label on one of the bottle reads, Possibility of water being good is 0.8. Which one would you prefer to open for drinking?
Fuzzy Logic deals with Possibility measures. Possibility indicates the extent of belief. First proposed by Lufti Zadeh. Lots of applications: Digital cameras Camcorders Washing machines Braking systems (trains) Process control Image processing
Control of automatic exposure in video cameras, humidity in a clean room, air conditioning systems, washing machine timing, microwave ovens, vacuum cleaners.
Continuous Fuzzy sets
Discrete Fuzzy set x = { 0/0, 0.2/1, 0.4/2, 1/ 3, 0.9/4, 0.3/5, 0.1/6 }
Membership function Crisp set representation Characteristic function Fuzzy set representation Membership function f ( ) : 0,1 A x X ( x) 1, if x A if x A ( x) 1 if x is totally in A A A fa ( x) 0 0 0 ( x) 1 A if x is not in A If x is partly in A
Fuzzy set theory basics Fuzzy set operators: Equality A = B A (x) = B (x) for all x X Complement A A (x) = 1 - A (x) X Containment A B A (x) B (x) for all x for all x X
Fuzzy set theory basics Fuzzy set operators: Union A B A B (x) = max( A (x), B (x)) X Intersection A B A B (x) = min( A (x), B (x)) X for all x for all x
T-norms & co-norms Intersection of two fuzzy sets t-norm properties: z T ( a, b) T ( a,1) T( a) T ( a, b) T ( a, b) If b1 < b2, then Basic t-norms: T( a, b ) T( a, b ) Standard intersection - Bounded sum - Algebraic product - 1 2 T ( a, b) min( a, b) m T ( a, b) max(0, a b 1) b T ( a, b) ab p
Example fuzzy set operations A A A B A B A B 15
Well known Membership Functions
A given value could have number of possibilities X has following possibilities possibility(low) = 0.8 possibility(medium) = 0.4 all others possibilities (high, V.high) = 0
Fuzzy Relations Generalizes classical relation into one that allows partial membership Describes a relationship that holds between two or more objects Example: a fuzzy relation Friend describe the degree of friendship between two person (in contrast to either being friend or not being friend in classical relation!) Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Fuzzy Relations A fuzzy relation R is a mapping from the Cartesian space X x Y to the interval [0,1], where the strength of the mapping is expressed by the membership function of the relation (x,y) The strength of the relation between ordered pairs of the two universes is measured with a membership function expressing various degree of strength [0,1] R ~ Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
Fuzzy Cartesian Product Let A B be a fuzzy set on universe X, and be a fuzzy set on universe Y, then A B R X Y Where the fuzzy relation R has membership function R (x, y) A x B (x, y) min( A (x), B (y)) Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
Fuzzy Cartesian Product: Example Let A and B Fuzzy set Fuzzy set defined on a universe of three discrete temperatures, X = {x 1,x 2,x 3 }, defined on a universe of two discrete pressures, Y = {y 1,y 2 } A B represents the ambient temperature and the near optimum pressure for a certain heat exchanger, and the Cartesian product might represent the conditions (temperaturepressure pairs) of the exchanger that are associated with efficient operations. For example, let y A 0.2 0.5 1 1 y 2 x x 1 x 2 x 1 0.2 0.2 3 and B 0.3 0.9 y 1 y 2 } A B R x 2 x 3 0.3 0.5 0.3 0.9 Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
Fuzzy Composition Suppose R S T is a fuzzy relation on the Cartesian space X x Y, is a fuzzy relation on the Cartesian space Y x Z, and is a fuzzy relation on the Cartesian space X x Z; then fuzzy max-min and fuzzy max-product composition are defined as T R S max min T (x,z) y Y( R (x,y) S (y,z)) max product T (x,z) y Y( (x,y) (y, z)) R S Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
Max-Min Composition The max-min composition of two fuzzy relations R1 (defined on X and Y) and R2 (defined on Y and Z) is R (, ) [ (, ) (, )] 1 R x z x y y z 2 R 1 R 2 y Properties: Associativity: R ( S T) ( R S) T Distributive over union: R ( S T) ( R S) ( R T)
Fuzzy Composition: Example (max-min) X {x 1, x 2 }, Y {y 1, y 2 },and Z {z 1,z 2, z 3 } Consider the following fuzzy relations: y R x 1 y 2 z 1 0.7 0.5 and x 2 0.8 0.4 S y 1 z 2 z 3 1 0.9 0.6 0.5 y 2 0.1 0.7 0.5 Using max-min composition, T (x 1,z 1 ) y Y( R (x 1,y) S (y,z 1 )) max[min( 0.7,0.9),min(0.5, 0.1)] 0.7 } z T x 1 z 2 z 3 1 0.7 0.6 0.5 x 2 0.8 0.6 0.4 Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
Max-Product Composition The max-product composition of two fuzzy relations R1 (defined on X and Y) and R2 (defined on Y and Z) is R (, ) [ (, ) (, )] 1 R x z x y y z 2 R 1 R 2 y Properties: Associativity: R ( S T) ( R S) T Distributive over union: R ( S T) ( R S) ( R T)
Fuzzy Composition: Example (max-prod) X {x 1, x 2 }, Y {y 1, y 2 },and Z {z 1,z 2, z 3 } Consider the following fuzzy relations: y R x 1 y 2 z 1 0.7 0.5 and x 2 0.8 0.4 S y 1 z 2 z 3 1 0.9 0.6 0.5 y 2 0.1 0.7 0.5 Using max-product composition, T (x 2, z 2 ) y Y( R (x 2, y) S (y, z 2)) max[( 0.8,0.6),(0.4, 0.7)] 0.48 } z T x 1 z 2 z 3 1.63.42.25 x 2.72.48.20 Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
Application: Fuzzy Relation Petite Fuzzy Relation Petite defines the degree by which a person with a specific height and weight is considered petite. Suppose the range of the height and the weight of interest to us are {5, 5 1, 5 2, 5 3, 5 4,5 5,5 6 }, and {90, 95,100, 105, 110, 115, 120, 125} (in lb). We can express the fuzzy relation in a matrix form as shown below: P 90 95 100 105 110 115 120 125 5' 1 1 1 1 1 1.5.2 5'1" 1 1 1 1 1.9.3.1 5' 2" 1 1 1 1 1.7.1 0 5' 3" 1 1 1 1.5.3 0 0 5' 4".8.6.4.2 0 0 0 0 5' 5".6.4.2 0 0 0 0 0 5' 6" 0 0 0 0 0 0 0 0 Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
P 90 95 100 105 110 115 120 125 5' 1 1 1 1 1 1.5.2 5'1" 1 1 1 1 1.9.3.1 5' 2" 1 1 1 1 1.7.1 0 5' 3" 1 1 1 1.5.3 0 0 5' 4".8.6.4.2 0 0 0 0 5' 5".6.4.2 0 0 0 0 0 5' 6" 0 0 0 0 0 0 0 0 Once we define the petite fuzzy relation, we can answer two kinds of questions: What is the degree that a female with a specific height and a specific weight is considered to be petite? What is the possibility that a petite person has a specific pair of height and weight measures? (fuzzy relation becomes a possibility distribution) Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Application: Fuzzy Relation Petite Given a two-dimensional fuzzy relation and the possible values of one variable, infer the possible values of the other variable using similar fuzzy composition as described earlier. Definition: Let X and Y be the universes of discourse for variables x and y, respectively, and x i and y j be elements of X and Y. Let R be a fuzzy relation that maps X x Y to [0,1] and the possibility distribution of X is known to be P x (x i ). The compositional rule of inference infers the possibility distribution of Y as follows: max-min composition: P Y (y j ) max x i (min(p X (x i ),P R (x i, y j ))) max-product composition: P Y (y j ) max x i (P X (x i ) P R (x i, y j )) Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Application: Fuzzy Relation Petite Problem: We may wish to know the possible weight of a petite female who is about 5 4. Assume About 5 4 is defined as About-5 4 = {0/5, 0/5 1, 0.4/5 2, 0.8/5 3, 1/5 4, 0.8/5 5, 0.4/5 6 } Using max-min compositional, we can find the weight possibility distribution of a petite person about 5 4 tall: P 90 95 100 105 110 115 120 125 5' 1 1 1 1 1 1.5.2 5'1" 1 1 1 1 1.9.3.1 5' 2" 1 1 1 1 1.7.1 0 5' 3" 1 1 1 1.5.3 0 0 5' 4".8.6.4.2 0 0 0 0 5' 5".6.4.2 0 0 0 0 0 5' 6" 0 0 0 0 0 0 0 0 P weight (90) (0 1) (0 1) (.4 1) (.8 1) (1.8) (.8.6) (.4 0) 0.8 Similarly, we can compute the possibility degree for other weights. The final result is P weight {0.8 /90,0.8 /95,0.8 /100,0.8/105,0.5 /110,0.4 /115, 0.1/120,0 /125} Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Fuzzy Inference Systems Fuzzy logical operations Fuzzy rules Fuzzification Implication Aggregation Defuzzification input Fuzzifier Inference Engine De-fuzzification output Fuzzy Knowledge base
Fuzzifier Converts the crisp input to a linguistic variable using the membership functions stored in the fuzzy knowledge base.
Inference Engine Using If-Then type fuzzy rules converts the fuzzy input to the fuzzy output.
COMPOSITIONAL RULE OF INFERENCE In order to draw conclusions from a set of rules (rule base) one needs a mechanism that can produce an output from a collection of rules. This is done using the compositional rule of inference. B = A o R o is the composition operator. The inference procedure is called compositional rule of inference. The inference mechanism is determined by two factors: 1. Implication operators: Mamdani: min Larsen: algebraic product 2. Composition operators: Mamdani: max-min Larsen: max-product
Rule Evaluation small slow o.55 distance acceleration Clipping approach (others are possible): Clip the fuzzy set for slow (the consequent) at the height given by our belief in the premises (0.55) We will then consider the clipped AREA (orange) when making our final decision Rationale: if belief in premises is low, clipped area will be very small But if belief is high it will be close to the whole unclipped area 35
Rule Evaluation = 0.75 brake slow present fast fastest delta acceleration Distance is not growing, then keep present acceleration 36
Rule Evaluation = 0.75 present delta acceleration Distance is not growing, then keep present acceleration 37
Rule Aggregation To make a final decision: From each rule we have Obtained a clipped area. But in the end we want a single Number output: our desired acceleration slow present acceleration From distance From delta (distance change) 38
Washing Machine INPUT: Load (Quantity) small, medium, large Fabric Softness: Hard, Not so Hard, Soft, Not so soft OUTPUT: (Wash Cycle) Light, Normal, Strong
If Laundry quantity is large (Fuzzy) then wash cycle is strong (Fuzzy)
Washing Machine1 Small Medium Large Light Normal Strong. 1 0.6 0.3 0 Laundry Quantity Wash Cycle If Laundry quantity is large (Fuzzy) then wash cycle is strong (Fuzzy) Washing machine needs a NON-fuzzy information.
Rule 1: If Laundry quantity is LARGE and Laundry softness is HARD then wash cycle is strong. Rule 2: If Laundry quantity is MEDIUM and Laundry softness is NOT SO HARD then wash cycle is normal. All rules in rule base get fired
Washing Machine Hard N.H N.S Soft Small Medium Large Light Normal Strong.75 1 1 0.6 0.2 0 Laundry Softness 0.3 0 Laundry Quantity Wash Cycle Rule 1: If Laundry quantity is LARGE and Laundry softness is HARD then wash cycle is strong. Rule 2: If Laundry quantity is MEDIUM and Laundry softness is NOT SO HARD then wash cycle is normal.
Summary: If-Then rules 1. Fuzzify inputs: Determine the degree of membership for all terms in the premise. If there is one term then this is the degree of support for the consequence. 2. Apply fuzzy operator: If there are multiple parts, apply logical operators to determine the degree of support for the rule. 44
Summary: If-Then rules 3. Apply implication method: Use degree of support for rule to shape output fuzzy set of the consequence. How do we then combine several rules? 45
Multiple rules We aggregate the outputs into a single fuzzy set which combines their decisions. The input to aggregation is the list of truncated fuzzy sets and the output is a single fuzzy set for each variable. Aggregation rules: max, sum, etc. As long as it is commutative then the order of rule exec is irrelevant. 46
Defuzzify the output Take a fuzzy set and produce a single crisp number that represents the set. Practical when making a decision, taking an action etc. Center of gravity 47
Defuzzification Center of Gravity 1 Low C Max Min Max Min tf ( t) dt f ( t) dt High 0.61 Center of Gravity 0.39 0 Crisp output t
Sugeno Fuzzy Models Also known as TSK fuzzy model Takagi, Sugeno & Kang, 1985 Goal: Generation of fuzzy rules from a given input-output data set. Fuzzy Rules of TSK Model: If x is A and y is B then z = f(x, y) Fuzzy Sets Crisp Function
Examples R1: if X is small and Y is small then z = x +y +1 R2: if X is small and Y is large then z = y +3 R3: if X is large and Y is small then z = x +3 R4: if X is large and Y is large then z = x + y + 2
Issues with Fuzzy logic How to determine the membership functions? Usually requires fine-tuning of parameters How to generate Fuzzy rules? 3 input variables, each can take 4 possible linguistic values GA can help 51