fuzzy logic and fuzzy systems –x: relationship and membership · 1 fuzzy logic and fuzzy systems...

25
1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science, Department of Computer Science Trinity College, Dublin-2, IRELAND November 19 th , 2008. https://www.cs.tcd.ie/Khurshid.Ahmad/Teaching.html

Upload: others

Post on 19-Oct-2019

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

1

Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership

1

Khurshid Ahmad, Professor of Computer Science,Department of Computer Science

Trinity College,Dublin-2, IRELANDNovember 19th, 2008.

https://www.cs.tcd.ie/Khurshid.Ahmad/Teaching.html

Page 2: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

2

Fuzzy SetsMembership Functions

Triangular MF: trimf x a b c x ab a

c xc b( ; , , ) max min , ,=

−−

−−

0

Trapezoidal MF: trapmf x a b c d x ab a

d xd c( ; , , , ) max min , , ,=

−−

−−

1 0

Generalized bell MF: gbel lmf x a b cx c

b

b( ; , , ) =+

−1

12

Gaussian MF: gaussmf x a b c ex c

( ; , , ) =−

12

2

σ

Page 3: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

3

Fuzzy SetsSigmoid Membership Function

Membership function for "being well-off (or earning around 3K Euros per month)"

00.10.20.30.40.50.60.70.80.9

1

0 5 10 15 20

Monthly Income in Euros

Tru

th V

alue

