Service combination method and system based on bp neural network and hierarchical clustering, and medium
Patent Information
- Application Number
- CN202311693187.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-11
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-12-11
AI Technical Summary
[0012]基于此,有必要针对如何基于QoS感知从服务组合计划中选择一个最优或者接近最优的组合、并且控制在可接受的时间代价内的问题,提供了基于BP神经网络和层次聚类的服务组合方法、系统及介质
[0041] 1. This invention achieves solution space reduction of candidate service set based on target user preferences, applies hierarchical clustering technology to the service composition process, and introduces attribute advantage ratio as the benchmark calculation parameter of hierarchical clustering. In the face of large-scale service composition scenarios, it can further reduce the time to find the optimal service composition result and improve the efficiency of service composition method.
Smart Images

Figure CN117650992B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of service composition technology, and more specifically, to service composition methods, systems, and media based on BP neural networks and hierarchical clustering. Background Technology
[0002] In recent years, with the development of cloud computing, service providers have been publishing a wide variety of services on the internet, which users can access anytime, anywhere. These existing modular, independent services with well-defined interfaces provide application developers with reusable functionality, and by combining these single-function services, more complex and powerful composite services can be formed to meet user needs.
[0003] To meet users' personalized functional and non-functional needs, the service composition process structure needs to be restructured to satisfy users' functional requirements. When meeting the non-functional requirements of different user preferences, it is necessary to select appropriate candidate services from a set of functionally equivalent candidate services to meet users' Quality of Service (QoS) requirements.
[0004] The current cloud environment is filled with a large number of services with similar functions but different QoS attributes, i.e., candidate services. QoS attributes include time, reliability, and price. Generally, candidate services with similar functions but different QoS attribute values can be grouped together and regarded as an abstract service. Therefore, there are several abstract services with different functions. Thus, a service composition plan can be viewed as a service composition process structure that combines a group of abstract services according to different workflow patterns.
[0005] To help understand the above relationship, see [link / reference]. Figure 1 This demonstrates a specific service portfolio plan that illustrates how a recruitment system operates: It begins with searching for company job postings. After selecting a position, the next step is resume completion. During this process, candidates can choose to synchronize their resumes from a third-party system, upload a local resume, or manually complete the system resume. Uploading a local resume requires parsing the uploaded data and populating the system resume form with the resulting information. Synchronizing a resume from a third-party system also requires data to be populated into the system's resume form. Finally, both of these methods require the candidate to manually complete and supplement the resume. After completing the resume, it can be submitted, and the candidate will receive notifications via email and SMS.
[0006] for Figure 1 The service composition plan embodies the concepts of state, candidate services, and abstract services:
[0007] A state represents a task that needs to be solved at a certain step in the service composition process. Each state in the service composition process represents a specific task objective that needs to be achieved in the current state. Figure 1 The hollow circle represents a state. For example, state S1 means that after reaching this state, the requirement to fill out a resume needs to be fulfilled.
[0008] In a service composition, a candidate service represents the smallest, indivisible, independent service unit. The final service composition is a combination of a series of candidate services that meet user requirements and constraints. Each candidate service can specifically implement a particular function and has its own QoS attribute value that reflects its characteristics.
[0009] An abstract service can be viewed as a collection of candidate services with the same functional characteristics but different QoS attribute values. Figure 1 The solid circle represents an abstract service: for example, state S2 contains an abstract service for parsing job seekers' resumes. Within this abstract service, there are many candidate services for parsing resumes provided by service providers. These specific candidate services all implement the function of parsing resumes, but they exhibit different characteristics in non-functional attributes such as time, reliability, and price.
[0010] exist Figure 1 In this context, different users (e.g., governments, large enterprises, startups) all need recruitment systems to support their recruitment efforts, but their preferences for non-functional requirements may differ. Figure 1 Three QoS attributes—response time, reliability, and service price—are introduced to represent users' non-functional requirements: governments may have higher reliability requirements; large enterprises need faster response times; and startups prefer cheaper services. Therefore, for these users with varying preferences, this service portfolio plan needs to optimize the most suitable candidate service from the abstract services after each state; and the time spent on this optimization process must be controlled within an acceptable timeframe to ultimately obtain an optimal or near-optimal service portfolio result.
[0011] However, as the number of candidate services increases, the service composition results generated by the service composition plan will grow exponentially. Therefore, selecting an optimal or near-optimal composition result from the service composition plan while keeping it within an acceptable time cost becomes one of the key issues in QoS-aware service composition. Summary of the Invention
[0012] Therefore, it is necessary to provide a service composition method, system, and medium based on BP neural network and hierarchical clustering to address the problem of how to select an optimal or near-optimal combination from the service composition plan based on QoS awareness and control it within an acceptable time cost.
[0013] This invention is achieved using the following technical solution:
[0014] In a first aspect, this invention discloses a service composition method based on BP neural network and hierarchical clustering, used to quickly and accurately optimize service composition results that meet the preferences of target users from a service composition plan. The service composition plan contains N abstract services.
[0015] The service composition method based on BP neural networks and hierarchical clustering includes the following steps:
[0016] Step 1: Obtain service portfolio plans and target user preferences;
[0017] Step 2: Extract the N abstract services contained in the service composition plan, and process the N abstract services using the Skyline algorithm to obtain a set of N non-dominated services;
[0018] For the i-th non-dominated service set, hierarchical clustering is performed with reference to the target user's preferences to obtain Z clusters. Then, the cluster closest to the target user's preferences is selected from the Z clusters as the preferred cluster. This process is repeated for N non-dominated service sets to obtain a total of N preferred clusters. Where i∈[1,N], and Z represents the number of target clusters.
[0019] The method for hierarchical clustering includes the following steps:
[0020] S2.1, treat each non-dominated service in the i-th non-dominated service set as a cluster;
[0021] For any given cluster, first calculate its attribute dominance ratio, then calculate its user preference value based on the attribute dominance ratio, and finally calculate its cluster center based on the user preference value.
[0022] S2.2, calculate the Euclidean distance between the cluster centers of any two clusters;
[0023] Find the two closest clusters and merge them into a new cluster;
[0024] Among them, for the new cluster formed by merging, the average of the cluster centers of the two clusters used for merging is taken as its cluster center;
[0025] S2.3, Repeat step S2.2 until the number of clusters drops to Z, then Z clusters are obtained;
[0026] Input the target user's preferences into a pre-trained BP neural network to predict whether to use N preferred clusters;
[0027] Step 3: If it is predicted that N preferred clusters should not be used, the N non-dominated service sets are processed using the Q-learning algorithm to obtain the optimization results;
[0028] If it is predicted that N preferred clusters will be used, then the Q-learning algorithm is used to process the N preferred clusters to obtain the optimization result.
[0029] This service composition method based on BP neural networks and hierarchical clustering implements the methods or processes according to embodiments of this disclosure.
[0030] Secondly, this invention discloses a service composition system based on BP neural network and hierarchical clustering, which uses the service composition method based on BP neural network and hierarchical clustering from the first aspect.
[0031] The service composition system based on BP neural network and hierarchical clustering includes: service acquisition module, preference acquisition module, skyline algorithm processing module, hierarchical clustering processing module, BP neural network processing module, cluster selection module, and Q-learning algorithm processing module.
[0032] The service acquisition module is used to obtain the service composition plan and extract the N abstract services it contains.
[0033] The preference acquisition module is used to acquire the preferences of the target user.
[0034] The skyline algorithm processing module is used to process N abstract services using the skyline algorithm to obtain a set of N non-dominated services.
[0035] The hierarchical clustering module performs hierarchical clustering on the i-th non-dominated service set, resulting in Z clusters. The cluster selection module selects the cluster closest to the target user's preference from the Z clusters obtained from the i-th non-dominated service set as the preferred cluster. The hierarchical clustering module and the cluster selection module iterate through the N non-dominated service sets, finally obtaining N preferred clusters.
[0036] The BP neural network processing module has a built-in pre-trained BP neural network, which is used to predict whether to use N preferred clusters based on the target user's preferences.
[0037] The Q-learning algorithm processing module is used to process N non-dominated service sets using the Q-learning algorithm to obtain the optimization result after predicting that N preferred clusters should not be used; or to process N preferred clusters using the Q-learning algorithm to obtain the optimization result after predicting that N preferred clusters should be used.
[0038] This service composition system based on BP neural networks and hierarchical clustering implements the methods or processes according to embodiments of this disclosure.
[0039] Thirdly, the present invention discloses a readable storage medium. This readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the steps of the service composition method based on BP neural networks and hierarchical clustering as described in the first aspect.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] 1. This invention achieves solution space reduction of candidate service set based on target user preferences, applies hierarchical clustering technology to the service composition process, and introduces attribute advantage ratio as the benchmark calculation parameter of hierarchical clustering. In the face of large-scale service composition scenarios, it can further reduce the time to find the optimal service composition result and improve the efficiency of service composition method.
[0042] 2. This invention uses a BP neural network as a prediction model to predict whether to use N preferred clusters based on the target user's preferences, thereby ensuring that the optimal service set can be used to participate in the subsequent service combination process according to different target user preferences.
[0043] 3. This invention combines hierarchical clustering and BP neural network technology and applies them to QoS-aware service composition, which can ensure that the optimal service composition results are obtained while further reducing the overall execution time of service composition. Attached Figure Description
[0044] Figure 1 This refers to the service portfolio plan corresponding to the recruitment system in the background technology;
[0045] Figure 2 This is a flowchart of the service composition method based on BP neural network and hierarchical clustering provided in Embodiment 1 of the present invention;
[0046] Figure 3 for Figure 2 Structure diagram of a backpropagation (BP) neural network;
[0047] Figure 4 This is a structural diagram of the scalable service composition plan constructed in Embodiment 2 of the present invention;
[0048] Figure 5 This is a comparison chart of the four methods in Embodiment 2 of the present invention under the first target user preference weight;
[0049] Figure 6 This is a comparison chart of the four methods in Embodiment 2 of the present invention under the second type of target user preference weight;
[0050] Figure 7 This is a comparison chart of the four methods in Embodiment 2 of the present invention under the third target user preference weight;
[0051] Figure 8 This is a comparison chart of the four methods in Embodiment 2 of the present invention under the fourth target user preference weight;
[0052] Figure 9 This is a comparison chart of the four methods in Embodiment 2 of the present invention under the first number of candidate services;
[0053] Figure 10 This is a comparison chart of the four methods in Embodiment 2 of the present invention under the second number of candidate services;
[0054] Figure 11 This is a graph showing the comparison of the average cumulative returns of the two methods in Embodiment 2 of the present invention under different numbers of candidate services.
[0055] Figure 12 This is a comparison chart of the average number of convergence cycles for the two methods in Embodiment 2 of the present invention under different numbers of candidate services. Detailed Implementation
[0056] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0057] It should be noted that when a component is said to be "installed on" another component, it can be directly on the other component or it may be in a component that is centered on it. When a component is said to be "set on" another component, it can be directly set on the other component or it may also be in a component that is centered on it. When a component is said to be "fixed to" another component, it can be directly fixed to the other component or it may also be in a component that is centered on it.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.
[0059] Example 1
[0060] Please see Figure 2 , Figure 2 This is a flowchart of the service composition method based on BP neural network and hierarchical clustering in this invention. As mentioned in the background section, this service composition method is used to quickly and accurately optimize the service composition results that meet the preferences of the target users from the service composition plan.
[0061] A service portfolio plan comprises N abstract services. The value of N is determined based on the specific service portfolio plan.
[0062] The following uses AS i Represents the i-th abstract service; AS i The number of candidate services in |AS i |;Use In AS i The j-th candidate service in the array; i∈[1,N], j∈[1,|AS i |].
[0063] like Figure 2 This service combination method includes the following steps:
[0064] Step 1: Obtain service portfolio plans and target user preferences.
[0065] In this context, the service composition plan is a service composition process structure formed by combining N abstract services according to different workflow patterns.
[0066] Target user preferences refer to the n QoS attributes that the target user values, meaning there are n dimensions to the QoS attributes. Generally, target user preferences are quantified into weight values, and the sum of the weight values of the n QoS attributes is made equal to 1. In other words, target user preferences can be represented by a weight set W: W = [w1, w2, ..., w...]. n ], In the formula, w k This represents the weight value of the k-th QoS attribute, where k∈[1,n].
[0067] Step Two:
[0068] Firstly, N abstract services included in the service composition plan are extracted, and the N abstract services are processed using the Skyline algorithm to obtain N sets of non-dominated services. The i-th set of non-dominated services is hierarchically clustered with reference to the target user's preferences to obtain Z clusters. Then, the cluster closest to the target user's preferences is selected from the Z clusters as the preferred cluster. The N sets of non-dominated services are traversed to obtain a total of N preferred clusters. Where i∈[1,N], and Z represents the number of target clusters.
[0069] Secondly, the target user preferences are input into a pre-trained BP neural network to predict whether to use N preferred clusters.
[0070] The two aspects of step two can be performed simultaneously, or designed as follows: first, perform hierarchical clustering and optimization, then predict whether to use the N preferred clusters. This is because hierarchical clustering is essential for non-dominated service sets and does not depend on the prediction results of the BP neural network. In other words, hierarchical clustering can be completed or in progress before the BP neural network makes its predictions; the decision to use preferred clusters is then determined by the BP neural network's predictions. This shortens the time spent on this part, thereby reducing the overall optimization time.
[0071] ① Regarding the first aspect, it mainly does three things: Ⅰ. Process N abstract services using the Skyline algorithm to obtain N sets of non-dominated services; Ⅱ. Perform hierarchical clustering on each set of non-dominated services with reference to the target user's preferences to obtain Z clusters; thus, the N sets of non-dominated services result in N*Z clusters; Ⅲ. Select one preferred cluster from the Z clusters obtained from any set of non-dominated services; thus, N*Z clusters correspond to N preferred clusters.
[0072] The following will explain each point in detail:
[0073] I. Methods for processing N abstract services using the Skyline algorithm include:
[0074] Normalize N abstract services to obtain N normalized service sets; where the i-th abstract service corresponds to the i-th normalized service set, and the number of normalized candidate services in the i-th normalized service set is equal to the number of candidate services in the i-th abstract service.
[0075] It should be noted that the normalization process actually targets candidate services within the abstract service. Normalization is performed to ensure that the QoS attributes of each candidate service can be compared and calculated using uniform rules.
[0076] In addition, the normalization process uses different formulas depending on the positive or negative correlation between QoS attributes and service quality:
[0077]
[0078] In the formula, v represents the QoS attribute value of the candidate service before normalization; t and r represent the normalized value of v; max represents the maximum value of the QoS attribute value before normalization; and min represents the minimum value of the QoS attribute value before normalization.
[0079] In this way, after normalization, the values of each QoS attribute of the candidate service are mapped to the range of [0,1].
[0080] The following uses BS i Represents the i-th normalized service set; BS i The normalized number of candidate services in |BS i |=|AS i |;Use Indicates in BS i The j-th normalized candidate service in the dataset.
[0081] For any normalized candidate service, if it meets the non-dominated requirement, it is included in the non-dominated service set; otherwise, it is not included in the non-dominated service set.
[0082] Specifically, the non-dominant requirement is:
[0083] for In other words, if the conditions are met This means In BS i The middle represents non-dominant services, represented as —i.e., BS i The j-th non-dominated service in the process.
[0084] in, express Dominate It meets the following requirements:
[0085]
[0086] In the formula, express The normalized value for the k-th QoS attribute; express The normalized value for the k-th QoS attribute.
[0087] In addition, for In this regard, it has a QoS attribute vector.
[0088]
[0089] So, BS i The set of services consisting of all non-dominated services is called the i-th non-dominated service set. Therefore, N normalized service sets can yield N non-dominated service sets; where the i-th normalized service set corresponds to the i-th non-dominated service set.
[0090] The following uses NDSS i Denotes the i-th non-dominated service set; NDSS i The number of non-dominated services in |NDSS i |;Use Indicates in NDSS i The h-th non-dominated service in [1, |NDSS]; h∈[1,|NDSS] i |].
[0091] II. Methods for hierarchical clustering include:
[0092] S2.1, treat each non-dominated service in the i-th non-dominated service set as a cluster;
[0093] For any given cluster, first calculate its attribute dominance ratio, then calculate its user preference value based on the attribute dominance ratio, and finally calculate its cluster center based on the user preference value.
[0094] Specifically, for Specifically, the formula for calculating the proportion of its attribute advantage is:
[0095]
[0096] In the formula, express The proportion of attribute advantage on the m-th QoS attribute; Indicates NDSS i The h-th non-dominant service in NDSS; i Denotes the i-th non-dominated service set; Indicates NDSS i The m-th QoS attribute ratio The set of poor, non-dominated services.
[0097] Among them, for exist:
[0098]
[0099]
[0100] In the formula, s represents belonging to Non-dominated services; express The normalized value of the m-th QoS attribute; qos m (s) represents the normalized value of s on the m-th QoS attribute;
[0101] b indicates that it belongs to NDSS i However, it does not belong to Non-dominated services; qos m (b) represents the normalized value of b on the m-th QoS attribute.
[0102] for Specifically, the formula for calculating user preference values is:
[0103]
[0104] In the formula, express User preference value; n represents the QoS attribute dimension; express The user preference value calculated on the m-th QoS attribute.
[0105] Since hierarchical clustering is a multi-round process, with two clusters participating in the synthesis of a new cluster in each round; therefore, before hierarchical clustering begins, for NDSS... i In other words, it includes |NDSS i |Non-dominant services, i.e., |NDSS i | clusters.
[0106] This | NDSS i The cluster center of each cluster is calculated using the following formula:
[0107]
[0108] In the formula, Indicates NDSS i The x-th cluster in [1, |NDSS], x∈[1,|NDSS] i |];|NDSS i NDSS before hierarchical clustering begins i Number of sub-clusters; NDSS i Denotes the i-th non-dominated service set; express The cluster center; n represents the QoS attribute dimension; express The value of the m-th QoS attribute; s k express The k-th non-dominant service in the process;
[0109] S2.2, calculate the Euclidean distance between the cluster centers of any two clusters;
[0110] Find the two closest clusters and merge them into a new cluster.
[0111] Specifically, the formula for calculating the Euclidean distance between two clusters is:
[0112]
[0113] In the formula, They represent NDSS respectively i The e-th cluster and the f-th cluster in the middle; NDSS i Denotes the i-th non-dominated service set; express The Euclidean distance between them; getDistance(.) represents the Euclidean distance calculation function.
[0114] For the new cluster formed by merging, the average of the cluster centers of the two clusters used for merging is taken as its cluster center.
[0115] S2.3, Repeat step S2.2 until the number of clusters drops to Z, then Z clusters are obtained.
[0116] It should be noted that, since step S2.2 needs to be repeated, therefore, The range of values for e and f in the formula is constantly shrinking—each time it is repeated, the range shrinks by 1.
[0117] Thus, after the i-th non-dominated service set is clustered in the above hierarchical manner, a clustering result that conforms to user preferences is obtained—Z clusters.
[0118] The following uses Indicates NDSS i Z clusters were obtained. Indicates ccluster i The z-th cluster in the [1, Z] cluster.
[0119] After traversing N sets of non-dominated services, N*Z clusters are obtained.
[0120] III. The process of selecting the optimal clusters aims to find the clusters of services that best match the preferences of the target users.
[0121] The methods for selecting preferred clusters include:
[0122] For the Z clusters obtained from the i-th non-dominated service set, calculate the Euclidean distance between each cluster and the target user's preference, and select the cluster with the closest distance as the preferred cluster.
[0123] The following uses Indicates ccluster i The preferred clusters in the data.
[0124] Among them, ccluster i The formula for calculating the Euclidean distance between the Z clusters and the target user's preference is:
[0125]
[0126] In the formula, Indicates ccluster i The z-th cluster in the middle; ccluster i Indicates NDSS i The resulting Z clusters; NDSS i Let represent the i-th non-dominated service set; W represents the target user preference weight set; getDistance(.) represents the Euclidean distance calculation function.
[0127] By traversing N*Z clusters, N optimal clusters are obtained.
[0128] ② Regarding the second aspect, it mainly utilizes a BP neural network to determine whether to use N preferred clusters.
[0129] This is because sometimes the cluster of services that best matches the target user's preferences is not the closest to those preferences. Therefore, relying on Euclidean distance can lead to incorrect selection, meaning the optimal service is missed. A major reason for this is that the number of target clusters selected during hierarchical clustering varies, resulting in different ranges of user preferences covered by each cluster. Consequently, when matching target user preferences that are stuck at cluster boundaries, the optimal service may be missed. Generally, in such cases, the entire set of non-dominated services is used directly.
[0130] Based on the above, a BP network is used to determine whether to use N preferred clusters before the Q-learning algorithm processes the data.
[0131] Backpropagation (BP) neural networks are multilayer feedforward neural networks that use the backpropagation algorithm to correct errors, and they perform well in classification and regression problems.
[0132] A backpropagation (BP) neural network consists of three parts: an input layer, hidden layers, and an output layer. The input layer is used to input the target user's preferences. The hidden layers are used for data computation. The output layer outputs the prediction results to determine whether to use N preferred clusters.
[0133] Specifically, the input layer consists of n neurons, receiving n dimensions of QoS attributes. The hidden layers are multi-layered, each containing multiple neurons—the number of hidden layers and the number of neurons per layer are variable. It's important to note that increasing the number of hidden layers or neurons per layer increases the prediction accuracy of the neural network, but also increases computational complexity and the risk of overfitting. The output layer consists of one neuron, and its dimension is typically a numerical value or a one-dimensional vector.
[0134] See Figure 3 This demonstrates a specific BP neural network structure: the front-end input layer includes 2 neurons, which can take in data of 2 dimensions; the middle layer has two hidden layers, each containing 8 neurons; and the final output layer contains 1 neuron.
[0135] In this embodiment 1, the target user preferences W = [w1, w2, ..., w n ], Input data flows into the input layer; then the data enters multiple hidden layers; after calculations in the hidden layers, the data is finally output from the output layer. For binary classification problems, the output layer outputs the binary probability or the predicted class. Generally, the sigmoid activation function is used as the activation function for the output layer, compressing the output value to between 0 and 1. If the output value is greater than a set threshold (usually set to 0.5), it is predicted as a positive class, and the output value is 1; otherwise, it is predicted as a negative class, and the output value is 0.
[0136] In other words, if the output of a trained BP neural network is 0, it means that N preferred clusters should not be used. If the output of a trained BP neural network is 1, it means that N preferred clusters should be used.
[0137] Before using a backpropagation (BP) neural network for prediction, it needs to be trained. Training methods include:
[0138] S1.1, Obtain actual running data as a sample dataset; wherein, the sample dataset contains real labels;
[0139] S1.2, divide the sample dataset into a training set and a test set, use the training set to train the BP neural network, and use the test set to test the trained BP neural network;
[0140] S1.3, obtain the BP neural network with the best test results, and use it as the trained BP neural network.
[0141] Step 3: If it is predicted that N preferred clusters should not be used, the N non-dominated service sets are processed using the Q-learning algorithm to obtain the optimization result.
[0142] If it is predicted that N preferred clusters will be used, then the Q-learning algorithm is used to process the N preferred clusters to obtain the optimization result.
[0143] Q-learning is a common algorithm in machine learning. Reinforcement learning, when faced with an unknown environment, can find the optimal decision-making solution through its excellent trial-and-error mechanism. The elements involved in reinforcement learning typically include the agent, environment, state, action, and reward. Figure 1 Taking a scenario as an example, the agent is in environment E. When the agent reaches state S1, the actions it can take include: synchronizing its resume from a third-party system, uploading a local resume, and manually filling in a system resume. In typical reinforcement learning scenarios, after an agent takes an action, it will transition from its current state to another state with a potential probability P. However, in service composition scenarios, P is generally assumed to be 1, meaning it will transition to a definite state. Simultaneously with the state transition, the agent receives a reward for taking that action. This reward can be positive or negative feedback: for positive feedback, the agent will strengthen this tendency in subsequent iterations, while for negative feedback, it will reduce this tendency. Ultimately, the output of reinforcement learning is to obtain a behavioral strategy that maximizes the overall reward and adaptively adjusts within a dynamic environment.
[0144] Based on the principles and processes described above for the Q-learning algorithm, in step three, the formula for calculating the reward value is set as follows:
[0145]
[0146] In the formula, r represents the reward value; n represents the QoS attribute dimension; Indicates NDSS i The h-th non-dominant service in NDSS; i Denotes the i-th non-dominated service set; express The normalized value of the k-th QoS attribute; w k This represents the weight value of the k-th QoS attribute.
[0147] In this way, the Q-learning algorithm is used to process the non-dominated service set or the optimal cluster. After the algorithm converges, the optimal service in each state is combined into the final service combination result, which is the optimization result.
[0148] Example 2
[0149] This embodiment 2 uses three types of experiments to verify the effectiveness, scalability, and overall superiority of the service composition method (Q-learning with prediction model and clustering) in embodiment 1 for service composition plans formed for a large number of candidate services. Three other methods are introduced for comparison: 1. Using only the Q-learning algorithm (Q-learning): The Q-learning method is used to directly optimize the service composition plan; 2. Combining the Q-learning algorithm with the skyline algorithm (Q-learning with skyline): The service composition plan is first processed using the skyline algorithm to obtain a set of non-dominated services, and then the Q-learning algorithm is used to optimize the set of non-dominated services; 3. Combining the Q-learning algorithm with the skyline algorithm and hierarchical clustering (Q-learning with clustering and skyline): The service composition plan is first processed using the skyline algorithm to obtain a set of non-dominated services, then hierarchical clustering is performed on the non-dominated service set to obtain Z clusters, and N preferred clusters are selected. Finally, the Q-learning algorithm is used to optimize the N preferred clusters.
[0150] The large-scale abstract service in this embodiment 2 comes from the QWS dataset, which contains a large number of web services on the Internet and their QoS attribute information.
[0151] To ensure the convenience and effectiveness of the experiment, the following modifications were made in Example 2:
[0152] Firstly, in the selection of QoS attributes, only response time and reliability were used—the value of the response time attribute is negatively correlated with service quality, while the value of the reliability attribute is positively correlated with service quality.
[0153] Secondly, the number of candidate services is expanded—on the one hand, the size of the dataset is increased to construct a service portfolio plan formed by large-scale candidate services; on the other hand, the overall characteristics of the dataset are adjusted so that the proportion of non-dominated services is about 60%.
[0154] Finally, construct as follows Figure 4 The scalable service composition plan shown in the experiment controls the total number of states by setting the number of template instances. See also... Figure 4Hollow circles represent states, and solid circles represent abstract services. This service composition plan includes selection and serial structures. Each selection state is followed by multiple possible states; a serial state has only one subsequent state. The entire process begins with a serial structure, and from state S3 onwards, the entire workflow is scaled up using the structure within the box as a template. In each template, each service composition path traverses m selection states and n serial states.
[0155] 1. Perform validity verification:
[0156] set up Figure 4 In the service composition plan, m=2 and n=3; the number of template instances set after state S3 is 19. Thus, the total number of states is 4 + (2*2 + 3*2)*19 + 2 = 196. The number of candidate services in each state is 200.
[0157] In the Q-learning algorithm, the learning rate α is set to 0.6, and the depreciation rate γ is set to 0.9; in hierarchical clustering, the number of target clusters is set to 3.
[0158] A comparative experiment was conducted using the four methods described above under four different target user preference weights. See the results below. Figure 5 , Figure 6 , Figure 7 , Figure 8 : Figure 5 This demonstrates the case where the reliability attribute is 0.8 and the response time attribute is 0.2. Figure 6 This demonstrates the case where the reliability attribute is 0.6 and the response time attribute is 0.4. Figure 7 This demonstrates the case where the reliability attribute is 0.3 and the response time attribute is 0.7; Figure 8 This demonstrates the case where the reliability attribute is 0 and the response time attribute is 1.
[0159] It should be noted that the horizontal axis in the graph represents the number of cycles in which the Q-learning algorithm is run, and the vertical axis represents the cumulative return value of the service combination obtained after different Q-learning algorithm running cycles.
[0160] It can be seen that when faced with different target user preference weights, the Q-learning with prediction model and clustering method can effectively select the best solution space reduction method for service composition; while the Q-learning method, since it does not use any solution space reduction method, has the slowest convergence speed among all methods.
[0161] 2. Perform scalability verification:
[0162] Set the target user preference weights: reliability attribute is 0.5, response time attribute is 0.5; in this case, the BP neural network predicts that N preferred clusters should be used.
[0163] Keeping the total number of states constant, comparative experiments were conducted using the four methods described above on different numbers of candidate services, and the results are as follows. Figure 9 , Figure 10 : Figure 9 This shows the case where the number of candidate services is 300 in each state; Figure 10 This shows the case where there are 400 candidate services in each state.
[0164] It can be seen that as the number of candidate services increases, the convergence learning cycle of all four methods increases; however, the Q-learning with prediction model and clustering method has a faster convergence speed than other methods when faced with an ever-increasing number of services, indicating that it can perform more effective and faster service combination.
[0165] 3. Conduct overall superiority verification:
[0166] Based on the validity and scalability verification, it can be seen that the Q-learning method performs the worst; the Q-learning with clustering and skyline method may lose the optimal service. Therefore, these two methods are not good enough in terms of overall superiority, so they are removed and only the Q-learning with prediction model and clustering method and the Q-learning with skyline method are compared.
[0167] By keeping the total number of states constant, the number of candidate services in each state can be changed to provide service portfolio plans of different scales.
[0168] For each size of service portfolio plan, 15 target user preference weights are randomly generated. Then, based on these 15 target user preference weights, the plan is run 15 times on each of the two methods. Finally, based on the results of these 15 runs, the average number of convergence cycles and the average cumulative return value for the service portfolio results obtained on both methods are calculated. See the results below. Figure 11 , Figure 12 .
[0169] like Figure 11 , Figure 12 As shown, this set of experiments compares the statistical results of two indicators when the number of candidate services in each state is 100, 200, 300, 400, and 500, respectively. Figure 11 The comparison of average cumulative returns shows that the average return of the Q-learning with prediction model and clustering method is slightly higher than that of the Q-learning with skyline method. This is because the Q-learning with prediction model and clustering method can more accurately reduce the size of the solution space when using priority clustering, thus making it easier for the subsequent Q-learning algorithm to explore the optimal service combination result. Figure 12 The comparison of average convergence cycles shows that as the scale increases, the number of convergence cycles for both methods increases. However, the average convergence speed of the Q-learning with prediction model and clustering method is significantly better than that of the Q-learning with skyline method. This indicates that the Q-learning with prediction model and clustering method uses a BP neural network to prioritize clustering and select the best non-dominated service set, which can reduce the optimization time overall while ensuring the optimality of the service combination result.
[0170] Example 3
[0171] This embodiment 3 discloses a service composition system based on BP neural network and hierarchical clustering, which uses the service composition method based on BP neural network and hierarchical clustering disclosed in embodiment 1.
[0172] The service composition system based on BP neural network and hierarchical clustering includes: service acquisition module, preference acquisition module, skyline algorithm processing module, hierarchical clustering processing module, BP neural network processing module, cluster selection module, and Q-learning algorithm processing module.
[0173] The service acquisition module is used to obtain the service composition plan and extract the N abstract services it contains.
[0174] The preference acquisition module is used to acquire the preferences of the target user.
[0175] The skyline algorithm processing module is used to process N abstract services using the skyline algorithm to obtain a set of N non-dominated services.
[0176] The hierarchical clustering module performs hierarchical clustering on the i-th non-dominated service set, resulting in Z clusters. The cluster selection module selects the cluster closest to the target user's preference from the Z clusters obtained from the i-th non-dominated service set as the preferred cluster. The hierarchical clustering module and the cluster selection module iterate through the N non-dominated service sets, finally obtaining N preferred clusters.
[0177] The BP neural network processing module has a built-in pre-trained BP neural network, which is used to predict whether to use N preferred clusters based on the target user's preferences.
[0178] The Q-learning algorithm processing module is used to process N non-dominated service sets using the Q-learning algorithm to obtain the optimization result after predicting that N preferred clusters should not be used; or to process N preferred clusters using the Q-learning algorithm to obtain the optimization result after predicting that N preferred clusters should be used.
[0179] Example 4
[0180] This embodiment 4 discloses a readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the steps of the service composition method based on BP neural network and hierarchical clustering disclosed in embodiment 1 are performed.
[0181] When applying the method of Example 1, it can be applied in the form of software, such as by designing it as a program that can run independently on a computer-readable storage medium, which can be a USB flash drive. The USB flash drive can be designed as a program that starts the entire method through an external trigger.
[0182] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0183] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A service composition method based on BP neural network and hierarchical clustering, used to quickly and accurately optimize service composition results that meet the preferences of target users from a service composition plan; wherein, The service portfolio plan comprises N abstract services; its characteristic is that... The service composition method based on BP neural network and hierarchical clustering includes the following steps: Step 1: Obtain service portfolio plans and target user preferences; Step 2: Extract the N abstract services contained in the service composition plan, and process the N abstract services using the Skyline algorithm to obtain a set of N non-dominated services; For the i-th non-dominated service set, hierarchical clustering is performed with reference to the target user's preferences to obtain Z clusters. Then, the cluster closest to the target user's preferences is selected from the Z clusters as the preferred cluster. This process is repeated for N non-dominated service sets to obtain a total of N preferred clusters. Where i∈[1,N], and Z represents the number of target clusters. Input the target user's preferences into a pre-trained BP neural network to predict whether to use N preferred clusters; Step 3: If it is predicted that N preferred clusters should not be used, the N non-dominated service sets are processed using the Q-learning algorithm to obtain the optimization results; If it is predicted that N preferred clusters will be used, then the N preferred clusters are processed by the Q-learning algorithm to obtain the optimization result; The method for hierarchical clustering includes the following steps: S2.1, treat each non-dominated service in the i-th non-dominated service set as a cluster; For any given cluster, first calculate its attribute dominance ratio, then calculate its user preference value based on the attribute dominance ratio, and finally calculate its cluster center based on the user preference value. S2.2, calculate the Euclidean distance between the cluster centers of any two clusters; Find the two closest clusters and merge them into a new cluster; Among them, for the new cluster formed by merging, the average of the cluster centers of the two clusters used for merging is taken as its cluster center; S2.3, Repeat step S2.2 until the number of clusters drops to Z, then Z clusters are obtained.
2. The service composition method based on BP neural network and hierarchical clustering according to claim 1, characterized in that, The BP neural network includes: The input layer is used to input the target user's preferences. Hidden layers, which are used for data computation; and The output layer is used to output the prediction results to determine whether to use N preferred clusters.
3. The service composition method based on BP neural network and hierarchical clustering according to claim 1 or 2, characterized in that, The output of a trained BP neural network is either 0 or 1; If the output of the trained BP neural network is 0, it means that N preferred clusters should not be used. If the output of the trained BP neural network is 1, it means that N preferred clusters should be used.
4. The service composition method based on BP neural network and hierarchical clustering according to claim 1, characterized in that, In S2.1, the formula for calculating the attribute dominance ratio is: In the formula, express The proportion of attribute advantage on the m-th QoS attribute; Indicates NDSS i The h-th non-dominant service in NDSS; i Denotes the i-th non-dominated service set; Indicates NDSS i The m-th QoS attribute ratio A set of poor, non-dominated services; The formula for calculating user preference values is: In the formula, express User preference value; n represents the QoS attribute dimension; express The user preference value calculated on the m-th QoS attribute; The formula for calculating the cluster center is: In the formula, Indicates NDSS i The x-th cluster in [1, |NDSS], x∈[1,|NDSS] i |];|NDSS i NDSS before hierarchical clustering begins i Number of sub-clusters; NDSS i Denotes the i-th non-dominated service set; express The cluster center; n represents the QoS attribute dimension; express The value of the m-th QoS attribute; s k express The k-th non-dominated service in the process.
5. The service composition method based on BP neural network and hierarchical clustering according to claim 4, characterized in that, In S2.2, the formula for calculating the Euclidean distance between two clusters in the i-th non-dominant service set is: In the formula, They represent NDSS respectively i The e-th cluster and the f-th cluster in the middle; NDSS i Denotes the i-th non-dominated service set; express The Euclidean distance between them; getDistance(.) represents the Euclidean distance calculation function.
6. The service composition method based on BP neural network and hierarchical clustering according to claim 1, characterized in that, In step two, the formula for calculating the Euclidean distance between the Z clusters obtained from the i-th non-dominated service set and the target user's preference is: In the formula, Indicates ccluster i The z-th cluster; ccluster i Indicates NDSS i The resulting Z clusters; NDSS i Let represent the i-th non-dominated service set; W represents the target user preference weight set; getDistance(.) represents the Euclidean distance calculation function.
7. The service composition method based on BP neural network and hierarchical clustering according to claim 1, characterized in that, Methods for processing N abstract services using the Skyline algorithm include: Normalize N abstract services to obtain N normalized service sets; where the i-th abstract service corresponds to the i-th normalized service set, and the number of normalized candidate services in the i-th normalized service set is equal to the number of candidate services in the i-th abstract service. For any normalized candidate service, if it meets the non-dominated requirement, it is included in the non-dominated service set; otherwise, it is not included in the non-dominated service set.
8. The service composition method based on BP neural network and hierarchical clustering as described in claim 1, characterized in that, In step three, the formula for calculating the reward value of the Q-learning algorithm is as follows: In the formula, r represents the reward value; n represents the QoS attribute dimension; Indicates NDSS i The h-th non-dominant service in NDSS; i Denotes the i-th non-dominated service set; express The normalized value of the k-th QoS attribute; w k This represents the weight value of the k-th QoS attribute.
9. A service composition system based on BP neural network and hierarchical clustering, characterized in that, It uses the service composition method based on BP neural network and hierarchical clustering as described in any one of claims 1-8; The service composition system based on BP neural network and hierarchical clustering includes: The service acquisition module is used to acquire the service composition plan and extract the N abstract services it contains; The preference acquisition module is used to acquire the preferences of the target user. The skyline algorithm processing module is used to process N abstract services using the skyline algorithm to obtain a set of N non-dominated services. The hierarchical clustering processing module is used to perform hierarchical clustering on the i-th non-dominated service set to obtain Z clusters. The cluster selection module is used to select the cluster closest to the target user's preference from the Z clusters obtained from the i-th non-dominated service set, and use it as the preferred cluster. Among them, the hierarchical clustering processing module and the cluster selection module traverse and process the N non-dominated service sets, and finally obtain N preferred clusters; The BP neural network processing module has a built-in pre-trained BP neural network, which is used to predict whether to use N preferred clusters based on the target user's preferences. The Q-learning algorithm processing module is used to process the N non-dominated service sets using the Q-learning algorithm to obtain the optimization result after predicting that N preferred clusters should not be used; or to process the N preferred clusters using the Q-learning algorithm to obtain the optimization result after predicting that N preferred clusters should be used.
10. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which are read and executed by a processor to perform the steps of the service composition method based on BP neural network and hierarchical clustering as described in any one of claims 1-8.