A Hybrid Service Selection and Composition Model for Cloud-Edge Computing in the Internet of Things

Cloud-edge computing is a hybrid model of computing where resources and services provided via the Internet of Things (IoT) between large-scale and long-term data informs of the cloud layer and small-scale and short-term data as edge layer. The main challenge of the cloud service providers is to select the optimal candidate services that are doing the same work but offer different Quality of Service (QoS) values in IoT applications. Service composition in cloud-edge computing is an NP-hard problem; therefore, many meta-heuristic methods introduced to solve this issue. Also, the correctness of meta-heuristic and machine learning algorithms for evaluating service composition problem should be proven using formal methods to guarantee functional and non-functional speciﬁcations. In this paper, a hybrid Artiﬁcial Neural Network-based Particle Swarm Optimization (ANN-PSO) Algorithm presented to enhance the QoS factors in cloud-edge computing. To illustrate the correctness and improve the reachability rate of candidate composited services and QoS factors for the proposed hybrid algorithm, we present a formal veriﬁcation method based on a labeled transition system to check some critical Linear Temporal Logics (LTL) formulas. The experimental results illustrated the high performance of the proposed model in terms of minimum veriﬁcation time, memory consumption, and guaranteeing critical speciﬁcations rules as the Linear Temporal Logic (LTL) formulas. Also, we observed that the proposed model has optimal response time, availability, and price with maximum ﬁtness function value than other service composition algorithms.


I. INTRODUCTION
Cloud computing is a new technology to help enterprises and organizations to subcontract information processing services [1], [2]. Also, edge computing is a unique and entirely Internet-based approach providing a small-scale and available considerable number of services platform for a variety of Internet of Things (IoT) applications [3]. By increasing the complexity of service negotiations and the number of smart devices and real-time user requests, centralized cloud-based The associate editor coordinating the review of this manuscript and approving it for publication was Mu-Yen Chen . solutions are not supportable to guarantee Service Level Agreement (SLA) in the service allocation, composition, and scheduling. So, cloud-edge computing can be increased flexibility of service availability and interoperability on the 5G platform in the IoT environment [4], [5]. One of the main challenges in cloud-edge computing is service composition [6], [7]. The service composition method has an important role in decreasing the price and the risk of providing new web service applications in large or small scale IoT environments [8], [9]. Also, service composition is specified as an NP-hard problem (nondeterministic polynomial time); making the problem of finding the optimal service composition VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ an essential challenge in cloud-edge computing. In practice, cloud applications and smart devices contain many components and resources by many candidates to provide requested services. Thus, when the number of resources and IoT devices is growing, the set of available composed services is also increased exponentially. So, selecting and recommending an optimal candidate service composition in the state space is impractical [10] to support the SLA in the composition of services [6]. Many researchers have applied existing meta-heuristic and machine learning algorithms to find the optimal service composition in recent years [11]- [13]. However, formal verification of these methods has some challenging issues such as a state-space explosion, maximizing reachability, and avoiding deadlock conditions. Particle Swarm Optimization (PSO) has some problems, such as getting stuck in local optima and premature convergence. [14]. Combining the PSO and the Artificial Neural Network (ANN) as a machine learning approach helps to escape from local optima [15].
In this paper, a formal verification method is proposed for a hybrid ANN-based PSO (ANN-PSO) algorithm to improve the reachability rate and execution time of a service composition model in cloud-edge computing. In addition, a Labeled Transition System (LTS) as a model checkingbased formal verification method is illustrated to measure the correctness of the proposed model. To evaluate the reachability condition of the service composition approach that particular states of the service composition procedure can reachable, the behavioral model of the ANN-PSO constructed as an LTS. Also, the Process Analysis Toolkit (PAT) model checker is applied to verify the proposed composition approach. The key contributions of this paper are presented as follows.
• Presenting a hybrid ANN-PSO algorithm for a service composition model in cloud-edge computing • Applying a formal verification method to prove the correctness of a hybrid ANN-PSO algorithm • Providing a behavioral modeling method based on LTS to achieve the optimal QoS factors for the proposed ANN-PSO algorithm • Guaranteeing important critical specification rules informs of Linear Temporal Logic (LTL) for the ANN-PSO algorithm in the PAT model checker The remainder of this research is structured as follows: related works are discussed for different service composition mechanisms in Section 2. The service composition model and a hybrid algorithm are presented in Section 3. Section 4 illustrates the formal verification method and experimental results according to the LTL properties. The conclusions and future work presented in Section 5.

