CN116755866B - Resource scheduling method and device, electronic equipment and readable storage medium - Google Patents

Resource scheduling method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN116755866B
CN116755866B CN202311028063.3A CN202311028063A CN116755866B CN 116755866 B CN116755866 B CN 116755866B CN 202311028063 A CN202311028063 A CN 202311028063A CN 116755866 B CN116755866 B CN 116755866B
Authority
CN
China
Prior art keywords
time
target
population
tasks
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311028063.3A
Other languages
Chinese (zh)
Other versions
CN116755866A (en
Inventor
祝志超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202311028063.3A priority Critical patent/CN116755866B/en
Publication of CN116755866A publication Critical patent/CN116755866A/en
Application granted granted Critical
Publication of CN116755866B publication Critical patent/CN116755866B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a resource scheduling method, a device, electronic equipment and a readable storage medium, which relate to the technical field of computers and are used for acquiring the type of a target task and the running state information of a resource node; under the condition that the type of the target task is a preset type, determining a first function according to the target task and the running state information, wherein the preset type represents any one of the 2 nd to the N th to-be-completed tasks of the N to-be-completed tasks, the N to-be-completed tasks are sequentially arranged, and N is an integer larger than 1; calculating the first function according to a target algorithm to obtain a target solution; and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution. When the task which is not completed exists on the resource nodes, the tasks can be distributed to other resource nodes which have completed the tasks, so that the total task execution time is shortened.

Description

Resource scheduling method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of artificial intelligence technologies, and in particular, to a resource scheduling method, a device, an electronic apparatus, and a readable storage medium.
Background
As the number of tasks of users continues to increase, the duration of completing the corresponding tasks by the cloud computing resource node also increases significantly, thereby seriously affecting the service quality of the users.
Under the condition that the cloud computing resource nodes do not finish old tasks and users submit new tasks, the existing resource node scheduling scheme is usually a resource node scheduling scheme for executing the new tasks after waiting for all the cloud computing resource nodes to finish all the old tasks, and due to different finishing time lengths of the old tasks finished on the cloud computing resource nodes, the situation that part of the cloud computing resource nodes finish the old tasks in advance and do not distribute new tasks to the cloud computing resource nodes exists.
Because a reasonable resource node scheduling scheme is not adopted to fully utilize the resource nodes, the problem that the total time length for completing tasks by the resource nodes is long in the prior art exists.
Disclosure of Invention
The embodiment of the invention provides a resource scheduling method, a device, electronic equipment and a readable storage medium, which are used for solving the problem in the prior art that the total time length for completing tasks by a resource node is long.
In a first aspect, an embodiment of the present invention provides a method for scheduling a resource node, including:
Acquiring the type of a target task and the running state information of a resource node;
determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, and the N tasks to be completed are sequentially arranged, and N is an integer larger than 1;
calculating the first function according to a target algorithm to obtain a target solution;
and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
Optionally, the target algorithm comprises at least one of a genetic algorithm and a greedy algorithm.
Optionally, in the case that the target algorithm includes a genetic algorithm and a greedy algorithm, the calculating the first function according to the target algorithm includes:
determining a target resource node of a first individual in a resource list according to the greedy algorithm and the type of the required resource of the first individual, wherein the first individual is an individual which does not meet a preset constraint condition, and the individual is determined based on the genetic algorithm;
Determining a first population according to the target resource node of the first individual, wherein the first population comprises the target resource node of the first individual;
carrying out iterative computation on the first population according to the genetic algorithm and recording the iterative times;
and under the condition that the iteration times of the first population reach the preset iteration times, determining the individual with the highest fitness in the current population as a target solution of the first function, wherein the current population is a population obtained by carrying out iterative computation on the first population by the preset iteration times.
Optionally, the performing iterative computation on the first population according to the genetic algorithm includes:
calculating fitness of individuals in the first population according to a genetic algorithm;
and determining a second population according to the genetic algorithm, the fitness of the individuals in the first population and a preset fitness threshold value, and performing iterative calculation.
Optionally, the performing iterative computation on the first population according to the genetic algorithm, the crossover probability and the mutation probability includes:
calculating the sum of the fitness of M individuals of the first population and the fitness of the M individuals, wherein M is a positive integer;
Determining a first probability of a target individual according to the sum of the fitness of the target individual and the fitness of the M individuals, wherein the target individual is any one of the M individuals, and the first probability is the probability that the target individual is selected into a second population;
and determining the second population according to the first probability of the target individual, wherein the second population is the population of the first population after one iteration.
Optionally, in the case that the first time period is less than the preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is less than the preset time period,indicating that the N to-be-completed arbitrary tasks are completed under the condition that the first time length is smaller than the preset time lengthThe cost to be spent on the business,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
Optionally, in the case that the first time period is longer than the preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is greater than the preset time period,representing the cost to be spent completing the N tasks to be completed if the first time period is greater than the preset time period,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first time of each resource node, wherein the first time is the waiting time before the resource node will target the taskThe time when the task processing is completed is the difference between the second time and the current time, and the second time is the latest time in the first time.
In a second aspect, an embodiment of the present invention further provides a resource scheduling device, where the resource scheduling device includes:
the monitoring module is used for acquiring the type of the target task and the running state information of the resource node;
the determining module is used for determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents that the target task is any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, the N tasks to be completed are sequentially arranged, and N is an integer larger than 1;
The obtaining module is used for calculating the first function according to a target algorithm to obtain a target solution;
and the scheduling module is used for scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
In a third aspect, an embodiment of the present invention further provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, which processor when executing the computer program implements the steps in the resource scheduling method as described above.
In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a resource scheduling method as described above.
In the embodiment of the invention, the type of the target task and the running state information of the resource node are obtained; determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, and the N tasks to be completed are sequentially arranged, and N is an integer larger than 1; calculating the first function according to a target algorithm to obtain a target solution; and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution. When the task which is not completed exists on the resource nodes, the tasks can be distributed to other resource nodes which have completed the tasks, so that the total task execution time is shortened.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
FIG. 1 is a flowchart of a resource scheduling method provided by an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a resource scheduling device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The flow chart of the resource scheduling method provided by the embodiment of the invention, as shown in fig. 1, comprises the following steps:
Step 101, acquiring the type of a target task and the running state information of a resource node;
it should be appreciated that the types of target tasks described above may be either a first type or a second type. The type of the target task is a first type, namely, no task which is not executed yet exists on a resource node before the target task is submitted, and the type of the target task is determined to be the first type at the moment; the type of the target task is a second type, which means that tasks which are not executed yet exist on the resource node before the target task is submitted, and the type of the target task is determined to be the second type.
It should be understood that the operation state information of the resource node includes: whether there is a task being executed and a completion time to execute the remaining tasks.
In step 101, after a user submits a target task to a resource node, acquiring the type of the target task and the running state information of the resource node once every certain period; the type of the target task and the running state information of the resource node can be acquired in real time after the user submits the target task to the resource node.
Step 102, determining a first function according to the target task and the running state information when the type of the target task is a preset type, wherein the preset type indicates that the target task is any one of the 2 nd to the N th tasks to be completed among N tasks to be completed, the N tasks to be completed are sequentially arranged, and N is an integer greater than 1;
It should be appreciated that the above-mentioned preset type is a second type; the target task has a task length.
In step 102, in the case that the type of the target task is a preset type, that is, in the case that the type of the target task is a second type, a first function is determined according to the target task and the running state information.
The first function may beAnd satisfies the following constraints: representing tasksFor resource nodeMedium resource typeIs used in the production of the product,is a resource nodeMedium resourceIs used in the amount of the available amount,representing the resource availability of the CPU,Representing the resource availability and amount of memoryRepresents the amount of resources available for bandwidth,to take on a weight parameter in the range of 0 to 1,for the weight parameter with the value ranging from 0 to 1, andn represents the number of tasks, m represents the number of resource nodes,represents the time required to complete the N tasks to be completed if the first time period is less than the preset time period, m represents the number of resource nodes,representing tasksWhether or not at the resource nodeThe execution of the method is performed by,the value of (2) is 1 or 0,representing tasksAt resource nodeThe execution of the process is performed on the machine,representing tasksNot at resource node The execution of the process is performed on the machine,for the taskIs provided for the length of (a),is a resource nodeThe execution speed of the CPU of the system;,f cost representing the cost to perform the task run,representing tasksWhether or not at the resource nodeThe execution of the method is performed by,the value of (2) is 1 or 0,representing tasksAt resource nodeThe execution of the process is performed on the machine,representing tasksNot at resource nodeThe execution of the process is performed on the machine,is a resource nodeThe resource usage cost in a unit time length, n represents the number of tasks, m represents the number of resource nodes,is a resource nodeMedium resourceIs used in the amount of the available amount,respectively represent the resource availability of the central processing unit, the memory and the bandwidth,for the taskIs provided for the length of (a),is a resource nodeThe execution speed of the central processing unit.
The first function may also beAnd satisfies the following constraints:representing tasksFor resource nodeMedium resource typeIs used in the production of the product,is a resource nodeMedium resourceIs used in the amount of the available amount,representing the resource availability of the CPU,Representing the resource availability and amount of memoryRepresents the amount of resources available for bandwidth,to take on a weight parameter in the range of 0 to 1,for the weight parameter with the value ranging from 0 to 1, andindicating that all resource nodes have completed the submitted task to the resource node before submitting the target task In the time interval between completion of the target task,representing representation resource nodesThe time of completing the target task, n represents the number of tasks, m represents the number of resource nodes,for the taskIs provided for the length of (a),is a resource nodeIs provided with a Central Processing Unit (CPU) execution speed,represents the time required to complete the N tasks to be completed if the first time period is greater than the preset time period,representing tasksWhether or not at the resource nodeThe execution of the method is performed by,the value of (2) is 1 or 0,representing tasksAt resource nodeThe execution of the process is performed on the machine,representing tasksNot at resource nodeThe execution of the process is performed on the machine,represents the cost of the N tasks to be completed when the first time period is longer than the preset time period, N represents the number of tasks, m represents the number of resource nodes,representing tasksWhether or not at the resource nodeThe execution of the method is performed by,for the taskIs provided for the length of (a),is a resource nodeIs provided with a Central Processing Unit (CPU) execution speed,is a resource nodeResource usage costs per unit time.
By setting the weight parameter, the relative importance of the task completion time and the resource use cost is expressed.
Step 103, calculating the first function according to a target algorithm to obtain a target solution;
It should be appreciated that the target algorithm may be a heuristic algorithm that can solve a constrained function.
In step 103, the target solution may be a locally optimal solution of the first function, or may be a globally optimal solution of the first function.
And 104, scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
In step 104, after obtaining the target solution of the first function, generating a task execution sequence table of each resource node, and then adding the task number into the task execution sequence table according to the sequence of the task submitting time, wherein the resource node executes the corresponding task according to the task number in the task execution sequence table.
In the embodiment of the invention, the type of the target task and the running state information of the resource node are obtained; determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, and the N tasks to be completed are sequentially arranged, and N is an integer larger than 1; calculating the first function according to a target algorithm to obtain a target solution; and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution. When the task which is not completed exists on the resource nodes, the tasks can be distributed to other resource nodes which have completed the tasks, so that the total task execution time is shortened.
Optionally, in some embodiments, the target algorithm comprises at least one of a genetic algorithm and a greedy algorithm.
In the embodiment of the invention, the target algorithm comprises a genetic algorithm and a greedy algorithm, so that when the genetic algorithm is utilized to solve the constrained resource scheduling problem, in order to ensure the diversity of the population, individuals which do not meet the constraint conditions are not abandoned in the stages of initialization, intersection, variation and the like, but the greedy algorithm is combined to adjust the individuals which do not meet the constraint conditions, so that the adjusted individuals have less task completion time and use cost of resource nodes, and the overall convergence accuracy is finally improved.
Optionally, in some embodiments, where the target algorithm includes a genetic algorithm and a greedy algorithm, the calculating the first function according to the target algorithm includes:
determining a target resource node of a first individual in a resource list according to the greedy algorithm and the type of the required resource of the first individual, wherein the first individual is an individual which does not meet a preset constraint condition, and the individual is determined based on the genetic algorithm;
It should be appreciated that the resource availability of the target resource node meets the task demand of the first individual.
It should be appreciated that the above preset constraints are:representing tasksFor resource nodeMedium resource typeIs used in the production of the product,is a resource nodeMedium resourceIs used in the amount of the available amount,respectively represent the resource availability of the central processing unit, the memory and the bandwidth.
Determining a first population according to the target resource node of the first individual, wherein the first population comprises the target resource node of the first individual;
it should be appreciated that the first population includes a plurality of individuals and a corresponding resource node for each individual.
Carrying out iterative computation on the first population according to the genetic algorithm and recording the iterative times;
and under the condition that the iteration times of the first population reach the preset iteration times, determining the individual with the highest fitness in the current population as a target solution of the first function, wherein the current population is a population obtained by carrying out iterative computation on the first population by the preset iteration times.
It should be appreciated that the predetermined number of iterations may be between 100 and 2000.
Optionally, in some embodiments, the iteratively calculating the first population according to a genetic algorithm includes:
Calculating fitness of individuals in the first population according to a genetic algorithm;
and determining a second population according to the fitness and the preset fitness of the individuals in the first population according to the genetic algorithm, and performing iterative calculation.
In the embodiment of the present invention, the formula for calculating the fitness of the individuals in the first population may be:may also beThe method comprises the steps of carrying out a first treatment on the surface of the And carrying out normalization processing on the sample, wherein the normalization processing formula is as follows:the method comprises the steps of carrying out a first treatment on the surface of the Wherein,andthe maximum and minimum fitness in the population, respectively.
At the same time, willIndividuals greater than the predetermined fitness value are determined to be a second population.
In the embodiment of the invention, by adopting the mode, the influence of the fitness on the order of magnitude can be reduced by carrying out normalization processing on the fitness.
Optionally, the performing iterative computation on the first population according to the genetic algorithm, the crossover probability and the mutation probability includes:
calculating the sum of the fitness of M individuals of the first population and the fitness of the M individuals, wherein M is a positive integer;
determining a first probability of a target individual according to the sum of the fitness of the target individual and the fitness of the M individuals, wherein the target individual is any one of the M individuals, and the first probability is the probability that the target individual is selected into a second population;
And determining the second population according to the first probability of the target individual, wherein the second population is the population of the first population after one iteration.
In the embodiment of the invention, the probability of an individual being selected is:the method comprises the steps of carrying out a first treatment on the surface of the Wherein,the fitness after the treatment is normalized for the ith individual, and N is the total number of tasks.
According to the embodiment of the invention, through the scheme, the probability that the individual with large adaptability is selected is larger than the individual with small adaptability.
Optionally, in some embodiments, probability is derived from the new populationSelection of two individuals for chromosomal crossover to probabilitySelecting an individual for chromosomal variation, generating a new individual, and treating the new individual as follows: decoding individual elements and mapping decoded values to intervalsIn the inner, the mapping formula is: when (when)In the time-course of which the first and second contact surfaces,when (when)In the time-course of which the first and second contact surfaces,. Wherein the method comprises the steps ofAndthe values before and after mapping are respectively represented.
Further, after all the element mapping is completed, adopting a greedy algorithm to correct the new individual which does not meet the constraint condition, namely judging the elements in the new individualWhether the constraint condition is satisfied, if so, continuing to judge the next element; if the constraint condition is not met, finding a corresponding resource type P, and generating an available resource list according to the order of the available resource P from small to large, wherein the list records the available quantity of 3 resources in m resource nodes, and the available quantity of the three resources comprises: the CPU, the memory and the bandwidth are available, the available amount of 3 resources is found from the table to meet the task requirement, and a resource nodes with the closest available amount of the resources P and the task requirement are a resource nodes, the value range of a is 1-5, and the current task t is calculated respectively i Corresponding fitness function when being distributed to a different resource nodesNumerical value, assigning the resource node number corresponding to the maximum fitness function value to e i And then continuing to judge the next element, and after all the elements are processed, re-binary encoding the individual and adding the binary encoded individual into the population.
Optionally, in the case that the first time period is less than the preset time period, the first function is:
wherein f time Representing the time required for completing the N tasks to be completed under the condition that the first time length is smaller than the preset time length, f cost The method comprises the steps of representing cost required by completing N tasks to be completed under the condition that a first time length is smaller than a preset time length, wherein the value range of alpha is 0 to 1, the value range of beta is 0 to 1, alpha+beta=1, the running state information comprises first time of each resource node, the first time is time when the resource node completes processing the tasks to be completed before the target task, the first time length is the difference between a second time and the current time, and the second time is the latest time in the first time.
Optionally, in the case that the first time period is longer than the preset time period, the first function is:
Wherein,represents the time required to complete the N tasks to be completed if the first time period is greater than the preset time period,representing the cost to be spent completing the N tasks to be completed if the first time period is greater than the preset time period,is taken from (a)The value range is 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a resource scheduling device 200 according to an embodiment of the present invention, as shown in fig. 2, including the following modules:
the monitoring module 201 is configured to obtain a type of a target task and running state information of a resource node;
a determining module 202, configured to determine a first function according to the target task and the running state information when the type of the target task is a preset type, where the preset type indicates that the target task is any one of a 2 nd to an N th task to be completed among N tasks to be completed, and the N tasks to be completed are sequentially arranged, where N is an integer greater than 1;
An obtaining module 203, configured to calculate the first function according to a target algorithm, so as to obtain a target solution;
and the scheduling module 204 is configured to schedule the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
Optionally, the target algorithm includes at least one of a genetic algorithm and a greedy algorithm.
Optionally, in the case that the target algorithm includes a genetic algorithm and a greedy algorithm, the obtaining module includes:
the first determining submodule is used for determining target resource nodes of a first individual in a resource list according to the greedy algorithm and the type of required resources of the first individual, wherein the first individual is an individual which does not meet preset constraint conditions, and the individual is determined based on the genetic algorithm;
a second determining submodule, configured to determine a first population according to the target resource node of the first individual, where the first population includes the target resource node of the first individual;
the calculation sub-module is used for carrying out iterative calculation on the first population according to the genetic algorithm and recording the iterative times;
and the third determining submodule is used for determining an individual with highest adaptability in the current population as a target solution of the first function under the condition that the iteration number of the first population reaches the preset iteration number, wherein the current population is a population obtained by carrying out iterative calculation on the first population by the preset iteration number.
Optionally, the calculating submodule includes:
a first calculation subunit, configured to calculate fitness of individuals in the first population according to a genetic algorithm;
and the first determining subunit is used for determining a second population according to the genetic algorithm, the fitness of the individuals in the first population and a preset fitness threshold value and performing iterative calculation.
Optionally, the calculating submodule includes:
a second calculating subunit, configured to calculate a sum of fitness of M individuals of the first population and fitness of the M individuals, where M is a positive integer;
a second determining subunit, configured to determine, according to a sum of fitness of a target individual and fitness of the M individuals, a first probability of the target individual, where the target individual is any one of the M individuals, and the first probability is a probability that the target individual is selected into a second population;
and the third determining subunit is used for determining the second population according to the first probability of the target individual, wherein the second population is the population of the first population after one iteration.
Optionally, in the case that the first time period is less than the preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is less than the preset time period, Representing the cost to be spent completing the N tasks to be completed if the first time period is less than the preset time period,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
Optionally, in the case that the first time period is longer than the preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is greater than the preset time period,representing the cost to be spent completing the N tasks to be completed if the first time period is greater than the preset time period,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
The embodiment of the invention also provides electronic equipment. Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. Because the principle of solving the problem of the electronic device is similar to that of the resource scheduling method in the embodiment of the invention, the implementation of the electronic device can refer to the implementation of the method, and the repetition is omitted.
As shown in fig. 3, the electronic device 300 includes: a processor 310 for reading the program in the memory 320, performing the following procedures:
acquiring the type of a target task and the running state information of a resource node;
determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents that the target task is any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, and the N tasks to be completed are sequentially arranged, and N is an integer larger than 1;
calculating the first function according to a target algorithm to obtain a target solution;
and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
Wherein in fig. 3, a bus architecture may comprise any number of interconnected buses and bridges, and in particular one or more processors represented by processor 310 and various circuits of memory represented by memory 320, linked together. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. The bus interface provides an interface. The processor 310 is responsible for managing the bus architecture and general processing, and the memory 320 may store data used by the processor 310 in performing operations.
Optionally, the processor 310 is further configured to read the program in the memory 320, and perform the following steps:
the target algorithm includes at least one of a genetic algorithm and a greedy algorithm.
Optionally, in the case that the target algorithm includes a genetic algorithm and a greedy algorithm, the calculating the first function according to the target algorithm includes:
determining a target resource node of a first individual in a resource list according to the greedy algorithm and the type of the required resource of the first individual, wherein the first individual is an individual which does not meet a preset constraint condition, and the individual is determined based on the genetic algorithm;
Determining a first population according to the target resource node of the first individual, wherein the first population comprises the target resource node of the first individual;
carrying out iterative computation on the first population according to the genetic algorithm and recording the iterative times;
and under the condition that the iteration times of the first population reach the preset iteration times, determining the individual with the highest fitness in the current population as a target solution of the first function, wherein the current population is a population obtained by carrying out iterative computation on the first population by the preset iteration times.
Optionally said iteratively calculating said first population according to said genetic algorithm comprises:
calculating fitness of individuals in the first population according to a genetic algorithm;
and determining a second population according to the genetic algorithm, the fitness of the individuals in the first population and a preset fitness threshold value, and performing iterative calculation.
Optionally, in some embodiments, said iteratively calculating said first population according to said genetic algorithm, said crossover probability and said mutation probability comprises:
calculating the sum of the fitness of M individuals of the first population and the fitness of the M individuals, wherein M is a positive integer;
Determining a first probability of a target individual according to the sum of the fitness of the target individual and the fitness of the M individuals, wherein the target individual is any one of the M individuals, and the first probability is the probability that the target individual is selected into a second population;
and determining the second population according to the first probability of the target individual, wherein the second population is the population of the first population after one iteration.
Optionally, in some embodiments, in a case where the first time period is less than a preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is less than the preset time period,representing the cost to be spent completing the N tasks to be completed if the first time period is less than the preset time period,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
Optionally, in some embodiments, in a case where the first time period is longer than a preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is greater than the preset time period,representing the cost to be spent completing the N tasks to be completed if the first time period is greater than the preset time period,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
The electronic device provided by the embodiment of the present invention may execute the above method embodiment, and its implementation principle and technical effects are similar, and this embodiment will not be described herein.
Furthermore, a computer-readable storage medium of an embodiment of the present invention stores a computer program executable by a processor to implement the steps of:
acquiring the type of a target task and the running state information of a resource node;
Determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents that the target task is any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, and the N tasks to be completed are sequentially arranged, and N is an integer larger than 1;
calculating the first function according to a target algorithm to obtain a target solution;
and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
Optionally, in the case that the target algorithm includes a genetic algorithm and a greedy algorithm, the calculating the first function according to the target algorithm includes:
determining a target resource node of a first individual in a resource list according to the greedy algorithm and the type of the required resource of the first individual, wherein the first individual is an individual which does not meet a preset constraint condition, and the individual is determined based on the genetic algorithm;
determining a first population according to the target resource node of the first individual, wherein the first population comprises the target resource node of the first individual;
Carrying out iterative computation on the first population according to the genetic algorithm and recording the iterative times;
and under the condition that the iteration times of the first population reach the preset iteration times, determining the individual with the highest fitness in the current population as a target solution of the first function, wherein the current population is a population obtained by carrying out iterative computation on the first population by the preset iteration times.
Optionally, the performing iterative computation on the first population according to the genetic algorithm includes:
calculating fitness of individuals in the first population according to a genetic algorithm;
and determining a second population according to the genetic algorithm, the fitness of the individuals in the first population and a preset fitness threshold value, and performing iterative calculation.
Optionally, the performing iterative computation on the first population according to the genetic algorithm, the crossover probability and the mutation probability includes:
calculating the sum of the fitness of M individuals of the first population and the fitness of the M individuals, wherein M is a positive integer;
determining a first probability of a target individual according to the sum of the fitness of the target individual and the fitness of the M individuals, wherein the target individual is any one of the M individuals, and the first probability is the probability that the target individual is selected into a second population;
And determining the second population according to the first probability of the target individual, wherein the second population is the population of the first population after one iteration.
Optionally, in the case that the first time period is less than the preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is less than the preset time period,indicating that the N to-be-completed are completed under the condition that the first time length is smaller than the preset time lengthThe cost to be spent on the task is,the value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first moment of each resource node, the first moment is a moment when the task to be completed before the target task is processed by the resource node, the first duration is a difference value between a second moment and a current moment, and the second moment is the latest moment in the first moments.
Optionally, in the case that the first time period is less than the preset time period, the first function is:
wherein,represents the time required to complete the N tasks to be completed if the first time period is greater than the preset time period,representing the cost to be spent completing the N tasks to be completed if the first time period is greater than the preset time period, The value of (2) is in the range of 0 to 1,has a value ranging from 0 to 1, andthe running state information comprises a first time of each resource node, wherein the first time is the time when the resource node takes the targetThe time when the task to be completed before the task processing is completed is the difference value between the second time and the current time, wherein the second time is the latest time in the first time.
In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may be physically included separately, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform part of the steps of the transceiving method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.

Claims (7)

1. A method for scheduling resources, the method comprising:
the method comprises the steps of obtaining the type of a target task and the running state information of a resource node, wherein the running state information of the resource node comprises the following steps: whether there is a task being executed and a completion time for executing the remaining tasks;
Determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents that the target task is any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, and the N tasks to be completed are sequentially arranged, and N is an integer larger than 1;
calculating the first function according to a target algorithm to obtain a target solution, wherein the target algorithm comprises a genetic algorithm and a greedy algorithm;
in the case that the first time length is less than the preset time length, the first function is:
min(αftime+βfcost);
wherein f time Representing the time required for completing the N tasks to be completed under the condition that the first time length is smaller than the preset time length, f cost The cost required for completing the N tasks to be completed under the condition that the first time length is smaller than the preset time length is represented, the value range of alpha is 0 to 1, the value range of beta is 0 to 1, alpha+beta=1, the running state information comprises first time of each resource node, the first time is the time when the resource node completes the task to be completed before the target task, the first time length is the difference between second time and the current time, and the second time is the latest time in the first time;
Under the condition that the first time length is longer than the preset time length, the first function is as follows:
min(γgtime+δgcost);
wherein g time Representing the time required for completing the N tasks to be completed under the condition that the first time length is longer than the preset time length, g cost The cost required for completing the N tasks to be completed under the condition that the first time length is longer than the preset time length is represented, the value range of gamma is 0 to 1, the value range of delta is 0 to 1, gamma+delta=1, the running state information comprises a first time of each resource node, the first time is the time when the resource node completes the task to be completed before the target task, the first time length is the difference between a second time and the current time, and the second time is the latest time in the first time; and scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
2. The resource scheduling method according to claim 1, wherein, in the case that the target algorithm includes a genetic algorithm and a greedy algorithm, the calculating the first function according to the target algorithm includes:
determining a target resource node of a first individual in a resource list according to the greedy algorithm and the type of the required resource of the first individual, wherein the first individual is an individual which does not meet a preset constraint condition, and the individual is determined based on the genetic algorithm;
Determining a first population according to the target resource node of the first individual, wherein the first population comprises the target resource node of the first individual;
carrying out iterative computation on the first population according to the genetic algorithm and recording the iterative times;
and under the condition that the iteration times of the first population reach the preset iteration times, determining the individual with the highest fitness in the current population as a target solution of the first function, wherein the current population is a population obtained by carrying out iterative computation on the first population by the preset iteration times.
3. The resource scheduling method of claim 2, wherein the iteratively calculating the first population according to the genetic algorithm comprises:
calculating fitness of individuals in the first population according to a genetic algorithm;
and determining a second population according to the genetic algorithm, the fitness of the individuals in the first population and a preset fitness threshold value, and performing iterative calculation.
4. The resource scheduling method of claim 2, wherein iteratively calculating the first population based on the genetic algorithm, cross probability, and variation probability comprises:
calculating the sum of the fitness of M individuals of the first population and the fitness of the M individuals, wherein M is a positive integer;
Determining a first probability of a target individual according to the sum of the fitness of the target individual and the fitness of the M individuals, wherein the target individual is any one of the M individuals, and the first probability is the probability that the target individual is selected into a second population;
and determining the second population according to the first probability of the target individual, wherein the second population is the population of the first population after one iteration.
5. A resource scheduling apparatus, the apparatus comprising:
the monitoring module is used for acquiring the type of the target task and the running state information of the resource node, wherein the running state information of the resource node comprises the following components: whether there is a task being executed and a completion time for executing the remaining tasks;
the determining module is used for determining a first function according to the target task and the running state information under the condition that the type of the target task is a preset type, wherein the preset type represents that the target task is any one of the 2 nd to the N th tasks to be completed in N tasks to be completed, the N tasks to be completed are sequentially arranged, and N is an integer larger than 1;
The obtaining module is used for calculating the first function according to a target algorithm to obtain a target solution, wherein the target algorithm comprises a genetic algorithm and a greedy algorithm;
in the case that the first time length is less than the preset time length, the first function is:
min(αftime+βfcost);
wherein f time Representing the time required for completing the N tasks to be completed under the condition that the first time length is smaller than the preset time length, f cost The cost required for completing the N tasks to be completed under the condition that the first time length is smaller than the preset time length is represented, the value range of alpha is 0 to 1, the value range of beta is 0 to 1, alpha+beta=1, the running state information comprises first time of each resource node, the first time is the time when the resource node completes the task to be completed before the target task, the first time length is the difference between second time and the current time, and the second time is the latest time in the first time;
under the condition that the first time length is longer than the preset time length, the first function is as follows:
min(γgtime+δgcost);
wherein g time Representing the time required for completing the N tasks to be completed under the condition that the first time length is longer than the preset time length, g cost The cost required for completing the N tasks to be completed under the condition that the first time length is longer than the preset time length is represented, the value range of gamma is 0 to 1, the value range of delta is 0 to 1, gamma+delta=1, the running state information comprises a first time of each resource node, the first time is the time when the resource node completes the task to be completed before the target task, the first time length is the difference between a second time and the current time, and the second time is the latest time in the first time;
And the scheduling module is used for scheduling the resource node to process the target task according to a target resource scheduling scheme determined based on the target solution.
6. An electronic device, comprising: a transceiver, a memory, a processor, and a computer program stored on the memory and executable on the processor; -characterized in that the processor is arranged to read a program in a memory for implementing the steps in the method according to any one of claims 1 to 4.
7. A readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps in the method according to any one of claims 1 to 4.
CN202311028063.3A 2023-08-16 2023-08-16 Resource scheduling method and device, electronic equipment and readable storage medium Active CN116755866B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311028063.3A CN116755866B (en) 2023-08-16 2023-08-16 Resource scheduling method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311028063.3A CN116755866B (en) 2023-08-16 2023-08-16 Resource scheduling method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN116755866A CN116755866A (en) 2023-09-15
CN116755866B true CN116755866B (en) 2024-01-26

Family

ID=87951776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311028063.3A Active CN116755866B (en) 2023-08-16 2023-08-16 Resource scheduling method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116755866B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902375A (en) * 2014-04-11 2014-07-02 北京工业大学 Cloud task scheduling method based on improved genetic algorithm
CN107977740A (en) * 2017-11-23 2018-05-01 海南电网有限责任公司 A kind of scene O&M intelligent dispatching method
CN109583709A (en) * 2018-11-09 2019-04-05 同济大学 A kind of automatic parking robot group method for scheduling task
CN112667379A (en) * 2020-12-29 2021-04-16 深圳Tcl新技术有限公司 Task scheduling method and server
CN113411369A (en) * 2020-03-26 2021-09-17 山东管理学院 Cloud service resource collaborative optimization scheduling method, system, medium and equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902375A (en) * 2014-04-11 2014-07-02 北京工业大学 Cloud task scheduling method based on improved genetic algorithm
CN107977740A (en) * 2017-11-23 2018-05-01 海南电网有限责任公司 A kind of scene O&M intelligent dispatching method
CN109583709A (en) * 2018-11-09 2019-04-05 同济大学 A kind of automatic parking robot group method for scheduling task
CN113411369A (en) * 2020-03-26 2021-09-17 山东管理学院 Cloud service resource collaborative optimization scheduling method, system, medium and equipment
CN112667379A (en) * 2020-12-29 2021-04-16 深圳Tcl新技术有限公司 Task scheduling method and server

Also Published As

Publication number Publication date
CN116755866A (en) 2023-09-15

Similar Documents

Publication Publication Date Title
Peng et al. Optimus: an efficient dynamic resource scheduler for deep learning clusters
US10354201B1 (en) Scalable clustering for mixed machine learning data
US8898108B2 (en) System and method for scheduling data storage replication over a network
US7979520B2 (en) Prescriptive architecture recommendations
CN110221915B (en) Node scheduling method and device
CN113377540A (en) Cluster resource scheduling method and device, electronic equipment and storage medium
CN109542352B (en) Method and apparatus for storing data
CN110795246A (en) Resource utilization rate prediction method and device
CN111723947A (en) Method and device for training federated learning model
CN112416585A (en) GPU resource management and intelligent scheduling method for deep learning
WO2022246833A1 (en) System, method, and medium for elastic allocation of resources for deep learning jobs
CN111275358A (en) Dispatch matching method, device, equipment and storage medium
CN111106960B (en) Mapping method and mapping device of virtual network and readable storage medium
CN115586961A (en) AI platform computing resource task scheduling method, device and medium
CN106708875B (en) Feature screening method and system
Entezari-Maleki et al. A genetic-based scheduling algorithm to minimize the makespan of the grid applications
CN112766318B (en) Business task execution method, device and computer readable storage medium
CN113312239A (en) Data detection method, device, electronic equipment and medium
CN116755866B (en) Resource scheduling method and device, electronic equipment and readable storage medium
CN110738508A (en) data analysis method and device
CN112416568A (en) Duration estimation method and duration estimation device for audio and video transcoding task
CN112286623A (en) Information processing method and device and storage medium
US11775344B1 (en) Training task queuing cause analysis method and system, device and medium
CN114581220A (en) Data processing method and device and distributed computing system
CN114676272A (en) Information processing method, device and equipment of multimedia resource and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant