CN115729714A - Resource allocation method, device, storage medium and electronic equipment - Google Patents

Resource allocation method, device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115729714A
CN115729714A CN202310019276.3A CN202310019276A CN115729714A CN 115729714 A CN115729714 A CN 115729714A CN 202310019276 A CN202310019276 A CN 202310019276A CN 115729714 A CN115729714 A CN 115729714A
Authority
CN
China
Prior art keywords
executing
target task
functional body
functional
target
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.)
Pending
Application number
CN202310019276.3A
Other languages
Chinese (zh)
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.)
Zhejiang Lab
Original Assignee
Zhejiang Lab
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 Zhejiang Lab filed Critical Zhejiang Lab
Priority to CN202310019276.3A priority Critical patent/CN115729714A/en
Publication of CN115729714A publication Critical patent/CN115729714A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the specification firstly obtains parameters of each functional body deployed in the equipment, and establishes and runs a simulation environment for resource allocation based on the parameters of each functional body. In the simulation environment, simulating the system resources distributed by each functional body for executing the target task, determining the reward value generated when the target task is executed according to the distributed system resources, and adjusting the system resources distributed by each functional body for executing the target task to obtain the target resource distribution mode by taking the reward value as the maximum as the target. And executing the actual target task through the equipment according to the target resource allocation mode. In the method, before the target task is actually executed, the allocation mode of the system resources allocated by each functional body when the target task is executed is determined through the simulation environment, so that the target task is executed by adopting reasonable system resources, the system resources are saved, and the execution efficiency of the target task is ensured.

Description

