Resource allocation method and device, electronic equipment and storage medium

By acquiring and analyzing multivariate time series data and spatial relationship data of edge computing nodes, using resource estimate models to predict future demands, and dynamically adjust resource allocation, the problem of uneven resource allocation of edge computing nodes in the power Internet of Things is solved, and the problem of improved resource allocation is improved System operation efficiency and stability.

CN119088570APending Publication Date: 2024-12-06CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411316518.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In the power Internet of Things, the resource allocation method of edge computing nodes has problems such as resource tightness and uneven allocation, especially in peak load situations.

Method used

By obtaining multivariate time series data and spatial relationship data of each edge computing node, use a pre-trained resource estimate model to predict future resource requirements, and dynamically adjust resource allocation, including horizontal or vertical expansion, or reduce resources.

Benefits of technology

The dynamic allocation of edge computing node resources is realized, which avoids the problems of resource tightness and uneven allocation, improves the overall operating efficiency and stability of the system, and ensures efficient utilization of resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088570A_ABST
    Figure CN119088570A_ABST
Patent Text Reader

Abstract

The invention discloses a resource allocation method and device, electronic equipment and a storage medium, and relates to the technical field of power equipment. The method comprises the following steps: acquiring multivariable time sequence data acquired based on each edge computing node and spatial relationship data among the edge computing nodes; wherein the multivariable time series data comprises power load data, power equipment state data and resource use data of each edge computing node, wherein the power load data and the power equipment state data are continuously collected on the basis of each edge computing node; on the basis of the multivariable time sequence data and the spatial relationship data between the edge computing nodes, utilizing a pre-trained resource estimation model to predict resource requirements of the edge computing nodes in a future time period; and dynamically adjusting the resource allocation of each edge computing node according to the resource demand of each edge computing node. According to the invention, the dynamic allocation of the resources of the edge computing nodes is realized, and the problem of resource shortage or uneven allocation is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power equipment, and in particular to a resource allocation method, device, electronic equipment and storage medium. Background Art

[0002] With the rapid development and application of Internet of Things (IoT) technology, the power IoT has become an important technical means in the power industry. Through the power IoT, real-time monitoring, intelligent management and optimized scheduling of various equipment and resources in the power system can be achieved, thereby improving the overall operating efficiency and stability of the power system. In the power IoT architecture, edge computing, as a distributed computing mode, can perform real-time data processing and decision-making close to the data source, reduce data transmission delays, and effectively alleviate the load pressure of the cloud computing center. Therefore, the role of edge computing nodes in the power IoT is becoming increasingly important.

[0003] The resources of edge computing nodes are limited and are usually allocated to each application or device according to a pre-set share, so that the resources of the edge computing nodes that can be used by each application or device are fixed. This resource allocation method has certain shortcomings, that is, it is easy to have resource shortages or uneven distribution under peak load conditions. Therefore, a new resource allocation method is urgently needed. Summary of the invention

[0004] The present invention provides a resource allocation method, device, electronic equipment and storage medium.

[0005] According to another aspect of the present invention, there is provided a resource allocation method, comprising:

[0006] Acquire multivariate time series data collected based on each edge computing node and spatial relationship data between each edge computing node; wherein the multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node;

[0007] Based on multivariate time series data and spatial relationship data between edge computing nodes, the resource demand of each edge computing node in the future time period is predicted using a pre-trained resource estimation model.

[0008] Dynamically adjust the resource allocation of each edge computing node according to the resource requirements of each edge computing node.

[0009] According to another aspect of the present invention, there is provided a resource allocation device, comprising:

[0010] A data acquisition module, used to acquire multivariate time series data collected based on each edge computing node and spatial relationship data between each edge computing node; wherein the multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node;

[0011] The prediction module is used to predict the resource requirements of each edge computing node in the future time period based on the multivariate time series data and the spatial relationship data between each edge computing node, using the pre-trained resource estimation model;

[0012] The resource adjustment module is used to dynamically adjust the resource allocation of each edge computing node according to the resource requirements of each edge computing node.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to at least one processor; wherein,

[0016] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the resource allocation method according to the embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource allocation method according to an embodiment of the present invention when executed.

[0018] The technical solution of the embodiment of the present invention realizes the dynamic allocation of resources of edge computing nodes in the power Internet of Things, avoiding the problem of resource shortage or uneven distribution.

[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1is a flow chart of a resource allocation method provided according to an embodiment of the present invention;

[0022] Figure 2 is a flow chart of another resource allocation method provided according to an embodiment of the present invention;

[0023] Figure 3 is a flow chart of another resource allocation method provided according to an embodiment of the present invention;

[0024] Figure 4 is a structural schematic diagram of a resource allocation device provided according to an embodiment of the present invention;

[0025] Figure 5 It is a structural diagram of an electronic device for implementing the resource allocation method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0027] Embodiment 1

[0028] Figure 1 A flowchart of a resource allocation method is provided for an embodiment of the present invention. This embodiment is applicable to scenarios in which resources of edge computing nodes in an electric power Internet of Things are dynamically allocated. The method can be executed by a resource allocation device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device.

