VIEWS: 0 PAGES: 216 POSTED ON: 6/28/2012
Soft Computing Fuzzy logic is part of soft computing Congress of Computational Intelligence Neural Nets Evolutionary Algorithms Computational Intelligence Fuzzy Logic Fuzzy Logic and Functions Constructive Induction Decision Trees and other Evolutionary Algorithms Fuzzy logic Learning Neural Nets The Definition of Fuzzy Logic Membership Function • A person's height membership function graph is shown next with linguistic values of the degree of membership as very tall, tall, average, short and very short being replaced by 0.85, 0.65, 0.50, 0.45 and 0.15. • In traditional logic, statements can be either true or false, and sets can either contain an element or not. • These logic values and set memberships are typically represented with number 1 and 0. • Fuzzy logic generalizes traditional logic by allowing statements to be somewhat true, partially true, etc. • Likewise, sets can have full members, tall partial members, and so on. • For example, a person whose height is 5’ 9” might be assigned a medium membership of 0.6 in the fuzzy set “tall people”. • The statement “Joe is tall” is 60% true of Joe is 5’9”. • Fuzzy logic is a set of “if--then” statements based on combining fuzzy sets. (Beale & Demuth..Fuzzy Systems Toolbox.) Fuzzy Sets, Statements, and Rules • A crisp set is simply a collection of objects taken from the universe of objects. • Fuzzy refers to linguistic uncertainty, like the word “tall”. • Fuzzy sets allow objects to have membership in more than one set: – e.g. 6’ 0” has grade 70% in the set “tall” and grade 40% in the set “medium”. • A fuzzy statement describes the grade of a fuzzy variable with an expression: – e.g. Pick a real number greater than 3 and less than 8. The Definition of Fuzzy Logic Rules • A fuzzy logic system uses fuzzy logic rules, as in an expert system where there are many if-then rules. – A fuzzy logic rule uses membership functions as variables. • A fuzzy logic rule is defined as an if variable(s) and then output fuzzy variable(s). • Fuzzy logic variables are connected together like binary equations with the variables separated with operators of AND, OR, and NOT. Contents • Review of classical logic and reasoning systems • Fuzzy sets • Fuzzy logic • Fuzzy logic systems applications • Fuzzy Logic Minimization and Synthesis • Practical Examples • Approaches to fuzzy logic decomposition • Our approach to decomposition • Combining methods and future research Outline •be introduced to the topics of: – fuzzy sets, – fuzzy operators, – fuzzy logic – and come to terms with the technology •learn how to represent concepts using fuzzy logic •understand how fuzzy logic is used to make deductions •familiarise yourself with the `fuzzy' terminology Traditional Logic • One of the main aims of logic is to provide rules which can be employed to determine whether a particular argument is correct or not. • The language of logic is based on mathematics and the reasoning process is precise and unambiguous. Logical arguments • Any logical argument consists of statements. • A statement is a sentence which unambiguously either holds true or holds false. –Example:Today is Sunday Predicates • Example: Seven is an even number – This example can be written in a mathematical form as follows: • 7 {x| x is an even number} – or in a more concise way: • 7 {x|P(x)} – where | is read as such that and P(x) stands for `x has property P' and it is known as the predicate. – Note that a predicate is not a statement until some particular x-value is specified. – Once a x value is specified then the predicate becomes a statement whose truth or falsity can be worked out. For All Quantifier • For all x and y, x2-y2 is the same as (x+y)*(x- y) – This example can be written in a mathematical form as well: • x,y ((x,yR) (x2-y2)=(x+y)*(x-y)) • where the is interpreted as 'for all', is the logical operator AND, and R represents what is termed as the universe of discourse. Universe of Discourse • Using the universe of discourse one assures that a statement is evaluated for relevant values. – The above predicate is then true only for real numbers. • Similarly for the first example the universe of discourse is most likely to be the set of natural numbers rather than buildings, rivers, or anything else. – Hence, using the concept of the universe of discourse any logical paradoxes can not arise. Existential Quantifier • Another type of quantifier is the existential quantifier (). • The existential quantifier is interpreted as 'there exists' or 'for some' and describes a statement as being true for at least one element of the set. • For example, (x) ((river(x)name(Amazon)) Connectives and their truth tables • A number of connectives exist. – Their sole purpose is to allow us to join together predicates or statements in order to form more complicated ones. • Such connectives are NOT (~), AND (), OR (). – Strictly speaking NOT is not a connective since it only applies to a single predicate or statement. • In traditional logic the main tools of reasoning are tautologies, such as the modus ponens (A(AB))B ( means implies). Truth Tables And Or Not A B AÙB AÚB ~A True True True True False True False False True False False True False True True False False False False True This everything will hold true, we will just do a small modification to the material on logic from the last quarter Identities of Fuzzy Logic • The form of identities used in fuzzy variables are the same as elements in fuzzy sets. • The definition of an element in a fuzzy set, {(x,u a(x))}, is the same as a fuzzy variable x and this form will be used in the remainder of the paper. • Fuzzy functions are made up of fuzzy variables. The identities for fuzzy algebra are: Idempotency: X + X = X, X * X = X Commutativity: X + Y = Y + X, X * Y = Y * X Associativity: (X + Y) + Z = X + (Y + Z), (X * Y) * Z = X * (Y* Z) Absorption: X + (X * Y) = X, X * (X + Y) = X Distributivity: X + (Y * Z) = (X + Y) * (X + Z), X * (Y + Z) = (X * Y) + (X * Z) Complement: X’’ = X DeMorgan's Laws: (X + Y)’ = X’ * Y’, (X * Y)’ = X’ + Y’ Transformations of Fuzzy Logic Formulas Some transformations of fuzzy sets with examples follow: x’b + xb = (x + x’)b b xb + xx’b = xb(1 + x’) = xb x’b + xx’b = x’b(1 + x) = x’b a + xa = a(1 + x) = a a + x’a = a(1 + x’) = a a + xx’a = a a+0=a x+0=x x*0=0 x+1=1 x*1=x Examples: a + xa + x’b + xx’b = a(1 + x) + x’b(1 + x) = a + x’b a + xa + x’a + xx’a = a(1 + x + x’ + xx’) = a Differences Between Boolean Logic and Fuzzy Logic • In Boolean logic the value of a variable and its inverse are always disjoint (X * X’ = 0) and (X + X’ = 1) because the values are either zero or one. • Fuzzy logic membership functions can be either disjoint or non-disjoint. • Example of a fuzzy non- linear and linear membership function X is shown (a) with its inverse membership function shown in (b). Fuzzy Intersection and Union • From the membership functions shown in the top in (a), and complement X’ (b) the intersection of fuzzy variable X and its complement X’ is shown bottom in (a). • From the membership functions shown in the top in (a), and complement X’ (b) the union of fuzzy variable X and its complement X’ is shown bottom in (b). Fuzzy Fuzzy union intersection Validation of Fuzzy Functions valid inconsistent • Two fuzzy functions are valid iff the function outputs are 0.5 under all possible assignments. • This is like doing EXOR of two binary functions shown in (b) which is the same as union. • Two fuzzy functions are inconsistent iff the function output is 0.5 under all possible assignments. Thus, if the output of the two fuzzy functions is < 0.5 then the two fuzzy functions are inconsistent. • This is like exnor of two binary functions of shown in (a) which is the same as intersection. Fuzzy Logic • The concept of fuzzy logic was introduced by L.A Zadeh in a 1965 paper. • Aristotelian concepts have been useful and applicable for many years. • But these traditional approaches present us with certain problems: – Cannot express ambiguity – Lack of quantifiers – Cannot handle exceptions Traditional Logic Problems – Cannot express ambiguity: • Consider the predicate `X is tall'. • Providing a specific person we can turn the predicate into a statement. • But what is the exact meaning of the word `tall'? • What is `tall' to some people is not tall to others. – Lack of quantifiers: • Another problem is the lack of being able to express statements such as `Most of the goals came in the first half '. • The `most' quantifier cannot be expressed in terms of the universal and/or existential quantifiers. Traditional Logic Problems – Cannot handle exceptions: • Another limitation of traditional predicate logic is expressing things that are sometimes, but not always true. Traditional sets • In order to represent a set we use curly brackets {}. • Within the curly brackets we enclose the names of the items, separating them from each other by commas. • The items within the curly brackets are referred to as the elements of the set. – Example: Set of vowels in the English alphabet = {a,e,i,o,u} • When dealing with numerical elements we may replace any number of elements using 3 dots. – Example: Set of numbers from 1 to 100 = {1,2,3,...,100} – Set of numbers from 23 to infinity = {23,24,25,...} Traditional sets • Rather than writing the description of a set all the time we can give names to the set. • The general convention is to give sets names in capital letters. – Example: • V = set of vowels in the English alphabet. • Hence any time we encounter V implies the set {a, e, i, o, u}. – For finite size sets a diagrammatic representation can be employed which can be used to assist in their understanding. • These are called the cloud diagrams Cloud Diagrams A cloud diagram V={a,e,i,o,u} a u e oi Set order • The order in which the elements are written down is not important. – Example: V = {a,e,i,o,u} = {u,o,i,e,a} = {a,o,e,u,i} • The names of the elements in a set must be unique. – Example: • V = {a,a,e,i,o,u} • If two elements are the same then there is no point writing them down twice (waste of effort) • but if different then we must introduce a way to tell them apart. Set membership • Given any set, we can test if a certain thing is an element of the set or not. • The Greek symbol, , indicates an element is a member of a set. • For example, xA means that x is an element of the set A. • If an element is not a member of a set, the symbol is used, as in A. Set equality & subsets • Two sets A and B are equal, (A= B) if every element of A is an element of B and every element of B is an element of A. • A set A is a subset of set B, (A B) if every element of A is an element of B. • A set A is a proper subset of set B, (A B) if A is a subset of B and the two sets are not equal. Set equality & subsets • Two sets A and B are disjoint, (A b) if and only if their intersection is the empty set. • There are a number of special sets. For instance: – Boolean B={True, False} – Natural numbers N={0,1,2,3,...} – Integer numbers Z={...,-3,-2,-1,0,1,2,3,...} – Real numbers R – Characters Char – Empty set or {} – The empty set is not to be confused with {0} which is a set which contains the number zero as its only element. Set operations • We have a number of possible operators acting on sets. • The intersection ( ), the union ( ), the difference (/), the complement ('). – Intersection results in a set with the common elements of two sets. – Union results in a set which contains the elements of both sets. – The difference results in a set which contains all the elements of the first set which do not appear in the second set. – The complement of a set is the set of all element not in that set. Set operations example • Using as an example the two following sets A and B the mathematical representation of the operations will be given. – A = {cat, dog, ferret, monkey, stoat} – B = {dog, elephant, weasel, monkey} • C = A B = {x e u | (x e A) (x e B)}={dog, monkey} • C = A B = {x e u | (x e A) (x e B)}={cat, ferret, stoat, dog, elephant, weasel, monkey} • C = A / B = {x e u | (x e A) ~(x e B)}={cat, ferret, stoat} • C = A‘ = {x e u | ~(x e A)} Set operations example using Venn diagrams Intersection Union A B A B Difference om ent C plem A B A A' Soft Computing and Fuzzy Theory What is fuzziness • The concept of fuzzy logic was introduced in a 1965 paper by Lotfi Zadeh. • Professor Zadeh was motivated by his realization of the fact that people base their decisions on imprecise, non-numerical information. • Fuzzification should not be regarded as a single theory but as a methodology – It generalizes any specific theory from a discrete to a continuous form. • For instance: – from Boolean logic to fuzzy logic, – from calculus to fuzzy calculus, – from differential equations to fuzzy differential equations, – and so on. What is fuzziness • Fuzzy logic is then a superset of conventional Boolean logic. • In Boolean logic propositions take a value of either completely true or completely false • Fuzzy logic handles the concept of partial truth, i.e., values between the two extremes. What is fuzziness • For example, if pressure takes values between 0 and 50 (the universe of discourse) one might label the range 20 to 30 as medium pressure (the subset). • Medium is known as a linguistic variable. • Therefore, with Boolean logic 15.0 (or even 19.99) is not a member of the medium pressure range. • As soon as the pressure equals 20, then it becomes a member. Boolean Medium Pressure Membership Grade 1 following Figure shows the membership function The0.9 using Boolean logic. 0.8 0.7 0.6 0.5 0.4 Not-Member Member Not-Member 0.3 0.2 0.1 0 Pressure 10 20 30 40 50 What is fuzziness • Contrast with the Figure of the next page which shows the membership function using fuzzy logic. • Here, a value of 15 is a member of the medium pressure range with a membership grade of about 0.3. • Measurements of 20, 25, 30, 40 have grade of memberships of 0.5, 1.0, 0.8, and 0.0 respectively. • Therefore, a membership grade progresses from non-membership to full membership and again to non-membership. Fuzzy Medium Pressure Membership Grade 1 0.9 0.8 0.7 0.6 Not-Member Member Not-Member 0.5 0.4 0.3 0.2 0.1 0 Pressure 10 20 30 40 50 Fuzzy Sets Fuzzy Sets • Fuzzy logic is based upon the notion of fuzzy sets. – Recall from the previous section that an item is an element of a set or not. – With traditional sets the boundaries are clear cut. – With fuzzy sets partial membership is allowed. – Fuzzy logic involves 3 primary processes : • Fuzzification • Rule evaluation • Defuzzification – With fuzzy logic the generalised modus ponens is employed which allows A and B to be characterised by fuzzy sets. Fuzzy Set Theory Fuzzy Sets • Definition • Operations • Identities • Transformations TRADITIONAL vs. FUZZY SETS • Traditional sets, influenced from the Aristotelian view of two-valued logic, have only two possible truth values, namely TRUE or FALSE, 1 or 0, yes or no etc. • Something either belongs to a particular set or does not. • The characteristic function or alternatively referred to as the discrimination function is defined below in terms of a functional mapping: TRADITIONAL vs. FUZZY SETS • In fuzzy sets, something may belong partially to a set. • Therefore it might be very true or somewhat true, 0.2 or 0.9 in numerical terms. • The membership function using fuzzy sets defined in terms of a functional mapping is as shown below: TRADITIONAL vs. FUZZY SETS • Fuzzy logic allows you to violate the laws of noncontradiction since an element can be a member of more than one set. • More set operations are available • The excluded middle is not applicable, i.e., the intersection of a set with its complement does not necessarily result to an empty set. • Rule based systems using fuzzy logic in some cases might increase the amount of computation required in comparison with systems using classical binary logic. TRADITIONAL vs. FUZZY SETS • If fuzzy membership grades are restricted to {0,1} then Boolean sets are recovered. • For instance, consider the Set Union operator which states that the truth value of two arguments x and y is their maximum: – truth(x or y) = max(truth(x), truth(y)). TRADITIONAL vs. FUZZY SETS • If truth grades are either 0 or 1 then following table is found: – x y truth –000 –011 –101 –111 • which is the same truth table as in the Boolean logic. • So, every crisp set is fuzzy, but not conversely. Definition of Fuzzy Set • A fuzzy set, defined as A, is a subset of a universe of discourse U, where A is characterized by a membership function uA(x). • The membership function uA(x) is associated with each point in U and is the “grade of membership” in A. • The membership function uA(x) is assumed to range in the interval [0,1], with value of 0 corresponding to the non- membership, and 1 corresponding to the full membership. • The ordered pairs form the set {(u,uA(x))} to represent the fuzzy set member and the grade of membership. Operations on Fuzzy Sets • The fuzzy set operations are defined as follows. – Intersection operation of two fuzzy sets uses the symbols: , *, , AND, or min. – Union operation of two fuzzy sets uses the symbols: , , +, OR, or max. • Equality of two sets is defined as A = B u a(x) = u b(x) for all x X. • Containment of two sets is defined as A subset B, A B u a(x) u b(x) for all x X. • Complement of a set A is defined as A’, where u a’(x) = 1 – u a(x) for all x X. • Intersection of two sets is defined as A B where u a b (x) = min{(u a(x),u b(x))} for all x X. Where C A, C B then C A B. • Union of two sets is defined as A B where u a b(x) = max{(u a(x), u b (x))} for all x X where D A, D B then D A B. Fuzzy sets, logic, inference, control – This is the appropriate place to clarify not what the terms mean but their relationship. – This is necessary because different authors and researchers use the same term either for the same thing or for different things. – The following have become widely accepted: • Fuzzy logic system – anything that uses fuzzy set theory • Fuzzy control – any control system that employs fuzzy logic • Fuzzy associative memory – any system that evaluates a set of fuzzy if-then rules uses fuzzy inference. Also known as fuzzy rule base or fuzzy expert system • Fuzzy inference control – a system that uses fuzzy control and fuzzy inference Fuzzy sets • A traditional set can be considered as a special case of fuzzy sets. • A fuzzy set has 3 principal properties: – the range of values over which the set is mapped – the degree of membership axis that measures a domain value's membership in the set – the surface of the fuzzy set - the points that connect the degree of membership with the underlying domain Fuzzy sets • Therefore, a fuzzy set in a universe of discourse U is characterised by the membership function µx, which takes values in the interval [0,1] namely µx:U[0,1]. – A fuzzy set X in U may be represented as a set of ordered pairs of a generic element u and its grade of membership µx as X={u,µX(u)/u _ U}, • i.e., the fuzzy variables u take on fuzzy values µx(u). – When a fuzzy set, say X, is discrete and finite it may expressed as X=µx(u1)/u1+...+µx(un)/un • where `+' is not the summation symbol but the union operator, the `/’ does not denote division but a particular membership function to a value on the universe of discourse. Fuzzy set 1.5 Grade 1 0.5 0 0 3 6 9 Decade Fuzzy sets • As an example consider: – the universe of discourse U={0,1,2,...,9} – and a fuzzy set X1, `young generation decade'. • A possible presentation now follows: – X1={1.0/0+1.0/1+0.85/2+0.7/3+0.5/4+0.3/5+0.15/6+ 0.0/7+0.0/8+0.0/9. – The set is also shown in a graphical form below. 1.5 Grade 1 0.5 0 0 3 6 9 Decade Fuzzy set • Another set, X2 might be `mid-age generation decade. In discrete form this can be depicted as X2={0.0/0+0.0/1+0.5/2+0.8/3+1.0/4+0.7/5+0.3/6 1 +0.0/7+0.0/8+0.0/9. 0.9 0.8 0.7 0.6 Grade 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 Decade – Support of a fuzzy set: Support, Crossover, • The support of a fuzzy set is the set of all elements of the Singleton universe of discourse that their grade of membership is greater than zero. • For X2 the support is {2,3,4,5,6}. • Additionally, a fuzzy set has compact support if its support 1 is finite. 0.9 0.8 – Crossover point: 0.7 0.6 • The element of a fuzzy set that Grade 0.5 0.4 has a grade of membership 0.3 equal to 0.5 is known as the 0.2 0.1 crossover point. 0 0 1 2 3 4 5 6 7 8 9 • For X2 the crossover point is 2. Decade – Fuzzy singleton: Support, Crossover, • The fuzzy set whose support is a single point in the universe of Singleton discourse with grade of membership equal to one is known as the fuzzy singleton. – -Level sets: • The fuzzy set that contains the elements which have a grade of 1 0.9 membership greater than the - 0.8 0.7 level set is known as the -Level 0.6 Grade 0.5 set. 0.4 0.3 • For X2 the -Level set when 0.2 0.1 =0.6 is {3,4,5}. 0 0 1 2 3 4 5 6 7 8 9 • Whereas for X2 the -Level set Decade when =0.4 is {2,3,4,5}. Popular Membership Functions Popular Membership Functions • Membership Functions are used in order to return the degree of membership of a numerical value for a particular set. – Fuzzy membership functions can have different shapes, depending on someone's experience or even preference. – Here we review some of the membership functions used in order to capture the modeler's sense of fuzzy numbers. – Membership functions can be drawn using: • Subjective evaluation and elicitation – (Experts specify at the end of an elicitation phase the appropriate membership functions) or • Ad-hoc forms – (One can draw from a set of given different curves. Popular Membership Functions • This simplifies the problem, for example to – 1. choosing just the central value and the slope on either side) – 2. Converted frequencies (Information from a frequency histogram can be used as the basis to construct a membership function – 3. Learning and adaptation. • For example, let us consider the fuzzy membership function of the linguistic variable Tall. • The following function can be one presentation: Popular Membership Functions 0 if height(x) < 5 feet height(x) - 5 Tall(x) = if 5 feet height(x) 7 feet 2 1 if height(x) > 7 feet • Given the above definition the membership grade for an expression like `Dimitris is Tall' can be evaluated. Assuming a height of 6' 11'' the membership grade is 0.54 • Other popular shapes used are triangles and trapezoidals. The S-Function 0 for x 2 x 2 for x S ( x; , , ) 2 1 2 x for x 1 for x S- The S-Function 1 function 0 .9 0 .8 0 .7 0 .6 0 .5 0 .4 0 .3 0 .2 0 .1 0 x a b g The S-Function • As one can see the S-function is flat at a value of 0 for xa and at 1 for xg. In between a and g the S- function is a quadratic function of x. – To illustrate the S-function we shall use the fuzzy proposition Dimitris is tall. – We assume that: • Dimitris is an adult • The universe of discource are normal people – (i.e., excluding the extremes of basketball players etc.) – then we may assume that anyone less than 5 feet is not tall (i.e., a=5) and anyone more than 7 feet is tall (i.e., g=7). • Hence, b=6. • Anyone between 5 and 7 feet has a membership function which increases monotonically with his height. S-Function 0 for x 5 x 5 2 2 for5 x 6 S ( x;5,6,7) x 7 2 1 2 for6 x 7 1 for x7 Hence the membership of 6 feet tall people is 0.5, whereas for 6.5 feet tall people increases to 0.9. S- 1 function 0 .9 0 .8 0 .7 0 .6 0 .5 0 .4 0 .3 0 .2 0 .1 0 5 6 7 Heigh t P-Function S ( x; , , ) for x ( x; , ) 2 1 S ( x; , , ) for x 2 P-Function -function P 1 0.9 0.8 0.7 0.6 0.5 b 0.4 0.3 0.2 0.1 0 x g-b g-(b/2) g g+(b/2) g+b P-Function • The P-function goes to zero at < , and the 0.5 point is at = (/2). • Notice that the parameter represents the bandwidth of the 0.5 points. P-Function -function P 1 0.9 0.8 0.7 0.6 0.5 6 0.4 0.3 0.2 0.1 0 x 1 4 7 10 13 S ( x;1,4,7) for x 7 ( x;6,7) 1 S ( x;7,10,13) for x 7 Many argument Fuzzy Operations Operations • An example of fuzzy operations: X = { 1, 2, 3, 4, 5} and fuzzy sets A and B. • A = {(3,0.8), (5,1), (2,0.6)} and B = {(3,0.7), (4,1), (2,0.5)} then • A B = {(3, 0.7), (2, 0.5)} • A B = {(3, 0.8), (4, 1), (5, 1), (2, 0.6)} • A’ = {(1, 1), (2, 0.4), (3, 0.2), (4, 1), (5,0)} Fuzzy operators • What follows is a summary of some fuzzy set operators in a domain X. • For illustration purposes we shall use the following membership sets: – A= 0.8/2 + 0.6/3 + 0.2/4, and B = 0.8/3 + 0.2/5 – as well as X1 and X2 from above. • Set equality: – A=B if A(x)=B(x) for all xX • Set complement: – A' A' (x)=1-A (x) for all xX. – This corresponds to the logic `NOT' function. – A' (x) = 0.2/2 + 0.4/3 + 0.8/4 Fuzzy operators • Subset: AB if and only if A(x)B(x) for all xX • Proper Subset: – AB if A(x)B(x) and A(x) B(x) for at least one xX • Set Union: – AB AB(x)=(A(x),B(x)) for all xX where is the join operator and means the maximum of the arguments. • This corresponds to the logic `OR' function. – AB(x) = 0.8/2 + 0.8/3 + 0.2/4 + 0.2/5 Fuzzy Union Diagram X1 1.2 1 X2 0.8 Union Grade 0.6 0.4 0.2 0 0 1 2 3 4 5 6 7 8 9 Decade – AB(x) = 0.8/2 + 0.8/3 + 0.2/4 + 0.2/5 Fuzzy operators • Set Intersection: – AB AB(x)=( A(x), B(x)) for all xX where is the meet operator and means the minimum of the arguments. • This corresponds to the logic `AND' function. – AB(x) = 0.6/3 • Set product: – AB AB(x)=A(x)B(x) • Power of a set: – AN AN (x)=(A(x))N Fuzzy Intersection diagram X1 1.2 X2 1 0.8 Inter. Grade 0.6 0.4 0.2 0 0 1 2 3 4 5 6 7 8 9 Decade Fuzzy operators • Bounded sum or bold union: AB – AB(x)=(1,(A(x)+B(x))) where is minimum and + is the arithmetic add operator. • Bounded product or bold intersection: AB – AB(x)=(0,(A(x)+B(x)-1)) where is maximum and + is the arithmetic add operator. • Bounded difference: A - B – A- B(x)=(0,(A(x)-B(x))) • where is maximum and - is the arithmetic minus operator. – This operation represents those elements that are more in A than B. Single argument Fuzzy Operations Concentration set operator • CON(A) CON(A)=(A(x))2 – This operation reduces the membership grade of elements that have small membership grades. • If TALL=-.125/5+0.5/6+0.875/6.5+1/7+1/7.5+1/8 then • VERY TALL = 0.0165/5+0.25/6+0.76/6.5+1/7+1/7.5+1/8 since VERY TALL=TALL2. Concentration set operator 1 0.9 0.8 Original 0.7 0.6 0.5 0.4 0.3 Concentration 0.2 0.1 0 0 2 4 6 8 10 12 14 Dilation set operator • DIL(A) DIL(A)=(A(x))0.5 – This operation increases the membership grade of elements that have small membership grades. – It is the inverse of the concentration operation. • If TALL=-.125/5+0.5/6+0.875/6.5+1/7+1/7.5+1/8 then • MORE or LESS TALL = 0.354/5+0.707/6+0.935/6.5+1/7+1/7.5+1/8 since MORE or LESS TALL=TALL0.5. Dilation set operator 1 0.9 0.8 Dilation 0.7 0.6 0.5 0.4 Original 0.3 0.2 0.1 0 0 2 4 6 8 10 12 14 Intensification set operator • This operation raises the membership grade of those elements within the 0.5 points and • This operation reduces the membership grade of those elements outside the crossover (0.5) point. • Hence, intensification amplifies the signal within the bandwidth while reducing the `noise'. – If TALL = -.125/5+0.5/6+0.875/6.5+1/7+1/7.5+1/8 then – INT(TALL) = 0.031/5+0.5/6+0.969/6.5+1/7+1/7.5+1/8. 2( A ( x)) 2 for 0 A ( x) 0.5 INT ( A) ( x) 1 2(1 A ( x)) for 0.5 A ( x) 1 2 Intensification set operator 1 0.9 intensification Intensificatio n 0.8 0.7 0.6 0.5 Original 0.4 0.3 0.2 0.1 0 0 2 4 6 8 10 12 14 Normalization set operator • NORM(A)(x)=A(x)/max{A(x)} where the max function returns the maximum membership grade for all elements of x. – If the maximum grade is <1, then all membership grades will be increased. – If the maximum is 1, then the membership grades remain unchanged. • NORM(TALL) = TALL since the maximum is 1 Hedges – language related operators • The above diagram shows the relationship between linguistic variables, term sets and fuzzy representations. – Cold, cool, warm and hot are the linguistic values of the linguistic variable temperature. – In general a value of a linguistic variable is a composite term u = u1, u2,...,un where each un is an atomic term. linguistic Temperature Hedges variable Cold Cool Warm Hot term set fuzzy set representation Hedges • From one atomic term by employing hedges we can create more terms. • Hedges such as very, most, rather, slightly, more or less etc. • Therefore, the purpose of the hedge is to create a larger set of values for a linguistic variable from a small collection of primary atomic terms. Hedges – This is achieved using the processes of: • normalisation, • intensifier, • concentration, and • dilation. – For example, using concentration very u is defined by : very u = u2 and very very u = u4. Hedges – Let us assume the following definition for linguistic variable slow (first is membership function, second speed): – u= 1.0/0 + 0.7/20 + 0.3/40 + 0.0/60 + 0.0/80 + 0.0/100. – Then, • Very slow = u2 = 1.0/0 + 0.49/20 + 0.09/40 + 0.0/60 + 0.0/80 + 0.0/100 • Very Very slow = u4 = 1.0/0 + 0.24/0 + 0.008/40 + 0.0/60 + 0.0/80 + 0.0/100 • More or less slow = u0.5 = 1.0/0 + 0.837/20 + 0.548/40 + 0.0/60 + 0.0/80 + 0.0/100 membership Hedges 1 0.9 0.8 more or less 0.7 0.6 slow 0.5 0.4 0.3 very slow 0.2 Speed 0.1 0 very very 0 slow20 40 60 80 100 Hedge rather – The hedge rather is a linguistic modifier that moves each membership by an appropriate amount C. • Setting C to unity we get. • Rather slow = 0.7/0 + 0.3/20 + 0.0/40 + 0.0/60 + 0.0/80 – The slow but not very slow is a modification which is using the connective but, which in turn is an intersection operator. – The membership function in its discrete form was found as follows: • slow = 1.0/0 + 0.7/20 + 0.3/40 + 0.0/60 + 0.0/80 + 0.0/100 • very slow = 1.0/0 + 0.49/20 + 0.09/40 + 0.0/60 + 0.0/80 + 0.0/100 • not very slow = 0.0/0 + 0.51/20 + 0.91/40 + 1.0/60 + 1.0/80 + 1.0/100 • slow but not very slow = min(slow, not very slow) = 0.0/0 + 0.51/20 + 0.3/40 + 0.0/60 + 0.0/80 + 0.0/100 Hedges slow but not very slow and rather slow 1 0.9 0.8 0.7 slow 0.6 slow but not very slow 0.5 0.4 0.3 0.2 0.1 rather slow 0 0 20 40 60 80 100 Hedge slightly – The slightly hedge is the fuzzy set operator for intersection acting on the fuzzy sets Plus slow and Not (Very slow). – Slightly slow = INT(NORM(PLUS slow and NOT VERY slow) where Plus slow is slow to the power of 1.25, and is the intersection operator. • slow = 1.0/0 + 0.7/20 + 0.3/40 + 0.0/60 + 0.0/80 + 0.0/100 • plus slow = 1.0/0 + 0.64/20 + 0.222/40 + 0.0/60 + 0.0/80 + 0.0/100 • not very slow = 0.0/0 + 0.51/20 + 0.91/40 + 1.0/60 + 1.0/80 + 1.0/100 • plus slow and not very slow = min(plus slow, not very slow) = 0.0/0 + 0.51/20 + 0.222/40 + 0.0/60 + 0.0/80 + 0.0/100 Hedges • norm (plus slow and not very slow) = (plus slow and not very slow/max) = 0.0/0 + 1.0/20 + 0.435/40 + 0.0/60 + 0.0/80 + 0.0/100 – slightly slow = int (norm) = 0.0/0 + 1.0/20 + 0.87/40 + 0.0/60 + 0.0/80 +0.0/100. Hedges 1 0.9 not very 0.8 slow 0.7 0.6 0.5 0.4 slightly slow 0.3 0.2 plus slow 0.1 0 0 20 40 60 80 100 Hedges • Now we are in a better position to understand the meaning of the syntactic and semantic rule. – A syntactic rule defines, in a recursive fashion, more term sets by using a hedge. – For instance T(slow)={slow, very slow, very very slow,...}. – The semantic rule defines the meaning of terms such as very slow which can be defined as very slow = (slow)2. – One is obviously allowed either to generate new hedges or to modify the meaning of existing ones Linguistic variables Linguistic variables • Looking at the production rules of either a expert system or a fuzzy expert system one can not see any differences – except that the fuzzy system is employing linguistic descriptors rather than absolute numerical values. – However, both parts of fuzzy rules have associated `levels of belief' something lacking in traditional production rules. • Secondly, with traditional production rules even when more than one rule applies only one executes. – With fuzzy rules all applicable rules contribute in calculating the resulting output. • All in all, fuzzy expert systems require fewer production rules since fuzzy rules embody more information. Linguistic variables • A major reason behind using fuzzy logic is the use of linguistic expressions. • A linguistic variable consists of: – the name of the variable (u), – the term set of the variable (T(u)), – its universe of discourse (U) in which the fuzzy sets are defined, – a syntactic rule for generating the names of values of u, and – a semantic rule for associating with each value its meaning. Linguistic variables • For example: • if u is temperature, • then its term set T(temperature) could be: – T(temperature)={cold, cool, warm, hot} over a universe of discourse U=[0,300]. Linguistic variables linguistic Temperature variable Cold Cool Warm Hot term set fuzzy set representation Fuzzy Set Definitions We can have either continuous or discrete definition of a fuzzy set Linguistic Variable • …. Terms, Degree of Membership, Membership Function, Base Variable….. Recap AI and Expert Systems. Fuzzy logic in this framework Overview of AI – The realization by the Artificial Intelligence community during the 1960's of the weakness of general purpose problem solvers led to the development of expert systems. – Expert systems held the greatest promise for capturing intelligence and have received more attention than any other sub-discipline of Artificial Intelligence. • The term knowledge-based systems is used interchangeably to avoid the mis-understandings and mis-interpretations of the word 'expert'. Expert Systems – Irrespective of the adjective, each such system is designed to operate in one of a variety of narrow areas. – The design involves attempts to model and codify the knowledge of human experts. – One might wonder what makes expert systems different from conventional ones. One might remark that in some sense, any computer program is expert at something. • A payroll program incorporates knowledge about accountancy, but it is not included in the expert class. – The differences originate from the type of programming language employed. – Additionally, expert systems can reason using incomplete data and can generate explanations and justifications, even during execution of their actions. Components of ES – Knowledge-base module: • this is the essential component of any system. • It contains a representation in a variety of forms of knowledge elicited from a human expert – Inference engine module: • the inference engine utilizes the contents of the knowledge base in conjunction with the data given by the user in order to achieve a conclusion. Components of ES – Working memory module: • this is where the user's responses and the system's conclusions for each session are temporarily stored. – Explanation module: • this is an important aspect of an expert system. • Answers from a computer are rarely accepted unquestioningly. • This is particularly true for responses from an expert system. • Any system must be able to explain how it reached its conclusions and why it has not reached a particular result. Components of ES – Justification module: • using this module the system provides the user with justification(s) of why some piece of information is required. – User interface module: • the user of an expert system asks questions, enters data, examines the reasoning etc. • The input-output interface, using menus or restricted language, enables the user to communicate with the system in a simple and uncomplicated way. Methods of inference • Much of the power of an expert system comes from the knowledge embedded in it. • In addition, the way the system infers conclusions is of equal importance. – Most expert systems apply forward and/or backward chaining. • The mode of chaining describes the way in which the production rules are activated. • With forward chaining the user of the expert system asks what conclusions can be made when this data is true. • The expert system might or might not ask for further data. • With backward chaining the user of the expert system asks what conclusions can be made. • The expert system will ask the user for data. Methods of inference – To illustrate the two modes consider the following situation. – As you are driving you notice that behind you is a police car with its lights and siren on. – So the data is `light is on' and `siren is on'. • The expert system will come to a conclusion such as `stop the car' and `someone else to stop the car'. • Obviously, the system can not make a hard decision and asks for more data. – You suddenly realise that the policeman in the car is waving at you. – This third piece of data `policeman is waving at me' suggests to the system that they want you to stop the car rather than someone else. Methods of inference – The previous scenario describes the forward chaining of your expert system which in this case happens to be your brain. – Now, the system starts applying backward chaining. • There are numerous conclusions of why the police want you to stop. • For instance, 50 miles in a 30-mile zone, not-working brake light, stolen plate number, turning to a one-way street etc. • Therefore, your system starts collecting data to support any of the hypothesised reasons. • Since you just passed your MOT, know that this is your car, it is not a one-way street the system deduces that you were overspeeding. Control Strategies • This refers to how the expert system comes to a conclusion, i.e., the mode of reasoning describes the way in which the system as a whole is organised. – For instance, the order of looking at the rules; – how to use meta-rules in order to check for outstanding queries, of a completed goal and the initiation of the evaluation of rules. – The order of looking at the rules usually is in lexical order viz. when scanning rules it will first look at rule 1, and then rule 2 etc. • When it searches, it inspects each rule to see if the left hand conditions are true. Control Strategies • This is achieved by either reading the working memory or by asking questions or by generating further subgoals. • In most cases the system continues to the next rule until all rules have inspected. – All rules that can execute are placed in a conflict set and one of the rules is selected. – The selected rule then executes. This is what is known as the match, select and execute cycle. Fuzzy Logic Principles and Learning Fuzzy Logic Principles • Fuzzy control produces actions using a set of fuzzy rules based on fuzzy logic This involves: fuzzifying: mapping sensor readings into a set of fuzzy inputs fuzzy rule base: a set of IF-THEN rules fuzzy inference: maps fuzzy sets onto other fuzzy sets using membership fncts. defuzzifying: mapping a set of fuzzy outputs onto a set of crisp output commands Fuzzy Control • Fuzzy logic allows for specifying behaviors as fuzzy rules Such behaviors can be smoothly blended together (e.g., Flakey robot) Fuzzy rules can be learned Industrial Application of Fuzzy Logic Control History, State of the Art, and Future Development Uncertainty Types of Uncertainty and the Modeling of Uncertainty • Stochastic Uncertainty: – The Probability of Hitting the Target is 0.8 Lexical Uncertainty: Methods of inference under uncertainty • This is very important to consider when using expert systems since sometimes data is uncertain (i.e., ambiguous, incomplete, noisy etc.). • A number of theories have been devised to deal with uncertainty. – These include classical probability, Bayesian probability, Shannon theory, Dempster-Shafer theory among others. – A popular method of dealing with uncertainty uses certainty factors Methods of inference under uncertainty • The certainty factor indicates the net belief in the conclusion and premises of a rule based on some evidence. • Certainty factors are hand-crafted by asking potential users questions such as `How much do you believe that opening valve x will start a flooding' and `How much do you disbelieve that opening valve x will start a flooding'. • The degree of certainty is the difference between the two responses. Production Rules • Assuming that the knowledge-base module contains knowledge represented in the the format of production rules the following sections introduce the following: • the concept of a production rule • the concept of linguistic variables • the fuzzy inference concept • the concept of fuzzification and how to accomplish the crisp to fuzzy transformation • the concept of defuzzification and how to accomplish the fuzzy to crisp transformation Knowledge presentation using production rules • From a philosophical point the concept of knowledge is highly ambiguous and debatable – knowledge-base builders treat knowledge from a narrower point of view. • This way the knowledge is easier to model and understand. • It remains diverse including: – rules, – facts, – truths, – reasons, – defaults and – heuristics. • The knowledge engineer needs some technique for capturing what is known about the application. Knowledge presentation using production rules • The technique should provide expressive adequacy and notational efficacy. • Knowledge representation is very much under constant research. • Several schemes have been suggested in the literature, namely: – semantic nets, – frames and – logic. • Production rules have also been suggested and are the most popular way of representing knowledge. Knowledge presentation using production rules • Production rules are small chunks of knowledge expressed in the form of if..then statements. – The left hand side (IF) represents the antecedent or conditional part. – The right hand side (THEN) represents the conclusion or action part. – A number of rules collectively define a modularized know-how system. – The principal use of production rules is in the encoding of empirical associations between incoming patterns of data and actions that the system should perform as a consequence. – The production rules are either expressed by an expert of the field, or derived using induction. Fuzzy Logic Control • Fuzzy controller design consist of turning intuitions, and any other information about how to control a system, into set of rules. • These rules can then be applied to the system. • If the rules adequately control the system, the design work is done. • If the rules are inadequate, the way they fail provides information to change the rules. Control a Plant A valve in an internal combustion pressure steam turbine engine that temperature system throttle regulates the amount of vaporized fuel entering the cylindres Rules presentation of ... An Expert system A fuzzy system If temperature > 680 if temperature is hot and pressure < 25 and pressure is low then throttle is 165 then throttle is positive medium Using Fuzzy Logic for Autonomous Vehicle Motion Planning • Findings of Stanford Research Institute (SRI) • Based on the performance of the robot “Flakey” circa 1993 • Discussion of autonomous navigation and path planning in an uncertain environment • Paper: “Using Fuzzy Logic for Autonomous Vehicle Motion Planning” Difficulties of this problem Flakey • Autonomous operation of a mobile robot in a real- world unstructured environment poses a series of problems: – knowledge about the environment is usually: • incomplete • uncertain, and • approximate – Perceptually acquired information is not reliable: • noise introduces uncertainty and imprecision • limited range and visibility introduces incompleteness • errors in interpretation More Difficulties with this Problem Flakey • Real world environments have complex and largely unpredictable dynamics – objects can move – the environment may be modified – features may change • – Vehicle action execution is not reliable: • the results produced by sending a given command to an effector can only be approximately estimated • action execution may fail entirely Robot Architecture using Fuzzy Controller Flakey Map of the LPS rooms Key is “Local Perceptual Space”: LPS is data structure providing geometric picture around vehicle Camera,etc The Fuzzy Controller Flakey • Physical motion based on complex fuzzy controller – Provides a layer of robust high-level motor skills. • Basic building block of controller is a “behavior”: • A behavior is defined as implementing an atomic motor skill aimed at achieving or maintaining a give goal situation – – e.g. follow a wall. Implementing Behaviors Flakey • Each behavioral skill is represented by means of a “desirability function” that expresses preferences over possible actions with reference to the goal: – e.g. a behavior aimed at following a given wall prefers actions that keep the agent parallel to the wall at a safe distance Behavior through Fuzzy Rules Flakey • Each behavior was implemented by a set of fuzzy rules of the form – IF A THEN C • A is composed of fuzzy predicates and connectives, and • C is a fuzzy set of control vectors – An example of a “keep off” behavior rule is: IF obstacle-close-in-front AND NOT obstacle- close-on-left THEN turn-sharp-left Last slide used Fast Reactive Flakey Behaviors • Purely reactive behaviors, intended to provide quick simple reactions to potential dangers typically use sensor data that has undergone little or no interpretation. • Since quick response is necessary to avoid disaster, little processing can be done. Control Structures Flakey • Purposeful behavior like attempting to reach a certain location must take explicit goals into consideration. • Goals represented in the LPS by means of control structures. • Control structure is a triple – S = (A,B,C) • A is a virtual object (artifact) in the LPS • B is a behavior that specifies the way to react to the presence of this object, and • C is a fuzzy predicate expressing the context where the control structure is relevant Control Structure Example S = (A,B,C) Flakey A is a virtual object (artifact) in the LPS B is a behavior that specifies the way to react to the presence of this object, and C is a fuzzy predicate expressing the context where the control structure is relevant • An example control structure is – S1=(CP1, go-to-CP, near(CP1) • CP1 is a control-point (marker for a location), together with a heading and a velocity • go-to-CP reacts to the presence of S1 in the LPS by generating the commands to reach the location, heading and velocity specified by CP1. • go-to-CP includes rules like: – IF facing(CP1) AND too-slow-for(CP1) THEN accelerate-smooth-positive Blending of Behaviors Flakey • Many behaviors can be simultaneously active • Fuzzy controller selects the controls that best satisfy the active behaviors • Satisfaction is weighted by each behavior’s relevance to the current situation. – e.g. can’t follow a wall if there isn’t one • Context dependent blending of behaviors is implemented by combining the output of all the behaviors using context rules Generating a plan: S = (A,B,C) A is a virtual object (artifact) in the LPS B is a behavior that specifies the way to react to the presence of this object, and C is a fuzzy predicate expressing the context where the control structure is relevant Flakey • simple goal-regressing planner used: – based on a topological map annotated with approximate measurements (no obstacles) working backwards from goal. • An example plan might be: S1 = (Obstacle, keep-off, near(Obstacle)) S2 = (Corr1, follow,~near(obstacle) AND at(Corr2) AND ~near(Corr2)) S3 = (Corr2, follow,~near(obstacle) AND at(Corr2) AND ~near(Door5)) S4 = (Door5, cross,~near(Obstacle) AND near(Door5)) Control structure Executing the Plan Flakey • S1 = (Obstacle, keep-off, near(Obstacle)) • S2 = (Corr1, follow,~near(obstacle) AND at(Corr2) AND • ~near(Corr2)) • S3 = (Corr2, follow,~near(obstacle) AND at(Corr2) AND • ~near(Door5)) • S4 = (Door5, cross,~near(Obstacle) AND near(Door5)) More FUZZY LOGIC SYSTEMS APPLICATIONS • 1. Discuss a Fuzzy Logic Control System • 2. Steps in Designing a Fuzzy Logic Control System • 3. Design of a Fuzzy Logic Control System: – Input membership function, – Fuzzy logic rules table, – Output membership function. Components of Fuzzy system: • The components of a conventional expert system and a fuzzy system are the same. • Fuzzy systems though contain `fuzzifiers’. – Fuzzifiers convert crisp numbers into fuzzy numbers, • Fuzzy systems contain `defuzzifiers', – Defuzzifiers convert fuzzy numbers into crisp numbers. Fuzzification • The function of the fuzzification component is to convert crisp numbers to equivalent fuzzy sets. • Please notice that the inputs might require some pre-processing in order to fit the range of the fuzzy system. Defuzzification • The output of the combined operation is defuzzified before being broadcast to the external world. • This implies the conversion of a fuzzy set to a crisp number. • There are several techniques of defuzzification. Conventional vs Fuzzy system Components of a ... conventional expert fuzzy system system precise value physical physical device device fuzzy fuzzifier value precise precise precise value value value fuzzy model knowledge model fuzzy defuzzifier value Sections of a Fuzzy Logic Control System • Fuzzifier section – System inputs with range of values – Mapped to membership function can be non-linear in correspondence • Fuzzy control section – Input fuzzy values – Through fuzzy rules – Produce the fuzzy output values • De-fuzzifier section – Fuzzy output values are combined together in values needed for output Steps in Designing a Fuzzy Logic Control System 1. Identify the system input variables, their ranges, and membership functions. 2. Identify the output variables, their ranges, and membership functions. 3. Identify the rules that describe the relations of the inputs to the outputs. 4. Determine the de-fuzzifier method of combining fuzzy rules into system outputs. Calculate Calculate Fuzzy Combine Inputs Fuzzy Inputs Rule-Base Crisp Output Memberships Outputs Outputs value Fuzzification step Defuzzification step Fuzzification step Example design of a Fuzzy Logic Control System – Cruise Control The block diagram of the intelligent cruise control system. Input membership functions The three input membership functions Fuzzy Logic Rules Table cruise slow / distance from car ahead fast / distance from car ahead speed 15 30 45 60 75 15 30 45 60 75 +10 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 0.15 +5 0.15 0.15 0.35 0.35 0.35 0.15 0.15 0.15 0.35 0.35 0 0.15 0.50 0.50 0.50 0.50 0.15 0.15 0.35 0.50 0.50 -5 0.35 0.65 0.65 0.85 0.85 0.15 0.35 0.50 0.65 0.85 -10 0.35 0.65 0.85 0.85 0.85 0.15 0.50 0.65 0.85 0.85 Output membership function The output is the accelerator percentage change needed to keep the car a safe distance behind the car ahead and to keep the car at cruising speed. Fuzzy Inference: creating fuzzy output • At the end of the fuzzification step the working memory module contains the values of the fuzzified input. – Each production rule is examined and all the rules that have their premises satisfied `fire'. – Hence, the only rules which do not fire are those that at least one of their premises has a membership degree of zero. – In the case that more than one rule fires, this is common and desirable, the system generates a single fuzzy output. • This is achieved by combining all fuzzy outputs. – The single fuzzy output is then passed to the defuzzification module which generates a crisp value. • Then the system is ready to start the entire process all over again. SIMPLE EXAMPLE: a four-rule system • Assumptions – Let X,Y and Z be the linguistic variables. – Let the membership functions be low and high. – Let the membership functions be the same for all linguistic variables. – Define the membership functions as: • low(linguistic) = 1 - t • high(linguistic) = t – where t is a value in the interval [0,1]. A Simple Example (Membership Functions) LOW HIGH A Simple Example (Rules) • The rule base contains the following four rules: – if X is low and Y is low then Z is high (rule-1) – if X is low and Y is high then Z is low (rule-2) – if X is high and Y is low then Z is low (rule-3) – If X is high and Y is high then Z is high (rule-4) A Simple Example (Calculations) • Next assume that the inputs are 0 and 0.32 for the linguistic variables X and Y respectively. – The problem then is to find if Z is high or low and its crisp value. • The next steps are followed: – Step-1: Find the membership grade for the premises of each rule. We have 8 premises but due to replication only 4 are needed. • Low(X) = 1- t = 1-0 = 1 • Low(Y) = 1- t = 1-0.32 = 0.68 • High(X) = t = 0 • High(Y) = t = 0.32 A Simple Example (Calculations) – Step-2: Identify the rules that can fire. In our case only the first two rules can fire since the last two rules have a premise with a zero degree of 1 membership. – Step-3: For each rule that X 0.68 can fire find the strength 0.68 of the firing. Z • Rule-1 = min(1,0.68) = 0.68 • Rule-2 = min(1,0.32) = 0.32 Y . • Note that min is used because the premises are connected with a logical AND. A Simple Example 1 . X 0.32 Z 0.32 •Rule-2 = min(1,0.32) = 0.32 Y A Simple Example (Calculations) – Step-4: All the fuzzy outputs are combined together to form a single fuzzy subset. – One way is to take the pointwise maximum value over all fuzzy outputs. – In our case we have two fuzzy outputs, so for each point we take the maximum value. A Simple Example • The rule base contains the following four rules: – if X is low and Y is low then Z is high (rule-1) – if X is low and Y is high then Z is low (rule-2) – if X is high and Y is low then Z is low (rule-3) – If X is high and Y is high then Z is high (rule-4) MAX In our case we have two fuzzy outputs, so for each point we take the maximum value. A Simple Example (Calculations) – Step-5: The fuzzy combined output needs to be converted to a single crisp value. – Using one method which takes the Average- of-Maxima. With this method one finds the maximum peak of the fuzzy combined output - in our case this is 0.68. – Then one collects all the t values for which the maximum value occurs - in our case there are 42 cases. – Finally, the crisp value is the average of such variables - in our case 0.84. Development Cycle Do not discuss in the class – this is home reading Development Cycle Define model's functional Define post-model and operational characteristics normalisation and data flow Define fuzzy sets Define rules Define acceptable limits Define method of defuzzification for performance Run simulation of system Tune and validate the Connect to production system systems Development Cycle – Step 1: The goal is to establish the characteristics of the system, and also to define the specific operating properties of the proposed fuzzy model. • Traditional systems analysis and knowledge engineering techniques can be employed at this stage. The designer must identify the relevant and appropriate inputs to the system; the basic transformations, if any, that are performed on the inputs,; and what output is expected from the system. • The designer must also decide if the fuzzy system is a subsystem of a `global' system and if so to define where the fuzzy subsystem fits into the `global architecture', or if it is the `global' system itself. • The numerical ranges of inputs and outputs must also be specified. This step applies to the development of all systems. Be prepared to throw away original versions at this stage. Development Cycle – Step 2: The goal is to decompose each control variable (i.e., inputs and outputs) into fuzzy sets and to give unique names to them. • It has been reported in the literature that the number of labels associated with a control variable should generally be odd and between five and nine. • Also, in order to obtain a smooth transition from a state to another each label should overlap somewhat with its neighbours. Overlapping of 10 to 50 percent is advised. • Finally, the density of the fuzzy sets should be highest around the optimal control point of the system and should thin out as the distance from that point increases. Development Cycle • If possible begin with an exhaustive list of production rules • Deal with redundant, impossible and implausible rules and/or conditions later. – When the number of rules increases dramatically, may be several rule-bases might be constructed. – Each rule-base to deal with a particular situation/condition of the system to be modelled. Development Cycle – Step 3: The goal is to obtain the production rules that tie the input values to the output values. – Since each production rule `declares' a small chunk of knowledge, the order in the knowledge base is unimportant. – Nevertheless, in order to maintain the knowledge base one should group the production rules by their premise variable. – How many rules is obviously dependent on the application and is related to the number of control variables. Development Cycle – Step 4: The goal is to decide on the way that is going to be used in order to convert a an output fuzzy set into a crisp solution variable. – As already indicated in another section there are many ways to perform the conversion but by and large, process control applications use the centroid technique. – The rest of the steps are similar to any modelling exercise. For instance, at the end of the fuzzy system construction the process of simulation commences. The model is compared against known test cases and the results are validated. When the results are not as desired changes are made until the desired performance is achieved. Popular Fuzzy Inference Methods Popular Fuzzy Inference Methods • Under the fuzzy inference process the grade of each premise is found and applied to the conclusion part of each rule. – MIN or PRODUCT are two popular inference methods. – With MIN inferencing the output of the conclusion part is clipped off at a height equal to the rule's degree of firing. • This was used in the simple example before and the MIN inference for the first rule is re-shown below • (Recall that the rule's degree of firing was 0.68): MIN 1 Original High 0.9 0.68 0.8 0.7 MIN 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.5 1 PRODUCT • With PRODUCT inferencing the output membership function is scaled by the rule's degree of firing. • Using the first rule of the simple example and the PRODUCT inference we get the following Product 1 Original High 0.9 0.8 0.7 Product 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.5 1 Popular methods for combining outputs Popular methods for combining outputs • Under the combining outputs process all outputs are combined together to produce a single fuzzy output. – MAX and SUM are two popular techniques for combining outputs. – With MAX the pointwise maximum for all fuzzy outputs is taken. – For the first rule of the simple example we used the MAX techniques which resulted in the following diagram: 1 Max 0.9 0.8 0.7 MAX 0.6 0.5 0.4 0.3 Rule 2 0.2 0.1 Rule 1 0 0 0.5 1 SUM • With SUM the pointwise sum for all fuzzy outputs is taken. • Again for the first rule of the simple example we get: 1 0.9 SUM 0.8 0.7 0.6 0.5 Rule 1 0.4 0.3 0.2 0.1 Rule 2 0 0 0.5 1 Popular defuzzification methods • Under the defuzzification process a fuzzy output is converted to a crisp number. – Two of the more popular techniques are the MAXIMUM and the CENTROID. – With MAXIMUM one selects the maximum value of the fuzzy output as the crisp value. – There are several variations to the MAXIMUM theme. • One such variation is the AVERAGE-OF-MAXIMA which was used in the simple example and gave us a crisp value of 0.84. • With the CENTROID method, the center of gravity of the fuzzy output gives the crisp value. • Using PRODUCT inferencing and the SUM combination the CENTROID results in a crisp value of 0.56. Example of calculation of Maximum n fuzzy point * strength of point i 1 n fuzzy point i 1 where n is the total number of fuzzy points (strips). Calculating the output of a rule Ways of Combining Fuzzy Logic Output Values There are four different techniques to combine the fuzzy logic rules output values. They are: • Maximizer • Average • Centroid • Singleton Calculating the output of a rule • Rules have promises which are usually combined together by the connective and. • The output is calculated by taking the degree of membership of the lesser of all premises as the value of the combination and truncating the output fuzzy set at that level. Calculating the output of a rule Output Premise-1 0.45 Truncated at 0.45 0.2 Premise-2 0.2 Combining rule outputs • When all rules have been evaluated a single fuzzy set is calculated by combining all outputs. • The combination involves the connective or. • The single output is calculated by taking the maximum of their respective output fuzzy sets grades at each point along the horizontal axis. Combining rule outputs Output-1 Combined Output 0.2 0.8 Output-2 Think about the set of fuzzy rules as a network with fuzzy literals and operators MIN, MAX, etc. In primary inputs you have Shifted fuzzification, in primary outputs you have horizontally defuzzification. The network analogy is very useful in your thinking about fuzzy logic, mv logic, or any other kind of data structure to store knowledge. Do in class a complete example of designing a fuzzy logic network for a simple robot control with about 6 rules. Discuss various operators and fuzzifiers, defuzzifiers. STATIC, ADAPTIVE, SELF- ORGANISING SYSTEMS STATIC, ADAPTIVE, SELF- ORGANISING SYSTEMS • Up to now we have seen that fuzzy logic supports the task of designing a control system. – What we examined in previous sections is known as the `static' fuzzy system. – In such a system, conventional techniques are employed in order to elicit or induce production rules. – Such a system, receives inputs which are then normalised and converted to fuzzy representations, the knowledge base is executed, an output fuzzy set is generated which is then converted to a crisp value. static' fuzzy system. Input Normalisation and fuzzification Execution of rules Output fuzzy set Inference engine Production rules Fuzzy sets Defuzzification Output STATIC, ADAPTIVE, SELF- ORGANISING SYSTEMS – The rules do not change, except if modified by the hand of the designer, for all the knowledge base lifetime. – Static systems are fine for applications in which the environment is known and predictable. • But because they can not adapt to gradual changes in their environments they can lead to disaster when the assumptions upon which they are built are violated. • An adaptive system adjusts to time or process conditions. • This means that such a system modifies: – the charactersitics of the rules, – the topology of the fuzzy sets, and – the method of defuzzification – among others. An adaptive system Input Buffer Performance metric Normalisation and fuzzification Output fuzzy Execution of rules set Inference engine Production rules Adaptation machine Fuzzy sets Defuzzification Output STATIC, ADAPTIVE, SELF- ORGANISING SYSTEMS • A performance metric, often another expert system or an algorithm, compares the current and the stored array of past solutions and the comparison result is passed to an adaptation machine. • The adaptation machine, often another expert system, decides what changes to make in the underlying fuzzy model. – For instance: • the contribution weights connected with each rule can be modified or • the membership functions re-drawn. Misconceptions about Fuzzy concepts Fuzziness is not Vague • we shall have a look at some propositions. • Dimitris is six feet tall – The first proposition (traditional) has a crisp truth value of either TRUE or FALSE. • He is tall – The second proposition is vague. – It does not provide sufficient information for us to make a decision, either fuzzy or crisp. – We do not know the value of the pronoun. – Is it Dimitris, John or someone else? Fuzziness is not Vague • Andrei is tall – The third proposition is a fuzzy proposition. – It is true to some degree depending in the context, i.e., the universe of discourse. – It might be SomeWhat True if we are referring to basketball players or it might be Very True if we are referring to horse-jockeys. Fuzziness is not Multi-valued logic – The limitations of two-valued logic were recognised very early. – A number of different logic theories based on multiple values of truth have been formulated through the years. – For example, in three-valued logic three truth values have been employed. – These are TRUTH, FALSE, and UNKNOWN represented by 1, 0 and 0.5 respectively. – In 1921 the first N-valued logic was introduced. – The set of truth values Tn were assumed to be evenly divided over the closed interval [0,1]. – Fuzzy logic may be considered as an extension of multi-valued logic but they are somewhat different. – Multi-valued logic is still based on exact reasoning whereas fuzzy logic is approximate reasoning. Fuzziness is not Probability • This is better explained using an example. • Let X be the set of all liquids (i.e., the universe of discourse) . • Let L be a subset of X which includes all suitable for drinking liquids. • Suppose now that you find two bottles, A and B. • The labels do not provide any clues about the contents. • Bottle A label is marked as membership of L is 0.9. • The label of bottle B is marked as probability of L is 0.9. • Given that you have to drink from the one you choose, the problem is of how to interpret the labels. Fuzziness is not Probability • Well, membership of 0.9 means that the contents of A are fairly similar to perfectly potable liquids. • If, for example, a perfectly liquid is pure water then bottle A might contain, say, tonic water. • Probability of 0.9 means something completely different. • You have a 90% chance that the contents are potable and 10% chance that the contents will be unsavoury, some kind of acid maybe. • Hence, with bottle A you might drink something that is not pure but with bottle B you might drink something deadly. So choose bottle A. Fuzziness is not Probability • Opening both bottles you observe beer (bottle A) and hydrochloric acid (bottle B). • The outcome of this observation is that the membership stays the same whereas the probability drops to zero. • All in all: – probability measures the likelihood that a future event will occur, – fuzzy logic measures the ambiguity of events that have already occurred. • In fact, fuzzy sets and probability exist as parts of a greater Generalized Information Theory. • This theory also includes: – Dempster-Shafer evidence theory, – possibility theory, – and so on. Applications of Fuzzy concepts Where is fuzzy logic used? – Fuzzy logic is a powerful problem-solving methodology. • It is used directly and indirectly in a number of applications. – Fuzzy logic is now being applied all over Japan, Europe and more recently in the United States of America. – It is true though that all we ever hear about is Japanese fuzzy logic. – Products such as: • the Panasonic rice cooker, • Hitachi's vacuum cleaner, • Minolta's cameras, • Sony's PalmTop computer, • and so on. – This is not unexpected since Japan adopted the technology first. Where is fuzzy logic used? – whereas in the West companies might keep their fuzzy development secret because of the implication of the word `fuzzy', – or because companies want to preserve competitive advantage, – or because fuzzy logic is embedded in products without advertisement. – Most applications of fuzzy logic use it as the concealed logic system for expert systems. Where is fuzzy logic used? • The areas of potential fuzzy implementation are numerous and not just for control: – Speech recognition, – fault analysis, – decision making, – image analysis, – scheduling – and many more are areas where fuzzy thinking can help. • Hence, fuzzy logic is not just control but can be utilized for other problems. Where is fuzzy logic used? • One business problem, namely that of fraud detection, was recently addressed using fuzzy logic. • The system detects probable fraudulent behavior: – by evaluating all the characteristics of a provider's claim data in parallel, – against the normal behavior of a small ( in demographic terms ) community. • An all-American success story is the use of fuzziness on keeping a commercial refrigerator thermally controlled (0.1 C). – The excitement comes due to the fact that this refrigerator has flown on several space shuttle flights. Where is fuzzy logic used? • Another interesting application has been reported by Aptronix Inc. • Fuzzy logic was there used as a means of determining correct focus distance for cameras with automatic focusing system. • Traditionally, such a camera focuses at the middle of the view finder. • This can be inaccurate though when the object of interest is not at the center. • Using fuzzy logic, three distances are measured from the view finder; left, center and right. • For each measurement a plausibility value is calculated and the measurement with the highest plausibility is deemed as the place where the object of interest is located. When to use Fuzzy Logic? • If the system to be modelled is a linear system which can be represented by a mathematical equation or by a series of rules then straightforward techniques should be used. • Alternatively, if the system is complex, fuzzy logic may be the technique to follow. When to use Fuzzy Logic? • We define a complex system : – when it is nonlinear, time-variant, ill- defined; – when variables are continuous; – when a mathematical model is either too difficult to encode or does not exist or is too complicated and expensive to be evaluated; – when noisy inputs; – and when an expert is available who can specify the rules underlying the system behavior. Summary • Fuzzy logic captures intuitive, human expressions. • Fuzzy sets, statements, and rules are the basis of control. • The technique is extremely powerful, and appears in mills at a growing rate. • It is combined with other methods and is the base of soft computing • Used much in Intelligent Robotics Sources • Paul and Mildred Burkey • Weilin Pan • Xuekun Kou • A. Ferworn • Kevin Morris • Dr Dimitris Tsaptsinos Kingston University, Mathematics http://www.kingston.ac.uk/~ma_s435 ma_s435@kingston.ac.uk