Resource allocation method, device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a resource allocation method, an apparatus, a storage medium, and an electronic device.
Background
In a computer system, it is necessary to provide system resources required for executing tasks for each task so that each task can be smoothly executed. The task may refer to any task that needs to be executed, such as: image processing, voice recognition, etc.
However, in the prior art, the system resources allocated to each task may be too much or too little, resulting in resource waste or inefficient task execution.
Disclosure of Invention
Embodiments of the present disclosure provide a resource allocation method, a resource allocation apparatus, a storage medium, and an electronic device, so as to partially solve the problems in the prior art.
The embodiment of the specification adopts the following technical scheme:
a resource allocation method provided in this specification includes:
acquiring parameters of each functional body deployed in equipment;
according to the parameters, constructing a simulation environment for simulating resource allocation of the equipment during task execution;
running the simulation environment, and determining the state of each functional body after responding to the system resources distributed by other functional bodies for executing the target task according to the system resources distributed by each functional body for executing the target task in the simulation environment;
according to the state, determining global state information of each functional body in the simulation environment, and according to the global state information, determining a reward value of each functional body for executing the target task according to the respectively distributed system resources;
with the maximization of the reward value as a target, adjusting system resources distributed by each functional body for executing the target task to obtain a target resource distribution mode;
and executing the actual target task through the equipment according to the target resource allocation mode.
Optionally, each functional body at least includes: CPU, memory, thread pool manager;
acquiring parameters of each functional body deployed in equipment, specifically comprising:
and acquiring CPU parameters of the CPU, memory parameters of the memory and thread pool parameters managed by the thread pool manager, wherein the CPU parameters, the memory parameters and the thread pool parameters are deployed in equipment.
Optionally, according to the parameters, a simulation environment for simulating resource allocation of the device when executing a task is constructed, which specifically includes:
and according to the parameters of each functional body, constructing initial state information corresponding to each functional body when the equipment executes the task, a resource allocation decision space corresponding to each functional body and a reward function when each functional body executes the target task according to the system resource allocated to each functional body.
Optionally, determining, according to the system resource allocated by each functional body for executing the target task in the simulation environment, a state of each functional body after responding to the system resource allocated by the other functional bodies for executing the target task, specifically includes:
and determining the state of each functional body after responding to system resources allocated by other functional bodies for executing the target task according to the number of CPU cores allocated by the CPU for executing the target task in the simulation environment, the memory space allocated for executing the target task in the simulation environment and the number of threads allocated by the thread pool manager for executing the target task in the simulation environment.
Optionally, determining, according to the global state information, an incentive value for each functional body to execute the target task according to the system resource allocated to each functional body, specifically including:
determining the execution efficiency of each functional body for executing the target task according to the respectively allocated system resources;
determining the total amount of system resources which are distributed by each functional body and used for executing the target task according to the global state information;
and determining a reward value of each functional body for executing the target task according to the system resource distributed by each functional body based on the execution efficiency and the total amount of the system resource, wherein the reward value is positively correlated with the execution efficiency, and the reward value is negatively correlated with the total amount of the system resource.
The present specification provides a resource allocation apparatus, including:
the acquisition module is used for acquiring parameters of all functional bodies deployed in the equipment;
the construction module is used for constructing a simulation environment for simulating resource allocation of the equipment during task execution according to the parameters;
the operation module is used for operating the simulation environment and determining the state of each functional body after responding to the system resources distributed by other functional bodies for executing the target task according to the system resources distributed by each functional body for executing the target task in the simulation environment;
the determining module is used for determining the global state information of each functional body in the simulation environment according to the state and determining the reward value of each functional body for executing the target task according to the system resource distributed by each functional body according to the global state information;
the adjusting module is used for adjusting the system resources which are respectively allocated to the execution target tasks by the functional bodies to obtain a target resource allocation mode by taking the maximization of the reward value as a target;
and the task execution module is used for executing the actual target task through the equipment according to the target resource allocation mode.
Optionally, the obtaining module is specifically configured to obtain a CPU parameter of a CPU disposed in the device, a memory parameter of a memory, and a thread pool parameter managed by the thread pool manager.
Optionally, the building module is specifically configured to build, according to the parameter of each functional body, initial state information corresponding to each functional body, a resource allocation decision space corresponding to each functional body, and a reward function corresponding to each functional body when the device is simulated to execute a task.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the resource allocation method described above.
The present specification provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the resource allocation method.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects:
in the embodiment of the present specification, before executing a target task, parameters of each functional body deployed in a device are acquired, a simulation environment for resource allocation is constructed based on the parameters of each functional body, and the simulation environment is run. In a simulation environment, simulating system resources distributed by each functional body for executing a target task, determining reward values generated when the target task is executed according to the system resources distributed by each functional body, and adjusting the system resources distributed by each functional body for executing the target task to obtain a target resource distribution mode by taking the maximization of the reward values as a target. And executing the actual target task through the equipment according to the target resource allocation mode. In the method, before the target task is actually executed, the allocation mode of the system resources allocated by each functional body when the target task is executed is determined through the simulation environment, so that the target task is executed by adopting reasonable system resources, the system resources are saved, and the execution efficiency of the target task is ensured.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the principles of the specification and not to limit the specification in a limiting sense. In the drawings:
fig. 1 is a flowchart of a resource allocation method provided in an embodiment of the present specification;
FIG. 2 is a schematic diagram of a simulation environment provided by embodiments of the present description;
fig. 3 is a schematic structural diagram of a resource allocation apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of this specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without making any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a resource allocation method provided in an embodiment of the present specification, including:
s100: parameters of each functional body deployed in the equipment are acquired.
In the embodiments of the present specification, a device may refer to any one of a server, a client, a cloud server, and the like that is capable of performing a task. Wherein, the task of execution includes at least: image processing, voice recognition, encryption and decryption and the like. Each function deployed in the device includes at least: a Central Processing Unit (CPU), a memory, a thread pool manager, etc.
In this embodiment of the present specification, when a device receives a request for executing a task, a task that needs to be executed may be determined from the request for executing the task, and the task is taken as a target task. Then, parameters of each function deployed in the device are acquired.
Specifically, the CPU parameters of the CPU, the memory parameters of the memory, and the thread pool parameters managed by the thread pool manager, which are deployed in the device, may be obtained. Wherein, the CPU parameters at least comprise: the system comprises a core structure, a main frequency, an external frequency, a frequency doubling, an interface, a cache, a multimedia instruction set, a manufacturing process, a voltage, a packaging form, an integer unit, a floating point unit and the like. The memory parameters at least include: memory capacity, operating voltage, TCK clock period, CL delay, number of memory lines, bus frequency, data bandwidth, etc. The thread pool parameters include at least: core thread count, maximum thread count, idle thread survival time, time units, work queues, thread factories, rejection policies, etc.
S102: and according to the parameters, constructing a simulation environment for simulating resource allocation of the equipment during task execution.
In this embodiment of the present specification, after the parameters of each functional body are obtained, a simulation environment for resource allocation of a simulation device during task execution may be constructed according to the parameters of each functional body. Wherein, the resource at least includes: core count, memory space, thread count, etc.
Specifically, initial state information corresponding to each functional body when the simulation device executes the task, a resource allocation decision space corresponding to each functional body, and a reward function when each functional body executes the target task according to the allocated system resource can be constructed according to the parameters of each functional body. The reward function can be related to the execution efficiency of executing the target task and the total amount of system resources distributed by each functional body for executing the target task, and is positively related to the execution efficiency and negatively related to the total amount of the system resources. The execution efficiency is related to the number of cores, the memory space and the number of threads of the CPU, and the execution efficiency is higher when the target task is executed and the occupied memory space is larger, the number of threads is larger, the number of cores is larger.
The initial state information corresponding to the CPU may include: the initial number of cores used by the CPU for allocation, and the resource allocation policy space corresponding to the CPU may include: increasing the number of cores or decreasing the number of cores, the initial state information corresponding to the memory may include: the initial memory space (i.e., memory capacity) of the memory for allocation, and the resource allocation policy space corresponding to the memory may include: increasing or decreasing the memory space, the initial state information corresponding to the thread pool manager may include: an initial number of threads for allocation within the thread pool. The resource allocation policy space corresponding to the thread pool manager may include: increasing the number of threads or decreasing the number of threads.
S104: and operating the simulation environment, and determining the state of each functional body after responding to the system resources allocated by other functional bodies for executing the target task according to the system resources allocated by each functional body for executing the target task in the simulation environment.
S106: according to the state, determining global state information of each functional body in the simulation environment, and according to the global state information, determining a reward value of each functional body for executing the target task according to the respectively distributed system resources.
S108: and adjusting the system resources distributed by each functional body for the execution target task to obtain a target resource distribution mode by taking the maximization of the reward value as a target.
In the embodiment of the specification, after the simulation environment for resource allocation of the device in executing the target task is built, the simulation environment can be run. In the process of operating the simulation environment, a plurality of resource allocation modes for resource allocation of the device in executing the target task can be simulated, and an optimal resource allocation mode is determined from the simulated plurality of resource allocation modes. The optimal resource allocation mode can achieve the effects of fastest execution efficiency of executing the target task and minimum memory space and thread number occupied by executing the target task.
In the process of running the simulation environment, the state of each functional body after responding to the system resources allocated by other functional bodies for executing the target task can be determined according to the system resources allocated by each functional body for executing the target task in the simulation environment. The state of each functional body after responding to the system resource allocated by the other functional body for executing the target task may refer to the state information respectively remaining after each functional body responds to the system resource allocated by the other functional body for executing the target task.
Such as: the initial state information of the CPU is 8 cores, 2 cores are allocated for executing the target task, and the state of the CPU after the CPU allocates the system resources for executing the target task is 6 cores. The initial state information of the memory is 128G, 18G is allocated to the execution of the target task, and the state of the memory after the system resource allocated to the execution of the target task is 110G. Because the system resources allocated by the CPU and the memory for executing the target task are more, the number of threads for executing the target task in the thread pool can be less. The initial state information of the thread pool manager is 50 thread numbers, 10 thread numbers are allocated for executing the target task, and the state of the thread pool manager after the thread pool manager allocates the system resources for executing the target task is 40 thread numbers.
After determining the state of each functional body after responding to the system resource allocated by the other functional bodies for executing the target task, the global state information of each functional body in the simulation environment may be determined according to the state of each functional body after responding to the system resource allocated by the other functional bodies for executing the target task, and the reward value of each functional body for executing the target task according to the system resource allocated by each functional body is determined according to the global state information.
When determining the reward value, the execution efficiency of each functional body for executing the target task according to the system resource allocated to each functional body may be determined according to the system resource allocated to each functional body. Then, according to the global state information, the total amount of system resources which are allocated by each functional body and used for executing the target task is determined. And finally, based on the execution efficiency and the total amount of the system resources, determining the reward value of each functional body for executing the target task according to the respectively distributed system resources. The reward value is positively correlated with the execution efficiency, and the reward value is negatively correlated with the total amount of system resources.
After determining the reward value of each functional body for executing the target task according to the system resource allocated to each functional body, the maximum reward value can be taken as a target, the system resources allocated to each functional body for executing the target task are adjusted, and finally, an optimal resource allocation mode is obtained and taken as a target resource allocation mode.
Continuing with the above example, the target resource allocation manner is: the CPU allocates 2 cores for executing the target task, the memory allocates 10G for executing the target task, and the thread pool manager allocates 15 thread numbers for executing the target task.
S110: and executing the actual target task through the equipment according to the target resource allocation mode.
In this embodiment of the present specification, after determining the target resource allocation manner, the device may execute an actual target task according to the target resource allocation manner.
It should be noted that all the actions of acquiring signal, information, task or image data in the present application are performed under the premise of complying with the corresponding data protection regulation policy of the country of the location and obtaining the authorization given by the owner of the corresponding device.
As can be seen from the method shown in fig. 1, before executing a target task, the present specification first obtains parameters of each functional body deployed in a device, and constructs a simulation environment for resource allocation based on the parameters of each functional body, and runs the simulation environment. In the simulation environment, simulating system resources distributed by each functional body for executing the target task, determining reward values generated when the target task is executed according to the system resources distributed by each functional body, and adjusting the system resources distributed by each functional body for executing the target task to obtain a target resource distribution mode by taking the reward value maximization as a target. And executing the actual target task through the equipment according to the target resource allocation mode. In the method, before the target task is actually executed, the allocation mode of the system resources allocated by each functional body when the target task is executed is determined through the simulation environment, so that the target task is executed by adopting reasonable system resources, the system resources are saved, and the execution efficiency of the target task is ensured.
In the above, the resource allocation method of fig. 1 is applied to system resource allocation on a computer system, and besides allocating system resources, the resource allocation method of fig. 1 may also be applied to other scenarios, such as: and simulating the scenes of the social environment.
In a scenario simulating a social environment, before steps S100 to S110 in fig. 1, various social characters in the society can be constructed by an object program running on a device, such as: residents, businesses, governments, etc. In the social environment of a region, a plurality of residents, a plurality of enterprises and a plurality of governments can be provided.
In step S100, parameters of each function deployed in the apparatus are acquired. Since the object program runs in the device and the object program is used for constructing various social roles, the functional entities deployed in the device can be various social roles constructed in the object program, that is, each functional entity at least includes: residents, enterprises, governments and the like. The parameters for each functionality may then refer to the number of individuals for each social role.
That is, the individual number of each function in the target program running on the device is acquired.
In step S102, a simulation environment for resource allocation when each functional body in the simulation device executes a task is constructed according to the parameter of each functional body.
In the embodiment of the present specification, a simulation environment (i.e., a social simulation environment) for simulating resource allocation of each functional body in a social environment when the functional body executes a task may be constructed according to the acquired parameters of each functional body. As shown in fig. 2. In the simulation environment of fig. 2, circles are used to represent residents, residents may be 10, triangles are used to represent businesses, businesses may be 4, squares are used to represent governments, and governments may be 1.
In addition, the tasks performed by the various functionalities may be different. Such as: for the residents, the tasks performed by the residents may include: labor, purchasing goods, paying personal income taxes, etc. For an enterprise, the tasks performed by the enterprise may include: and issuing wages, enterprise investment, paying enterprise income tax, selling commodities and the like. For governments, government performed tasks may include: tax collection, resident subsidy issue, etc. In addition, the resources may include: money resources, time resources, inventory resources, and the like.
When a simulation environment is constructed, aiming at each functional body, the initial state information of the functional body, the resource allocation decision space of the functional body and the reward function corresponding to the functional body are constructed. The reward function corresponding to each functional body is related to the resources allocated to other functional bodies for executing the respective tasks.
Wherein, for the resident, the initial state information of the resident may include: assets, work attitude coefficients, etc. The resident's resource allocation decision space may include: time resources of work, money resources consumed to purchase goods, etc. The reward function of the residents can represent the satisfaction degree of the residents on life, and is positively correlated with the money resources consumed by the residents for purchasing commodities and negatively correlated with the time resources of the residents for working. For an enterprise, the initial state information for the enterprise may include: inventory resources (e.g., inventory of goods), monetary resources for payment (e.g., payroll), sales price of goods, accumulated monetary resources (e.g., accumulated profit), intrinsic resources (e.g., business capital), productivity conversion factors, etc., the resource allocation decision space of the business may include: monetary resources for work return, selling price of goods, monetary resources for capital investment, etc. The reward function of a business may refer to the profit of the business over a preset length of time. For governments, initial state information for the government may include: inventory resources per enterprise, sales prices per enterprise, monetary resources per enterprise for work return, etc., government resource allocation decision space may include: the tax rate of the personal income tax, the tax rate of the enterprise income tax, subsidies issued to residents, and the like. The government reward function may refer to the resident's reward function, or the sum of the resident's reward function and the enterprise's reward function.
Such as: for the residents, the initial state information of the residents may be: (
Figure 374264DEST_PATH_IMAGE001
),
Figure 963508DEST_PATH_IMAGE002
To indicate residents
Figure 274404DEST_PATH_IMAGE003
In that
Figure 338787DEST_PATH_IMAGE004
The assets at the time step are,
Figure 825263DEST_PATH_IMAGE005
to indicate residents
Figure 178884DEST_PATH_IMAGE003
Different residents can correspond to different working attitude coefficients. The resident's resource allocation decision space may be: (
Figure 118022DEST_PATH_IMAGE006
),
Figure 848080DEST_PATH_IMAGE007
Is shown in
Figure 189063DEST_PATH_IMAGE004
In time step, residents
Figure 588951DEST_PATH_IMAGE003
In an enterprise
Figure 140018DEST_PATH_IMAGE008
The time resources of the work are such that,
Figure 283555DEST_PATH_IMAGE009
is shown in
Figure 479044DEST_PATH_IMAGE004
In time step, residents
Figure 440047DEST_PATH_IMAGE010
The money resources consumed to purchase the goods, i.e., the total amount of consumption.
Figure 88197DEST_PATH_IMAGE011
Figure 894479DEST_PATH_IMAGE012
To indicate residents
Figure 212983DEST_PATH_IMAGE010
Purchasing enterprises
Figure 220254DEST_PATH_IMAGE008
The number of commodities. The resident's reward function may be:
Figure 480334DEST_PATH_IMAGE013
Figure 965673DEST_PATH_IMAGE014
to indicate residents
Figure 260388DEST_PATH_IMAGE010
The degree of satisfaction obtained from the consumer goods,
Figure 704139DEST_PATH_IMAGE015
can represent residents
Figure 61302DEST_PATH_IMAGE010
In that
Figure 474966DEST_PATH_IMAGE004
Time resources working within a time step.
For an enterprise, the initial state information of the enterprise may be: (
Figure 499553DEST_PATH_IMAGE016
),
Figure 114205DEST_PATH_IMAGE017
Representing a business
Figure 83299DEST_PATH_IMAGE008
In that
Figure 910440DEST_PATH_IMAGE004
The inventory resources within the time step are,
Figure 179748DEST_PATH_IMAGE018
representing a business
Figure 696792DEST_PATH_IMAGE008
In that
Figure 294127DEST_PATH_IMAGE004
The selling price of the goods in the time step,
Figure 49593DEST_PATH_IMAGE019
representing an enterprise
Figure 783194DEST_PATH_IMAGE008
In that
Figure 598703DEST_PATH_IMAGE004
The money resources for the work return, i.e., payroll, in the unit time paid to the residents within the time step.
Figure 683334DEST_PATH_IMAGE020
Representing a business
Figure 117857DEST_PATH_IMAGE008
In that
Figure 830598DEST_PATH_IMAGE004
The accumulated monetary resources, i.e., the accumulated profit, over the time step.
Figure 692375DEST_PATH_IMAGE021
Representing a business
Figure 123356DEST_PATH_IMAGE008
In that
Figure 95992DEST_PATH_IMAGE004
Intrinsic resources, i.e., capital, within the timestep.
Figure 69764DEST_PATH_IMAGE022
Representing a business
Figure 961496DEST_PATH_IMAGE008
In that
Figure 11930DEST_PATH_IMAGE004
Capital and labor at time step are converted into productivity conversion factors for productivity. The resource allocation decision space of an enterprise may be: (
Figure 912890DEST_PATH_IMAGE023
)。
Figure 210010DEST_PATH_IMAGE024
Representing a business
Figure 679169DEST_PATH_IMAGE008
In that
Figure 819163DEST_PATH_IMAGE004
Monetary resources for capital investment within a timestep. The reward function for a business may be:
Figure 664760DEST_PATH_IMAGE025
Figure 347545DEST_PATH_IMAGE026
representing a business
Figure 161173DEST_PATH_IMAGE008
In that
Figure 944058DEST_PATH_IMAGE004
Net profit over time steps.
Figure 327766DEST_PATH_IMAGE027
Representing an enterprise
Figure 724112DEST_PATH_IMAGE008
In that
Figure 269494DEST_PATH_IMAGE004
The amount of sales in the time step,
Figure 384080DEST_PATH_IMAGE028
representing a business
Figure 305900DEST_PATH_IMAGE008
In that
Figure 822332DEST_PATH_IMAGE004
Total sales over time steps.
Figure 538615DEST_PATH_IMAGE029
Representing a business
Figure 281443DEST_PATH_IMAGE030
In that
Figure 866009DEST_PATH_IMAGE004
Pay the wages of all workers within the time step,
Figure 377892DEST_PATH_IMAGE031
is shown in
Figure 389711DEST_PATH_IMAGE004
Time resources for all workers to work within a time step.
For governments, the initial state information for the government may be: (
Figure 88677DEST_PATH_IMAGE032
)。
Figure 614948DEST_PATH_IMAGE033
Indicates all enterprises are in
Figure 840393DEST_PATH_IMAGE004
Inventory resources within a time step.
Figure 164058DEST_PATH_IMAGE034
Indicates all enterprises are in
Figure 740533DEST_PATH_IMAGE004
Selling price of the goods in the time step.
Figure 542267DEST_PATH_IMAGE035
Indicates all enterprises are in
Figure 763164DEST_PATH_IMAGE004
Money resources for work remuneration in a unit time paid to residents within the time step. The government resource allocation decision space may be: (
Figure 382364DEST_PATH_IMAGE036
)。
Figure 321501DEST_PATH_IMAGE037
Indicates the government is
Figure 51560DEST_PATH_IMAGE004
The tax rate of the personal income tax at the next time step of the time step setting,
Figure 861384DEST_PATH_IMAGE038
indicates the government is
Figure 792431DEST_PATH_IMAGE004
The tax rate of the enterprise income tax at the next time step set by the time step,
Figure 77919DEST_PATH_IMAGE039
indicates the government is
Figure 221455DEST_PATH_IMAGE004
And issuing subsidies to residents at the time step. Wherein the content of the first and second substances,
Figure 275999DEST_PATH_IMAGE040
Figure 380877DEST_PATH_IMAGE041
indicating the government
Figure 888082DEST_PATH_IMAGE004
The tax rate of the personal income tax at time step.
Figure 835309DEST_PATH_IMAGE042
To indicate residents
Figure 150884DEST_PATH_IMAGE003
In that
Figure 17209DEST_PATH_IMAGE004
The income or payroll of the time step,
Figure 729819DEST_PATH_IMAGE043
Figure 746316DEST_PATH_IMAGE044
indicating the government
Figure 438767DEST_PATH_IMAGE004
The tax rate of the enterprise income tax at time step,
Figure 351359DEST_PATH_IMAGE045
representing an enterprise
Figure 364315DEST_PATH_IMAGE008
In that
Figure 653345DEST_PATH_IMAGE004
Net profit over time steps. The government reward function may be:
Figure 677932DEST_PATH_IMAGE046
or
Figure 151639DEST_PATH_IMAGE047
In step S104, the simulation environment is run, and the state of each functional body after responding to the resources allocated by other functional bodies for executing the target task is determined according to the resources allocated by each functional body for executing the target task in the simulation environment.
In an embodiment of the present specification, by running the simulated environment, each functional body is caused to execute a respective target task in the simulated social environment, and each functional body is caused to allocate a respective resource for executing the respective target task. After the preset time length, determining the state of each functional body after responding to the resources allocated by other functional bodies to execute the respective target tasks. The preset duration may refer to a specified time step. For the residents, the target tasks performed by the residents at least include: work (i.e., work), purchase goods, etc. Aiming at an enterprise, the target task executed by the enterprise at least comprises the following steps: selling goods, issuing wages, investing in enterprises, etc. For governments, government executed target tasks include at least: tax collection and subsidy issue.
When each function allocates its own resource, the resource cannot be allocated without limitation, and resource allocation needs to be restricted.
For the constraints of the inhabitants, the time resource for working within one time step needs to be below a maximum time threshold, i.e.:
Figure 261678DEST_PATH_IMAGE048
Figure 213453DEST_PATH_IMAGE049
can represent residents
Figure 358127DEST_PATH_IMAGE003
In that
Figure 612522DEST_PATH_IMAGE004
The time resources that are working within a time step,
Figure 334490DEST_PATH_IMAGE050
representing a maximum time threshold.
The total consumption amount of the commodities purchased by residents is lower than that of the assets of the residents, namely:
Figure 965322DEST_PATH_IMAGE051
Figure 823557DEST_PATH_IMAGE002
to indicate residents
Figure 777082DEST_PATH_IMAGE003
In that
Figure 596134DEST_PATH_IMAGE004
Assets at time step.
The number of purchased articles by the residents cannot exceed the inventory of the articles, that is,
Figure 889712DEST_PATH_IMAGE052
Figure 166234DEST_PATH_IMAGE053
representing a business
Figure 827679DEST_PATH_IMAGE054
In that
Figure 399605DEST_PATH_IMAGE004
Inventory resources within a time step.
Figure 401934DEST_PATH_IMAGE055
Is composed of
Figure 219716DEST_PATH_IMAGE004
All residents in time step to enterprise
Figure 783552DEST_PATH_IMAGE008
The amount of the purchase of the commodity of (a),
Figure 842775DEST_PATH_IMAGE056
is composed of
Figure 773429DEST_PATH_IMAGE004
Residents in time step
Figure 601707DEST_PATH_IMAGE003
For enterprises
Figure 539708DEST_PATH_IMAGE008
The expected amount of the purchase of the goods of (a),
Figure 761260DEST_PATH_IMAGE057
is composed of
Figure 138015DEST_PATH_IMAGE004
Residents in time step
Figure 617538DEST_PATH_IMAGE003
For enterprises
Figure 664122DEST_PATH_IMAGE008
The actual purchase amount of the commodity.
The cumulative profit for an enterprise needs to be greater than zero for the constraints of the enterprise.
The government is not profitable for its constraints, i.e., all taxes are issued to residents as subsidies.
After each functional body allocates respective resources for executing respective target tasks, a state in which each functional body is in response to the resources allocated by other functional bodies when executing respective target tasks can be determined.
For residents, the state that residents are in after responding to the resources allocated by other functional bodies to perform their respective target tasks may be: (
Figure 229096DEST_PATH_IMAGE058
)。
Figure 612804DEST_PATH_IMAGE059
Figure 946833DEST_PATH_IMAGE060
To indicate residents
Figure 958127DEST_PATH_IMAGE010
In that
Figure 479238DEST_PATH_IMAGE004
The asset at the next time step of the time step,
Figure 338741DEST_PATH_IMAGE061
representing the number of all residents.
For an enterprise, the state of the enterprise after responding to the resources allocated by other functional bodies to execute their respective target tasks may be: (
Figure 996118DEST_PATH_IMAGE062
)。
Figure 844558DEST_PATH_IMAGE063
Representing a business
Figure 118544DEST_PATH_IMAGE008
In that
Figure 844055DEST_PATH_IMAGE004
The inventory resources at the next time step from the time step,
Figure 887097DEST_PATH_IMAGE064
Figure 256505DEST_PATH_IMAGE065
Figure 486630DEST_PATH_IMAGE066
representing a business
Figure 546989DEST_PATH_IMAGE008
In that
Figure 913380DEST_PATH_IMAGE004
The number of goods produced in a time step,
Figure 61813DEST_PATH_IMAGE028
representing a business
Figure 310392DEST_PATH_IMAGE008
In that
Figure 112126DEST_PATH_IMAGE004
Total sales in time step.
Figure 801864DEST_PATH_IMAGE067
For enterprises
Figure 562010DEST_PATH_IMAGE008
Is determined.
Figure 766726DEST_PATH_IMAGE068
Representing an enterprise
Figure 496785DEST_PATH_IMAGE030
In that
Figure 837767DEST_PATH_IMAGE004
The money resources for the labor compensation in the unit time paid to the resident set at the next time step of the time step.
Figure 500305DEST_PATH_IMAGE069
Representing an enterprise
Figure 520214DEST_PATH_IMAGE008
In that
Figure 496041DEST_PATH_IMAGE004
The selling price of the commodity at the next time step of the time step.
Figure 957109DEST_PATH_IMAGE070
Representing an enterprise
Figure 59058DEST_PATH_IMAGE008
In that
Figure 97421DEST_PATH_IMAGE004
The accumulated monetary resource at the next time step of the time step,
Figure 44648DEST_PATH_IMAGE071
Figure 94644DEST_PATH_IMAGE072
representing an enterprise
Figure 492127DEST_PATH_IMAGE008
In that
Figure 109797DEST_PATH_IMAGE004
The accumulated profit at the time step is taken into account,
Figure 391874DEST_PATH_IMAGE045
representing a business
Figure 561955DEST_PATH_IMAGE030
In that
Figure 536864DEST_PATH_IMAGE004
Net profit over time steps.
Figure 159607DEST_PATH_IMAGE073
Representing a business
Figure 838850DEST_PATH_IMAGE008
In that
Figure 597858DEST_PATH_IMAGE004
The intrinsic resources of the next time step of the time step,
Figure 40208DEST_PATH_IMAGE074
in step S106, a reward value corresponding to each function may be determined according to the reward function of each function and the resource allocated by each function to execute the target task within the preset time length.
Wherein, for the residents, the reward function is
Figure 9301DEST_PATH_IMAGE075
. For an enterprise, the reward function is
Figure 367601DEST_PATH_IMAGE076
. For the government, the reward function is
Figure 981116DEST_PATH_IMAGE077
Or
Figure 919334DEST_PATH_IMAGE078
In step S108, the resources allocated by each function for executing the target task may be adjusted to obtain the target resource allocation manner, with the goal of maximizing the reward value of each function as a target. And finally, distributing respective resources for executing respective target tasks of the functional bodies according to the obtained target resource distribution mode through a target program in the equipment so as to verify whether the task indexes obtained after the functional bodies execute the respective target tasks reach the standard or not.
In the embodiment of the present specification, after the reward value of each function body is determined, the same type of function body may be randomly selected as a target function body for any function body. And judging whether the reward value of the target function body is larger than the reward value of the function body, and if so, learning the decision action of the target function body according to the designated probability. Wherein the same type of functionality may refer to a resident or business or government.
Such as: if the function body is a resident, another function body which is the same as the resident is randomly selected as a target function body. Then, in the case where it is determined that the reward value of the target function is greater than the reward value of the function, the probability may be specified
Figure 375723DEST_PATH_IMAGE079
Learning a decision-making action of the target functionality. That is to say that the first and second electrodes,
Figure 269205DEST_PATH_IMAGE080
Figure 127440DEST_PATH_IMAGE081
is the decision-making action of the functional body,
Figure 755998DEST_PATH_IMAGE082
is a decision-making action of the target functionality.
In step S110, respective resources may be allocated to each function according to the obtained target resource allocation manner by the target program in the device, so as to verify whether the task index obtained after each function executes each target task meets the standard. Wherein the task metrics at least include: the wages and working hours of residents at the residential level, the wage level of enterprises at the enterprise level, the kini coefficient, the GDP, the income distribution, the medium income group proportion and the like.
In addition, in steps S100 to S108, in order to meet the requirement that different residents have different characters and different working capacities in the real society, the functional units belonging to the same resident can be differentiated. Therefore, the working attitude coefficient for representing the working attitude and the capacity coefficient for representing the working capacity of each resident are set for each resident, the better the working attitude is, the smaller the working attitude coefficient is, the stronger the working capacity is, and the larger the capacity coefficient is. Wherein the working attitude coefficient may be
Figure 575050DEST_PATH_IMAGE083
The coefficient of capacity may be
Figure 399786DEST_PATH_IMAGE084
When the simulation environment is constructed, the resident functional bodies can be classified according to different working attitude coefficients and different capacity coefficients, and various categories aiming at the resident functional bodies are obtained. Then, an initial proportion of the resident function bodies of each category to all the resident function bodies is determined.
Such as: if coefficient of working attitude
Figure 519052DEST_PATH_IMAGE083
And (4) following power law distribution, classifying the resident functional bodies according to different working attitude coefficients, and distributing different initial ratios to the resident functional bodies of each category. That is to say that the first and second electrodes,
Figure 646408DEST_PATH_IMAGE085
the functional bodies of residents who are diligent are represented, and the functional bodies of the residents account for 30 percent;
Figure 952756DEST_PATH_IMAGE086
representing normal resident functional bodies, wherein the resident functional bodies account for 30 percent;
Figure 50025DEST_PATH_IMAGE087
the function body of the inhabitants represents the lazy function body, and the inhabitants account for 30 percent of the function body. Similarly, if coefficient of capacity
Figure 229989DEST_PATH_IMAGE084
And classifying the resident functional bodies according to different capacity coefficients and distributing different initial ratios to the resident functional bodies of various categories according to power law distribution. That is to say that the first and second electrodes,
Figure 528246DEST_PATH_IMAGE088
the method represents resident functional bodies with high talent, and the percentage of the resident functional bodies is 20 percent;
Figure 56310DEST_PATH_IMAGE089
the functional bodies of residents with high and medium talents account for 30 percent;
Figure 222850DEST_PATH_IMAGE090
the method represents the resident functional bodies with medium and low talents, and the percentage of the resident functional bodies in the category is 30 percent;
Figure 457653DEST_PATH_IMAGE091
the resident function body with low talent is represented, and the resident function body accounts for 20 percent. Therefore, by comprehensively considering the working attitude coefficient and the capability coefficient, the resident functions can be classified into 12 types, respectively: the functional bodies of residents in the states of work and employment and high talents account for 6 percent, the functional bodies of residents in the states of work and employment and high talents account for 9 percent, the functional bodies of residents in the states of work and employment and low talents account for 9 percent, and the functional bodies of residents in the states of work and employment and low talents account for 6 percent. The proportion of the resident functions of ' normal, high talent ' is 6%, ' normal, medium and highThe resident function body of the talent accounts for 9 percent, the resident function body of the normal talent, the middle-low talent accounts for 9 percent, and the resident function body of the normal talent, the low talent accounts for 6 percent. The functional body of the residents of the high talent accounts for 6 percent, the functional body of the residents of the high talent accounts for 9 percent, the functional body of the residents of the middle and low talent accounts for 9 percent, and the functional body of the residents of the low talent accounts for 6 percent.
When the simulation environment is constructed, because the capability coefficient of each resident functional body is considered, the income of the resident functional body can be updated as follows:
Figure 785866DEST_PATH_IMAGE092
. Because the income of the resident function body is changed, the income can influence the consumption of the resident function body, thereby influencing the reward function of the resident function body. Therefore, the reward function of the resident function body can be updated to:
Figure 66806DEST_PATH_IMAGE093
after the simulation environment is built, the simulation environment is run. In the process of running the simulation environment, besides adjusting the resources allocated to the execution of the objective tasks by the respective functions with the aim of maximizing the respective reward values of the respective functions, the expected revenue distribution of all the resident functions can be determined according to empirical data. And simultaneously, determining the income distribution corresponding to all the resident functional bodies in the simulation environment according to the income of each resident functional body in the simulation environment. Then, aiming at minimizing the difference between the income distribution corresponding to all the resident functions in the simulation environment and the expected income distribution, the initial occupation ratio of each category of the resident functions to all the resident functions is adjusted to obtain the final occupation ratio of each category of the resident functions to all the resident functions. And finally, verifying whether the income distribution corresponding to all the resident function bodies in the simulation environment accords with the expected income distribution or not based on the obtained final occupation ratio of each category of resident function bodies to all the resident function bodies and the income corresponding to each resident function body. Wherein the desired revenue distribution may appear pyramidal. That is, the number of resident functions with high income is small, and the number of resident functions with low income or moderate income is large.
In addition, on the basis of introducing differentiation of resident functional bodies, income distribution of the resident functional bodies tends to be average by adjusting a tax mechanism and a subsidy mechanism of a government functional body, so that the common abundance is realized.
Specifically, under the condition that the income distribution corresponding to each resident function in the simulation environment conforms to the expected income distribution, the tax rate of personal income tax in the resource allocation decision space of the government function and subsidies issued to the resident functions can be adjusted, so that the income distribution of all the resident functions tends to be even. Wherein the higher the capacity factor, the fewer patches are issued, and conversely, the lower the capacity factor, the more patches are issued.
Among them, the residents
Figure 925784DEST_PATH_IMAGE003
The subsidy formula of (c):
Figure 608569DEST_PATH_IMAGE094
Figure 248629DEST_PATH_IMAGE095
for residents
Figure 875920DEST_PATH_IMAGE003
The time resources of the work are such that,
Figure 197311DEST_PATH_IMAGE096
is a capability coefficient of a resident j and subsidies
Figure 182DEST_PATH_IMAGE097
And coefficient of capacity
Figure 599091DEST_PATH_IMAGE098
Inversely proportional to time resources of operation
Figure 323465DEST_PATH_IMAGE099
Is in direct proportion.
After adjusting the tax rate of the personal income tax in the resource allocation decision space of the government function and the subsidy issued to the resident function, the tax rate of the adjusted personal income tax in the resource allocation decision space of the government function and the subsidy issued to each resident function can be determined. Finally, the adjusted tax rate of the personal income tax and the subsidies issued to the functions of the residents can be applied to the real social environment, so that the residents are rich together.
Based on the same idea, the present specification further provides a corresponding apparatus, a storage medium, and an electronic device.
Fig. 3 is a schematic structural diagram of a resource allocation apparatus provided in an embodiment of the present specification, where the apparatus includes:
an obtaining module 301, configured to obtain parameters of each function deployed in the device;
a building module 302, configured to build, according to the parameter, a simulation environment for simulating resource allocation of the device when executing a task;
a running module 303, configured to run the simulation environment, and determine, according to the system resource allocated by each functional body in the simulation environment for executing the target task, a state of each functional body after responding to the system resource allocated by another functional body for executing the target task;
a determining module 304, configured to determine, according to the state, global state information of each functional body in the simulation environment, and determine, according to the global state information, an award value for each functional body to execute the target task according to the system resource allocated to the functional body;
an adjusting module 305, configured to adjust system resources allocated by the respective functional bodies for the execution of the target task, so as to obtain a target resource allocation manner, with the goal of maximizing the reward value;
a task executing module 306, configured to execute, by the device, an actual target task according to the target resource allocation manner.
Optionally, the obtaining module 301 is specifically configured to obtain a CPU parameter of a CPU disposed in the device, a memory parameter of a memory, and a thread pool parameter managed by a thread pool manager.
Optionally, the building module 302 is specifically configured to, according to the parameter of each functional body, build initial state information corresponding to each functional body, a resource allocation decision space corresponding to each functional body, and a reward function corresponding to each functional body when the device is simulated to execute a task.
Optionally, the running module 303 is specifically configured to determine, according to the number of CPU cores allocated by the CPU in the simulation environment for executing the target task, the memory space allocated by the thread pool manager in the simulation environment for executing the target task, and the number of threads allocated by the thread pool manager in the simulation environment for executing the target task, a state of each functional body after responding to the system resource allocated by the other functional bodies for executing the target task.
Optionally, the determining module 304 is specifically configured to determine the execution efficiency of each functional body for executing the target task according to the system resource allocated to each functional body; determining the total amount of system resources which are distributed by each functional body and used for executing the target task according to the global state information; and determining a reward value of each functional body for executing the target task according to the system resource distributed by each functional body based on the execution efficiency and the total amount of the system resource, wherein the reward value is positively correlated with the execution efficiency, and the reward value is negatively correlated with the total amount of the system resource.
The present specification also provides a computer readable storage medium storing a computer program which, when executed by a processor, is operable to perform the resource allocation method provided in fig. 1 above.
Based on the resource allocation method shown in fig. 1, the embodiment of the present specification further provides a schematic structural diagram of the electronic device shown in fig. 4. As shown in fig. 4, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs the computer program to implement the resource allocation method described in fig. 1 above.
Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain a corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical blocks. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is an integrated circuit whose Logic functions are determined by a user programming the Device. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as ABEL (Advanced Boolean Expression Language), AHDL (alternate Hardware Description Language), traffic, CUPL (core universal Programming Language), HDCal, jhddl (Java Hardware Description Language), lava, lola, HDL, PALASM, rhyd (Hardware Description Language), and vhigh-Language (Hardware Description Language), which is currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry for implementing the logical method flows can be readily obtained by a mere need to program the method flows with some of the hardware description languages described above and into an integrated circuit.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium that stores computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be regarded as a hardware component and the means for performing the various functions included therein may also be regarded as structures within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A method for resource allocation, comprising:
acquiring parameters of each functional body deployed in equipment;
according to the parameters, constructing a simulation environment for simulating resource allocation of the equipment during task execution;
running the simulation environment, and determining the state of each functional body after responding to the system resources distributed by other functional bodies for executing the target task according to the system resources distributed by each functional body for executing the target task in the simulation environment;
according to the state, determining global state information of each functional body in the simulation environment, and according to the global state information, determining a reward value of each functional body for executing the target task according to the respectively distributed system resources;
with the maximization of the reward value as a target, adjusting system resources distributed by each functional body for executing the target task to obtain a target resource distribution mode;
and executing the actual target task through the equipment according to the target resource allocation mode.
2. The method of claim 1, wherein each of the functions comprises at least: CPU, memory, thread pool manager;
acquiring parameters of each functional body deployed in equipment, specifically comprising:
and acquiring CPU parameters of the CPU, memory parameters of the memory and thread pool parameters managed by the thread pool manager, wherein the CPU parameters, the memory parameters and the thread pool parameters are deployed in equipment.
3. The method according to claim 1, wherein constructing, according to the parameters, a simulation environment for simulating resource allocation of the device when executing a task, specifically comprises:
and according to the parameters of each functional body, constructing initial state information corresponding to each functional body when the equipment executes a task, a resource allocation decision space corresponding to each functional body and a reward function when each functional body executes the target task according to the system resource allocated to each functional body.
4. The method of claim 2, wherein determining, according to the system resources allocated to each functional entity for executing the target task in the simulation environment, a state that each functional entity is in after responding to the system resources allocated to other functional entities for executing the target task, specifically comprises:
and determining the state of each functional body after responding to system resources allocated by other functional bodies for executing the target task according to the number of CPU cores allocated by the CPU for executing the target task in the simulation environment, the memory space allocated for executing the target task in the simulation environment and the number of threads allocated by the thread pool manager for executing the target task in the simulation environment.
5. The method of claim 1, wherein determining, based on the global state information, a reward value for each of the functionalities to perform the target task according to the respectively allocated system resource comprises:
determining the execution efficiency of each functional body for executing the target task according to the respectively allocated system resources;
determining the total amount of system resources which are distributed by each functional body and used for executing the target task according to the global state information;
and determining a reward value of each functional body for executing the target task according to the respectively distributed system resources based on the execution efficiency and the total amount of the system resources, wherein the reward value is positively correlated with the execution efficiency, and the reward value is negatively correlated with the total amount of the system resources.
6. An apparatus for resource allocation, comprising:
the acquisition module is used for acquiring parameters of all functional bodies deployed in the equipment;
the construction module is used for constructing a simulation environment for simulating resource allocation of the equipment during task execution according to the parameters;
the operation module is used for operating the simulation environment and determining the state of each functional body after responding to the system resources distributed by other functional bodies for executing the target task according to the system resources distributed by each functional body for executing the target task in the simulation environment;
the determining module is used for determining global state information of each functional body in the simulation environment according to the state, and determining the reward value of each functional body for executing the target task according to the system resource distributed by each functional body according to the global state information;
the adjusting module is used for adjusting the system resources distributed by each functional body for the execution of the target task to obtain a target resource distribution mode by taking the maximization of the reward value as a target;
and the task execution module is used for executing the actual target task through the equipment according to the target resource allocation mode.
7. The apparatus according to claim 6, wherein the obtaining module is specifically configured to obtain CPU parameters of a CPU, memory parameters of a memory, and thread pool parameters managed by a thread pool manager, which are deployed in the device.
8. The apparatus according to claim 6, wherein the constructing module is specifically configured to construct, according to the parameter of each functional entity, an initial state information corresponding to each functional entity, a resource allocation decision space corresponding to each functional entity, and a reward function corresponding to each functional entity, when the device executes a task, for simulating.
9. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when being executed by a processor, carries out the method of any of the preceding claims 1-5.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-5 when executing the program.
CN202310019276.3A 2023-01-06 2023-01-06 Resource allocation method, device, storage medium and electronic equipment Pending CN115729714A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310019276.3A CN115729714A (en) 2023-01-06 2023-01-06 Resource allocation method, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310019276.3A CN115729714A (en) 2023-01-06 2023-01-06 Resource allocation method, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115729714A true CN115729714A (en) 2023-03-03