II. RELATED WORK
This section gives a brief review of some related works. Different methods have presented for QoS aggregation in service composition. For example, a comprehensive literature review presented by Souri, et al. [16] in formal verification of web service composition methods. In this literature, a state-of-theart analysis was applied according to verification approaches, existing meta-heuristic algorithms, evaluated QoS factors, and verification and simulation tools.
Li and Yao [17] proposed a process calculus-based service composition approach using the cloud entropy genetic algorithm. The modeling diagrams designed using Unified Modeling Language (UML) to illustrate the service composition prototype platform in a cloud-manufacturing environment.
Liao, et al. [18] have proposed a service composition model based on an accurate sub-swarm PSO method. The accuracy of the standard PSO algorithm is improved through the proposed method to find the optimal result of the service composition. The disadvantages of this method are premature convergence and low diversity of the PSO algorithm. Also, Ghobaei-Arani, et al. [19] have proposed a moth-flame optimization algorithm to evaluate the correctness and efficiency of the service composition according to the QoS factors in cloud computing. Moreover, the accuracy of the proposed algorithm is extracted from a formal verification method analyzed with the NuSMV model checker. The analytical results have proven the efficiency of the proposed composition algorithm.
A new approach based on the genetic algorithm for web service composition in the cloud environment has been proposed by Wang et al. [20]. First, an initial population is generated, then the proposed algorithm tries iteratively to find a solution until the convergence criterion is satisfied. This method ensured that the user experience is maximized, and the SLA violation minimized. Moreover, Wang, et al. [21] have proposed a trust-based web service selection and composition method according to a conceptual collaborative reputation approach in a social network. The authors have suggested a conditional reputation stage according to the collaborative relationships between recommenders based on the reputation of neighbors. The simulation results have shown that this method improved three categories of web service prototypes.
Wang, et al. [22] have presented a reliability-aware web service composition method for incorporating essential components of cyber-physical systems with social networks. The proposed approach uses skyline method for decreasing the state space of the QoS factors to guarantee reliability. It also tries to find the best solution with lower computation time using a mixed-integer programming method. The experimental results have shown that the proposed approach performs better than four existing approaches. Moreover, Wang, et al. [23] have also presented a new approach to evaluate the QoS. Fuzzy synthetic decisions used to assess cloud service providers. Moreover, fuzzy logic control is applied to make QoS assessment. The experimental comparisons have determined that the proposed method achieved a perfect valuation of QoS for service composition in cloud computing.
Vaithiyanathan et al. [24] have presented a new framework for automatic orchestration of services based on user preferences. This framework can address automated orchestration using multiple agents. In the proposed framework, automation of the process and the system response time are the important issues. The simulation results show that the proposed system minimizes human intervention. In another study, mixed integer programming has been used by Alrifai et al. [25] for choosing the best composited model based on global QoS factors. Simulation results have shown that the proposed method reduces the computational complexity, but when different tasks have different QoS range values, the decomposition algorithm is not accurate. Jula et al. [26] have proposed a new framework to improve the service time of composite services based on the enhanced imperialist reasonable method [27] for choosing appropriate service providers. Experimental results have shown that the service time improved with this approach.
A greedy approach for web service composition has proposed by Yu et al. [26]. First, the greedy method selects the cloud. Then, the proposed method continues to find the perfect cloud until the specified clouds support all the service requirements. ACO (Ant Colony Optimization) algorithm has been proposed to select cloud combinations that use the minimum amount of clouds. The main advantage of this approach is finding the optimal cloud composition that has the minimum number of clouds to fulfill the users' needs. Slow convergence is considered as the weakness of this method. Moreover, the genetic algorithm has been adopted by Canfora, et al. [28] to find optimal service selection and composition model.

III. HYBRID ANN-PSO ALGORITHM
This section presents the proposed ANN-PSO algorithm for service composition model. First, we illustrate the main concepts of the service composition model based on QoS metrics. Then, the proposed ANN-PSO algorithm is presented to apply the service selection and composition procedure.

