Dynamic task scheduling method and device, equipment and storage medium
By generating multiple alternative server code sets based on alternative area tasks in the banking system, calculating the alternative fitness and generating the new server code set, the problems of unbalanced load and high computing overhead in the existing task scheduling methods are solved, and efficient and real-time task scheduling is achieved.
Patent Information
- Application Number
- CN202510026996.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-04-11
AI Technical Summary
The existing task scheduling methods have problems with hunger and load imbalance in the banking system, and the calculation overhead is large, making it difficult to meet the real-time requirements.
By generating multiple alternative server code sets based on alternative area tasks, the alternative fitness of each code set is calculated, the intermediate server code set is determined, and the new server code set is generated through random values and interference factor processing, and the target server code set is finally determined to optimize task scheduling.
The load balancing of task scheduling is realized, local optimization problems are avoided, computing overhead is reduced, and task scheduling can meet the requirements of high real-timeness.
Smart Images

Figure CN119806784A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology, and in particular to a dynamic task scheduling method, device, equipment and storage medium. Background Art
[0002] During the operation of the banking system, multiple tasks may be generated at the same time. The banking system needs to allocate corresponding computing resources to each task to achieve task scheduling.
[0003] At present, the task scheduling methods commonly used in banking systems are: (1) traditional heuristic methods, specifically the min-min method that first assigns small tasks to the machine with the best performance, or the method of assigning tasks based on priority; (2) meta-heuristic methods, specifically generating or selecting heuristic (partial search algorithm) feasible solutions without relying on the specific conditions of the problem; (3) hybrid methods, specifically the hybrid methods generated by combining two or more scheduling methods, such as the multi-objective cuckoo particle swarm optimization that combines cuckoo search (CS) and particle swarm optimization (PSO).
[0004] However, traditional heuristic methods generally only consider a single standard, such as the shortest execution time, the shortest idle time, the shortest deadline, etc., and often fail to consider the impact of the current task on the execution of subsequent nodes, which often leads to starvation and load imbalance problems; metaheuristic methods generally take longer to calculate than heuristic search models due to the need for multiple iterations, and are prone to falling into local optimality if the parameters are not configured correctly; hybrid methods also generate additional overhead and low utilization due to the increased algorithm complexity. Moreover, the solution obtained at one time cannot meet the requirements of systems with high real-time requirements.
[0005] From the above, it can be seen that the scheduling effect of existing task scheduling methods is not good. Summary of the invention
[0006] In order to improve the scheduling effect of the task scheduling method, the present application provides a dynamic task scheduling method, device, equipment and storage medium.
[0007] In a first aspect, the present application provides a dynamic task scheduling method, comprising:
[0008] Generate multiple candidate server code sets based on the candidate area tasks, and calculate the candidate fitness of each of the candidate server code sets respectively;
[0009] Determine an intermediate server code set from each candidate server code set based on the candidate fitness, randomly generate a current round random value, and process the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set;
[0010] Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set;
[0011] Based on the target server code set of the current round, a task scheduling scheme is determined.
[0012] Through the above implementation, by calculating the alternative fitness, it is possible to determine the load balancing degree of each server corresponding to the alternative server code set when processing tasks, thereby eliminating the situation where only a single standard is considered when scheduling tasks; secondly, after generating the target server code set for the current round, the target server code sets for the current round for different iteration rounds will be cyclically generated in the process of determining the task scheduling plan to avoid the problem of local optimality; in addition, the dynamic task scheduling method provided by this scheme does not incur additional overhead, and the final task scheduling plan can be directly generated based on the alternative area tasks; in this way, this scheme facilitates improving the scheduling effect of the task scheduling method.
[0013] Preferably, the separately calculating the candidate fitness of each of the candidate server code sets includes:
[0014] Determine the time for each server corresponding to the candidate server code set to process the corresponding candidate zone task to obtain a time set;
[0015] Based on the time set and the preset time regulation weight and load regulation weight, the candidate fitness corresponding to the candidate zone server code set is calculated.
[0016] Through the above implementation, the alternative fitness of the alternative server code set is determined according to the time taken by each server corresponding to the alternative server code set to process the corresponding alternative area task. This makes it easy to determine the load balancing degree of each alternative server code set, so as to facilitate the subsequent selection of a better alternative server code set.
[0017] Preferably, the determining of the intermediate server code set from each candidate server code set based on the candidate fitness comprises:
[0018] Calculate the selection probability corresponding to each of the candidate fitnesses to obtain a selection probability set;
[0019] Determining an intermediate fitness from each of the candidate fitnesses based on the selection probability set and a preset random probability;
[0020] The candidate server code set corresponding to the intermediate fitness is used as the intermediate server code set.
[0021] Through the above implementation, the selection probability corresponding to the alternative fitness is determined, and the random probability is set, so that the intermediate server code set can be determined by roulette, so as to improve the global search capability of the intermediate server code set and the efficiency of determining the intermediate server code set.
[0022] Preferably, the processing of the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set includes:
[0023] Determine whether the current round random value is less than a preset interference factor;
[0024] If yes, then mutate each server code between the server code corresponding to the current round random value in the intermediate server code set and the server code corresponding to the interference factor in the intermediate server code set to obtain a new server code set;
[0025] Otherwise, the server code corresponding to the random value of the current round in the intermediate server code set is exchanged with the server code corresponding to the interference factor to obtain a new server code set.
[0026] Through the above implementation, the server codes that need to be changed in the intermediate server code set are determined by the current round random value and the interference factor, which makes it easy to improve the randomness of the generation of the new server code set, thereby making it easier to obtain a more accurate task scheduling solution later.
[0027] Preferably, the determining of the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set includes:
[0028] Determining the candidate fitness of the intermediate server code set, and calculating the candidate fitness of the new server code set;
[0029] Determining whether the candidate fitness of the new server code set is less than the candidate fitness of the intermediate server code set;
[0030] If so, the new server code set is used as the target server code set for the current round; otherwise, the intermediate server code set is used as the target server code set for the current round.
[0031] Through the above implementation, the target server code set of the current round is determined from the new server code set and the intermediate server code set according to the size of the candidate fitness, so that the target server code set of the current round with the best load balancing is obtained.
[0032] Preferably, determining the task scheduling scheme based on the target server code set of the current round includes:
[0033] Determine the number of iterations and the number of accesses corresponding to the target server code set of the current round;
[0034] Determining whether the number of iterations is a preset number of iterations threshold;
[0035] If yes, then generate a task scheduling plan based on the candidate area tasks and the target server code set of the current round, otherwise, continue to determine whether the number of accesses does not exceed a preset access number threshold;
[0036] If so, a new target server code set for the current round is determined based on the candidate fitness; otherwise, multiple new candidate server code sets are generated based on the candidate area tasks, and the number of visits corresponding to the target server code set for the current round is set to zero.
[0037] Through the above implementation, by judging the number of iterations and the iteration number threshold, as well as the number of visits and the visit number threshold, the target server code set of the current round is cyclically generated, and the task scheduling plan is finally determined. This facilitates continuous optimization of the server code set with the best load balancing capability, thereby improving the accuracy of the final task scheduling plan.
[0038] In a second aspect, the present application provides a dynamic task scheduling device, comprising:
[0039] A fitness calculation module, used to generate multiple candidate server code sets based on the candidate zone tasks, and respectively calculate the candidate fitness of each of the candidate server code sets;
[0040] A code set processing module, used to determine an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generate a current round random value, and process the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set;
[0041] A code set determination module, used to determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set;
[0042] The scheme determination module is used to determine the task scheduling scheme based on the target server code set of the current round.
[0043] Through the above implementation, by calculating the alternative fitness, it is possible to determine the load balancing degree of each server corresponding to the alternative server code set when processing tasks, thereby eliminating the situation where only a single standard is considered when scheduling tasks; secondly, after generating the target server code set for the current round, the target server code sets for the current round for different iteration rounds will be cyclically generated in the process of determining the task scheduling plan to avoid the problem of local optimality; in addition, the dynamic task scheduling method provided by this scheme does not incur additional overhead, and the final task scheduling plan can be directly generated based on the alternative area tasks; in this way, this scheme facilitates improving the scheduling effect of the task scheduling method.
[0044] In a third aspect, the present application provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method when executing the computer program.
[0045] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.
[0046] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0047] The above-mentioned dynamic task scheduling method, device, equipment and storage medium generate multiple alternative server code sets based on the alternative area tasks, and calculate the alternative fitness of each of the alternative server code sets respectively; determine the intermediate server code set from each alternative server code set based on the alternative fitness, and randomly generate a random value for the current round, and process the intermediate server code set based on the random value for the current round and a preset interference factor to obtain a new server code set; determine the target server code set for the current round based on the alternative fitness of the intermediate server code set and the calculated alternative fitness of the new server code set; and determine the task scheduling plan based on the target server code set for the current round. Through the above implementation, by calculating the alternative fitness, it is possible to determine the load balancing degree of each server corresponding to the alternative server code set when processing tasks, thereby eliminating the situation where only a single standard is considered when scheduling tasks; secondly, after generating the target server code set for the current round, the target server code sets for the current round for different iteration rounds will be cyclically generated in the process of determining the task scheduling plan to avoid the problem of local optimality; in addition, the dynamic task scheduling method provided by this scheme does not incur additional overhead, and the final task scheduling plan can be directly generated based on the alternative area tasks; in this way, this scheme facilitates improving the scheduling effect of the task scheduling method.
[0048] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 A flow chart of a dynamic task scheduling method provided in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of a directed acyclic graph provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of the structure of a dynamic task scheduling device provided in an embodiment of the present application;
[0053] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0054] Figure 5 This is a diagram of the internal structure of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.
[0056] It should be noted that the terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0057] In this article, the term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the related objects before and after are in an "or" relationship.
[0058] Embodiment 1
[0059] Figure 1 A flow chart of a dynamic task scheduling method provided in Example 1 of the present application, refer to Figure 1 The method may be performed by a device for performing the method, and the device may be implemented by software and / or hardware. The method includes:
[0060] S110 , generating a plurality of candidate server code sets based on the candidate zone tasks, and calculating the candidate fitness of each of the candidate server code sets.
[0061] Among them, the banking system will generate some tasks during its operation. The types of tasks include: independent tasks, dependent tasks and mixed tasks; independent tasks have no dependencies on other tasks and can be completed after one operation. Dependent tasks include multiple subtasks, which have dependencies between them. The execution of some subtasks may utilize the execution results of other subtasks before, that is, the subtasks in the dependent tasks have a dependency relationship of execution in sequence; mixed tasks include both independent tasks and dependent tasks. In order to facilitate the intuitive display of mixed tasks, a directed acyclic graph (DAG) can be used to display mixed tasks. For example, please refer to Figure 2 , a mixed task directed acyclic graph includes a pseudo start node Start, several task nodes V and a pseudo end node End, where several task nodes include two independent tasks, that is, A1{V 1} and A2{V 2}, and also includes two dependent tasks B1{V 3 ,V 4 ,V 5 ,V 6} and B2{V 7 ,V 8 ,V 9}; Each task node has a corresponding task identifier v id , the final deadline v deadline , task value v value And the task status v state , taking one of the task nodes V i For example, the V i Denoted as {v id , vdeadline ,v value ,v state}。
[0062] It should be noted that in this embodiment, taking a hybrid task as an example, after creating a directed acyclic graph corresponding to a hybrid task, it is necessary to allocate corresponding idle computing resources to each task node in the directed acyclic graph. The idle computing resources are currently in an idle state and will be used to process the allocated task nodes later. In this embodiment, each idle computing resource is specifically an idle server. During the allocation process, in order to facilitate the management of each task node in the directed acyclic graph, the scheduling center server creates an initial area, an alternative area, a completion area, and a death area to store task nodes in different states; among them, all task nodes V in the directed acyclic graph are stored in the initial area in the initial state; then the pseudo-start node Start, the pseudo-end node End, and the task nodes directly connected to the pseudo-start node Start (in this embodiment, that is, V 1 ,V 2 ,V 3 ,V 7 ) are further stored in the alternative area, and then the pseudo-start node Start and the pseudo-end node End in the alternative area are further stored in the completion area. Then, according to the task nodes directly connected to the pseudo-start node Start in the alternative area (hereinafter referred to as alternative area tasks) and several idle computing resources, allocation calculations are performed to generate a corresponding allocation plan (or task scheduling plan). In the allocation plan, if a single idle computing resource is allocated multiple alternative area tasks, then according to the task value v value of each alternative area task, they are sorted from high to low, and then the alternative area tasks with higher task value v value of the idle computing resource start to be processed; after the alternative area task is completed, the corresponding task node in the alternative area is further moved into the completion area; if the alternative area task is a dependent task, the subsequent subtasks of the alternative area task are placed in the alternative area as new alternative area tasks; if the alternative area task times out or fails to execute, the alternative area task and its subsequent subtasks are moved into the death area, and the task nodes in the death area are all task nodes that have not been successfully executed.
[0063] Among them, assuming that there are p alternative area tasks and q idle servers in total, in order to implement the scheduling of alternative area tasks later, it is necessary to select several from the q idle servers as alternative servers, and then encode each alternative server to obtain an alternative server code, and denote the alternative server code as x i (0≤i<p); Exemplarily, assuming that the alternative area tasks are {V 1 ,V 2 ,V 3 ,V 7}, the set of candidate server codes corresponding to the selected server may be {x 4 , x 3 , x 2 , x 3}, and the set of candidate server codes is recorded as the candidate server code set. In this embodiment, m different candidate server code sets X can be randomly generated according to a set of candidate area tasks. 1 , X 2 , ..., X m ; The above alternative server encoding set {x 4 , x 3 , x 2 , x 3}That is, one of the m alternative server encodings.
[0064] Each alternative server code set can calculate the alternative fitness fit corresponding to the alternative server code set based on the time taken by the corresponding idle servers therein to execute the corresponding tasks. The alternative fitness fit is used to characterize the load balancing degree of the corresponding idle servers in the corresponding alternative server code set to execute the corresponding tasks. In this embodiment, the expected load balancing degree is that the total time taken by each idle server to execute the task is similar and the load of each idle server is similar. Therefore, the smaller the alternative fitness fit, the more the allocation plan generated by the corresponding alternative server code set is in line with expectations.
[0065] S120, determining an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generating a random value for the current round, and processing the intermediate server code set based on the random value for the current round and a preset interference factor to obtain a new server code set.
[0066] Among them, the intermediate server code set is one of the alternative server code sets randomly selected from each alternative server code set according to the alternative fitness corresponding to each alternative server code set through a certain selection method; after the intermediate server code set is determined, in order to speed up the determination of a group of server code sets for generating task scheduling plans, it is necessary to randomly change the server codes in the intermediate server code set.
[0067] In order to realize the random change of each server code in the intermediate server code set, after the intermediate server code set is determined, the random value u' of the current round is randomly generated. The present embodiment also presets an interference factor u. The server codes that need to be randomly changed in the intermediate server code set can be determined by the random value u' of the current round and the interference factor u. Then, after the server codes that need to be changed determined in the intermediate server code set are changed, a new server code set can be obtained.
[0068] S130: Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set.
[0069] Among them, the intermediate server code set is an alternative server set randomly selected from multiple alternative server sets initially randomly generated. The alternative fitness of the alternative server set has been calculated and can be used as the alternative fitness of the intermediate server code set at this time; the newly generated new server code set can be calculated according to the time taken for each corresponding idle server to execute the corresponding task, thereby calculating the corresponding alternative fitness of the new server code set.
[0070] From the above analysis, it can be seen that the smaller the alternative fitness, the more the corresponding server code set meets expectations. Therefore, this step can be performed by comparing the alternative fitness of the intermediate server code set with the calculated alternative fitness of the new server code set, and then using the one with the smaller alternative fitness between the intermediate server code set and the new server code set as the target server code set for this round.
[0071] S140: Determine a task scheduling plan based on the target server code set of the current round.
[0072] It should be noted that in order to obtain a target server code set that is more in line with expectations, it is necessary to continue to perform multiple rounds of iterations through the randomly generated multiple candidate server code sets based on the generated target server code set for the current round. Each round of iteration can generate a corresponding target server code set for the current round until the preset iteration stop condition is met, thereby obtaining the final target server code set for the current round, and then establish a matching relationship between each candidate area task and each server code in the final target server code set for the current round, thereby obtaining a task scheduling plan. Subsequently, according to the task scheduling plan, each candidate area task can be assigned to the corresponding idle server for execution.
[0073] It should be noted that the present embodiment generates multiple alternative server code sets based on the alternative area tasks, and calculates the alternative fitness of each of the alternative server code sets respectively; determines an intermediate server code set from each of the alternative server code sets based on the alternative fitness, and randomly generates a random value for the round, and processes the intermediate server code set based on the random value for the round and a preset interference factor to obtain a new server code set; determines the target server code set for the round based on the alternative fitness of the intermediate server code set and the calculated alternative fitness of the new server code set; and determines a task scheduling plan based on the target server code set for the round. Through the above implementation, by calculating the alternative fitness, it is possible to determine the load balancing degree of each server corresponding to the alternative server code set when processing tasks, thereby eliminating the situation where only a single standard is considered when scheduling tasks; secondly, after generating the target server code set for the current round, the target server code sets for the current round for different iteration rounds will be cyclically generated in the process of determining the task scheduling plan to avoid the problem of local optimality; in addition, the dynamic task scheduling method provided by this scheme does not incur additional overhead, and the final task scheduling plan can be directly generated based on the alternative area tasks; in this way, this scheme facilitates improving the scheduling effect of the task scheduling method.
[0074] Embodiment 2
[0075] A dynamic task scheduling method provided in the second embodiment of the present application optimizes the "respectively calculating the candidate fitness of each candidate server code set" in the first embodiment; it should be noted that for the part not described in detail in this embodiment, reference can be made to the description of other embodiments, and the method includes:
[0076] S211. Generate multiple candidate server code sets based on the candidate zone tasks.
[0077] S212: Determine the time for each server corresponding to the candidate server code set to process the corresponding candidate zone task, and obtain a time set.
[0078] Among them, taking an alternative server code set as an example, the alternative server code set contains multiple alternative server codes, and each alternative server code corresponds to an idle server; when the alternative area tasks are determined, each idle server corresponding to the randomly generated alternative server code set corresponds to one or more alternative area tasks, and each idle server will consume corresponding time to execute the corresponding one or more alternative area tasks.
[0079] For example, it is assumed that the determined candidate area task is {V 1 , V 2 , V 3 , V 7}, a randomly generated candidate server code set is {x 4, x 3 , x 2 , x 3}, in this case, idle server No. 4 needs to process task 1 in the candidate area, idle server No. 3 needs to process tasks 2 and 7 in the candidate area, and idle server No. 2 needs to process task 7 in the candidate area; the estimated time T consumed by idle server No. 4 to process task 1 in the candidate area is 1 , the total time T consumed by idle server No. 3 to process task 2 and task 7 in the candidate area 2 , and the time T consumed by idle server No. 2 to process task 7 in the candidate area 3 ; The estimated time consumed by each idle server corresponding to the candidate server code set to execute the corresponding one or more candidate zone tasks can be obtained to obtain the corresponding time set; the time set corresponding to the above example is {T 1 , T 2 , T 3}.
[0080] S213: Calculate the candidate fitness corresponding to the candidate zone server code set based on the time set and the preset time control weight and load control weight.
[0081] It should be noted that the lengths of the times in the time set are different. Take one of the time sets as an example, and the longest time in the time set is recorded as max(T(R)), and the shortest time is recorded as min(T(R)); the difference between max(T(R)) and min(T(R)) can be used to measure the load balancing degree of the corresponding alternative zone server encoding set, and the difference between max(T(R)) and min(T(R)) is recorded as E(R), E(R) = max(T(R))-min(T(R)).
[0082] In order to more accurately measure the load balancing degree of the candidate zone server code set, this embodiment also introduces a preset time control weight a and load control weight b, and uses the candidate fitness fit as a more accurate measure of the load balancing degree of the candidate zone server code set. Fit = aT(R) + bE(R), where T(R) is the sum of the time of each idle server corresponding to the candidate zone server code set executing the corresponding candidate zone task. For example, when the time set is {T 1 , T 2 , T 3}, T(R)=T 1 +T 2 +T 3 .
[0083] S220, determining an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generating a random value for the current round, and processing the intermediate server code set based on the random value for the current round and a preset interference factor to obtain a new server code set.
[0084] S230: Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set.
[0085] S240: Determine a task scheduling plan based on the target server code set of the current round.
[0086] Embodiment 3
[0087] A dynamic task scheduling method is provided in the third embodiment of the present application. The method optimizes the "determining the intermediate server code set from each candidate server code set based on the candidate fitness" in the first embodiment. It should be noted that for the part not described in detail in the present embodiment, reference can be made to the description of other embodiments. The method includes:
[0088] S310: Generate multiple candidate server code sets based on the candidate area tasks, and calculate the candidate fitness of each of the candidate server code sets.
[0089] S321. Calculate the selection probability corresponding to each candidate fitness to obtain a selection probability set.
[0090] Among them, this embodiment specifically adopts the roulette selection method to randomly determine the intermediate server code set from each candidate server code set, and for this purpose, the selection probability of each candidate fitness is first calculated; and the sum of each candidate fitness corresponding to each candidate server code set is recorded as the fitness sum value fit total , and the candidate fitness corresponding to any candidate server encoding set is recorded as fit i , then the selection probability corresponding to the alternative fitness is fit i / fit total ; and the set of selection probabilities corresponding to each alternative fitness is recorded as the selection probability set.
[0091] S322: Determine an intermediate fitness from each of the candidate fitnesses based on the selection probability set and a preset random probability.
[0092] Among them, in order to use the roulette selection method to randomly determine the intermediate server code set from each alternative server code set, it is also necessary to preset the corresponding random probability r; in order, one selection probability in the selection probability set is accumulated each time, and the corresponding accumulated value is obtained, and then it is determined whether the accumulated value is greater than the random probability r. If so, the alternative fitness corresponding to the accumulated selection probability is used as the intermediate fitness. It should be noted that when the first accumulation is performed, the accumulated value is also the first selection probability in the selection probability set.
[0093] S323: Use the candidate server code set corresponding to the intermediate fitness as the intermediate server code set.
[0094] Among them, each candidate fitness has its corresponding candidate server code set, and the candidate server code set corresponding to the intermediate fitness is also the intermediate server code set.
[0095] S324, and randomly generate a random value for the current round, and process the intermediate server code set based on the random value for the current round and a preset interference factor to obtain a new server code set.
[0096] S330: Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set.
[0097] S340: Determine a task scheduling plan based on the target server code set of the current round.
[0098] Embodiment 4
[0099] A dynamic task scheduling method is provided in the fourth embodiment of the present application. The method optimizes the "processing the intermediate server code set based on the current round random value and the preset interference factor to obtain a new server code set" in the first embodiment; it should be noted that, for the part not described in detail in this embodiment, please refer to the description of other embodiments. The method includes:
[0100] S410: Generate multiple candidate server code sets based on the candidate area tasks, and calculate the candidate fitness of each of the candidate server code sets.
[0101] S421. Determine an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generate a random value for the current round.
[0102] S422: Determine whether the current round random value is less than a preset interference factor.
[0103] S423: If yes, mutate each server code between the server code corresponding to the random value of the current round in the intermediate server code set and the server code corresponding to the interference factor in the intermediate server code set to obtain a new server code set.
[0104] If the current round random value u' is less than the preset interference factor u, the strategy for changing the server code in the intermediate server code set selected in this embodiment is: determine the server code x corresponding to the current round random value u' in the intermediate server code set. u’ , x u’ That is, the u'th server code in the intermediate server code set, and the server code x corresponding to the interference factor u in the intermediate server code set is also determined. u , and then the intermediate server encoding is concentrated in the server encoding x u’ with server encoding x u The server codes between them are mutated to obtain a new server code set.
[0105] It should be noted that the mutation is to randomly mutate the server code into a new idle server code, and the new idle server code may still be the previous server code.
[0106] S424. Otherwise, exchange the server code corresponding to the current round random value in the intermediate server code set with the server code corresponding to the interference factor to obtain a new server code set.
[0107] If the current round random value u' is not less than the preset interference factor u, the strategy for changing the server code in the intermediate server code set selected in this embodiment is: determine the server code x corresponding to the current round random value u' in the intermediate server code set. u’ , and also determine the server code x corresponding to the interference factor u in the intermediate server code set u , then exchange the server code x u’ with server encoding x u The position in the intermediate server code set, thereby obtaining a new server code set.
[0108] S430: Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set.
[0109] S440: Determine a task scheduling plan based on the target server code set of the current round.
[0110] Embodiment 5
[0111] A dynamic task scheduling method provided in the fifth embodiment of the present application optimizes the "determining the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set" in the first embodiment; it should be noted that, for the part not described in detail in this embodiment, reference can be made to the description of other embodiments, and the method includes:
[0112] S510: Generate multiple candidate server code sets based on the candidate area tasks, and calculate the candidate fitness of each of the candidate server code sets.
[0113] S520, determining an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generating a random value for the current round, and processing the intermediate server code set based on the random value for the current round and a preset interference factor to obtain a new server code set.
[0114] S531. Determine the candidate fitness of the intermediate server code set, and calculate the candidate fitness of the new server code set.
[0115] It should be noted that the intermediate server code set is a candidate server code set selected from multiple candidate server code sets, and each candidate server code set has calculated the candidate fitness corresponding to its own degree, so the intermediate server code set has also calculated its corresponding candidate fitness. The new server code set can calculate the candidate fitness corresponding to the new server code set according to the time taken by each corresponding idle server to execute the corresponding task.
[0116] S532: Determine whether the candidate fitness of the new server code set is less than the candidate fitness of the intermediate server code set.
[0117] S533: If so, use the new server code set as the target server code set for the current round; otherwise, use the intermediate server code set as the target server code set for the current round.
[0118] Among them, if the alternative fitness of the new server code set is less than the alternative fitness of the intermediate server code set, it means that the new server code set is a server code set that is more in line with the expected one than the intermediate server code set. At this time, the new server code set is used as the target server code set of this round.
[0119] If the alternative fitness of the new server code set is not less than the alternative fitness of the intermediate server code set, it means that the intermediate server code set is a server code set that is more in line with the expected value than the new server code set. At this time, the new server code set is used as the target server code set for this round.
[0120] S540: Determine a task scheduling plan based on the target server code set of the current round.
[0121] Embodiment 6
[0122] A dynamic task scheduling method is provided in Example 6 of the present application. The method optimizes the "determining a task scheduling scheme based on the target server code set of the current round" in Example 1. It should be noted that for the parts not described in detail in this embodiment, reference can be made to the descriptions of other embodiments. The method includes:
[0123] S610: Generate multiple candidate server code sets based on the candidate area tasks, and calculate the candidate fitness of each of the candidate server code sets.
[0124] S620. Determine an intermediate server code set from each candidate server code set based on the candidate fitness, randomly generate a random value for the current round, and process the intermediate server code set based on the random value for the current round and a preset interference factor to obtain a new server code set.
[0125] S630: Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set.
[0126] S641, determining the number of iterations and the number of accesses corresponding to the target server code set of the current round.
[0127] S642: Determine whether the number of iterations is a preset iteration number threshold.
[0128] It should be noted that in order to achieve iterative optimization of the target server code set of the current round, this embodiment presets an iteration number threshold, and sets the initial iteration number to 0. Each time the target server code set of the current round is generated, the iteration number is increased by 1 to obtain a new iteration number. The iteration number threshold is used to compare with the iteration number to determine when to stop the iteration.
[0129] S643: If yes, generate a task scheduling plan based on the candidate area tasks and the target server code set of the current round; otherwise, continue to determine whether the number of accesses does not exceed a preset access number threshold.
[0130] It should be noted that if it is determined that the number of iterations is the preset iteration number threshold, it means that the preset iteration stop condition has been reached at this time, and the current round of target server code set generated by the current round of iteration is determined, and the matching relationship between each alternative area task and each server code in the current round of target server code set is determined, so as to obtain the task scheduling plan.
[0131] It should be noted that in order to achieve iterative optimization of the target server code set of the current round, the present embodiment also provides an access count threshold, and sets the initial access count to 0. The access count is used to characterize the number of times the corresponding intermediate server code set or the new server code set is used as the target server code set of the current round, and the access count threshold is used to compare with the access count to determine whether to start the next round of iteration.
[0132] S644, if yes, then re-determine a new target server code set for the current round based on the candidate fitness; otherwise, re-generate multiple new candidate server code sets based on the candidate area tasks, and set the number of visits corresponding to the target server code set for the current round to zero.
[0133] Among them, if it is judged that the number of accesses does not exceed the preset access number threshold, it means that the next round of iteration can be started at this time, that is, the S620-S630 steps are executed again based on the alternative fitness generated in step S610 to generate a new target server code set for the current round; if it is judged that the number of accesses exceeds the preset access number threshold, it means that the determined target server code set for the current round may fall into a local optimum, and it is necessary to re-execute the dynamic task scheduling method from step S610, and set the above-mentioned number of accesses to 0.
[0134] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0135] Embodiment 7
[0136] Based on the same inventive concept, this embodiment also provides a dynamic task scheduling device for implementing the dynamic task scheduling method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more dynamic task scheduling device embodiments provided below can refer to the limitations of the dynamic task scheduling method above, and will not be repeated here.
[0137] In this embodiment, Figure 3 As shown, a dynamic task scheduling device is provided, comprising:
[0138] A fitness calculation module, used to generate multiple candidate server code sets based on the candidate zone tasks, and respectively calculate the candidate fitness of each of the candidate server code sets;
[0139] A code set processing module, used to determine an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generate a current round random value, and process the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set;
[0140] A code set determination module, used to determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set;
[0141] The scheme determination module is used to determine the task scheduling scheme based on the target server code set of the current round.
[0142] Each module in the above-mentioned dynamic task scheduling device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0143] It should be noted that the present embodiment generates multiple alternative server code sets based on the alternative area tasks, and calculates the alternative fitness of each of the alternative server code sets respectively; determines an intermediate server code set from each of the alternative server code sets based on the alternative fitness, and randomly generates a random value for the round, and processes the intermediate server code set based on the random value for the round and a preset interference factor to obtain a new server code set; determines the target server code set for the round based on the alternative fitness of the intermediate server code set and the calculated alternative fitness of the new server code set; and determines a task scheduling plan based on the target server code set for the round. Through the above implementation, by calculating the alternative fitness, it is possible to determine the load balancing degree of each server corresponding to the alternative server code set when processing tasks, thereby eliminating the situation where only a single standard is considered when scheduling tasks; secondly, after generating the target server code set for the current round, the target server code sets for the current round for different iteration rounds will be cyclically generated in the process of determining the task scheduling plan to avoid the problem of local optimality; in addition, the dynamic task scheduling method provided by this scheme does not incur additional overhead, and the final task scheduling plan can be directly generated based on the alternative area tasks; in this way, this scheme facilitates improving the scheduling effect of the task scheduling method.
[0144] In an optional embodiment, in terms of respectively calculating the candidate fitness of each candidate server code set, the fitness calculation module is specifically used to:
[0145] Determine the time for each server corresponding to the candidate server code set to process the corresponding candidate zone task to obtain a time set;
[0146] Based on the time set and the preset time regulation weight and load regulation weight, the candidate fitness corresponding to the candidate zone server code set is calculated.
[0147] In an optional embodiment, in determining the intermediate server code set from each candidate server code set based on the candidate fitness, the code set processing module is specifically used to:
[0148] Calculate the selection probability corresponding to each of the candidate fitnesses to obtain a selection probability set;
[0149] Determining an intermediate fitness from each of the candidate fitnesses based on the selection probability set and a preset random probability;
[0150] The candidate server code set corresponding to the intermediate fitness is used as the intermediate server code set.
[0151] In an optional embodiment, in terms of processing the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set, the code set processing module is specifically used to:
[0152] Determine whether the current round random value is less than a preset interference factor;
[0153] If yes, then mutate each server code between the server code corresponding to the current round random value in the intermediate server code set and the server code corresponding to the interference factor in the intermediate server code set to obtain a new server code set;
[0154] Otherwise, the server code corresponding to the random value of the current round in the intermediate server code set is exchanged with the server code corresponding to the interference factor to obtain a new server code set.
[0155] In an optional embodiment, in determining the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set, the code set determination module is specifically used to:
[0156] Determining the candidate fitness of the intermediate server code set, and calculating the candidate fitness of the new server code set;
[0157] Determining whether the candidate fitness of the new server code set is less than the candidate fitness of the intermediate server code set;
[0158] If so, the new server code set is used as the target server code set for the current round; otherwise, the intermediate server code set is used as the target server code set for the current round.
[0159] In an optional embodiment, in determining the task scheduling scheme based on the target server code set of the current round, the scheme determination module is specifically used to:
[0160] Determine the number of iterations and the number of accesses corresponding to the target server code set of the current round;
[0161] Determining whether the number of iterations is a preset number of iterations threshold;
[0162] If yes, then generate a task scheduling plan based on the candidate area tasks and the target server code set of the current round, otherwise, continue to determine whether the number of accesses does not exceed a preset access number threshold;
[0163] If so, a new target server code set for the current round is determined based on the candidate fitness; otherwise, multiple new candidate server code sets are generated based on the candidate area tasks, and the number of visits corresponding to the target server code set for the current round is set to zero.
[0164] Embodiment 8
[0165] In this embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a dynamic task scheduling method is implemented.
[0166] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0167] Embodiment 9
[0168] In this embodiment, a computer readable storage medium is provided. Figure 5As shown, a computer program is stored thereon, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0169] Embodiment 10
[0170] In this embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0171] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0172] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present disclosure may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided by the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0173] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.
[0174] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the attached claims.
Claims
1. A dynamic task scheduling method, characterized in that: include: Generate multiple candidate server code sets based on the candidate area tasks, and calculate the candidate fitness of each of the candidate server code sets respectively; Determine an intermediate server code set from each candidate server code set based on the candidate fitness, randomly generate a current round random value, and process the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set; Determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set; Based on the target server code set of the current round, a task scheduling scheme is determined.
2. The method according to claim 1, characterized in that The respectively calculating the candidate fitness of each candidate server code set comprises: Determine the time for each server corresponding to the candidate server code set to process the corresponding candidate zone task to obtain a time set; Based on the time set and the preset time regulation weight and load regulation weight, the candidate fitness corresponding to the candidate zone server code set is calculated.
3. The method according to claim 1, characterized in that The determining of the intermediate server code set from each candidate server code set based on the candidate fitness comprises: Calculate the selection probability corresponding to each of the candidate fitnesses to obtain a selection probability set; Determining an intermediate fitness from each of the candidate fitnesses based on the selection probability set and a preset random probability; The candidate server code set corresponding to the intermediate fitness is used as the intermediate server code set.
4. The method according to claim 1, characterized in that The step of processing the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set includes: Determine whether the current round random value is less than a preset interference factor; If yes, then mutate each server code between the server code corresponding to the current round random value in the intermediate server code set and the server code corresponding to the interference factor in the intermediate server code set to obtain a new server code set; Otherwise, the server code corresponding to the random value of the current round in the intermediate server code set is exchanged with the server code corresponding to the interference factor to obtain a new server code set.
5. The method according to claim 1, characterized in that The determining of the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set includes: Determining the candidate fitness of the intermediate server code set, and calculating the candidate fitness of the new server code set; Determining whether the candidate fitness of the new server code set is less than the candidate fitness of the intermediate server code set; If so, the new server code set is used as the target server code set for the current round; otherwise, the intermediate server code set is used as the target server code set for the current round.
6. The method according to claim 1, characterized in that The step of determining a task scheduling scheme based on the target server code set of the current round includes: Determine the number of iterations and the number of accesses corresponding to the target server code set of the current round; Determining whether the number of iterations is a preset number of iterations threshold; If yes, then generate a task scheduling plan based on the candidate area tasks and the target server code set of the current round, otherwise, continue to determine whether the number of accesses does not exceed a preset access number threshold; If so, a new target server code set for the current round is determined based on the candidate fitness; otherwise, multiple new candidate server code sets are generated based on the candidate area tasks, and the number of visits corresponding to the target server code set for the current round is set to zero.
7. A dynamic task scheduling device, characterized in that: The device comprises: A fitness calculation module, used to generate multiple candidate server code sets based on the candidate zone tasks, and respectively calculate the candidate fitness of each of the candidate server code sets; A code set processing module, used to determine an intermediate server code set from each candidate server code set based on the candidate fitness, and randomly generate a current round random value, and process the intermediate server code set based on the current round random value and a preset interference factor to obtain a new server code set; A code set determination module, used to determine the target server code set of the current round based on the candidate fitness of the intermediate server code set and the calculated candidate fitness of the new server code set; The scheme determination module is used to determine the task scheduling scheme based on the target server code set of the current round.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.