’<br />
Tap ch´ Tin hoc v` Diˆu khiˆn hoc, T.23, S.2 (2007), 153–163<br />
ı<br />
e<br />
e<br />
.<br />
. a `<br />
.<br />
<br />
’<br />
´<br />
´<br />
´<br />
ˆ<br />
` ..<br />
`<br />
ˆ<br />
ˆ .<br />
CAC GIAI THUAT T` KIEM VA LU A CHON THANH PH` N COTS TOI U U<br />
IM ˆ<br />
A<br />
.<br />
.<br />
.<br />
`.<br />
˜. ˆ<br />
´<br />
ˆ<br />
´<br />
`<br />
`<br />
THEO CAC TIEU CH´ GIA THANH VA DU THU A DU LIEU<br />
I<br />
.<br />
´<br />
´<br />
`<br />
ˆ<br />
˘<br />
`<br />
HUYNH QUYET THANG1 , PHAM THI QUYNH2<br />
.<br />
.<br />
<br />
o<br />
CNTT, Tru.`.ng DHBK H` Nˆi<br />
a o<br />
.<br />
2<br />
.`.ng DHSP H` Nˆi<br />
a o<br />
Khoa CNTT, Tru o<br />
.<br />
<br />
1 Khoa<br />
<br />
Abstract. Component-based software development is gaining recognition as the key technology for<br />
the construction of high-quality, evolvable and large software systems in timely and affordable manners. Commercial components (COTS) is being used more and more in Component-Based Software<br />
Engineering for building software applications, and accordingly, some mechanisms are demanded by<br />
developers of software applications to describe, search, select and compose COTS components. In<br />
this paper we presented two algorithms applied to select COTS components witth optimization of<br />
cost and data redunancy (size). The proposed algorithms are realized based on .NET platform and<br />
experimented on case study Geographic Translator Service. The comparison between proposed and<br />
original algorithm also is presented.<br />
´<br />
’<br />
`<br />
`<br />
`<br />
T´m t˘t. Ph´t triˆn phˆn mˆm hu.´.ng th`nh phˆn (Component-Based Software Development o<br />
a<br />
a<br />
e<br />
a<br />
e<br />
o<br />
a<br />
a<br />
.ng k˜ thuˆt tiˆu biˆu xˆy du.ng c´c phˆn mˆm l´.n, ph´.c tap, gi´ p giam<br />
’ a<br />
`<br />
`<br />
’<br />
a<br />
a<br />
e<br />
o<br />
y<br />
a e<br />
e<br />
u .<br />
u<br />
CBSD) l` mˆt trong nh˜<br />
a o<br />
u<br />
.<br />
.<br />
.<br />
`<br />
`<br />
`<br />
th`.i gian, cˆng s´.c v` gi´ th`nh xˆy du.ng phˆn mˆm. C´c th`nh phˆn thu.o.ng mai (COTS) dang<br />
o<br />
a<br />
e<br />
a<br />
a<br />
a<br />
o<br />
u a a a<br />
a<br />
.<br />
.<br />
’<br />
`<br />
`<br />
`<br />
’ .<br />
a<br />
a e a<br />
a ´<br />
a a<br />
e<br />
o<br />
e `<br />
a<br />
e<br />
du.o.c su. dung ng`y c`ng nhiˆu trong cˆng nghˆ phˆn mˆm du.a th`nh phˆn dˆ xˆy du.ng c´c u.ng<br />
.<br />
.<br />
.<br />
.<br />
’<br />
´<br />
´<br />
`<br />
´ ’<br />
o a<br />
a a<br />
e ´<br />
a e `<br />
a<br />
o o<br />
dung phˆn mˆm, v` do d´ c´c nh` ph´t triˆn u.ng dung d˜ yˆu cˆu mˆt sˆ co. chˆ dˆ mˆ ta, t` kiˆm,<br />
a `<br />
e<br />
a<br />
e e o ’ ım e<br />
.<br />
.<br />
.<br />
`<br />
’<br />
a a<br />
a<br />
a<br />
a<br />
a a a<br />
u<br />
o ınh a<br />
a .<br />
lu.a cho n v` xˆy du.ng c´c th`nh phˆn COTS. Trong b`i b´o n`y ch´ ng tˆi tr` b`y giai thuˆt lu.a<br />
.<br />
.<br />
.<br />
.<br />
’<br />
`<br />
´<br />
chon c´c th`nh phˆn COTS tˆ i u.u theo du. th`.a d˜. liˆu (k´ thu.´.c) v` gi´ th`nh, dˆ t´ ho.p trong<br />
a<br />
a<br />
o<br />
e ıch .<br />
u u e<br />
ıch<br />
o<br />
a a a<br />
. a<br />
.<br />
´<br />
´<br />
`<br />
`<br />
`<br />
’<br />
a<br />
a `<br />
a<br />
a<br />
a<br />
e<br />
e<br />
a o o<br />
u .<br />
phˆn mˆm cˆn xˆy du.ng. Thuˆt to´n dˆ xuˆt c´ dˆ ph´.c tap chˆp nhˆn du.o.c. C´c thu. nghiˆm<br />
a<br />
e<br />
a a<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.o.c thu.c hiˆn trˆn mˆt b`i to´n cu thˆ: Thiˆt kˆ dich vu chuyˆn dˆ i khuˆn dang c´c anh khˆng<br />
’<br />
’<br />
’ o<br />
´ e .<br />
´<br />
’<br />
du .<br />
o<br />
a<br />
o<br />
e<br />
e<br />
o a<br />
a . e<br />
e<br />
e<br />
.<br />
.<br />
.<br />
.<br />
.<br />
gian.<br />
<br />
’. A<br />
ˆ<br />
1. MO D` U<br />
`<br />
`<br />
`<br />
a<br />
a<br />
e<br />
o<br />
a<br />
e’ .<br />
u<br />
Ph´t triˆ n phˆn mˆm du.a th`nh phˆn (CBSD) cho ph´p ngu.`.i ph´t triˆ n tao ra nh˜.ng<br />
a<br />
e’<br />
a<br />
e<br />
.<br />
.ng dung d`ng mˆt phˆn phˆn mˆm du.o.c goi l` c´c th`nh phˆn. Th`nh phˆn phˆn mˆm<br />
`<br />
`<br />
`<br />
`<br />
`<br />
`<br />
`<br />
u<br />
o<br />
a<br />
a<br />
e<br />
a<br />
a<br />
a<br />
a<br />
a<br />
e<br />
u<br />
´<br />
.<br />
.<br />
.<br />
. a a<br />
.n vi cˆ u th`nh v´.i giao diˆn du.o.c thoa thuˆn tru.´.c v` chı phu thuˆc du.´.i g´c dˆ<br />
´<br />
’<br />
a<br />
o<br />
e<br />
a<br />
o a ’<br />
o<br />
o o o<br />
l` mˆt do . a<br />
a o<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
´<br />
’ a<br />
a o<br />
ınh a<br />
e<br />
o e<br />
a o a<br />
u<br />
o<br />
e e<br />
nˆi dung d˜ r˜ r`ng, ch´ng c´ kha n˘ng liˆn kˆt, tu.o.ng t´c v´.i nhau h` th`nh nˆn mˆt hˆ<br />
o<br />
. .<br />
.<br />
`<br />
`<br />
`<br />
´<br />
a<br />
a<br />
a<br />
e<br />
o e’<br />
e’<br />
o a<br />
thˆng m´.i. Th`nh phˆn phˆn mˆm c´ thˆ du.o.c triˆ n khai mˆt c´ch dˆc lˆp. COTS l` mˆt<br />
o<br />
o<br />
o a<br />
a o<br />
.<br />
.<br />
. .<br />
.<br />
.o.ng mai (c´ thˆ du.o.c cˆ p giˆ y ph´p, ho˘c du.o.c b´n)<br />
’<br />
`<br />
`<br />
`<br />
´<br />
´<br />
th`nh phˆn phˆn mˆm mang t´ thu<br />
a<br />
a<br />
a<br />
e<br />
ınh<br />
o e<br />
a<br />
e<br />
a<br />
.<br />
. a<br />
.<br />
. a<br />
´<br />
´<br />
u ’<br />
´<br />
o ’ u<br />
u a y e<br />
u<br />
cho ph´p d´ng g´i, phˆn phˆi, lu.u gi˜., su.a ch˜.a v` tu` biˆn theo y ngu.`.i su. d`ng, nh˜.ng<br />
e o<br />
o<br />
a<br />
o<br />
.`.ng l´.n v` du.o.c lu.u tr˜. trong c´c kho phˆn mˆm.<br />
`<br />
`<br />
o a<br />
u<br />
a<br />
a `<br />
e<br />
th`nh phˆn n`y thu o<br />
a<br />
a a<br />
.<br />
’n phˆn mˆm du.a nˆn th`nh phˆn COTS ng`y c`ng tro. nˆn linh hoat l` do<br />
`<br />
`<br />
`<br />
’ e<br />
Viˆc ph´t triˆ<br />
e<br />
a<br />
e<br />
a<br />
e<br />
e<br />
a<br />
a<br />
a a<br />
.<br />
. `<br />
. a<br />
’<br />
` a<br />
`<br />
`<br />
’ a ’<br />
a<br />
c´ su. gia t˘ng vˆ chˆ t lu.o.ng v` su. da dang cua c´c san phˆ m du.a nˆn th`nh phˆn COTS<br />
o .<br />
a<br />
e ´<br />
a .<br />
e<br />
a<br />
a<br />
.<br />
.<br />
.<br />
<br />
154<br />
<br />
´<br />
´<br />
`<br />
ˆ<br />
˘<br />
`<br />
HUYNH QUYET THANG, PHAM THI QUYNH<br />
.<br />
.<br />
<br />
´<br />
’ u e<br />
nhu. hˆ diˆu h`nh, co. so. d˜. liˆu, hˆ thˆng tin nh˘n, thu. diˆn tu., GIS, GUI builders... C´c<br />
e `<br />
e o<br />
a<br />
a<br />
e ’<br />
. e a<br />
.<br />
. ´<br />
.<br />
.ng dung v` c´c th`nh phˆn ho`n thiˆn v` d˜ c´ m˘t trˆn thi tru.`.ng<br />
’<br />
` a ´<br />
`<br />
’<br />
a a<br />
a<br />
a<br />
a<br />
e a a o a e<br />
o<br />
san phˆ m n`y gˆ m c´c u<br />
a<br />
a o<br />
.<br />
.<br />
.<br />
.<br />
`<br />
´ .<br />
´<br />
´<br />
’<br />
a<br />
a<br />
a<br />
u<br />
e<br />
a<br />
a<br />
CNTT. Sˆ lu.o.ng c´c th`nh phˆn COTS dang tiˆp tuc gia t˘ng, chˆ t lu.o.ng c˜ng nhu. kha<br />
o .<br />
.<br />
`<br />
`<br />
’<br />
’<br />
o a a<br />
e<br />
u<br />
a<br />
e’<br />
a<br />
e<br />
e<br />
n˘ng u.ng dung cua n´ ng`y c`ng du.o.c cai thiˆn. Ho.n n˜.a, ph´t triˆ n phˆn mˆm du.a trˆn<br />
a ´<br />
.<br />
.<br />
.<br />
.<br />
’<br />
`<br />
´<br />
´<br />
`<br />
`<br />
’ a<br />
’ o<br />
c´c th`nh phˆn COTS c`n cung cˆ p kha n˘ng mo. rˆng v` biˆn dˆ i c´c u.ng dung phˆn mˆm<br />
a<br />
a<br />
a<br />
o<br />
a<br />
a e o a ´<br />
a<br />
e<br />
.<br />
.<br />
a<br />
u o o o e’ u .<br />
o<br />
thˆng qua c´c h`m APIs, c´c ngˆn ng˜. plug- ins v` script. T`. d´, n´ c´ thˆ ph` ho.p v´.i<br />
o<br />
a a<br />
a<br />
o<br />
u<br />
. dung cua t`.ng muc d´ r`ng buˆc kh´c nhau.<br />
`<br />
’ u<br />
o<br />
a<br />
nhu cˆu su .<br />
a ’<br />
.<br />
. ıch, a<br />
’n phˆn mˆm du.a th`nh phˆn COTS, viˆc lu.a chon th`nh phˆn COTS<br />
`<br />
`<br />
`<br />
`<br />
Trong ph´t triˆ<br />
a<br />
e<br />
a<br />
e<br />
a<br />
a<br />
e .<br />
a<br />
a<br />
.<br />
.<br />
.<br />
.p l` mˆt trong nh˜.ng b`i to´n rˆ t quan trong. Trong b`i b´o n`y ch´ng tˆi tˆp trung<br />
´<br />
u<br />
a a a<br />
a a a<br />
u<br />
o a<br />
ph` ho a o<br />
u .<br />
.<br />
.<br />
.<br />
.u mo. rˆng giai thuˆt lu.a<br />
’ o<br />
’<br />
v`o nghiˆn c´<br />
a<br />
e u<br />
a .<br />
.<br />
.<br />
’<br />
` ´<br />
’ e<br />
a<br />
a<br />
chon c´c tˆ ho.p th`nh phˆn u.ng cu. viˆn<br />
a o .<br />
.<br />
´n tr´c phˆn mˆm cˆn xˆy<br />
`<br />
`<br />
`<br />
COTS cho kiˆ<br />
e<br />
u<br />
a<br />
e<br />
a<br />
a<br />
’ o<br />
’<br />
a<br />
a .<br />
du.ng. C´c mo. rˆng trong giai thuˆt lu.a<br />
.<br />
.<br />
.<br />
a<br />
e<br />
e<br />
ı:<br />
chon n`y du.o.c xˆy du.ng trˆn 2 tiˆu ch´<br />
a<br />
.<br />
.<br />
.<br />
`<br />
’ a<br />
u<br />
u e<br />
a<br />
a<br />
a<br />
du. th`.a d˜. liˆu cua c´c th`nh phˆn v`<br />
.<br />
´ tu.o.ng ch´ng<br />
`<br />
’<br />
gi´ th`nh cua th`nh phˆn. Y ’<br />
a a<br />
a<br />
a<br />
u<br />
’<br />
’<br />
tˆi ´p dung trong giai thuˆt xˆy du.ng giai<br />
o a<br />
a a<br />
.<br />
.<br />
.<br />
.a chon l` phu.o.ng ph´p nh´nh cˆn.<br />
a<br />
a<br />
a<br />
thuˆt lu<br />
a .<br />
. a<br />
.<br />
.<br />
´u tr´c cua b`i b´o du.o.c tr` b`y<br />
’<br />
Cˆ<br />
a<br />
u<br />
a a<br />
ınh a<br />
.<br />
ınh a ` e<br />
e ´ ınh a<br />
nhu. sau. Muc 2 tr` b`y vˆ tiˆn tr` xˆy<br />
.<br />
`<br />
`<br />
`<br />
a<br />
e<br />
a<br />
a<br />
du.ng phˆn mˆm du.a th`nh phˆn COTS.<br />
.<br />
.<br />
’<br />
Muc 3 s˜ tr` b`y giai thuˆt COTSCone ınh a<br />
a<br />
.<br />
.<br />
’<br />
’ a<br />
a<br />
a ` a<br />
e<br />
figs v` nh˜.ng d´nh gi´ vˆ c´c kha n˘ng mo.<br />
a u<br />
´<br />
´<br />
rˆng v` tˆi u.u thuˆt to´n. Tiˆp theo, Muc<br />
o<br />
a o<br />
a a<br />
e<br />
.<br />
.<br />
.<br />
`<br />
´<br />
’ o<br />
e a<br />
a<br />
a<br />
4 l` c´c mo. rˆng dˆ xuˆ t cho thuˆt to´n<br />
a a<br />
.<br />
.<br />
’<br />
COTSConfigs. Trong Muc 5 l` c´c mo.<br />
a a<br />
.<br />
rˆng thˆng tin trong d˘c ta COTS Doco<br />
o<br />
a ’<br />
.<br />
.<br />
’ lu.u tr˜. gi´ th`nh th`nh phˆn.<br />
`<br />
u a a<br />
a<br />
a<br />
e<br />
ument dˆ<br />
. nghiˆm<br />
e<br />
a ’<br />
Muc 6 tr` b`y c´c d´nh gi´ thu<br />
ınh a a a<br />
.<br />
.<br />
.c hiˆn v´.i c´c giai thuˆt dˆ xuˆ t,<br />
`<br />
´<br />
’<br />
d˜ thu<br />
a<br />
e o a<br />
a e a<br />
`<br />
`<br />
´<br />
.<br />
.<br />
.<br />
a<br />
e<br />
H` 1. Tiˆn tr` xˆy du.ng phˆn mˆm<br />
ınh<br />
e<br />
ınh a<br />
.<br />
.´.ng ph´t triˆ n.<br />
´<br />
´ .<br />
.a trˆn c´c th`nh phˆn COTS<br />
cuˆi c`ng l` kˆt luˆn v` hu o<br />
o u<br />
a e a a<br />
a<br />
e’<br />
`<br />
du<br />
e a<br />
a<br />
a<br />
.<br />
’<br />
´<br />
ˆ<br />
´<br />
ˆ<br />
ˆ<br />
ˆ<br />
2. TIEN TR`<br />
INH PHAT TRIEN PH` N M` M<br />
A<br />
E<br />
.<br />
` N COTS<br />
ˆ<br />
´<br />
`<br />
ˆ<br />
DU A TREN CAC THANH PHA<br />
.<br />
´<br />
`<br />
`<br />
`<br />
`<br />
Mˆ h` tiˆn tr` ph´t triˆ n phˆn mˆm hu.´.ng th`nh phˆn du.a trˆn c´c th`nh phˆn<br />
o ınh e<br />
ınh<br />
a<br />
e’<br />
a<br />
e<br />
o<br />
a<br />
a<br />
e a<br />
a<br />
a<br />
.<br />
’ trong H` 1, du.o.c chia th`nh ba giai doan ([1, 5, 6]):<br />
a<br />
COTS, mˆ ta<br />
o<br />
ınh<br />
.<br />
.<br />
’ .<br />
’<br />
a o<br />
o ınh o<br />
ı .<br />
o o<br />
Giai doan 1: Su. dung c´c cˆng cu mˆ h` h´a (v´ du UML-RT cua bˆ cˆng cu Rational<br />
.<br />
.<br />
.<br />
.<br />
’ mˆ ta v` thiˆt kˆ kiˆn tr´c phˆn mˆm. Mˆu d˘c ta du.o.c xˆy du.ng v` tr` b`y<br />
˜ a ’<br />
´ ´ ´<br />
`<br />
`<br />
a ınh a<br />
e<br />
e e e<br />
u<br />
a<br />
e<br />
a<br />
Rose) dˆ o ’ a<br />
. a<br />
.<br />
.<br />
trong [1, 5].<br />
´<br />
´<br />
’ .<br />
o e<br />
ınh . o<br />
Giai doan 2: Su. dung mˆt tiˆn tr` tu. dˆng dˆ xuˆ t c´c thˆng tin t`. k´ ph´p UML - RT<br />
e’ a a<br />
o<br />
u y a<br />
.<br />
.<br />
.<br />
˜u d˘c ta XML.<br />
th`nh c´c mˆ a ’<br />
a<br />
a<br />
a<br />
.<br />
´<br />
´<br />
` ´<br />
’<br />
Giai doan 3: Tiˆn tr` COTSTrader, thu.c hiˆn t` kiˆm danh s´ch c´c th`nh phˆn u.ng cu.<br />
e<br />
ınh<br />
e ım e<br />
a<br />
a<br />
a<br />
a<br />
.<br />
.<br />
.<br />
<br />
’<br />
´<br />
´ .<br />
´<br />
ˆ<br />
ˆ<br />
` ..<br />
`<br />
ˆ<br />
ˆ<br />
CAC GIAI THUA T T` KIEM VA LU A CHON THANH PH` N COTS TOI U U<br />
IM<br />
A<br />
.<br />
.<br />
<br />
155<br />
<br />
˜<br />
´<br />
’ ’<br />
’<br />
viˆn trong kho ch´.a mˆu XML. Co. so. cua tiˆn tr` n`y l` giai thuˆt COTSTrader. Giai<br />
e<br />
u<br />
a<br />
e<br />
ınh a a ’<br />
a<br />
.<br />
.o.c tr` b`y chi tiˆt trong [1].<br />
´<br />
ınh a<br />
e<br />
thuˆt d˜ du .<br />
a a<br />
.<br />
’<br />
` u<br />
´<br />
´<br />
´<br />
´<br />
a<br />
a<br />
Tiˆp theo tiˆn tr` t` kiˆm l` tiˆn tr` COTSConfigs lu.a chon tˆ ho.p th`nh phˆn t`.<br />
e<br />
e<br />
ınh ım e a e<br />
ınh<br />
.<br />
. o .<br />
.ng cu. viˆn dˆ tao ra c´c cˆ u h` thoa m˜n kiˆn tr´c phˆn mˆm yˆu<br />
` ´<br />
´<br />
´<br />
`<br />
’ e e’ .<br />
danh s´ch th`nh phˆn u<br />
a<br />
a<br />
a<br />
a a ınh ’<br />
a<br />
e<br />
u<br />
a `<br />
e<br />
e<br />
. tu.o.ng v´t can<br />
`<br />
´ ’<br />
cˆu. Trong [1, 2, 3] c˜ng tr` b`y chi tiˆt giai thuˆt COTSConfigs, ´p dung tu ’<br />
a<br />
u<br />
ınh a<br />
e<br />
a<br />
a<br />
e .<br />
.<br />
.<br />
´<br />
´<br />
´ ’<br />
’<br />
’<br />
o<br />
a a ınh. Mˆt sˆ cai tiˆn cua giai thuˆt n`y c˜ng d˜ du.o.c tr`<br />
o o ’ e<br />
a a u<br />
ınh<br />
a<br />
c´c tru.`.ng ho.p thoa m˜n cˆ u h`<br />
a<br />
.<br />
.<br />
.<br />
.<br />
b`y trong [5, 6].<br />
a<br />
´<br />
´<br />
´<br />
o<br />
o u<br />
u<br />
a<br />
a ’ a a ınh a<br />
Bu.´.c cuˆi c`ng trong giai doan n`y, khi tˆ t ca c´c cˆ u h` d˜ du.o.c sinh, ch´ng ta thu.c<br />
.<br />
.<br />
.<br />
.´.c d´ng g´i c´c cˆ u h` dˆ tao ra mˆt u.ng dung ho`n chınh.<br />
´<br />
’<br />
a<br />
o a a ınh e’ .<br />
o ´<br />
hiˆn bu o o<br />
e<br />
.<br />
.<br />
.<br />
´ ınh<br />
’ a a a<br />
’<br />
Trong tˆm cua b`i b´o tˆp trung v`o bu.´.c th´. hai cua giai doan 3 - tiˆn tr` COTSConfigs<br />
a<br />
a<br />
o<br />
u<br />
e<br />
.<br />
.<br />
.<br />
.a chon tˆ ho.p th`nh phˆn.<br />
’<br />
`<br />
a<br />
a<br />
lu<br />
.<br />
. o .<br />
.<br />
.<br />
’<br />
ˆ<br />
ˆ<br />
´<br />
3. THUAT TOAN COTSConfigs LU A CHON TO HO P<br />
.<br />
.<br />
.<br />
.<br />
´<br />
`<br />
ˆ<br />
CAC THANH PH` N COTS<br />
A<br />
3.1. Mˆ ta b`i to´n<br />
o ’ a<br />
a<br />
` ´<br />
´<br />
´<br />
a<br />
a<br />
e a o<br />
a ınh<br />
Tiˆn tr` sinh c´c cˆ u h` t`. tˆp c´c th`nh phˆn u.ng viˆn l` mˆt qu´ tr` quan trong<br />
e<br />
ınh<br />
a a ınh u a a<br />
.<br />
.<br />
.<br />
´m c´c th`nh phˆn COTS. Tiˆn tr` n`y s˜ lu.a chon tˆp c´c<br />
`<br />
´<br />
trong to`n bˆ qu´ tr` t` kiˆ<br />
a o a ınh ım e<br />
a<br />
a<br />
a<br />
e<br />
ınh a e .<br />
.<br />
. a a<br />
.<br />
´<br />
´<br />
`<br />
`<br />
`<br />
`<br />
a o e<br />
u<br />
a<br />
e `<br />
a a<br />
e<br />
e<br />
u . ’ a<br />
th`nh phˆn ph` ho.p nhˆ t v´.i kiˆn tr´c phˆn mˆm cˆn xˆy du.ng. Diˆu kiˆn ph` ho.p o. dˆy<br />
a<br />
a<br />
u .<br />
.<br />
.<br />
`<br />
´ ınh a ´<br />
’<br />
’ i lu.a chon c´c th`nh phˆn sao cho tˆp dich vu m` cˆ u h` d´p u.ng du.o.c phai kh´.p<br />
a<br />
a<br />
a .<br />
o<br />
l` pha .<br />
a<br />
. a<br />
.<br />
. a a<br />
.<br />
.i tˆp dich vu yˆu cˆu cua kiˆn tr´c phˆn mˆm cˆn xˆy du.ng.<br />
´<br />
`<br />
e `<br />
a ’<br />
e<br />
u<br />
a `<br />
e `<br />
a a<br />
v´ a .<br />
o .<br />
.<br />
.<br />
’<br />
`<br />
a<br />
a<br />
a<br />
e’<br />
o<br />
B`i to´n lu.a chon tˆ ho.p c´c th`nh phˆn COTS du.o.c ph´t biˆ u nhu. sau ([1]): Cho mˆt<br />
a a .<br />
. o . a<br />
.<br />
.<br />
.a to`n bˆ c´c th`nh phˆn u.ng viˆn COTS ph` ho.p<br />
´ u<br />
`<br />
` ´<br />
kiˆn tr´c phˆn mˆm A. C´ mˆt kho B ch´<br />
e<br />
a `<br />
e<br />
o o<br />
u<br />
a o a<br />
a<br />
a<br />
e<br />
u .<br />
.<br />
.<br />
`<br />
´<br />
`<br />
’<br />
’ a<br />
a<br />
a<br />
a a ınh a a<br />
a<br />
a<br />
dˆ lu.a chon t´ ho.p v`o A. Cˆn phai sinh ra c´c cˆ u h` S l` tˆp ho.p cua c´c th`nh phˆn<br />
e’ .<br />
. ıch .<br />
.<br />
.<br />
´ ınh<br />
e<br />
o<br />
a<br />
a .<br />
u a<br />
a<br />
e<br />
a ´<br />
u.ng viˆn COTS c´ trong B, sao cho cˆ u h` S d´p u.ng c´c dich vu/ch´.c n˘ng m` A yˆu<br />
´<br />
.<br />
. vˆy cˆ u h` S cˆn d´p u.ng hai diˆu kiˆn:<br />
´<br />
`<br />
`<br />
`<br />
a a ´<br />
e<br />
e<br />
cˆu. Nhu a a ınh<br />
a<br />
.<br />
.o.c hˆ tro. bo.i c´c th`nh phˆn cua S phai tr`ng v´.i tˆp c´c dich vu<br />
˜ . ’ a<br />
`<br />
’ u<br />
a<br />
a ’<br />
o a a .<br />
(i) Tˆp c´c dich vu du . o<br />
a a .<br />
.<br />
.<br />
.<br />
.<br />
.o.c hˆ tro. bo.i A (t´.c l` khˆng c´ c´c lˆ hˆ ng dich vu).<br />
˜<br />
˜ ’<br />
du . o . ’<br />
u a o<br />
o a o o<br />
.<br />
.<br />
`<br />
´<br />
(ii) Khˆng c´ hai th`nh phˆn n`o cua S cung cˆ p c`ng mˆt dich vu chung (t´.c l` khˆng<br />
o<br />
o<br />
a<br />
a a ’<br />
a u<br />
o .<br />
u a o<br />
.<br />
.<br />
c´ dich vu tr`ng)<br />
o .<br />
u<br />
.<br />
´<br />
a a<br />
a<br />
a e<br />
a a ınh<br />
Sau dˆy l` thuˆt to´n s˜ sinh ra c´c cˆ u h` S ([1]).<br />
.<br />
’<br />
Giai thuˆt COTSConfigs<br />
a<br />
.<br />
1<br />
function COTSconfigs(i, Sol, S)<br />
´<br />
’ a<br />
’ a<br />
2<br />
// 1<br />
i<br />
size(CB(A)) khao s´t qua tˆ t ca c´c kha n˘ng c´ trong kho CB(A)<br />
a ’ a<br />
o<br />
` ´<br />
’ e<br />
(ch´.a danh s´ch c´c th`nh phˆn u.ng cu. viˆn)<br />
u<br />
a<br />
a<br />
a<br />
a<br />
.i dang du.o.c xˆy du.ng trong giai thuˆt<br />
´<br />
’<br />
a<br />
3<br />
// Sol l` cˆ u h` tam hiˆn th`<br />
a a ınh .<br />
e<br />
o<br />
. a<br />
.<br />
.<br />
.<br />
.a du.ng tˆp ho.p tˆ t ca c´c cˆ u h` c´ gi´ tri dˆi v´.i kiˆn tr´c A<br />
´<br />
´<br />
´<br />
´<br />
4<br />
// S ch´<br />
u<br />
a<br />
u<br />
.<br />
.<br />
. a ’ a a ınh o a . o o e<br />
5<br />
if i size(CB(A)) then<br />
´<br />
e o a ’ a .<br />
6<br />
for j := 1 to size(Ci.R) do//thu.c hiˆn v´.i tˆ t ca c´c dich vu trong C1<br />
.<br />
.<br />
.<br />
’. gom dich vu Ci.Ri v`o Sol<br />
7<br />
// thu<br />
a<br />
.<br />
.<br />
8<br />
if {Ci.Ri} ∩ Sol.R = ∅ then // Ci.Ri ∈ Sol : R?<br />
9<br />
Sol := Sol ∪ {Ci.Ri}<br />
10<br />
if A.R ⊆ Sol.R then // Kiˆ m tra xem Sol c´ l` mˆt cˆ u h` khˆng?<br />
e’<br />
o a o a ınh o<br />
. ´<br />
<br />
´<br />
´<br />
`<br />
ˆ<br />
˘<br />
`<br />
HUYNH QUYET THANG, PHAM THI QUYNH<br />
.<br />
.<br />
<br />
156<br />
<br />
´<br />
S := S ∪ {Sol} // Nˆu Sol l` mˆt cˆ u h`<br />
e<br />
a o a ınh, n´ s˜ du.o.c gom nh´m v`o<br />
o e<br />
o<br />
a<br />
. ´<br />
.<br />
trong S<br />
´ ˜<br />
´<br />
e a o a .<br />
o<br />
a .<br />
12<br />
else // nhu.ng nˆu vˆn c`n c´c dich gˆi nhau v` dich vu tr`ng nhau<br />
. u<br />
13<br />
configs(i, Sol, S) ; // t` trong Ci...<br />
ım<br />
14<br />
endif<br />
15<br />
Sol := Sol − {Ci.Ri}<br />
16<br />
endif<br />
17<br />
endfor<br />
´<br />
18<br />
configs(i + 1, Sol, S) // tiˆp tuc trong CB(A)<br />
e .<br />
19<br />
endif<br />
20<br />
endfunction<br />
˜ ´<br />
`<br />
’ .<br />
’<br />
’<br />
C´c kho.i tao cua giai thuˆt l` S =; Sol =; configs (1; Sol; S). Mˆi cˆ u h` (d`ng 9) dˆu<br />
a<br />
a a<br />
o a ınh o<br />
e<br />
.<br />
.o.c sinh ra b˘ ng c´ch thu. tˆ t ca c´c u.ng cu. viˆn, kˆt ho.p dˆn c´c dich vu Cj.Rj c`n chu.a<br />
`<br />
´<br />
´<br />
’ a ’ a ´<br />
’ e<br />
e . ` a .<br />
a<br />
a<br />
a<br />
o<br />
du .<br />
.<br />
` o<br />
’<br />
a ’<br />
a<br />
u<br />
a o o<br />
a o<br />
a<br />
ch´.a trong A, v` bo di nh˜.ng dich vu m` A d˜ c´ rˆ i (d`ng 8 v` d`ng 10). Khi giai thuˆt<br />
u<br />
.<br />
.<br />
.<br />
.a tˆ t ca c´c cˆ u h` cˆn thiˆt.<br />
´<br />
´<br />
´<br />
´<br />
a<br />
e<br />
kˆt th´c, biˆn S s˜ ch´ a ’ a a ınh `<br />
e<br />
u<br />
e<br />
e u ´<br />
11<br />
<br />
3.2. D´nh gi´ nhˆn x´t vˆ giai thuˆt<br />
a<br />
a<br />
a<br />
e `<br />
e ’<br />
a<br />
.<br />
.<br />
. tu.o.ng giai thuˆt quay lui dˆ thu.c hiˆn qu´ tr` t` kiˆm lu.a<br />
´<br />
’<br />
’<br />
e<br />
a ınh ım e<br />
a<br />
e’ .<br />
Thuˆt to´n ´p dung tu<br />
a<br />
a a<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.p lˆ. N´ s˜ sinh t`. tˆp ho.p c´c u.ng cu. viˆn trong kho B : CB(A) =<br />
´ ınh . .<br />
’ e<br />
o e<br />
u a<br />
a ´<br />
chon c´c cˆ u h` ho e<br />
a a<br />
.<br />
.<br />
.<br />
´ u<br />
`<br />
´<br />
{C1 , ..., Ck}, v` t`. kiˆn tr´c phˆn mˆm cˆn xˆy du.ng A, mˆt tˆp S c´c cˆ u h` ho.p lˆ (d`ng<br />
a u e<br />
a `<br />
e ` a<br />
a<br />
o a<br />
a a ınh . e o<br />
.<br />
. .<br />
.<br />
˜ ’<br />
`<br />
´<br />
o<br />
a a ınh<br />
o o . o o o<br />
o .<br />
11). Khˆng c´ tru.`.ng ho.p c´c cˆ u h` trong S c`n tˆ n tai c´ lˆ hˆ ng dich vu (mˆt dich vu<br />
o<br />
o<br />
.<br />
.<br />
.<br />
.<br />
.<br />
`<br />
a .<br />
e<br />
n`o d´ khˆng du.o.c d´p u.ng) hay c´c dich vu chˆ ng ch´o. Do d´, giai thuˆt s˜ chı sinh nh˜.ng<br />
a o o<br />
o ’<br />
a e ’<br />
u<br />
. a ´<br />
. o<br />
.<br />
´<br />
´ ınh . e<br />
’<br />
’<br />
e<br />
a a o<br />
e’ a o<br />
a ım e<br />
e<br />
cˆ u h` ho.p lˆ. Tuy nhiˆn, giai thuˆt n`y c´ nhu.o.c diˆ m l` mˆt giai thuˆt t` kiˆm v´t<br />
a<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.i dˆ ph´.c tap l` O(2n ), trong d´ n l` sˆ lu.o.ng c´c dich vu m` tˆ t ca c´c th`nh phˆn<br />
´<br />
`<br />
´<br />
a .<br />
a<br />
a<br />
o<br />
a o .<br />
can, v´ o u . a<br />
o .<br />
. a a ’ a<br />
.<br />
’ d´p u.ng. Khi d´ v´.i mˆt kho c´c th`nh phˆn u.ng viˆn l´.n, th` s˜ dˆn<br />
˜<br />
` ´<br />
o<br />
a<br />
a<br />
a<br />
e o<br />
ı e a<br />
o o<br />
trong CB(A) c´ thˆ a ´<br />
o e<br />
.<br />
’ ’<br />
´<br />
’<br />
t´.i b`ng nˆ tˆ ho.p. Qu´ tr` t` kiˆm nhu. vˆy s˜ khˆng kha thi.<br />
o u<br />
o o .<br />
a ınh ım e<br />
a e o<br />
.<br />
´<br />
’<br />
´<br />
’<br />
ˆ<br />
ˆ<br />
ˆ<br />
ˆ<br />
´<br />
E<br />
4. CAC D` XUAT CAI TIEN GIAI THUAT COTSCONFIGS<br />
.<br />
.<br />
.<br />
’<br />
ˆ<br />
´<br />
`<br />
ˆ<br />
A<br />
LU A CHON TO HO P CAC THANH PH` N COTS<br />
.<br />
.<br />
.<br />
`<br />
´<br />
’<br />
’<br />
a<br />
a<br />
e<br />
u<br />
o e’ `<br />
Dˆ giam dˆ ph´.c tap cua thuˆt to´n trˆn, ch´ng ta c´ thˆ dˆ xuˆ t thay b˘ ng giai thuˆt<br />
e’ ’<br />
o u .<br />
e a<br />
a<br />
a<br />
.<br />
.<br />
.<br />
. tu.o.ng cua thuˆt to´n nh´nh cˆn l` nh`. v`o mˆt sˆ c´c<br />
´ a<br />
’<br />
’<br />
nh´nh cˆn (brand and bound). Tu<br />
a<br />
a<br />
a<br />
a<br />
a<br />
a a o a<br />
o o<br />
.<br />
.<br />
.<br />
.<br />
´<br />
´<br />
´<br />
’ a o<br />
o o a<br />
a<br />
a<br />
a<br />
o<br />
a o e’ `<br />
a<br />
thˆng tin d˜ c´ dˆ nh˘ m loai bo b´.t mˆt sˆ c´c phu.o.ng ´n ch˘c ch˘n khˆng phai l` tˆi u.u,<br />
o<br />
. ´<br />
. ’ o<br />
.c l` c´ thˆ lu.o.c b´.t mˆt sˆ n´t khˆng cˆn thiˆt trˆn cˆy t` kiˆm. Vˆy mˆt sˆ tiˆu ch´ c´<br />
’ . o<br />
´ u<br />
`<br />
´ e a ım e<br />
´<br />
´ e<br />
o o<br />
o<br />
a<br />
e<br />
a<br />
o o<br />
ı o<br />
t´ a o e<br />
u<br />
.<br />
.<br />
.<br />
´<br />
’ ım e<br />
a e’ a<br />
e<br />
thˆ du.a v`o dˆ t˘ng hiˆu qua t` kiˆm nhu.:<br />
e’<br />
.<br />
`<br />
´<br />
- Lu.a chon th`nh phˆn v´.i du. th`.a d˜. liˆu l` tˆi thiˆ u.<br />
a<br />
a o<br />
u u e a o<br />
e’<br />
.<br />
.<br />
.<br />
’<br />
`<br />
´<br />
a<br />
a o o<br />
a a<br />
a o<br />
e’<br />
- Lu.a chon th`nh phˆn v´.i tˆ ng gi´ th`nh l` tˆi thiˆ u.<br />
.<br />
.<br />
’<br />
´<br />
`<br />
´<br />
’<br />
’<br />
4.1. Cai tiˆn giai thuˆt lu.a chon th`nh phˆn v´.i du. th`.a d˜. liˆu tˆi thiˆu<br />
e<br />
a .<br />
a<br />
a<br />
o<br />
u<br />
u e o<br />
e<br />
.<br />
.<br />
.<br />
´ ınh u .<br />
´<br />
`<br />
`<br />
Khi xˆy du.ng c´c cˆ u h` ph` ho.p v´.i kiˆn tr´c phˆn mˆm yˆu cˆu, ch´ng ta c´ thˆ<br />
a<br />
a a<br />
o<br />
e<br />
u<br />
a<br />
e<br />
e `<br />
a<br />
u<br />
o e’<br />
.<br />
.o.c nhiˆu kˆt qua cˆ u h` ([1, 2, 5, 6]). Trong d´, s˜ c´ nh˜.ng cˆ u h` l` tˆ ho.p c´c<br />
’<br />
`<br />
´<br />
´ ınh<br />
´ ınh a o . a<br />
’ a<br />
e e<br />
a<br />
thu du .<br />
o e o u<br />
´<br />
`<br />
`<br />
a e<br />
u<br />
a `<br />
e<br />
a e `<br />
a<br />
o o u<br />
th`nh phˆn m` ngo`i nh˜.ng dich vu m` kiˆn tr´c phˆn mˆm d˜ yˆu cˆu, c`n c´ nh˜.ng dich<br />
a<br />
a<br />
a<br />
a<br />
u<br />
.<br />
.<br />
.<br />
. th`.a khˆng cˆn d`ng. Nˆu su. dung c´c cˆ u h` n`y s˜ l`m t˘ng dˆ ph´.c tap dˆn t´.i<br />
˜<br />
`<br />
´<br />
´<br />
vu du u<br />
o u .<br />
o<br />
a u<br />
e ’ .<br />
a a ınh a e a<br />
a<br />
a o<br />
.<br />
.<br />
`<br />
`<br />
`<br />
´<br />
a a u<br />
du. th`.a d˜. liˆu v` th`nh phˆn cua hˆ thˆng phˆn mˆm du.o.c xˆy du.ng. Dˆy l` nh˜.ng cˆ u<br />
u u e a a<br />
a ’<br />
e o<br />
a<br />
e<br />
a<br />
.<br />
. ´<br />
. a<br />
.<br />
<br />
’<br />
´<br />
´ .<br />
´<br />
ˆ<br />
ˆ<br />
` ..<br />
`<br />
ˆ<br />
ˆ<br />
CAC GIAI THUA T T` KIEM VA LU A CHON THANH PH` N COTS TOI U U<br />
IM<br />
A<br />
.<br />
.<br />
<br />
157<br />
<br />
`<br />
´<br />
’ a<br />
’<br />
h` khˆng du.o.c lu.a chon. V` vˆy ch´ng ta cˆn phai xˆy du.ng giai thuˆt t` kiˆm, lu.a chon<br />
ınh o<br />
ı a<br />
u<br />
a<br />
a ım e<br />
. .<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.ng cˆ u h` khˆng cˆn thiˆt n`y.<br />
´<br />
`<br />
´<br />
’<br />
a ınh o<br />
a<br />
e a<br />
COTSConfigs sao cho loai bo nh˜<br />
u<br />
.<br />
`<br />
´<br />
´ .<br />
’<br />
a<br />
a o<br />
u u e a o<br />
e’<br />
Giai thuˆt nh´nh cˆn t` kiˆm lu.a chon c´c th`nh phˆn v´.i du. th`.a d˜. liˆu l` tˆi thiˆ u<br />
a<br />
a<br />
a ım e<br />
. a<br />
.<br />
.<br />
.<br />
´<br />
du.o.c dˆ xuˆ t nhu. sau.<br />
e a<br />
. `<br />
’<br />
´<br />
´<br />
’<br />
’<br />
Giai thuˆt COTSConfigs cai tiˆn v´.i du. th`.a d˜. liˆu tˆi thiˆu<br />
a<br />
e<br />
o<br />
u<br />
u e o<br />
e<br />
.<br />
.<br />
’<br />
´<br />
1<br />
total = numOfInterfaces(CB(A)) //tˆ ng sˆ dich vu cua mˆt cˆ u h`<br />
o<br />
o .<br />
o a ınh<br />
. ’<br />
. ´<br />
’<br />
2<br />
function brandAndBound(i, Sol, S) //giai thuˆt nh´nh cˆn<br />
a<br />
a<br />
a<br />
.<br />
.<br />
3<br />
if i size(CB(A)) then<br />
´<br />
e o a ’ a .<br />
4<br />
for j := 1 to size(Ci.R) do //thu.c hiˆn v´.i tˆ t ca c´c dich vu trong C1<br />
.<br />
.<br />
.<br />
’<br />
a<br />
// thu. gom dich vu Ci.Ri v`o Sol<br />
.<br />
.<br />
5<br />
if {Ci.Ri} ∩ Sol.R = ∅ then // Ci.Ri ∈ Sol : R?<br />
6<br />
Sol := Sol ∪ {Ci.Ri}<br />
7<br />
if A.R ⊆ Sol.R then //<br />
8<br />
if numOfInterface(S) < total then<br />
´<br />
´<br />
’<br />
//sˆ dich vu cua cˆ u h` n`y c`n ´ ho.n ca ngu.˜.ng(muc tiˆu) nˆn<br />
o .<br />
o<br />
e<br />
e<br />
. ’ a ınh a o ıt<br />
.<br />
.˜.ng vˆ sˆ dich vu cua mˆt cˆ u h`<br />
` o .<br />
e ´<br />
o a<br />
//dˆy l` mˆt gi´ tri cua ngu o<br />
a a o<br />
a . ’<br />
. ’<br />
. ´ ınh<br />
.<br />
m´.i<br />
o<br />
9<br />
total := numberOfInterface(S ) // cˆp nhˆt ngu.˜.ng m´.i<br />
a<br />
a<br />
o<br />
o<br />
.<br />
.<br />
´<br />
’ u<br />
10<br />
S := // x´a c´c kˆt qua c˜<br />
o a e<br />
.a Sol v`o tˆp kˆt qua S<br />
´<br />
’<br />
11<br />
S := S ∪ {Sol} // du<br />
a a e<br />
.<br />
12<br />
else if numberOfInterface(S ) = total then<br />
` o .<br />
’<br />
//thoa m˜n ngu.˜.ng vˆ sˆ dich vu<br />
a<br />
o<br />
e ´<br />
.<br />
´<br />
’<br />
a a e<br />
13<br />
S := S ∪ {Sol} // du.a Sol v`o tˆp kˆt qua S<br />
.<br />
14<br />
endif<br />
´ ˜<br />
´<br />
15<br />
else // nhu.ng nˆu vˆn c`n c´c dich vu gˆi nhau ho˘c dich vu tr`ng nhau<br />
e a o a .<br />
a .<br />
. o<br />
.<br />
. u<br />
16<br />
configs(i, Sol, S) // t` trong Ci...<br />
ım<br />
17<br />
endif<br />
18<br />
Sol := Sol − {Ci.Ri}<br />
19<br />
endif<br />
20<br />
endfor<br />
21<br />
if (numberOfInterface(S) + (n − m)× minOfInterface(CB(A))<br />
⇐ total then<br />
22<br />
brandAndBound(i + 1, Sol, S)<br />
23<br />
endif<br />
24<br />
endif<br />
25<br />
endfunction<br />
´<br />
` ´<br />
’<br />
Ta c´, mˆt cˆ u h` tˆi da s˜ l` tˆp ho.p cua to`n bˆ c´c c´c th`nh phˆn u.ng viˆn. Nhu.<br />
o o a ınh o<br />
a o a a<br />
a<br />
a<br />
e<br />
e a a<br />
. ´<br />
.<br />
.<br />
.<br />
.c l` sˆ c´c dich vu tˆi da cua mˆt cˆ u h` s˜ l` tˆ ng cua c´c dich vu du.o.c cung cˆ p<br />
’<br />
´ a .<br />
´<br />
´<br />
´ ınh e a o<br />
’<br />
’ a .<br />
a<br />
vˆy, t´ a o<br />
a u<br />
o a<br />
. o<br />
.<br />
.<br />
.<br />
.<br />
.i c´c th`nh phˆn u.ng viˆn. Vˆy, tru.´.c tiˆn, ta goi biˆn total l` biˆn lu.u tˆ ng sˆ dich vu<br />
’<br />
` ´<br />
´<br />
´<br />
´<br />
’<br />
a<br />
a<br />
e<br />
a<br />
o<br />
e<br />
e<br />
a e<br />
o<br />
o .<br />
bo a<br />
.<br />
.<br />
.<br />
.i tao biˆn n`y b˘ ng tˆ ng sˆ dich vu cua to`n bˆ c´c th`nh<br />
’<br />
`<br />
´<br />
´<br />
’<br />
’<br />
cua mˆt cˆ u h` (d`ng 1). Kho .<br />
o a ınh o<br />
e a a<br />
o<br />
o .<br />
a o a<br />
a<br />
. ´<br />
. ’<br />
.<br />
` ´<br />
` o<br />
´<br />
’<br />
a<br />
ınh a<br />
phˆn u.ng viˆn. Dˆy ch´ l` ngu.˜.ng vˆ tˆ ng sˆ d˜. liˆu cua mˆt cˆ u h`<br />
a<br />
e<br />
o<br />
e ’<br />
o u e<br />
o a ınh.<br />
.<br />
. ´<br />
<br />