A. SERVICE COMPOSITION MODEL
First of all, we present existing QoS metrics based on the normalization method to recognize the final candidate service composition according to the aggregation of QoS metrics. In this paper, three representative QoS metrics are chosen, including availability, response time, and prices. For computing total QoS metrics for each candidate composited service, we normalize the QoS metrics. The formulas illustrating the processes of normalizing and calculating the three metrics are given in Equations 1-3.
Where Q Att max is the maximum value of each QoS metric in all candidate services, Q Att min is the minimum value of each QoS metric in all candidate services, Q Att i,j is shown as the initial value of the candidate service j attribute Att in the task i, n represents the total number of tasks in service composition, and q Att i,j is the normalized value of each QoS metric for the candidate service j of the task i [29].
The total QoS value for a candidate service composition is defined as the sum of the normalized QoS metrics of the candidate services selected for each task, as shown in Equations 4 and 5. Also, the fitness function of final candidate service is illustrated according to Equation 5.
where W shows the specified weight of different QoS metrics. V is the QoS metric for each selected candidate service in the task i.
For showing a conceptual description of the service composition model in cloud-edge computing, Figure 1 presents a three-layered service composition model. First, a set of requested services is forwarded by users. Then, this request is sent to cloud and edge candidate service repositories to service discovery procedures based on existing QoS factors. Also, all smart devices in the IoT layers such as healthcare applications, agriculture-based smart devices, transportation and vehicle applications, smart home-care, and smart city applications communicate with existing fog nodes in the edge layer. When the set of requested services is received by the service coordinator flow, the service discovery procedure starts. In a flow service stream, suitable atomic services are selected from the available candidate service list with appropriate QoS factors to guarantee the SLA conditions. For each requested service, the proposed model estimates the total QoS metric for each candidate composited services, and selected atomic services composed with existing composition pattern in sequential, loop, parallel, and branch forms according to [11]. Finally, the model chooses the maximum QoS as a final optimal service composition solution between the set of candidate composited services for recommending to users.
After describing a brief perspective of the service composition model, we present the hybrid ANN-PSO algorithm.

B. ANN-PSO ALGORITHM
The proposed hybrid algorithm uses ANN to select the optimum position for each particle and avoid rapid convergence in the PSO algorithm. Traditionally, premature convergence has been one of the main problems of the PSO algorithm [30], [31]. The ANN algorithm is proposed as a potential means solve the mentioned issue by combining it with PSO as a hybrid algorithm. In the hybrid algorithm, after each iteration of the PSO algorithm, by selecting half of the population of particles that had weaker performance, the particles will fly again in high accurate solution space using ANN algorithm with trained procedure. Therefore, the probability of premature convergence and getting stuck at local optimum points decreased.
Initially, P individuals for forming the population are randomly produced. These individuals can be regarded as neurons in ANN, and particles in terms of PSO [32]. In the PSO, the possible explanations, called particles, are navigated with a multi-layer space [33]. To show each particle i, a location path X i is considered. Then, a group of particles transfers with a multi-dimensional state space, with the speed of each particle denoted by a vector V i . It changes the particle position to find a better one. pBest and gBest are the optimal visited locations for the particle i and the best of all particle location values, respectively. The preliminary speeds of particles are likelihoods limited to a range of [0, 1]. Algorithm 1 describes the hybrid algorithm for service composition model. It generates the initial population randomly for particles, and also the velocity of each particle generated randomly. In this step, the particles are allowed to move freely in the problem space, and each of them shows a new solution for candidate service composition. In the problem space, the particles will be allowed to fly and choose a point in the position [34]. The prediction of the best solution space on the particles at the end of each iteration is applied using the ANN algorithm. So, the ANN-PSO algorithm does a better general search in solution space. This process continues until all solution space is searched thoroughly. In other words, if the number of iterations is equal to the maximum iteration number, the implementation of the algorithm will be terminated. Otherwise, it goes to related steps, and the process repeated. With the end of the implementation of the algorithm, the best particle will be considered as a final response in the last generation.

Algorithm 1 ANN-PSO Algorithm for Finding the Optimal Solution
Input: a set of requests for each task / * QoS metrics for each requested service/ * Output: An optimal composted service model; 1: Normalizing set of QoS metrics for requested services/ * Producing existing requests/ * 2: Initializing the position of particles and velocity V i / * Initializing vector input, number of hidden layers, and transfer function./ * 3: Generating positions of particles randomly in PSO; 4: Training initial position of particles using ANN; 5: Calculating the fitness of each particle. 6: Set overall best fitness as pBest 7: Checking convergence of prediction 8: Updating position X i and velocity V i 9: Evaluating Fitness of new particle 10: Checking gBest for next particle 11: Checking maximum iteration 12: Selecting gBest as the final solution 13: End