[0029] like Figure 1 As shown, the resource allocation method includes:

[0030] S101. Acquire multivariate time series data collected by each edge computing node and spatial relationship data between each edge computing node.

[0031] In an embodiment of the present invention, multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node that are continuously collected based on each edge computing node. Among them, the power load data is used to reflect the power consumption of the edge computing node, which may be related to the operating status, power consumption mode, and coordination with other devices of the edge computing node. Exemplary power equipment includes smart meters, smart switches, transformers, etc.; power equipment status data may optionally include electrical parameters of the equipment (such as voltage, current, power, etc.), temperature parameters, insulation parameters, etc., which are not listed here one by one. The resources of the edge computing node include computing resources (such as CPU processor resources, memory resources), network bandwidth resources, storage resources, etc.; and the resource usage data can be CPU usage, network bandwidth usage, memory usage, etc.

[0032] The spatial relationship data between each edge computing node can be represented by the adjacency matrix of the edge computing node. Each element value in the adjacency matrix is ​​used to measure the spatial connection relationship between two edge computing nodes. For example, a value of 1 indicates that there is a connection relationship between the two edge computing nodes, and a value of 0 indicates that there is no connection relationship between the two edge computing nodes.

[0033] S102: Based on the multivariate time series data and the spatial relationship data between the edge computing nodes, the resource demand of each edge computing node in the future time period is predicted using a pre-trained resource estimation model.

[0034] In an embodiment of the present invention, the pre-trained resource estimation model may be a deep learning model or a machine learning model, which is not specifically limited here. The pre-trained resource estimation model can predict the resource requirements of each edge computing node in the future time period based on the multivariate time series data and the spatial relationship data between each edge computing node. Among them, the future time period refers to a preset duration starting from the current time point, and the size of the preset duration can be determined according to actual needs. The predicted resource requirements of the edge computing node can be exemplarily represented by the CPU usage rate, memory usage rate, and network bandwidth usage rate in the future time period. For example, the CPU usage rate in the future time period is larger than the current one, indicating that the CPU resources required in the future time period are larger; in addition, the power load of the edge computing node in the future time period can also be predicted. Since a high power load may mean a high demand for computing resources, the resource allocation of the edge computing node can be adjusted according to the power load of the edge computing node in the future time period.

[0035] In an optional implementation, based on multivariate time series data and spatial relationship data between edge computing nodes, a pre-trained resource estimation model is used to predict resource requirements of each edge computing node in future time periods, including: preprocessing the multivariate time series data and the spatial relationship data between edge computing nodes; wherein the preprocessing includes data cleaning and standardization; and using a pre-trained resource estimation model to predict the preprocessed multivariate time series data and the spatial relationship data between edge computing nodes to obtain the resource requirements of each edge computing node in future time periods.

[0036] It can be understood that by performing data cleaning and standardization on the multivariate time series data and the spatial relationship data between the edge computing nodes, the processed data is more accurate and can meet the requirements of the resource estimation model for input data.

[0037] S103. Dynamically adjust resource allocation of each edge computing node according to the resource requirements of each edge computing node.

[0038] Optionally, if the resource demand of any edge computing node is greater than the current resource supply of the edge computing node, the resources of the edge computing node are increased by horizontal expansion or vertical expansion; wherein, increasing the resources of the edge computing node by horizontal expansion includes: adding virtual machines or container instances to share the load; increasing the resources of the edge computing node by vertical expansion includes: directly increasing the number of CPU cores, memory or network bandwidth in the edge computing node.

[0039] If the resource demand of any edge computing node is less than the current resource supply of the edge computing node, the resources of the edge computing node are reduced by reducing instances or lowering resource configuration.

[0040] In this way, the above operations can realize dynamic adjustment of edge computing node resources.

[0041] In addition, based on the predicted resource requirements of each edge computing node in the future time period, a load balancing strategy can be adopted, such as redistributing processing tasks among multiple edge computing nodes to ensure that the processing tasks of high-load edge settlement nodes can be processed on edge computing nodes with surplus resources (i.e., edge computing nodes with lower loads). Load balancing algorithms (such as weighted polling or minimum connection number algorithms) can be introduced to redistribute processing tasks. In addition, since the migration of processing tasks may involve data transmission delays and broadband overhead, the migration cost of the processing tasks to be migrated can be calculated, and then whether to migrate can be determined based on the migration cost.

[0042] The present invention continuously collects data such as the power load, power equipment status, and computing resource usage of each edge computing node, and uses a trained resource estimation model to accurately predict resource requirements (such as power load, CPU usage, and memory usage) in the future time period, thereby knowing in advance possible resource bottlenecks or overloads. On this basis, the resource allocation of each edge node is dynamically adjusted to respond to the changing needs of the system load in real time, avoiding waste of resources and performance degradation, and improving the overall operating efficiency and stability of the system. Through this method, it can better adapt to the complex application scenarios in the power Internet of Things and achieve efficient use of resources.

[0043] Furthermore, in addition to adjusting the resources of the edge computing nodes according to the predicted resource requirements, resources can also be adjusted according to the current load conditions of the edge computing nodes; for example, when the current load fluctuations change dramatically, the resource allocation of the edge computing nodes is adjusted through preset rules or optimization algorithms.

