Presentation is loading. Please wait.

Presentation is loading. Please wait.

October 2005 0 Fuzzy Expert Systems CS364 Artificial Intelligence.

Similar presentations


Presentation on theme: "October 2005 0 Fuzzy Expert Systems CS364 Artificial Intelligence."— Presentation transcript:

1 October 2005 0 Fuzzy Expert Systems CS364 Artificial Intelligence

2 October 2005 1  Recap  Example: Air Conditioner  Example: Cart Pole Problem  Case Study: Building a Fuzzy Expert System  Summary Fuzzy Expert Systems

3 October 2005 2 1. Specify the problem; define linguistic variables. Recap 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. Process of developing a fuzzy expert system:

4 October 2005 3 Fuzzification: definition of fuzzy sets, and determination of the degree of membership of crisp inputs in appropriate fuzzy sets. Recap 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 Operation of a fuzzy expert system:

5 October 2005 4  Recap  Example: Air Conditioner  Example: Cart Pole Problem  Case Study: Building a Fuzzy Expert System  Summary Fuzzy Expert Systems

6 October 2005 5 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

7 October 2005 6 Example: Air Conditioner 2. Determine Fuzzy Sets: Temperature Temp ( 0 C). COLDCOOLPLEASANTWARMHOT 0Y*NNNN 5YYNNN 10NYNNN 12.5NY*NNN 15NYNNN 17.5NNY*NN 20NNNYN 22.5NNNY*N 25NNNYN 27.5NNNNY 30NNNNY* COLDCOOLPLEASANTWARMHOT 0<  (T)<1  (T)=1  (T)=0

8 October 2005 7 Example: Air Conditioner 2. Determine Fuzzy Sets: Temperature

9 October 2005 8 Example: Air Conditioner 2. Determine Fuzzy Sets: Fan Speed Rev/sec(RPM)MINIMALSLOWMEDIUMFASTBLAST 0Y*NNNN 10YNNNN 20YYNNN 30NY*NNN 40NYNNN 50NNY*NN 60NNNYN 70NNNY*N 80NNNYY 90NNNNY 100NNNNY*

10 October 2005 9 Example: Air Conditioner 2. Determine Fuzzy Sets: Fan Speed

11 October 2005 10 Example: Air Conditioner 3. Elicit and construct fuzzy rules RULE 1: IF is THEN is RULE 1: IF temp is cold THEN speed is minimal RULE 2: IF is THEN is RULE 2: IF temp is cool THEN speed is slow RULE 3: IF is THEN is RULE 3: IF temp is pleasant THEN speed is medium RULE 4: IF is THEN is RULE 4: IF temp is warm THEN speed is fast RULE 5: IF is THEN is RULE 5: IF temp is hot THEN speed is blast

12 October 2005 11 Example: Air Conditioner 3. Encode into an Expert System 4. Evaluate and tune the system Consider a temperature of 16 o C, use the system to compute the optimal fan speed. Operation of a Fuzzy Expert System Fuzzification Inference Composition Defuzzification

13 October 2005 12 Example: Air Conditioner Fuzzification  Affected fuzzy sets: COOL and PLEASANT  COOL (T) = – T / 5 + 3.5 = – 16 / 5 + 3.5 = 0.3  PLSNT (T) = T /2.5 - 6 = 16 /2.5 - 6 = 0.4 Temp=16  COLD  COOL  PLEASANT  WARM  HOT 00.30.400

14 October 2005 13 Example: Air Conditioner Inference RULE 1: IF is THEN is RULE 1: IF temp is cold THEN speed is minimal RULE 2: IF is THEN is RULE 2: IF temp is cool THEN speed is slow RULE 3: IF is THEN is RULE 3: IF temp is pleasant THEN speed is medium RULE 4: IF is THEN is RULE 4: IF temp is warm THEN speed is fast RULE 5: IF is THEN is RULE 5: IF temp is hot THEN speed is blast

15 October 2005 14 Example: Air Conditioner RULE 2: IF temp is cool (0.3) THEN speed is slow (0.3) RULE 3: IF temp is pleasant (0.4) THEN speed is medium (0.4) Inference

16 October 2005 15 Example: Air Conditioner Composition speed is slow (0.3)speed is medium (0.4) +

17 October 2005 16 Example: Air Conditioner Defuzzification COG = 0.125(12.5) + 0.25(15) + 0.3(17.5+20+…+40+42.5) + 0.4(45+47.5+…+52.5+55) + 0.25(57.5) 0.125 + 0.25 + 0.3(11) + 0.4(5) + 0.25 = 45.54rpm

18 October 2005 17  Recap  Example: Air Conditioner  Example: Cart Pole Problem  Case Study: Building a Fuzzy Expert System  Summary Fuzzy Expert Systems

19 October 2005 18 Example: 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,  of the pole. M m g  