Series1

))((1

1)( cxawealthy

ex −×−+

Page 4: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

4

Fuzzy SetsGaussian Membership Function

Membership function for the proposition 'about 50 years old'

00.10.20.30.40.50.60.70.80.9

1

0 25 50 75 100

Age

Tru

th V

alue

Series1

250

1050

1

1)(

−+=

xxoldsoorµ

Page 5: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

5

Fuzzy SetsCartesian Products and Patches

The cartesian or cross product of fuzzy subsets A and B, of sets X and Y respectively is denoted as

A ×××× BThis cross product relationship T on the set X ×××× Y is denoted as

T = A ×××× B

EXAMPLEA = {1/a1, 0.6/a2,0.3/a3},

B = {0.6/b1, 0.9/b2,0.1/b3}.

A ×××× B = { 0.6/(a1,b1), 0.9/(a1,b2), 0.1/(a1,b3),0.6/(a2,b1), 0.6/(a2,b2), 0.1/(a2,b3),0.3/(a3,b1), 0.3/(a3,b2), 0.1/(a3,b3)}

))](),([(),( yxMINyx BAT µµµ =

Page 6: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

6

Fuzzy SetsCartesian Products and Patches

More generally, if A1, A2, ……An, are fuzzy subsets of X1, X2, ……Xn, then their cross product

A1× A2× A3 × … × An,is a fuzzy subset of

X1× X2× X3 × … × Xn, and

‘Cross products’ facilitate the mapping of fuzzy subsets that belong to disparate quantities or observations. This mapping is crucial for fuzzy rule based systems in general

and fuzzy control systems in particular.

)]([),.....,,( 321 iiAi

nT xMINxxxx µµ =

Page 7: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

7

Fuzzy SetsFuzzy Relationships

•Electric motors are used in a number of devices; indeed, it is impossible to think of a device in everyday use that does not convert electrical energy into mechanical energy – air conditioners, elevators or lifts, central heating systems, …..•Electric motors are also examples of good control systems that run on simple heuristics relating to the speed of the (inside) rotor in the motor: change the strength of the magnetic field to adjust the speed at which the rotor is moving.

Electric motors can be electromagnetic and electrostatic; most electric motors are rotary but there are linear motors as well.

Page 8: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

8

Fuzzy SetsFuzzy Relationships

•Electric motors are also examples of good control systems that run on simple heuristics relating to the speed of the (inside) rotor in the motor:

If the motor is running too slow, then speed it up.If motor speed is about right, then not much change is needed.If motor speed is too fast, then slow it down.

INPUT: Note the use of reference fuzzy sets representing linguistic values TOO SLOW, ABOUT RIGHT, and, TOO FAST. The three linguistic values form the term set SPEED.

Page 9: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

9

Fuzzy SetsFuzzy Relationships

If the motor is running too slow, then speed it up.If motor speed is about right, then not much change is needed.If motor speed is too fast, then slow it down.

OUTPUT: In order to change speed, an operator of a control plant will have to apply more or less voltage: there are three reference fuzzy sets representing the linguistic values:

increase voltage (speed up); no change (do nothing); and, decrease voltage (slow down).

The three linguistic values for the term set VOLTAGE.

Page 10: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

10

Fuzzy SetsFuzzy Relationships

http://www.fuzzy-logic.com/ch3.htm

A fuzzy patch between the terms SPEED & VOLTAGE.

Page 11: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

11

Fuzzy SetsFuzzy Relationships

Slow down

Not much change

Spee

d up

Too sl

ow

About rightToo fast

2.36

2.40

2.44

2362 2420 2478

Page 12: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

12

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE:In order to understand how two fuzzy subsets are mapped onto each other to obtain a cross product, consider the example of an air-conditioning system. 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 fanwhich blows/cools/circulates fresh air and has cooler and the cooler is under thermostatic control. Generally, the amount of air being compressed is proportional to the ambient temperature.

Consider Johnny’s air-conditioner which has five control switches: COLD, COOL, PLEASANT, WARM and HOT. The corresponding speeds of the motorcontrolling the fan on the air-conditioner has the graduations: MINIMAL, SLOW, MEDIUM, FAST and BLAST.

Page 13: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

13

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE:The rules governing the air-conditioner are as follows:RULE#1: IF TEMPis COLD THEN SPEEDis MINIMAL

RULE#2: IF TEMPis COOL THEN SPEEDis SLOW

RULE#3: IF TEMPis PLEASENT THEN SPEEDis MEDIUM

RULE#4: IF TEMPis WARM THEN SPEEDis FAST

RULE#5: IF TEMPis HOT THEN SPEEDis BLAST

The rules can be expressed as a cross product:CONTROL = TEMP × SPEED

Page 14: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

14

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE:

The rules can be expressed as a cross product:CONTROL = TEMP × SPEED

WHERE:TEMP = {COLD, COOL, PLEASANT, WARM, HOT}

SPEED = {MINIMAL, SLOW, MEDIUM, FAST, BLAST}

)](),([(),(

300&100:1#

)](),([(),(

VTMINVT

RPMVCTIFRULE

VTMINVT

SPEEDTEMPCONTROL

SPEEDTEMPCONTROL

µµµ

µµµ

=≤≤≤≤

=

o

Page 15: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

15

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE (CONTD.):The temperature graduations are related to Johnny’s perception of ambient temperatures:

Y*NNNN30

YNNNN27.5

NYNNN25

NY*NNN22.5

NYNNN20

NNY*YN17.5

NNNY*N12.5

NNNYN10

NNNYY5

NNNNY*0

HOTWARMPLEASANTCOOLCOLDTemp (0C).

Page 16: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

16

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE (CONTD.):Johnny’s perception of the speed of the motor is as follows:

YNNNN90

Y*NNNN100

YYNNN80

NY*NNN70

NYYNN60

NNY*YN50

NNYYN40

NNNY*Y30

NNNYY20

NNNYY10

NNNNY*0

BLASTFASTMEDIUMSLOWMINIMALRev/second (RPM)

Page 17: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

17

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE (CONTD.):The analytically expressed membership for the reference fuzzy subsets for the temperatureare:

301)(

3025115.2

)(''

5.275.225.55

)(

5.225.175.35

)('''

;205.1785.2

)(

5.171565.2

)(''

;5.175.125.35

)(

5.1205.12

)(''

;100110

)(''

)2(

)1(

)2(

)1(

)2(

)1(

)2(

)1(

≥=

≤≤−=

≤≤−−=

≤≤−=

≤≤+−=

≤≤−=

≤≤+−=

≤≤=

≤≤+−=

TT

TT

THOT

TT

T

TT

TWARM

TT

T

TT

TPLEASENT

TT

T

TT

TCOOL

TT

TCOLD

HOT

HOT

WARM

WARM

PLEA

PLEA

SLOW

SLOW

COLD

µ

µ

µ

µ

µ

µ

µ

µ

µ

Page 18: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

18

Fuzzy Systems:Fuzzy Sets and RelationshipsTriangular membership functions can be described through the equations:

100 90 80 70 60 50 40 30 20 10 0

1 0

BLASTFAST

MEDIUM

SLOWSTOP

AIR MOTOR SPEED

45 50 55 60 65 70 75 80 85 90

1 0

CO

LD CO

OL

JUST

R

IGH

T

Temperature in Degrees in F

WA

RM

HO

T

≤≤−−

≤≤−−

=

cx

cxbbc

xc

bxaab

ax

ax

cbaxf

0

,0

),,;(

Page 19: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

19

Fuzzy Systems:Fuzzy Sets and RelationshipsTriangular membership functions can be more elegantly and compactly expressed as

100 90 80 70 60 50 40 30 20 10 0

1 0

BLASTFAST

MEDIUM

SLOWSTOP

AIR MOTOR SPEED

45 50 55 60 65 70 75 80 85 90

1 0

CO

LD CO

OL

JUST

R

IGH

T

Temperature in Degrees in F

WA

RM

HO

T

)0),,max(min(),,;(bc

xc

ab

axcbaxf

−−

−−=

Page 20: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

20

Fuzzy Systems:Fuzzy Sets and Relationships

A graphical representation of the two linguistic variables Speed and Temperature.

100 90 80 70 60 50 40 30 20 10 0

1 0

BLASTFAST

MEDIUM

SLOWSTOP

AIR MOTOR SPEED

45 50 55 60 65 70 75 80 85 90

1 0

CO

LD CO

OL

JUST

R

IGH

T

Temperature in Degrees in FW

AR

M

HO

T

Page 21: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

21

7030BLAST

907050FAST

605040MEDIUM

503010SLOW

130MINIMAL

cbaMembership functionTerm

Fuzzy Systems:Fuzzy Sets and RelationshipsEXAMPLE (CONTD.):The analytically expressed membership for the reference fuzzy subsets for speed are:

ca

VVMINIMAL +−=)(µ

−−

−−= 0,,minmax)(

bc

Vc

ab

aVVSLOWµ

−−

−−= 0,,minmax)(

bc

Vc

ab

aVVMEDIUMµ

−−

−−= 0,,minmax)(

bc

Vc

ab

aVVFASTµ

−= 1,min)(a

cVVBLASTµ

Page 22: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

22

Fuzzy Systems:Fuzzy Sets and Relationships

0-0.252.2555

00250

0.250.251.7545

0.50.51.540

0.750.751.2535

11130

0.751.250.7525

0.51.50.520

0.251.750.2515

02010

Speed (V)

−−

ab

aV

−−

bc

Vc

EXAMPLE (CONTD.):A sample computation of the SLOW membership function as a triangular membership function:

−−

−−= 0,,minmax)(

bc

Vc

ab

aVVSLOWµ

Page 23: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

23

Fuzzy Systems:Fuzzy Patches and Rules

A fuzzy patch is defined by a fuzzy rule: a patch is a mapping of two membership functions, it is a product of two geometrical objects, line segments, triangles, squares etc.

100 90 80 70 60 50 40 30 20 10 0

0

BLAST

FAST

MED

IUM

SLOW

STOP

AIR

MO

TO

R S

PE

ED

45 50 55 60 65 70 75 80 85 90

1 0

CO

LD CO

OL

JUST

R

IGH

T

Temperature in Degrees in F

WA

RM

HO

T

IF WARM THEN FAST

Page 24: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

24

Fuzzy Systems:Fuzzy Patches and Rules

In a fuzzy controller, a rule in the rule set of the controller can be visualized as a ‘device’for generating the product of the input/output fuzzy sets.

Geometrically a patch is an area that represents the causal association between the cause (the inputs) and the effect (the outputs).

The size of the patch indicates the vagueness implicit in the rule as expressed through the membership functions of the inputs and outputs.

Page 25: Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership · 1 Fuzzy Logic and Fuzzy Systems –X: Relationship and Membership 1 Khurshid Ahmad, Professor of Computer Science,

25

Fuzzy Systems:Fuzzy Patches and Rules

The total area occupied by a patch is an indication of the vagueness of a given rule that can be used to generate the patch.

Consider a one-input-one output rule: if the input is crisp and the output is fuzzy then the patch becomes a line. And, if both are crisp sets then the patch is vanishingly small – a point.