Family

ID=85301936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310019276.3A Pending CN115729714A (en) 2023-01-06 2023-01-06 Resource allocation method, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115729714A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116151137A (en) * 2023-04-24 2023-05-23 之江实验室 Simulation system, method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0414788D0 (en) * 2004-07-01 2004-08-04 Egg Banking Plc Resource allocation tool
CN106354564A (en) * 2016-08-31 2017-01-25 深圳天珑无线科技有限公司 System resource distribution method and system
CN113157422A (en) * 2021-04-29 2021-07-23 清华大学 Cloud data center cluster resource scheduling method and device based on deep reinforcement learning
CN113342537A (en) * 2021-07-05 2021-09-03 中国传媒大学 Satellite virtual resource allocation method, device, storage medium and equipment
CN113641481A (en) * 2021-08-27 2021-11-12 西安交通大学 FPGA task scheduling optimization method and system adopting DQN
CN114050961A (en) * 2021-11-08 2022-02-15 南京大学 Large-scale network simulation system and resource dynamic scheduling and distributing method
CN114661480A (en) * 2022-05-23 2022-06-24 阿里巴巴(中国)有限公司 Deep learning task resource allocation method and system
CN115049433A (en) * 2022-06-15 2022-09-13 北京三快在线科技有限公司 Model training method and device, storage medium and electronic equipment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0414788D0 (en) * 2004-07-01 2004-08-04 Egg Banking Plc Resource allocation tool
CN106354564A (en) * 2016-08-31 2017-01-25 深圳天珑无线科技有限公司 System resource distribution method and system
CN113157422A (en) * 2021-04-29 2021-07-23 清华大学 Cloud data center cluster resource scheduling method and device based on deep reinforcement learning
CN113342537A (en) * 2021-07-05 2021-09-03 中国传媒大学 Satellite virtual resource allocation method, device, storage medium and equipment
CN113641481A (en) * 2021-08-27 2021-11-12 西安交通大学 FPGA task scheduling optimization method and system adopting DQN
CN114050961A (en) * 2021-11-08 2022-02-15 南京大学 Large-scale network simulation system and resource dynamic scheduling and distributing method
CN114661480A (en) * 2022-05-23 2022-06-24 阿里巴巴(中国)有限公司 Deep learning task resource allocation method and system
CN115049433A (en) * 2022-06-15 2022-09-13 北京三快在线科技有限公司 Model training method and device, storage medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱海;王洪峰;廖貅武;: "云环境下能耗优化的任务调度模型及虚拟机部署算法", 系统工程理论与实践 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116151137A (en) * 2023-04-24 2023-05-23 之江实验室 Simulation system, method and device