[0044] Embodiment 2

[0045] Figure 2 A flowchart of a resource allocation method is provided for an embodiment of the present invention. Figure 2 , the method comprises the following steps:

[0046] S201. Acquire multivariate time series data collected by each edge computing node and spatial relationship data between the edge computing nodes.

[0047] Among them, the multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node.

[0048] S202. Preprocess the multivariate time series data and the spatial relationship data between the edge computing nodes; wherein the preprocessing includes data cleaning and standardization.

[0049] In an embodiment of the present invention, in order to estimate the resource requirements of edge computing nodes in future time periods, a resource estimation model is pre-trained. The pre-trained resource estimation model is an LSTM model, and the model structure is mainly divided into three parts, namely, a time series variational autoencoder module, a graph convolutional network module and an LSTM core module.

[0050] In an embodiment of the present invention, the time series variational autoencoder module includes an input layer, an encoder layer, a latent space sampling layer, and a decoder layer; wherein the encoder layer includes two layers of stacked LSTM units, the first layer of LSTM units may include 128 hidden units, and the second layer of LSTM units may include 64 hidden units; the latent space sampling layer may perform sampling based on a reparameterized formula; the decoder layer includes two layers of reverse LSTM units, the first layer of LSTM units includes 64 hidden units, and the second layer of LSTM units includes 128 hidden units.

[0051] In an embodiment of the present invention, the graph convolutional network module includes at least an input layer, a graph convolutional network layer (i.e., a GCN layer) and an output layer; wherein the number of graph convolutional network layers is at least two layers; exemplarily, the first GCN layer includes 64 hidden units, and the second GCN layer includes 32 hidden units.

[0052] In an embodiment of the present invention, the LSTM core module includes at least an input layer, a multi-layer LSTM unit, an attention mechanism and a prediction output layer; wherein the multi-layer LSTM unit exemplarily includes three layers, the first layer LSTM unit includes 128 hidden units; the second layer LSTM unit includes 64 hidden units; the third layer LSTM unit includes 32 hidden units; and the attention mechanism can be set between the second layer LSTM unit and the third layer LSTM unit.

[0053] Since the structure of the resource estimation model is mainly divided into three parts, the loss function of the resource estimation model is the loss function L of the time series variational autoencoder module. recon , the loss function L of the graph convolutional network module GCN , the loss function L of the LSTM core module pred composition.

[0054] Among them, the loss function L of the time series variational autoencoder module is recon represents the reconstruction loss of the time series variational autoencoder module, and the calculation formula is as follows:

[0055]

[0056] Where N is the number of samples; x i represents the i-th input sample, which represents the original value of the input data; Represents the multidimensional reconstructed data of the i-th sample; represents the absolute error, which measures the absolute error between the input value and the multidimensional reconstructed data of the i-th sample in the j-th dimension; d represents the dimension of the input sample; α1 represents the weight coefficient of the mean square error MSE term; α2 represents the weight coefficient of the MAE term; β represents the weight coefficient of the KL divergence term; D KL(q(z|x)||p(z)) represents the KL divergence, which measures the difference between the posterior distribution (z|x) of the latent representation variable z and the prior distribution p(z).

[0057] The loss function L of the time series variational autoencoder module recon , by minimizing the mean square error (MSE) and absolute error (MAE) between the input data and the reconstructed data, the resource estimation model is ensured to effectively capture and retain the key features of the input time series data. This combination of multiple losses enables the resource estimation model to not only focus on the overall numerical accuracy (MSE) when reconstructing data, but also take into account the fidelity of local details (MAE), thereby improving the robustness of the model; and by introducing the KL divergence, the model can adjust the distribution of the latent space to a predefined prior distribution, thereby avoiding overfitting and enhancing the generalization ability of the model when facing unseen data. The KL divergence term forces the latent variables to maintain a reasonable distribution, thereby improving the stability and expressiveness of the model when dealing with different data distributions.

[0058] The loss function L of the graph convolutional network module GCN Represents the spatial dependency loss of the convolutional network module, and the calculation formula is as follows:

[0059]

[0060] Where N represents the number of edge computing nodes; A ij is an element in the adjacency matrix, indicating the spatial connection relationship between edge computing node i and edge computing node j; if A ij =1, then there is a connection relationship between node i and node j, A ij = 0, there is no connection between node i and node j; h i represents the embedded representation of edge computing node i, that is, the node feature vector obtained by the graph convolutional network layer; |h i -h j | 2 represents the square of the Euclidean distance between the embedded representations of edge computing nodes i and j; γ1 represents the weight coefficient used to process disconnected edge computing nodes; ReLU(x) represents the rectified linear unit activation function, which returns x when x>0 and 0 otherwise; δ represents the threshold, which represents the minimum expected distance between disconnected edge computing nodes.

