Fuzzy Logic.

Slides:



Advertisements
Similar presentations
Fuzzy Sets and Fuzzy Logic
Advertisements

 Negnevitsky, Pearson Education, Lecture 5 Fuzzy expert systems: Fuzzy inference n Mamdani fuzzy inference n Sugeno fuzzy inference n Case study.
AI – CS364 Fuzzy Logic Fuzzy Logic 3 03 rd October 2006 Dr Bogdan L. Vrusias
Lecture 4 Fuzzy expert systems: Fuzzy logic
Fuzzy Logic and its Application to Web Caching
Fuzzy Inference and Defuzzification
CS 561, Sessions This time: Fuzzy Logic and Fuzzy Inference Why use fuzzy logic? Tipping example Fuzzy set theory Fuzzy inference.
Fuzzy Logic Steve Foster.
Chapter 14.7 Russell & Norvig. Fuzzy Sets  Rules of thumb frequently stated in “fuzzy” linguistic terms. John is tall. If someone is tall and well-built.
Fuzzy Expert System Fuzzy Logic
AI TECHNIQUES Fuzzy Logic (Fuzzy System). Fuzzy Logic : An Idea.
Fuzzy Expert System. Basic Notions 1.Fuzzy Sets 2.Fuzzy representation in computer 3.Linguistic variables and hedges 4.Operations of fuzzy sets 5.Fuzzy.
Fuzzy Expert Systems. Lecture Outline What is fuzzy thinking? What is fuzzy thinking? Fuzzy sets Fuzzy sets Linguistic variables and hedges Linguistic.
Fuzzy Sets and Fuzzy Logic Chapter 12 M. Tim Jones See also
FUZZY Logic for Game Programmers
Fuzzy Sets and Fuzzification Michael J. Watts
Fuzzy Logic E. Fuzzy Inference Engine. “antecedent” “consequent”
Fuzzy Expert System.
Fuzzy Logic E. Fuzzy Inference Engine. “antecedent” “consequent”
Fuzzy Medical Image Segmentation
1 Chapter 18 Fuzzy Reasoning. 2 Chapter 18 Contents (1) l Bivalent and Multivalent Logics l Linguistic Variables l Fuzzy Sets l Membership Functions l.
WELCOME TO THE WORLD OF FUZZY SYSTEMS. DEFINITION Fuzzy logic is a superset of conventional (Boolean) logic that has been extended to handle the concept.
Fuzzy Logic Dave Saad CS498. Origin Proposed as a mathematical model similar to traditional set theory but with the possibility of partial set membership.
Introduction What is Fuzzy Logic? HOW DOES FL WORK? Differences between Classical set (crisps) and Fuzzy set theory Example 1 Example 2 Classifying Houses.
Introduction to Fuzzy Logic Control
The Equivalence between fuzzy logic controllers and PD controllers for single input systems Professor: Chi-Jo Wang Student: Nguyen Thi Hoai Nam Student.
Fuzzy Logic BY: ASHLEY REYNOLDS. Where Fuzzy Logic Falls in the Field of Mathematics  Mathematics  Mathematical Logic and Foundations  Fuzzy Logic.
Fuzzy Rule-based Models *Neuro-fuzzy and Soft Computing - J.Jang, C. Sun, and, E. Mizutani, Prentice Hall 1997.
BEE4333 Intelligent Control
FUZZY LOGIC Babu Appat. OVERVIEW What is Fuzzy Logic? Where did it begin? Fuzzy Logic vs. Neural Networks Fuzzy Logic in Control Systems Fuzzy Logic in.
9/3/2015Intelligent Systems and Soft Computing1 Lecture 4 Fuzzy expert systems: Fuzzy logic Introduction, or what is fuzzy thinking? Introduction, or what.
Abdul Rahim Ahmad MITM 613 Intelligent System Chapter 3b: Dealing with Uncertainty (Fuzzy Logic)
Fuzzy Logic Conception Introduced by Lotfi Zadeh in 1960s at Berkley Wanted to expand crisp logic.
Fuzzy Sets Introduction/Overview Material for these slides obtained from: Modern Information Retrieval by Ricardo Baeza-Yates and Berthier Ribeiro-Neto.
Fuzzy Logic. Lecture Outline Fuzzy Systems Fuzzy Sets Membership Functions Fuzzy Operators Fuzzy Set Characteristics Fuzziness and Probability.
 Negnevitsky, Pearson Education, Lecture 5 Fuzzy expert systems: Fuzzy inference n Mamdani fuzzy inference n Sugeno fuzzy inference n Case study.
