Tải bản đầy đủ (.doc) (37 trang)

Tiểu luận Thuật toán và phương pháp giải quyết vấn đề Bài toán người du lịch

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (450.14 KB, 37 trang )


ĐẠI HỌC CÔNG NGHỆ THÔNG TIN
 
!"#$%&'"'&()*+,-./



 !"#$%#%&#
0
TP.HCM, Tháng 01 - 2014
'"('"
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112
345611111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111117
60 389:3;<=>4?3@11111111111111111111111111111A
01$B&.CDEFG1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111A
010101H&IF111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111A
010121/JKL1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111A
010171/JK.M111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111N
21!""!&(O"&$BPGH111111111111111111111111111111111111111111111111111111111111110Q
210101RKO"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110Q
210121$%&'"'",!111111111111111111111111111111111111111111111111111111111111111111111111111111111111110Q
210171%STGUG!MF'V'"111111111111111111111111111111111111111111111111111111111111111111111111111111111111100
2101A1FD!DW&X11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100
2101Y1Z"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100
2101[1M\X'Z"1111111111111111111111111111111111111111111111111111111111111111111111111111111102
2101N1X2]^&11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111102
62 :_:`ab?c3defg<=1111111111111111107
01+J+-DWPhGK1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111107
21!"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111107
210101DW&X111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111107
210121M\'Z"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110Y


210171M\X'Z"111111111111111111111111111111111111111111111111111111111111111111111111111111110N
67 i>jak11111111111111111111111111111111111111111111111111111111111111111111112A
6A ldm<=>4?3@n:op
qer_:a<s;111111111111111111111111111111111111111111170
A10101tGO"&$BPGH11111111111111111111111111111111111111111111111111111111111111111111111111111111170
A101218$T&'u&,MF.J+vD&vw111111111111111111111111111111111111170
A10171!".J+&(O"&$BPGH11111111111111111111111111111111111111111111111111111111172
A101A1$R&Px.yOz&&&h{31111111111111111111111111111111111111111111111111111111111111177
3d_m<11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111117N

2
()*+,-
"&$BPGHCE.$B&.&t-&$B$%&Z|SFG}SF~C
F*•&XG&$B&€-'"•‚']C.)FGLG$ƒ-("
']P*-‚GL,)F*,/']OF.L,R'„D…-C.$ƒ
'"O†,+J‡0NOTF"X,$%&)]G{DˆGGFa‰F
FG,FS}*&_DJFC,.$ƒ&D&]&"DE3U*+
.ŠH‹+&MF<€ŒDP1•F•&DTO"J•"Ž
+&ROT.‚'Ž'!"•&}S]•|D&*w&!
"&$BF•&XW&Gh&O"‘J•~1&$BFOt.L’,&
O]"J+)(&(O"*Dw"*„••0“YA|A“.”~C.+•
2QQAO"&(.$ƒ,RS].”GwR2A1“N•C,PvO"S–•+'\•&F
hF1
"&$BPGH|DF,}GG&{FG}SFDOG}~G‚D&h&O"
J.†,J•D&X1•D-/"+'!&(O"*&F*•J
•RDF.BC$S’P\&)**+„C",!1L.Z*""+'
!,/+•FC$!"PD*/.$ƒ"'P\&•h&J+)(J()F1
D&†G!*C}€.$ƒ'V'&RK+'$%&'"'",
!,S%G$ƒ,/'$%&'"'&(.‚."PvF,'u&,MF.J+
v,R)"DEFŽ•,/‹D&vw.†&(O"E.$B&.&t

-&$BPGH1Z*G'$%&'"'$%&.]J•wD&†G!*”
-,U$T&C,$R&Px.yC•&$DEO*‚".%&(
-)F.••.$ƒ‚"EJ",R""&(D*/]&O"*1
*}€DEO*O]'LSF.Z*
L0 3U*+Gw)F.+O"&$BPGH1
L2 +J+-DWPhGK,.y$%&DE1
L7 —&Š$%&DE1
LA {%G$ƒ,/&(O"&$BPGHOz&'u&,MF.
J+D&vw
eRh&J+Ž+MF}w\wMFO*”z
\.„X!',E†CF&„-XFU$T&G„.†D†JF
h&&EE.—,.$ƒO+1
˜€Z(%{1{1™e•%.—•h&O&(&SW„
,SZSt.†(Ž&SvDF.BMFO*1
7
,#(.-/0(*12-345*678)*9-(:"
# ;<=>?@ABC>D
### EFA
.ŠH|•$R&~š|eC˜~1
Chu trình (có hướng) Hamilton GDE|•$R&~S%-')FX.”.ŠH1
Đường đi (có hướng) Hamilton G.$B&.|•$R&~S%-')FX.”.ŠH1
$,!*XDEFG•.‚POz&S].”C,X.$B&.FG
•.‚POz&S].”D•01
ŠHŽFDE|•$R&~FG&XGđồ thị Hamilton.
Ví dụ1›V.ŠH
@#
ŠHDwJ&•.$B&.˜G}D,E".”&CC}CŒ•O!G…C$&•
DEFG
F→O→→P→}→Œ→&→F
##G HIJK

Định lí (S’.ŠH•DEFG1_.•
|~ŠHGw&1
|~X.”MF•O!GR%yOz&2C,•.W&FGw‚
‚DE1
|~+€•F.k.”O-Jœ^&"Gw‚W&CE.ŠH•G
S–•].Fk'LGw&1
Chứng minh
K./|~,|~G†w1K./|~S*DF•v+GJ€•F.J
.”O-Jœ^&"Gw‚W&EDEOHFDF/-
J'L1
Hệ quả
(S’.ŠHn.”•.$B&.FG1_.•
|~ŠHGw&1
|~•„-n−2.”O!≥2C,™.”•.W&FGw‚‚
.$B&.1
|~+€•F.k.”O-Jœ^&"Gw‚W&CE.ŠH•G
S–•].Fk•0'LGw&1
A
Ví dụ 11›V.ŠH
@G
ŠHJ&•DEFG1
!,!*C+ŠDEFGE•'(•Y1eEO!
P}&|,
2
~šP}&|,
A
~š7w'(‚R,
2
,‚R,
A

J&‚
DE1{]•GGAwJ&†•Y.$ƒCZx1
F•&•†"'P\&Dv+'HGUDw1+Ou.2.”,
2
,,
A
^&
"Gw‚W&E.ŠH•GG7.”.‚G!'C•7'LGw
&1$,!*}K./|~MFHGUDwE.ŠHJ&•DE
FG1
Ví dụ 21Ž&Dz&.ŠHSFJ&•.$B&.FG1
@$
(S’G.$B&.FG1ŠHDw•0[.”Cw.$B&.•0Y
|ž~1
‘Cách 11eE.ŠH•2NwS]J&zDw.$B&'(G02
|žž~1
›V".”‚!'šŸ0C2C7CACYC[CN 1X˜

Cš0C111CNCG!'ƒ'"
Gw‚.”∈J&zDw.$B&.1eEXy'.”D&J&J/
Fw"!'˜

•&DBF•&y'‚1$,!*S]Gw‚".”
MFJ&zDwG
Jš
( )

=
N
0i

i
Ecard
eES]Gw‚0.”zDw.$B&./-G2w™!'
˜
0
C˜
2
C˜
7
C˜
N
•„-0,™!'˜
A
C˜
Y
C˜
[
•„-71eE,!*
Y
J≥Až0•7ž7š071
Zx,R|žž~1
‘Cách 21›V“.”•G1Z*G".”J&J/F•&y'‚C
D&.••„-N.”•2Gw‚∈,2.”•G•„-0
Gw‚∈1$,!*S]∈„-GNž2•2š0[CZx,R|ž~1
‘Cách 31›"N.”0C2C7CACYC[CN,"Gw‚E.ŠH•G
•“.”G!'CŽ“'LGw&1}K)(21A12|~C.ŠHJ&•
.$B&.FG1
Ví dụ 31|Bài toán xếp chỗ ngồi~“&$BO^&&Š•D&OD•AGL1™
GLX.$ƒ€+'&Š}‚Žv1—*F*.‹™&Š™GLSFJ&•
2&$B&Š&LF%0GL1

FG!'.ŠH“.”0C2C111C“C.””&$B1F.y.”0Z,"
.”•GDw.$B&D•$E,–1™"€+'G‚DEFGMF
.ŠH1
DEŽ-$E,–G
0→2→7→A→Y→[→N→•→“→0
@L
›F*GLG$ƒDE"&•π¡A}/J.Š&ŠF!.$ƒ"
DEC•&G""€+'CSF
@&
0→7→Y→2→N→A→“→[→•→0
[
@M
0→Y→N→7→“→2→•→A→[→0
@N
0→N→“→Y→•→7→[→2→A→0
##$ HIJ<O
Định lý 1ŠH.M_

,RnG…|n≥7~•|n−0~¡2DEFG•&.
‚J&&FF|ŽGJ&•&~1
Chứng minh
$%&v$GB&(O"€+'“&$BDwOD•CF€Z*Pv&"€+'
}DEFGDw.ŠHSF|š2J•0~
0→2→7→111→2J→2J•0→0


@P
N
›F*DEGLG$ƒ‚&•π¡J}/J.Š&ŠF!.$ƒJ
"€+'1

Định lý 2 (Dirac):G.%.ŠHn.”|n≥7~1+O!P}&|,~≥n¡2,RX
.”vMFCE•DEFG1
Định lý 3:G.ŠH.%n.”|n≥7~1+O!P}&|,~≥|−0~¡2,RX.”
,MFE•.$B&.FG1
Chứng minh
+š0E•.$B&FGL$B&G0.”1
(S’¢01FG!'.ŠHOz&"w,.”,,-("],
,RX.”MF1ŠH••0.”,P}&|,~š1eRX.”∈F•
P}&

|~šP}&

|~•0≥|−0~¡2•0š|•0~¡2
}.HGU?DFE•DEFG1u.,,"R,F
.$ƒ.$B&.FGD&1
Định lý 4:G.ŠH.%n.”|≥7~1(S’,,GF.”J&J/
FMFSF 
P}&|~•P}&|,~≥1
_.••DEFGJ,”J.ŠH•|C,~|.ŠHw
|C,~~•DEFG1
Định lý 5:G.ŠH.%&(.”1(S’£,¤GF.ŠH.$ƒ
•Oz&)*']-(y'.”J&J/F•‹&"O!„-Oz&1
_.•F•£š¤1
•.HGUDwF•†.H&IFJ"Kbao đóngMF.ŠH1
Định nghĩa 6: Bao đóng|~MF.ŠHn.”G.ŠH.$ƒ•Oz&"C
})*'C]-("y'.”J&J/F‹&S]O!„-Oz&n
.+JJ&•y'.”$,!*hF1
Ví dụ 2.4.51"€Z*Pv&OF.•&1
@Q
Định lý 7:ŠH•DEFGJ,”JOF.•&MF•DE

FG1
Định lý 8: +OF.•&|~š_

|≥7~E.ŠH•DEFG1
Định lý 9RECS6?TUG.%.ŠH.”|≥7~1+P}&|~•P}&|,~≥
,RXy'.”J&J/FE.ŠH•DEFG1
Định lý 10:G.%.ŠH.”|≥7~,1+≥|−0C2~•2E
.ŠH•DEFG1

Định lý 11:.ŠH.%G.ŠHG$¥&'Z,RF!'.”e
0
,e
2
SF

FDP|e
0
~šFDP|e
2
~š≥2
+O!P}&|,~¢¡2,RX.”,MFCE•DEFG1
Đồ thị có hướng.
 .ŠH•$R&,Rn.”1F•"J+)('"O†D&".H
GUSF
Định lý 12:|điều kiện đủ tồn tại chu trình có hướng Hamilton~
F1|}*}G~+.ŠHGw&,
P}&|~•P}&|,~≥2n−0∀C,∈J&J/F
E•DE•$R&FG1
O1|GF‘D~+.ŠHGw&,
P}&|,~≥n∀,∈

E•DE•$R&FG1
1|ˆPFGG~+
P}&
<
|~•P}&

|,~≥n∀C,∈J&Š&•.+,
E•DE•$R&FG1
P1+
P}&

|,~≥¡2#P}&
<
|,~≥¡2∀,∈
E•DE•$R&FG1
•Định lý 13:|điều kiện đủ tồn tại đường đi có hướng Hamilton~
a. Nếu
P}&|~•P}&|,~≥2−7∀C,∈J&J/F
thì G có đường đi có hướng Hamilton.
b. Nếu
P}&|,~≥−0∀,∈
thì G có đường đi có hướng Hamilton.
c. Nếu
P}&
<
|~•P}&

|,~≥−0∀C,∈J&Š&•.+,
thì G có đường đi có hướng Hamilton.
d. Nếu

P}&

|,~≥¡2#P}&
<
|,~≥¡2∀,∈
thì G có đường đi có hướng Hamilton.
Z*&BW&FS–&wŽ.$B&.,DE•$R&FGD&
.ŠH•$R&.M|•.ŠHG•.M~1D$R+G.HGUJ¦&.HSvŠ.$B&
.•$R&FGD&.ŠH•$R&.M1
Định lý 14 (Konig)X.ŠH•$R&.M./•.$B&.•$R&FG1
Định lý 15 (Camion)ŠH•$R&.M•DE•$R&FGJ,”
J•Gw&1

G V>>DWWVX>DW;CE
G## >JX>DW
‚&$B€-'"•‚'].•]R•

0
']J"C™'].W&‚GLCDŠ)F*,/']OF.L1uw.
}DEv.†.‚P‹&‚&" . .$B&.)FG&t-|J(&
"&hFF']•††GvG*&$B&yB&FL.y
'„MFDEC111,€}$D$R~1
›V .Š H .L* .M š|eC˜~C ,R ešŸ0C 2C 111C  C • DX& S] ,R DX& S]

§
š|C§~•†J"
§
š|§C~1$,!*CF•†€}$G‚.ŠH•
$R&.L*.M¨¤}&IF,RXC§š0C2C111CC©§CG•|C§~C
|§C~


˜1"DTEDEFG•.‚P&t-D&1
"‹+&*.—•GB&(Oz&"S’P\&'$%&'"'¨",
!¤1
G#G YWYWV
!""!G‚D&"'$%&'"'M*+&(O"]$
‹ƒ'1$$T&%O(MF•GD&)"DEEJ+F'Z"'$%&
"MFO"DFFF*/!'$G"WMFZ*EJ+,]
&t&."&"!"WCGOuh&"FO+ttGJ&
ŽF'$%&"]$1
›Vbài toán người du lịch1X
šŸc
ij
 C§š0C2C111C
Gma trận chi phí1™DE
,š ,|0~→,|2~→111→,|−0~→,|~→,|0~
•†,+P$RP&
,š|,|0~C,|2~~C|,|2~C,|7~~C111C|,|−0~C,|~~C|,|~C,|0~~
D&.•™'L|,|−0~C,|~~&XG‚MFDE1
D&O"&$BPGHJ+EJ+GB&(FS–'Z!'
DEF!' ‚!'ŽF|C§~,!'J&ŽF*1F&X
,K.•G'Z"C™!'•Dw&XG"1eK'Z".$ƒ
OTZ*EJ+
!'-(DE

"DE)F|C§~ "DEJ&)F|C§~
eK'Z"S–.$ƒPvFDw)tƒ'GU.•'V'FDW&t
)"DEEJ+'$%&"]$1{FJ'Z"FS–„!P$RMF
\wD&™!'•Dw1eKEJ+S–EDw!'•!P$Ru
%1M\S–+'\.+J.$ƒDE.L*.MCŽG'$%&"MF

O"&$BPGH1{F.•F”L€Vh&!'•!P$Ru%&"DH
\wE.$ƒ1
0Q
G#$ " ZCSCVOAY[Y>DW
+ J& €" .H  '] €- '" E•ª  DEC ™  DE
Ž&,R‚",H.•MF!'Ÿ0C2C111C 1•+D$R']€-
'"E•-(G|

0~ªDE1
G#L A>?V?\>
a«D&‹&'„MF‚DES–ŽF.W&‚'L’Dw™P•&
,™‚MFFD!'„š|
§
~1?.•+FD•OR™'L’MF‚
P•&|F*‚‚~.^&‚&"DHE'„MF-(DES–&(.‚
G$ƒ&C,E+DE]$S–J&F*.‹1eE,!*++D•OR"
'L’MF™P•&,™‚.‚z&S]SF.$ƒFD!J&Z
,™‚•&$™P•&ŽF„-‚S]QCE‹&"z&S]D•..•S–
F!P$RMFXDE1M\D•OR*&XGM\DW&XC"z&
S]D•T™P•&|‚~&XGz&S]DW&XP•&|‚~CFD!.$ƒ&XGF
D!DW&X1
Thủ tục rút gọn:
◊Đầu vào FD!'„š|c
ij
~
◊Đầu ra FD!DW&X,‹&z&S]DW&XSum
◊Thuật toán
|~_T
 Sum šQ¬|”"'P\&FD!'„OF.L~
|~aW&XP•& 

eR™P•&D•0.+MFFD!vK
‘E'L’

šαu-DwP•&1
‘D•-("'L’DwP•&.‚G$ƒ&α1
‘‚&PŠ Sum šSum•α
|~aW&X‚ 
eR™‚•0.+MFFD!vK
‘E'L’

šαu-Dw‚1
‘D•-("'L’Dw‚.‚G$ƒ&α1
‘‚&PŠ Sum šSum•α
G#& ]W
(S’FX'Z"|DCS~1$,!*"DES–.$ƒFG
F!' 
0
ŽF"DE)F|DCS~,
2
ŽF"DEJ&)F|DCS~1
•"!'
0
 !P$Rβ,R&"DH€-'"••M\DW&X1
‘(-'FD!'„Oz&"GP•&D,‚S1
‘&•-DE 
-|SCD~Oz&".y
SD
š∞1
+|DCS~G'Z"ŽFDT.E'(€V".—X]
D$R,SF|DCS~P—*]+'"$ESF

→ 111 → 111 →
|C§~ 111 |DCS~ 111 |JC~
,--("P&|C~Oz&".y

š∞1
aW&XFD!'„F•!P$Rβ šβ•|‹&z&S]DW&X~1
00
F•†+'\M\'Z"}"*,RFD!'„.—
.$ƒK”,&(0O!1eKX.†'Z"FS–OT\
+'}1
•"!'
2
 
‘-|DCS~Oz&".y
DS
š∞1
‘vKM\DW&X,RFD!'„$%&Ž&,„!P$R
β šβ•|‹&z&S]DW&X~"1
F•†+'\M\'Z"}"*,RFD!'„.—
.$ƒK”^&!P$R$%&Ž&1eKX.†'Z"FS–
OT\+'}1
G#M O>^_Y]W
‚"G&GFX'Z"|DCS~SF!P$RMF"
J&ŽF|DCS~S–•&/-1
Thủ tục chọn cạnh phân nhánh (r,s)
◊Đầu vào FD!DW&XO!J1
◊Đầu ra 'Z"|DCS~1
◊Thuật toán
|~_T α š−∞¬
|~eR™y'|C§~(c

ij
šQ|š0C111CJ¬§š0C111CJ~vK
‘›".H
DšŸ

 ≠§
SšŸ
§
 ≠
‘+α-D•SC.y
α šD•S¬ D š¬ S š§¬
G#N "G_!`
™DE•1{FJ.—X−2CF'(X]2•
G13W*FD!DW&X•O!2,G‚D&FP&SF
^&!P$Rβ1
D&D$B&ƒ'|~FXF|'C~,|)C,~C•D&D$B&ƒ'|~
FXF|'C,~,|)C~1‹&'„Gβ1
02
,G*0a0"b-cd"9e(*f-5"5*g-h67
# i>Iij>?\kCJ
†&()*+",-./MF.ŠHOz&"*„W&FLG$&h.ŠH
D&O‚RMF"*„1?.•W&FL.$FDF"'$%&'"'O†P®.Š
HOT"-DWPhGK1•/'$%&'"'O†P®.ŠH O†P®.ŠH
Oz&FD!J/CFD!Gw‚CPFS"|&~,PFS"J/1
D&./*.ŠH.$ƒG$DhOTFD!,&"6lmlmC,RGS]
.”MF.ŠH,<{¯°¯±°G'„.•.”.+.”§1
Ví dụ ŠHSF1
ŠHDw.$ƒG$,FD!$SF
0 2 7 A
0


2Q Y 0Y
2 0Q

0Y 2Q
7 • Y

2Q
A Y 2 2Y

G V>>DW
?vF,'LGU*+TDw!""!.$ƒ.H&IFOT"
$%&DESF
G## B?\>
Thủ tục rút gọn:
•Đầu vào FD!'„š|
§
~
•Đầu ra FD!DW&X,‹&z&S]DW&XSum
•Thuật toán
|~_T { šQ¬
|~aW&XP•& 
eR™P•&D•0.+MFFD!vK
‘E'L’

šαu-DwP•&1
‘D•-("'L’DwP•&.‚G$ƒ&α1
‘‚&PŠ { š{•α
|~aW&X‚ 
07

2
Y
A 7
0 2
2
Q
0
Y
Y0
Y
Y
2
Q
0
Q
2
Q
Y

2
eR™‚•0.+MFFD!vK
‘E'L’

šαu-Dw‚1
‘D•-("'L’Dw‚.‚G$ƒ&α1
‘‚&PŠ { š{•α
•Ví dụ1FD!'„MFO"&$BPGH,Rš[$SF
0 2 7 A Y [ α
0 ∞ 7 “7 07 77 “ 7
2 A ∞ NN A2 20 0[ A

7 AY 0N ∞ 7[ 0[ 2• 0[
A 7“ “Q •Q ∞ Y[ N N
Y 2• A[ •• 77 ∞ 2Y 2Y
[ 7 •• 0• A[ “2 ∞ 7
F+DW&XFD!*.†E!P$R-(DE
‘Khởi tạo
y { šQ¬
‘Rút gọn các dòng
"'L’u-Dw"P•&}Žv0C2C7CACYC[G7CAC0[CNC2YC
71
D•OR"'L’P•&0C2C7CACYC[."z&S]DW&X$%&Ž&Dw
‚F.$ƒFD!
0 2 7 A Y [
0 ∞ Q “Q 0Q 7Q [
2 Q ∞ N7 7• 0N 02
7 2“ 0 ∞ 2Q Q 02
A 72 •7 N2 ∞ A“ Q
Y 7 20 [7 • ∞ Q
[ Q •Y 0Y A7 •“ ∞
α Q Q 0Y • Q Q
‚&PŠ"z&S]DW&XF.$ƒ
{ š{•7•A•0[•N•2Y•7šY•
‘Rút gọn các cột
"'L’u-Dw"‚}Žv0C2C7CACYC[GQCQC0YC•CQCQ1
D•OR"'L’‚0C2C7CACYC[."z&S]DW&X$%&Ž&Dw
&|F.$ƒFD!DW&X~
0A
0 2 7 A Y [
0 ∞ Q NY 2 7Q [
2 Q ∞ Y• 7Q 0N 02

7 2“ 0 ∞ 02 Q 02
A 72 •7 Y• ∞ A“ Q
Y 7 20 A• Q ∞ Q
[ Q •Y Q 7Y •“ ∞
‚&PŠ"z&S]DW&XF.$ƒ
{ š{•Q•Q•0Y•••Q•QšY••0Y••š•0
e!*!P$R-(DEGβšQ•Sš•0
|&IFGJ&•DE•‹&'„u%•0~1
G#G O>^Y]W
(S’FX'Z"|DCS~1$,!*"DES–.$ƒFG
F!' 
0
ŽF"DE)F|DCS~,
2
ŽF"DEJ&)F|DCS~1
•"!'
0
 !P$Rβ,R&"DH€-'"••M\DW&X1
‘(-'FD!'„Oz&"GP•&D,‚S1
‘&•-DE 
-|SCD~Oz&".y
SD
š∞1
+|DCS~G'Z"ŽFDT.E'(€V".—X]
D$R,SF|DCS~P—*]+'"$ESF
→ 111 → 111 →
|C§~ 111 |DCS~ 111 |JC~
,--("P&|C~Oz&".y

š∞1

aW&XFD!'„F•!P$Rβ šβ•|‹&z&S]DW&X~1
F•†+'\M\'Z"}"*,RFD!'„.—
.$ƒK”,&(0O!1eKX.†'Z"FS–OT\
+'}1
•"!'
2
 
‘-|DCS~Oz&".y
DS
š∞1
‘vKM\DW&X,RFD!'„$%&Ž&,„!P$R
β šβ•|‹&z&S]DW&X~"1
F•†+'\M\'Z"}"*,RFD!'„.—
.$ƒK”^&!P$R$%&Ž&1eKX.†'Z"FS–
OT\+'}1
•Ví dụ1›V+',„P\Dw1(S’FX'Z"G|DCS~š|[C7~1"
DES–.$ƒ'ZF"

0
ŽF"DE)F|[C7~,

2
ŽF"DEJ&)F|[C7~1
•›V"!'
0

‘(-'FD!'„Oz&"GP•&[,‚71
‘&•-DE 
0Y
 -|7C[~Oz&".y7[š∞1

F!.$ƒFD!'„$%&Ž&^&!P$R€-'"βš•01
0 2 A Y [
0 ∞ Q 2 7Q [
2 Q ∞ 7Q 0N 02
7 2“ 0 02 Q ∞
A 72 •7 ∞ A“ Q
Y 7 20 Q ∞ Q
eEFD!.—TP&DW&Xw!P$R,x&h&*wβš•01
F•†+'\M\'Z"}"*,RFD!'„.—.$ƒ
K”1eKX.†'Z"FS–OT\+'}1
•"!'
2
 
‘-|[C7~Oz&".y
[7
š∞1
‘vKM\DW&X,RFD!'„$%&Ž&,„!P$R
β šβ•|‹&z&S]DW&X~"
0 2 7 A Y [
0 ∞ Q NY 2 7Q [
2 Q ∞ Y• 7Q 0N 02
7 2“ 0 ∞ 02 Q 02
A 72 •7 Y• ∞ A“ Q
Y 7 20 A• Q ∞ Q
[ Q •Y ∞ 7Y •“ ∞
αšA•
‚Ž7•&(-('L’.'L’u-
Y7
šA•,F!.$ƒ
FD!DW&XSF

0 2 7 A Y [
0 ∞ Q 2N 2 7Q [
2 Q ∞ 0Q 7Q 0N 02
7 2“ 0 ∞ 02 Q 02
A 72 •7 0Q ∞ A“ Q
Y 7 20 Q Q ∞ Q
[ Q •Y ∞ 7Y •“ ∞
,!P$R
β š β•αš •0•A• š 02“
F•†+'\M\'Z"}"*,RFD!'„.—
.$ƒK”^&!P$R$%&Ž&|02“~1eKX.†'Z"F
S–OT\+'}1
0[
G#$ O>^_Y]W
‚"G&GFX'Z"|DCS~SF!P$RMF"J&
ŽF|DCS~S–•&/-1
Thủ tục chọn cạnh phân nhánh (r,s)
•Đầu vào FD!DW&XO!J
•Đầu ra 'Z"|DCS~1
•Thuật toán
|~_T α š‘∞¬
|~eR™y'|C§~(
§
šQ|š0C111CJ¬§š0C111CJ~vK
‘›".H
DšŸ

 ≠§
SšŸ
§

 ≠
‘+α-D•SC.y
α šD•S¬ D š¬ S š§¬
•Ví dụ1›V+',„P\Dw1F.}"
0
C)F|[C7~1!P$Rβš•0
,FD!'„$%&Ž&$SF
0 2 A Y [
0 ∞ Q 2 7Q [
2 Q ∞ 7Q 0N 02
7 2“ 0 02 Q ∞
A 72 •7 ∞ A“ Q
Y 7 20 Q ∞ Q
‘yαš‘∞1
‘›V"y'|C§~•
§
šQ1
y'|0C2~  Dš2¬Sš0¬
αš‘∞-D•Sš7→α š7¬ D š0¬ S š2¬
y'|2C0~  Dš02¬Sš7¬
αš7-D•Sš0Y→α š0Y¬ D š2¬ S š0¬
y'|7CY~  Dš0¬Sš0N¬
αš0Y-D•Sš0•→α š0•¬ D š7¬ S šY¬
y'|AC[~  Dš72¬SšQ¬
αš0•-D•Sš72→α š72¬ D šA¬ S š[¬
"y'|YCA~,|YC[~•‹&D•S-αCwJ&G
F*.‹α,|DCS~1
_+)(FX.$ƒ'Z"G|AC[~1
!'DE
0

S–.$ƒ'Z2"

00
&Š"DE)F|AC[~,

02
&Š"DEJ&)F|AC[~1
•"
02
•FD!'„$%&Ž&$SF
0N
0 2 A Y [
0 ∞ Q 2 7Q [
2 Q ∞ 7Q 0N 02
7 2“ 0 02 Q ∞
A 72 •7 ∞ A“ ∞ 72
Y 7 20 Q ∞ Q
α
vKM\DW&XF.$ƒFD!DW&X
0 2 A Y [
0 ∞ Q 2 7Q [
2 Q ∞ 7Q 0N 02
7 2“ 0 02 Q ∞
A Q Y0 ∞ 0N ∞
Y 7 20 Q ∞ Q
,R‹&z&S]DW&Xαš72,!P$Rβšβ•αš•0•72š0071
•"
00
 
‘3&A,‚[F•S–•FD!'„-'A$%&Ž&

0 2 A Y
0 ∞ Q 2 7Q
2 Q ∞ 7Q 0N
7 2“ 0 02 Q
Y 7 20 Q ∞
‘-DE
|[C7~XD$RJ++'SF|AC[~
→ → 
|AC[~|[C7~
D&O$R*F-|7CA~COz&".y
7A
š∞1F!.$ƒFD!
0 2 A Y
0 ∞ Q 2 7Q
2 Q ∞ 7Q 0N
7 2“ 0 ∞ Q
Y 7 20 Q ∞
0•
FD!'„.—TP&DW&Xw!P$Rβ&h&*wβš•01
Z*&BF+'\M\X'Z"C'Z",DW&X.],R
00
1
vKM\X'Z"CFX.$ƒ'Z"|2C0~,
‹&z&S]DW&X$%&Ž&G0N•7š2Q1
!'
002
&Š"DED&
00
J&)F|2C0~S–•!P$RG
βšβ•2Qš0Q01

!'
000
&Š"DED&
00
)F|2C0~S–•FD!'„
-'7$%&Ž&CSFJ.—G&2,‚0
2 A Y
0 Q 2 7Q
7 0 ∞ Q
Y 20 Q ∞
‘ &•-DE
y
02
š∞.†-|0C2~1
|2C0~J&]+'^&"XD$RG|[C7~,|AC[~CwFJ&
'(-"J"1F•FD!'„
2 A Y
0 ∞ 2 7Q 2
7 0 ∞ Q
Y 20 Q ∞
0 α
FD!'„.$ƒDW&X$SF
2 A Y
0 ∞ Q 2•
7 Q ∞ Q
Y 2Q Q ∞
!P$Rβšβ•αš•0•7š•A1
$%&vF+'\M\X'Z"C'Z",DW&X.]
,R
000

1
X'Z"|0CA~C‹&z&S]DW&X$%&Ž&G2••Qš2•1
!'
0002
&Š"DED&
000
J&)F|0CA~S–•!P$RGβ
šβ•2•š•A•2•š0021
0“
!'
0000
&Š"DED&
000
)F|0CA~S–•FD!'„-'2
$%&Ž&
 2 Y
7 ∞ Q
Y 2Q ∞
2Q α
|0CA~]+'^&"XD$RG|[C7~C|AC[~,|2C0~PZ*
|2C0~C|0CA~C|AC[~C|[C7~C
wF'(-|7C2~COz&".y
72
š∞1
aW&XFD!*F.$ƒFD!DW&X
2 Y
7 ∞ Q
Y Q ∞
,!P$Rβšβ•αš•A•2Qš0QA1
"G_!`

™DE•1{FJ.—X‘2CF'(X]2
•G13W*FD!DW&X•O!2,G‚D&FP&SF 
 ,  ,
' Q ∞ ' ∞ Q
) ∞ Q ) Q ∞
|~ |~
^&!P$Rβ1
D&D$B&ƒ'|~FXF|'C~,|)C,~C•D&D$B&ƒ'|~
FXF|'C,~,|)C~1‹&'„Gβ1
•Ví dụ1›V+',„P\Dw1{FJX"|[C7~C|AC[~C|2C0~C|0CA~F•FD!
DW&X
2 Y
7 ∞ Q
Y Q ∞
2Q
,!P$Rβš0QA1FX]F•GG|7CY~,|YC2~,.$ƒ
DE
|0CA~C|AC[~C|[C7~C|7CY~C|YC2~C|2C0~
,R‹&'„Oz&βš0QA1
"DEDw•†O†P®Oz&S%.ŠSF
Cận dưới Cận dưới
βš  βš
 
2
-( DE
•0 DE J&ŽF|[C7~ 02“

0

02

DE DE
•0 ŽF|[C7~ J&ŽF|AC[~ 007

00
DE 
002
DE
•0 ŽF|AC[~J&ŽF|2C0~0Q0


000
DE 
0002
DE
•A ŽF|2C0~J&ŽF|0CA~002


0000
DE 
0QA ŽF|0CA~

X+'F•GF•DE
'š|0CA~C|AC[~C|[C7~C|7CY~C|YC2~C|2C0~,'„
'
š0QA
FS%.ŠDwF-*""
2
C
02
C

0002
•!P$RGR%
'
š0QAC
,E+"DEMF"".••‹&'„GR%
'
1”•"
002
•!P$RG0Q0u%
'
1+'}FEDER}"*1
20
•"
002
S–•FD!'„-'A$%&Ž&
0 2 A Y
0 ∞ Q 2 7Q
2 ∞ ∞ 7Q 0N 0N
7 2“ 0 ∞ Q
Y 7 20 Q ∞
7 α
T.Z*
20
š∞.†-|2C0~1!P$R€-'"MF
00
Gβš•01
aW&XFD!'„F.$ƒFD!
0 2 A Y
0 ∞ Q 2 7Q
2 ∞ ∞ 07 Q

7 2[ 0 ∞ Q
Y Q 20 Q ∞
,R!P$Rβšβ•αš•0•2Qš0Q01
X|YC0~G'Z"1"
0022
&Š"DEJ&)F
|YC0~•!P$ROz&0Q0•2[š02N¢0QAš
'
1FGJ&€V"*hF1
•"
0020
&Š"DE)F|YC0~•FD!'„
2 A Y
0 Q 2 ∞
2 ∞ 07 Q
7 0 ∞ Q
2 α
|
0Y
š∞.†-|0CY~~1
aW&XFD!'„F•FD!DW&X
2 A Y
0 Q Q ²
2 ∞ 00 Q
7 0 ∞ Q
,R!P$Rβšβ•³š0Q0•2š0Q71
22
X|0CA~G'Z"1"
00202
&Š"DEJ&)F

|0CA~•!P$ROz&0Q7•00š00A¢0QAš
'
1FGJ&€V"
*hF1
•"
00200
&Š"DE)F|0CA~•FD!'„
2 Y
2 ∞ Q
7 0 ∞ 0
α
|0CA~^&,R".—XP—*
|YC0~C|0CA~C|AC[~C|[C7~
,E+F-|7CY~COz&".y
7Y
š∞1aW&XF.$ƒFD!
2 Y
2 ∞ Q
7 Q ∞
,!P$Rβš0Q7•0š0QA1
X+'2•G|7C2~,|2CY~F.$ƒDE
|YC0~C|0CA~C|AC[~C|[C7~C|7C2~C|2CY~
,R‹&'„G0QA1
•Kết luận FDEE.$ƒG]$,R'„-'-G0QA
|0CA~C|AC[~C|[C7~C|7CY~C|YC2~C|2C0~
,
|0CA~C|AC[~C|[C7~C|7C2~C|2CY~C|YC0~
27
,$n-o"8pcq
r"WIAXWD`<sC>?k

(&F/S ?^&.†G$'„.$B&..+"']1
(&‚/ O¯0° G$‹&'„.$B&.1
(&´F&¯0Q°¬GGFDF&FF&O€F
(&´§¯0Q°¬GGFDF&O€F
F&¯2Q° 3$‹&u-}&,‚
F&G§¯2Q° 3$G.”.$ƒXD&•&O$RGy'
F&G¯2Q°¬3$G.”§.$ƒXD&•&O$RGy'
FD}ŒG}¯[N°¬3$wŒG}1
r"WB>?D>?@
01 DtBAGR>=>B=>Al#%%ml#%%m=>u=>vU DF(&F
/F1CG”S]‚,&|D&O"*Eš~C€C*G.H,H
.‚.†1
21 DcTAwCTRU.XPhGK•‚ŒG}|P&$BP^&!'wŒG}~1
?hGKD&ŒG}.$ƒG$,(&F†S1
71 D?>DtAR>=>B=>Al#%%ml#%%mU €".H'L’
u-Dw&|~,D•-("'L’J"Dw&1
A1 D?>DtD>R>=>B=>Al#%%ml#%%mU€".H'L’u
-Dw‚|~,D•-("'L’J"Dw‚1
Y1 >>DtBxR>=>Al#%%ml#%%m=>=>xU„‹&}
&,‚CD(,/J+)(„.$ƒ1
[1 DuAtR>=>Al#%%ml#%%m=>CU€".H|C§~D&
.•&´§|~GGR-1e.yD&"€•F&‚§1
{FJvKO$RGy'E€".H.$ƒ.†,.†§G$D&
F&F&G,F&G§1?^&,•&Gy'‰G}D&$%&DE„.†J+
+DE.$B&.1
◊µG}PhGK.L, a1•-DW
 |S].”~
F
00
F

02
111F
0
|FD!'„~
F
20
F
22
111F
2
11111111111111111111
F
0
F
2
111F

◊µG}PhGK.LDF ae˜31<•-DW
‘D$B&ƒ'J&ŠDEFG
<3<93˜
‘D$B&ƒ'ŠDEFG
<3<{  |'„]$~
<393˜ |DE]$~

0
→€
2
→111→€

→€

0
*
0
→*
2
→111→*

→*
0
111

0
→¶
2
→111→¶

→¶
0
2A
◊Ví dụ 1
ae˜31 ae˜31<
[ <3<{ 0QA
∞ 7 “7 07 77 “ <393˜
A ∞ NN A2 20 0[ 0→A→[→7→Y→2→0
AY 0N ∞ 7[ 0[ 2• 0→A→[→7→2→Y→0
7“ “Q •Q ∞ Y[ N
2• A[ •• 77 ∞ 2Y
7 •• 0• A[ “2 ∞
◊Ví dụ 2
ae˜31 ae˜31<

A <3<93˜
∞ 7 A ∞
A ∞ Y ∞
2 0 ∞ ∞
∞ ∞ ∞ ∞
2Y

×