[0061] The loss function L of the graph convolutional network module GCN, by minimizing the feature differences between connected edge computing nodes, the ability of the graph convolutional network to capture the spatial dependencies between edge computing nodes is enhanced; this optimization ensures that the network can accurately reflect the real physical or logical associations between edge computing nodes when modeling spatial relationships; by applying distance control to unconnected edge computing nodes, combined with the ReLU function and threshold δ, this loss function can prevent unconnected edge computing nodes from being misjudged as having strong relationships. This mechanism effectively avoids the noise and false associations that occur in the graph convolutional network in spatial feature modeling, thereby improving the accuracy and reliability of the overall prediction.

[0062] The loss function L of the LSTM core module pred The calculation formula is as follows:

[0063]

[0064] Where T represents the number of time steps; y t represents the true target value at time step t; represents the predicted target value at time step t; represents the mean square error; λ1 represents the weight coefficient of the mean square error term; λ2 represents the weight coefficient of the SmoothL1Loss term; λ3 represents the weight coefficient of the differential loss term; represents the smooth L1 loss function; represents the time step difference loss term.

[0065] The loss function of the LSTM core module ensures the accuracy of the model in time series forecasting by optimizing the predicted values ​​for multiple future time steps. This loss function not only focuses on the deviation between the predicted value and the actual value (through MSE), but can also be combined with other weight parameters to optimize different time steps, so that the model performs better in capturing long-term and short-term dependencies.

[0066] On the basis of determining the structure and loss function of the resource estimation model, the constructed training samples can be directly used for training, and then the trained resource estimation model can be used for subsequent prediction of resource requirements of edge computing nodes. The specific prediction process can be carried out according to steps S203-S205.

[0067] S203, extracting the latent representation of the preprocessed multivariate time series data through the time series variational autoencoder module, and performing data reconstruction processing based on the latent representation to obtain multidimensional reconstructed data with the same dimension as the multivariate time series data.

[0068] In an optional implementation, since the time series variational autoencoder module includes an input layer, an encoder layer, a latent space sampling layer, and a decoder layer, the encoder layer includes at least two layers of stacked LSTM units to extract time series features from multivariate time series data, and output the mean and standard deviation of the latent space; in this embodiment, the multivariate time series data is mainly mapped to a low-dimensional latent space by at least two layers of stacked LSTM units included in the encoder layer, and the mean and standard deviation of the latent space are output; through the latent space sampling layer, the latent representation variable corresponding to the multivariate time series data is determined according to the mean and standard deviation; exemplarily, when sampling, the noise ε is directly sampled from the standard normal distribution N(0,1), and then the latent representation variable z is obtained by the reparameterization formula z=μ(z)+σ(z)*ε; wherein μ(z) represents the mean of the latent space; σ(z) represents the standard deviation of the latent space. It should be noted that in this way, the sampling operation becomes differentiable, ensuring that the gradient can be propagated back through the sampling process during the training process. Furthermore, the latent representation variable z is transformed by at least two layers of reverse LSTM units included in the decoder layer to obtain multidimensional reconstructed data. It should be noted that the reason for generating multidimensional reconstructed data is that multidimensional reconstructed data is convenient for extracting more useful features, reducing noise, reducing computational complexity, capturing complex dependencies, and improving the robustness of the model, and can obtain better prediction results and model performance than directly using the original data. Therefore, reconstructed data helps to more accurately predict future resource requirements in the dynamic resource allocation process, thereby achieving more effective resource management.

[0069] S204. Using a graph convolutional network module, extract the spatial dependencies between the edge computing nodes from the preprocessed spatial relationship data between the edge computing nodes to obtain a spatial dependency feature matrix.

[0070] In an optional implementation, the graph convolutional network module includes at least an input layer, a graph convolutional network layer and an output layer, and the number of graph convolutional network layers is at least two. On this basis, the process of obtaining the spatial dependency feature matrix includes: obtaining the spatial relationship data between each edge computing node through the input layer; wherein the spatial relationship data can be the adjacency matrix A of the edge computing node; extracting the spatial dependency features from the spatial relationship data through the graph convolutional network layer to obtain the spatial dependency feature matrix; the calculation formula of each graph convolutional network layer is as follows: H I+1 =ReLU(A*H I *W I ), where H I represents the input of layer I; W I Represents the weight matrix; finally, the spatial dependency feature matrix is ​​output through the output layer for prediction by the LSTM core module.

[0071] S205. Through the LSTM core module, the resource requirements of each edge computing node in the future time period are predicted based on the multi-dimensional reconstructed data and the spatial dependency feature matrix.

[0072] In an embodiment of the present invention, the LSTM core module includes at least an input layer, a multi-layer LSTM unit, an attention mechanism and a prediction output layer; wherein the multi-layer LSTM unit exemplarily includes three layers, the first layer LSTM unit includes 128 hidden units; the second layer LSTM unit includes 64 hidden units; the third layer LSTM unit includes 32 hidden units; and the attention mechanism can be set between the second layer LSTM unit and the third layer LSTM unit.