Artificial Intelligence in Game Design Lecture 6: Fuzzy Logic and Fuzzy State Machines.
 Definition Definition  Bit of History Bit of History  Why Fuzzy Logic? Why Fuzzy Logic?  Applications Applications  Fuzzy Logic Operators Fuzzy.
Fuzzy Inference (Expert) System
Artificial Intelligence for Games Lecture 5 1 Minor Games Programming.
Logical Systems and Knowledge Representation Fuzzy Logical Systems 1.
Fuzzy Systems Michael J. Watts
Lógica difusa  Bayesian updating and certainty theory are techniques for handling the uncertainty that arises, or is assumed to arise, from statistical.
Fuzzy Sets and Control. Fuzzy Logic The definition of Fuzzy logic is a form of multi-valued logic derived frommulti-valued logic fuzzy setfuzzy set theory.
“Principles of Soft Computing, 2 nd Edition” by S.N. Sivanandam & SN Deepa Copyright  2011 Wiley India Pvt. Ltd. All rights reserved. CHAPTER 12 FUZZY.
AI Fuzzy Systems. History, State of the Art, and Future Development Sde Seminal Paper “Fuzzy Logic” by Prof. Lotfi Zadeh, Faculty in Electrical.
Fuzzy Expert System n Introduction n Fuzzy sets n Linguistic variables and hedges n Operations of fuzzy sets n Fuzzy rules n Summary.
Could Be Significant.
Fuzzy Logic Artificial Intelligence Chapter 9. Outline Crisp Logic Fuzzy Logic Fuzzy Logic Applications Conclusion “traditional logic”: {true,false}
Aisha Iqbal (CT-084) Kanwal Hakeem (CT-098) Tehreem Mushtaq (CT-078) Talha Syed (CT-111)
Fuzzy Logic 1. Introduction Form of multivalued logic Deals reasoning that is approximate rather than precise The fuzzy logic variables may have a membership.
Fuzzy Relations( 關係 ), Fuzzy Graphs( 圖 形 ), and Fuzzy Arithmetic( 運算 ) Chapter 4.
Introduction to Fuzzy Logic and Fuzzy Systems
Artificial Intelligence CIS 342
Fuzzy Systems Michael J. Watts
Fuzzy expert systems Fuzzy inference Mamdani fuzzy inference
Artificial Intelligence
Fuzzy Logic and Fuzzy Sets
Homework 8 Min Max “Temperature is low” AND “Temperature is middle”
Introduction to Fuzzy Logic
Artificial Intelligence and Adaptive Systems
Fuzzy logic Introduction 3 Fuzzy Inference Aleksandar Rakić
Dr. Unnikrishnan P.C. Professor, EEE
FUZZIFICATION AND DEFUZZIFICATION
Homework 9 Min Max “Temperature is low” AND “Temperature is middle”
Lecture 5 Fuzzy expert systems: Fuzzy inference
Fuzzy Logic Colter McClure.
Dr. Unnikrishnan P.C. Professor, EEE
Fuzzy Logic KH Wong Fuzzy Logic v.9a.
Presentation transcript:

Fuzzy Logic

Fuzzy Logic Lotfi Zadeh (professor at UC Berkeley) wrote his original paper on fuzzy set theory. In various occasions, this is what he said… “Fuzzy logic is a means of presenting problems to computers in a way akin to the way humans solve them” “The essence of fuzzy logic is that everything is a matter of degree” What do these statements really mean?

