Fuzz Logic Andrew Kusiak 239 Seamans Center Iowa Cit, IA 52242 527 andrew-kusiak@uiowa.edu http://www.icaen.uiowa.edu/~ankusiak (Based on the material provided b Professor V. Kecman) What is Fuzz Logic? Fuzz logic is a tool for embedding human knowledge (eperience, epertise, heuristics) Wh Fuzz Logic? Human knowledge is fuzz: epressed in fuzz linguistic terms, e.g., oung, old, large, cheap. Temperature is epressed as cold, warm or hot. No quantitative meaning. Fuzz Logic Fuzz logic ma be viewed as a bridge over the ecessivel wide gap between the precision of classical crisp logic and the imprecision of both the real world and its human interpretation Paraphrasing L. Zadeh Fuzz Logic Fuzz logic attempts to model the wa of reasoning of the human brain. Almost all of human eperience can be epressed in the form of the IF -THEN rules. Human reasoning is pervasivel approimate, non-quantitative, linguistic, and dispositional (meaning, usuall qualified). The World is Not Binar! Gradual transitions and ambiguities at the boundaries Good, Da, Young, Health, YES, True, Happ, Tall,, Bad, Night, Old, Ill NO False, Sad, Short,,
When and Wh to Appl FL? Human knowledge is available Mathematical model is unknown or impossible to obtain Process substantiall nonlinear Lack of precise sensor information When and Wh to Appl FL? At higher levels of hierarchical control sstems In decision making processes How to Transfer Human Knowledge Into the Model? Knowledge must be structured. Possible shortcomings: Knowledge is subjective Eperts ma bounce between etreme points of view: Have problems with structuring the knowledge, or Too aware in his/hers epertise, or Tend to hide knowledge, or... Solution: Find a good epert. Fuzz Sets vs Crisp Sets Crisp Sets Fuzz Sets Fuzz Sets vs Crisp Sets Crisp Sets Fuzz Sets Modeling or Approimating a Function: Curve or Surface Fitting m m Venn Diagrams µ - membership degree, possibilit distribution, grade of belonging Names used in other disciplines: regression (L or NL), estimation, identification, filtering
Modeling a Function Standard mathematical approach of curve fitting (more or less satisfactor fit) Modeling a Function Curve fitting b using fuzz rules (patches) Surface approimation for 2 inputs or hper-surface (3 or more inputs) Modeling a Function Small number of rules - Large patches or rough approimation More rules - more smaller patches and better approimation What is the origin of the patches and how do the work? Consider modeling two different functions b fuzz rules Eample Eample Less rules decreases the approimation accurac. An increase in a number of rules increases the precision at the cost of a computation time needed to process these rules. This is the most classical soft computing dilemma - A trade-off between the imprecision and uncertaint on one hand and low solution cost, tractabilit and robustness on the other. The appropriate rules for the two functions are: Eample IF is low THEN is high. IF is low THEN is high. IF is medium THEN is low. IF is medium THEN is medium. IF is large THEN is high. IF is large THEN is low.
Eample These rules define three large rectangular patches that cover the functions. The are shown in the net slide together with two possible approimators for each function. Eample 2 Modeling two different functions b fuzz rules Eample 2 Humans do not (or onl rarel) think in terms of nonlinear functions. Humans do not draw these functions in their mind. We neither tr to see them as geometrical artifacts. The two original functions (solid lines in both graphs) covered b three patches produced b IF-THEN rules and modeled b two possible approimators (dashed and dotted curves). In general, we do not process geometrical figures, curves, surfaces or hpersurfaces while performing some tasks or epressing our knowledge. Eample 2 Eample 2 Car Eample Even more, our epertise or understanding of some functional dependencies is ver often not a structured piece of knowledge at all. We tpicall perform comple tasks without being able to epress how the are eecuted. Eplain to our colleague in the form of IF- THEN rules how to ride a bike. The steps in fuzz modeling are alwas the same. i) Define the variables of relevance, interest or importance: In engineering we use to call them input and output variables ii) Define the subsets intervals: Small - medium, or negative - positive, or Left - right (labels are variables dependant)
Car Eample Car Eample Car Eample iii) Choose the shapes and the positions of fuzz subsets, i.e., Membership functions, i.e., attributes iv) Set the rule form, i.e., IF - THEN Rules INPUTS: D = DISTANCE, v = SPEED OUTPUT: B = BRAKING FORCE D B D B v v) Perform computations and (if needed) tune (learn, adjust, adapt) the positions and the shapes of both the input and the output attributes of the model v Analze the rules for some given distance D and for different velocit v, i.e., B = f(v) Car Eample Velocit Low High Small High High Low Car Eample The fuzz patch High Low Car Eample The fuzz patches 2 (km/h) IF the Velocit is Low, THEN the is Small IF the Velocit is, THEN the is IF the Velocit is High THEN the is High, 2 Small High Velocit 2 Small High Velocit
The Fuzz Patches Define the Function High Low Car Eample The fuzz patches Note the overlapping of fuzz subsets that leads to a smooth approimation 2 of the function between the Small High Velocit and Braking Force Velocit Car Eample The Fuzz Patches Define the Function High Low 2 Small High Three possible dependencies between the Velocit and Breaking force. Each of us drives differentl Velocit FUNCTIONAL DEPENDENCE OF THE VARIABLES SURFACE OF KNOWLEDGE Fuzz Control of the Distance Between Two Cars Visualization of 2 INPUTS: D and v, and OUTPUT B is possible. For more inputs everthing remains the same but visualization is not possible. BrakingForce 9 8 7 6 5 4 3 2 2 5 Speed 5 8 6 4 Distance 2 Room Temperature Eample: Slow Eample: Room Temperature Slow Eample: Room Temperature Slow 3 ( o C) 3 ( o C) If Room Temperature is Cold then is Slow 3 ( o C) If Room Temperature is Cold then is Slow If Room Temperature is Warm then is
Eample: Room Temperature Slow Slow Eample: The fuzz patches Slow Eample: The fuzz patches 3 ( o C) If Room Temperature is Cold then is Slow If Room Temperature is Warm then is If Room Temperature is Hot then is 3 ( o C) Room Temperature Room Temperature 3 ( o C) Slow Note the overlapping of fuzz subsets leads to a smooth approimation of the function between the and Temperature Eample: 3 ( Cold o C) Warm Hot The fuzz patches Room Temperature There must be some overlapping of the input fuzz subsets (membership or characteristic functions) if we want to obtain a smooth model O U T P U T VL L M S VS 2 8 6 4 2 I N P U T Eample: VS S M L VL 2 4 6 8 2 If there was no overlapping one obtains the stepwise function as shown net There must be some overlapping of the input fuzz subsets (membership or characteristic functions) if we want to obtain a smooth model O U T P U T VB B M S VS 2 8 6 4 2 Eample: VS S M B VB 2 4 6 8 2 I N P U T
Output Computation: Fuzzification, Inference and Defuzzifaction Room Temperature Slow 22 3 ( o C) R: If Room Temperature is Cold Then is Slow R2: If Room Temperature is Warm Then is R3: If Room Temperature is Hot Then is Eample: After the fuzz modeling is done there is an operational phase: Compute the fan speed when the room temperature = 22 o C NOTE: 22 o C belongs to the subsets Warm and Hot.6 Fuzzification and Inference Room Temperature Slow 22 3 ( o C) If Room Temperature is Cold Then is Slow If Room Temperature is Warm Then is If Room Temperature is Hot Then is Fuzzification and Inference Room Temperature.6.3 Slow 22 3 ( o C) If Room Temperature is Cold then is Slow If Room Temperature is Warm then is If Room Temperature is Hot then is Fuzzification and Inference Room Temperature.6.3 3 ( o C) 22 If Room Temperature is Cold then is Slow If Room Temperature is Warm then is If Room Temperature is Hot then is Slow WHAT IS THE OUTPUT VALUE? Defuzzification 6 The result of the fuzz inference is a fuzz subset composed of the slices of fan speed: (blue) and (red) How to find a crisp (useful in the real world application) value? One of several methods used to obtain a crisp output value is the center of area formula
Eample: Vehicle Turning Problem Generic fuzz logic controller - Developed in Matlab - User friendl - Multiple inputs Man other commercial applications are possible Configuration of the Vehicle Turning Problem Finish θ = Car angle (INPUT ) d = Distance from center line (INPUT 2) φ ma = π/4: Upper bound of steering angle (OUTPUT) v =. m/s d Start Conclusions Fuzz logic can be implemented wherever there is structured human knowledge, epertise, heuristics, eperience. Fuzz logic is not needed whenever there is an analtical closed-form model that, using a reasonable number of equations, can solve a problem in a reasonable time, at the reasonable costs and with higher accurac. Conclusions Finding good (accountable) epert Right choice of the variables Increasing the number of inputs, as well as the number of fuzz subsets per input variable, the number of rules increases eponentiall (curse of dimensionalit) Good news is that there are plent of real life problems and situations that can be solved with small number of rules onl