You are on page 1of 29

15

o
C
20
o
C
Nhit 32
o
C
Lnh
Bnh thng
Nng
1. Logic mnh (logic truyn thng)
C s chnh ca logic mnh l ta ch quan tm n 2 tiu chun sau:
- Mnh
- Chn tr (1 v 0)
T 2 c s chnh ny ta suy ra c 2 gi tr chn l l: ng (1) v sai (0).
Nh vy logic mnh lun tun theo 2 gi tr gi thuyt nh sau:
- Gi thuyt 1 l tnh thnh vin ca tp hp: Vi mt phn t v mt tp hp bt k,
th phn t hoc l thuc tp hp , hoc thuc phn b ca tp .
- Gi thuyt 2 l nh lut loi tr trung gian, khng nh mt phn t khng th va
thuc mt tp hp va thuc phn b ca n.
V d 1.1: Ta c nhng lp lun nh sau th khng th p dng logic mnh c:
Nu c mt bi ton no c p dng logic mnh , m bi ton li c gi tr
ng (1) cng khng hn l ng, m sai (0) cng khng hn l sai nh vy ta khng th
p dng logic mnh tnh ton.
V d 1.2: Nu nhit di 20 C th lnh, cn nhit t 21 C n 32 C l bnh
thng, ngc li t 32 C tr ln l nng. Hnh 1.2 bn di minh ha tp hp
LNH gm tt c cc nhit t 20 C tr xung, cn NNG gm tt c cc nhit
t 32 C tr ln.







Hnh 1.2: Biu din tp nhit Lnh, Bnh thng v Nng
Qua biu din ca hnh trn ta thy khng th p dng logic mnh phn bit cc
thnh phn trong cng mt tp hp. Gi s ta xt trng hp v nhit lnh gia hai
nhit 10 C v 8 C, th logic mnh khng th hin c nhit no lnh hn
nhit no, cn gi s ta xt trng hp nhit nng gia hai nhit 40 C v 50
C, th logic mnh cng khng th hin c nhit no nng hn nhit no.
Nh vy i vi logic mnh th khng th gii quyt c cc d kin mang tnh m
h, khng chnh xc, m trong thc t li c rt nhiu pht biu bng ngn ng t
nhin dng ny.
V d 1.3:
- An kh cao vy An c thuc tp hp nhng ngi cao hay khng?
- An kh thng minh nh th no l thng minh
Nhng d kin mang tnh khng r rng trn th logic mnh khng th no biu din
c.
Quy tc tnh ton ca logic mnh : Trong logic mnh tnh ton suy lun ta c 5
php ton c bn sau:
STT Php ton ngha
1
(
Ph nh
2
.
V
3
v
Hay
4

Php ko theo
5

Php ko theo 2 chiu

2. Tp m
a. Khi nim tp m
Mt tp hp trong mt khng gian no , theo khi nim c in s chia khng
gian thnh 2 phn r rng. Mt phn t bt k trong khng gian s thuc hoc khng
thuc vo tp cho. Tp hp nh vy cn c gi l tp r. L thuyt tp hp c in
l nn tng cho nhiu ngnh khoa hc, chng t vai tr quan trng ca mnh. Nhng
nhng yu cu pht sinh trong khoa hc cng nh cuc sng cho thy rng l thuyt
tp hp c in cn phi c m rng.
Ta xt tp hp nhng ngi tr. Ta thy rng ngi di 26 tui th r rng l tr
v ngi trn 60 tui th r rng l khng tr. Nhng nhng ngi c tui t 26 n 60 th
c thuc tp hp nhng ngi tr hay khng? Nu p dng khi nim tp hp c in th
ta phi nh ra mt ranh gii r rng v mang tnh cht p t, chng hn l 45 tui xc
nh tp hp nhng ngi tr. V trong thc t th c mt ranh gii m ngn cch
nhng ngi tr v nhng ngi khng tr l nhng ngi trung nin. Nh vy, nhng
ngi trung nin l nhng ngi c mt tr no . Nu coi tr ca ngi di
26 tui l hon ton ng tc l c gi tr l 1 v coi tr ca ngi trn 60 tui l
hon ton sai tc l c gi tr l 0, th tr ca ngi trung nin s c gi tr p no
tho 0 < p < 1 (c ngha l: p e [0, 1]).
Nh vy nhu cu m rng khi nim tp hp v l thuyt tp hp l hon ton t
nhin. Cc cng trnh nghin cu v l thuyt tp m v logic m c L.Zadeh cng
b u tin nm 1965, v sau lin tc pht trin mnh m.
nh ngha: Cho khng gian nn U, tp A c U c gi l tp m nu A c xc nh
bi hm:
A
:X->[0,1]
-
A
c gi l hm thuc, hm lin thuc hay hm thnh vin (membership
function)
- Vi xeX th
A
(x) c gi l mc thuc ca x vo A.
Nh vy ta c th coi tp r l mt trng hp c bit ca tp m, trong hm thuc
ch nhn 2 gi tr 0 v 1.
K hiu tp m, ta c cc dng k hiu sau:
Lit k phn t: gi s U={a,b,c,d} ta c th xc nh mt tp m A=
d c b a
0 2 . 0 3 . 0 1 . 0
+ + +
A = ( ) { } U x x x
A
e | ) ( ,
A =

eU x
A
x
x) (
trong trng hp U l khng gian ri rc
A =
}
U
A
x x / ) ( trong trng hp U l khng gian lin tc
Lu l cc k hiu

v
}
khng phi l cc php tnh tng hay tch phn, m ch l
k hiu biu th tp hp m.
V d: Tp m A l tp s gn 2 xc nh bi hm thuc
2
) 2 (
=
x
A
e ta c th k hiu: A
= ( ) { } U x x x e | ) 2 ( ,
2
hoc A =
}
+