[0073] On this basis, through the LSTM core module, according to the multi-dimensional reconstruction data and spatial dependency feature matrix, the resource requirements of each edge computing node in the future time period are predicted, including: obtaining the multi-dimensional reconstruction data and spatial dependency feature matrix through the input layer; extracting features from the multi-dimensional reconstruction data and spatial dependency feature matrix obtained in the input layer through multi-layer LSTM units and attention mechanism; specifically, the input of the first layer LSTM unit is the reconstruction data X′; the input of the second layer LSTM unit is the output of the first layer LSTM unit and the spatial dependency feature matrix; and then, through the self-attention layer set between the second layer LSTM unit and the third layer LSTM unit, the weighted average of different time steps in the time series is calculated to strengthen the focus on key time points, and finally, the time series pattern is further extracted through the third layer LSTM unit. Finally, through the prediction output layer, according to the features extracted by the multi-layer LSTM unit and the attention mechanism, the resource requirements of each edge computing node in the future time period are predicted and output, such as predicting the power load, CPU usage, memory usage, network bandwidth usage, etc. in the future time period.

[0074] S206. Dynamically adjust resource allocation of each edge computing node according to resource requirements of each edge computing node.

[0075] In an embodiment of the present invention, an LSTM model is constructed and trained to estimate resource requirements, and the resource requirements of edge computing nodes in future time periods can be quickly and accurately predicted through this model. Then, the resource allocation of edge computing nodes is dynamically adjusted according to the resource requirements to ensure balanced resource allocation and avoid problems such as insufficient resources or waste of resources.

[0076] Embodiment 3

[0077] Figure 3 The present invention provides a flowchart of a resource allocation method. The present invention adds content of periodically dynamically adjusting the weight of the resource estimation model. Figure 3 , the method comprises the following steps:

[0078] S301, in response to the model weight dynamic adjustment operation, sampling task T from the task distribution i , each task T i Corresponding to different load modes.

[0079] In the embodiment of the present invention, the task distribution may be determined first, and the task distribution may be a set of tasks of different types predefined according to the actual application scenario. For example, in time series prediction, the task distribution may include prediction tasks of different time spans, prediction tasks of different data frequencies, etc. Further, in response to the dynamic adjustment operation of the model weight, a task T is randomly sampled from the task distribution. i Each task T i Corresponding to different load modes, the load mode can be understood as the specific requirements of the task on computing resources, data characteristics, etc.

[0080] S302: For each task T i , according to the first weight update formula, update the model parameters of the LSTM model on the support set.

[0081] In this embodiment, the first weight updating formula is: Among them, W l represents the initial parameter weight of the lth layer; W l ′ indicates that the lth layer is in task T i The updated weight; α represents the learning rate; Represents the weight W l The gradient of Indicates that in task T i The loss function on .

[0082] The specific process of updating the model parameters is as follows: For the sampled task T i , determine the support set. The support set is a set of data samples used to update the model parameters on the current task. The selection of the support set can be determined based on the characteristics of the task and the availability of data, and can usually be determined by random sampling, stratified sampling, etc. Then, the gradient descent method is used to update the model parameters on the support set. Specifically, for each layer of the LSTM model, the loss function is calculated The weight W of this layer l The loss function can be selected according to the specific objectives of the task, and the specific formula of the loss function of the present application can be found in the description of the above embodiment, which will not be traced here. Further, the weight is updated according to the gradient. The first weight update formula is Among them, α is the learning rate, which controls the step size of parameter update. By continuously iteratively updating the weights, the value of the loss function gradually decreases, thereby improving the performance of the model on the current task.

[0083] S303: Based on the multiple tasks, according to the second weight update formula, the global parameters of the LSTM model are updated using the meta-learning update rule.

[0084] Among them, the second weight update formula is: in, represents the updated global weight of the lth layer; β represents the learning rate of meta-learning; Indicates that in task T i The loss function on is calculated using the updated weights; i represents the index of all tasks.

[0085] The specific process of updating global parameters is as follows: After completing the task parameter updates of multiple tasks, the global parameters are updated. The multiple tasks here can be different tasks obtained through multiple samplings, or a set of pre-defined representative tasks. For each layer of the LSTM model, the loss function of all tasks is calculated for the updated weight W l The gradient sum of ′. Where i represents the index of all tasks. The global weight is updated based on the gradient sum. The update formula is Where β is the learning rate of meta-learning. By updating the global weights, the model can perform well on multiple tasks and has better generalization ability.

[0086] After the weights of the LSTM model (ie, the resource estimation model) are updated, resources may be dynamically allocated according to the process of steps S304-S306.

[0087] S304: Acquire multivariate time series data collected by each edge computing node and spatial relationship data between the edge computing nodes.

[0088] The multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node;

[0089] S305: Based on the multivariate time series data and the spatial relationship data between the edge computing nodes, a pre-trained resource estimation model with adjusted model weights is used to predict the resource requirements of the edge computing nodes in future time periods.

[0090] S306: Dynamically adjust resource allocation of each edge computing node according to resource requirements of each edge computing node.

[0091] In this embodiment, by dynamically adjusting the parameters of the LSTM model, the accuracy of the resource requirements predicted by the model can be guaranteed, and the rationality of the dynamic adjustment of the resource allocation of the edge computing nodes can be guaranteed.

[0092] Embodiment 4