20 October 2005 19 nbnbnbnb nmnmnmnm nsnsnsns azazazaz pspspsps pmpmpmpm pbpbpbpb nbnbnbnb pspspsps pbpbpbpb nmnmnmnm pmpmpmpm nsnsnsns nmnmnmnm nsnsnsns pspspsps azazazaz nbnbnbnb nmnmnmnm nsnsnsns azazazaz pspspsps pmpmpmpm pbpbpbpb pspspsps nsnsnsns pspspsps pmpmpmpm pmpmpmpm nmnmnmnm pbpbpbpb nbnbnbnb nsnsnsns Example: Cart Pole Problem nb: negative big,nm: negative medium,ns: negative small az: approximately zero ps: positive small,pm: positive medium,pb: positive big IF is negative medium and  is approximately zero THEN F is negative medium 

21 October 2005 20 Example: 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:   if   if   if  

22 October 2005 21 Example: Cart Pole Problem (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. (a) Based on the fuzzy sets table draw three graphs showing the fuzzy sets (nb, nm, ns, az, ps, pm, pb) for each θ,  and F individually.

23 October 2005 22 Example: Cart Pole Problem Fuzzification i)Determine where θ and the angular velocity fall in the table θ: pm, pb  az ii)Formulate possible rules from linguistic values obtained IF θ is pm AND  is az THEN F is pm IF θ is pb AND  is az THEN F is pb

24 October 2005 23 Example: Cart Pole Problem Fuzzification iii)Compute membership functions -11.25 -5 010 22.5 45 5067.5  45 5067.5 11  1/22.5 =  /17.5  0.78 θ: pm θ: pb 67.55045  1 1/22.5 =  /5  0.22  1  : az 1/11.25 =  /6.25  0.56

25 October 2005 24 Example: Cart Pole Problem Inference The two premises in RULE 1 are conjunctive  minimum of the two: min{0.78, 0.56}=0.56 1IF θ is pm AND  is az THEN F is pm 2IF θ is pb AND  is az THEN F is pb The two premises in RULE 2 are conjunctive  minimum of the two: min{0.22, 0.56}=0.22

26 October 2005 25 Example: Cart Pole Problem Composition ps pb Defuzzification C

27 October 2005 26  Recap  Example: Air Conditioner  Example: Cart Pole Problem  Case Study: Building a Fuzzy Expert System  Summary Fuzzy Expert Systems

28 October 2005 27 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. Case Study: Building a Fuzzy Expert System Step 1: Specify the problem and define linguistic variables 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.

29 October 2005 28 Linguistic variables and their ranges

30 October 2005 29 Step 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.

31 October 2005 30 Fuzzy sets of Mean Delay m

32 October 2005 31 Fuzzy sets of Number of Servers s

33 October 2005 32 Fuzzy sets of Repair Utilisation Factor 

34 October 2005 33 Fuzzy sets of Number of Spares n

35 October 2005 34 Step 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.

36 October 2005 35 The square FAM representation

37 October 2005 36 The rule table

38 October 2005 37 Rule Base 1

39 October 2005 38 Cube FAM of Rule Base 2

40 October 2005 39 Step 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.

41 October 2005 40 Step 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 system’s performance.

42 October 2005 41 Three-dimensional plots for Rule Base 1

43 October 2005 42 Three-dimensional plots for Rule Base 1

44 October 2005 43 Three-dimensional plots for Rule Base 2

45 October 2005 44 Three-dimensional plots for Rule Base 2

46 October 2005 45 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. Tune the system….

47 October 2005 46 Modified fuzzy sets of Number of Servers s

48 October 2005 47 Cube FAM of Rule Base 3

49 October 2005 48 Three-dimensional plots for Rule Base 3

50 October 2005 49 Three-dimensional plots for Rule Base 3

51 October 2005 50 Tuning fuzzy systems 1. Review model input and output variables, and if required redefine their ranges. required redefine their ranges. 2. Review the fuzzy sets, and if required define additional sets on the universe of discourse. additional sets on the universe of discourse. The use of wide fuzzy sets may cause the fuzzy The use of wide fuzzy sets may cause the fuzzy system to perform roughly. system to perform roughly. 3. Provide sufficient overlap between neighbouring sets. It is suggested that triangle-to-triangle and sets. It is suggested that triangle-to-triangle and trapezoid-to-triangle fuzzy sets should overlap trapezoid-to-triangle fuzzy sets should overlap between 25% to 50% of their bases. between 25% to 50% of their bases.

52 October 2005 51 4. Review the existing rules, and if required add new rules to the rule base. rules to the rule base. 5. Examine the rule base for opportunities to write hedge rules to capture the pathological behaviour hedge rules to capture the pathological behaviour of the system. of the system. 6. Adjust the rule execution weights. Most fuzzy logic tools allow control of the importance of rules logic tools allow control of the importance of rules by changing a weight multiplier. by changing a weight multiplier. 7. Revise shapes of the fuzzy sets. In most cases, fuzzy systems are highly tolerant of a shape fuzzy systems are highly tolerant of a shape approximation. approximation.

53 October 2005 52  Recap  Example: Air Conditioner  Example: Cart Pole Problem  Case Study: Building a Fuzzy Expert System  Summary Fuzzy Expert Systems

54 October 2005 53 Summary 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


Download ppt "October 2005 0 Fuzzy Expert Systems CS364 Artificial Intelligence."

Similar presentations


Ads by Google