Real-time scheduling method of cloud resources based on improved bee colony algorithm
By improving the swarm algorithm to balance energy consumption and computing time in cloud computing resource scheduling, the problems of resource scheduling delay and energy consumption in the prior art are solved, and the efficiency and sustainability of cloud computing systems are improved.
Patent Information
- Application Number
- CN202411549448.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-11-01
AI Technical Summary
The prior art is difficult to effectively balance the two conflicting goals of energy consumption and computing time in cloud computing resource scheduling, resulting in longer task execution time and reduced system fault tolerance.
By constructing the objective function, adjust the assignment scheme of the task to the server, and adopt an improved swarm algorithm, including the hiring stage and the filtering stage of the bystander bee stage reconciliation, introduce a solution retention strategy based on dominance relationships and fast non-dominant sorting to avoid premature convergence to the local optimal solution.
A resource allocation method that achieves a better balance between energy consumption and computing time is achieved, which improves the overall efficiency and sustainability of cloud computing systems, and avoids the delay in resource scheduling decisions and increased energy consumption.
Smart Images

Figure CN119046023B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a cloud resource real-time scheduling technology, and in particular to a cloud resource real-time scheduling method based on an improved bee colony algorithm. Background Art
[0002] The existing technology is difficult to effectively balance the two conflicting goals of energy consumption and computing time when scheduling cloud computing resources. The conflicting goals lead to longer task execution time and reduced system fault tolerance. The traditional bee colony algorithm does not converge fast enough and has limited solution accuracy in cloud computing resource scheduling applications. The genetic algorithm has the problem of converging to the local optimal solution too early. The slow convergence speed leads to delays in resource scheduling decisions. The low solution accuracy of the algorithm leads to increased energy consumption, and it is difficult to quickly adapt to dynamic changes and find the optimal solution.
[0003] In view of the above technical problems, this application proposes a solution. Summary of the invention
[0004] The purpose of the present invention is to find a resource allocation method that achieves a balance between energy consumption and computing time by constructing an objective function and continuously adjusting the allocation scheme of tasks to servers, so as to improve the overall efficiency and sustainability of the cloud computing system; a solution retention strategy based on dominance relationship is introduced in the bee hiring stage, so that the solutions in the population can evolve to a better direction more quickly; in the solution filtering stage, fast non-dominated sorting and crowding distance calculation are used to screen solutions, retaining evenly distributed high-quality solutions, avoiding the population from converging to the local optimal solution too early, and solving the problem that it is difficult to effectively balance the two conflicting goals of energy consumption and computing time when scheduling cloud computing resources, resulting in extended task execution time and reduced system fault tolerance; the traditional bee colony algorithm has the problem that the convergence speed is not fast enough and the solution accuracy is limited in the cloud computing resource scheduling application, and a cloud resource real-time scheduling method based on an improved bee colony algorithm is proposed.
[0005] The purpose of the present invention can be achieved through the following technical solutions:
[0006] The real-time scheduling method of cloud resources based on the improved bee colony algorithm includes:
[0007] Step 1: The main module initializes parameters, determines its own initial population size and randomly generates an initial population. Each solution corresponds to a resource allocation scheme, ensuring that the three constraints are met, and calculates the objective function values of energy consumption and computing time for each solution in the initial population;
[0008] Step 2: Iterative calculation from the module, in the hired bee stage, the slave module generates a new solution based on the current solution, compares the dominance relationship between the new solution and the old solution, and updates the solution based on the dominance relationship; in the spectator bee stage, the slave module increases the number of spectator bees according to the change in the number of solutions in the hired bee stage, and the spectator bees select solutions through roulette, search for new solutions in the neighborhood of the selected solution, compare the dominance relationship between the new solution and the original solution, and update the population and solution information if the new solution dominates the original solution; in the solution filtering stage, the population solutions are classified using fast non-dominated sorting, the crowding distance is calculated, the solutions are cut according to the solution level and crowding distance, and the population characteristics are maintained. After the iteration, the non-dominated solutions and related information are passed to the main module;
[0009] Step 3: The master module receives the non-dominated solutions and information transmitted by the slave module, and merges them with the non-dominated solution set and the sum maintained by itself. When merging, the non-dominated sorting is re-performed and the crowding distance is calculated. If the number of solutions exceeds the preset threshold, the solution is cut according to the crowding distance. When the slave module completes the iteration of the set number of slave module iterations, the multi-objective bee colony algorithm is iterated with the non-dominated solution set and the sum as the initial population. After the iteration, the obtained population is evenly distributed to the slave modules.
[0010] Step 4: After each iteration, the main module determines whether the termination condition is met. If the termination condition is met, the final population is returned.
[0011] As a preferred embodiment of the present invention, the data processing steps of the slave module in the bee hiring stage are as follows:
[0012] Step 1: After hiring bees to generate new solutions, if for all objective functions, there exists , , and there exists at least one objective function such that , , then determine the solution Dominant Solution , remove the solution On the contrary, solution Solution All are retained; and The solution is Solution In the The function value on the objective function, and The solution is Solution In the The function value on the objective function;
[0013] Step 2: If the old solution is retained, the "retained generation" count of the old solution in the population is increased by 1. If the new solution is retained, the initial count of the new solution is 0. The number of solutions increases. If the new solution dominates the old solution, an update operation is performed to replace the old solution with the new solution.
[0014] As a preferred embodiment of the present invention, the data processing steps of the slave module in the spectator bee stage are as follows:
[0015] Step 1: If the number of solutions in the hiring bee stage increases The number of bystander bees is set according to the ratio To increase, that is, to increase indivual;
[0016] Step 2: Initialize the spectator bees and assign an initial selection probability to each spectator bee. The initial probability is set to a uniform distribution and is associated with the solution in the current population.
[0017] Step 3: Each spectator bee independently performs a selection operation and selects a solution to mark. The selected spectator bee searches in the neighborhood of the marked solution to generate a new solution. The search method is the same as that of the hired bee stage.
[0018] Step 4: The resource allocation scheme in the cloud computing resource scheduling problem, i.e., the solution, can be obtained by randomly selecting a set proportion of tasks based on the current resource allocation and transferring them from the currently allocated servers to other servers, while considering the three constraints of the server; the objective function values of the energy consumption and computing time of the new solution are calculated and compared with the original marked solution. If the dominance relationship of the new solution is dominant, the new solution is used to replace the original solution; otherwise, the original solution is retained;
[0019] Step 5: If the new solution replaces the original solution, the corresponding position in the population is updated to the new solution, and the fitness value and "retained generation" count value of the solution are updated; if the original solution is retained, the population remains unchanged.
[0020] As a preferred embodiment of the present invention, the data processing steps of the slave module in the filtering stage of the solution are as follows:
[0021] Step 1: Use the fast non-dominated sorting method to filter the solutions and mark all the solutions in the current population as unsorted;
[0022] Step 2: Initialize an empty list of non-dominated solution sets , used to store non-dominated solution sets of different levels; for each solution in the population , and all other solutions in the population ( ) are compared pairwise. If for all objective functions, there exists , , and there exists at least one objective function such that , , then determine the solution Dominant Solution , record the solution Dominant Solution After completing all pairwise comparisons, select solutions that are not dominated by any other solution and place them into the non-dominated solution set. in, and for The solution in is assigned level 1; and The solution is Solution In the The function value on the objective function, and The solution is Solution In the The function value on the objective function;
[0023] Step 3: Remove non-dominated solutions from the current population The solution in , we get a new population , for the new population Repeat step 2 to find The solutions dominated by any other solution in form a new non-dominated solution set , and The solution in is assigned level 2; continue to repopulate Remove non-dominated solution sets The solution in , we get a new population , until all solutions in the entire population are assigned ranks, and a series of non-dominated solution sets are obtained , , ;
[0024] Step 4: For each non-dominated solution set The solutions in the above equations are calculated respectively, and their crowding distances are calculated for each objective function. , the non-dominated solution set The solution in is based on the objective function value Sort in ascending order; for the sorted non-boundary solutions, their crowding distance The calculation method is ,in is the number of objective functions, and In the objective function After sorting The adjacent next settlement The objective function value of the adjacent previous solution;
[0025] Step 5: Screen the solutions according to their level and crowding distance, give priority to cutting solutions with higher levels, and for solutions of the same level, cut them in order of crowding distance from small to large until the population size is the same as the initial number of food sources; after the screening is completed, the remaining solutions constitute the filtered population.
[0026] As a preferred embodiment of the present invention, the data processing steps based on the master-slave module calculation method are as follows:
[0027] Step 1: Initialization. According to the computing resources of the cloud computing environment and the scale of the problem, the number of threads to be initialized is determined by the number of cores of the server. , create a slave module for each thread; allocate independent memory space to each slave module to store its population data, solution-related information, and intermediate results during the algorithm operation;
[0028] Step 2: Slave module iteration, each slave module starts to execute the iteration process of the multi-objective bee swarm algorithm in its own population; after each iteration, each slave module passes the non-dominated solution generated in this iteration process to the master module;
[0029] Step 3: Master module operation. When the master module receives the non-dominated solutions from the slave modules, it merges these solutions with the existing non-dominated solution set. During the merging process, if the newly added solution causes the rank and crowding distance of the original solution to change, fast non-dominated sorting and crowding distance calculation are performed again to ensure that the non-dominated solution set maintained by the master module is always optimal. The master module sets a threshold , when the number of solutions in the sum of non-dominated solution sets exceeds When , some solutions are cut according to the crowding distance, and solutions with small crowding distance are cut first, so that the number of solutions remains within the set range;
[0030] Step 4: Set the number of iterations from the module to , when each slave module completes the iteration of the set slave module iteration number, the master module uses the currently maintained non-dominated solution set and as the initial population and starts to execute the iteration of the multi-objective bee colony algorithm; the number of master module iterations is set to ,After the master module completes the set number of iterations of the master module, the obtained population is evenly distributed to each slave module;
[0031] Step 5: After receiving the population assigned by the master module, the slave module starts to concurrently execute the multi-objective bee colony algorithm and repeats the above steps 2 and 3. After each iteration of the master module, it determines whether the three preset termination conditions of the algorithm are met. When one of the three termination conditions is met, the master module no longer assigns populations to the slave module, but returns the final population. The final population is marked as the decision basis for cloud computing resource scheduling.
[0032] As a preferred implementation of the present invention, the steps for calculating resource consumption during the operation of the server are as follows:
[0033] Step 1: The number of servers is , the number of tasks is , as the number of iterations Assuming that the computing resource consumption of each iteration is the same, the total computing resource consumption , the total memory resource consumption is , the total time resource consumption is ;
[0034] Step 2: Preset Server In unit time The energy consumption of executing multiple tasks in a server can be obtained by summing the energy consumption of all tasks assigned to the server. , Unit time Internally allocated to the server The task collection on Unit time Internal Tasks Is it assigned to the server? superior, Indicates allocation, Indicates unallocated, Indicates that the task Assign to server energy consumption, Representation Server The upper limit of energy consumption, , Indicates a certain task";
[0035] Step 3: Calculate the total resource consumption , For the task On the server Upper unit time The amount of computing resources occupied; the total amount of memory resources consumed , For the task On the server The amount of memory required when running on
[0036] Step 4: The consumption caused by iteration , the consumption caused by server operation .
[0037] As a preferred implementation of the present invention, the master-slave module iteration and the resource consumption comparison of the server operation are as follows:
[0038] Step 1: During the scout bee stage, the iteration of the master-slave module leads to a stable state of computing resource consumption, memory resource consumption and time consumption. Before the master module reaches one of the three preset termination conditions, the master-slave module iteration will continue to iterate. During the iterative operation of the master-slave module, the server is continuously in the awake state. In the awake state, the server operation continues to consume resources. The amount of resources consumed by the iteration is compared with the amount of resources consumed by the server operation;
[0039] Step 2: When When the master and slave modules continue to perform iterative operations, it is determined that the amount of resources consumed by the master and slave modules is greater than the amount of resources consumed by the server operation; if the master module still does not reach one of the three preset termination conditions, it is determined that the iterative operation is stopped and the server stops working;
[0040] Step 3: Calculate the crowding distance of the solutions in the population, and then calculate the crowding distance data of each solution. After comparison, the solution with a larger crowding distance and a level of 1 is selected; during the entire iteration process, the performance change trend of each solution is recorded, and the solution with a good performance increase trend and good final performance is selected; after four-fold screening of crowding distance, count value, level and change trend, the optimal solution is screened out.
[0041] Compared with the prior art, the present invention has the following beneficial effects:
[0042] 1. By constructing the objective function, the algorithm aims to minimize energy consumption and computing time during the iteration process. The algorithm adopts a multi-objective optimization strategy to comprehensively consider the various resource consumption and time spent when the task is executed on the server. By continuously adjusting the allocation scheme of tasks to servers, the algorithm gradually finds a resource allocation method that achieves a good balance between energy consumption and computing time, thereby improving the overall efficiency and sustainability of the cloud computing system.
[0043] 2. In the hired bee stage, a solution retention strategy based on dominance relationship is introduced. The new solution and the old solution are decided by comparing the dominance relationship, which enables the solutions in the population to evolve faster towards a better direction; in the spectator bee stage, the number of solutions is adjusted according to the change in the number of solutions and the solutions are selected through roulette, which increases the chances of high-quality solutions being selected and further optimized; in the solution filtering stage, fast non-dominated sorting and crowding distance calculation are used to screen solutions, retaining evenly distributed high-quality solutions, avoiding the population from converging to the local optimal solution too early, and also improving the quality of the solution; the improvement measures cooperate with each other, so that the algorithm can converge to the vicinity of the optimal solution faster during the iteration process, improving the accuracy of the final solution found. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.
[0045] Figure 1 is a flow chart of the method of the present invention;
[0046] Figure 2 It is a resource consumption variation curve diagram of the present invention. DETAILED DESCRIPTION
[0047] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Example:
[0049] See also Figure 1 As shown, the cloud resource real-time scheduling method based on the improved bee colony algorithm includes a master module and a slave module;
[0050] The cloud computing resource pool consists of a large number of heterogeneous server clusters. Represents a server cluster, where , Represents a server in the cluster; use the collection Represents a set of tasks to be executed, where , Indicates a task;
[0051] In actual operation, the performance of each server is different, the nature of the tasks to be executed is different, and even the server environment is different. These factors often cause different tasks to consume different energy and execution time when executed on different servers. Indicates that the task Assign to server energy consumption, Indicates that the task Assign to server The required computing time; in server management, the premise for the server to run stably and effectively is that each server The energy consumption is limited within a certain range; represents the upper limit of server energy consumption, where , , Representation Server The energy consumption limit of Indicates the distribution of tasks in the server cluster. When the value is "1", it means that the task Assign to server ;when A value of "0" means that the task will not be Assign to server ;
[0052] The energy consumption required by the server to complete all task calculations is represented by the energy consumption function. ; The server executes each task in a summary, represented by the calculation time function, which calculates the time function ; The objective function of this project is to minimize energy consumption and computing time at the same time. The objective function is , represents the function related to energy consumption, , represents a function related to computation time, ;
[0053] Tasks need to meet certain conditions when they are scheduled. The constraints of this model are as follows:
[0054] The energy consumption of the tasks assigned to each server cannot exceed the upper limit of the energy consumption of the server. express, ; Each task is executed once, through express, ; Each server has only two states for each task: execution or non-execution. , express.
[0055] In the hiring bee stage, after the traditional hiring bees generate a new solution, the dominated solution will be removed only when there is a dominance relationship between the new solution and the old solution, otherwise both solutions will be retained; the dominance relationship refers to the solution Dominant Solution When , for all objective functions , , all exist , and there is at least one objective function Make In a multi-objective scenario, the quality of a solution cannot be judged based on a single objective alone. A comprehensive evaluation mechanism is needed. In terms of energy consumption and computation time, it is not inferior to the solution , and is better in at least one objective (such as lower energy consumption or shorter computing time), then the solution is considered Dominant Solution ; If the old solution is retained, the "retained generation" count of the old solution in the population is increased by 1, and if the new solution is retained, the initial count of the new solution is 0; in this way, the number of solutions will increase. If the new solution dominates the old solution, an update operation is performed to replace the old solution with the new solution;
[0056] In cloud computing resource scheduling, if the resource allocation scheme corresponding to the new solution consumes less energy and has the same (or shorter) computing time than the old solution in terms of both energy consumption and computing time, or has a shorter computing time and consumes the same (or less) energy, or is better in terms of both energy consumption and computing time, then the new solution is determined to dominate the old solution, and an update operation is performed;
[0057] In the spectator bee stage, since the number of solutions in the hired bee stage changes, the number of spectator bees is increased accordingly; if the number of solutions in the hired bee stage increases The number of bystander bees is set according to the ratio To increase, that is, to increase Initialize the spectator bees, assign an initial selection probability to each spectator bee (the initial probability is set to uniform distribution, that is, the probability of each solution being selected is the same), and associate it with the solution in the current population, that is, each spectator bee corresponds to a solution in the population; if the number of the population changes, more high-quality solutions are retained and continuously updated, then the corresponding solution is selected through the roulette method;
[0058] For the two objectives of energy consumption and computing time in cloud computing resource scheduling, a fitness function is designed. , is the total time of task execution, is the energy consumption, and is the weight coefficient; according to the calculated fitness value , update the fitness information corresponding to each solution; the higher the fitness value, the greater the probability of being selected by the spectator bee; calculate the cumulative probability of each solution, if there is Solution, The fitness value of a solution is , No. The probability of a solution being selected is , No. The cumulative probability of a solution , generating a Random number between ; Starting from the first solution, compare the cumulative probabilities With random numbers ,when When A solution;
[0059] Each spectator bee independently performs a selection operation and selects a solution as its "focused" solution. The selected spectator bee searches in the neighborhood of its "focused" solution to generate a new solution. The search method is the same as that of the hired bee stage. The resource allocation scheme (solution) in the cloud computing resource scheduling problem can be achieved by randomly selecting a set proportion of tasks based on the current resource allocation and transferring them from the currently allocated server to other servers, while considering the three constraints of the server. The objective function values of the energy consumption and computing time of the new solution are calculated and compared with the original "focused" solution. If the new solution performs better (dominance relationship) according to the comparison rules of multi-objective optimization, the original solution is replaced by the new solution; otherwise, the original solution is retained.
[0060] If the new solution replaces the original solution, the corresponding position in the population is updated to the new solution, and the fitness value and the "retained generation" count value of the solution are updated; if the original solution is retained, the population remains unchanged;
[0061] After completing the spectator bee stage, the number of solutions has expanded in the two stages of employed bees and spectator bees, that is, a larger space has been searched. In order to control the number of populations and prevent the number of solutions from growing indefinitely, it is necessary to filter the solutions and leave the better solutions to enter the scout bee stage. The fast non-dominated sorting method is used to filter the solutions.
[0062] Mark all solutions in the current population as unsorted, so that the processing status of each solution can be accurately identified in the subsequent sorting process; initialize an empty list of non-dominated solution sets , used to store non-dominated solution sets of different levels; for each solution in the population , and all other solutions in the population ( ) for pairwise comparison, if for all objective functions , all exist , and there is at least one objective function Make , then determine the solution Dominant Solution , record the solution Dominant Solution After completing all pairwise comparisons, select solutions that are not dominated by any other solution and place them into the non-dominated solution set. in, and for The solutions in are assigned rank 1; the non-dominated solution set is removed from the current population The solution in , we get a new population , for the new population Repeat the above steps to determine the non-dominated solution set and find The solutions dominated by any other solution in form a new non-dominated solution set , and The solution in is assigned level 2; continue to repopulate Remove non-dominated solution sets The solution in , we get a new population Repeat the above process until all solutions in the entire population are assigned ranks, and a series of non-dominated solution sets are obtained. , , ; For each non-dominated solution set The solutions in the above equations are calculated respectively, and their crowding distances are calculated for each objective function. , the non-dominated solution set The solution in is based on the objective function value Sort in ascending order; for the sorted boundary solutions (i.e., the first and last solutions, which have the minimum and maximum values on the objective function), set their crowding distance to infinity, and for other solutions (non-boundary solutions), their crowding distance The calculation method is ,in is the number of objective functions, and In the objective function After sorting The adjacent next settlement The objective function value of the adjacent previous solution; the crowding distance reflects the distribution density of the solution in the target space. The larger the crowding distance, the fewer solutions there are around the solution, and the sparser the distribution of the solution; conversely, the smaller the crowding distance, the denser the distribution of the solution;
[0063] The solutions are screened based on their level and crowding distance, with higher-level solutions being prioritized. For solutions of the same level, they are cut in descending order of crowding distance until the population size is the same as the initial number of food sources. After the screening is completed, the remaining solutions form the filtered population.
[0064] In the scout bee stage, the solution set in the filtered population is checked. If there is a dominant solution in the solution set, the subsequent deletion and replacement operation is performed. All the dominant solutions in the solution set are traversed, and a dominant solution with the largest count value is selected from the dominant solutions to be deleted, and it is replaced by a randomly generated new solution. The new solution is generated by randomly assigning tasks to different servers. At the same time, the three constraints of the server need to be considered to ensure that the new solution is a feasible resource allocation solution. If all are non-dominated solutions, the scout bee stage is skipped and the next iteration is performed directly. In the next iteration, the new solution set will be used as the initial population, and will go through the hired bee stage, the spectator bee stage, the solution filtering stage and the scout bee stage again. This process is repeated until the termination condition of the algorithm is met (such as reaching the maximum number of iterations or the quality of the solution reaches a certain convergence standard), and finally the optimized cloud resource scheduling solution (i.e., the task and resource allocation solution, which achieves a relatively good balance between the two goals of energy consumption and computing time) is obtained.
[0065] According to the computing resources and problem scale of the cloud computing environment, the number of threads initialized is determined by the number of cores of the server. , create a slave module for each thread, each slave module will independently run a multi-objective bee colony algorithm instance; allocate independent memory space to each slave module to store its population data, solution-related information and intermediate results during the algorithm operation process. The solution-related information includes resource allocation scheme, energy consumption, computing time, count value and fitness value;
[0066] In each slave module, an initial population is randomly generated; for cloud computing resource scheduling problems, each solution in the initial population represents a possible resource allocation scheme; the objective function values of energy consumption and computing time of each solution in the initial population are calculated; according to the objective function values of energy consumption and computing time, the fitness of each solution is calculated and the count value of the solution is initialized;
[0067] Each slave module starts to execute the iterative process of the multi-objective bee colony algorithm in its own population; in the employed bee stage, the employed bees in the slave module generate new solutions according to the current solution (resource allocation plan), and decide whether to retain or replace the solution by comparing the dominance relationship between the new solution and the old solution, and update the count value of the solution at the same time; in the spectator bee stage, the number of spectator bees is increased according to the change in the number of solutions in the employed bee stage, and the solution is selected by the roulette method (the selection probability is related to the fitness of the solution, and the higher the fitness, the greater the probability of being selected), and the new solution is searched in the neighborhood of the selected solution, and the performance of the new solution and the original solution is compared to decide whether to update the solution in the population and the corresponding solution information (such as fitness value, count value, etc.); in the solution filtering stage, the fast non-dominated sorting method is used to classify the solutions in the population, and the crowding distance of each level of solution is calculated. The solution is cut according to the level and crowding distance of the solution to maintain the optimality and distribution uniformity of the solution in the population until the number of populations is the same as the number of initial food sources;
[0068] After each iteration, each slave module transmits the non-dominated solution generated in this iteration to the master module; the transmitted data includes the complete information of the solution, which includes resource allocation scheme, energy consumption, computing time, fitness value and count value, so that the master module can fully understand the search results of the slave modules;
[0069] The main module is responsible for collecting the non-dominated solutions transmitted by each slave module. After receiving the non-dominated solutions from the slave modules, the main module merges these solutions with the existing non-dominated solution set. During the merging process, if the newly added solution causes the rank and crowding distance of the original solution to change, fast non-dominated sorting and crowding distance calculation are performed again to ensure that the non-dominated solution set maintained by the main module is always optimal. In order to prevent the non-dominated solution set from being too large and affecting the efficiency of the algorithm, the main module sets a threshold , when the number of solutions in the sum of non-dominated solution sets exceeds When , some solutions are cut according to the crowding distance, and solutions with small crowding distance are cut first, so that the number of solutions remains within a reasonable range;
[0070] Set the number of iterations from the module to , when each slave module completes the iteration of the set slave module iteration number, the master module uses the currently maintained non-dominated solution set as the initial population and starts to execute the iteration of the multi-objective bee colony algorithm; the iteration process of the master module is similar to that of the slave module, but it searches on the basis of the global non-dominated solution set, aiming to further optimize the quality of the solution and find a better Pareto frontier (that is, a solution set that cannot make other objectives better without making any objective worse); during the iteration process, the master module will also generate new solutions, evaluate the performance of the solutions, compare and update the solutions, and will also continue to merge the non-dominated solutions generated in the iteration process into the non-dominated solution set, and then perform sorting and reduction operations again;
[0071] Set the number of main module iterations to After the main module completes the iteration of the set number of main module iterations, the obtained population is evenly distributed to each slave module; the distribution method is average distribution, that is, the solutions in the population are evenly divided according to the number of slave modules, and each slave module obtains the same number of solutions, which serve as the initial population for the next iteration. When distributing solutions, it is necessary to ensure that the solutions obtained by each slave module have a certain diversity to avoid the initial populations of some slave modules being too similar, which affects the search efficiency;
[0072] After receiving the population assigned by the master module, the slave module starts to concurrently execute the multi-objective bee colony algorithm and repeats the operations of the above slave module iteration phase, including executing the algorithm, generating non-dominated solutions and passing them to the master module; the master module continues to collect non-dominated solutions passed by the slave module, maintains the non-dominated solution set, and then iterates again with the non-dominated solution set as the initial population, and so on. The master and slave modules take turns to execute concurrently;
[0073] After each main module completes iteration, determine whether the termination condition of the algorithm is met; termination condition one, reaching the maximum total number of iterations , that is, the total number of iterations executed by the master module and the slave module reaches the preset value; Termination condition two, after multiple consecutive iterations of the master module, the quality of the solution in the sum of the non-dominated solution set has not been significantly improved, that is, the solution has converged to a certain extent; Termination condition three, the usage time of the computing resources exceeds the preset time limit;
[0074] When the termination condition is met, the master module no longer assigns populations to the slave modules, but returns the final population; the solution in this final population represents the resource allocation plan after multiple iterations of optimization, and has good performance in terms of energy consumption and computing time.
[0075] The consumption caused by iteration , the consumption caused by server operation ;
[0076] The number of servers is , the number of tasks is , the computational complexity of calculating the objective function value of a solution is assumed to be , the population size is , then the consumption of computing resources in the hired bee stage is ; The computational complexity of roulette selection and searching for new solutions is assumed to be , the population size after the increase is , then the consumption of computing resources in the spectator bee stage is ; The consumption of computing resources in the filtering phase of the solution is preset to ; The consumption of computing resources in the scout bee stage is preset to ; The consumption of computing resources in the iteration phase of the master-slave module is preset to , the sum of the above five types of computing resource consumption is calculated to obtain the computing resource consumption caused by one iteration, which is recorded as , as the number of iterations Assuming that the computing resource consumption of each iteration is the same, the total computing resource consumption ; Both represent the number of servers and number of tasks Related functions, Indicates that in the corresponding stage, the growth rate of computing resource consumption is The growth rate is of the same order of magnitude.
[0077] Assume that the memory space required to store a solution is , the population size is , then the amount of memory resources occupied by the population is ; The filtering stage of the solution needs to store information such as the level and crowding distance of the solution, and the memory space required is ; The memory space occupied by the non-dominated solution set is ; Calculate the sum of the above three memory resource consumptions to get the memory resource consumption caused by one iteration , as the number of iterations Assuming that the memory resource consumption of each iteration is the same, the total memory resource consumption is ; Both represent the number of servers and number of tasks Related functions, Indicates that in the corresponding stage, the growth rate of memory resource consumption is The growth rate is of the same order of magnitude.
[0078] The time complexity of generating new solutions and comparing dominance relations in the hired bee stage is set to , the population size is , then the time consumption of the hired bee stage is ; The time complexity of roulette wheel selection and search for new solutions in the spectator bee stage is set to , the population size after the increase is , then the consumption of computing resources in the spectator bee stage is ; The time complexity of the fast non-dominated sorting method in the filtering phase of the solution is set to ; The time consumption of the scout bee stage to select and replace the solution is set to The time consumption of the main module to collect, merge non-dominated solutions and perform iterative calculations based on the non-dominated solution set is set to ; Calculate the sum of the above five memory resource consumptions to get the memory resource consumption caused by one iteration , as the number of iterations Assuming that the memory resource consumption of each iteration is the same, the total memory resource consumption is ; Both represent the number of servers and number of tasks Related functions, Indicates that in the corresponding stage, the growth rate of memory resource consumption is The growth rate is of the same order of magnitude.
[0079] During server operation, preset server In unit time The energy consumption of executing multiple tasks in a server can be obtained by summing the energy consumption of all tasks assigned to the server. , Unit time Internally allocated to the server The task collection on Unit time Is it allocated to the server? superior, Indicates allocation, Indicates unallocated;
[0080] Calculate the total amount of resource consumption , For the task On the server Upper unit time The amount of computing resources occupied by the task; for CPU resources, it can be calculated based on the number of CPU cores occupied by the task per unit time and the utilization rate of each core ; For disk I / O resources, you can determine the amount of data read and written by the task and the disk read and write speed. ;
[0081] Total memory resource consumption , For the task On the server The amount of memory required when running on
[0082] During the scout bee stage, the iteration of the master-slave module leads to a stable state of computing resource consumption, memory resource consumption and time consumption. Before the master module reaches one of the three termination conditions, the master-slave module iteration will continue to iterate. During the iterative operation of the master-slave module, the server is continuously in the awake state. In the awake state, the server operation continues to consume resources. The resource consumption of the iteration is compared with the resource consumption of the server operation. When the master and slave modules continue to iterate, it is determined that the amount of resources consumed by the master and slave modules is greater than the amount of resources consumed by the server operation. The additional resource overhead caused by continuing to run the server is large, which will cause a waste of resources or affect the overall resource balance of the system. If the master module still does not reach one of the three termination conditions, it is determined that the iterative operation stops and the server stops working;
[0083] The crowding distance of the solutions in the population is calculated, and the solution with a larger crowding distance and a level of 1 is selected; considering the stability of the solution during the iteration process, in the bee hiring stage and the solution filtering stage, the count value of the solution can reflect its stability, and the solution with a lower count value has better stability;
[0084] Solution In the The performance evaluation function at the iteration is , calculate the solution From Iteration to Performance change trend value of iteration , is the set observation window size; if the preset average change rate maximum , then determine the solution The performance during this iteration is on the rise; if the preset average change rate minimum , then determine the solution The performance during this iteration tends to decrease; if , then determine the solution The performance during this iteration was basically stable;
[0085] like and , then determine the solution is the optimal solution, It is the preset minimum value of final performance.
[0086] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A real-time cloud resource scheduling method based on an improved bee colony algorithm, characterized in that: include: Step 1: The main module initializes parameters, determines its own initial population size and randomly generates an initial population, sets each solution in the initial population to correspond to a resource allocation scheme, and calculates the objective function value of energy consumption and computing time for each solution in the initial population; Step 2: Iterative calculation from the module, hiring bees stage, the module generates a new solution based on the current solution, compares the dominance relationship between the new solution and the old solution, and updates the solution based on the dominance relationship; In the spectator bee stage, the number of spectator bees is increased from the module according to the change in the number of solutions in the hired bee stage. The spectator bees select solutions through roulette, search for new solutions in the neighborhood of the selected solution, compare the dominance relationship between the new solution and the original solution, and update the population and solution information if the new solution dominates the original solution. In the solution filtering stage, the population solutions are graded using fast non-dominated sorting, the crowding distance is calculated, and the solutions are cut according to the solution level and crowding distance to maintain the population characteristics. After the iteration, the non-dominated solutions and related information are passed to the main module. Step 3: The master module receives the non-dominated solutions and information transmitted by the slave module, and merges them with the non-dominated solution set maintained by itself. When merging, it re-sorts the non-dominated solutions quickly and calculates the crowding distance. If the number of solutions exceeds the preset threshold, it performs a pruning operation according to the crowding distance. When the slave module completes the iteration of the set number of slave module iterations, the multi-objective bee colony algorithm is iterated with the non-dominated solution set and the initial population; after the iteration, the obtained population is evenly distributed to the slave modules; Step 4: After each iteration, the main module determines whether the three preset termination conditions are met. If the three preset termination conditions are met, the final population is returned; The method also includes the energy consumption required for the server to complete all task calculations, which is represented by an energy consumption function. , Indicates that the task Assign to server energy consumption, Representation Server The energy consumption limit of the server is the sum of the time it takes to execute each task, which is represented by the calculation time function. , Indicates that the task Assign to server The required computing time; the objective function of this project is to minimize both energy consumption and computing time. The objective function is , represents the function related to energy consumption, , represents a function related to computation time, ;in , Represents a server in the cluster; , Indicates a task; The steps for calculating resource consumption during server operation are as follows; Step 1: The number of servers is , the number of tasks is , as the number of iterations Assuming that the computing resource consumption of each iteration is the same, the computing resource consumption , the total memory resource consumption is , the total time resource consumption is ; Step 2: Preset Server In unit time The energy consumption of multiple tasks is obtained by summing the energy consumption of all tasks assigned to the server. , Unit time Internally allocated to the server The task collection on Unit time Internal Tasks Is it assigned to the server? superior, Indicates allocation, Indicates unallocated, Indicates that the task Assign to server energy consumption, Representation Server The upper limit of energy consumption, , Indicates a task; Step 3: Calculate the total resource consumption , For the task On the server Upper unit time The amount of computing resources occupied by the system; Total memory resource consumption , For the task On the server The amount of memory required when running on Step 4: Calculate the cost of iteration , the consumption caused by server operation ; Comparison of resource consumption of master-slave module iteration and server operation, the steps are as follows: Step 1: During the scout bee stage, the iteration of the master-slave module leads to a stable state of computing resource consumption, memory resource consumption and time consumption. Before the master module reaches one of the three preset termination conditions, the master-slave module iteration will continue to iterate. During the iterative operation of the master-slave module, the server is continuously in the awake state. In the awake state, the server operation continues to consume resources. The amount of resources consumed by the iteration is compared with the amount of resources consumed by the server operation; Step 2: When When the master and slave modules continue to perform iterative operations, it is determined that the amount of resources consumed by the master and slave modules is greater than the amount of resources consumed by the server operation; if the master module still does not reach one of the three termination conditions, it is determined that the iterative operation stops and the server stops working; Step 3: Solution In the The performance evaluation function at the iteration is , calculate the solution From Iteration to Performance change trend value of iteration , is the set observation window size; if the preset average change rate maximum , then determine the solution The performance during this iteration is on the rise; if the preset minimum average rate of change , then determine the solution The performance during this iteration tends to decrease; if , then determine the solution The performance during this iteration was basically stable; Step 4: If and , then determine the solution is the optimal solution, is the preset minimum final performance value; If the solution If there are multiple numbers of Corresponding Value and The difference between the values is compared and the solution with the largest difference is selected. is the optimal solution.
2. The cloud resource real-time scheduling method based on the improved bee colony algorithm according to claim 1 is characterized in that: The data processing steps from the module in the hiring bee stage are as follows: Step 1: After hiring bees to generate new solutions, if for all objective functions, there exists , , and there exists at least one objective function such that , , then determine the solution Dominant Solution , remove the solution On the contrary, solution Solution All are retained; and The solution is Solution In the The function value on the objective function, and The solution is Solution In the The function value on the objective function; Step 2: If the old solution is retained, the "retained generations" count of the old solution in the population is increased by 1. If the new solution is retained, the initial count of the new solution is 0. The number of solutions increases. If the new solution dominates the old solution, an update operation is performed to replace the old solution with the new solution.
3. The cloud resource real-time scheduling method based on the improved bee colony algorithm according to claim 1 is characterized in that: The steps for data processing from the module at the spectator bee stage are as follows: Step 1: If the number of solutions in the hiring bee stage increases The number of bystander bees is set according to the ratio To increase, that is, to increase indivual; Step 2: Initialize the spectator bees and assign an initial selection probability to each spectator bee. The initial probability is set to a uniform distribution and is associated with the solution in the current population. Step 3: Each spectator bee independently performs a selection operation and selects a solution to mark. The selected spectator bee searches in the neighborhood of the marked solution to generate a new solution. The search method is the same as that of the hired bee stage. Step 4: Resource allocation scheme in cloud computing resource scheduling problem. The new solution is to randomly select a set proportion of tasks based on the current resource allocation and transfer them from the currently allocated server to other servers. The objective function values of energy consumption and computing time of the new solution are calculated and compared with the original marked solution. If the dominance relationship of the new solution is dominant, the new solution replaces the original solution; otherwise, the original solution is retained. Step 5: If the new solution replaces the original solution, the corresponding position in the population is updated to the new solution, and the fitness value and "retained generation" count value of the solution are updated; if the original solution is retained, the population remains unchanged.
4. The cloud resource real-time scheduling method based on the improved bee colony algorithm according to claim 1 is characterized in that: The data processing steps of the slave module in the filtering stage of the solution are as follows: Step 1: Use the fast non-dominated sorting method to filter the solutions and mark all the solutions in the current population as unsorted; Step 2: Initialize an empty list of non-dominated solution sets , used to store non-dominated solution sets of different levels; for each solution in the population , and all other solutions in the population Perform pairwise comparisons, where , if for all objective functions, there exists , , and there exists at least one objective function such that , , then determine the solution Dominant Solution , record the solution b dominates the solution After completing all pairwise comparisons, select solutions that are not dominated by any other solution and place them into the non-dominated solution set. in, and for The solution in is assigned level 1; and The solution is Solution In the The function value on the objective function, and The solution is Solution In the The function value on the objective function; Step 3: Remove non-dominated solutions from the current population The solution in , we get a new population , for the new population Repeat step 2 to find The solutions dominated by any other solution in form a new non-dominated solution set , and The solution in is assigned level 2; continue to repopulate Remove non-dominated solution sets The solution in , we get a new population , until all solutions in the entire population are assigned ranks, and a series of non-dominated solution sets are obtained , , ; Step 4: For each non-dominated solution set The solutions in the above equations are calculated respectively, and their crowding distances are calculated for each objective function. , the non-dominated solution set The solution in is based on the objective function value Sort in ascending order; for the sorted non-boundary solutions, their crowding distance The calculation method is ,in is the number of objective functions, and In the objective function After sorting The adjacent next settlement The objective function value of the adjacent previous solution; Step 5: Screen the solutions according to their level and crowding distance, give priority to cutting solutions with higher levels, and for solutions of the same level, cut them in order of crowding distance from small to large until the population size is the same as the initial number of food sources; after the screening is completed, the remaining solutions constitute the filtered population.
5. The cloud resource real-time scheduling method based on the improved bee colony algorithm according to claim 1 is characterized in that: The data processing steps based on the master-slave module calculation method are as follows: Step 1: Initialization. According to the computing resources of the cloud computing environment and the scale of the problem, the number of threads to be initialized is determined by the number of cores of the server. , create a slave module for each thread; allocate independent memory space to each slave module to store its population data, solution-related information, and intermediate results during the algorithm operation; Step 2: Slave module iteration, each slave module starts to execute the iterative process of the multi-objective bee swarm algorithm in its own population; After each iteration, each slave module passes the non-dominated solution generated during this iteration to the master module; Step 3: Master module operation. When the master module receives the non-dominated solutions from the slave modules, it merges these solutions with the existing non-dominated solution set. During the merging process, if the newly added solution causes the level and crowding distance of the original solution to change, fast non-dominated sorting and crowding distance calculation are performed again. The master module sets a threshold , when the number of solutions in the sum of non-dominated solution sets exceeds When , the solutions with small crowding distance are preferentially cut according to the crowding distance, so that the number of solutions is kept within the set range; Step 4: Set the number of iterations from the module to ,When each slave module completes the set number of iterations of the slave module, the master module uses the currently maintained non-dominated solution set and as the initial population, and starts to execute the iteration of the multi-objective bee swarm algorithm; Set the number of main module iterations to ,After the master module completes the set number of iterations of the master module, the obtained population is evenly distributed to each slave module; Step 5: After receiving the population assigned by the master module, the slave module starts to concurrently execute the multi-objective bee colony algorithm and repeats the above steps 2 and 3. After each iteration of the master module, it determines whether the three preset termination conditions of the algorithm are met. When one of the three termination conditions is met, the master module no longer assigns populations to the slave module, but returns the final population. The final population is marked as the decision basis for cloud computing resource scheduling.