[0093] Figure 4 This is a schematic diagram of the structure of a resource allocation device provided by an embodiment of the present invention. This embodiment is applicable to the scenario of dynamically allocating resources of edge computing nodes in the power Internet of Things. Figure 4 As shown, the device comprises:

[0094] The data acquisition module 401 is used to acquire multivariate time series data collected based on each edge computing node and spatial relationship data between each edge computing node; wherein the multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node;

[0095] Prediction module 402, used to predict resource requirements of each edge computing node in a future time period based on multivariate time series data and spatial relationship data between each edge computing node using a pre-trained resource estimation model;

[0096] The resource adjustment module 403 is used to dynamically adjust the resource allocation of each edge computing node according to the resource demand of each edge computing node.

[0097] In an optional implementation, the prediction module 402 includes:

[0098] A preprocessing unit, used to preprocess the multivariate time series data and the spatial relationship data between the edge computing nodes; wherein the preprocessing includes data cleaning processing and standardization processing;

[0099] The prediction unit is used to use the pre-trained resource estimation model to predict the pre-processed multivariate time series data and the spatial relationship data between each edge computing node to obtain the resource requirements of each edge computing node in the future time period.

[0100] In an optional implementation, the pre-trained resource estimation model is an LSTM model, including a time series variational autoencoder module, a graph convolutional network module, and an LSTM core module;

[0101] Accordingly, the prediction unit includes:

[0102] A first prediction subunit is used to extract the latent representation of the preprocessed multivariate time series data through a time series variational autoencoder module, and perform data reconstruction processing based on the latent representation to obtain multidimensional reconstructed data with the same dimension as the multivariate time series data;

[0103] The second prediction subunit is used to extract the spatial dependency between the edge computing nodes from the preprocessed spatial relationship data between the edge computing nodes through the graph convolution network module to obtain a spatial dependency feature matrix;

[0104] The third prediction subunit is used to predict the resource requirements of each edge computing node in the future time period based on the multi-dimensional reconstructed data and the spatial dependency feature matrix through the LSTM core module.

[0105] In an optional implementation, the time series variational autoencoder module includes at least an encoder layer, a latent space sampling layer, and a decoder layer;

[0106] Accordingly, the first prediction subunit is specifically used for:

[0107] The encoder layer includes at least two layers of stacked LSTM units to extract time series features from multivariate time series data and output the mean and standard deviation of the latent space;

[0108] Through the latent space sampling layer, the latent representation variables corresponding to the multivariate time series data are determined according to the mean and standard deviation;

[0109] The decoder layer includes at least two layers of reverse LSTM units, which transform the potential representation variables to obtain multi-dimensional reconstructed data.

[0110] The first prediction subunit, the graph convolutional network module at least includes an input layer, a graph convolutional network layer and an output layer, and the number of the graph convolutional network layers is at least two layers;

[0111] Accordingly, the second prediction subunit is specifically used for:

[0112] Obtain the spatial relationship data between each edge computing node through the input layer;

[0113] Through the graph convolutional network layer, the spatial dependency features are extracted from the spatial relationship data to obtain the spatial dependency feature matrix;

[0114] The spatial dependency feature matrix is ​​output through the output layer for prediction by the LSTM core module.

[0115] The first prediction subunit, the LSTM core module includes at least an input layer, a multi-layer LSTM unit, an attention mechanism, and a prediction output layer;

[0116] Accordingly, the third prediction subunit is specifically used for:

[0117] Obtain multi-dimensional reconstruction data and spatial dependency feature matrix through the input layer;

[0118] Through multi-layer LSTM units and attention mechanism, feature extraction is performed on the multi-dimensional reconstructed data and spatial dependency feature matrix obtained from the input layer;

[0119] Through the prediction output layer, based on the features extracted by the multi-layer LSTM units and the attention mechanism, the resource requirements of each edge computing node in the future time period are predicted and output.

[0120] The first prediction subunit further includes a weight updating module, which is used to:

[0121] In response to the model weight dynamic adjustment operation, sample tasks T from the task distribution i , each task T corresponds to a different load pattern;

[0122] For each task T i , according to the formula Update the model parameters of the LSTM model on the support set; where W l represents the initial parameter weight of the lth layer; W l ′ indicates that the lth layer is in task T i The updated weight; α represents the learning rate; Represents the weight W l The gradient of Indicates that in task T i The loss function on ;

[0123] Based on multiple tasks, according to the formula The global parameters of the LSTM model are updated using the meta-learning update rule; where W l new represents the updated global weight of the lth layer; β represents the learning rate of meta-learning; Indicates that in task T i The loss function on is calculated using the updated weights; i represents the index of all tasks.

[0124] In an optional implementation, the loss function is the loss function L of the time series variational autoencoder module recon , the loss function L of the graph convolutional network module GCN , the loss function L of the LSTM core module pred composition.

[0125] Among them, the loss function L of the time series variational autoencoder module is recon The formula is as follows:

[0126]