C. FORMAL VERIFICATION OF ANN-PSO FOR SERVICE COMPOSITION
In this subsection, behavioral modeling based on LTS to present the proposed ANN-PSO algorithm is presented for the service composition model. Also, the proposed behavioral model is implemented based on the PAT model checker for evaluating the correctness of the ANN-PSO algorithm and satisfying critical specification rules of the generated state space of the behavioral model. First, a behavioral model is proposed based on a finite state machine [32]. Second, this behavioral model is translated to the LTS structure [35] for transforming to the PAT model checker. To understand mapping the proposed ANN-PSO algorithm to select optimal service composition with a high level of QoS metrics, we use behavioral modeling based on the LTS in the next section.
The following definition shows the LTS structure. Definition 1: An LTS T is a 4-tuple structure T = (Q, q, E, L) [36]: • Q shows a set of finite states. • q demonstrates the initial state: q ∈ Q. • E shows a set of potential actions. • L is a complete transition relation between finite states and actions: L ⊆ Q× E × Q. The relation q 1 e −→ q 2 (q 1 , q 2 ∈ Q, and e ∈ E) is applied to the state that (q 1 , e, q 2 ) ∈ L. Definition 2: A service composition model SC is a 4-tuple structure SC = (S, R, QOS, C) [36]: • S shows a set of candidate atomic services. • R demonstrates a set of the requested service form user • QOS shows a set of existing QoS factors for each requested atomic service.
• C is a path of candidate composited services where: C ⊆ S × QOS × S. To illustrate the LTS model of the ANN-PSO algorithm, Figure 2 shows a behavioral model as follows.
In the first phase, a requested list of services is forwarded to cloud-edge service repositories. All required services are checked based on mapped QoS factors for each atomic service. Then all QoS factors are normalized to evaluate the total QoS metric. In the second phase, the existing parameters of ANN and PSO algorithms are initialized, respectively [37].
For the ANN algorithm, existing weights, number of hidden layers initialized randomly. Also, the position of particles, the number of velocities, and the maximum number of iteration values specified for the PSO algorithm respectively [38].
In the third phase, the first population of particles should be generated that the ANN algorithm applied to find an optimal position for each particle. In the training level of ANN, existing neurons inputted to network with activating existing weights and layers. Finally, the output layer is recognized by checking the error rate to finalize the training procedure. When the error value passed, then the position of particles updated.
In the fourth phase, the fitness function of existing particles as a candidate solution calculated. When total fitness function computed, pBest and gBest factors will be updated. In the final phase, if composition count is lower than the maximum iteration value, then the previous phases are applied. Otherwise, the final optimal service composition with a maximum QoS metric recommended to the user.
According to the above behavioral model for the ANN-PSO algorithm, we define important critical specification roles to evaluate the correctness of the proposed algorithm as given in Table 1. For example, LTL1 shows the initialization of existing ANN and PSO parameters when QoS factors are normalized. Also, LTL2 illustrates a critical condition for terminating ANN procedure when the iteration counter value is lower than the specified error value. The LTL3 and LTL4 show deadlock-free and divergence-free conditions, respectively. Besides, the LTL5 shows the reachability condition for achieving QoS checking factors between existing QoS metrics in terms of response time, availability, and price. The LTL6 checks the reachability condition for applying the training procedure using the ANN algorithm. The LTL7 illustrates  the reachability condition for checking the finalization of choosing the best solution for a service composition model. Finally, the LTL8 shows the reachability condition for the PSO procedure.

IV. EXPERIMENTAL RESULTS
In this section, the experimental results are presented to evaluate the proposed ANN-PSO efficiency. For analyzing the proposed ANN-PSO algorithm in the service composition model, first, we have provided a simulation analysis with C# language in the Visual Studio environment as an Integrated Development Environment (IDE). Second, the verification results of the proposed algorithm is presented to prove the correctness of the behavioral model in the PAT model checker.

A. SIMULATION RESULTS
We applied the QWS (The Quality of Service for Web Services Data set) data set [39] that contains 2500 web services. To show the feasibility of our method, some basic algorithms  such as the Genetic Algorithm (GA) [40], PSO [41] and GAPSO algorithm are compared. Also, for showing the evaluation of availability, response time, and price, the number of applied services is 10, 30, 50, 70, and 100 on the QWS dataset with 100 iterations. Figure 3 depicts the availability factor for the existing ANN-PSO algorithm. We observed that the ANN-PSO algorithm had outperformed results to achieve availability when the number of services increased.  Figure 5 shows the optimality of the ANN-PSO algorithm to recognize the price factor. When the number of requests increases, the price factor decreases significantly.
Finally, Figure 6 shows the overallfitness of the service composition model in 100 iterations. According to Figure 6, the total fitness of the proposed algorithm is higher than the VOLUME 8, 2020  other algorithms, which indicates that this algorithm provides the more appropriate distribution of requests with maximum QoS metric for requested services.