x x / ) 2 (
2

b. Cc dng hm thuc tiu biu
Theo l thuyt th hm thuc c th l mt hm bt k tho
A
:X->[0,1]. Nhng
trong thc t th c cc dng hm thuc sau y l quan trng v c tnh ng dng cao hn
c.
Nhm hm n iu
Nhm ny gm n iu tng v n iu gim. V d tp hp ngi gi c hm thuc
n iu tng theo tui trong khi tp hp ngi tr c hm thuc n iu gim theo
tui. Ta xt thm v d minh ha sau:
- Cho tp v tr E = Tc = {20, 50, 80, 100, 120} n v l km/h.
- Xt tp m F=Tc nhanh xc nh bi hm thuc
nhanh
nh th
Nh vy tc di 20km/h c coi l khng nhanh. Tc cng cao th thuc ca
n vo tp F cng cao. Khi tc l 100km/h tr ln th thuc l 1.








Nhm hm hnh chung
Nhm hm ny c th dng hnh chung, bao gm dng hm tam gic, hm hnh thang,
gauss.
Xt v d cng vi tp v tr E trn, xt tp m F=Tc trung bnh xc nh bi hm
thuc

s s
s s
> v s
=
100 50 50 / ) 100 (
50 20 30 / ) 20 (
100 20 0
x khi x
x khi x
x x khi
trungbnh









c. Cc khi nim lin quan
Gi s A l tp m trn v tr U, c hm thuc
A
th ta c cc khi nim sau:
Gi ca A, k hiu supp(A) l mt tp r bao gm tt c cc phn t xe U
sao cho
A
(x) > 0
Nhn ca A l mt tp r bao gm tt c cc phn t xe U sao cho
A
(x) = 1
Bin ca A l mt tp r bao gm tt c cc phn t xe U sao cho 0 <
A
(x) < 1
1
0.85
0.5
100 20 50 80
E
nhanh


120
1
0.4
100 20 50 80
E
trungbnh


120
cao ca A, k hiu height(A) l cn trn ng ca
A
(x). height(A)=
) ( sup x
A
U x

e

Tp m A c gi l tp m chun tc (normal fuzzy set) nu height(A)=1.
Tc l tp m chun tc c nhn khc rng.
d. Cc ton t logic trn tp m
Cho X,Y l hai tp m trn khng gian nn B, c cc hm thuc tng ng
l
X
,
Y
, khi :
- Php hp hai tp m : XY
+ Theo lut Max
X Y
(b) = Max{
X
(b) ,
Y
(b) }
+ Theo lut Sum
X Y
(b) = Min{ 1,
X
(b) +
Y
(b) }
+ Tng trc tip
X Y
(b) =
X
(b) +
Y
(b) -
X
(b).
Y
(b)
- Php giao hai tp m : X Y
+ Theo lut Min
X Y
(b) = Min{
X
(b) ,
Y
(b) }
+ Theo lut Lukasiewicz
XY
(b) = Max{0,
X
(b)+
Y
(b)-1}
+ Theo lut Prod
XY
(b) =
X
(b).
Y
(b)
- Php b tp m :
X
(b) = 1-
X
(b)
Trong bi kha lun ny chng ta s dng lut Max cho php hp (union) v lut
Min cho php giao (intersection), do phn sau s trnh by r hn mt cht v cc
php hp v giao ny cng nh php b.
Ta c 3 ton t logic trn tp m quan trng sau: OR, AND, NOT
Php hp (hay ton t OR)
Khi nim: Hp ca hai tp m (AB) th hin mc mt phn t thuc
v mt trong hai tp l bao nhiu.
Cng thc:
A B
(x) = max (
A
(x) ,
B
(x))
A B

V d d.1:

Tr
(An) = 0.8 v
Trung nin
(An) = 0.3

Tr Trung Nin
(An) = max( 0.8, 0.3) = 0.8
Php giao (hay ton t AND)
Khi nim: Giao ca hai tp m (AB) th hin mc mt phn t thuc
v c hai tp l bao nhiu.
Cng thc:
A B
(x) = min (
A
(x) ,
B
(x))

A B

V d d.2:

Tr
(An) = 0.8 v
Trung nin
(An) = 0.3

Tr Trung Nin
(An) = min( 0.8, 0.3) = 0.3
Php b (hay ton t NOT)
A

Khi nim: B ca mt tp m th hin mc mt phn t khng thuc
v tp l bao nhiu.
Cng thc:
A
(x) = 1 -
A
(x)
V d d.3:

Tr
(An) = 0.8

Tr
(An) = 1 0.8 = 0.2

Nhn xt: Logic m khng tun theo cc lut v tnh b ca logic truyn
thng:
A A
(x) 1 v
A A
(x) 0
V d d.4:

A A
(x) = max (0.8, 0.2) = 0.8

A A
(x) = min( 0.8, 0.2) = 0.2
e. Cc php ton m rng
Ngoi cc php ton chun: phn b, hp, giao c cp trn cn c nhiu
cch m rng php ton trn tp m khc c tnh tng qut ha cao hn.
Phn b m
Gi s xt hm C: [0,1] -> [0,1] cho bi cng thc C(a) = 1 a, a e [0,1]. Khi hm
thuc ca phn b chun tr thnh
A
(x) = C(
A
(x)). Nu tng qut ho tnh cht ca
hm C th ta s c tng qut ho nh ngha ca phn b m. T ta c nh ngha: Phn
b m ca tp m A l tp m A vi hm thuc c xc nh bi
A
(x) = C(
A
(x)),
trong C l mt hm s tho cc iu kin sau:
i. Tin C1 (iu kin bin): C(0) = 1, C(1) = 0
ii. Tin C2 (n iu gim): a, b e [0,1]. Nu a < b th C(a) > C(b)
Hm C tho cc iu kin trn c gi l hm phn b.
Ta thy rng hm thuc ca phn b chun l mt hm c bit trong h cc hm phn b.
V d:
Hm phn b Sugeno C(a) =
a
a
+

1
1
trong l tham s tho > -1. Hm b
chun l trng hp c bit ca hm Sugeno khi = 0.
Hm phn b Yager C(a) =
w
w
a
1
) 1 ( trong w l tham s tho w > 0. Hm b
chun l trng hp c bit ca hm Yager khi w = 1.
Hp m cc php ton S-norm
Php ton max trong cng thc hm hp m chun c th c tng qut ho thnh cc
hm S-norm:
Mt hm s S: [0,1]x[0,1] -> [0,1] c gi l mt S-norm nu tho cc iu kin sau:
i. Tin S1 (iu kin bin): S(0,a) = a, ae[0,1]
ii. Tin S2 (giao hon): S(a,b) = S(b,a), a,be[0,1]
iii. Tin S3 (kt hp): S(S(a,b),c) = S(a,S(b,c)), a,b,ce[0,1]
iv. Tin S4 (n iu tng): Nu a sb v csd th S(a,c) sS(b,d), a,b,c,de[0,1]
S-norm cn c gi l co-norm hoc T-i chun.
Hp ca tp m A v tp m B l tp m AB vi hm thuc c xc nh bi:

B A
(x) = S(
A
(x),
B
(x))
trong S l mt S-norm
Ngoi hm max, ta c mt s hm S-norm quan trng sau y:
Tng Drastic :

> >
=
=
= v
0 , 0 1
0
0
b a if
a if b
b if a
b a
Tng chn: ) , 1 min( b a b a + =
Tng i s: ab b a b a + = +
.

Php hp Yager:
(

+ =
w
w w
w
b a b a S
1
) ( , 1 min ) , (
Trong w l tham s tho w > 0
Giao m cc php ton T-norm
Ta c nh ngha hm T-norm l tng qut ho ca hm min:
Mt hm s T: [0,1]x[0,1] -> [0,1] c gi l mt T-norm nu tho cc iu kin:
i. Tin T1 (iu kin bin): T(1,a) = a, ae[0,1]
ii. Tin T2 (giao hon): T(a,b) = T(b,a), a,be[0,1]
iii. Tin T3 (kt hp): T(T(a,b),c) = T(a,T(b,c)), a,b,ce[0,1]
iv. Tin T4 (n iu tng): Nu a sb v csd th T(a,c) sT(b,d), a,b,c,de[0,1]
T-norm cn c gi l T-chun hoc chun tam gic.

Giao ca tp m A v tp m B l tp m AB vi hm thuc c xc nh nh sau:

B A
(x) = T(
A
(x),
B
(x))
Trong T l mt T-norm.
Ngoi hm min, ta c mt s hm T-norm quan trng sau y:
Tch Drastic:

< <
=
=
= .
1 , 1 0
1
1
b a if
a if b
b if a
b a
Tch chn: ) 1 , 0 max( + = b a b a
Tch i s: ab b a = .
Php giao Yager:
(

+ =
w
w w
w
b a b a T
1
) ) 1 ( ) 1 (( , 1 min 1 ) , (
Trong w l tham s tho w>0
nh l: Vi mi T-norm bt k T v S-norm bt k S ta c:
a .b s T(a,b) s min(a,b) s max(a,b) s S(a,b) s avb
Tch -cc m
Tch -cc ca tp m
1
A ,
2
A , ,
n
A trn cc v tr
1
U ,
2
U , ,
n
U tng ng l tp m
A =
1
A
2
A
n
A trn khng gian tch
1
U
2
U
n
U vi hm thuc c xc
nh nh sau:
A
(
1
x ,
2
x , ,
n
x ) =
1
A
(x) T
2
A
(x) T T
n
A
(x)
1
x e
1
U ,
2
x e
2
U , ,
n
x e
n
U
Trong T l mt T-norm bt k.
Ta thy, y l nh ngha m rng cho tch -cc chun khi thay th hm min bng mt
T-norm bt k.
Quan h m
Cho U v V l cc v tr. Khi mt quan h m hai ngi R gia U v V l mt tp
m trong tch -cc UxV. Nh vy ta c th xc nh hm thuc cho quan h m theo
cch tnh hm thuc cho tch -cc m.

Khi U = V ta ni R l quan h trn U.
Tng qut mt quan h m R gia cc tp
1
U ,
2
U , ,
n
U l tp m A =
1
A
2
A
n
A trn khng gian tch
1
U
2
U
n
U . Trong
i
A _
i
U , i = 1..n
Hp ca cc quan h m
Hp ca quan h m R t U n V v quan h m Z t V n W l quan h m RoZ t U
n W c hm thuc xc nh bi
RoS
(u,w) =
V ve
max { T(
R
(u,v),
Z
(v,w)) }
Trong T l mt T-norm bt k.
Cc hm thuc quan trng sau c dng rng ri xc nh hp ca cc quan h m :
Hm hp max-min:

RoS
(u,w) =
V ve
max { min(
R
(u,v),
Z
(v,w)) }
Hm hp max-tch (hay max-prod):

RoS
(u,w) =
V ve
max {
R
(u,v) .
Z
(v,w) }
3. Logic m
a. Khi nim logic m
khc phc khuyt im ca logic truyn thng (logic mnh ), Lotfi Zadeh
a ra l thuyt mi v logic gi l logic m (fuzzy logic). L thuyt ca Zadeh
biu din tnh m hay tnh thiu chnh xc trong cc pht biu trn, theo cch nh
lng bng cch a ra mt hm t cch thnh vin tp hp (set membership function
- hay cn c gi l hm thuc) nhn gi tr thc gia 0 v 1.
b. Bin ngn ng
Ta xt mt bin nhn gi tr trong mt min gi tr no , chng hn nhit c
th nhn gi tr s l 1

C, 2

C, l cc gi tr chnh xc. Khi , vi mt gi tr c th


gn vo bin s gip chng ta xc nh c tnh cht, quy m ca bin. Ngoi ra chng ta
cn bit c nhng thng tin khc lin quan n bin . V d chng ta hiu l khng
nn chm tay trn vo vt c nhit l 80

C tr ln. Nhng trong thc t th chng ta


thng ni khng nn chm vo vt c nhit cao ch t khi ni khng nn chm
vo vt c nhit l 80

C tr ln. Thc t l li khuyn u th c ch hn bi v nu


nhn c li khuyn sau th ta d b ng nhn l c th chm tay vo vt c nhit l
79

C trong khi vt c nhit 80

C tr ln th khng. Nhng vn t ra l nu
nghe theo li khuyn u th ta c th xc nh r l nhit bng bao nhiu th c th
chm tay vo? Cu tr li l tu vo kin ca tng ngi. Vi nhit l 60

C th c
ngi cho l cao trong khi ngi khc th khng. Tuy cc kin l khc nhau nhng c
mt iu chc chn l khi gi tr ca bin nhit cng tng th cng d dng c chp
nhn l cao. Nh vy nu xt hm
cao
nhn bin nhit v tr v t l kin ng
l cao th
c a o
s l hm thuc ca tp m nhit cao trn v tr nhit , xem
hnh b.1 bn di






Hnh b.1: Biu din thang nhit
Bin nhit c th nhn gi tr cao l mt gi tr ca ngn ng t nhin nn n c
gi l mt bin ngn ng (linguistic variable)
Khi nim bin ngn ng c Zadeh a ra nm 1973 nh sau:
Mt bin ngn ng c xc nh bi b (x, T, U, M)
trong : x l tn bin. V d: nhit , tc , m,
T l tp cc t l cc gi tr ngn ng t nhin m x c th nhn.
V d: x l tc th T c th l {chm, trung bnh, nhanh}
U l min cc gi tr vt l m x c th nhn.
V d: x l tc th U c th l {0km/h,1km/h, , 150km/h}
M l lut ng ngha, ng mi t trong T vi mt tp m At trong U
T nh ngha trn chng ta c th ni rng bin ngn ng l bin c th nhn gi tr l cc
tp m trn mt v tr no .
1
0.9
100 50 80
Nhit
cao


120
c. Mnh m
Trong logic c in (logic v t cp mt), mt mnh phn t P(x) l mt pht
biu c dng x l P trong x l mt i tng trong mt v tr U no tho tnh
cht P. V d x l s chn th U l tp cc s nguyn v P l tnh cht chia ht cho 2.
Nh vy ta c th ng nht mt mnh phn t x l P vi mt tp (r) A = { xeU |
P(x) }.
T ta c:
P(x) = (x)
Trong

l hm c trng ca tp A ( xeA (x) = 1). Gi tr chn l ca P(x) ch
nhn mt trong hai gi tr 1 v 0 (true v false) tng ng vi s kin x thuc A hoc
khng.
Trong trng hp P l mt tnh cht m chng hn nh s ln th ta s c mt mnh
logic m phn t. Khi tp hp cc phn t trong v tr U tho P l mt tp m B c
hm thuc
B
sao cho:
P(x) =
B
(x)
Lc ny P(x) c th nhn cc gi tr tu trong [0,1]. V ta thy c th ng nht cc hm
thuc vi cc mnh logic m.
e. Cc php ton mnh m
Trong logic c in, t cc mnh phn t v cc php ton .(AND), v (OR), (NOT)
ta c th lp nn cc mnh phc. Ta c:
P(x) = 1 P(x)
P(x) . Q(y) = min(P(x), Q(y))
P(x) v Q(y) = max(P(x), Q(y))
P(x) =>Q(y) = P(x) v Q(y) = max(1-P(x), Q(y))
P(x) =>Q(y) = P(x) v (P(x) . Q(y)) = max(1-P(x), min(P(x), Q(y)))
Nh vy, ta s c m rng mt cch t nhin t logic c in sang logic m vi quy tc
tng qut ho dng hm b m cho php ph nh, hm T-norm cho php giao () v S-
norm cho php hp (). S m rng ny da trn s tng quan gia mnh logic m
vi hm m v cc php ton trn tp m. Ta c:

A
(x) = C(
A
(x))
A
(x) .
B
(y) = T(
A
(x),
B
(y))
A
(x) v
B
(y) = S(
A
(x),
B
(y))
A
(x) =>
B
(y) = S(C(
A
(x)),
B
(y)) (1)
A
(x) =>
B
(y) = S( C(
A
(x)), T(
A
(x),
B
(y)) ) (2)

Trong C l hm b m (hay ph nh m), T l hm T-norm, S l hm S-norm.

f. Php ton ko theo m
Cc php ton ko theo c vai tr quan trng trong logic m. Chng to nn cc
lut m thc hin cc php suy din trong tt c cc h m. Do mt mnh m tng
ng vi mt tp m nn ta c th dng hm thuc thay cho cc mnh .
Sau y l mt s php ko theo quan trng c s dng rng ri:
Php ko theo Dienes Rescher
Nu p dng cng thc (1) vi S-norm max v C l hm b chun cho ta c php ko theo
Dienes Rescher

A
(x) =>
B
(y) = max(1-
A
(x),
B
(y))
Php ko theo Lukasiewicz
Nu p dng cng thc (1) vi S-norm l hm hp Yager vi w=1 v C l hm b chun
cho ta c php ko theo Lukasiewicz:

A
(x) =>
B
(y) = min(1, 1-
A
(x)+
B
(y))
Php ko theo Zadeh
Nu p dng cng thc (2) vi S-norm l max, T-norm min hoc tch v C l hm b
chun cho ta c php ko theo Zadeh:

A
(x) =>
B
(y) = max( 1-
A
(x), min(
A
(x),
B
(y))) (a)

A
(x) =>
B
(y) = max( 1-
A
(x),
A
(x).
B
(y)) (b)
Ko theo Mamdani
Ta c th coi mnh
A
(x) =>
B
(y) xc nh mt quan h 2 ngi R _ UxV. Trong
U l khng gian nn ca x (v tr cha x), V l khng gian nn ca y (v tr cha y). Khi
gi tr chn l ca mnh
A
(x) =>
B
(y) l gi tr hm thuc ca cp (x,y) vo R.
Theo cng thc xc nh hm thuc ca quan h m ta c:

A
(x) =>
B
(y) = T(
A
(x),
B
(y))
Trong T l mt T-norm. Khi chn T l min hoc tch ta c cc php ko theo
Mamdani:

A
(x) =>
B
(y) = min(
A
(x),
B
(y)) (a)

A
(x) =>
B
(y) =
A
(x).
B
(y) (b)
g. Lut m
Mt lut m l mt biu thc If - Then c pht biu dng ngn ng t
nhin th hin s ph thuc nhn qu gia cc bin.
V d: If nhit l lnh v gi du l r Then si m nhiu.
Trong :
- nhit , gi du v si m l cc bin
- lnh, r, nhiu l cc gi tr hay chnh l cc tp m.
Hoc: If mt ngi c chiu cao l cao v c bp l lc lng Then chi bng r
hay.
- Cc bin y s l: chiu cao, c bp, chi bng r
- Cc gi tr hay tp m l: cao, lc lng, hay.
h. Lut Modus Ponens hay Modus Tollens
Thng thng, suy din m (suy lun m) hay s dng lut Modus Ponen hoc
Modus Tollens. Trong logic c in, Modus Ponens din t nh sau:
Mnh 1 (Lut hoc tri thc) : P Q
Mnh 2 (s kin) : P ng
Kt lun : Q ng
Tng t logic c in, trong logic m (suy din m hay suy lun m) cng c lut
Modus Ponens nh sau:
Gi thit 1 (lut m) : Nu x l A th y l B
Gi thit 1 (s kin m) : x l A
Kt lun : y l B
Trong A, B, A, B l cc bin ngn ng (c ngha l cc tp m). A v A l
cc tp m trn khng gian nn U, cn B v B l cc tp m trn khng gian nn
V.
V d :
Lut m : Nu gc quay tay ga ln th xe i nhanh
S kin m : Gc quay tay ga kh ln
Kt lun : Xe i kh nhanh
Trong logic c in, Modus Tollens din t nh sau:
Mnh 1 (Lut hoc tri thc) : P Q
Mnh 2 (s kin) : Q ng
Kt lun : P ng
Tng t logic c in, trong logic m (suy din m hay suy lun m) lut c din
t nh sau :
Gi thit 1 (Lut m hoc tri thc m) : P Q
Gi thit 2 (S kin m) : Q kh ng
Kt lun : P kh ng
V d :
Lut m : Nu gc quay tay ga ln th xe i nhanh
S kin m : Xe khng i nhanh lm
Kt lun : Gc quay tay ga khng ln lm
ng dng suy din m (suy lun m) vo trong bi ton thc t th vn mu
cht cn thc hin l xy dng c ch lp lun xp x c th a ra kt lun hay
quyt nh m.
Cng thc tnh kt lun ca lut Modus Ponens nh sau:

' B
(y) =
sup
x
T(
R
(x,y),
' A
(x)) (*)
Trong T l mt hm T-norm v R l quan h hai ngi xc nh bi php ko theo.
Cch tnh
R
(x,y), chnh l cch tnh gi tr chn l ca php ko theo trnh by phn
trc. Nh vy tu theo cch chn cch tnh lut ko theo khc nhau m ta c cch
tnh kt qu ca lut Modus Ponens khc nhau.
V d: Gi s quan h gia nhit v p sut cho bi lut sau:
Nu nhit l cao th p sut l ln.
Nhit nhn cc gi tr trong U = {30, 35, 40, 45}
p sut nhn cc gi tr trong V = {50, 55, 60, 65}
Ta c cc tp m xc nh bi cc bin ngn ng nhit v p sut nh sau:
A = nhit cao =
45
1
40
9 . 0
35
3 . 0
30
0
+ + +
B = p sut ln =
65
1
60
1
55
5 . 0
50
0
+ + +
p dng lut ko theo Mamdani tch ta c quan h m sau (gi tr dng i, ct j l gi
tr hm thuc ca cp nhit i v p sut j vo quan h)
R=
65 60 55 50
45
40
35
30
1 1 5 . 0 0
9 . 0 9 . 0 45 . 0 0
3 . 0 3 . 0 15 . 0 0
0 0 0 0
(
(
(
(


By gi, gi s ta bit s kin nhit l trung bnh v
A = nhit trung bnh =
45
1 . 0
40
8 . 0
35
1
30
6 . 0
+ + +
p dng cng thc (*) ta suy ra B =
65
8 . 0
60
8 . 0
55
45 . 0
50
0
+ + +
i. Th tc ra quyt nh m (fuzzy decision making procedure)
h thng m c th suy lun bng cc lut m v a ra kt lun t cc s liu chnh
xc u vo, h thng thc hin 3 bc:


Hnh i.1 M hnh suy lun ca mt h thng m
1. M ha: Tnh ton cc gi tr m t cc s liu chnh xc u vo
2. Suy lun m: p dng tt c cc lut m c th p dng tnh ra gi tr m cho
kt lun, sau kt hp cc kt qu u ra.
3. Gii m ha: Xc nh gi tr chnh xc t kt qu m c c bc 2. C nhiu
k thut gii m ha c th p dng c, phng php thng dng nht l
phng php trng tm (centriod method).

V d i.2: Cho h thng m dng trong iu tr bnh gm cc lut sau y
1. IF st nh THEN liu lng asperine thp
2. IF st THEN liu lng asperine bnh thng
3. IF st cao THEN liu lng asperine cao
4. IF st rt cao THEN liu lng asperine cao nht

M ha
(fuzzification)
Kh tnh m
(defuzzification)
Suy lun


Hnh i.2 - Biu din ca cc tp m trong v d i.2
V d i.3: Mt bnh nhn st 38.7 , hy xc nh liu lng asperince cn thit cp
cho bnh nhn.
Gii:
Bc 1: M ha gi tr x = 38.7 cho: ta thy 38.7 thuc v cc tp m nh sau:

St nh
(x) = 0.3
St
(x) = 0.7
St cao
(x) = 0
St rt cao
(x) = 0
Hnh i.3 M ha gi tr nhp r u vo
Bc 2: Ta thy c hai lut 1 v 2 c th p dng cho ra hai liu lng aspirine:

Thp
(x) = 0.3
Bnh thng
(x) = 0.7
Kt hp cc gi tr m ny li ta c vng c t mu sau y:

Hnh i.4 Gii m ha c kt xut r u ra
Bc 3: Gii m ha kt qu bng cch tnh trng tm ca din tch c t trong
hnh trn, chiu xung trc honh ta c gi tr 480mg, y chnh l liu lng
aspirine cn cp cho bnh nhn.
k. Gii m
Gii m l qu trnh xc nh gi tr r u ra t hm thuc
B
(y) ca tp m B.
C 2 phng php gii m :
Phng php cc i
Cc bc thc hin :
- Xc nh min cha gi tr y, y l gi tr m ti
B
(y) t Max
G = { yY |
B
(y) = H }
- Xc nh y theo mt trong 3 cch sau :
+ Nguyn l trung bnh
+ Nguyn l cn tri
+ Nguyn l cn phi

Hnh k.1 Gii m theo phng php cc i
- Nguyn l trung bnh: y = (y1+y2)/2
- Nguyn l cn tri: chn y = y
1

- Nguyn l cn phi: chn y = y
2

Phng php trng tm
im y c xc nh l honh ca im trng tm min c bao bi trc
honh v ng
B
(y).
Cng thc xc nh :
}
}
=
S
S
dy y
dy y y
y
) (
) (
'


trong S l min xc nh ca tp m B
- Phng php trng tm cho lut Sum-Min
Gi s c m lut iu khin c trin khai, k hiu cc gi tr m u ra ca
lut iu khin th k l
Bk
(y) th vi quy tc Sum-Min hm thuc s l
) ( ) (
1
' '
y y
m
k
k B B
=
= , v y c xc nh:

}
}

}

=
=
=
=
=
=
=
|
|
.
|

\
|
|
|
.
|

\
|
=
|
.
|

\
|
=
m
k
k
m
k
k
m
k
S
k B
m
k
S
k B
S
m
k
k B
S
m
k
k B
A
M
dy y
dy y y
dy y
dy y y
y
1
1
1
'
1
'
1
'
1
'
) (
) (
) (
) (
'

(1)
Trong :
}
=
S
k B k
dy y y M ) (
'
v
}
=
S
k B k
dy y A ) (
'
k=1,2...m

Xt ring cho trng hp cc hm thuc dng hnh thang nh hnh trn :
( ) a m b m a b m m
H
M
k 1 2
2 2 2
1
2
2
3 3 3 3
6
+ + + =
( ) b a m m
H
A
k
+ + =
1 2
2 2
2

Ch y hai cng thc trn c th p dng c cho lut Max-Min
- Phng php cao
T cng thc (1), nu cc hm thuc c dng singleton th ta c:

=
=
=
m
k
k
m
k
k k
H
H y
y
1
1
' vi H
k
=
Bk
(y)
y l cng thc gii m theo phng php cao.
4. S m
Trong phn s m ny ta tp trung vo 2 vn quan trng l: Gii thiu v s
m v cc tnh ton ca s m. Khi nim s m thc cht l da trn khi nim v tp
m v t nh ngha ca tp m dn n nh ngha s m.
V d: Mt s thc th biu din trn trc s l mt im, cn nu v mt s c th biu
din l mt im. Nu xt v mt tp hp th tp hp gm mt phn t, cn nu s m n
b m, chng hn ta c s 1, vy s 1 ng l din t 1 im trn trc s. Ta ni 1 s xp
x 1, ta hiu cc con s nm ch ny hay ch kia, ni chung l n gn 1, nh vy ta khng
xt thnh mt v tr m thnh mt tp hp v tr. Nh vy s ci m xp x 1 n phi xc
nh bng mt tp hp nhng s thc m nm gn 1, vy bn thn ch gn 1 l m h,
vy tp ny gi l s m. S m c nh ngha l 1 tp m trn trc thc, nhng m n
phi c tp im ch khng phi bt k tp no trn trc thc cng gi l s m, ta phi
da trn cc c im.
a. nh ngha
C s khoa hc ca s m l tp m trn trc thc tha 2 iu kin, ta c nh
ngha v s m nh sau: Tp m M trn ng thng s thc R
1
l tp s m nu tha 2
iu kin sau:
a) M l chun s, tc l c im x sao cho M(x) = 1
b) ng vi mi o e R
1
, tp mc {x:
M
(x)o} l on ng trn R
1