[0127] Where N is the number of samples; x i represents the i-th input sample, which represents the original value of the input data; Represents the multidimensional reconstructed data of the i-th sample; represents the absolute error, which measures the absolute error between the input value and the multidimensional reconstructed data of the i-th sample in the j-th dimension; d represents the dimension of the input sample; α1 represents the weight coefficient of the mean square error MSE term; α2 represents the weight coefficient of the MAE term; β represents the weight coefficient of the KL divergence term; D KL (q(z|x)||p(z)) represents the KL divergence, which measures the difference between the posterior distribution (z|x) of the latent representation variable z and the prior distribution p(z);

[0128] The loss function L of the graph convolutional network module GCN The formula is as follows:

[0129]

[0130] Where N represents the number of edge computing nodes; A ij is an element in the adjacency matrix, indicating the spatial connection relationship between edge computing node i and edge computing node j; h i represents the embedded representation of edge computing node i, that is, the node feature vector obtained by the graph convolutional network layer; |h i -h j | 2 represents the square of the Euclidean distance between the embedded representations of edge computing nodes i and edge computing nodes j; γ1 represents the weight coefficient used to process disconnected edge computing nodes; ReLU(x) represents the rectified linear unit activation function; δ represents the threshold, which represents the minimum expected distance between disconnected edge computing nodes;

[0131] The loss function L of the LSTM core module pred The calculation formula is as follows:

[0132]

[0133] Where T represents the number of time steps; y t represents the true target value at time step t; represents the predicted target value at time step t; represents the mean square error; λ1 represents the weight coefficient of the mean square error term; λ2 represents the weight coefficient of the SmoothL1Loss term; λ3 represents the weight coefficient of the differential loss term; represents the smooth L1 loss function; represents the time step difference loss term.

[0134] In an optional implementation, the resource adjustment module 403 is used to:

[0135] If the resource demand of any edge computing node is greater than the current resource supply of the edge computing node, increase the resources of the edge computing node by horizontal expansion or vertical expansion;

[0136] If the resource demand of any edge computing node is less than the current resource supply of the edge computing node, the resources of the edge computing node are reduced.

[0137] The resource allocation device provided in the embodiment of the present invention can execute the resource allocation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0138] Embodiment 4

[0139] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to be a controller device in a new energy vehicle. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0140] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0141] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0142] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as executing a resource allocation method.

[0143] In some embodiments, the resource allocation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the resource allocation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the resource allocation method in any other appropriate manner (e.g., by means of firmware).

[0144] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0145] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable resource allocation device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0146] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0147] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0148] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0149] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0150] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0151] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A resource allocation method, characterized in that: include: Acquire multivariate time series data collected based on each edge computing node and spatial relationship data between each edge computing node; wherein the multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node; Based on the multivariate time series data and the spatial relationship data between the edge computing nodes, using a pre-trained resource estimation model, predicting the resource demand of each edge computing node in a future time period; Dynamically adjust resource allocation of each edge computing node according to the resource requirements of each edge computing node.

2. The method according to claim 1, characterized in that The method of predicting resource requirements of each edge computing node in a future time period based on the multivariate time series data and the spatial relationship data between each edge computing node using a pre-trained resource estimation model includes: Preprocessing the multivariate time series data and the spatial relationship data between the edge computing nodes; wherein the preprocessing includes data cleaning and standardization; The pre-trained resource estimation model is used to predict the pre-processed multivariate time series data and the spatial relationship data between the edge computing nodes to obtain the resource requirements of the edge computing nodes in the future time period.

3. The method according to claim 2, characterized in that The pre-trained resource estimation model is an LSTM model, including a time series variational autoencoder module, a graph convolutional network module and an LSTM core module; Accordingly, the pre-trained resource estimation model is used to predict the pre-processed multivariate time series data and the spatial relationship data between the edge computing nodes to obtain the resource requirements of the edge computing nodes in the future time period, including: Extracting the latent representation of the preprocessed multivariate time series data through the time series variational autoencoder module, and performing data reconstruction processing based on the latent representation to obtain multidimensional reconstructed data with the same dimension as the multivariate time series data; Extracting the spatial dependency between the edge computing nodes from the preprocessed spatial relationship data between the edge computing nodes through the graph convolutional network module to obtain a spatial dependency feature matrix; Through the LSTM core module, the resource requirements of each edge computing node in a future time period are predicted based on the multi-dimensional reconstructed data and the spatial dependency feature matrix.

4. The method according to claim 3, characterized in that The time series variational autoencoder module comprises at least an encoder layer, a latent space sampling layer, and a decoder layer; Correspondingly, the potential representation of the preprocessed multivariate time series data is extracted by the time series variational autoencoder module, and data reconstruction processing is performed based on the potential representation to obtain multidimensional reconstructed data with the same dimension as the multivariate time series data, including: Performing time series feature extraction on the multivariate time series data through at least two stacked LSTM units included in the encoder layer, and outputting a mean and a standard deviation of a latent space; Determining, by a latent space sampling layer, a latent representation variable corresponding to the multivariate time series data according to the mean and the standard deviation; The latent representation variables are transformed by at least two layers of reverse LSTM units included in the decoder layer to obtain the multi-dimensional reconstructed data.

