Resource allocation method, device, electronic device, storage medium and product
By calculating the device status scoring set of device nodes and allocating resources according to the scoring set, the problem of unintelligent resource allocation between heterogeneous devices is solved, and the intelligent allocation of resources according to device needs is realized, and resource utilization efficiency is improved.
Patent Information
- Application Number
- CN202411836218.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-13
AI Technical Summary
In the interconnection scenarios of the Internet of Things and industrial equipment, heterogeneous devices are difficult to share data and resources in real time, resulting in unintelligent resource allocation, inefficient efficiency and waste of resources.
By calculating the device state score set of the device node, the resource allocation probability of the device node is calculated based on the score set, and the resource is allocated according to the probability, and the probability is periodically adjusted to respond to changes in the device state and resource state.
The ability to dynamically allocate resources according to the device status is realized, ensuring that resources are allocated intelligently according to the device needs, improving the flexibility and efficiency of resource allocation, and enhancing resource utilization efficiency.
Smart Images

Figure CN119316485B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a resource allocation method, device, electronic device, storage medium and computer program product. Background Art
[0002] In the interconnected scenarios of the Internet of Things and industrial equipment, there are a large number of heterogeneous devices. It is difficult for devices from different manufacturers and platforms to share data and resources in real time. For example, servers, sensors, and industrial machines of different brands need to be monitored and optimized in real time according to different states (such as hardware configuration, network status, geographic location, etc.). Existing technologies mostly use private protocols and static models, which are difficult to respond to changes in device status in real time, resulting in low efficiency and waste of resources. Therefore, there is a problem of unintelligent resource allocation in the current resource allocation method for heterogeneous devices. Summary of the invention
[0003] The main purpose of this application is to provide a resource allocation method, device, electronic device, storage medium and computer program product, aiming to solve the technical problem of how to intelligently allocate resources.
[0004] To achieve the above object, the present application proposes a resource allocation method, which is applied to a distributed network, wherein the distributed network includes various device nodes, and the resource allocation method includes:
[0005] Calculating a device status score set for each device node;
[0006] For any one of the device nodes, calculating the resource allocation probability of the device node based on the device status score set, and allocating resources to the device nodes according to the resource allocation probability corresponding to the device nodes;
[0007] The resource allocation probability is adjusted according to the impact of the state change of the device node within a preset time step and the resource state value of the preset resource pool, and the adjusted resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step.
[0008] In one embodiment, the device node includes various attributes, and the step of calculating the device status score set of each device node includes:
[0009] For any one of the attributes, calculating an attribute weight corresponding to the attribute, wherein the attribute weight is determined by an impact factor of the priority when the attribute allocates resources to the device node;
[0010] Normalizing the attributes, and obtaining a device status score of the device node based on the normalized attributes and attribute weights corresponding to the attributes;
[0011] The device status scores of each device node are integrated into a device status score set.
[0012] In one embodiment, the step of calculating the resource allocation probability of the device node based on the device status score set includes:
[0013] Determining a device status score corresponding to the device node in the device status score set;
[0014] The ratio of the device state score to the device state score set is used as the resource allocation probability of the device node, and the resource allocation probability is used to indicate the priority of the device node in acquiring resources.
[0015] In one embodiment, there are resources to be allocated in the preset resource pool, and the step of allocating resources to each device node according to the resource allocation probability corresponding to each device node includes:
[0016] In a case where the amount of the resources to be allocated is higher than the resource demand of each device node, determining a probability distribution of resource allocation probabilities corresponding to each device node, randomly selecting a device node based on the probability distribution, and allocating the resources to be allocated to the selected device node;
[0017] In the case that the amount of the resources to be allocated is lower than the resource demand of each device node, the resources to be allocated are allocated to each device node in descending order according to the resource allocation probability corresponding to each device node.
[0018] In one embodiment, before the step of adjusting the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, the step further includes:
[0019] Obtaining a state change amount of each attribute in the device node within a preset time step, and obtaining a state change impact amount of the device node in combination with an attribute weight corresponding to each attribute;
[0020] The resource state value of the preset resource pool is obtained based on the resource balance amount, the newly added resource amount to be allocated, the resource allocation amount and the preset resource balance equation of the preset resource pool within the preset time step.
[0021] In one embodiment, the step of adjusting the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and using the adjusted resource allocation probability as the resource allocation probability corresponding to the device node at the next preset time step includes:
[0022] When the state change impact amount does not meet the preset state change threshold or the resource state value does not meet the preset resource state threshold, obtaining the state impact weight corresponding to the state change impact amount and the resource state weight corresponding to the resource balance amount;
[0023] A new resource allocation probability is obtained by combining the resource allocation probability corresponding to the device node within the preset time step, the state change impact, the state impact weight, the resource balance amount and the resource state weight, and the new resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step.
[0024] In addition, to achieve the above purpose, the present application also proposes a resource allocation device, which is applied to a distributed network, wherein the distributed network includes various device nodes, and the resource allocation device includes:
[0025] A scoring calculation module, used to calculate a device status score set of each device node;
[0026] A resource allocation module, configured to calculate, for any one of the device nodes, a resource allocation probability of the device node based on the device status score set, and allocate resources to the device nodes according to the resource allocation probability corresponding to the device nodes;
[0027] The probability adjustment module is used to adjust the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and use the adjusted resource allocation probability as the resource allocation probability corresponding to the device node in the next preset time step.
[0028] In addition, to achieve the above objectives, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the resource allocation method described above.
[0029] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, and stores a computer program on the storage medium. When the computer program is executed by a processor, the steps of the resource allocation method described above are implemented.
[0030] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the resource allocation method described above are implemented.
[0031] The present application provides a resource allocation method, which is applied to a distributed network, wherein the distributed network includes various device nodes, including: calculating a device state score set of each device node; for any device node among the device nodes, calculating a resource allocation probability of the device node based on the device state score set, and allocating resources to each device node according to the resource allocation probability corresponding to each device node; adjusting the resource allocation probability according to an impact amount of a state change of the device node within a preset time step and a resource state value of a preset resource pool, and using the adjusted resource allocation probability as the resource allocation probability corresponding to the device node for the next preset time step.
[0032] This application can quantify the current status of each device node through device status scoring, provide a basis for subsequent resource allocation, and realize the ability to dynamically allocate resources according to device status by calculating resource allocation probability and allocating resources according to resource allocation probability, ensuring that resources can be intelligently allocated according to device requirements, improving the flexibility and efficiency of resource allocation, and can respond to changes in device status in real time by regularly adjusting resource allocation probability, improving the accuracy and real-time performance of resource allocation, and realizing dynamic optimization of resource allocation strategy by continuously updating resource allocation probability, improving the stability and efficiency of the overall system. Compared with related solutions that mostly use private protocols and static models, it is difficult to respond to changes in heterogeneous device status in real time, resulting in inefficiency and waste of resources. This application solves the problem of data sharing and resource allocation between devices by responding to changes in device and resource status in real time, enhancing the intelligence of resource allocation, and improving resource utilization efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the resource allocation method of the present application;
[0036] Figure 2 A schematic diagram of a flow chart provided for Embodiment 2 of the resource allocation method of the present application;
[0037] Figure 3 A schematic diagram of a process flow provided for Embodiment 3 of the resource allocation method of the present application;
[0038] Figure 4This is a schematic diagram of the module structure of the resource allocation device according to an embodiment of the present application;
[0039] Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the resource allocation method in the embodiment of the present application.
[0040] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0041] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0042] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0043] The embodiment of the present application is applied to a distributed network, which includes various device nodes. The main solution is: calculating a device status score set for each device node; for any device node among the device nodes, calculating the resource allocation probability of the device node based on the device status score set, and allocating resources to each device node according to the resource allocation probability corresponding to each device node; adjusting the resource allocation probability according to the impact of the state change of the device node within a preset time step and the resource status value of a preset resource pool, and using the adjusted resource allocation probability as the resource allocation probability corresponding to the device node for the next preset time step.
[0044] In this embodiment, for the convenience of description, the resource allocation system is used as the execution subject for explanation below.
[0045] Due to the large number of heterogeneous devices in the Internet of Things and industrial interconnection scenarios, real-time data resource sharing across manufacturers and platforms faces challenges. These devices require personalized monitoring and management due to differences in hardware configuration, network and geographical location. Existing technologies mostly rely on private protocols and static models to manage heterogeneous devices, which makes it difficult to dynamically respond to changes in device status, resulting in inefficiency and waste of resources.
[0046] The present application provides a solution that realizes instant response to changes in device and resource status by collecting device status information in real time and performing scoring and calculating resource allocation probability, effectively solving the problem of data sharing and resource allocation between heterogeneous devices, significantly improving the intelligence level of resource allocation, and thus optimizing resource utilization efficiency.
[0047] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a resource allocation system, etc. The following takes the resource allocation system as an example to illustrate this embodiment and the following embodiments.
[0048] Based on this, the embodiment of the present application provides a resource allocation method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the resource allocation method of the present application.
[0049] In this embodiment, the method is applied to a distributed network, which includes various device nodes. The resource allocation method includes steps S01 to S03:
[0050] Step S01, calculating a device status score set of each device node;
[0051] It should be noted that, since there are a large number of heterogeneous devices in the interconnection scenario of the Internet of Things and industrial equipment, these heterogeneous devices can be defined by a unified object model, namely the super object model. The super object model is used to describe and control distributed devices in the Internet of Things, and can abstract and summarize product functions of different brands, different categories or different protocols. Based on this, this application adopts the OPC UA protocol to intelligently manage distributed devices in the super object model. OPC UA (OPC Unified Architecture) is a communication protocol in the field of industrial automation, which aims to achieve interoperability between industrial equipment of different manufacturers and different models. It provides a unified and standardized way to exchange data so that devices of different systems can communicate with each other. Using the information modeling function of OPC UA, the various attributes (hardware configuration, network status, geographic location, historical usage, etc.) of distributed devices in the super object model are mapped to the node attributes of the device node in the OPC UA architecture. The information of each distributed device is abstracted into a device node in the OPC UA architecture. The multi-dimensional attributes of the distributed device are expressed through the hierarchical structure of the node. The parent node represents the device entity, the child node represents the specific attribute, and the attribute is further described by the additional meta information (such as unit, data type).
[0052] For example, in order to map the various attributes of distributed devices in the super object model to the node attributes of device nodes in the OPC UA architecture, it is necessary to first clarify all the key attributes contained in the super object model, such as hardware configuration (CPU, memory, storage, etc.), network status (IP address, bandwidth, latency, etc.), geographic location (latitude and longitude, location, etc.) and historical usage (operating time, fault records, maintenance logs, etc.). According to the attributes of the super object model, create corresponding OPC UA object types, variable types and data types. The object type is used to represent a distributed device or a part of a distributed device, such as a sensor, controller, etc. The variable type is used to represent a specific attribute of a distributed device, such as temperature, humidity, pressure, etc. The data type is used to define the specific data format of the variable, such as integer, floating point number, string, etc. Then create a variable node for each attribute and assign it a unique identifier (such as node ID). According to the complexity of distributed devices and the relationship between attributes, design OPC The hierarchical structure of device nodes in the UA architecture includes device layer nodes (parent nodes) and attribute layer nodes (child nodes). The device layer node is used to represent the entire distributed device and is the top layer of the hierarchy. The attribute layer node is used to represent the specific attributes of the device and is the bottom layer of the hierarchy. The multi-dimensional attributes of the device can be expressed through the hierarchical structure of the device node. Multiple device nodes constitute a distributed network.
[0053] In addition, it should be noted that the device status score is a comprehensive score calculated based on the hardware configuration, network status, geographical location and other attributes of the distributed device. For each device node in the distributed network, the corresponding device status score is calculated, and the device status evaluation can be performed on each device node to determine the priority of the distributed device corresponding to the device node when allocating resources. The device status scores of all device nodes are integrated to obtain a device status score set.
[0054] It is understandable that, since existing solutions often allocate resources based on static device configuration or simple status monitoring, they lack dynamism and accuracy. Therefore, step S01 is performed to accurately reflect the current status and resource requirements of the device node by calculating the device status score, providing a reliable basis for subsequent resource allocation.
[0055] Step S02: for any one of the device nodes, the resource allocation probability of the device node is calculated based on the device status score set, and resources are allocated to each device node according to the resource allocation probability corresponding to each device node;
[0056] It should be noted that the resource allocation probability of each device node is calculated based on the device status score set of the device node. The resource allocation probability is the proportion of the device status score corresponding to the device node in the device status score set, which is used to determine the possibility of the device node obtaining resources. After the resource allocation probability of each device node is calculated, resources are allocated according to the resource allocation probability to ensure that nodes with high priority are allocated resources first.
[0057] It is understandable that, since existing solutions often adopt fixed resource allocation strategies and cannot be dynamically adjusted according to changes in device status, step S02 is performed to ensure that resources are preferentially allocated to devices with better status and more urgent needs by calculating the resource allocation probability, thereby improving the efficiency and fairness of resource allocation and meeting the optimal utilization of resources.
[0058] Step S03, adjusting the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and using the adjusted resource allocation probability as the resource allocation probability corresponding to the device node in the next preset time step.
[0059] It should be noted that the preset time step refers to the time interval used by the system to update the device status and resource allocation strategy, such as 1 second. The state change impact refers to the change in the device status within the preset time step, which is used to evaluate the degree and impact of the device status change. The resource status value refers to the resource status of the preset resource pool within the preset time step, which is used to evaluate the state change and supply and demand relationship of the preset resource pool. The preset resource pool refers to the collection used to store and allocate resources in the system, including resources to be allocated, that is, software authorization resources, which are divided into operating licenses for device use (such as licenses for special software), communication protocol access authorizations for data acquisition or control systems, and the right to use specific services or modules, such as additional analysis function modules.
[0060] In addition, it should be noted that through the subscription mechanism of OPC UA, the state changes of equipment are monitored in real time. Within the preset time step, the system will collect the state data of each device node and compare it with the state data of the previous preset time step to calculate the impact of the state change. This impact reflects the change trend and amplitude of the node state within the preset time step. At the same time, the system will also monitor the state changes of the resources to be allocated in the preset resource pool, including the total amount of resources, allocation status, remaining amount, etc. These changes reflect the supply and demand status and change trend of the preset resource pool. Based on the state change impact and resource status value, the resource allocation probability of each node is updated to ensure that resource allocation can respond to changes in the device status and the preset resource pool status in real time, and improve the flexibility and accuracy of resource allocation.
[0061] It is understandable that, since existing solutions often lack real-time and intelligence and cannot be dynamically adjusted according to changes in equipment requirements and changes in resource supply and demand conditions, step S03 is performed to regularly update the adjustment of resource allocation probability according to changes in equipment status and preset resource pool status, respond in real time to changes in equipment requirements and changes in resource supply and demand conditions, and achieve real-time and intelligent resource allocation.
[0062] In a feasible implementation, in step S01, the device node includes various attributes, and the step of calculating the device status score set of each device node includes steps A01-A02:
[0063] Step A01, for any one of the attributes, calculating the attribute weight corresponding to the attribute, where the attribute weight is determined by the priority influencing factor when the attribute allocates resources to the device node;
[0064] It should be noted that in the super object model, distributed devices contain multi-dimensional attribute information, such as device hardware configuration, network status, geographic location, etc. The attribute set of the super object model is:
[0065]
[0066] in, Indicates the device’s To optimize resource allocation, different attribute weights are assigned to each attribute (such as network status, CPU usage, geographic location, etc.). , attribute weight satisfy:
[0067]
[0068] Attribute weight refers to the importance of each attribute in evaluating the status of distributed devices. The larger the value, the greater the impact of the attribute on the priority of distributed device resource allocation. The influencing factor refers to various factors that affect the calculation of attribute weight, such as the importance, reliability, stability, etc. of the attribute. These factors jointly determine the priority of the attribute in resource allocation.
[0069] In addition, it should be noted that when determining the attribute weights of each attribute, first clarify all relevant attributes of the distributed device, including the performance parameters, energy consumption, reliability, maintenance cost, etc. of the device, and analyze the degree of influence of each attribute on the priority of distributed device resource allocation based on the operating requirements and business objectives of the distributed device. Use quantitative methods such as hierarchical analysis method (AHP), fuzzy comprehensive evaluation method or principal component analysis method to determine the attribute weights. The determination process includes constructing a comparison matrix between attributes, and deriving the relative weight of each attribute through mathematical operations. After the weights are preliminarily determined, they are output to the developer and put into use after determining that the attribute weight distribution is reasonable and in line with the business logic. At the same time, continuously collect the operating data and related attribute values of the distributed device. When the change in the attribute value exceeds a certain threshold, the equipment failure rate increases, or the business demand changes, recalculate the weight. When the equipment has a serious failure or the business demand changes drastically, notify the developer to manually intervene to ensure the rationality of the weight adjustment.
[0070] Step A02, normalize each attribute, obtain a device status score of the device node based on the normalized attributes and the attribute weights corresponding to each attribute, and integrate the device status scores of each device node to obtain a device status score set.
[0071] It should be noted that for each device node, each attribute is normalized, and the device status score of the device node is calculated by combining the corresponding attribute weights of each attribute. The calculation formula for the device status score is:
[0072]
[0073] Among them, S is the device status score, For attributes Normalization function. Normalization refers to converting attribute values of different dimensions and different value ranges to the same scale so that their value range is in the range of [0, 1] for comparison and calculation. Its methods include but are not limited to linear normalization, minimum-maximum normalization, Z-score normalization, etc.
[0074] In this implementation, by calculating the attribute weights, a quantitative assessment of the importance of the attributes is achieved, which provides a basis for subsequent device status scoring and helps to achieve smarter resource allocation. By normalizing the attributes, the dimensional differences between different attributes are eliminated. At the same time, the score calculation is combined with the attribute weights to more accurately reflect the actual status and priority of the device attributes, making the device status scoring more accurate and reliable.
[0075] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2In step S02, the step of calculating the resource allocation probability of the device node based on the device status score set includes steps S11 to S12:
[0076] Step S11, determining a device status score corresponding to a device node in a device status score set;
[0077] It should be noted that the resources to be allocated in the preset resource pool are identified and determined, and after each resource to be allocated is determined, the device nodes requesting these resources to be allocated are further detected, and the device status scores corresponding to these device nodes are obtained in the device status score set.
[0078] Step S12: taking the ratio of the device status score to the device status score set as the resource allocation probability of the device node, where the resource allocation probability is used to indicate the priority of the device node in acquiring resources.
[0079] It should be noted that, based on step S11, for each resource to be allocated, the resource allocation probability corresponding to any device node requesting the resource to be allocated is calculated according to the device status scores corresponding to all device nodes. The calculation formula for the resource allocation probability is:
[0080]
[0081] in, Assign probability to resources, satisfying:
[0082]
[0083] This probability reflects the possibility of a device node obtaining the required resources during the resource allocation process. Score the device status of each device node, , The total number of device nodes for the current request to allocate resources.
[0084] In addition, it should be noted that when calculating the probability of resource allocation, the system may choose to combine multiple algorithms or models, such as a weight-based allocation strategy, a priority-based allocation strategy, etc., to ensure that resources can be allocated according to predetermined rules and logic.
[0085] In this implementation, by accurately identifying the resources to be allocated and the device nodes requesting the resources to be allocated, and combining the device status score, the system can more accurately understand the actual situation and needs of the device, and provide strong support for subsequent resource allocation. By introducing the concept of resource allocation probability, the system can dynamically adjust and optimize the resource allocation strategy according to the actual situation and needs of the device, which can not only improve the efficiency and accuracy of resource allocation, but also ensure that high-scoring devices obtain resources first, thereby achieving fair allocation and maximum utilization of resources to a certain extent.
[0086] In a feasible implementation manner, in step S02, there are resources to be allocated in the preset resource pool, and the step of allocating resources to each device node according to the resource allocation probability corresponding to each device node includes steps B01-B02:
[0087] Step B01, when the amount of resources to be allocated is higher than the resource demand of each device node, determine the probability distribution of resource allocation probability corresponding to each device node, randomly select a device node based on the probability distribution, and allocate the resources to be allocated to the selected device node;
[0088] It should be noted that resource demand refers to the number of resource demands of device nodes that can meet all current resource requests. It is used to determine whether the current resources to be allocated are sufficient. When the number of resources to be allocated is higher than the resource demand of each device node, it means that the current resources to be allocated are sufficient. A probability distribution model is constructed based on the resource allocation probability of each device node. The probability distribution model reflects the possibility of each node selecting the resources to be allocated. The system uses the probability distribution model to randomly select a device node as the recipient of resource allocation. This random selection process is not a simple equal probability extraction, but a weighted extraction based on the resource allocation probability of each node to ensure that nodes with high probability have a higher chance of being selected. Once a node is selected, the system will allocate resources to the node. After meeting the resource demand of the node, the extraction will continue until all device nodes have met the resource demand.
[0089] For example, assume that there are three device nodes A, B, and C in the system, and their resource allocation probabilities are 0.6, 0.3, and 0.1, respectively. When resources are sufficient, the system builds a probability distribution model based on these probabilities. During a resource allocation process, the system randomly selects a node based on the probability distribution model. Since node A has the highest resource allocation probability (0.6), node A has the greatest chance of being selected. If node A is selected, the system will allocate the required unallocated resources to node A. If resources are still sufficient, the system will repeat this process until all resources are allocated or all nodes have obtained sufficient resources. In this process, nodes B and C also have the opportunity to be selected and allocated resources, but their resource allocation probabilities are lower, so their chances of being selected are relatively small.
[0090] Step B02: when the amount of resources to be allocated is lower than the resource demand of each device node, allocate each resource to be allocated to each device node in descending order according to the resource allocation probability corresponding to each device node.
[0091] It should be noted that when the resources to be allocated are not sufficient to meet the resource demand quantity of all device nodes currently requesting resources, it means that the current resources to be allocated are insufficient. The system will allocate resources to each device node in descending order according to the calculated resource allocation probability. Specifically, the system will first allocate resources to the device node with the highest allocation probability until the resources are exhausted or the node's demand is met, and then allocate the remaining resources to the node with the second highest allocation probability, and so on.
[0092] For example, assume that there are three device nodes A, B, and C in the system, and their resource allocation probabilities are 0.7, 0.2, and 0.1, respectively, and the current system has only enough resources for two nodes. According to step B01, the system will first allocate resources to node A. If the demand of node A is not fully met, the allocation will continue until the resources are exhausted or the demand of node A is met; then, the system will allocate the remaining resources (if any) to node B, while node C may not be allocated due to insufficient resources.
[0093] In this implementation, by introducing resource allocation probability and dynamic adjustment mechanism, intelligent and balanced allocation of resources among multiple device nodes is achieved. When resources are limited, device nodes with high resource allocation probability can obtain resources first, ensuring that device nodes with high priority obtain resources first. At the same time, the decreasing allocation strategy reduces resource waste and improves the overall resource utilization efficiency of the system. When resources are sufficient, random sampling through probability distribution is used to achieve balanced allocation of resources among multiple nodes, avoiding excessive concentration of resources. Although the allocation is random, the priority of each node can still be reflected through probability distribution, ensuring that key nodes can also obtain relatively more resources in random allocation.
[0094] Based on the first and second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those of the first and second embodiments can be referred to the above description, and will not be described in detail later. Figure 3 In step S03, before the step of adjusting the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, steps S21-S22 are also included:
[0095] Step S21, obtaining the state change amount of each attribute in the device node within a preset time step, and combining the attribute weight corresponding to each attribute to obtain the state change impact amount of the device node;
[0096] It should be noted that, through the OPC UA protocol, the status of each attribute in each device node is continuously monitored and obtained within a preset time step. The status set of each attribute is expressed as:
[0097]
[0098] in, represents the preset time step, Represents the state set of each attribute, The attribute state of the preset time step is set for the distributed device. Based on the state of each attribute within the preset time step, the state change of each attribute is calculated. The calculation formula of the state change is:
[0099]
[0100] in, is the state change, For properties at a preset time step The attribute status of The last preset time step for the attribute These state changes reflect the performance fluctuations or state migration of distributed devices in a specific time period.
[0101] After calculating the state change of each attribute, the state change impact of the device node is calculated based on the corresponding attribute weight of each attribute. The calculation formula for the state change impact is:
[0102]
[0103] in, The state change impact is a comprehensive indicator used to measure the overall state change degree of the device node within a preset time step. is the attribute weight corresponding to the attribute, is the state change amount.
[0104] Step S22, obtaining a resource status value of the preset resource pool based on the resource balance amount of the preset resource pool within the preset time step, the newly added resource amount to be allocated, the resource allocation amount and the preset resource balance equation.
[0105] It should be noted that the resource balance amount, the newly added resource amount to be allocated, and the resource allocation amount of the preset resource pool within the preset time step are obtained, wherein the resource balance amount refers to the balance state of each resource to be allocated in the preset resource pool, and the expression of the resource balance amount is:
[0106]
[0107] in, is the balance state of each resource to be allocated in the preset resource pool, that is, the resource balance amount. is the total amount of all resources to be allocated in the current preset resource pool. It is the total amount of resources to be allocated requested by all device nodes at the preset time step t.
[0108] In addition, it should be noted that the newly added resources to be allocated refer to the resources newly added to the resource pool and waiting to be allocated, and the resource allocation refers to the resources allocated to the device node, reflecting the resource outflow of the resource pool in the current time step. The resource balance amount, the newly added resources to be allocated and the resource allocation amount are substituted into the preset resource balance equation. The preset resource balance equation refers to a mathematical model used to describe the change of the resource pool state. It calculates the resource state value of the resource pool in the preset time step according to parameters such as the resource balance amount, the newly added resources to be allocated and the resource allocation amount. The expression of the preset resource balance equation is:
[0109]
[0110] in, Indicates the resource balance amount, Indicates the amount of new resources to be allocated. Indicates the resource allocation amount, It is the resource status value, that is, the resource balance value of the next preset time step, which is used to ensure that the resources to be allocated in the resource pool are in a dynamic balance state.
[0111] In this implementation, through the introduction of the OPC UA protocol and attribute weights, automatic and dynamic monitoring and evaluation of device status are achieved, the accuracy of state change evaluation is improved, and the system can more accurately identify attribute changes that have a greater impact on the overall performance of the device. By introducing a preset resource balance equation and dynamically calculating the change in resource status, dynamic monitoring and adjustment of the resource allocation process are achieved, ensuring that the resource pool remains in a relatively stable state during the resource allocation process.
[0112] In a feasible implementation manner, in step S03, the resource allocation probability is adjusted according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and the adjusted resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step. The steps include steps C01~C02:
[0113] Step C01, when the state change impact amount does not meet the preset state change threshold or the resource state value does not meet the preset resource state threshold, obtain the state impact weight corresponding to the state change impact amount and the resource state weight corresponding to the resource balance amount;
[0114] It should be noted that when the state change impact does not meet the preset state change threshold or the resource state value does not meet the preset resource state threshold, it indicates that the resource allocation probability needs to be readjusted. The preset state change threshold ( ) is used to determine whether the device node status change is significant enough to require resource allocation adjustment. , that is, when the state change impact does not meet the preset state change threshold, it means that the state of the current device node has changed significantly, so the resource allocation probability needs to be readjusted, and the preset resource state threshold ( ) is used to determine whether the resource pool status meets the current demand. , that is, when the resource status value is less than the resource lower limit threshold, it means that the resource status in the current resource pool is tight. At this time, it is necessary to reduce the allocation probability of some device nodes. , that is, when the resource status value is greater than the resource upper limit threshold, it means that the resource status in the current resource pool is too idle and there are many unallocated resources that are not used. At this time, it is necessary to increase the allocation probability of some device nodes to make full use of the resources.
[0115] In addition, it should be noted that when it is determined that the resource allocation probability needs to be readjusted, it is first necessary to obtain the state impact weight corresponding to the state change impact amount and the resource state weight corresponding to the resource balance amount. The state impact weight is used to measure the impact of the device state change on resource allocation. When the device load increases significantly, its state impact weight will also increase accordingly. The resource state weight is used to measure the impact of the resource pool state on resource allocation. When the remaining resources in the resource pool are tight, its resource state weight will increase accordingly. When the remaining resources in the resource pool are idle, its resource state weight will decrease accordingly.
[0116] Step C02, combining the resource allocation probability corresponding to the device node within the preset time step, the state change impact, the state impact weight, the resource balance amount and the resource state weight, obtains a new resource allocation probability, and uses the new resource allocation probability as the resource allocation probability corresponding to the device node for the next preset time step.
[0117] It should be noted that the resource allocation probability, state change impact, state impact weight, resource balance and resource state weight corresponding to the device node within the preset time step are obtained, and the new resource allocation probability is calculated. The calculation formula is:
[0118]
[0119] in, is the new resource allocation probability, which is used as the resource allocation probability for the next preset time step. The probability of resource allocation corresponding to the device node within the current preset time step, is the state influence weight, is the influence of state change, is the resource status weight, The resource balancing amount.
[0120] In this implementation, by introducing state impact weights and resource state weights, the system can respond to changes in device state and resource state more flexibly, thereby making more intelligent allocation decisions, significantly improving the accuracy and flexibility of resource allocation, and by dynamically adjusting the resource allocation probability, the system can more effectively utilize resources, reduce resource waste, and significantly improve resource utilization efficiency and equipment performance.
[0121] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the resource allocation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0122] This application also provides a resource allocation device, please refer to Figure 4 , applied to a distributed network, the distributed network includes various device nodes, and the resource allocation device includes:
[0123] The scoring calculation module 10 is used to calculate the device status scoring set of each device node;
[0124] The resource allocation module 20 is used to calculate the resource allocation probability of the device node based on the device status score set for any device node among the device nodes, and allocate resources to each device node according to the resource allocation probability corresponding to each device node;
[0125] The probability adjustment module 30 is used to adjust the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and use the adjusted resource allocation probability as the resource allocation probability corresponding to the device node in the next preset time step.
[0126] Optionally, the device node includes various attributes, and the score calculation module 10 is further used to:
[0127] For any attribute among the attributes, the attribute weight corresponding to the attribute is calculated, and the attribute weight is determined by the priority influencing factor when the attribute allocates resources to the device node;
[0128] Each attribute is normalized, and based on the normalized attributes and the attribute weights corresponding to each attribute, the device status score of the device node is obtained, and the device status scores of each device node are integrated to obtain a device status score set.
[0129] Optionally, the resource allocation module 20 is further configured to:
[0130] Determine a device status score corresponding to the device node in the device status score set;
[0131] The ratio of the device status score to the device status score set is used as the resource allocation probability of the device node. The resource allocation probability is used to indicate the priority of the device node in obtaining resources.
[0132] Optionally, there are resources to be allocated in the preset resource pool, and the resource allocation module 20 is further used to:
[0133] In the case where the amount of resources to be allocated is higher than the resource demand of each device node, determining the probability distribution of resource allocation probability corresponding to each device node, randomly selecting a device node based on the probability distribution, and allocating the resources to be allocated to the selected device node;
[0134] When the amount of resources to be allocated is lower than the resource demand of each device node, each resource to be allocated is allocated to each device node in descending order according to the resource allocation probability corresponding to each device node.
[0135] Optionally, the resource allocation device further includes a state acquisition module 40, and the state acquisition module 40 is used to:
[0136] Obtain the state change of each attribute in the device node within the preset time step, and obtain the state change impact of the device node by combining the corresponding attribute weights of each attribute;
[0137] The resource state value of the preset resource pool is obtained based on the resource balance amount of the preset resource pool within the preset time step, the newly added resource amount to be allocated, the resource allocation amount and the preset resource balance equation.
[0138] Optionally, the probability adjustment module 30 is further used for:
[0139] When the state change impact does not meet the preset state change threshold or the resource state value does not meet the preset resource state threshold, the state change impact weight corresponding to the state change impact and the resource balance weight corresponding to the resource state are obtained;
[0140] The new resource allocation probability is obtained by combining the resource allocation probability corresponding to the device node within the preset time step, the state change impact, the state impact weight, the resource balance amount and the resource state weight, and the new resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step.
[0141] The resource allocation device provided by the present application adopts the resource allocation method in the above embodiment to solve the technical problem of how to intelligently allocate resources. Compared with the prior art, the beneficial effects of the resource allocation device provided by the present application are the same as the beneficial effects of the resource allocation method provided by the above embodiment, and other technical features in the resource allocation device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0142] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the resource allocation method in the above-mentioned embodiment 1.
[0143] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), PMPs (Portable Media Players: portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0144] like Figure 5 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0145] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0146] The electronic device provided by the present application adopts the resource allocation method in the above embodiment to solve the technical problem of how to intelligently allocate resources. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the resource allocation method provided by the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0147] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0148] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0149] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the resource allocation method in the above-mentioned embodiment.
[0150] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0151] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0152] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the resource allocation device is applied to a distributed network, which includes various device nodes and can calculate the device status score set of each device node; for any device node among the device nodes, the resource allocation probability of the device node is calculated based on the device status score set, and resources are allocated to each device node according to the resource allocation probability corresponding to each device node; the resource allocation probability is adjusted according to the impact of the state change of the device node within a preset time step and the resource status value of the preset resource pool, and the adjusted resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step.
[0153] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0154] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0155] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0156] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned resource allocation method, and can solve the technical problem of how to intelligently allocate resources. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the resource allocation method provided in the above-mentioned embodiment, and will not be repeated here.
[0157] The present application also provides a computer program product, including a computer program, which implements the steps of the resource allocation method as described above when the computer program is executed by a processor.
[0158] The computer program product provided by this application can solve the technical problem of how to intelligently allocate resources. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the resource allocation method provided by the above embodiment, which will not be repeated here.
[0159] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A resource allocation method, characterized in that: Applied to a distributed network, the distributed network is constructed by mapping a super object model to an OPC UA architecture through an OPC UA protocol, and the distributed network includes various device nodes. The resource allocation method includes: Calculate a device status score set for each device node, where the device status score is a comprehensive score calculated based on various attributes of the distributed device, such as hardware configuration, network status, and geographic location; For any one of the device nodes, calculating the resource allocation probability of the device node based on the device status score set, and allocating resources to the device nodes according to the resource allocation probability corresponding to the device nodes; The resource allocation probability is adjusted according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and the adjusted resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step.
2. The resource allocation method according to claim 1, characterized in that: The device node contains various attributes, and the step of calculating the device status score set of each device node includes: For any one of the attributes, calculating an attribute weight corresponding to the attribute, wherein the attribute weight is determined by an impact factor of the priority when the attribute allocates resources to the device node; The attributes are normalized, and based on the normalized attributes and the attribute weights corresponding to the attributes, a device status score of the device node is obtained, and the device status scores of the device nodes are integrated to obtain a device status score set.
3. The resource allocation method according to claim 1, characterized in that: The step of calculating the resource allocation probability of the device node based on the device status score set comprises: Determining a device status score corresponding to the device node in the device status score set; The ratio of the device state score to the device state score set is used as the resource allocation probability of the device node, and the resource allocation probability is used to indicate the priority of the device node in acquiring resources.
4. The resource allocation method according to claim 1, characterized in that: There are resources to be allocated in the preset resource pool, and the step of allocating resources to each device node according to the resource allocation probability corresponding to each device node includes: In a case where the amount of the resources to be allocated is higher than the resource demand of each device node, determining a probability distribution of resource allocation probabilities corresponding to each device node, randomly selecting a device node based on the probability distribution, and allocating the resources to be allocated to the selected device node; In the case that the amount of the resources to be allocated is lower than the resource demand of each device node, the resources to be allocated are allocated to each device node in descending order according to the resource allocation probability corresponding to each device node.
5. The resource allocation method according to claim 1, characterized in that: Before the step of adjusting the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, the step further includes: Obtaining a state change amount of each attribute in the device node within a preset time step, and obtaining a state change impact amount of the device node in combination with an attribute weight corresponding to each attribute; The resource state value of the preset resource pool is obtained based on the resource balance amount, the newly added resource amount to be allocated, the resource allocation amount and the preset resource balance equation of the preset resource pool within the preset time step.
6. The resource allocation method according to claim 5, characterized in that: The step of adjusting the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and using the adjusted resource allocation probability as the resource allocation probability corresponding to the device node at the next preset time step includes: When the state change impact amount does not meet the preset state change threshold or the resource state value does not meet the preset resource state threshold, obtaining the state impact weight corresponding to the state change impact amount and the resource state weight corresponding to the resource balance amount; A new resource allocation probability is obtained by combining the resource allocation probability corresponding to the device node within a preset time step, the state change impact, the state impact weight, the resource balance amount and the resource state weight, and the new resource allocation probability is used as the resource allocation probability corresponding to the device node in the next preset time step.
7. A resource allocation device, characterized in that: Applied to a distributed network, the distributed network is constructed by mapping a super object model to an OPC UA architecture through an OPC UA protocol, the distributed network includes various device nodes, and the resource allocation device includes: A scoring calculation module, used to calculate a device status score set for each device node, wherein the device status score is a comprehensive score calculated based on various attributes of the hardware configuration, network status, and geographical location of the distributed device; A resource allocation module, configured to calculate, for any one of the device nodes, a resource allocation probability of the device node based on the device status score set, and allocate resources to the device nodes according to the resource allocation probability corresponding to the device nodes; The probability adjustment module is used to adjust the resource allocation probability according to the impact of the state change of the device node within the preset time step and the resource state value of the preset resource pool, and use the adjusted resource allocation probability as the resource allocation probability corresponding to the device node in the next preset time step.
8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the resource allocation method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the resource allocation method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the resource allocation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Tree-based resource distribution method
CN108416615A