19
73 CHAPTER 3 FUZZY INFERENCE SYSTEM Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. There are three types of fuzzy inference system that can be implemented in fuzzy logic tool box: Mamdani-type , Sugeno-type and The Standard Additive Model (SAM). We applied Mamdani model to solve the temperature control problem. [3.1]. THE MAMDANI MODEL. Mamdani model is one of the most useful models which consist of the following rules that describe a mapping from U 1 x U 2 xU 3 …………. U n to W. is and is ………and is Then is (3.1) Where ( J=1,2,…..n) are the input variables, y is the output variable and and are fuzzy sets for and y respectively. Given inputs of the form: ,………………… where ………. are fuzzy subsets of U 1 , U 2 ,U 3 …………. U n , the contribution of rule R i to a mamdani model’s output is a fuzzy set whose membership function is computed by …… (3.2) Where α i is known as matching degree of rule R i and is the matching degree between x J and R i ‘S condition respect to x J . ( ) (3.3)

CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

73

CHAPTER – 3

FUZZY INFERENCE SYSTEM

Fuzzy inference is the process of formulating the mapping from a

given input to an output using fuzzy logic. There are three types of fuzzy

inference system that can be implemented in fuzzy logic tool box:

Mamdani-type , Sugeno-type and The Standard Additive Model (SAM).

We applied Mamdani model to solve the temperature control problem.

[3.1]. THE MAMDANI MODEL.

Mamdani model is one of the most useful models which consist of the

following rules that describe a mapping from U1 x U2 xU3…………. Un

to W.

is and is ………and is Then is (3.1)

Where ( J=1,2,…..n) are the input variables, y is the output variable and

and are fuzzy sets for and y respectively. Given inputs of the

form:

,…………………

where

………. are fuzzy subsets of U1 , U2 ,U3…………. Un,

the contribution of rule Ri to a mamdani model’s output is a fuzzy set

whose membership function is computed by

……

(3.2)

Where αi is known as matching degree of rule Ri and is the matching

degree between xJ and Ri ‘S condition respect to xJ .

( )

(3.3)

Page 2: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

74

the operator ^ denotes the “min” operator. The final output of the model is

the aggregation of outputs from all rules using the max operator:

(3.4)

The output results are fuzzy outputs that could be defuzzified into crisp

output by using defuzzification methods.[49],[50]

[3.2]. THE TSK MODEL .

The Takagi-Sugeno-Kang (TSK) model was introduced by T.Takagi and

M.Sugeno .This model reduce the number of rules required by Mamdani

model, specially for complex and high dimensional problems. To achieve

this goal, the TSK model replaces the fuzzy sets in the consequent part

(then-part) of the Mamdani rule with a linear equation of the input

variables, For example Two input and one output TSK model consist of

rules in the form of

IF x is and y is

THEN z = ax+by+c (3.5)

Where a,b,c are numerical constants. In general, rules in a TSK model have

the form

IF is and y is

THEN y = ( , ,….. ) = + + ….. + (3.6)

Where is the linear model and are real valued parameters .

The inference performed by the TSK model is an interpolation of all the

relevant linear models. The degree of relevance of a linear model is

determined by the degree the input data belongs to the fuzzy subspace

associated with the linear model . These degree of relevance become the

weight in the interpolation process.

Page 3: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

75

The total output of the model is given by the equation below where αi is the

matching degree of rule Ri, which is analogous to the matching degree of

the Mamdani model

(3.7)

The inputs to a TSK model are crisp (non fuzzy) numbers. Therefore, the

degree the input x1 = a1, x2=a2, …………xr= ar , matches ith

rule is typically

computed using the min operator:

(3.8)

However the product operator can be used :

= x

……………… (3.9)

Let us consider a TSK model consisting of the following three rules :

IF x is Small THEN y = L1 (x),

IF x is Medium THEN y= L2(x), (3.10)

IF x is Large THEN y= L3(x),

The output of such a model is

(3.11)

The TSK model provides a powerful tool for modeling complex systems. It

can express highly nonlinear function using a small number of rules. The

potential applicaton of TSK models, hence is very broad.

The great advantage of the TSK model is its representative power; it

can describe a highly nonlinear system using a small number of rules.

Page 4: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

76

Moreover , due to the explicit functional representation form, it is

convenient to identify its parameters using some learning algorithms .[51]

[3.3].THE STANDARD ADDITIVE MODEL (SAM)

The structure of fuzzy rules in SAM is identical to that of the Mamdani

model. It was introduced by B.Kosko [52].There are four differences

between the inference scheme of these two models:

(1) SAM assumes the inputs are crisp, while while Mamdani model

handles both crisp and fuzzy inputs.