5. The method according to claim 3, characterized in that: The graph convolutional network module includes at least an input layer, a graph convolutional network layer and an output layer, and the number of the graph convolutional network layers is at least two; Correspondingly, the graph convolutional network module extracts the spatial dependency between the edge computing nodes from the preprocessed spatial relationship data between the edge computing nodes to obtain a spatial dependency feature matrix, including: Acquire spatial relationship data between each of the edge computing nodes through the input layer; Extracting spatial dependency features from the spatial relationship data through the graph convolutional network layer to obtain the spatial dependency feature matrix; The spatial dependency feature matrix is ​​output through the output layer for use by the LSTM core module for prediction.

6. The method according to claim 3, characterized in that: The LSTM core module at least includes an input layer, a multi-layer LSTM unit, an attention mechanism and a prediction output layer; Accordingly, through the LSTM core module, according to the multi-dimensional reconstructed data and the spatial dependency feature matrix, the resource requirements of each edge computing node in the future time period are predicted, including: Acquiring the multidimensional reconstruction data and the spatial dependency feature matrix through the input layer; Performing feature extraction on the multi-dimensional reconstructed data and the spatial dependency feature matrix obtained by the input layer through the multi-layer LSTM unit and the attention mechanism; Through the prediction output layer, based on the features extracted by the multi-layer LSTM unit and the attention mechanism, the resource requirements of each edge computing node in the future time period are predicted and output.

7. The method according to claim 3, characterized in that Also includes: In response to the model weight dynamic adjustment operation, sample tasks T from the task distribution i , each task T i Corresponding to different load modes; For each task T i , according to the formula Update the model parameters of the LSTM model on the support set; where W l represents the initial parameter weight of the lth layer; W′ l Indicates that the lth layer is in task T i The updated weight; α represents the learning rate; Represents the weight W l The gradient of Indicates that in task T i The loss function on ; Based on multiple tasks, according to the formula The global parameters of the LSTM model are updated using the meta-learning update rule; wherein, represents the updated global weight of the lth layer; β represents the learning rate of meta-learning; Indicates that in task T i The loss function on is calculated using the updated weights; i represents the index of all tasks.

8. The method according to claim 7, characterized in that The loss function is the loss function L of the time series variational autoencoder module. recon , the loss function L of the graph convolutional network module GCN , the loss function L of the LSTM core module pred composition. Among them, the loss function L of the time series variational autoencoder module is recon The formula is as follows: Where N is the number of samples; x i represents the i-th input sample, which represents the original value of the input data; Represents the multidimensional reconstructed data of the i-th sample; represents the absolute error, which measures the absolute error between the input value and the multidimensional reconstructed data of the i-th sample in the j-th dimension; d represents the dimension of the input sample; α1 represents the weight coefficient of the mean square error MSE term; α2 represents the weight coefficient of the MAE term; β represents the weight coefficient of the KL divergence term; D KL (q(z|x)||p(z)) represents the KL divergence, which measures the difference between the posterior distribution (z|x) of the latent representation variable z and the prior distribution p(z); The loss function L of the graph convolutional network module GCN The formula is as follows: Where N represents the number of edge computing nodes; A ij is an element in the adjacency matrix, indicating the spatial connection relationship between edge computing node i and edge computing node j; h i represents the embedded representation of edge computing node i, that is, the node feature vector obtained by the graph convolutional network layer; |h i -h j | 2 represents the square of the Euclidean distance between the embedded representations of edge computing nodes i and edge computing nodes j; γ1 represents the weight coefficient used to process disconnected edge computing nodes; ReLU(x) represents the rectified linear unit activation function; δ represents the threshold, which represents the minimum expected distance between disconnected edge computing nodes; The loss function L of the LSTM core module pred The calculation formula is as follows: Where T represents the number of time steps; y t represents the true target value at time step t; represents the predicted target value at time step t; represents the mean square error; λ1 represents the weight coefficient of the mean square error term; λ2 represents the weight coefficient of the SmoothL1Loss term; λ3 represents the weight coefficient of the differential loss term; represents the smooth L1 loss function; represents the time step difference loss term.

9. The method according to claim 1, characterized in that: Dynamically adjusting resource allocation of each edge computing node according to resource requirements of each edge computing node, including: If the resource demand of any edge computing node is greater than the current resource supply of the edge computing node, increase the resources of the edge computing node by horizontal expansion or vertical expansion; If the resource demand of any edge computing node is less than the current resource supply of the edge computing node, the resources of the edge computing node are reduced.

10. A resource allocation device, characterized in that: include: A data acquisition module, used to acquire multivariate time series data collected based on each edge computing node and spatial relationship data between each edge computing node; wherein the multivariate time series data includes power load data, power equipment status data, and resource usage data of each edge computing node continuously collected based on each edge computing node; A prediction module, configured to predict resource requirements of each edge computing node in a future time period based on the multivariate time series data and the spatial relationship data between each edge computing node using a pre-trained resource estimation model; The resource adjustment module is used to dynamically adjust the resource allocation of each edge computing node according to the resource requirements of each edge computing node.

11. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so as to enable the at least one processor to perform the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 9 when executed.