Similar Documents

Publication Publication Date Title
CN110008018B (en) Batch task processing method, device and equipment
CN107066518B (en) Data processing method and system
CN109005214B (en) Resource scheduling method and device
CN109636457A (en) A kind of advertisement placement method, apparatus and system towards high net value client
CN111047220A (en) Method, device, equipment and readable medium for determining condition of wind control threshold
CN107025137A (en) A kind of resource query method and device
CN115729714A (en) Resource allocation method, device, storage medium and electronic equipment
CN112016914B (en) Resource control and fund control method, device and equipment
CN110516713A (en) A kind of target group's recognition methods, device and equipment
CN113506159A (en) SAP HANA-based cost allocation method, SAP HANA-based cost allocation device, SAP HANA-based cost allocation equipment and SAP storage medium
CN113222649A (en) Method and device for recommending service execution mode
CN106993008B (en) Resource scheduling method and device
CN111047435A (en) Credit data processing method, credit allocation method, credit data processing device, credit allocation device and electronic equipment
CN112449021B (en) Internet resource screening method and device
CN109063967B (en) Processing method and device for wind control scene feature tensor and electronic equipment
CN111177562A (en) Recommendation and sorting processing method and device for target objects and server
CN110992171A (en) User credit granting strategy determination method and device and electronic equipment
CN107392408B (en) Credit score prompt information output method and device
CN110008386A (en) A kind of data generation, processing, evaluation method, device, equipment and medium
CN115660105A (en) Model training method, business wind control method and business wind control device
CN109634812A (en) Process CPU usage control method, terminal device and the storage medium of linux system
CN115049433A (en) Model training method and device, storage medium and electronic equipment
CN114925982A (en) Model training method and device, storage medium and electronic equipment
CN114418736A (en) Bank retail credit customer layering method, storage medium and server
CN112418670A (en) Case allocation method, device, equipment and 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20230303