(2) SAM uses the scaling inference method while Mamdani uses the

clipping method.

(3) SAM uses addition to combine the conclusion of fuzzy rules, while

the mamdani model uses max.

(4) SAM includes the centroid defuzzification technique, while the

Mamdani model does not insist on a specific defuzzification method.

Let us consider a standard Additive model consisting of rules of the form of

IF x is AND y is THEN z is . (3.12)

Given crisp inputs x= x0, y = y0, the output of the model is

∑ x

x (3.13)

Where centroid is the function that performs the centroid defuzzification.

This is formerly stated in the theorms below

Theorem:

Suppose a SAM model that describes a mapping from U x W to W contains

rules in the form of

IF x is and y is THEN z is .

Then the model’s output from the inputs x=x0; y = y0 is

Page 5: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

77

(3.14)

Where Ai is the are under the ith

rules .Conclusion Ci and gi is the centroid

of Ci (center of gravity) :

∫ (3.15)

If z is a continuous variable.

[3.4]. DESIGNING ANTECEDENT MEMBERSHIP

FUNCTION.

The membership functions of an input variable’s fuzzy sets should usually

be designed in such a way that the following two conditions are satisfied:

(1) Each membership function overlaps only with the closest neighboring

membership functions;

(2) for any possible input data, its membership value in all relevant fuzzy

sets should sum to 1 or (nearly so)

Let us use Ai to denote fuzzy sets of an input variable x. the two guidelines

above may be expressed formally as the two equations below:

1: Ai ∩Aj =ф (3.16)

2: ∑µAi (x) ≈ 1

Two examples of membership functions that do not follow these design

principles are shown in figs 3.1 and 3.2 . Fig 3.1 obviously violets the

second principle because the membership value 10 in three fuzzy sets do

not sum to 1. i.e.,[50]

(3.17)

Page 6: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

78

Figure 3.1 that violets the second principle

Figure 3.2 violets both design principles beccause A1∩A3≠ ф

Two example of membership function that follows these two guide lines

are shown in figure 3.3 and 3.4. The former uses five symmetric

membership functions, whereas the latter uses five asymmetric membership

functions.

Page 7: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

79

Fig 3.3 A Symmetric Membership Function Design Following the guidelines

Fig 3.4 An Asymmetric membership function design following the guidelines

[3.4]. BINARY FUZZY RELATIONS

Composition of binary fuzzy relations can be performed conveniently in

terms of membership matrices of the relations. Let [ ] , [

]

Page 8: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

80

and [ ] be membership matrices of binary relations such that R =

P0Q . We can then write, using this matrix notation,

(i)

(ii)

Fig 3.5 Example of two convenient representation of a fuzzy binary relation: (i) sagital diagram

(ii) membership matrix

[ ] [ ] [ ]

Where

(3.18)

Page 9: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

81

observe that the same elements of P and Q are used in the calculation of R

as would be used in the regular multiplication of matrices, but the product

and sum operations are here replaced with the min and max operations,

respectively.[53]

The following matrix equation illustrates the use of Eq. 3.18 to perform the

standard composition of two binary fuzzy relations represented by their

membership functions:

For example,

.8(= ) = max[min(.3,.9), min(.5,.3), min(.8,1)]

= max[min( ,

),min( ,

), min ( ,

)],

.4(= ) = max[min(.4,.5), min(.6,.2), min(.5,0)]