Fuzzy Logic Very often, we humans analyze situations and solve problems in a rather imprecise manner Do not have all the facts Facts might be uncertain Maybe we only generalize facts without having the precise data or measurements… Real-life example: Playing a game of basketball

Everything is a matter of degree? Is your basketball opponent tall, or average or short? (use of linguistic terms to measure degree) Is 7 feet tall? Is 6 feet 10 inches tall? Are they both considered tall? (overlapping degrees) Problem with traditional Boolean logic You are forced to define a point above which we will consider the guy to be tall or just average, e.g. > 7 ft Fuzzy Logic  allows gray areas or degrees of being considered “tall”

The degree of truth So…you can think of fuzzy logic as classifying something as being TRUE, but to varying degrees Real-life control applications (air-conditioning, household appliances): Traditional Boolean logic will result in abrupt switching of response functions Fuzzy logic alleviates this problem  Responses will vary smoothly given the degree of truth or strength of the input conditions

Fuzzy logic for games A previous game AI example… An AI character makes his decision to chase (using FSM or DT) based on traditional Boolean logic, e.g. distance of player < 20 units, and player health < 50% In fuzzy logic, we can represent these input conditions using a few “membership” degrees of measure Distance: (“Far”, “Average”, “Near”) Health: (“Good”, “Normal”, “Poor”) The output actions can also be represented with different membership degrees (“Chase Fast”, “Chase Slow”)

How to use Fuzzy Logic in Games? 3 possible ways how fuzzy logic can be used in games Control Modulating steering forces, travelling/moving towards target Threat Assessment Assessing player’s strengths/weaknesses for deploying units and making moves Classification Identifying the combat prowess of characters in the game based on a variety of factors in order to choose opponent There are many other possibilities…

Fuzzy Logic Basics Fuzzy control or fuzzy inference process – 3 basic steps

Step 1: Fuzzification Fuzzification: Process of mapping/converting crisp data (real numbers) to fuzzy data Find degree of membership of the crisp input in predefined fuzzy sets E.g. given a character’s health, determine the degree to which it is “Good”, “Fair” or “Poor”. Mapping is achieved using membership functions

Membership Functions Membership Functions Map input variables to a degree of membership, in a fuzzy set, between 0 and 1. Degree 1  absolutely true, degree 0  absolutely false, any degree in between  true or false to a certain extent “Boolean logic membership function”

Membership Functions Fuzzy Membership Functions Enables us to transition gradually from false to true Grade membership function

Membership Functions Triangular m/f Reverse grade m/f Equations are just the inverse of the grade m/f

Membership Functions Trapezoid m/f Other nonlinear m/f Gaussian or Sigmoid ‘S’-shaped curves

Membership Functions Typically, we are interested in the degree of which an input variable falls within a number of qualitative sets

Membership Functions Setting up collections of fuzzy sets for an input variable is a matter of judgment and trial-and-error  not uncommon to “tune” the sets While tuning, one can try different membership functions, increase or decrease number of sets Some fuzzy practitioners recommend 7 fuzzy sets to fully define a practical working range (?!?!?)

Membership Functions One rule of thumb for ensuring smooth transitions (in later steps) is to enforce overlapping between neighboring sets

Hedge Functions Hedge functions are sometimes used to modify the degree of membership Provide additional linguistic constructs that you can use in conjunction with other logical operations. Two common hedges: VERY(Truth(A)) = Truth(A)2 NOT_VERY(Truth(A)) = Truth(A)0.5 (Truth(A) is the degree of membership of A in some fuzzy set)

Step 2: Fuzzy Rules Next, construct a set of rules, combining the input in some logical manner, to yield some output If-then style rules (if A then B) – A being the antecedent/premise and B being the consequent/conclusion Fuzzy input variables are combined logically to form premise Conclusion will be the degree of membership of some output fuzzy set

Fuzzy Axioms Since we are writing “logical” rules with fuzzy input, we need a way to apply logical operators to fuzzy input (just like with Boolean input) Logical OR (disjunction) Truth(A OR B) = MAX(Truth(A), Truth(B)) Logical AND (conjunction) Truth(A AND B) = MIN(Truth(A), Truth(B)) Logical NOT (negation) Truth(NOT A) = 1 – Truth(A)

