A group control method for IoT devices based on self-balancing flexible scheduling algorithm
Through the LSTM algorithm and the self-balancing flexible scheduling algorithm, the scheduling efficiency problem of IoT devices in resource-limited scenarios is solved, intelligent resource allocation and scheduling are realized, and resource utilization and equipment adaptability are improved.
Patent Information
- Application Number
- CN202410540690.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-04-30
AI Technical Summary
Traditional preset scheduling strategies cannot effectively respond to efficient use of IoT devices in resource-limited or environmentally sensitive scenarios, especially in terms of energy consumption and computing requirements, and cannot respond to environmental changes and adjust scheduling decisions in real time.
Using a self-balancing flexible scheduling algorithm based on LSTM, intelligent scheduling and resource optimization of IoT devices is achieved through control task prediction, edge node selection and task allocation, control task evaluation and dynamic adjustment of sample screening coefficients.
It realizes more intelligent scheduling decisions, avoids resource overload and waste, improves resource utilization, adapts to the heterogeneity and environmental changes of IoT devices, and ensures the adaptability and robustness of scheduling.
Smart Images

Figure CN118316963B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional model rendering, and in particular to a group control method of Internet of Things devices based on a self-balancing flexible scheduling algorithm. Background Art
[0002] With the popularization of IoT technology and the expansion of application scenarios, the number of IoT devices has shown an explosive growth trend. These devices have significant heterogeneity, including different hardware specifications, communication protocols, energy supply methods, computing power, and data processing requirements. In addition, the widespread deployment and intensive use of IoT devices place extremely high demands on energy, computing, and network resources. While pursuing efficient services, it is particularly important to maximize resource utilization and reduce energy consumption, especially in scenarios with limited resources or sensitive environments. In this case, traditional preset scheduling strategies often cannot effectively respond, and a scheduling method is needed that can perceive environmental changes in real time, respond quickly, and adjust scheduling decisions. Summary of the invention
[0003] In view of the deficiencies in the prior art, the present invention provides a method and method for group control of Internet of Things devices based on a self-balancing flexible scheduling algorithm, which solves the problems raised in the above background technology.
[0004] Step 1: Control task prediction: predict the control task details of the current time period based on the control tasks of the historical time series.
[0005] Assume that the historical control records are a time series set:
[0006] D={x1,x2,...,x t}
[0007] Among them, x t Represents the control task feature vector at time t, including timestamp, control type, control duration, etc. Given the input x at the current time step t and the hidden state h at the previous time step t-1 , the calculation process of LSTM is as follows:
[0008] Step 1: Forget gate calculation;
[0009] F t =σ(W F ·[h t-1 ,x t ]+b F )
[0010] Among them, W F 、b F Respectively represent the weight matrix and bias vector of the forget gate, [h t-1 ,xt ] represents vector concatenation, σ represents the sigmoid function;
[0011] Step 2: Input gate calculation;
[0012] I t =σ(W I ·[h t-1 ,x t ]+b I )
[0013] Among them, W I 、b I Represent the weight matrix and bias vector of the forget gate respectively;
[0014] Step 3: Candidate unit calculation:
[0015]
[0016] Among them, W C 、b C are the weight matrix and bias vector of the candidate unit state, respectively, and tanh is the hyperbolic tangent activation function;
[0017] Step 4: Update unit status;
[0018]
[0019] Where ⊙ represents element-by-element multiplication, i.e., Hadamard product. For two matrices of the same type (i.e., with the same number of rows m and columns n) A and B, where the elements of A are a ij , the element of B is b ij , then their Hadamard product C is an m×n matrix of the same size, whose element c ij Calculated according to the following rules:
[0020] c ij =a ij *b ij
[0021] Step 5: Output gate calculation;
[0022] O t =σ(W O ·[h t-1 ,x t ]+b O )
[0023] Among them, W O 、b O They are the weight matrix and bias vector of the output gate respectively;
[0024] Step 6: Generate hidden state:
[0025] h t =O t ☉tanh(C t )
[0026] Among them, h t is the output of the current time step;
[0027] Step 7: Predict the output and convert the last hidden state h of the LSTM model t Pass it to the fully connected layer to calculate the predicted value;
[0028] y t =W y *h t +b y
[0029] Among them, W y 、b y is the weight matrix and bias term of the fully connected layer, y t The number and type distribution of control tasks at predicted future time points.
[0030] Step 2: Edge node selection and task allocation: control tasks are allocated to corresponding edge servers based on prediction results and self-balancing flexible scheduling algorithm;
[0031] Step 1: Calculate the probability of edge server selection;
[0032] Several factors that affect the performance of edge servers are selected as performance indicators, and these indicators are weighted as the probability of each edge server being selected:
[0033]
[0034] ω j represents the weight of the jth performance indicator, T j represents the value of the jth performance indicator, T jmax represents the maximum value of the jth performance indicator. For indicators such as response time, the smaller the value, the better the performance. The corresponding reciprocal is taken. i represents the i-th edge server, and n represents the number of edge servers.
[0035] To ensure p i Located in the interval [0,1], the weight coefficient ω j Should meet
[0036] Step 2: Calculation of weight coefficient;
[0037] Will Represented as the feature vector x j ,but Abbreviated to matrix form p = ωT x, use the least squares method to estimate these weight coefficients, then the loss function is:
[0038]
[0039] Among them, h ω (x (j) ) represents the model's predicted value for the i-th sample, that is, the final predicted value obtained by the LSTM model, y (j) Represents the true output value of the i-th sample;
[0040] Step 3: Select the edge server to issue the control task;
[0041] After obtaining the weight coefficients, when there is a new control request, the probability of all edges being selected is calculated. Generally, we will select the edge server with the highest probability to execute a specific control instruction. However, in a real environment, sometimes the obtained probability is too small, that is, all edges are in a poor performance state. At this time, the mathematical expectation of the number of successful control is introduced to ensure the success rate of control:
[0042]
[0043] Where N represents the number of edge servers executing control task i, p j represents the control success rate of the jth edge server, Num j represents the control times of the jth edge server, E(M i ) represents the mathematical expectation of the number of successful control of the ith control task; to ensure the control success rate E(M i ) must meet the following requirements:
[0044] E(M i )≥1
[0045] According to p j Different values determine N and Num j The value of p j When it is greater than 0.5, it means that the control success rate is very high. Selecting two edge servers for control can ensure control success. j When it is less than 0.5 and greater than 0.2, it means that the control success rate is not high. At this time, the edge server with the highest success rate is selected for control. This control, p j When it is less than 0.2, it means that the control success rate is very low, and all servers execute the control command once;
[0046]
[0047] When one edge server is successfully controlled, the device sends the control result directly to the cloud, and the cloud stops the control instructions that other edges are about to execute.
[0048] Step 3: Control task evaluation: score the control results of each sample, with the main indicators being success rate, response time, resource consumption, etc.
[0049] Step 1: Determine the indicators and calculate the scores;
[0050] The performance scores of all samples can be calculated based on the weight values of each evaluation indicator in step 2:
[0051]
[0052] Among them, S i represents the total score of the i-th sample, P ij represents the performance value of the i-th sample on the j-th evaluation index, ω ij represents the weight of the i-th sample on the j-th evaluation index, and n represents the number of evaluation indicators.
[0053] Step 2: Sample screening;
[0054] Filter samples based on their total score. Set a threshold below which samples will be excluded.
[0055] Threshold=μ s -k*σ s
[0056] Among them, μ s is the average of the total scores of all samples, σ s is the standard deviation, and k is a coefficient used to determine the position of the threshold. When there are fewer samples in the early stage, the k value is set smaller to ensure that most samples are retained. When there are enough samples, the k value is increased to ensure that the deviation of the remaining samples is small.
[0057] Step 3: Threshold calculation;
[0058] The calculation formula for the mean is:
[0059]
[0060] Among them, S t represents the total score of the tth sample, and T represents the total number of samples.
[0061] The calculation formula of variance is:
[0062]
[0063] Substituting the threshold calculation formula into the formula, we can get:
[0064]
[0065] Step 4: Dynamically adjust the sample screening coefficient k to reduce the impact of subjective human factors on sample selection.
[0066] According to the calculation formula of the threshold in step 3, it can be seen that the threshold is only related to the variance (standard deviation) and the coefficient k. Therefore, the present invention designs a method based on the variance adjustment coefficient k, which can be used to reflect the degree of dispersion of sample scores and adjust the strictness of sample screening accordingly. When the variance is large, it means that the distribution of sample scores is more dispersed, and a larger k value may be required to capture more samples; on the contrary, when the variance is small, the sample scores are more concentrated, and a smaller k value can be selected to screen out samples with more stable performance.
[0067]
[0068] Among them, k0 is the initial value of k, k max is the maximum value of k, σ max is the maximum allowed standard deviation, σ min is the minimum allowed variance. This formula ensures that when the actual standard deviation σ is close to σ min When k is close to k0, and when the actual standard deviation σ is close to σ max When k is close to k max .
[0069] Considering k0, k max , σ max , σ min are all constants, and k is only related to σ. The calculation formula of the threshold can be obtained:
[0070]
[0071] Step 5: Use the latest threshold to screen samples and provide new samples for the next training.
[0072] Step 1: Calculate the mean μ of all sample scores s and standard deviation σ s ;
[0073] Step 2: Calculate the latest k according to the k value calculation formula;
[0074] Step 3: Update the threshold for sample screening;
[0075] Step 4: Screen samples according to the new threshold, and samples with scores below the threshold will be excluded;
[0076] Step 5: When a new control task is issued, use the latest sample for training calculation and repeat steps 1-4.
[0077] Beneficial effects:
[0078] 1. The present invention uses the LSTM algorithm to predict the control tasks of the time series set, providing accurate prediction values for the flexible scheduling algorithm and realizing more intelligent scheduling;
[0079] 2. The present invention uses a self-balancing flexible scheduling algorithm to reasonably allocate tasks according to the predicted value of the LSTM algorithm, the performance of the edge server, and the current state to avoid overload and waste of resources;
[0080] 3. The present invention responds to changes in server status and network conditions in real time and dynamically adjusts control task allocation through a control task evaluation system and dynamic sample screening coefficient adjustment.
[0081] 4. The present invention adopts a self-balancing flexible scheduling algorithm, fully considering the heterogeneity of IoT devices (such as processing power, communication capability, energy consumption characteristics, working mode, etc.), as well as constraints such as task priority, time limit, dependency, etc., to ensure the adaptability and robustness of the control algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] The present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0083] Figure 1 It is the operating principle diagram of the present invention. DETAILED DESCRIPTION
[0084] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0085] like Figure 1 As shown, according to one aspect of the present invention, a method for group control of Internet of Things devices based on a self-balancing flexible scheduling algorithm is provided, comprising the following steps:
[0086] Step 1: Control task prediction: predict the control task details of the current time period based on the control tasks of the historical time series.
[0087] Assume that the historical control records are a time series set:
[0088] D={x1,x2,...,x t}
[0089] Among them, x t Represents the control task feature vector at time t, including timestamp, control type, control duration and other information.
[0090] Given the input x at the current time step t and the hidden state h at the previous time stept-1 , the calculation process of LSTM is as follows:
[0091] Step 1: Forget gate calculation;
[0092] F t =σ(W F ·[h t-1 ,x t ]+b F )
[0093] Among them, W F 、b F Respectively represent the weight matrix and bias vector of the forget gate, [h t-1 ,x t ] represents vector concatenation, and σ represents the sigmoid function.
[0094] Step 2: Input gate calculation;
[0095] I t =σ(W I ·[h t-1 ,x t ]+b I )
[0096] Among them, W I 、b I Represent the weight matrix and bias vector of the forget gate respectively.
[0097] Step 3: Candidate unit calculation:
[0098]
[0099] Among them, W C 、b C are the weight matrix and bias vector of the candidate unit state, respectively, and tanh is the hyperbolic tangent activation function.
[0100] Step 4: Update unit status;
[0101]
[0102] Where ⊙ represents element-by-element multiplication, i.e., Hadamard product. For two matrices of the same type (i.e., with the same number of rows m and columns n) A and B, where the elements of A are a ij , the element of B is b ij , then their Hadamard product C is an m×n matrix of the same size, whose element c ij Calculated according to the following rules:
[0103] c ij =a ij *b ij
[0104] Step 5: Output gate calculation;
[0105] O t =σ(W O ·[h t-1 ,x t ]+b O )
[0106] Among them, W O 、b O are the weight matrix and bias vector of the output gate respectively.
[0107] Step 6: Generate hidden state:
[0108] h t =O t ☉tanh(C t )
[0109] Among them, h t is the output of the current time step;
[0110] Step 7: Predict the output and convert the last hidden state h of the LSTM model t Pass it to the fully connected layer to calculate the predicted value;
[0111] y t =W y *h t +b y
[0112] Among them, W y 、b y is the weight matrix and bias term of the fully connected layer, y t The distribution of the number or type of control tasks at the predicted future time point.
[0113] Step 2: Edge node selection and task allocation: control tasks are allocated to corresponding edge servers based on prediction results and self-balancing flexible scheduling algorithm;
[0114] Step 1: Calculate the probability of edge server selection;
[0115] Several factors that affect the performance of edge servers are selected as performance indicators, and these indicators are weighted as the probability of each edge server being selected:
[0116]
[0117] ω j represents the weight of the jth performance indicator, T j represents the value of the jth performance indicator, T jmaxIt represents the maximum value of the j-th performance indicator. For indicators such as response time, the smaller the value, the better the performance, the corresponding reciprocal is taken. i represents the i-th edge server, and n represents the number of edge servers.
[0118] To ensure p i Located in the interval [0,1], the weight coefficient ω j Should meet
[0119] Step 2: Calculation of weight coefficient;
[0120] Will Represented as the feature vector x j ,but Abbreviated to matrix form p = ω T x, use the least squares method to estimate these weight coefficients, then the loss function is:
[0121]
[0122] Among them, h ω (x (j) ) represents the model's predicted value for the i-th sample, that is, the final predicted value obtained by the LSTM model, y (j) Represents the true output value of the i-th sample.
[0123] Step 3: Select the edge server to issue the control task;
[0124] After obtaining the weight coefficients, when there is a new control request, the probability of all edges being selected is calculated. Generally, we will select the edge server with the highest probability to execute a specific control instruction. However, in a real environment, sometimes the obtained probability is too small, that is, all edges are in a poor performance state. At this time, the mathematical expectation of the number of successful control is introduced to ensure the success rate of control:
[0125]
[0126] Where N represents the number of edge servers executing control task i, p j represents the control success rate of the jth edge server, Num j represents the control times of the jth edge server, E(M i ) represents the mathematical expectation of the number of successful control of the ith control task. To ensure the control success rate E(M i ) must meet the following requirements:
[0127] E(M i )≥1
[0128] According to p j Different values determine N and Num j The value of pj When it is greater than 0.5, it means that the control success rate is very high. Selecting two edge servers for control can ensure control success. j When it is less than 0.5 and greater than 0.2, it means that the control success rate is not high. At this time, the edge server with the highest success rate is selected for control. This control, p j When it is less than 0.2, it means that the control success rate is very low, and all servers execute the control command once.
[0129]
[0130] When one edge server is successfully controlled, the device sends the control result directly to the cloud, and the cloud stops the control instructions that other edges are about to execute.
[0131] Step 3: Control task evaluation: Score the control result of each sample, with the main indicators being success rate, response time, resource consumption, etc.
[0132] Step 1: Determine the indicators and calculate the scores;
[0133] The performance scores of all samples can be calculated based on the weight values of each evaluation indicator in step 2:
[0134]
[0135] Among them, S i represents the total score of the i-th sample, P ij represents the performance value of the i-th sample on the j-th evaluation index, ω ij represents the weight of the i-th sample on the j-th evaluation index, and n represents the number of evaluation indicators.
[0136] Step 2: Sample screening;
[0137] Filter samples based on their total score. Set a threshold below which samples will be excluded.
[0138] Threshold=μ s -k*σ s
[0139] Among them, μ s is the average of the total scores of all samples, σ s is the standard deviation, and k is a coefficient used to determine the position of the threshold. When there are fewer samples in the early stage, the k value is set smaller to ensure that most samples are retained. When there are enough samples, the k value is increased to ensure that the deviation of the remaining samples is small.
[0140] Step 3: Threshold calculation;
[0141] The calculation formula for the mean is:
[0142]
[0143] Among them, S t represents the total score of the tth sample, and T represents the total number of samples.
[0144] The calculation formula of variance is:
[0145]
[0146] Substituting the threshold calculation formula into the formula, we can get:
[0147]
[0148] Step 4: Dynamically adjust the sample screening coefficient k to reduce the impact of subjective human factors on sample selection.
[0149] According to the calculation formula of the threshold in step 3, it can be seen that the threshold is only related to the variance (standard deviation) and the coefficient k. Therefore, the present invention designs a method based on the variance adjustment coefficient k, which can be used to reflect the degree of dispersion of sample scores and adjust the strictness of sample screening accordingly. When the variance is large, it means that the distribution of sample scores is more dispersed, and a larger k value may be required to capture more samples; on the contrary, when the variance is small, the sample scores are more concentrated, and a smaller k value can be selected to screen out samples with more stable performance.
[0150]
[0151] Among them, k0 is the initial value of k, k max is the maximum value of k, σ max is the maximum allowed standard deviation, σ min is the minimum allowed variance. This formula ensures that when the actual standard deviation σ is close to σ min When k is close to k0, and when the actual standard deviation σ is close to σ max When k is close to k max .
[0152] Considering k0, k max , σ max , σ min are all constants, and k is only related to σ. The calculation formula of the threshold can be obtained:
[0153]
[0154] Step 5: Use the latest threshold to screen samples and provide new samples for the next training.
[0155] Step 1: Calculate the mean μ of all sample scores s and standard deviation σs ;
[0156] Step 2: Calculate the latest k according to the k value calculation formula;
[0157] Step 3: Update the threshold for sample screening;
[0158] Step 4: Screen samples according to the new threshold, and samples with scores below the threshold will be excluded;
[0159] Step 5: When a new control task is issued, use the latest sample for training calculation and repeat steps 1-4.
[0160] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by ordinary technicians in this technical field within the essential scope of the present invention also fall within the protection scope of the present invention.
Claims
1. A method for group control of Internet of Things devices based on a self-balancing flexible scheduling algorithm, characterized in that: The following steps are involved: S1, control task prediction, predicting the control task details of the current time period based on the control tasks of the historical time series; S2, edge node selection and task allocation, assigning control tasks to corresponding edge servers based on prediction results and self-balancing flexible scheduling algorithm; S3, control task evaluation: score the control results of each sample; S4. Dynamically adjust the sample screening coefficient to reduce the impact of subjective human factors on sample selection; S5. Use the latest threshold to screen samples and provide new samples for the next training; In step S1, the control task prediction is divided into the following steps: Step 1: Forget gate calculation; in, Represent the weight matrix and bias vector of the forget gate respectively, represents vector concatenation, Represents the sigmoid function; Step 2: Input gate calculation; in, Represent the weight matrix and bias vector of the forget gate respectively; Step 3: Candidate unit calculation; in, are the weight matrix and bias vector of the candidate unit state, respectively, and is the hyperbolic tangent activation function; Step 4: Update unit status; Among them, ☉ represents element-by-element multiplication; Step 5: Output gate calculation; in, They are the weight matrix and bias vector of the output gate respectively; Step 6: Generate hidden state; in, is the output of the current time step; Step 7: Predict the output, pass the last hidden state of the LSTM model to the fully connected layer, and calculate the predicted value; in, is the weight matrix and bias term of the fully connected layer, The number and type distribution of control tasks at predicted future time points; In step S2, edge node selection and task allocation are divided into the following steps: Step 1: Calculate the probability of edge server selection; Several factors that affect the performance of edge servers are selected as performance indicators, and these indicators are weighted as the probability of each edge server being selected: in, represents the weight of the jth performance indicator, represents the value of the jth performance indicator, represents the maximum value of the jth performance indicator. For indicators such as response time, the smaller the value, the better the performance. The corresponding reciprocal is taken. i represents the i-th edge server, and n represents the number of edge servers. Step 2: Calculation of weight coefficient; will be represented as a feature vector ,but , abbreviated as matrix form , using the least squares method to estimate these weight coefficients, the loss function is: in, It represents the predicted value of the model for the i-th sample, that is, the predicted value finally obtained by the LSTM model. Represents the true output value of the i-th sample; Step 3: Select the edge server to issue the control task; After obtaining the weight coefficients, when there is a new control request, the probability of all edges being selected is calculated, and the mathematical expectation of the number of successful control times is introduced to ensure the success rate of control: Where N represents the number of edge servers executing control task i, represents the control success rate of the jth edge server, represents the control times of the jth edge server, Represents the mathematical expectation of the number of successful control of the ith control task; to ensure the control success rate Need to meet: according to Different values of determine N and The value of When it is greater than 0.5, it indicates that the control success rate is very high. Selecting two edge servers for control can ensure control success. When it is less than 0.5 and greater than 0.2, it means that the control success rate is not high. At this time, the edge server with the highest success rate is selected for control. This control, When it is less than 0.2, it means that the control success rate is very low, and all servers execute the control command once; When one edge server is successfully controlled, the device sends the control result directly to the cloud, and the cloud stops the control instructions that other edges are about to execute.
2. According to claim 1, a method for group control of Internet of Things devices based on a self-balancing flexible scheduling algorithm is characterized in that: The control task evaluation in step S3 is divided into the following steps: Step 1: Determine the indicators and calculate the scores; The performance scores of all samples can be calculated based on the weight values of each evaluation indicator in step S2: in, represents the total score of the i-th sample, represents the performance value of the i-th sample on the j-th evaluation index, represents the weight of the i-th sample on the j-th evaluation index, and n represents the number of evaluation indicators; Step 2: Sample screening; Filter samples based on their total scores; set a threshold, and samples with scores below this threshold will be excluded; in, is the average of the total scores of all samples, is the standard deviation, is a coefficient used to determine the position of the threshold; when there are fewer samples in the early stage, Set the value smaller to ensure that most samples are retained. When there are enough samples, increase the value. value, ensuring that the deviation of the remaining samples is small; Step 3: Threshold calculation; The calculation formula for the mean is: in, represents the total score of the tth sample, and T represents the total number of samples; The calculation formula of variance is: Substituting the threshold calculation formula into the formula, we can get: .
3. The method for group control of Internet of Things devices based on a self-balancing flexible scheduling algorithm according to claim 2 is characterized in that: The formula for dynamically adjusting the sample screening coefficient in step S4 is: in, Yes Initial value, yes The maximum value of is the maximum allowed standard deviation, is the minimum allowed variance; this formula ensures that when the actual standard deviation near hour, near ; When the actual standard deviation near hour, near ; Considering , , , They are all constants, and the calculation formula for the threshold can be obtained: .
Citation Information
Patent Citations
LSTM neural network short-term traffic flow prediction method based on ant colony algorithm optimization
CN111860989A
Wind power output short-term rolling prediction and correction method based on LSTM and Markov chain
CN113591957A
Method for accurately predicting future task load and resource demand of user based on long short-term memory network model
CN117273233A
Internet of vehicles edge computing resource scheduling method based on reinforcement learning
CN117762643A
Internet of things system
WO2023030513A1
