0% found this document useful (0 votes)
13 views8 pages

Fuzzy Logic 4

The document outlines the development process of fuzzy expert systems, detailing steps such as problem specification, fuzzy set determination, rule construction, encoding, and system evaluation. An example of an air conditioning system is used to illustrate these concepts, including the definition of linguistic variables, fuzzy sets for temperature and fan speed, and the application of fuzzy rules. The document emphasizes the importance of tuning the system to enhance performance and ensure it meets initial requirements.

Uploaded by

Milos nikolic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

Fuzzy Logic 4

The document outlines the development process of fuzzy expert systems, detailing steps such as problem specification, fuzzy set determination, rule construction, encoding, and system evaluation. An example of an air conditioning system is used to illustrate these concepts, including the definition of linguistic variables, fuzzy sets for temperature and fan speed, and the application of fuzzy rules. The document emphasizes the importance of tuning the system to enhance performance and ensure it meets initial requirements.

Uploaded by

Milos nikolic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

27.12.2023.

ETF
Beograd

Fuzzy Logic
Developing Fuzzy Expert Systems

Aleksandar Rakić, [email protected]


Accompanying presentation for lectures 2023/2024

Fuzzy Expert System


Development Process

1. Specify the problem; define linguistic variables.

2. Determine fuzzy sets.

3. Bring out 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

1
27.12.2023.

Example: 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
3

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.

Fuzzy sets are defined both for input and output variables!

2
27.12.2023.

Example: Air Conditioner


2. Determine Fuzzy Sets: Temperature
temp
Temp COLD
COLD COOL
COOL PLEASAN
PLEASANT WARM
WARM HOT
((00C).
C) T 1
Temperature Membership Functions

0 Y* N N N N
0.9

0.8
5 Y Y N N N
0.7

Degree of Membership
COLD(temp)

0< (temp)<1 10 N Y N N N
0.6
COOL(temp)
0.5 PLEASANT(temp)

12.5 N Y* N N N
0.4
WARM(temp)
HOT(temp)

15 N Y N N N
0.3

0.2

17.5 N N Y* N N
0.1

20 N N N Y N
0
0 5 10 15 20 25 30
temp [ oC]

22.5 N N N Y* N
25 N N N Y N
 (temp)=0  (temp)=1
27.5 N N N N Y
30 N N N N Y*

Example: Air Conditioner


2. Determine Fuzzy Sets: Fan Speed
speed MINIMAL SLOW MEDIUM FAST BLAST
(RPM) Speed Membership Functions
1

0 Y* N N N N0.9
10 Y N N N N
0.8

0.7
Degree of Membership

MINIMAL(speed)
20 Y Y N N N0.6 SLOW(speed)
MEDIUM(speed)
30 N Y* N N N
0.5
FAST(speed)
0.4
BLAST(speed)
40 N Y N N N0.3
50 N N Y* N N0.1
0.2

60 N N N Y N0 0 10 20 30 40 50 60 70 80 90 100
speed [rpm]

70 N N N Y* N
80 N N N Y Y
90 N N N N Y
100 N N N N Y*

3
27.12.2023.

3. Bring out 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.

Example: 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

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++, Python, Java, or
◼ to apply a fuzzy logic development tool such as
MATLAB Fuzzy Logic Toolbox or Fuzzy Knowledge Builder.

4
27.12.2023.

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.
◼ Evaluation of the system output is performed for test
situations on the several representative values of input variables.
Fuzzy Logic development tools often can generate surface to
help us evaluate and analyze the system’s performance.
◼ Tuning of the system consists of reviewing, adding and/or
changing the membership functions and rules in order to
increase the performance of the system.

Example: Air Conditioner

5a. Evaluate the system


Consider a temperature of 16oC, use the system
to compute the optimal fan speed.

RECALL: Operation of a fuzzy expert system:


◼ Fuzzification: 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.
◼ Aggregation: combination of the outputs of all rules.

◼ Defuzzification: computation of crisp output

10

10

5
27.12.2023.

Example: Air Conditioner


• Fuzzification
Temperature Membership Functions
1

0.9

0.8

0.7

Degree of Membership
COLD(temp)
0.6
COOL(temp)
For temp = 16, 0.5 PLEASANT(temp)

affected input fuzzy sets are: 0.4


WARM(temp)
HOT(temp)
COOL and PLEASANT 0.3

0.2

0.1

0
0 5 10 15 20 25 30
temp [ oC]

COOL(temp) = – temp / 5 + 3.5 PLEASANT(temp) = temp /2.5 - 6


= – 16 / 5 + 3.5 = 16 /2.5 - 6
= 0.3 = 0.4

COLD COOL PLEASANT WARM HOT


temp = 16
0 0.3 0.4 0 0
11

11

Example: Air Conditioner