Fuzzy Axioms Example, given a person is overweight to the degree of 0.7 and tall to the degree of 0.3: Overweight AND tall = MIN(0.7, 0.3) = 0.3 Overweight OR tall = MAX(0.7, 0.3) = 0.7 NOT overweight = 1 – 0.7 = 0.3 NOT tall = 1 – 0.3 = 0.7 NOT(overweight AND tall) = 1 – MIN(0.7, 0.3) = 0.7 There are other definitions for these logical operators…

Rule Evaluation Unlike traditional Boolean logic, Rules in fuzzy logic can evaluate into any number between 0 and 1 (not just 0 or 1) All rules are evaluated in parallel (not in series that the first one that is true gets fired). Each rule always fires, to various degrees The strength of each rule represents the degree of membership in the output fuzzy set

Rule Evaluation Example: Evaluating whether an AI should attack player Rules can be written like: If (in melee range AND uninjured) AND NOT hard then attack Set up as many rules to handle all possibilities in the game

Rule Evaluation Given specific degrees for the input variables, you might get outputs (conclusions of the rules) that look something like this: Attack to degree: 0.2 Do nothing to degree: 0.4 Flee to degree: 0.7 The most straightforward way to interpret these outputs is to take the action associated with the highest degree (in this case, the action will be flee)

Step 3: Defuzzification In some cases, you might want to use the fuzzy output degree to determine a crisp value (real number), which can be useful for further calculations Defuzzification: Process of converting the results from the fuzzy rules to get a crisp number as an output Opposite of fuzzification (you can say that, although the purpose and methods are different!)

Step 3: Defuzzification Previous example: Instead of determining some finite action (do nothing, flee, attack), we also want to use the output to determine the speed to take the action To get a crisp number, aggregate the output strengths on the predefined output membership functions

Step 3: Defuzzification With the numerical output from the earlier example (0.2 degree attack, 0.4 degree do nothing, 0.7 degree flee), we have the composite membership function below

Defuzzifying composite m/f Truncate each output set to the output degree of membership for that set. Then combine all output sets by disjunction A crisp number can be arrived from such an output fuzzy set in many ways Geometric centroid of the area under the output fuzzy set, taking its horizontal axis coordinate as the crisp output

Using “predefuzzified” output A less computationally expensive method is the use of singleton output membership function or a “predefuzzified” output function Instead of doing lots of calculation, assign speeds to each output action (-10 for flee, 1 for do nothing, 10 for attack). E.g. The resulting speed for flee is simply the preset value of -10 times the degree to which the output action flee is true (-10 x 0.7 = -7)

Using “predefuzzified” output Aggregate of all outputs with a simple weighted average In our example, we might have: Output = [(0.7)(-10) + (0.4)(1) + (0.3)(10)] / (0.7+0.4+0.3) = -2.5 This output would result in the creature fleeing, but not earnestly in full extent Naturally, we can obtain various output (crisp) values depending on the different input conditions

Further Examples There are 2 good examples in the textbook, showing the full process of using fuzzy logic to model game AI characters

Using Fuzzy Logic in FSMs? If we want to add some fuzzy logic into FSMs, how can that be accomplish? Is it possible? Remember: Each state defines a behavior or action, and each state is reached by transition from another state on the basis of fulfilling some input conditions… Conditions for transition are normally in Boolean logic, how do we accommodate fuzzy logic?

Fuzzy State Machines Different AI developers regard Fuzzy State Machines differently State machine with fuzzy states State transitions that use fuzzy logic to trigger Both Find out more about how these different variations can be worked out and implemented (refer to Millington book)

… Next up Upcoming lectures Homework 2 (due in Week 10, submission via mail) Milestone #2 (due in Week 11, 11.00am 23/8, Thurs) Upcoming lectures Probabilities and Uncertainty Techniques Tactical and Strategic AI