- 1. FUZZY LOGIC
- 2. Origins and Evolution of Fuzzy Logic • Origin: Fuzzy Sets Theory (Zadeh, 1965) • Aim: Represent vagueness and impre-cission of statements in natural language • Fuzzy sets: Generalization of classical sets • In the 70s: From FST to Fuzzy Logic • Nowadays: Applications to control systems – Industrial applications – Domotic applications, etc.
- 4. Classical Sets Classical sets – either an element belongs to the set or it does not. For example, for the set of integers, either an integer is even or it is not (it is odd).
- 5. Classical Sets Classical sets are also called crisp (sets). Lists: A = {apples, oranges, cherries, mangoes} A = {a1,a2,a3 } A = {2, 4, 6, 8, …} Formulas: A = {x | x is an even natural number} A = {x | x = 2n, n is a natural number} Membership or characteristic function A ( x) 1 if x A 0 if x A
- 8. Fuzzy Sets Sets with fuzzy boundaries A = Set of tall people Crisp set A Fuzzy set A 1.0 1.0 .9 Membership .5 5’10’’ Heights function 5’10’’ 6’2’’ Heights
- 9. Membership Functions (MFs) Characteristics of MFs: Subjective measures Not probability functions “tall” in Asia MFs .8 “tall” in the US .5 “tall” in NBA .1 5’10’’ Heights
- 10. Fuzzy Sets Formal definition: A fuzzy set A in X is expressed as a set of ordered pairs: A Fuzzy set {( x, A ( x ))| x Membership function (MF) X} Universe or universe of discourse A fuzzy set is totally characterized by a membership function (MF).
- 11. An Example • A class of students (E.G. MCA. Students taking „Fuzzy Theory”) • The universe of discourse: X • “Who does have a driver’s licence?” • A subset of X = A (Crisp) Set • (X) = CHARACTERISTIC FUNCTION 1 0 1 1 0 1 1 • “Who can drive very well?” (X) = MEMBERSHIP FUNCTION 0.7 0 1.0 0.8 0 0.4 0.2
- 12. Crisp or Fuzzy Logic Crisp Logic A proposition can be true or false only. • Bob is a student (true) • Smoking is healthy (false) The degree of truth is 0 or 1. Fuzzy Logic The degree of truth is between 0 and 1. • William is young (0.3 truth) • Ariel is smart (0.9 truth)
- 13. Fuzzy Sets Membership function A X [0,1] Crisp Sets Characteristic function mA X {0,1}
- 15. Set-Theoretic Operations Subset A B A ( x) B ( x), x U Complement A U Union C A B C A ( x) A ( x) 1 max( A ( x), min( A A B ( x) ( x)) A ( x) B ( x) Intersection C A B C ( x) ( x), B ( x )) A ( x) B ( x)
- 17. Properties Of Crisp Set Involution A Commutativity A B B A B B Associativity Distributivity Idempotence Absorption A De Morgan’s laws A A A C A B C A B C A B C A B C A B C A A A A A A A A A A B B A B A B A A A C A C A B A A B B B A B
- 18. Properties The following properties are invalid for fuzzy sets: The laws of contradiction A A A A U The laws of exclude middle
- 19. Properties of Fuzzy Set
- 21. Example we have two discrete fuzzy sets
- 22. Example (cont..)
- 23. Summarize properties Involution A Commutativity A A B=B A, A B=B A Associativity A B C=(A B) C=A (B C), A B C=(A B) C=A (B C) Distributivity A (B C)=(A B) (A C), A (B C)=(A B) (A C) Idempotence A A=A, A A=A Absorption A (A B)=A, A (A B)=A A A B A B A A B A B A X=X, A = Absorption of complement Abs. by X and Identity A =A, A X=A Law of contradiction A A Law of excl. middle A A X DeMorgan’s laws A B A B A B A B
- 27. Representation of Crisp set
- 29. CARTESIAN PRODUCT An ordered sequence of r elements, written in the form (a1, a2, a3, . . . , ar), is called an ordered rtuple. For crisp sets A1,A2, . . . ,Ar, the set of all rtuples(a1, a2, a3, . . . , ar), where a1∈A1,a2 ∈A2, and ar∈Ar, is called the Cartesian product of A1,A2, . . . ,Ar, and is denoted by A1 A2 ··· Ar. (The Cartesian product of two or more sets is not the same thing as the arithmetic product of two or more sets.)
- 30. Crisp Relations A subset of the Cartesian product A1 A2 ··· Ar is called an r-ary relation over A1,A2, . . . ,Ar. If three, four, or five sets are involved in a subset of the full Cartesian product, the relations are called ternary, quaternary, and quinary
- 31. Cartesian product The Cartesian product of two universes X and Y is determined as X Y = {(x, y) | x ∈X, y ∈Y} which forms an ordered pair of every x ∈X with every y ∈Y, forming unconstrained matches between X and Y. That is, every element in universe X is related completely to every element in universe Y.
- 32. Fuzzy Relations Triples showing connection between two sets: (a,b,#): a is related to b with degree # Fuzzy relations are set themselves Fuzzy relations can be expressed as matrices … 32
- 33. Fuzzy Relations Matrices Example: Color-Ripeness relation for tomatoes R1(x, y) unripe semi ripe ripe green 1 0.5 0 yellow 0.3 1 0.4 Red 0 0.2 1 33
- 34. Fuzzy Relations A fuzzy relation R is a 2D MF: R ( x, y), R ( x, y) | ( x, y) X Y
- 35. Fuzzy relation A fuzzy relation is a fuzzy set defined on the Cartesian product of crisp sets A1, A2, ..., An where tuples (x1, x2, ..., xn) may have varying degrees of membership within the relation. The membership grade indicates the strength of the relation present between the elements of the tuple. R R : A1 A2 ... An (( x1 , x2 ,..., xn ), [0,1] R )| R ( x1 , x2 ,..., xn ) 0, x1 A1, x2 A2 ,..., xn An 35
- 37. Max-Min Composition X Y Z R: fuzzy relation defined on X and Y. S: fuzzy relation defined on Y and Z. R。S: the composition of R and S. A fuzzy relation defined on X an Z. RS (x, z) max y min y R ( x, y) R ( x, y), S S ( y, z) ( y, z)
- 38. Max-min composition ( x, y) A B, ( y, z) B C max[min( R ( x, y ), S R ( x, z ) y y [ R ( x, y ) S S ( y, z ))] ( y, z )] Example 38
- 39. Example S R (1, ) max[min(0.1, 0.9), min(0.2, 0.2), min(0.0, 0.8), min(1.0, 0.4)] max[0.1, 0.2, 0.0, 0.4] 0.4 39
- 40. Example S R (1, ) max[min(0.1, 0.0), min(0.2,1.0), min(0.0, 0.0), min(1.0, 0.2)] max[0.0, 0.2, 0.0, 0.2] 0.2 40
- 41. 41
- 42. Max-min composition is not mathematically tractable, therefore other compositions such as max-product composition have been suggested. Max-Product Composition X Y Z R: fuzzy relation defined on X and Y. S: fuzzy relation defined on Y and Z. R。S: the composition of R and S. A fuzzy relation defined on X an Z. RS (x, y) maxv R ( x, v) S (v, y)
- 43. Max Product Max product: C = A・B=AB= Example C12 ? 43
- 48. Introduction Fuzzify crisp inputs to get the fuzzy inputs Defuzzify the fuzzy outputs to get crisp outputs
- 50. Propositional logic A proposition is a statement- in which English is a declarative sentence and logic defines the way of putting symbols together to form a sentences that represent facts Every proposition is either true or false.
- 51. Example of PL The conjunction of the two sentences: Grass is green Pigs don't fly is the sentence: Grass is green and pigs don't fly The conjunction of two sentences will be true if, and only if, each of the two sentences from which it was formed is true.
- 52. Statement symbols and variables Statement: A simple statement is one that does not contain any other statement as a part. A compound statement is one that has two or more simple statement as parts called components.
- 53. Symbols for connective ASSERTION P NEGATION “P IS TRUE” ¬P ~ ! CONJUCTION P^Q . & DISJUNCTION PvQ || IMPLICATION P-> Q EQUIVALENCE P⇔Q NOT AND “BOTH P AND Q ARE TRUE | OR “ EITHER P OR Q IS TRUE” ⇒ = && “P IS FALSE” IF…THEN “IF P IS TRUE THEN Q IS TRUE.” ⇔ IF AND ONLY IF “P AND Q ARE EITHER BOTH TRUE OR FALSE”
- 54. Truth Value The truth value of a statement is truth or falsity. P is either true or false ~p is either true of false p^q is either true or false, and so on. Truth table is a convenient way of showing relationship between several propositions..
- 55. Truth Table for Negation P ~P Case 1 T F Case 2 F T As you can see “P” is a true statement then its negation “~P” or “not P” is false. If “P” is false, then “~P” is true.
- 56. Truth Table for Conjunction P Q PΛQ Case 1 T T T Case 2 T F F Case 3 F T F Case 4 F F F
- 57. Truth Table for Disjunction P Q PVQ Case 1 T T T Case 2 T F T Case 3 F T T Case 4 F F F
- 58. Tautology Tautology is a proposition formed by combining other proposition (p,q,r…)which is true regardless of truth or falsehood of p,q,r… DEF: A compound proposition is called a tautology if no matter what truth values its atomic propositions have, its own truth value is T.
- 59. Tautology example Demonstrate that [¬p (p q )] q is a tautology in two ways: 1. Using a truth table – show that (p q )] q is always true. [¬p L3 59
- 60. Tautology by truth table p q ¬p p q ¬p (p q ) [¬p (p q )] q T T T F F T F F L3 60
- 61. Tautology by truth table p q ¬p p q ¬p (p q ) [¬p (p q )] q T T F T F F F T T F F T L3 61
- 62. Tautology by truth table p q ¬p p q ¬p (p q ) [¬p (p q )] q T T F T T F F T F T T T F F T F L3 62
- 63. Tautology by truth table p q ¬p p q ¬p (p q ) [¬p (p q )] q T T F T F T F F T F F T T T T F F T F F L3 63
- 64. Tautology by truth table p q ¬p p q ¬p (p q ) [¬p (p q )] q T T F T F T T F F T F T F T T T T T F F T F F T L3 64
- 65. Modus Ponens and Modus Tollens Modus ponens -- If A then B, observe A, conclude B Modus tollens – If A then B, observe notB, conclude not-A
- 66. Modus Ponens and Tollens If Joan understood this book, then she would get a good grade. If P then Q Joan understood .: she got a good grade. This uses modus ponens. P .: Q If Joan understood this book, then she would get a good grade. If P then Q She did not get a good grade .: she did not understand this book. ~Q .: ~P This uses modus tollens.
- 67. Fuzzy Quantifiers The scope of fuzzy propositions can be extended using fuzzy quantifiers • Fuzzy quantifiers are fuzzy numbers that take part in fuzzy propositions • There are two different types: – Type #1 (absolute): Defined on the set of real numbers • Examples: “about 10”, “much more than 100”, “at least about 5”, etc. – Type #2 (relative): Defined on the interval [0, 1] • “almost all”, “about half”, “most”, etc.
- 68. Fuzzification The fuzzification comprises the process of transforming crisp values into grades of membership for linguistic terms of fuzzy sets. The membership function is used to associate a grade to each linguistic term. Measurement devices in technical systems provide crisp measurements, like 110.5 Volt or 31,5 C. At first, these crisp values must be transformed into linguistic terms (fuzzy sets) . This is called fuzzification.
- 69. Input Fuzzifier Fuzzifier Inference Engine Defuzzifier Output Fuzzy Knowledge base Converts the crisp input to a linguistic variable using the membership functions stored in the fuzzy knowledge base.
- 70. Fuzzy interference If x is A and y is B then z = f(x, y) Fuzzy Sets Crisp Function f(x, y) is very often a polynomial function w.r.t. x and y.
- 71. 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
- 73. Defuzzification • Convert fuzzy grade to Crisp output The max criterion method finds the point at which the membership function is a maximum. The mean of maximum takes the mean of those points where the membership function is at a maximum.
- 74. Defuzzification