Ngi ta thng dng cc s m dng tam gic, hnh thang v dng Gauss.
V dn n cc qui tc l ta gi nh rng tp m l dng c bit m ng biu din
to thnh tam gic cn trn biu , do ta c cc qui tc tnh ton s m nh sau:
Cc php ton (dng tnh ton) trn s m:
Cng : [a,b] + [d,e] = [a+d, b+e]
Tr : [a,b] - [d,e] = [a-e, b-d]
Nhn : [a,b] * [d,e] = [min(ad,ae, bd, be), max(ad,ae, bd, be)]
Chia : [a,b] / [d,e] = [min(a/d,a/e, b/d, b/e), max(a/d,a/e, b/d, b/e)]
b. Nguyn l suy rng ca Zadeh
lm vic vi cc h thng c nhiu bin vo, nguyn l suy rng ca Zadeh l rt quan
trng
nh ngha: Cho A
i
l tp m vi cc hm thuc A
i
trn khng gian nn X
i
, (i=1..n).
Khi tch A
1
xA
2
x..A
n
l tp m trn X=X
1
xX
2
x..X
n
vi hm thuc:
A(x)=min{ A
i
(x
i
); i=1..n} Trong x=(x
1
,x
2
,..x
n
)
Gi s mi bin u vo x
i
ly gi tr l A
i
(i=1..n). Hm f: X->Y chuyn cc gi tr u
vo l A
i
thnh gi tr u ra B. Khi B l tp m trn Y vi hm thuc xc nh bi:
B(x)=max{min( A
i
(x
i
)); i=1..n : xef
1
(y)} nu f
1
(y) = |
B(x)=0 nu f
1
(y) =|
Trong f
1
(y) = {x eX : f(x)=y}
Ta c th p dng nguyn l suy rng cho nh ngha suy rng ca php cng nh mt
hm 2 bin m. Tng t cho cc php ton tr, nhn, chia.
c. Cc s hc m
T cc php ton c bn (Cc php ton trn s m) ngi ta xy dng nn s hc
m. C nhiu cch xy dng mt s hc m. Sau y l s hc m da trn khi nim o -
cuts (lt ct alpha). o -cuts ca s m l khong ng thc vi mi 0< o <=1. Gi * l
mt trong 4 php ton sau: {+, -, ., /}
[a,b]*[d,e]={f x g / as f s b, d s g s e}
Cc tnh cht s hc m da trn khong ng:
Gi A=[a1,a2], B=[b1,b2], C=[c1, c2], 0=[0,0], 1=[1,1] ta c mt s tnh cht s hc m
sau:
1. A+B=B+A ; A.B=B.A
2. (A+B)+C=A+(B+C) ; (A.B).C=A.(B.C)
3. A=0+A=A+0 ; A=1.A=A.1
4. A.(B+C) _A.B+A.C
5. Nu b.c >= 0 beB, ceC th A.(B.C)=A.B+A.C
6. 0e A-A; 1eA/A
7. Nu A_ E v B_ F th:
a. A+B _ E+F
b. A-B _ E-F
c. A.B _ E.F
d. A/B _ E/F
Cng hai s m
[a, b] + [d, e] = [a + d, b + e]
Tr hai s m
[a, b] - [d, e] = [a - e , b - d]
Nhn hai s m
[a, b] - [d, e] = [a - e , b - d]
Chia hai s m
[a, b] / [d, e] = [ min (a/d, a/e, b/d, b/e]), max (a/d, a/e, b/d, b/e)]


