Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fuzzy Logic By Andrew Pro. References Alexander, Thor, “An Optimized Fuzzy Logic Architecture For Decision Making”, AI Game Wisdom. Bonissone, P. Piero.

Similar presentations


Presentation on theme: "Fuzzy Logic By Andrew Pro. References Alexander, Thor, “An Optimized Fuzzy Logic Architecture For Decision Making”, AI Game Wisdom. Bonissone, P. Piero."— Presentation transcript:

1 Fuzzy Logic By Andrew Pro

2 References 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)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)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=rep 1&type=pdf)http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.9757&rep=rep 1&type=pdf Shwab, Brian, AI Game Engine Programming. (http://site.ebrary.com/lib/lehighlibrary/docDetail.action?docID=10074871&f orce=1)http://site.ebrary.com/lib/lehighlibrary/docDetail.action?docID=10074871&f orce=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.html

3 Outline Introduction to Fuzzy Logic Fuzzy Game AI Fuzzy Logic in CBR

4 Introducing 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]

5 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.999

6 Fuzzy 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.

7 Fuzzy Membership Functions Functions can be simple or complex (fuzzily speaking of course) Which functions could describe the fuzzy value, Tall?

8 Fuzzy Sets and Operations Fuzzy Set defined by function. – COLD(x) = 1 if temp(x)<= 50 (60 – temp(x))/10 if 50<temp(x)<60 0 if temp(x)>=60 – Negation ¬COLD(x) = 0 if temp(x)<= 50 (temp(x)-60)/10 if 50<temp(x)<60 1 if temp(x)>=60 The function and its inverse overlap!

9 Fuzzy Set Operation A AND B at x=4.75 A AND B = min(A,B) =.25 A OR B at x=4.75 A AND B = max(A,B) =.75

10 Fuzzy 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.

11 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 logic

12 Example NPC FSM Character stays in state until distance value is crossed

13 FSM 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 measure

14 Fuzzy 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 behavior

15 Fuzzy 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.

16 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…

17 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.

18 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.

19 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 defuzzification

20 Fuzzy 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 natural

21 Fuzzy 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 case

22 Restaurant Example Ex’ple Bar Fri Hun PatAltTypewait x1 no yes some yesFrench yes x4 no yes full yes Thai yes x5 no yes no full yesFrench no x6 yes no yes some noItalianyes x7 yes no none noBurgerno x8 no yes some no Thaiyes x9 yes no full noBurgerno x10 yes full yesItalianno x11 noNo no none no Thaino

23 Restaurant 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 fuzziness. – Is the difference between None and Some really just 1 patron? – Does full actually mean there are no open tables whatsoever?

24 Fuzzy CBR Systems WIND-1 – Weather prediction for airports. Expert identifies fuzzy attributes (cloud ceiling, visibility, etc) – Expert defines similarity thresholds to measure sim between cases. Outputs are fuzzy. (Very near, near, slightly near) – Fuzzy predictor performs more accurately than system finding k-NN using crisp attribute values.

25 Fuzzy CBR Systems PROFIT – Fuzzy CBR system for real estate value estimation that uses fuzzy logic in similarity computation, case adaptation, and confidence value generation – Sale comparison approach: “finding the most similar houses, located close to the subject property, sold not too long ago; and selecting a balanced subset of the most promising comparables to derive the final estimate.”

26 Fuzzy CBR Systems cont’d (PROFIT) Similarity functions describing living area, lot size, preferred #bedrooms, and preferred #bathrooms

27 Fuzzy CBR Systems cont’d (PROFIT) Finds most similar cases, applies adjustment rule set using differences to subject case. Similarity rank could differ from net adjustment rank. Discard cases with too much price adjustment. Final estimate = sum(adjPrice*sim)/sum(sim) Confidence assessment using aggregation of fuzzy functions related to cases retrieved, similarity, average price adjustment, etc.

28 Conclusion Fuzzy logic helps represent vague variables and sets in a more natural Game AI can be altered using fuzzy state transitions and/or fuzzy states to add variance to NPCs In Case-Based Reasoning, the Retrieve and Revise steps can benefit from having fuzzy membership functions of case features.


Download ppt "Fuzzy Logic By Andrew Pro. References Alexander, Thor, “An Optimized Fuzzy Logic Architecture For Decision Making”, AI Game Wisdom. Bonissone, P. Piero."

Similar presentations


Ads by Google