Reading
First, an intro to fuzzy logic: http://www.cs.cmu.edu/Groups/AI/html/faqs/ai/fuzzy/part1/faq-doc-2.html
Then, how it's applied: http://www.cs.cmu.edu/Groups/AI/html/faqs/ai/fuzzy/part1/faq-doc-4.html
Answer these questions:
1) What is 'fuzzification'?
2) What is the universe of discourse?
3) If you were to represent a fuzzy subset in code (in whatever language you like),
what data types would you use?
4) Make a membership function for the fuzzy subset HOT, which maps from temperatures
(or people, if you like) to membership values. It can be completely arbitrary.
5) What are the four steps for applying fuzzy logic?
6) What are some applications of MIN or PRODUCT inferencing?
7) Similarly, what are some applications of MAX or SUM composition?
8) When would you need to defuzzify a fuzzy subset into a crisp value?
9) Can you give some examples (or maybe just one) of a fuzzy expert system?
Lecture Notes
See attached slide show.
In-Class Activity
For an in-class activity (probably to be done during the lecture), I would present the scenario of a coffee machine that needs to brew coffee to a "reasonable" temperature. I would ask each table to come up with a few rules to govern the system, and define any linguistic variables they would use.
Quiz Question(s)
1) x, y, and z are all in the range [1, 10]
low(t) = 1 - ( t / 10 )
high(t) = t / 10
rule 1: if x is low AND y is low then z is low
rule 2: if x is low AND y is high then z is high
rule 3: if x is high AND y is low then z is high
rule 4: if x is high AND y is high then z is low
Given the inputs x = 0 and y = 5, answer the following questions:
a) What are the low and high values of x and y?
ANS: low(x) = 1.0, high(x) = 0.0
low(y) = .5, high(y) = .5
b) What are the corresponding alpha values for each of the rules?
a1 = 0.5
a2 = 0.5
a3 = 0.0
a4 = 0.0
c) Using Product-Sum Composition, what is the fuzzy subset describing the output?
.5
d) Using any defuzzification method, defuzzify this into a crisp value.
Slightly trick question--it already kind of is one. Any defuzzification method would return (0.5).
Homework Exercise
Model a physical system that would use fuzzy logic on multiple inputs to create an output. You will need to:
Establish the range for the inputs.
List the rules for the system. It should have at least 3 rules.
Then, for a few points of example data, give me the output, showing each step in the process:
Alpha values for each rule.
Inferred fuzzy subsets for each rule.
The composed fuzzy subset.
The crisp value generated by the logic rules.
Feel free to use any (established) method for inference, composition, and defuzzification, as long as you state what method you are using.
SAMPLE HOMEWORK SOLUTION:
Imagine a robotic fan that alters motor speed based on how cold it is in the room, and how far away a target is. Two inputs, temperature (t) and distance (d), and one output, motor speed (s). Normalize the input values from a reasonable range (say 40-90 for temp, 0-10 feet for distance) to a range [1, 10]. The fuzzy subsets for these might be defined as:
low(x) = 1 - (x / 10)
mid(x) = 1 - (abs(x - 5) / 5)
high(x) = x / 10
A few rules might be:
If t is LOW and d is LOW, s is LOW.
If t is LOW and d is HIGH, s is MID.
If t is HIGH and d is LOW, s is MID.
If t is HIGH and d is HIGH, s is HIGH.
Imagine the inputs t = 7 and d = 4. The HIGH/MID/LOW values for the inputs would be:
high(t) = .7 mid(t) = .6 low(t) = .3
high(d) = .4 mid(d) = .8 low(d) = .6
The alpha values would be:
rule1(s) = .3
rule2(s) = .4
rule3(s) = .6
rule4(s) = .4
Product inference would result in:
rule1(s) = .3 - .03s
rule2(s) = .4 - 0.08(abs(s - 5))
rule3(s) = .6 - 0.12(abs(s - 5))
rule4(s) = .04s
Sum Composition would result in:
fuzzy(s) = 1.3 - .01s - 0.08(abs(s - 5)) - 0.12(abs(s - 5))
Max defuzzification would result in 5.