Multi-terminal task allocation method and device, electronic equipment and readable storage medium
1. A task allocation method for multiple terminals is characterized in that the method comprises the following steps:
acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, and determining historical task execution time of the plurality of terminals by using the total task list;
determining the lowest tasks of the plurality of terminals and the total required tasks of the plurality of terminals according to the total task quantity;
determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion;
determining iteration rounds when the total demand tasks are iteratively distributed to the demand terminals and the number of tasks to be distributed corresponding to each iteration round;
determining an allocation sequence allocated to all the demand terminals according to the historical task execution time of the plurality of terminals;
distributing the lowest task to the plurality of terminals, and iteratively distributing the number of tasks to be distributed corresponding to each iteration to the demand terminals according to the distribution sequence.
2. The multi-terminal task allocation method according to claim 1, wherein the iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence comprises:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, determining the ith demand terminal in the distribution sequence as a terminal to be distributed, and distributing the number of tasks to be distributed corresponding to the ith round of iteration to the terminal to be distributed according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
3. The multi-terminal task allocation method according to claim 1, wherein the iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence comprises:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, the number of tasks to be distributed corresponding to the ith round of iteration is evenly distributed to all the demand terminals according to the distribution sequence;
if the number of the tasks to be distributed corresponding to the ith iteration is remained after the distribution, sequentially distributing the number of the tasks to be distributed corresponding to the remained ith iteration to the demand terminal according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
4. The multi-terminal task allocation method according to claim 1, wherein the determining an iteration turn when the total required task is iteratively allocated to the required terminal and the number of tasks to be allocated corresponding to each iteration turn comprises:
determining that the minimum distribution quantity of the total demand tasks is equal to the quantity of the minimum tasks;
determining the average distribution task number of each demand terminal according to the number of the demand terminals and the minimum distribution number;
performing arithmetic operation on the average distribution task quantity and the minimum distribution quantity to obtain the initial maximum distribution quantity of the total demand tasks;
determining the initial highest allocation quantity as the quantity of tasks to be allocated corresponding to the first iteration;
and sequentially decreasing the initial highest distribution quantity by the task quantity of the preset interval quantity, determining the iteration turn of iterative distribution by adding one to the decreasing times until the distribution quantity obtained by decreasing is equal to the lowest distribution quantity, and obtaining the distribution quantity after each decreasing as the task quantity to be distributed corresponding to each turn of iteration except the first turn of iteration.
5. The multi-terminal task allocation method according to claim 1, wherein the determining an allocation order to all the demanding terminals according to the historical task execution times of the plurality of terminals comprises:
acquiring a work list of the plurality of terminals, inquiring the total number of tasks completed and the time spent by all the demand terminals based on the work list, and determining the historical task execution time of each demand terminal;
and sequencing all the demand terminals according to the sequence of the historical task execution time from long to short, and determining the sequence as an allocation sequence allocated to all the demand terminals.
6. The method for multi-terminal task allocation according to claim 1, wherein the determining the lowest task of the plurality of terminals and the total required task of the plurality of terminals according to the total task amount comprises:
selecting a preset task quantity from the total task quantity as a total lowest plan completion task according to the total number of the plurality of terminals;
subtracting the total lowest plan completion task from the total task amount to obtain a total demand task of the plurality of terminals;
and dividing the total lowest plan by the total number of the plurality of terminals to obtain the lowest tasks of the plurality of terminals.
7. The method for task allocation of multiple terminals according to any of claims 1 to 6, wherein the obtaining of the total task list of the multiple terminals and the total task volume to be allocated to the multiple terminals comprises:
acquiring the total task list, wherein the total task list comprises task names and task completion progress;
determining the total historical task completion number in a historical time period according to the task name and the task completion progress;
and determining the total task amount to be distributed to the plurality of terminals according to the historical task completion total number.
8. A task assigning apparatus for a multi-terminal, comprising:
the system comprises a total task dividing module, a task scheduling module and a task scheduling module, wherein the total task dividing module is used for acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, determining historical task execution time of the plurality of terminals by using the total task list, and determining a lowest task of the plurality of terminals and a total required task of the plurality of terminals according to the total task amount;
the demand task dividing module is used for determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion, determining iteration rounds when the total demand tasks are distributed to the demand terminals in an iteration mode and the number of tasks to be distributed corresponding to each iteration, and determining a distribution sequence distributed to all the demand terminals according to historical task execution time of the terminals;
and the multi-terminal task allocation module is used for allocating the lowest task to the plurality of terminals and iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of task allocation for a multi-terminal according to any of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method for task allocation of a multi-terminal according to any one of claims 1 to 7.
Background
The application scenarios of multi-terminal task allocation in the internet field are very wide, and in the process of multi-terminal task allocation, resources are reasonably allocated, so that the task completion progress and the completion quality are greatly influenced.
At present, task allocation is generally carried out in an average manner, the processing capacity of a terminal and the working load of the terminal are neglected, the task completion is often over-term, and the task processing efficiency is low.
Disclosure of Invention
The invention provides a multi-terminal task allocation method and device, electronic equipment and a computer readable storage medium, and mainly aims to improve task processing efficiency.
In order to achieve the above object, a task allocation method for multiple terminals provided by the present invention includes:
acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, and determining historical task execution time of the plurality of terminals by using the total task list;
determining the lowest tasks of the plurality of terminals and the total required tasks of the plurality of terminals according to the total task quantity;
determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion;
determining iteration rounds when the total demand tasks are iteratively distributed to the demand terminals and the number of tasks to be distributed corresponding to each iteration round;
determining an allocation sequence allocated to all the demand terminals according to the historical task execution time of the plurality of terminals;
distributing the lowest task to the plurality of terminals, and iteratively distributing the number of tasks to be distributed corresponding to each iteration to the demand terminals according to the distribution sequence.
Optionally, the iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence includes:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, determining the ith demand terminal in the distribution sequence as a terminal to be distributed, and distributing the number of tasks to be distributed corresponding to the ith round of iteration to the terminal to be distributed according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
Optionally, the iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence includes:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, the number of tasks to be distributed corresponding to the ith round of iteration is evenly distributed to all the demand terminals according to the distribution sequence;
if the number of the tasks to be distributed corresponding to the ith iteration is remained after the distribution, sequentially distributing the number of the tasks to be distributed corresponding to the remained ith iteration to the demand terminal according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
Optionally, the determining an iteration turn when the total demand task is iteratively allocated to the demand terminal and the number of tasks to be allocated corresponding to each iteration turn includes:
determining that the minimum distribution quantity of the total demand tasks is equal to the quantity of the minimum tasks;
determining the average distribution task number of each demand terminal according to the number of the demand terminals and the minimum distribution number;
performing arithmetic operation on the average distribution task quantity and the minimum distribution quantity to obtain the initial maximum distribution quantity of the total demand tasks;
determining the initial highest allocation quantity as the quantity of tasks to be allocated corresponding to the first iteration;
and sequentially decreasing the initial highest distribution quantity by the task quantity of the preset interval quantity, determining the iteration turn of iterative distribution by adding one to the decreasing times until the distribution quantity obtained by decreasing is equal to the lowest distribution quantity, and obtaining the distribution quantity after each decreasing as the task quantity to be distributed corresponding to each turn of iteration except the first turn of iteration.
Optionally, the determining, according to the historical task execution times of the multiple terminals, an allocation sequence allocated to all the demand terminals includes:
acquiring a work list of the plurality of terminals, inquiring the total number of tasks completed and the time spent by all the demand terminals based on the work list, and determining the historical task execution time of each demand terminal;
and sequencing all the demand terminals according to the sequence of the historical task execution time from long to short, and determining the sequence as an allocation sequence allocated to all the demand terminals.
Optionally, the determining the lowest task of the plurality of terminals and the total required task of the plurality of terminals according to the total task amount includes:
selecting a preset task quantity from the total task quantity as a total lowest plan completion task according to the total number of the plurality of terminals;
subtracting the total lowest plan completion task from the total task amount to obtain a total demand task of the plurality of terminals;
and dividing the total lowest plan by the total number of the plurality of terminals to obtain the lowest tasks of the plurality of terminals.
Optionally, the obtaining a total task list of the plurality of terminals and a total task amount to be allocated to the plurality of terminals includes:
acquiring the total task list, wherein the total task list comprises task names and task completion progress;
determining the total historical task completion number in a historical time period according to the task name and the task completion progress;
and determining the total task amount to be distributed to the plurality of terminals according to the historical task completion total number.
In order to solve the above problem, the present invention further provides a multi-terminal task allocation apparatus, including:
the system comprises a total task dividing module, a task scheduling module and a task scheduling module, wherein the total task dividing module is used for acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, determining historical task execution time of the plurality of terminals by using the total task list, and determining a lowest task of the plurality of terminals and a total required task of the plurality of terminals according to the total task amount;
the demand task dividing module is used for determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion, determining iteration rounds when the total demand tasks are distributed to the demand terminals in an iteration mode and the number of tasks to be distributed corresponding to each iteration, and determining a distribution sequence distributed to all the demand terminals according to historical task execution time of the terminals;
and the multi-terminal task allocation module is used for allocating the lowest task to the plurality of terminals and iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one computer program; and
and a processor for executing the computer program stored in the memory to realize the multi-terminal task allocation method.
In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored, the at least one computer program being executed by a processor in an electronic device to implement the multi-terminal task allocation method described above.
The embodiment of the invention determines the lowest tasks and the total demand tasks of all the terminals in the distribution process, distributes the lowest tasks to all the terminals, and distributes the total demand tasks to the demand terminals in an iterative manner, thereby realizing the distribution according to the terminal difference during the task distribution, ensuring more reasonable task distribution, avoiding the problem of too much or too little task distribution, and ensuring that the tasks can be executed by the terminals as soon as possible after the task distribution, thereby improving the task processing efficiency. Therefore, the task allocation method, the task allocation device, the electronic device and the readable storage medium for multiple terminals provided by the embodiment of the invention can achieve the purpose of improving the task processing efficiency.
Drawings
Fig. 1 is a schematic flowchart of a task allocation method for multiple terminals according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of a task allocation apparatus for multiple terminals according to an embodiment of the present invention;
fig. 3 is a schematic internal structural diagram of an electronic device implementing a multi-terminal task allocation method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention provides a task allocation method of multiple terminals. The execution subject of the multi-terminal task allocation method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiments of the present application. In other words, the task allocation method of the multi-terminal may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, which is a schematic flow chart of a multi-terminal task allocation method according to an embodiment of the present invention, in an embodiment of the present invention, the multi-terminal task allocation method includes:
s1, acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, and determining historical task execution time of the plurality of terminals by using the total task list.
In this embodiment, the plurality of terminals are terminals to which tasks are to be allocated. The terminals may be the same or different electronic devices, for example, the terminals are all computers, or some terminals are computers and some terminals are servers.
In this embodiment, the total task list, the total task amount, and the historical task execution time may be stored locally, for example, in a storage space of a local processing unit. The processing unit refers to a unit that can perform a series of operations on an instruction, for example, a fetch instruction, an analysis instruction, and an execute instruction.
The total task list contains the names of all tasks that have been executed and are scheduled to be executed during at least two preset time periods (both during the historical time period and during the current time period, e.g., the quarter and the quarter above), and the total number of tasks and the progress of completion of those tasks.
For example, the total task list contains 200 scheduled tasks from the last quarter to this quarter, some of which have been completed, some of which are in progress, and some of which have not yet begun execution.
In this embodiment, the total task amount is the number of all tasks scheduled to be allocated to the plurality of terminals and completed by the plurality of terminals in the current time period, for example, the current time period.
For example, the total task volume is all the tasks planned to be distributed to the plurality of terminals in this quarter, and specifically, the total task volume is 100 tasks planned to be executed.
In this embodiment, the historical task execution time of the terminal may be time taken by the terminal to complete all tasks in a self work list in a historical time period, where the self work list may be the number of all tasks scheduled to be executed by each terminal in the historical time period and the time taken by each terminal, and includes specific time taken by the completed tasks and specific time taken by the uncompleted tasks in the future.
In detail, the acquiring a total task list of a plurality of terminals and a total task amount to be allocated to the plurality of terminals includes:
acquiring the total task list, wherein the total task list comprises task names and task completion progress;
determining the total historical task completion number in a historical time period according to the task name and the task completion progress;
and determining the total task amount to be distributed to the plurality of terminals according to the historical task completion total number.
In this embodiment, the total number of completed historical tasks in the historical time period is the number of tasks completed by the plurality of terminals together.
For example, if the total number of completed tasks in the previous quarter does not meet the standard, the total number of tasks to be completed in the next quarter is increased; and if the total number of the task completion in the previous quarter exceeds the standard, reducing the total task quantity required to be completed in the next quarter.
In this embodiment, optionally, the total task list may further include a name of the terminal.
Further, the determining the historical task execution time of the plurality of terminals by using the total task list includes:
acquiring a working list of the plurality of terminals;
and acquiring the time spent by the plurality of terminals for completing all tasks in the self work list according to the work lists of the plurality of terminals, and determining the historical task execution time of all the terminals according to the self work list of each terminal.
In this embodiment, the work list of the terminal refers to a list related to a task executed by the terminal. The work list of the terminal may include the number of all tasks and the time spent by all the tasks that the terminal plans to execute, and specifically, the work list of the terminal includes the specific time spent by the completed tasks and the specific time spent by the uncompleted tasks in the future.
In this embodiment, the historical task execution time of the terminal may be determined according to the number of all tasks and the time spent by each terminal planning to execute in the self work list of each terminal, including the specific time spent by the completed task and the specific time spent by the uncompleted task in the future.
And S2, determining the lowest task of the plurality of terminals and the total required task of the plurality of terminals according to the total task amount.
In this embodiment, the total required tasks refer to the number of tasks remaining after the total lowest planned completion task is deducted from the total task amount.
In detail, determining the lowest task of the plurality of terminals and the total required task of the plurality of terminals according to the total task amount includes:
selecting a preset task quantity from the total task quantity as a total lowest plan completion task according to the total number of the plurality of terminals;
subtracting the total lowest plan completion task from the total task amount to obtain a total demand task of the plurality of terminals;
and dividing the total lowest plan by the total number of the plurality of terminals to obtain the lowest tasks of the plurality of terminals.
In this embodiment, the preset task number may be a preset value, and specifically, the preset task number is 40% to 60% of the total task amount.
In this embodiment, the lowest task is to equally divide the total lowest planned completion task number according to the total number of terminals to obtain the lowest number that each terminal needs to complete.
For example, if the total task amount is 100, the total number of the terminals is 10, and if the proportion of the total lowest planned completed tasks to the total task amount is 40%, the total lowest planned completed tasks is 40; the lowest task of each terminal is calculated as a task quota obtained by equally dividing 40 tasks of the total lowest planned completed tasks to 10 terminals, namely the lowest task allocated by each terminal is 4; by deducting 40 total lowest planned completed tasks from the total task volume 100, a total required tasks of 60 can be obtained.
And S3, determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion.
In this embodiment, the number of the demand terminals is the number of terminals to which the total demand task needs to be allocated, and the preset allocation proportion is preset. For example, if the preset allocation ratio is 80%, the number of terminals required is 80% of the total number of terminals.
For example, if the proportion of the number of the demand terminals to the total number of the terminals (for example, the total number is 10) is 80%, the number of the demand terminals is 8.
And S4, determining iteration rounds when the total demand tasks are iteratively distributed to the demand terminal and the number of tasks to be distributed corresponding to each iteration round.
In detail, the determining iteration rounds and the number of tasks to be allocated corresponding to each iteration when performing iterative allocation on the total required tasks includes:
determining that the minimum distribution quantity of the total demand tasks is equal to the quantity of the minimum tasks;
determining the average distribution task number of each demand terminal according to the number of the demand terminals and the minimum distribution number;
performing arithmetic operation on the average distribution task quantity and the minimum distribution quantity to obtain the initial maximum distribution quantity of the total demand tasks;
determining the initial highest allocation quantity as the quantity of tasks to be allocated corresponding to the first iteration;
and sequentially decreasing the initial highest distribution quantity by the task quantity of the preset interval quantity, determining the iteration turn of iterative distribution by adding one to the decreasing times until the distribution quantity obtained by decreasing is equal to the lowest distribution quantity, and obtaining the distribution quantity after each decreasing as the task quantity to be distributed corresponding to each turn of iteration except the first turn of iteration.
In this embodiment, the minimum distribution number of the total demand tasks is the minimum task number of the total demand tasks distributed to the demand terminal, and is equal to the minimum task number.
The average distribution task number is the task number distributed to all the demand terminals by the total demand tasks, and can be obtained by quoting the total demand tasks/the demand terminal number, or can be obtained by (the highest distribution number + the lowest distribution number)/2.
The initial highest allocation number is the highest task number of allocating the total demand tasks to the demand terminals for the first time, and may be obtained by multiplying the average allocation number by 2, and the highest allocation number may be a non-fixed value.
In this embodiment, the minimum allocation number is the number of allocation tasks in the last round.
For example, if the minimum allocation number is equal to the minimum task (e.g., 4 tasks), the average allocation task number is 60/8, that is, 7.5 tasks, and the initial maximum allocation number is 2 — 7.5 — 2-4, that is, 11 tasks.
Distributing the initial highest distribution quantity according to the task quantity which is sequentially decreased by a preset interval quantity (if the task quantity is one task), stopping distribution until the highest distribution quantity is equal to the lowest distribution quantity, sequentially decreasing 11 by 1, and obtaining 8 iteration rounds of iterative distribution when the decreased value is equal to the lowest distribution quantity 4; and the number of tasks to be distributed corresponding to each iteration distributed to all the demand terminals is respectively 11, 10, 9, 8, 7, 6, 5 and 4 tasks.
And S5, determining the distribution sequence distributed to all the demand terminals according to the historical task execution time of the plurality of terminals.
In detail, the determining an allocation sequence allocated to all the demand terminals according to the historical task execution times of the plurality of terminals includes:
acquiring a work list of the plurality of terminals, inquiring the total number of tasks completed and the time spent by all the demand terminals based on the work list, and determining the historical task execution time of each demand terminal;
and sequencing all the demand terminals according to the sequence of the historical task execution time from long to short, and determining the sequence as an allocation sequence allocated to all the demand terminals.
Specifically, in this embodiment, if the number of the demand terminals is 8, the 8 demand terminals are sorted according to the sequence of the historical task execution times from long to short, and the terminal with the longest historical task execution time is terminal a, terminal B, and so on, C, D, E, F, G and terminal H are obtained, that is, the distribution sequence of the demand terminals is A, B, C, D, E, F, G and H.
And S6, distributing the lowest task to the plurality of terminals, and distributing the number of tasks to be distributed corresponding to each iteration to the demand terminals in an iteration mode according to the distribution sequence.
In detail, the iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence includes:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, determining the ith demand terminal in the distribution sequence as a terminal to be distributed, and distributing the number of tasks to be distributed corresponding to the ith round of iteration to the terminal to be distributed according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
Specifically, in this embodiment, the number of tasks to be allocated corresponding to each iteration of all the demand terminals is 11, 10, 9, 8, 7, 6, 5, and 4 tasks, respectively; and all the demand terminals are sorted from long to short according to the historical task execution time, and the distribution sequence of the demand terminals can be A, B, C, D, E, F, G and H. The number of tasks to be distributed corresponding to the first iteration is 11, the number of tasks to be distributed corresponding to the second iteration is 10, the number of tasks to be distributed corresponding to the second iteration is 7, the number of tasks distributed by the terminal C is 9, the number of tasks distributed by the terminal D is 8, the number of tasks distributed by the terminal E is 7, the number of tasks distributed by the terminal F is 6, the number of tasks distributed by the terminal G is 5, and the number of tasks distributed by the terminal H is 4.
In another optional embodiment, the iteratively allocating the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence includes:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, the number of tasks to be distributed corresponding to the ith round of iteration is evenly distributed to all the demand terminals according to the distribution sequence;
if the number of the tasks to be distributed corresponding to the ith iteration is remained after the distribution, sequentially distributing the number of the tasks to be distributed corresponding to the remained ith iteration to the demand terminal according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
Specifically, in this embodiment, the number of tasks to be allocated corresponding to each iteration of all the demand terminals is 11, 10, 9, 8, 7, 6, 5, and 4 tasks, respectively, all the demand terminals are sorted according to the historical task execution time from long to short, and the allocation sequence allocated to the demand terminals can be A, B, C, D, E, F, G and H. Equally distributing one task to A, B, C, D, E, F, G and H terminals for 11 tasks to be distributed corresponding to the first iteration, wherein at the moment, 3 tasks remain, and distributing the 3 tasks to A, B and C terminals in sequence; allocating the number of the tasks to be allocated corresponding to the second iteration to A, B, C, D, E, F, G and 2 remaining tasks of the H terminal for 10, and then allocating the two tasks to the A and B terminals; in the same way, the number of tasks to be distributed corresponding to the third iteration is 9, and the tasks are distributed to A, B, C, D, E, F, G, the H terminal and the A terminal; allocating the number of tasks to be allocated corresponding to the fourth iteration to A, B, C, D, E, F, G and an H terminal for 8; allocating the number of tasks to be allocated corresponding to the fifth iteration to A, B, C, D, E, F and a G terminal for 7; allocating the number of tasks to be allocated corresponding to the sixth iteration to A, B, C, D, E and the F terminal for 6; allocating the number of tasks to be allocated corresponding to the seventh iteration to A, B, C, D and E terminals for 5; and allocating the number of tasks to be allocated corresponding to the last iteration to A, B, C and the terminal D as 4. The tasks finally allocated to the terminal a are 11, the terminal B is 10, the terminal C is 9, the terminal D is 8, the terminal E is 7, the terminal F is 6, the terminal G is 5, and the terminal H is 4.
The embodiment of the invention determines the lowest tasks and the total demand tasks of all the terminals in the distribution process, distributes the lowest tasks to all the terminals, and distributes the total demand tasks to the demand terminals in an iterative manner, thereby realizing the distribution according to the terminal difference during the task distribution, ensuring more reasonable task distribution, avoiding the problem of too much or too little task distribution, and ensuring that the tasks can be executed by the terminals as soon as possible after the task distribution, thereby improving the task processing efficiency. Therefore, the task allocation method of the multi-terminal provided by the embodiment of the invention can achieve the purpose of improving the task processing efficiency.
As shown in fig. 2, the present invention is a functional block diagram of a task assigning apparatus for a multi-terminal.
The multi-terminal task assigning apparatus 100 of the invention can be installed in an electronic device. According to the implemented functions, the multi-terminal task allocation device may include a general task dividing module 101, a demand task dividing module 102, and a multi-terminal task allocating module 103, which may also be referred to as a unit, and refers to a series of computer program segments that can be executed by a processor of an electronic device and can perform fixed functions, and are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the total task dividing module 101 is configured to obtain a total task list of a plurality of terminals and a total task amount to be allocated to the plurality of terminals, determine historical task execution times of the plurality of terminals by using the total task list, and determine a lowest task of the plurality of terminals and a total required task of the plurality of terminals according to the total task amount.
In this embodiment, the plurality of terminals are terminals to which tasks are to be allocated. The terminals may be the same or different electronic devices, for example, the terminals are all computers, or some terminals are computers and some terminals are servers.
In this embodiment, the total task list, the total task amount, and the historical task execution time may be stored locally, for example, in a storage space of a local processing unit. The processing unit refers to a unit that can perform a series of operations on an instruction, for example, a fetch instruction, an analysis instruction, and an execute instruction.
The total task list contains the names of all tasks that have been executed and are scheduled to be executed during at least two preset time periods (both during the historical time period and during the current time period, e.g., the quarter and the quarter above), and the total number of tasks and the progress of completion of those tasks.
For example, the total task list contains 200 scheduled tasks from the last quarter to this quarter, some of which have been completed, some of which are in progress, and some of which have not yet begun execution.
In this embodiment, the total task amount is the number of all tasks scheduled to be allocated to the plurality of terminals and completed by the plurality of terminals in the current time period, for example, the current time period.
For example, the total task volume is all the tasks planned to be distributed to the plurality of terminals in this quarter, and specifically, the total task volume is 100 tasks planned to be executed.
In this embodiment, the historical task execution time of the terminal may be time taken by the terminal to complete all tasks in a self work list in a historical time period, where the self work list may be the number of all tasks scheduled to be executed by each terminal in the historical time period and the time taken by each terminal, and includes specific time taken by the completed tasks and specific time taken by the uncompleted tasks in the future.
Specifically, the total task dividing module 101 obtains a total task list of a plurality of terminals and a total task amount to be allocated to the plurality of terminals by performing the following operations, including:
acquiring the total task list, wherein the total task list comprises task names and task completion progress;
determining the total historical task completion number in a historical time period according to the task name and the task completion progress;
and determining the total task amount to be distributed to the plurality of terminals according to the historical task completion total number.
In this embodiment, the total number of completed historical tasks in the historical time period is the number of tasks completed by the plurality of terminals together.
For example, if the total number of completed tasks in the previous quarter does not meet the standard, the total number of tasks to be completed in the next quarter is increased; and if the total number of the task completion in the previous quarter exceeds the standard, reducing the total task quantity required to be completed in the next quarter.
In this embodiment, optionally, the total task list may further include a name of the terminal.
Further, the determining the historical task execution time of the plurality of terminals by using the total task list includes:
acquiring a working list of the plurality of terminals;
and acquiring the time spent by the plurality of terminals for completing all tasks in the self work list according to the work lists of the plurality of terminals, and determining the historical task execution time of all the terminals according to the self work list of each terminal.
In this embodiment, the work list of the terminal refers to a list related to a task executed by the terminal. The work list of the terminal may include the number of all tasks and the time spent by all the tasks that the terminal plans to execute, and specifically, the work list of the terminal includes the specific time spent by the completed tasks and the specific time spent by the uncompleted tasks in the future.
In this embodiment, the historical task execution time of the terminal may be determined according to the number of all tasks and the time spent by each terminal planning to execute in the self work list of each terminal, including the specific time spent by the completed task and the specific time spent by the uncompleted task in the future. In this embodiment, the total required tasks refer to the number of tasks remaining after the total lowest planned completion task is deducted from the total task amount.
In detail, the total task dividing module 101 determines the lowest task of the plurality of terminals and the total required task of the plurality of terminals according to the total task amount by performing the following operations, including:
selecting a preset task quantity from the total task quantity as a total lowest plan completion task according to the total number of the plurality of terminals;
subtracting the total lowest plan completion task from the total task amount to obtain a total demand task of the plurality of terminals;
and dividing the total lowest plan by the total number of the plurality of terminals to obtain the lowest tasks of the plurality of terminals.
In this embodiment, the preset task number may be a preset value, and specifically, the preset task number is 40% to 60% of the total task amount.
In this embodiment, the lowest task is to equally divide the total lowest planned completion task number according to the total number of terminals to obtain the lowest number that each terminal needs to complete.
For example, if the total task amount is 100, the total number of the terminals is 10, and if the proportion of the total lowest planned completed tasks to the total task amount is 40%, the total lowest planned completed tasks is 40; the lowest task of each terminal is calculated as a task quota obtained by equally dividing 40 tasks of the total lowest planned completed tasks to 10 terminals, namely the lowest task allocated by each terminal is 4; by deducting 40 total lowest planned completed tasks from the total task volume 100, a total required tasks of 60 can be obtained.
The demand task dividing module 102 is configured to determine, according to the total number of the terminals and a preset allocation proportion, the number of demand terminals to allocate the total demand task, determine an iteration round when the total demand task is allocated to the demand terminals in an iterative manner and the number of tasks to be allocated corresponding to each iteration round, and determine, according to historical task execution times of the plurality of terminals, an allocation sequence to be allocated to all the demand terminals.
In this embodiment, the number of the demand terminals is the number of terminals to which the total demand task needs to be allocated, and the preset allocation proportion is preset. For example, if the preset allocation ratio is 80%, the number of terminals required is 80% of the total number of terminals.
For example, if the proportion of the number of the demand terminals to the total number of the terminals (for example, the total number is 10) is 80%, the number of the demand terminals is 8.
In detail, the demand task dividing module 102 determines an iteration turn and a number of tasks to be allocated corresponding to each iteration turn when performing iterative allocation on a total demand task by performing the following operations, including:
determining that the minimum distribution quantity of the total demand tasks is equal to the quantity of the minimum tasks;
determining the average distribution task number of each demand terminal according to the number of the demand terminals and the minimum distribution number;
performing arithmetic operation on the average distribution task quantity and the minimum distribution quantity to obtain the initial maximum distribution quantity of the total demand tasks;
determining the initial highest allocation quantity as the quantity of tasks to be allocated corresponding to the first iteration;
and sequentially decreasing the initial highest distribution quantity by the task quantity of the preset interval quantity, determining the iteration turn of iterative distribution by adding one to the decreasing times until the distribution quantity obtained by decreasing is equal to the lowest distribution quantity, and obtaining the distribution quantity after each decreasing as the task quantity to be distributed corresponding to each turn of iteration except the first turn of iteration.
In this embodiment, the minimum distribution number of the total demand tasks is the minimum task number of the total demand tasks distributed to the demand terminal, and is equal to the minimum task number.
The average distribution task number is the task number distributed to all the demand terminals by the total demand tasks, and can be obtained by quoting the total demand tasks/the demand terminal number, or can be obtained by (the highest distribution number + the lowest distribution number)/2.
The initial highest allocation number is the highest task number of allocating the total demand tasks to the demand terminals for the first time, and may be obtained by multiplying the average allocation number by 2, and the highest allocation number may be a non-fixed value.
In this embodiment, the minimum allocation number is the number of allocation tasks in the last round.
For example, if the minimum allocation number is equal to the minimum task (e.g., 4 tasks), the average allocation task number is 60/8, that is, 7.5 tasks, and the initial maximum allocation number is 2 — 7.5 — 2-4, that is, 11 tasks.
Distributing the initial highest distribution quantity according to the task quantity which is sequentially decreased by a preset interval quantity (if the task quantity is one task), stopping distribution until the highest distribution quantity is equal to the lowest distribution quantity, sequentially decreasing 11 by 1, and obtaining 8 iteration rounds of iterative distribution when the decreased value is equal to the lowest distribution quantity 4; and the number of tasks to be distributed corresponding to each iteration distributed to all the demand terminals is respectively 11, 10, 9, 8, 7, 6, 5 and 4 tasks.
In detail, the demand task dividing module 102 determines an allocation order allocated to all the demand terminals according to the historical task execution times of the plurality of terminals by performing the following operations, including:
acquiring a work list of the plurality of terminals, inquiring the total number of tasks completed and the time spent by all the demand terminals based on the work list, and determining the historical task execution time of each demand terminal;
and sequencing all the demand terminals according to the sequence of the historical task execution time from long to short, and determining the sequence as an allocation sequence allocated to all the demand terminals.
Specifically, in this embodiment, if the number of the demand terminals is 8, the 8 demand terminals are sorted according to the sequence of the historical task execution times from long to short, and the terminal with the longest historical task execution time is terminal a, terminal B, and so on, C, D, E, F, G and terminal H are obtained, that is, the distribution sequence of the demand terminals is A, B, C, D, E, F, G and H.
The multi-terminal task allocation module 103 is configured to allocate the lowest task to the multiple terminals, and iteratively allocate the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence.
In detail, the multi-terminal task allocation module 103 iteratively allocates the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence by performing the following operations, including:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, determining the ith demand terminal in the distribution sequence as a terminal to be distributed, and distributing the number of tasks to be distributed corresponding to the ith round of iteration to the terminal to be distributed according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
Specifically, in this embodiment, the number of tasks to be allocated corresponding to each iteration of all the demand terminals is 11, 10, 9, 8, 7, 6, 5, and 4 tasks, respectively; and all the demand terminals are sorted from long to short according to the historical task execution time, and the distribution sequence of the demand terminals can be A, B, C, D, E, F, G and H. The number of tasks to be distributed corresponding to the first iteration is 11, the number of tasks to be distributed corresponding to the second iteration is 10, the number of tasks to be distributed corresponding to the second iteration is 7, the number of tasks distributed by the terminal C is 9, the number of tasks distributed by the terminal D is 8, the number of tasks distributed by the terminal E is 7, the number of tasks distributed by the terminal F is 6, the number of tasks distributed by the terminal G is 5, and the number of tasks distributed by the terminal H is 4.
In another optional embodiment, the multi-terminal task allocation module 103 iteratively allocates the number of tasks to be allocated corresponding to each iteration to the demand terminal according to the allocation sequence by performing the following operations, including:
when the ith round of iterative allocation is executed, judging whether the value of i reaches the iterative round, wherein the initial value of i is 1;
when the value of the i does not reach the iteration round, the number of tasks to be distributed corresponding to the ith round of iteration is evenly distributed to all the demand terminals according to the distribution sequence;
if the number of the tasks to be distributed corresponding to the ith iteration is remained after the distribution, sequentially distributing the number of the tasks to be distributed corresponding to the remained ith iteration to the demand terminal according to the distribution sequence;
and increasing the value of i by 1, and executing the operation of judging whether the value of i reaches the iteration round again until the value of i is greater than the iteration round, and stopping iterative distribution.
Specifically, in this embodiment, the number of tasks to be allocated corresponding to each iteration of all the demand terminals is 11, 10, 9, 8, 7, 6, 5, and 4 tasks, respectively, all the demand terminals are sorted according to the historical task execution time from long to short, and the allocation sequence allocated to the demand terminals can be A, B, C, D, E, F, G and H. Equally distributing one task to A, B, C, D, E, F, G and H terminals for 11 tasks to be distributed corresponding to the first iteration, wherein at the moment, 3 tasks remain, and distributing the 3 tasks to A, B and C terminals in sequence; allocating the number of the tasks to be allocated corresponding to the second iteration to A, B, C, D, E, F, G and 2 remaining tasks of the H terminal for 10, and then allocating the two tasks to the A and B terminals; in the same way, the number of tasks to be distributed corresponding to the third iteration is 9, and the tasks are distributed to A, B, C, D, E, F, G, the H terminal and the A terminal; allocating the number of tasks to be allocated corresponding to the fourth iteration to A, B, C, D, E, F, G and an H terminal for 8; allocating the number of tasks to be allocated corresponding to the fifth iteration to A, B, C, D, E, F and a G terminal for 7; allocating the number of tasks to be allocated corresponding to the sixth iteration to A, B, C, D, E and the F terminal for 6; allocating the number of tasks to be allocated corresponding to the seventh iteration to A, B, C, D and E terminals for 5; and allocating the number of tasks to be allocated corresponding to the last iteration to A, B, C and the terminal D as 4. The tasks finally allocated to the terminal a are 11, the terminal B is 10, the terminal C is 9, the terminal D is 8, the terminal E is 7, the terminal F is 6, the terminal G is 5, and the terminal H is 4.
The embodiment of the invention determines the lowest tasks and the total demand tasks of all the terminals in the distribution process, distributes the lowest tasks to all the terminals, and distributes the total demand tasks to the demand terminals in an iterative manner, thereby realizing the distribution according to the terminal difference during the task distribution, ensuring more reasonable task distribution, avoiding the problem of too much or too little task distribution, and ensuring that the tasks can be executed by the terminals as soon as possible after the task distribution, thereby improving the task processing efficiency. Therefore, the task allocation device with multiple terminals provided by the embodiment of the invention can achieve the purpose of improving the task processing efficiency.
Fig. 3 is a schematic structural diagram of an electronic device implementing a multi-terminal task allocation method according to the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a multi-terminal task allocation program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a task assigning program of a multi-terminal, but also to temporarily store data that has been output or will be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., a multi-terminal task allocation program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The communication bus 12 may be a PerIPheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
Fig. 3 shows only an electronic device having components, and those skilled in the art will appreciate that the structure shown in fig. 3 does not constitute a limitation of the electronic device, and may include fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Optionally, the communication interface 13 may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further include a user interface, which may be a Display (Display), an input unit (such as a Keyboard (Keyboard)), and optionally, a standard wired interface, or a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The multi-terminal task allocation program stored in the memory 11 of the electronic device is a combination of a plurality of computer programs, and when running in the processor 10, can realize:
acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, and determining historical task execution time of the plurality of terminals by using the total task list;
determining the lowest tasks of the plurality of terminals and the total required tasks of the plurality of terminals according to the total task quantity;
determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion;
determining iteration rounds when the total demand tasks are iteratively distributed to the demand terminals and the number of tasks to be distributed corresponding to each iteration round;
determining an allocation sequence allocated to all the demand terminals according to the historical task execution time of the plurality of terminals;
distributing the lowest task to the plurality of terminals, and iteratively distributing the number of tasks to be distributed corresponding to each iteration to the demand terminals according to the distribution sequence.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
Further, the electronic device integrated module/unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. The computer readable medium may be non-volatile or volatile. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
acquiring a total task list of a plurality of terminals and a total task amount to be distributed to the plurality of terminals, and determining historical task execution time of the plurality of terminals by using the total task list;
determining the lowest tasks of the plurality of terminals and the total required tasks of the plurality of terminals according to the total task quantity;
determining the number of demand terminals for distributing the total demand tasks according to the total number of the terminals and a preset distribution proportion;
determining iteration rounds when the total demand tasks are iteratively distributed to the demand terminals and the number of tasks to be distributed corresponding to each iteration round;
determining an allocation sequence allocated to all the demand terminals according to the historical task execution time of the plurality of terminals;
distributing the lowest task to the plurality of terminals, and iteratively distributing the number of tasks to be distributed corresponding to each iteration to the demand terminals according to the distribution sequence.
Further, the computer usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.