-
面向服务的体系结构(service of architecture, SOA)[1]作为一种新型软件构架技术,因其允许集成服务和易于开发复杂的商业应用,已被广泛应用于环境智能[2]、物联网[3]、无人机控制[4]、远程医疗[5]等诸多领域。Web服务及其组合技术,是实现SOA的关键技术。
时序约束是Web服务组合中备受瞩目的非功能特性。多数QoS(quality of service)感知的Web服务组合方法[6-10]仅考虑了全局用户时序约束。文献[11]考虑了服务之间及服务内部的时序约束,主要关注了组合服务的时序兼容性问题。文献[12]除了考虑全局用户时序约束之外,还考虑了任务之间的时序约束(即具有直接或间接继承关系的两个任务之间的时序约束),但其建立的数学模型比较复杂,缺乏求解该模型的高效算法。文献[13]不仅考虑了全局用户时序约束而且还考虑了施加于由多个任务组成的某种模式的时序约束,并提出了一种TCD模型来解决这类时序约束问题。TCD模型可以保障全局时序约束,但可能丢失可行组合方案;当用户提出的时序约束条件较强时,可能导致找不到组合方案。
现有Web服务应用场景多为支持多用户、高并发的云平台,其资源分配与任务调度策略对服务的时序约束高度敏感。为此,本文提出一种CIA-TCD模型,其思想是在文献[13]提出的TCD模型中引入松弛因子,使得当用户约束强度较弱时,仍可保障全局时序约束;当用户约束强度较强时,保留一定数量的候选方案(有些可能不满足全局时序约束),以提升找到可行组合方案的概率。
-
一个包含n个活动(记为:A1, A2, …, An)的工作流,活动Ai拥有mi个候选服务(第j个候选服务记为sij,对应的完成时间记为sij.pt,1≤j≤mi),用于描述该工作流的VA序列有u个(记为VA1, VA2, …, VAu,u≤n)。用户对于该工作流的时序约束,可以施加到某些VA或者某些活动之上。时序服务组合问题可定义为:当满足用户时序约束时,使得其某些QoS最优化(例如:执行价格最低)。
-
用户时序约束分解的目标是寻找每个活动应该满足的时序上限,记为ULT(Ai),i = 1, 2, …, n。当每个活动应该满足的时序上限确定时,任何一个VA应该满足的时序上限可由算法UtterLimit(VA)计算所得。为便于描述,活动Ai被看作一个VA(NONE, < Ai > , -1)。该算法在最坏情况下,需要递归遍历每个VA和活动,其时间复杂度为O(n)。
算法UtterLimit(VA)
输入:虚拟任务VA
输出:VA应满足的时序上限
If (VA.CP == NONE) {
获取VA.AL中的元素Ai;
Return ULT(Ai); }
Else if (VA.CP== SEQ) {
Set value = 0; //初始化VA的时序上限
For each element in VA.AL
value += UtterLimit (element);
Return value; }
Else if (VA.CP == XOR) {
Set value = +∞;
For each element in VA.AL {
temp = UtterLimit (element);
If (temp < value)
value = temp; }
Return value; }
Else if (VA.CP == AND) {
Set value = 0;
For each element in VA.AL {
temp = UtterLimit (element);
If (temp > value)
value = temp; }
Return value; }
Else if (VA.CP == LOOP) {
Set value = 0;
For each element in VA.AL
value += UtterLimit (element);
Return value * VA.K; }
-
全局QoS约束分解策略是研究QoS感知的Web服务组合的重要方法。现有QoS约束分解模型[13, 20-26]可分为3类:依据经验公式或规则建立的分解模型[20-21],其优点是易于实现,但它不能保障全局QoS约束,也不能保证不丢失可行组合方案;以保障全局QoS约束建立的分解模型[13, 22-25],它在用户约束强度较强时,容易丢失可行组合方案;保障以不丢失可行组合方案建立的分解模型[26],其目的是过滤不可行的候选服务,在用户约束强度较弱时过滤效果较差,也不能保障全局约束。由此可见,用户约束强度会影响QoS约束分解的效果。
用RA(VA)描述VA涉及到的活动的集合:
$$ {\mathop{\rm RA}\nolimits} ({\rm{VA}}) = \left\{ {\begin{array}{*{20}{c}} {\{ a|a\;\;{\rm{ in\; VA}}{\rm{.AL}}\} {\rm{ VA}}{\rm{.CP }} = {\rm{ NONE }}}\\ {\bigcup\limits_{{\rm{VA}} \in {\rm{VA}}{\rm{.AL }}} {{\rm{RA}}({\rm{VA}})} {\rm{ VA}}{\rm{.CP }} \ne {\rm{ NONE }}} \end{array}} \right. $$ (1) 若为RA(VA)中的每个活动选择一个候选服务,其执行时间为对应的活动的所有候选服务的平均执行时间,由这些服务组合成的执行方案的平均执行时间称为VA的平均执行时间,记为APT(VA)。设用户对VA的时序约束为${\rm{tc}}({\rm{VA}}) \leqslant \tau ({\rm{VA}})$,用CI(VA)表示用户对VA的时序约束强度:
$${\rm{CI}}({\rm{VA}}) = \frac{{\tau ({\rm{VA}})}}{{{\rm{APT}}({\rm{VA}})}} - 1$$ (2) -
构建CIA-TCD模型的基本思想是在TCD模型的基础上引入松弛因子。当约束强度较弱时,取松弛因子为0以保障全局约束;当约束强度较强时,松弛因子取一个大于0的合适值,以保留一定数量的组合方案和降低丢失可行组合方案的概率。
CIA-TCD模型可描述如下:
目标:
$$\max {\rm{ }}\prod\limits_{i = 1}^n {{\rm{\# \{ }}{s_{ij}}{\rm{|}}{s_{ij}}.{\rm{pt}} \leqslant {\rm{ULT(}}{A_i}{\rm{)\;\;\;\;1}} \leqslant j \leqslant {m_i}{\rm{\} }}} $$ (3) 约束条件:
$${\rm{ULT}}({A_u}) \leqslant \tau ({A_u})\;\;\;\;1 \leqslant u \leqslant n$$ (4) $${\rm{ULT}}({\rm{V}}{{\rm{A}}_v}) \leqslant (1 + {\lambda _v})\tau ({\rm{V}}{{\rm{A}}_v})\;\;\;\;1 \leqslant v \leqslant n$$ (5) $$\min ({A_u}.{\rm{pt}}) \leqslant {\rm{ULT}}({A_u}) \leqslant \max ({A_u}.{\rm{pt}})\;\;\;\;1 \leqslant u \leqslant n$$ (6) 式中,#{}表示集合中元素的个数;$\tau $(Au)、$\tau $(VAv)(1≤u≤n,1≤v≤n)分别为用户对各个活动、VA的时序约束(若无约束,设为$ + \infty $);min(Au.pt)、max(Au.pt) (1≤u≤n)分别表示Au的候选服务的执行时间的最小值与最大值;${\lambda _v}$(1≤v≤n)表示VAv的时序约束所需引入的松弛因子;ULT(Au)(1≤u≤n)为模型变量,表示Au的时序约束上限。式(3)表明CIA-TCD模型的优化目标为最大化剩余组合方案的个数。
-
若能确定CIA-TCD模型中${\lambda _v}$(1≤v≤k)的值,该模型可以采用文献[13]中给出的贪心算法求解。${\lambda _v}$的取值主要与RA(VAv)中活动个数(记为|RA(VAv)|)和CI(VAv)相关,可采用模糊推理规则来实现${\lambda _v}$的自适应调节。图 2a、图 2b、图 2c分别描述了|RA(VAv)|、CI(VAv)和${\lambda _v}$的隶属函数。采用表 1所示的推理规则,可得${\lambda _v}$的投影曲面如图 3所示。
表 1 模糊推理规则
|RA(VAv)| CI(VAv) S M L S S5 S3 S1 M S5 S3 S2 L S6 S4 S2 其中|RA(VAv)|和CI(VAv)的模糊子集均为{S, M, L};${\lambda _v}$则划分为6个等级,从小到大依次记为S1, S2, …, S6。
Constraints Strength-Aware Temporal Constraints Service Composition
-
摘要: 保障全局时序的时序约束分解模型(TCD)可以将时序服务组合分解成约束分解与局部优选两个相对独立的过程,但该模型可能丢失可行组合方案,在用户约束强度较强时可能导致无解。该文提出了一种约束强度感知的时序约束分解模型(CIA-TCD),通过在现有的TCD模型中引入松弛因子,使得用户约束强度较弱时,能保证全局约束,而约束强度较强时,也能够保留一定量的组合方案,从而提高找到可行方案的概率。分析表明,当约束强度较强时,CIA-TCD模型较TCD模型找到可行组合方案的概率明显更大。Abstract: The temporal constraints decomposition model (TCD), which guarantees the global temporal, can decompose the temporal service composition into two relatively independent processes:constraints decomposition and local optimization. However, the model may lose the feasible combination scheme, which may lead to no solution when the user constraints strength is strong. This paper proposes a constraints strength-aware temporal constraints decomposition model (CIA-TCD), which introduces a relaxation factor into the existing TCD model. When the user constraint strength is weak, the global constraint can be guaranteed; and when the constraint strength is strong, a certain amount of combination scheme can be reserved, thereby increasing the probability that a feasible solution can be found. The experimental analysis shows that the CIA-TCD model has a significantly better probability of finding a feasible combination scheme than the TCD model when the constraint strength is strong.
-
表 1 模糊推理规则
|RA(VAv)| CI(VAv) S M L S S5 S3 S1 M S5 S3 S2 L S6 S4 S2 -
[1] WANG P W, DING Z J, JIANG C J, et al. Automatic web service composition based on uncertainty execution effects[J]. IEEE Transactions on Services Computing, 2016, 9(4): 551-565. doi: 10.1109/TSC.2015.2412943 [2] MANUEL S, JOSE A, ERNESTO E. Integrating SOA and MAS in intelligent environments[J]. Dyna, 2018, 85(206): 268-282. doi: 10.15446/dyna.v85n206.68671 [3] ZHANG Y, CHEN J L, CHENG B. Integrating events into SOA for IoT services[J]. IEEE Communications Magazine, 2017, 55(9): 180-186. doi: 10.1109/MCOM.2017.1600359 [4] RODRIGUES D, PIRES R D M, MARCONATO E A, et al. Service-oriented architectures for a flexible and safe use of unmanned aerial vehicles[J]. IEEE Intelligent Transportation Systems Magazine, 2017, 9(1): 97-109. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=2f94ed1028c0d3db7b0b35b69b50b877 [5] TRAORE B B, KAMSU-FOGUEM B, TANGARA F. Integrating MDA and SOA for improving telemedicine services[J]. Telematics & Informatics, 2016, 33(3): 733-741. http://cn.bing.com/academic/profile?id=35cc2e55ca4d01c4cc41368268f9bd90&encoded=0&v=paper_preview&mkt=zh-cn [6] 叶恒舟, 李陶深, 关云慧.一种自治愈的QoS感知的Web服务组合方法[J].电子科技大学学报, 2017, 46(3): 618-624. doi: 10.3969/j.issn.1001-0548.2017.03.023 YE Heng-zhou, LI Tao-shen, GUAN Yun-hui. A self-healing QoS-aware web service composition method[J]. Journal of University of Electronic Science and Science and Technology of China, 2017, 46(3): 618-624. doi: 10.3969/j.issn.1001-0548.2017.03.023 [7] 叶恒舟, 陆湘鹏.基于离散粒子群优化的鲁棒Web服务组合[J].电子科技大学学报, 2018, 47(3): 443-448. doi: 10.3969/j.issn.1001-0548.2018.03.019 YE Heng-zhou, LU Xiang-peng. Robust web services composition base on discrete particle swarm optimization[J]. Journal of University of Electronic Science and Technology of China, 2018, 47(3): 443-448. doi: 10.3969/j.issn.1001-0548.2018.03.019 [8] XU J J, GUO L, ZHANG R X, et al. QoS-aware service composition using fuzzy set theory and genetic algorithm[J]. Wireless Personal Communications, 2018, 102(2): 1009-1028. doi: 10.1007/s11277-017-5129-8 [9] LU W, WANG W D, BAO E D, et al. FAQS: Fast web service composition algorithm based on QoS-aware sampling[J]. IEICE Transactions on Fundamentals of Electronics Communications & Computer Sciences, 2016, 99(4): 826-834. http://d.old.wanfangdata.com.cn/Periodical/zgwsjyzz200505006 [10] 谭文安, 赵尧.基于混沌遗传算法的Web服务组合[J].计算机集成制造系统, 2018, 24(7): 1822-1829. http://d.old.wanfangdata.com.cn/Periodical/jsjjczzxt201807024 TAN Wen-an, ZHAO Yao. Web service composition based on chaos genetic algorithm[J]. Computer Integrated Manufacturing Systems, 2018, 24(7): 1822-1829. http://d.old.wanfangdata.com.cn/Periodical/jsjjczzxt201807024 [11] DU Y H, TAN W, ZHOU M C. Timed compatibility analysis of web service composition: a modular approach based on petri nets[J]. IEEE Transactions on Automation Science & Engineering, 2014, 11(2): 594-606. http://cn.bing.com/academic/profile?id=06b2ed4274f08c61236588c404fbab97&encoded=0&v=paper_preview&mkt=zh-cn [12] GUIDARA I, GUERMOUCHE N, JMAIEL M, et al. Time-dependent QoS aware best service combination selection[J]. International Journal of Web Services Research, 2015, 12(2): 1-25. doi: 10.4018/IJWSR.2015040101 [13] 叶恒舟, 李陶深, 关云慧.基于时序约束分解的QoS感知的Web服务组合[J].电子学报, 2017, 45(5): 1150-1157. doi: 10.3969/j.issn.0372-2112.2017.05.018 YE Heng-zhou, LI Tao-shen, GUAN Yun-hui. QoS-aware web service composition based on temporal constraints decomposition[J]. Acta Electronica Sinica, 2017, 45(5): 1150-1157. doi: 10.3969/j.issn.0372-2112.2017.05.018 [14] 汪潇洒, 付晓东, 刘骊, 等.随机QoS感知的Web服务组合概率分析[J].计算机工程与应用, 2017, 53(14): 70-75. doi: 10.3778/j.issn.1002-8331.1602-0047 WANG Xiao-sa, FU Xiao-dong, LIU Li, et al. Probabilistic analysis for stochastic QoS of web service composition[J]. Computer Engineering and Applications, 2017, 53(14): 70-75. doi: 10.3778/j.issn.1002-8331.1602-0047 [15] WANG D D, YANG Y, MI Z Q. A genetic-based approach to web service composition in geo-distributed cloud environment[J]. Computers and Electrical Engineering, 2015, 43: 129-141. doi: 10.1016/j.compeleceng.2014.10.008 [16] GUO X, CHEN S S, ZHANG Y W, et al. Service composition optimization method based on parallel particle swarm algorithm on spark[J]. Security & Communication Networks, 2017: 10.1155/2017/9097616. http://cn.bing.com/academic/profile?id=322089b294e2788e873541ba22eeee81&encoded=0&v=paper_preview&mkt=zh-cn [17] MEZNI H, SELLAMI M. A negotiation-based service selection approach using swarm intelligence and kernel density estimation[J]. Software Practice & Experience, 2018, 48(6): 1285-1311. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=ad76ae46eab508180c3ee729ab9cdc97 [18] BAO L, ZHAO F, SHEN M Q, et al. An orthogonal genetic algorithm for QoS-aware service composition[J]. Computer Journal, 2016, 59(12): 1857-1871. doi: 10.1093/comjnl/bxw043 [19] DING Z J, SUN Y Q, LIU J J, et al. A genetic algorithm based approach to transactional and QoS-aware service selection[J]. Enterprise Information Systems, 2015, 11(3): 339-358. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=10.1080/17517575.2015.1048832 [20] 王尚广, 孙其博, 杨放春.基于全局QoS约束分解的Web服务动态选择[J].软件学报, 2011, 22(7): 1426-1439. http://d.old.wanfangdata.com.cn/Periodical/rjxb201107002 WANG Shang-guang, SUN Qi-bo, YANG Fang-chun. Web service dynamic selection by the decomposition of global QoS constraints[J]. Journal of Software, 2011, 22(7): 1426-1439. http://d.old.wanfangdata.com.cn/Periodical/rjxb201107002 [21] HWANG S Y, HSU C C, LEE C H. Service selection for web services with probabilistic QoS[J]. IEEE Transactions on Services Computing, 2017, 8(3): 467-480. http://cn.bing.com/academic/profile?id=bf534e20f679e5a705d9477447de2fe9&encoded=0&v=paper_preview&mkt=zh-cn [22] SUN S X. A decomposition-based approach for service composition with global QoS guarantees[J]. Information Sciences, 2012, 199(15): 138-153. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=fd5b951a9e771c945e1eab91c983fd1e [23] SURIANARAYANAN C, GANAPATHY G, SETHUNARAYANAN M. An approach for selecting best available services through a new method of decomposing QoS constraints[J]. Service Oriented Computing & Applications, 2014, 9(2): 1-32. [24] LIU Z Z, XUE X, SHEN J Q, et al. Web service dynamic composition based on decomposition of global QoS constraints[J]. International Journal of Advanced Manufacturing Technology, 2013, 69(9-12): 2247-2260. doi: 10.1007/s00170-013-5204-6 [25] YE H Z, LI T S, JING C. Decomposition of global constraints for QoS-aware web service composition[J]. International Journal of Innovative Computing, Information and Control, 2016, 12(6): 2053-2066. [26] GUIDARA I, JAOUHARI I A, GUERMOUCHE N. Dynamic selection for service composition based on temporal and QoS constraints[C]//IEEE International Conference on Services Computing.[S.l.]: IEEE, 2016: 267-274. [27] AI-MASRI E, MAHMOUD Q H. Discovering the best web service[C]//International Conference on World Wide Web(WWW). New York: ACM, 2007: 1257-1258. [28] AI-MASRI E, MAHMOUD Q H. QoS-based discovery and ranking of web services[C]//International Conference on Computer Communications and Networks(ICCCN). New York: IEEE, 2007: 529-534.