Unformatted text preview:

Slide 1ReferencesOutlineIntroducing Fuzzy LogicParadox of Self-Reference (just for fun)Fuzzy Membership FunctionsFuzzy Membership FunctionsFuzzy Sets and OperationsFuzzy Set OperationFuzzy Logic or Probability TheoryFuzzy Logic in Game AIExample NPC FSMFSM RulesFuzzy Rules cont’dFuzzy AI DecisionFuzzy AI Decision cont’dDefuzzificationCombinatorial ExplosionThe Combs MethodFuzzy AIFuzzy CBRRestaurant ExampleRestaurant ExampleFuzzy CBR SystemsFuzzy CBR SystemsFuzzy CBR Systems cont’d (PROFIT)Fuzzy CBR Systems cont’d (PROFIT)ConclusionFuzzy LogicBy Andrew ProReferences•Alexander, Thor, “An Optimized Fuzzy Logic Architecture For Decision Making”, AI Game Wisdom.•Bonissone, P. Piero and Cheetham, William, “Fuzzy Case Based Reasoning For Residential Property Valuation” (http://www.rpi.edu/~bonisp/fuzzy-course/99/L10/fuzzycbr4realestate.pdf)•Hansen, Bjarne K., and Riordan, Denis, “Weather Prediction Using Case-Based Reasoning and Fuzzy Set Theory” (http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.16.3814)•Hellman, M., “Fuzzy Logic Introduction” (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.9757&rep=rep1&type=pdf)•Shwab, Brian, AI Game Engine Programming. (http://site.ebrary.com/lib/lehighlibrary/docDetail.action?docID=10074871&force=1)•Zarozinski, Michael, “Imploding Combinatorial Explosion In A Fuzzy System”, Game Programming Gems 2.•http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol4/sbaa/report.htmlOutline•Introduction to Fuzzy Logic•Fuzzy Game AI•Fuzzy Logic in CBRIntroducing Fuzzy Logic•Takes into account the approximate nature of human reasoning–If the light is turned off, the room will be dark. How dark?•Everything in Fuzzy logic is a matter of degree –Binary logic is fixed at a degree of 0 or 1, where fuzzy truth values can be anywhere in the range of [0,1]Paradox of Self-Reference (just for fun)•Liar paradox – “This sentence is false.”–In binary logic, X cannot equal ¬X.–We can use fuzzy logic and declare X to be (.5) false, so ¬((.5)X) = (.5)X. “This sentence is (half) false.” is (half) true.•Epimenedes – A Cretan says: “All Cretans are liars.”–Perhaps he means with a truth value of .999Fuzzy Membership Functions•Fuzzy Logic extends multi-valued logic•A function is defined for each logic value•Instead of values being mutually exclusive like in a normal logic system, the logic values overlap .Fuzzy Membership Functions•Functions can be simple or complex (fuzzily speaking of course)•Which functions could describe the fuzzy value, Tall?Fuzzy Sets and Operations•Fuzzy Set defined by function.–COLD(x) = 1 if temp(x)<= 50(60 – temp(x))/10 if 50<temp(x)<600 if temp(x)>=60–Negation ¬COLD(x) = 0 if temp(x)<= 50(temp(x)-60)/10 if 50<temp(x)<601 if temp(x)>=60•The function and its inverse overlap!Fuzzy Set Operation•A AND Bat x=4.75 A AND B = min(A,B)= .25•A OR Bat x=4.75 A AND B = max(A,B)= .75Fuzzy Logic or Probability Theory•Fuzzy logic deals with the measure of how much a variable is in a particular set.•Probability theory handles subjective probability where a function may map how likely a variable is to be in a particular set.Fuzzy Logic in Game AI•Fuzzy logic can be used in a variety of ways to help game AI seem more human-like•NPC Finite State Machines can be improved by making fuzzy determinations for state transition logicExample NPC FSM•Character stays in state until distance value is crossedFSM Rules•FSM transition rules: State Chase–IF player is close THEN attack–ELSE IF player is far THEN returnHome–ELSE chase•Close and far are crisply defined–Is necessary if distance is the only state transition measureFuzzy Rules cont’d•Fuzzy rules might be–IF player is close THEN attack–IF player is far THEN returnHome–IF player is inbetween THEN chase•Combined with other factors (weapon range, time of day, weather condition) a distance measured close may not be close enough•The NPC now has more varied, interesting behaviorFuzzy AI Decision•Rules are created using every combination of 1 set from each variable.•Rules may be difficult to produce. Variables can be given weights or rule base can be generated by expert.Fuzzy AI Decision cont’d•Each rule has an aggressiveness value (or truth value) using the Fuzzy AND operation.•All-out attack is the best choice because is has the highest degree of truth, but there still is a small part of Fight defensively that wants to be considered. So…Defuzzification•Want to derive a numeric output value for aggressiveness. One method is the center-of-mass method•Take the maximum value from each output variable set. (attack – 53, defend – 18, run – 0)•Create a full output block by capping each membership function at the final output value, then OR the functions.•Find the center of mass.Combinatorial Explosion•For real time AI, this becomes unpractical at a certain point.•Can compromise some of the functionality to significantly reduce the number of rules.The Combs Method•Use rules based on each set’s relationship to the output.•Take output from each rule fired, OR the matching sets to get the overall truth value for each output set.– (Run – 0, Defense – 83, Attack – 60)•Different, but still reasonable–Aggressiveness values fairly close after defuzzificationFuzzy AI•Keep fuzziness in game AI on a small scale•FuSM can be used where states don’t interfere with eachother.–Face modeling can be fuzzy to look more naturalFuzzy CBR•Think about CBR using fuzzy logic–Case is similar or not similar–Retrieval can be more accurate with fuzzy attributes (…symbolic attributes)–Case can be adapted using fuzzy set functions based on differences between problem case and retrieved caseRestaurant ExampleEx’ple Bar Fri Hun Pat Alt Type wait x1 no no yes some yes French yes x4 no yes yes full yes Thai yes x5 no yes no full yes French no x6 yes no yes some no Italian yes x7 yes no no none no Burger no x8 no no yes some no Thai yes x9 yes yes no full no Burger no x10 yes yes yes full yes Italian no x11 no No no none no Thai noRestaurant Example•Bar / No Bar doesn’t really work, but fuzzifying Hungry and Patrons could help–(starving, pretty hungry, a little hungry)•Patrons seems to be begging for


View Full Document

LEHIGH CSE 335 - Fuzzy Logic

Download Fuzzy Logic
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Fuzzy Logic and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Fuzzy Logic 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?