Title: Fuzzy Expert Systems
1Fuzzy Expert Systems
CS364 Artificial Intelligence
2Fuzzy Expert Systems
- Recap
- Example Air Conditioner
- Example Cart Pole Problem
- Case Study Building a Fuzzy Expert System
- Summary
3Recap
Process of developing a fuzzy expert system
- Specify the problem define linguistic
variables.
2. Determine fuzzy sets.
3. Elicit and construct fuzzy rules.
4. Encode the fuzzy sets, fuzzy rules and
procedures to perform fuzzy inference into
the expert system.
5. Evaluate and tune the system.
4Recap
Operation of a fuzzy expert system
- Fuzzification definition of fuzzy sets, and
- determination of the degree of membership of
crisp - inputs in appropriate fuzzy sets.
- Inference evaluation of fuzzy rules to
produce - an output for each rule.
- Composition aggregation or combination of
- the outputs of all rules.
- Defuzzification computation of crisp output
5Fuzzy Expert Systems
- Recap
- Example Air Conditioner
- Example Cart Pole Problem
- Case Study Building a Fuzzy Expert System
- Summary
6Example Air Conditioner
1a. Specify the problem
Air-conditioning involves the delivery of air,
which can be warmed or cooled and have its
humidity raised or lowered. An air-conditioner is
an apparatus for controlling, especially
lowering, the temperature and humidity of an
enclosed space. An air-conditioner typically has
a fan which blows/cools/circulates fresh air and
has a cooler. The cooler is controlled by a
thermostat. Generally, the amount of air being
compressed is proportional to the ambient
temperature.
1b. Define linguistic variables
- Ambient Temperature
- Air-conditioner Fan Speed
7Example Air Conditioner
2. Determine Fuzzy Sets Temperature
0lt? (T)lt1
? (T)1
? (T)0
8Example Air Conditioner
2. Determine Fuzzy Sets Temperature
9Example Air Conditioner
2. Determine Fuzzy Sets Fan Speed
10Example Air Conditioner
2. Determine Fuzzy Sets Fan Speed
11Example Air Conditioner
3. Elicit and construct fuzzy rules
- RULE 1 IF temp is cold THEN speed is
minimal - RULE 2 IF temp is cool THEN speed
is slow - RULE 3 IF temp is pleasant THEN speed is
medium - RULE 4 IF temp is warm THEN speed is
fast - RULE 5 IF temp is hot THEN speed
is blast
12Example Air Conditioner
3. Encode into an Expert System
4. Evaluate and tune the system
Consider a temperature of 16oC, use the system
to compute the optimal fan speed.
Operation of a Fuzzy Expert System
- Fuzzification
- Inference
- Composition
- Defuzzification
13Example Air Conditioner
? Affected fuzzy sets COOL and PLEASANT
?PLSNT(T) T /2.5 - 6 16
/2.5 - 6 0.4
?COOL(T) T / 5 3.5 16 /
5 3.5 0.3
14Example Air Conditioner
- RULE 1 IF temp is cold THEN speed is
minimal - RULE 2 IF temp is cool THEN speed
is slow - RULE 3 IF temp is pleasant THEN speed is
medium - RULE 4 IF temp is warm THEN speed is
fast - RULE 5 IF temp is hot THEN speed
is blast
15Example Air Conditioner
16Example Air Conditioner
speed is slow (0.3)
speed is medium (0.4)
17Example Air Conditioner
18Fuzzy Expert Systems
- Recap
- Example Air Conditioner
- Example Cart Pole Problem
- Case Study Building a Fuzzy Expert System
- Summary
19Example Cart Pole Problem
The problem is to balance an upright pole,
with a mass m at its head and mass M at its
base. A weightless shaft connects these two
masses. The base can be moved on a horizontal
axis. The task is to determine the FORCE (F)
necessary to balance the pole. The calculation
of the force F involves the measurement of the
angle ? and the angular velocity, w of the pole .
20Example Cart Pole Problem
w
nb negative big, nm negative
medium, ns negative small az approximately
zero ps positive small, pm positive
medium, pb positive big
21Example Cart Pole Problem
The fuzzy sets for ?, and F are based on the
linear equation µ(x)ax b, and are defined
based on the following table
w
22Example Cart Pole Problem
- Based on the fuzzy sets table draw three
graphs showing - the fuzzy sets (nb, nm, ns, az, ps, pm,
pb) for each ?, w, - and F individually.
(b) Consider the case when the input
variables are ? 50, -5. Use the
rule base, execute each of the four tasks to
compute the force F necessary to
balance the pole using the Centre of
Gravity in the Defuzzification task.
23Example Cart Pole Problem
- Fuzzification
- Determine where ? and the angular velocity fall
in the table - ? pm, pb
- w az
- Formulate possible rules from linguistic values
obtained -
IF ? is pm AND w is az THEN F is pm IF ?
is pb AND w is az THEN F is pb
24Example Cart Pole Problem
Fuzzification iii) Compute membership functions
-11.25 -5
0
10
25Example Cart Pole Problem
Inference
26Example Cart Pole Problem
Composition
Defuzzification
27Fuzzy Expert Systems
- Recap
- Example Air Conditioner
- Example Cart Pole Problem
- Case Study Building a Fuzzy Expert System
- Summary
28Case Study Building a Fuzzy Expert System
Step 1 Specify the problem and define
linguistic variables
A service centre keeps spare parts and repairs
failed ones. A customer brings a failed item and
receives a spare of the same type. Failed parts
are repaired, placed on the shelf, and thus
become spares. The objective is to advise a
manager of the service centre on certain decision
policies to keep the customers satisfied.
There are four main linguistic variables
average waiting time (mean delay) m, repair
utilisation factor of the service centre ?,
number of servers s, and initial number of spare
parts n.
29Linguistic variables and their ranges
30Step 2 Determine fuzzy sets
Fuzzy sets can have a variety of shapes.
However, a triangle or a trapezoid can often
provide an adequate representation of the expert
knowledge, and at the same time, significantly
simplifies the process of computation.
31Fuzzy sets of Mean Delay m
32Fuzzy sets of Number of Servers s
33Fuzzy sets of Repair Utilisation Factor ?
34Fuzzy sets of Number of Spares n
35Step 3 Elicit and construct fuzzy rules
To accomplish this task, we might ask the expert
to describe how the problem can be solved using
the fuzzy linguistic variables defined
previously. Required knowledge also can be
collected from other sources such as books,
computer databases, flow diagrams and observed
human behaviour.
36The square FAM representation
37The rule table
38Rule Base 1
39Cube FAM of Rule Base 2
40Step 4 Encode the fuzzy sets, fuzzy rules
and procedures to perform fuzzy
inference into the expert system
To accomplish this task, we may choose one of
two options to build our system using a
programming language such as C/C or Pascal, or
to apply a fuzzy logic development tool such as
MATLAB Fuzzy Logic Toolbox or Fuzzy Knowledge
Builder.
41Step 5 Evaluate and tune the system
The last, and the most laborious, task is to
evaluate and tune the system. We want to see
whether our fuzzy system meets the requirements
specified at the beginning. Several test
situations depend on the mean delay, number of
servers and repair utilisation factor. The
Fuzzy Logic Toolbox can generate surface to help
us analyse the systems performance.
42Three-dimensional plots for Rule Base 1
43Three-dimensional plots for Rule Base 1
44Three-dimensional plots for Rule Base 2
45Three-dimensional plots for Rule Base 2
46Tune the system.
However, even now, the expert might not be
satisfied with the system performance. To
improve the system performance, we may use
additional sets ? Rather Small and Rather Large ?
on the universe of discourse Number of Servers,
and then extend the rule base.
47Modified fuzzy sets of Number of Servers s
48Cube FAM of Rule Base 3
49Three-dimensional plots for Rule Base 3
50Three-dimensional plots for Rule Base 3
51Tuning fuzzy systems
1. Review model input and output variables, and
if required redefine their ranges.
2. Review the fuzzy sets, and if required
define additional sets on the universe of
discourse. The use of wide fuzzy sets may cause
the fuzzy system to perform roughly.
3. Provide sufficient overlap between
neighbouring sets. It is suggested that
triangle-to-triangle and trapezoid-to-triangle
fuzzy sets should overlap between 25 to 50
of their bases.
524. Review the existing rules, and if required
add new rules to the rule base.
5. Examine the rule base for opportunities to
write hedge rules to capture the pathological
behaviour of the system.
6. Adjust the rule execution weights. Most
fuzzy logic tools allow control of the
importance of rules by changing a weight
multiplier.
7. Revise shapes of the fuzzy sets. In most
cases, fuzzy systems are highly tolerant of a
shape approximation.
53Fuzzy Expert Systems
- Recap
- Example Air Conditioner
- Example Cart Pole Problem
- Case Study Building a Fuzzy Expert System
- Summary
54Summary
- Process of developing a fuzzy expert system
- Operation of a fuzzy expert system
- Examples Air Conditioner Cart Pole Problem
- Case Study Building a Fuzzy Expert System