B. VERIFICATION RESULTS
To show the correctness of the proposed algorithm, verification results have presented as follows. We examined some important specifications rules according to subsection 3.3. Also, reachability conditions are evaluated for satisfying four important sections, including QoS checking with maximum metrics, training with the ANN algorithm, checking the maximum rate of iteration to terminate service composition procedure, and the PSO algorithm. Figure 7 shows a snapshot of the PAT verifier environment for evaluating existing specification rules. We observe that LTL 1, 3, 4, 5, 6, 7, and 8 were satisfied using stringent conditions. It means that the proposed algorithm met all critical deadlock-free, divergence-free, and reachability conditions exactly.
Also, LTL 2, as a critical avidness condition does not satisfy because of occurring a safety point in the proposed path. Figure 8 shows a counter example to evaluate invalid conditions in this specification role. When the training procedure occurred using the ANN algorithm, if the current error value is lower than the maximum error rate, the training procedure should be replicated, and the existing layers in the network should be updated. However, LTL2 shows the wrong situation for this procedure.

V. CONCLUSION AND FUTURE WORK
In this paper, a combined machine learning and a metaheuristic algorithm called ANN-PSO algorithm presented to evaluate the optimal QoS-based service composition for cloud-edge computing in the IoT environment. The ANN-PSO algorithm has two stages in assessing the service selection and composition process. The first stage applies the global search process to predict the optimal position for existing particles for avoiding premature convergence. The second stage provides optimal service composition based on the PSO factors to guarantee the requested QoS factors. In simulation results, the proposed algorithm has outperformed results to minimize response time and price than other algorithms such as PSO, GA, and PSOGA algorithms. Also, our hybrid algorithm gets the maximum percentage for evaluating fitness function and availability factors to show the feasibility and optimality of the proposed service composition model in the IoT environment. To support the correctness of the proposed ANN-PSO composition model, an LTS-based verification approach has been presented. For specifying the reachability of the service composition model, the behavioral model of the ANN-PSO is constructed in the LTS. The verification results showed that the ANN-PSO algorithm has the highest reachability rate to prove the correctness of the service composition approach using the PAT model checker. Also, all critical specification rules have been satisfied in the state space of the ANN-PSO behavioral model.
In the future work, we will try to apply prediction methods such as deep learning methods for avoiding state space explosion problem in model checking method in the service composition model. ALIREZA SOURI received the Ph.D. degree in computer engineering from Science and Research Branch, Islamic Azad University, Iran. He is currently an Assistant Professor with Islamic Azad University. His research interests include formal verification, model checking, fog & cloud computing, Internet of Things, data mining, and wireless networks. He was recognized by Iran's National Elites Foundation and awarded as a National Young Elite in 2018, 2019, and 2020. Up to now, he has authored or coauthored more than 60 scientific articles in established journals such as Expert Systems with Applications (Elsevier), the Journal of Systems and Software (Elsevier), and IEEE Access. He is currently an Associate Editor of Human-Centric Computing and Information Sciences (Springer), Cluster Computing (Springer), and IET Communications (IEEE) journals. He is a Reviewer of more than 50 reputed journals including SCI-Indexed Journals of the IEEE, ACM, Elsevier, Springer, and Wiley, such as the IEEE Communications Surveys and Tutorials, the IEEE Internet of Things, the IEEE Access, ACM computing Survey, Future Generation Computer Systems.
MONIRE NOROUZI received the B.S. degree in software engineering from the University College of Nabi Akram, Iran, and the M.Sc. degree in software engineering from Shabestar Branch, Islamic Azad University, Iran. She is currently appointed as a Lecturer with IAU. Her research interests include data mining, fog & cloud computing, IoT, and social networks.
BAO HUYNH received the M.Sc. degree in computer science from the Posts and Telecommunications Institute of Technology, Ho Chi Minh City, Vietnam, in 2011, and the Ph.D. degree in computer science from the VSB-Technical University of Ostrava, Czech, in 2017. Since 2017, he has been continuously researched and developed new algorithms that are helpful for real applications in various fields. His research interests include data mining, privacy-preserving, big data analytics, parallel computing, social networks, network infrastructure, and network security. In addition, he has over ten years of experience in design, implements network infrastructure systems, and security network systems. VOLUME 8, 2020