= max[min( ,

, min( ,

), min ( ,

)]

A similar operation on two binary relations, which differs from the

composition in that it yield triples instead of pairs, is known as the relation

join. For fuzzy relations P(X,Y) and Q(Y,Z), the relational join, P*Q ,

corresponding to the standard max-min composition is a ternary relation

R(X,Y,Z) defined by

R(x, y, z) = [P*Q](x,y,z) = min[P(x,y), Q(y,z)] (3.19)

For each xЄX, yЄY, and zЄZ.

Page 10: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

82

The fact that the relational join produces a ternary relation from two binary

relations is a major differences from the composition, which results in

another binary relation. In fact, the max-min composition is obtained by

aggregating appropriate elements of the corresponding

(i)

(ii)

Page 11: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

83

(iii)

Figure 3.6 composition and join of binary relation.

Join by the max operator. Formally,

[PoQ](x,z) = max[P*Q](x,y,z) (3.20)

For each xЄX, and zЄZ.

[3.5].TEMPERATURE CONTROL PROBLEM.

We want to control the room temperature by air flow mixing. The amount

of hot air flow and cold air flow is controlled by adjusting the voltage to

the pump in the mixing stage. The lowest and highest voltage settings are

denoted by V1 and V2. If the voltage is set at V1, maximal cold air flow

will be allowed. If the voltage is set at V2, maximal hot air flow will be

generated. A voltage between V1 and V2 mixes the hot flow and cold flow

proportionally . Rules for the problem are

R1: If K is Low Then V=V1

R2: If K is High Then V=V2 (3.21)

Page 12: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

84

Fig 3.7 Temperature control system

Rule viewer for the problem is as follows

Fig 3.8 MATLAB generated rule viewer for

The algorithm of fuzzy rule-based inference consists of four basic steps

1.Fuzzy Matching: Calculate the degree to which the input data match the

condition of the fuzzy rules.

2.Inference: Calculate the rule’s conclusion based on its matching degree.

Page 13: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

85

3.Combination: Combine the conclusion inferred by all fuzzy rules in to a

final conclusion.

4.Defuzzification: It is a process to convert a fuzzy conclusion into a crisp

one.

Fuzzy Matching:

Let us consider fuzzy matching for the flow mixing control rules. The

degree to which the input target temperature satisfies the condition of

rule—R1 ”target temperature is Low” is the same as the degree to which

the input target temperature K belongs to the fuzzy set Low. For the

convenience we denote the degree of matching between input data and rule

R as Matching Degree(I,R).Thus We can conclude

Matching Degree( K,R1)= µLow(K)

Matching Degree(K,R2)= µHigh(K)

Let the input target temperature is 370C i.e. K=37

0C

Fig 3.9 Showing the matching degree

Page 14: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

86

When a rule has multiple conditions combined using AND (conjuction), we

simply use a fuzzy conjunction operator to combine the matching degree of

each condition.

In general, the degree to which a rule in the form of

Matches the input data

Is computed by the following formula:

(3.22)

Inference:

After the fuzzy matching step, a fuzzy inference step is invoked for each of

the relevant rules to produce a conclusion based on their matching degree.

There are two methods to produce the conclusion: (1) Clipping method and

(2) scaling method. Both methods generate an inferred conclusion by

suppressing the membership function of the consequent. The extent to

which they suppress the membership function depends on the degree to

which the rule is matched.

Fig 3.10 Showing the working of clipping method

Page 15: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

87

The clipping method cuts off the top of the membership function whose

value is higher then the matching degree.

In the case of a crisp consequent, the two methods degenerate into an

identical one. We recall the rules for the problem

R1: If K is Low Then V=V1

R2: If K is High Then V=V2

To apply fuzzy inference to these rules with crisp consequents, we need to

first convert them into an equivalent fuzzy set representation. For instance,

the crisp value V1 is equivalent to a membership function that assigns value

1 to V1, and 0 to all other values as shown in figure . Similarly, we can

construct the membership function of the crisp value V2 as shown in figure

Fig 3.11 Membership function for crisp values of v1 and v2

It is then straightforward to show that the conclusion V=V3 inferred by rule

R1 and the conclusion V=V4 inferred by R2 have the following membership

function for clipping method:

(3.23)

Page 16: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

88

Figure illustrates this for R3 and a target temperature that is 0.7 degree in

the fuzzy set Low. Hence the conclusion inferred by R3 in this case is

Fig 3.12 Fuzzy inference

Combining fuzzy Conclusions:

A fuzzy rule-based system consists of a set of fuzzy rules with partially

overlapping conditions, a particular input to the system often triggers

multiple fuzzy rules. Therefore, a third step is needed to combine the

inference results of these rules. This is done by superimposing all fuzzy

conclusions about a variable. Combining Fuzzy conclusions through

superimposition is based on applying the max fuzzy disjunction operator to

multiple possibilitybdistributions of the output variable

Page 17: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

89

Fig 3.13 Output voltage with respect to input temperature

Fig 3.14 Showing the control of temperature by voltage supply

Page 18: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

90

Defuzzification:

This is the process to convert fuzzy input into a crisp one. We apply the

Center of Area (COA) or Centroid method to get crisp output. This method

calculates the weighted average of a fuzzy set (John Yen ,Reza Langari et

al. 2007).The result of applying COA defuzzification to a fuzzy conclusion

“Y is A” can be expressed by the formula

∑ (3.24)

If y is discrete and by the formula

∫ (3.25)

If y is continous

Fig 3.15 Fig showing the defuzzified value

Putting All Four Steps Together:

The result of combining all four steps together is shown in figure.

Page 19: CHAPTER 3 FUZZY INFERENCE SYSTEMshodhganga.inflibnet.ac.in/bitstream/10603/134769/9/09_chapter 3.pdfMamdani model does not insist on a specific defuzzification method. Let us consider

91

Fig 3.16 Showing the overall working of fuzzy system

(3.26)

The defuzzified output for the flow mixing controller can be

expressed as a function of the input target temperature using the

above formula .