• Inference
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
1 1
SLOW(speed)
COOL(temp)
0.3
R2(speed)
temp speed
0 5 10 15 20 25 30 0 20 40 60 80 100
RULE 2: IF temp is COOL THEN speed is SLOW
1 1
MEDIUM(speed)
PLEASANT(temp)
0.4
R3(speed)
temp speed
0 5 10 15 20 25 30 0 20 40 60 80 100
RULE 3: IF temp is PLEASANT THEN speed is MEDIUM

Other rules are not affected; their antecedent truth degree is 0.0
and they produce empty fuzzy sets on the output universe! 12

12

6
27.12.2023.

Example: Air Conditioner


1
SLOW(speed)

• Aggregation
0.3 R2(speed)
speed
0 20 40 60 80 100
𝜇𝐴𝐺𝐺 𝑠𝑝𝑒𝑒𝑑 = max [𝜇𝑅1 𝑠𝑝𝑒𝑒𝑑 , 𝜇𝑅2 (𝑠𝑝𝑒𝑒𝑑) , 1
MEDIUM(speed)
𝜇𝑅3 𝑠𝑝𝑒𝑒𝑑 , 𝜇𝑅4 𝑠𝑝𝑒𝑒𝑑 , 𝜇𝑅5 (𝑠𝑝𝑒𝑒𝑑)]
= max [𝜇𝑅2 𝑠𝑝𝑒𝑒𝑑 , 𝜇𝑅3 𝑠𝑝𝑒𝑒𝑑 ] 0.4
R3(speed)
speed
(since 𝜇𝑅1 𝑠𝑝𝑒𝑒𝑑 , 𝜇𝑅4 𝑠𝑝𝑒𝑒𝑑 , and 𝜇𝑅5 𝑠𝑝𝑒𝑒𝑑 are 0 20 40 60 80 100
empty fuzzy sets = zero flat-lined over output universe) 1

0.4 AGG(speed)
0.3
• Defuzzification 0 20 40 60 80 100
speed

𝑛 𝑛
෍ 𝜇𝐴𝐺𝐺 𝑠𝑝𝑒𝑒𝑑𝑗 × 𝑠𝑝𝑒𝑒𝑑𝑗 × Δ𝑠𝑝𝑒𝑒𝑑 ෍ 𝜇𝐴𝐺𝐺 𝑠𝑝𝑒𝑒𝑑𝑗 × 𝑠𝑝𝑒𝑒𝑑𝑗
𝑗=1 𝑗=1
𝒔𝒑𝒆𝒆𝒅𝑪𝑶𝑮 ≈ 𝑛 = 𝑛 Δ𝑠𝑝𝑒𝑒𝑑 = 2.5, 𝑛 = 41
෍ 𝜇𝐴𝐺𝐺 𝑠𝑝𝑒𝑒𝑑𝑗 × Δ𝑠𝑝𝑒𝑒𝑑 ෍ 𝜇𝐴𝐺𝐺 𝑠𝑝𝑒𝑒𝑑𝑗
𝑗=1 𝑗=1

0 0 + 2.5 + ⋯ + 10 + 0.125 12.5 + 0.3 17.5 + 20 + ⋯ 42.5 + 0.4 45 + 47.5 + ⋯ 55 + 0.25 57.5 + 0 60 + ⋯ + 100
=
0 × 5 + 0.125 × 1 + 0.25 × 1 + 0.3 × 11 + 0.4 × 5 + 0.25 × 1 + 0 × 17
= 𝟒𝟓. 𝟓𝟒 𝑹𝑷𝑴
13

13

Input – Output Plot


100

90

80

70

60
fan-speed

50

40

30

20

10

0
0 5 10 15 20 25 30
temp

Example: Air Conditioner More general example:


one input – one output two inputs – one output gives 3D
gives nonlinear transfer transfer surface
characteristic

▪ From input-output point of view, FIS is the static nonlinear mapping of


the input universe(s) to the output one.
▪ So, FIS implementation is possible through look-up table(s)! 14

14

7
27.12.2023.

5b. Tune fuzzy system to improve performance


1. Review input and output variables and, if required, redefine their universes.
2. Review the fuzzy sets:
◼ Revise shapes of the fuzzy sets. In most cases, fuzzy systems are highly
tolerant of a shape approximation.
◼ 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.
◼ If required, define additional sets on the universe of discourse.
Wide fuzzy sets may cause the fuzzy system to perform roughly.
3. Review the existing rule base:
◼ If required, add new rules to the rule base. Encode just as many rules as
needed to cover expected utilization of input universe.
◼ Examine for opportunities to write hedge rules to capture the pathological
behaviour of the system.
◼ Adjust the rule execution weights. Most fuzzy logic tools allow control of
the importance of rules by changing a weight multiplier.
4. Modify engine methods (AND, OR, implication, aggregation, defuzzification). 15

15

You might also like