5. H m
a. Kin trc ca h m tng qut
Mt h m tiu biu c kin trc nh hnh 5.a.1 sau:






Hnh 5.a.1: M hnh biu din h m
Thnh phn trung tm ca h m l c s lut m (fuzzy rule base). C s lut m
bao gm cc lut m if-then biu din tri thc ca chuyn gia trong lnh vc no .
Trong trng hp mt h iu khin m c th th c s lut m chnh l tri thc v kinh
nghim ca cc chuyn gia trong vic iu khin khi cha p dng h iu khin m.
Thnh phn quan trng k tip l b suy din m (fuzzy inference engine). Nhim
v ca b phn ny l kt hp cc lut trong c s lut m, p dng vo tp m u vo
theo cc phng php suy din m xc nh tp m u ra.
D liu u vo ca h iu khin m l cc tn hiu do cc b phn cm bin mi
trng cung cp sau khi s ho nn c tnh cht r (khi nim r y c ngha l cc
tn hiu khng phi l cc tp m, ch khng c ngha l cc tn hiu khng c nhiu).
V vy cn phi c b m ho (fuzzier) chuyn cc d liu s u vo thnh cc tp m
b suy din m c th thao tc c.
D liu u ra ca b suy din m dng cc tp m s c b gii m
(defuzzier) chuyn thnh tn hiu s trc khi truyn n cc c quan chp hnh nh tay
my, cng tc, van iu khin,
Do cc d liu u vo v u ra c s ho nn ta ch cn xem xt cc h m lm
vic vi cc bin s. Trng hp tng qut, h m nhn mt vector n chiu u vo v
cho ra mt vector m chiu u ra. H m nh th c gi l h m nhiu u vo
nhiu u ra (MIMO). Nu m bng 1, ta c h h m nhiu u vo mt u ra (MISO).
Mt h m nhiu u vo nhiu u ra c th phn tch thnh nhiu h nhiu u vo
C s
lut m
B suy
din m
B m
ho
B gii
m
u vo
(s)
u vo
(tp m)
Tham kho
lut m
u ra
(tp m)
u ra
(s)
mt u ra. Do ta ch cn tm hiu k v h m nhiu u vo mt u ra vi cc bin
s. Khi ch ni v h m nhiu - mt th ta s ngm hiu l mt h m nhiu u vo
mt u ra vi cc bin s
K hiu: R V R U U
n
n
i
i
c c =
[
=
,
1
, trong
i
U l min xc nh ca cc bin vo i, i=1..n
v V l min gi tr ca bin ra y, ta c m hnh h m nhiu u vo mt u ra nh
hnh 5.a.2 sau:




Hnh 5.a.2: M hnh h m nhiu u vo mt u ra
Cc mc k tip s m t k hn v cc b phn chc nng ca h m.
b. C s lut m
C s lut m ca h m n u vo mt u ra gm m lut if-then m c dng:
I f x
1
l A
k1
v x
2
l A
k2
v v x
n
l A
kn
then y l B
k
, k=1..m (1)
Trong k l ch s ca lut (lut th k trong tp lut), x
i
l cc bin u vo, A
ki
l cc
tp m trn U
i
(i=1..n), y l bin u ra v B
k
l tp m trn V (k=1..m)
Cc lut m dng (1) c gi l cc lut if-then m chun tc. Cc lut m khng chun
tc c th bin i a v dng chun tc tng ng.
C nhiu phng php xc nh cc lut m a vo c s lut m. Cc
phng php thng dng l nh cc chuyn gia trong lnh vc p dng, hoc t quan st,
thc nghim thng k c c cc tp d liu mu u vo v ra tng ng, t dng
cc k thut khai m d liu rt ra cc lut.
c. B suy din m
Chng ta s nghin cu phng php thit k b suy din m trong trng hp c
s lut m gm m lut if-then m chun tc, nhiu u vo v mt u ra (MISO).
Cc lut if-then c th c p dng bng cc cng thc tng qut nh trnh by
trong chng logic m (Fuzzy Logic) nhng trong thc t th thng c tnh bng cng
thc Mamdani max-min hoc max-tch (max-prod). Chng ta s xem xt k kin trc b

H m
nhiu u
vo mt
u ra
1
U x e
2
U x e

n
U x e

V y e


suy din m s dng phng php suy din max-min. Khi chuyn qua phng php suy
din max-tch th ch cn thay min bng php nhn trong cc cng thc.
Cho A, A, B ln lt l cc tp m trn v tr X, X, Y. Lut if A then B c th
hin nh mt quan h m R=AB trn XY. Khi tp m B suy ra t A c xc
nh bi:

' B
(y) = max {min [
' A
(x),
R
(x,y)]} (*)
Trng hp mt u vo v mt lut, xem hnh 5.c.1
Ta c
' B
(y) =
max
x
{min [
' A
(x),
R
(x,y)]}
=
max
x
{min [
' A
(x),
A
(x),
B
(y)]}
= min {
max
x
(min [
' A
(x),
A
(x)]),
B
(y)}
= min {
max
x
A A '
(x),
B
(y)}
= min { h
A A '
,
B
(y)}
Trong h
A A '
l cao ca tp m A A





Hnh 5.c.1: Trng hp mt u vo v mt lut
Trng hp hai u vo v mt lut
y l trng hp lut c pht biu Nu x l A v y l B th z l C.
Lut : Nu x l A v y l B th z l C
S kin : x l A v y l B
Kt lun : z l C
Lut m vi iu kin c 2 mnh nh trn c th biu din dng AxB => C. Suy lun
tng t trng hp mt u vo v mt lut ta c:
' c
(z) = min { h
AxB xB A ' '
,
C
(z)}
M A x B A x B = (A A) x (B B) nn h
AxB xB A ' '
= min {
h A A '
,
h B B '
}
Vy
' c
(z) = min {
h A A '
,
h B B '
,
C
(z)}
B
B A A
h
x

y

Suy rng ra cho trng hp nhiu u vo A
i
, i=1..n v mt lut
Lut : Nu x
1
l A
1
v x
2
l A
2
v... v x
n
l A
n
th z l C
S kin : x
1
l A
1
v x
2
l A
2
v... v x
n
l A
n

Kt lun : z l C
Vy ta c suy lun sau:

' c
(z) = min { (
n i .. 1
min
=
h Ai i A '
),
C
(z)}
Xem hnh minh ha sau:





Trng hp nhiu u vo v nhiu lut
Trong trng hp nhiu u vo v nhiu lut, ta tnh kt qu u ra cho tng lut sau
kt qu ca h s l cc php giao hoc hp cc kt qu ring ty theo bn cht ca
h l hi hay tuyn cc lut.
Nu trong mt lut c dng Nu x l A hoc y l B th z l C ta tch thnh 2 lut
ring bit Nu x l A th z l C v Nu y l B th z l C tnh.
d. B m ha
M ho l qu trnh bin i mt vector x=(x
1
, x
2
, , x
n
) eU_
n
R

thnh mt tp
m A trn U. A s l u vo cho b suy din m. M ho phi tho cc tiu chun sau:
im d liu x phi c thuc cao vo A
Vector x thu nhn t mi trng ngoi c th sai lch do nhiu nn A phi phn
nh c tnh gn ng ca d liu thc
Hiu qu tnh ton: n gin cho cc tnh ton trong b suy din.
Sau y l mt s phng php m ho thng dng
i. M ho n tr
Mi im d liu x c xem nh mt tp m n tr tc l tp m A c hm thuc xc
nh nh sau:

' A
(u)=

=
=
x u if
x u if
0
1

h1
A A
x

C
C
z

B B
y

h2
ii. M ho Gauss
Mi gi tr xi c biu din thnh mt s m Ai. Tp A l tch -cc ca cc Ai

i
A'
(
i
u ) =
2
|
|
.
|

\
|

i
i i
a
x u
e
iii. M ho tam gic
Mi gi tr xi c biu din thnh mt s m Ai. Tp A l tch -cc ca cc Ai

i
A'
(
i
u ) =

>
s

i i i
i i i
i
i i
b x u if
b x u if
b
x u
| | 0
| |
| |
1

V d:
M ha l qu trnh nhn tr thnh vin tp m i vi mt bin u vo c th.
V d, tng tng mt ngi cao 1.75m v tp m Trung_bnh c xc nh bng
hm thnh vin v biu di y.
Trung _bnh ( x ) = { 0 if x >= 1.90 or x < 1.70,
(1.90 - x)/0.1 if x >= 1.80 and x < 1.90,
(x- 1.70)/0.1 if x >= 1.70 and x < 1.80 }

Hnh 5.d.1 th biu din tp m Trung_bnh
Tr thc nhp u vo 1.75m s c m ha bi tp m Trung_bnh cung cp
tr Trung_bnh(1.75) = 0.5.
e. H m l mt h xp x vn nng
Cc h m c ng dng thnh cng trong rt nhiu lnh vc, c bit l trong
iu khin cc qu trnh cng nghip v trong h chuyn gia. Mt cu hi t ra l ti sao
h m li c phm vi ng dng rng ln v hiu qu nh th? Mt cch trc quan chng
ta c th gii thch rng l v cc h m c th s dng tri thc ca cc chuyn gia
c pht biu trong ngn ng t nhin nn c bn cht m. L do na l v cc s liu
thu nhn c t mi trng l xp x, khng chnh xc nn cng c bn cht m.
V mt l thuyt, nh l quan trng sau y c chng minh, l nn tng
vng chc cho h m nhiu u vo mt u ra (MISO). M h m nhiu u vo mt
u ra c th coi nh n v cu thnh ca h m nhiu u vo nhiu u ra (MIMO).
Mt h m nhiu u vo mt u ra xc nh mt hm thc n bin y = F(x), ng
vi mi vector u vo ( )
n
n
R x x x x e = ,..., ,
2 1
vi gi tr u ra R y e . Ta gi l F l s hm
c trng ca h m ny.
nh l: Gi s U l tp compact trong
n
R , R V c , f l hm f: U -> V. Nu f lin tc th
tn ti mt h m sao cho hm F c trng ca n xp x f vi chnh xc tu cho
trc. Tc l
c <
e
) ( ) ( sup x f x F
U x

Chng ta c th xem chng minh nh l trn qua cc sch tham kho sau:
[1] Lee C. S. G. and Lin C. T., Neural Fuzzy Systems, A neuro Fuzzy
Synergism to I ntelligent System, Prentice Hall, 1996
[2] Wang L. X. A course in Fuzzy Systems and Control, Prentice Hall, 1997
f. Gii thiu mt s h lut m trong thc t
ng dng ca logic m (Fuzzy Logic) trong thc t rt phong ph v a dng. Chng ta c
th phn chia cc ng dng thnh cc dng chnh sau y:
1. Cc h iu khin
2. Cc h chuyn gia
3. Cc h nhn dng
4. Cc h m phng, gi lp
5. Cc h chn on trong y t (l mt dng h chuyn gia c bit)














Dng 1: A + X = B
Khng th suy ra X = B A,
Tht vy vi A=[a
1
,a
2
], B=[b
1
,b
2
], B-A=[b
1
-a
1
,b
2
-a
2
]
A+B = [a
1
,a
2
] +[b
1
-a
2
,b
2
-a
1
] = [a
1
+b
1
-a
2
, a
2
+b
2
-a
1
] = [b
1
,b
2
] = B
Nu X=[x
1
,x
2
], ta co [a
1
+x
1
, a
2
+x
2
] =[b
1
,b
2
]
a
1
+ x
1
= b
1
x
1
= b
1
a
1

a
2
+ x
2
= b
2
x
2
= b
2
a
2

V X l1 khong vi x
1
s x
2
b
1
- a
1
s b
2
- a
2
th c nghim
Lc c nghim l x=[b
1
-a
1
,b
2
-a
2
]