A blockchain transaction storage allocation method for industrial internet of things
By using a nonlinear programming model and decomposition algorithm, the problem of insufficient storage caused by the difference in storage capacity of edge devices is solved, and a balance is achieved between the storage capacity adaptability of edge devices and the network security of DAG blockchain, thereby improving the overall security and reliability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU INSTITUTE OF TECHNOLOY XIDIAN UNIVERSITY
- Filing Date
- 2023-02-27
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies in cloud-edge collaborative industrial IoT fail to effectively consider the differences in storage capacity of edge devices, resulting in insufficient storage for small-capacity devices and affecting the security and reliability of DAG blockchain networks.
A nonlinear programming model is designed. By establishing a mathematical description of storage occupancy and security index, and combining breadth-first traversal and greedy search algorithms, it is decomposed into two sub-problems for solution, so as to achieve a trade-off between storage occupancy balance and system security.
It effectively reduces the storage pressure on edge devices, improves the security and reliability of the system, reduces the time complexity of model solving, and realizes adaptive allocation of storage capacity for edge devices.
Smart Images

Figure CN116257588B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of blockchain and industrial Internet of Things (IoT) technology, and particularly relates to a blockchain transaction storage and allocation method for industrial IoT. Background Technology
[0002] The Industrial Internet of Things (IIoT), a fusion of the Internet of Things (IoT) and industrial manufacturing, achieves higher production efficiency by interconnecting, sharing data, and flexibly configuring various devices and resources in industrial production. Blockchain, based on cryptographic principles and consensus mechanisms, is a distributed ledger technology maintained and managed by multiple parties. Blockchain offers advantages such as decentralization, immutability, and traceability, enabling functions like resource auctions, node collaboration, and transaction data notarization, making it widely applicable in IIoT scenarios. With the development of information technology, the network scale of IIoT continues to increase, and the massive amounts of blockchain transaction data place enormous storage pressure on edge devices. Therefore, related solutions have begun to attract researchers' attention.
[0003] The LDV scheme proposed by Yang Wenhui et al. [1] is one of the classic research results in this field. LDV is a blockchain data reduction scheme for the Internet of Vehicles. It divides the blockchain network into several topic groups. Each user joins the topic groups that are related to their interests and stores the blockchain transactions of the topic groups they join, without storing irrelevant transactions. Although the LDV scheme significantly reduces the storage pressure on user nodes, it also has some drawbacks, such as too much duplicate data in popular topic groups and insufficient data backup in unpopular topic groups.
[0004] As a follow-up study, recently, scholars such as Liao Zhuofan proposed a DAG blockchain partitioning method GpDB for cloud-edge collaborative industrial IoT in the literature [2], and its corresponding patent [3]. Among them, the authors proposed the concepts of node activity and transaction freshness. In a cycle, the activity of a node is equal to the sum of the scores of each transaction it participates in, and the freshness of the transaction is equal to the sum of the activity of the nodes of both parties in the transaction. GpDB is a method that is executed cyclically in each cycle of the system. This method is specifically divided into three stages. The first stage is that all transactions in this round are verified and consensus is reached, which is the same as ordinary DAG blockchain. In the second stage, the freshness of each transaction is calculated, and then a threshold is calculated. This threshold is used to partition the DAG blockchain network. The third stage is the judgment and partitioning. The system determines that those transactions with freshness higher than the threshold are kept in the edge nodes, and the rest are handed over to the cloud server for storage. After receiving the above partitioning scheme, each edge node sends the transactions with low freshness to the cloud server and deletes them locally. GpDB uses collaborative storage between the cloud and the edge to keep the storage pressure of the edge server at a low level. Experiments have shown that the GpDB solution reduces storage overhead at the edge servers by approximately 79% and 92% compared to the LDV solution and the original blockchain, respectively. However, the GpDB solution makes the assumption that all edge nodes have the same storage capacity, without considering their differences.
[0005] Investigations have revealed that the storage capacities of mainstream edge devices on the market can vary by up to thousands of times. If all edge devices store the same amount of transaction data, after a certain period, devices with smaller capacities will gradually run out of space and be forced to leave the network, which cannot adequately meet actual needs. To resolve this contradiction, efforts can be made to allow smaller-capacity devices to store only a smaller amount of transaction data. However, it is important to note that in a DAG blockchain network, the verification process of subsequent transactions against previous transactions is continuously iterated. This mechanism is crucial for ensuring the security and reliability of transaction data across the entire network. Therefore, the act of deleting transactions itself can affect the security and reliability of the DAG blockchain network. Thus, how to strike a balance between capacity adaptability and system security when designing transaction storage schemes is a problem worth exploring and solving. Currently, there are few research results in this area.
[0006] In summary, the problems with the existing technology are as follows:
[0007] (1) Although the GpDB solution reduces the storage overhead of edge devices, it does not specifically consider the differences in storage capacity between edge devices;
[0008] (2) How to arrange the storage of transactions so that it is compatible with the storage capacity of each edge node?
[0009] At the same time, the security of the DAG blockchain network is also taken into account.
[0010] References:
[0011] [1]Yang W, Dai
[0012] [2]Liao Z, Cheng S, Zhang J, et al. GpDB: A Graph-partition Based StorageStrategy for DAG-Blockchain in Edge-cloud IIoT[J]. IEEE Transactions on Industrial Informatics, 2022.
[0013] [3] Liao Zhuofan, Cheng Siwei, Zhang Jingyu, et al. A method, device, equipment and storage medium for blockchain data storage [P]. Hunan Province: CN 114168086 A, 2022-03-11. Summary of the Invention
[0014] To address the aforementioned problems, this invention, targeting cloud-edge collaborative industrial IoT scenarios, designs a blockchain transaction storage allocation method for industrial IoT, which can serve as a supplementary mechanism to GpDB. The allocation method of this invention includes establishing a planning model, decomposing the model, solving sub-problem one, and solving sub-problem two. The specific details of the method are as follows:
[0015] S1, Establish a planning model
[0016] The first aspect of this invention addresses the trade-off problem of storage allocation among edge nodes in a cloud-edge collaborative industrial Internet of Things (IIoT) for transaction data of DAG (Directed Acyclic Graph) blockchains, and establishes a nonlinear mathematical programming model.
[0017] The model is described as follows. An Industrial Internet of Things (IIoT) system consists of several industrial nodes and N edge nodes, connected to a large cloud server. Assume that all blockchain transactions in the current cycle have completed the verification and consensus phases, and the system has calculated transaction freshness and partitioning thresholds according to the methods defined in GpDB. At this point, K transactions in the system have a freshness higher than the threshold, and the remaining transactions are sent to the cloud server for storage. For these K transactions, unlike GpDB which directly allocates them to all edge nodes, this invention establishes a mathematical model based on the differences in node capacity to redistribute the storage of the K transactions. In the model, the variable to be solved is matrix P. N×K The matrix has N rows, which represents the number of nodes, and K columns, which represent the number of transactions. This matrix represents the final storage allocation scheme, and is defined as follows:
[0018]
[0019] Let the total capacity of the N edge nodes be denoted as C = {C1, C2, ..., C...} N Let the freshness values of the K transactions be denoted as F = {F1, F2, ..., F...}. K Assume that the data size of a single transaction in this blockchain is uniformly L. Define the OSR (Optical Storage Ratio) of edge node i. i for:
[0020]
[0021] Storage utilization rate OSR i The number of transactions stored in node i represents its relation to the total capacity C. i The degree of resource occupancy. If the number of transactions stored on each node is commensurate with its own capacity, then their OSR should have a very low degree of deviation. In statistics, the standard deviation is commonly used to describe the degree of deviation; therefore, the first optimization objective of this model is to minimize the standard deviation (SDD) of the OSR of each node, i.e.:
[0022] in
[0023] As mentioned earlier, the foundation for ensuring the security and reliability of DAG blockchain transaction data lies in the iterative verification mechanism of previous and subsequent transactions. Based on the research findings of GpDB, preserving transactions with high freshness is beneficial for subsequent transaction verification. Let R be the sum of the transaction freshness stored at edge node i. i R i This characterizes the ability of edge node i to provide verification for subsequent transactions:
[0024]
[0025] Clearly, the system's overall verification capability for new transactions is determined by the R values of each node. i A composite index of coefficients. Define R. i If the geometric mean is the system's "safety index" ASE, then the second optimization objective of this model is to maximize ASE:
[0026]
[0027] Geometric mean is used because it better characterizes the overall security of the system, while arithmetic mean is more easily affected by individual peaks.
[0028] The first constraint of this model is that the number of transactions stored on each edge device cannot exceed its capacity C. i ,Right now:
[0029]
[0030] The second constraint of this model is that, in order to adhere to the principle of data backup, the proportion of any transaction stored must reach a certain preset threshold, called the Minimum Redundancy Threshold (MRT), i.e.:
[0031]
[0032] In summary, the mathematical model for the above problem is a nonlinear, bi-objective 0-1 programming model:
[0033] in
[0034] in
[0035]
[0036] S2, Decomposition Model
[0037] The second aspect of this invention provides a solution method (hereinafter referred to as "this method") for the above-mentioned nonlinear programming model. This method decomposes the original programming model into subproblems and solves them sequentially.
[0038] For the original planning model, we make the following assumptions when solving:
[0039] (1) This method serves as a supplementary mechanism to GpDB and is executed once per cycle along with GpDB. In the following discussion, it is assumed that the data size within a single cycle is acceptable for each edge node, that is, it is assumed that the first constraint of the above plan is generally satisfied, only resulting in different storage occupancy rates.
[0040] (2) Assume all transactions and nodes are sorted in descending order of transaction freshness and node storage capacity, i.e., F1 ≥ F2 ≥ ... ≥ F K And C1≥C2≥...≥C N This is to reduce unnecessary and tedious operations in subsequent solutions, but it does not affect the essence or core idea of this method. If the input data is out of order, we only need to perform a sorting operation before executing this method.
[0041] In the original planning model, the matrix P to be solved N×K All possible value states reach 2 N×K Performing a complete traversal would result in extremely high time complexity. Note that the calculation of node storage utilization is independent of transaction freshness and depends only on the number of transactions. Therefore, this method proposes decomposing the original planning model into two sub-problems: "finding the optimal number of transactions" and "solving the allocation matrix," which are solved separately.
[0042] The mathematical representation of subproblem one, "finding the optimal number of solutions," is as follows:
[0043] in
[0044]
[0045] Among them, C i OSR i , MRT, and MRT are the total node capacity, storage utilization rate, and minimum redundancy threshold defined above, respectively. The decision variables for this subproblem are q = {q1, q2, ..., q...} N}, where q i This represents the number of transactions stored in node i. Here, SQ = N × SDD 2 Therefore, minimizing SQ is the same as minimizing SDD. The constraints here are to ensure that q i The sum must meet the MRT constraint requirements of the original model; otherwise, no matter how the allocation matrix is adjusted in subsequent stages, there will be some transactions whose storage ratio is lower than the minimum redundancy threshold (MRT).
[0046] The mathematical representation of subproblem two, “solving the distribution matrix”, is as follows:
[0047] in
[0048]
[0049] Where F j This refers to the freshness of transaction j, R. iThat is, the sum of the transaction freshness stored in edge node i, matrix P N×K That is, the storage allocation matrix to be determined, q i This refers to the number of transactions that node i needs to store, as calculated above. ASE is the system "security index" defined above.
[0050] Clearly, the two sub-problems derived from the decomposition have different objectives. Sub-problem one, "finding the optimal number," aims to determine the optimal number of transactions to store based on the storage capacity of each edge node, focusing on achieving a balance in storage usage. Sub-problem two, "solving the allocation matrix," uses the output of the first stage as a benchmark to formulate a specific storage scheme (i.e., matrix P) with the goal of achieving the highest possible system security. N×K This emphasizes system security. Specifically, in the search process for subproblem two, for all candidate storage schemes, the number of transactions stored in each node is fixed to the solution of subproblem one; only the storage order changes. The goal is to search for the scheme with the largest ASE (Accumulated Transaction Allocation). Here, in the mathematical representation of subproblem two, the optimization objective ASE and MRT (Mean Transformation Time Limit) constraints remain consistent with the original model, with only the addition of constraint one, which states that the sum of the 1s in each row of the matrix to be solved is always fixed to the solution of subproblem one.
[0051] S3, Solving Subproblem 1
[0052] Here, for subproblem one, "finding the optimal number of nodes," a breadth-first search algorithm is designed. Breadth-first search is used because for small-capacity storage nodes, changes in the number of nodes stored have a greater impact on the occupancy rate, while the opposite is true for large-capacity nodes. Therefore, during the traversal, the principle for changing the number of nodes should be: first increase the number of nodes stored in large-capacity nodes, then increase the number of nodes stored in slightly smaller-capacity nodes. This traversal order is equivalent to breadth-first search (storage capacities are arranged in descending order).
[0053] The algorithm steps for finding the optimal number (subproblem 1) are as follows:
[0054] Step 1: Initialize the number of solutions q, the number of layers layer, the iteration starting point x, and the mean variable avg.
[0055] Step two: Set the first layer element of list q to K, calculate the mean variable avg, and set the iteration starting point x = layer + 1. Let the loop index i = x, and start the iteration process.
[0056] Step 3: For the current node i, find the optimal number j such that the difference between the storage utilization rate of node i and the average value is minimized. Then q i Set the value to j, update avg, and increment the iteration index i by 1.
[0057] Step 4: If i > N, stop the current iteration and proceed to Step 5; otherwise, continue with Step 3.
[0058] Step 5: Calculate the sum of elements in list q. If the sum is not less than N×MRT×K, the algorithm terminates and outputs list q. Otherwise, decrement list q. x The value increases by 1.
[0059] Step six, if q x If the value is greater than N, then the layer number is increased by 1, and step two is executed again. Otherwise, update avg, set the loop index i = x + 1, and then execute step three.
[0060] Furthermore, in step one, q = {q1, q2, ..., q} N Let q be a list of length N, used to record the current value state of the solutions. Each iteration starts from the smallest index and determines the value of the next element of list q according to a certain optimization criterion, until the last element q is reached. N The calculation is complete. Each iteration calculates a candidate optimal solution. The layer number `layer` signifies that the number of large-capacity nodes in the previous `layer` iterations is fixed at K, and `layer` also represents the current level of the state space tree. The initial value of `layer` is 1. During traversal, if no solution corresponding to the current `layer` satisfies the algorithm's termination condition, `layer` continues to increase. The mean variable `avg` is continuously updated; it records the OSR mean of several nodes that have completed previous iterations and also serves as the standard for optimizing the next element of list `q`. The iteration starting point `x` is always updated to `layer + 1`, and each iteration begins from `i = x`.
[0061] Furthermore, in step two, the first layer element of list q is set to K, indicating that the number of these large-capacity nodes is fixed at K, and then the iteration process starts from x = layer + 1.
[0062] Furthermore, in step three, when node i stores q... i When the values are 1, 2, ..., K, the corresponding storage occupancy rates are L / C respectively. i 2×L / C i 3×L / C i ,…,K×L / C i Take the absolute value of the difference between these values and avg, where the smallest difference from avg is j×L / C. i This means q i When the value is j, the deviation from the OSR of the preceding node is minimized; therefore, let q... i =j, then avg is updated to (avg+j×L / C) i) / i
[0063] Furthermore, in step four, if i > N, it means that the last layer has been iterated and an alternative solution has been obtained. Next, in step five, the sum of the current number of solutions is calculated as sum(q) = q1 + q2 + ... + q N If sum(q) ≥ N × MRT × K, it means the sum of the number of transactions stored in the current solution is sufficient. In this case, the algorithm terminates and outputs the current candidate solution. Otherwise, it means the sum of the number of transactions in the current solution is insufficient. In this case, an increment is applied to the current solution, let q... x The value increases by 1.
[0064] Furthermore, in step six, if q x ≤N, indicating that q x If the upper limit has not yet been reached after adjustment, update avg and then restart the iteration from i = x + 1. If q x >N indicates that under the current layer value conditions, even if q x The number of layers is increased to the maximum, regardless of whether an alternative solution that satisfies the algorithm's termination condition is found. Therefore, the layer number is increased by 1, and then step two is entered to restart the traversal with the updated iteration starting point.
[0065] After executing the above algorithm, the system can determine the optimal number of transactions to store on each edge node. Next, using the solution for the number of transactions as a benchmark, sub-problem two can be solved to arrive at the final allocation scheme.
[0066] S4, Solving Subproblem Two
[0067] Regarding subproblem two, "solving the allocation matrix," the algorithm designed in this invention is based on the following:
[0068] (1) The number of solutions q = {q1, q2, ..., q} is obtained from the subproblems. N If we let the first q of each row i of the matrix... i When all elements are set to 1 (transaction freshness sorted in descending order), the system's "security index" ASE will inevitably reach its theoretical upper limit. This matrix is called the "ideal matrix".
[0069] (2) Although the matrix constructed according to (1) corresponds to the highest ASE, there are some transactions with lower freshness. These transactions have fewer 1 elements in their corresponding columns in the ideal matrix, indicating that their storage ratio in the system is less than the minimum redundancy threshold (MRT). Therefore, the ideal matrix must be adjusted, which means moving some of the leading 1 elements in each row of the ideal matrix to the columns containing the low-freshness transactions. Since each matrix adjustment operation is performed on the same row, this will not change the node's storage occupancy rate, and therefore will not affect the system's SDD, nor will it change the optimal number of solutions.
[0070] (3) If transaction w does not meet the minimum redundancy threshold, assume that transactions u and v at node i have spares (F). u >F v >F w If one transaction must be chosen to fill the gap in transaction w, then transaction v should be prioritized for the filling operation, rather than transaction u. This is because R... i -F u +F w <R i –F v +F w Clearly, after transaction u performs the fill operation, the sum of transaction freshness R of node i will increase. i The descent is faster.
[0071] (4) Assume that during the search process, transaction t needs to fill the gap in transaction w. Assume that both node i and node j have spare transactions t (F). t >F w And R i >R j If node i is the first node to be filled, then node i should be filled first, not node j. This is because (R... i -F t +F w )*R j >R i *(R j -F t +F w If node j performs the fill operation, the system's ASE will decrease faster.
[0072] It should be noted that u, v, w, t, i, j appearing in the above description do not refer to specific nodes or transactions, but rather to a general category of situations. This applies universally during the search process.
[0073] Based on the above four criteria, this method designs a matrix adjustment algorithm based on greedy search for the second problem. The steps are as follows:
[0074] Step 1: According to the optimal number solution q = {q1, q2,..., q N} output by the first-stage algorithm, construct the ideal matrix P N×K . For all 1 ≤ i ≤ N, set the first q i elements in the i-th row to 1, and set all the remaining elements to 0.
[0075] Step 2: MRTNUM = MRT × N × K. For all 1 ≤ j ≤ K, calculate the difference D between the storage copies of each transaction j and MRTNUM j .
[0076] Step 3: Search for the subscript H, where D H > 0 and D H+1 = 0.
[0077] Step 4: For all transactions j that do not meet the MRT constraint, calculate the sum S of their differences D j . Search for the subscript L that satisfies D L+1 +…+D H < S but D L +…+D H ≥ S.
[0078] Step 5: Construct the "quota list" T = {T L , T L+1 ,..., T H}, where T L = S - (D L+1 +...+D H ), and all the remaining T j = D j (L + 1 ≤ j ≤ H).
[0079] Step 6: Search for the row subscript U corresponding to the first non-all-1 row of the matrix P, and the row subscript V corresponding to the last 1 element in the L-th column. Let x = U, y = L, and e = K.
[0080] Step 7: Calculate the sum R of the freshness of the transactions corresponding to the 1 elements in each row i (U ≤ i ≤ V) of the current matrix P i . Find the one with the largest R i and non-zero P iy , and assign its row subscript to x.
[0081] Step 8: Swap the 1 element in the x-th row and y-th column to the e-th column in the same row, and T y = T y - 1.
[0082] Step 9: If the current transaction e already meets the MRT constraint, then set e = e - 1.
[0083] Step 10: If T yIf y = 0, then let y = y + 1. Otherwise, continue to step seven.
[0084] Step 11: If y = H + 1, it means that all transactions have satisfied the MRT constraints, the algorithm ends and outputs matrix P. Otherwise, continue to step 7.
[0085] Furthermore, in step one, when the number of solutions q = {q1, q2, ..., q} N Once determined, each edge node i stores the top q nodes sorted by freshness. i The sum of freshness R in a transaction is called the freshness value. i The upper limit of F1. And because F1≥F2≥...≥F2... K Therefore, by using the first q rows of the i-th row... i Setting each element to 1 yields the ideal solution P in matrix form. However, the ideal matrix P is in row echelon form, and mathematically, it's easy to see that the first few columns of matrix P have more 1s than the last few. Specifically, in the K transactions, those ranked lower in freshness will not satisfy the MRT constraint. Therefore, adjustments need to be made based on the ideal matrix so that even the transactions ranked lower in freshness can satisfy the MRT constraint.
[0086] Furthermore, the MRTNUM calculated in step two represents the minimum number of copies of each transaction that are stored. If transaction j is stored in more copies than MRTNUM, then the difference D is... j >0; conversely, for those transactions j that do not satisfy the MRT constraints, their difference D j <0.
[0087] Furthermore, the H searched in step three is the right boundary of the matrix adjustment algorithm, where the number of transactions H is exactly more than MRTNUM, and the number of transactions H+1 stored is exactly equal to MRTNUM.
[0088] Furthermore, in step four, the search term L is the left boundary of the matrix adjustment algorithm, where the surplus 1 elements of transactions L to H can just fill those transactions that do not satisfy the MRT constraint, while transactions L+1 to H are just not enough to fill them.
[0089] Furthermore, the quota list T from step five records the filling tasks that need to be performed for each transaction. The filling task quotas for transactions L+1 to H are all equal to the difference between T and T. L This is to make up for the difference in digits between S and S.
[0090] Furthermore, in step six, U is the first row with a missing transaction, and V is the last row where transaction L exists. The execution range of the matrix adjustment algorithm will be limited to U≤i≤V, L≤j≤H. Irrelevant rows and columns do not need to participate in this algorithm.
[0091] Furthermore, within the algorithm's limited search range, step seven involves selecting the sum of current freshness R. i The largest row with non-empty transaction y is filled with the 1 element corresponding to transaction y in the row and placed at transaction e. Transaction y is traversed from the left, while transaction e is traversed from the right.
[0092] Furthermore, in steps nine and ten, if transaction e already satisfies the MRT constraint, it means that the transaction with the lowest freshness among those currently not satisfying the MRT constraint has been filled. At this point, e = e - 1 is executed to move left to the transaction with the second lowest freshness. If T y =0, which means that the quota for filling the task of the current transaction y has been completed. Then execute y = y + 1 to move to the right and advance to the transaction with the second highest freshness.
[0093] Furthermore, in step eleven, if y = H + 1, it means that the filling tasks defined for transactions L to H have all been completed. At this point, the algorithm can be terminated and matrix P can be output.
[0094] In the algorithm described above, the optimization principle in step seven embodies the idea of greedy search. After executing the matrix adjustment algorithm based on greedy search, a matrix is obtained, which is the final transaction storage allocation scheme.
[0095] The present invention has the following beneficial effects:
[0096] 1. This invention analyzes the capacity differences of edge nodes, proposes the phenomenon of potentially uneven storage occupancy, and establishes a nonlinear programming model to accurately describe the trade-off between balanced storage occupancy and system security.
[0097] 2. In the case of extremely high model complexity, this invention proposes to decompose the model into two sub-problems that are solved sequentially, which greatly reduces the theoretical time complexity and gives the original problem a chance to be solved.
[0098] 3. This invention proposes two solution algorithms for subproblems one and two, respectively drawing on the ideas of breadth-first search and greedy search. These algorithms not only find the optimal solutions to the subproblems, but also have acceptable running times, thus effectively solving the problems. Attached Figure Description
[0099] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0100] Figure 1 A flowchart illustrating a blockchain transaction storage allocation method for the Industrial Internet of Things (IIoT) provided in this embodiment of the invention;
[0101] Figure 2 A flowchart of the breadth-first traversal algorithm for solving subproblem 1 provided in an embodiment of the present invention;
[0102] Figure 3 A flowchart of a matrix adjustment algorithm based on greedy search for solving subproblem 2 provided in an embodiment of the present invention;
[0103] Figure 4 This illustrates the relationship between the OSR variance of the solution obtained in this embodiment of the invention and the case size (N*K).
[0104] Figure 5 The safety factor ASE is the solution result of five examples in the embodiments of the present invention.
[0105] Figure 6 This illustrates the relationship between the running time and the case size (N*K) of the solution results in this embodiment of the invention. Detailed Implementation
[0106] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0107] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0108] Please see Figure 1 An embodiment of the present invention provides a blockchain transaction storage allocation method for the Industrial Internet of Things, comprising the following steps:
[0109] S1, Establish a planning model
[0110] Firstly, the first aspect of this invention is to analyze the shortcomings of the existing product GpDB, extract the problem of how to balance storage utilization and system security, and establish a nonlinear programming model to mathematically describe this problem.
[0111] The model is described as follows: An Industrial Internet of Things (IIoT) system consists of several industrial nodes and N edge nodes, connected to a large cloud server. Assume that all blockchain transactions in the current cycle have completed the verification and consensus phases, and the system has calculated transaction freshness and partitioning thresholds according to the methods defined in GpDB. At this point, K transactions in the system have a freshness higher than the threshold, and the remaining transactions are sent to the cloud server for storage. For these K transactions, unlike GpDB which directly allocates them to all edge nodes, this invention establishes a mathematical model based on the differences in node capacity to redistribute the storage of the K transactions. In the model, the variable to be solved is matrix P. N×K The matrix has N rows, which represents the number of nodes, and K columns, which represent the number of transactions. This matrix represents the final storage allocation scheme, and is defined as follows:
[0112]
[0113] Let the total capacity of the N edge nodes be denoted as C = {C1, C2, ..., C...} N Let the freshness values of the K transactions be denoted as F = {F1, F2, ..., F...}. K Assume that the data size of a single transaction in this blockchain is uniformly L. Define the OSR (Optical Storage Ratio) of edge node i. i for:
[0114]
[0115] Storage utilization rate OSR i The number of transactions stored in node i represents its relation to the total capacity C. i The degree of resource occupancy. If the number of transactions stored on each node is commensurate with its own capacity, then their OSR should have a very low degree of deviation. In statistics, the standard deviation is commonly used to describe the degree of deviation; therefore, the first optimization objective of this model is to minimize the standard deviation (SDD) of the OSR of each node, i.e.:
[0116] in
[0117] As mentioned earlier, the foundation for ensuring the security and reliability of DAG blockchain transaction data lies in the iterative verification mechanism of previous and subsequent transactions. Based on the research findings of GpDB, preserving transactions with high freshness is beneficial for subsequent transaction verification. Let R be the sum of the transaction freshness stored at edge node i. i R i This characterizes the ability of edge node i to provide verification for subsequent transactions:
[0118]
[0119] Clearly, the system's overall verification capability for new transactions is determined by the R values of each node. i A composite index of coefficients. Define R. i If the geometric mean is the system's "safety index" ASE, then the second optimization objective of this model is to maximize ASE:
[0120]
[0121] Geometric mean is used because it better characterizes the overall security of the system, while arithmetic mean is more easily affected by individual peaks.
[0122] The first constraint of this model is that the number of transactions stored on each edge device cannot exceed its capacity C. i ,Right now:
[0123]
[0124] The second constraint of this model is that, in order to adhere to the principle of data backup, the proportion of any transaction stored must reach a certain preset threshold, called the Minimum Redundancy Threshold (MRT), i.e.:
[0125]
[0126] In summary, the mathematical model for the above problem is a nonlinear, bi-objective 0-1 programming model:
[0127] in
[0128] in
[0129]
[0130] S2, Decomposition Model
[0131] The second aspect of this invention is that, for the aforementioned nonlinear programming model, it proposes to decompose the model into two sub-problems, namely sub-problem one "finding the optimal number" and sub-problem two "finding the allocation matrix", which solves the problem that the original model is too complex and difficult to solve.
[0132] It should be noted in advance that the following assumptions are made when implementing this invention:
[0133] (1) This method serves as a supplementary mechanism to GpDB and is executed once per cycle along with GpDB. In the following discussion, it is assumed that the data size within a single cycle is acceptable for each edge node, that is, it is assumed that the first constraint of the above plan is generally satisfied, only resulting in different storage occupancy rates.
[0134] (2) Assume all transactions and nodes are sorted in descending order of transaction freshness and node storage capacity, i.e., F1 ≥ F2 ≥ ... ≥ F K And C1≥C2≥...≥C N If the input data is out of order, we only need to perform a sorting operation before executing this method.
[0135] Specifically, decomposing the model into two sub-problems involves the following steps:
[0136] S201 decomposes the original planning problem into two subproblems: subproblem one, "finding the optimal number of items", and subproblem two, "finding the allocation matrix".
[0137] S202, set the objective function of subproblem one as the sum of squares SQ, the difference between the OSR and the mean of each edge node, and minimize it:
[0138] in
[0139] S203, In order to ensure that subsequent solutions satisfy the MRT constraints of the original problem, a lower bound on the total number of storage transactions is set as a constraint condition for subproblem one:
[0140]
[0141] S204, after simplification, yields the mathematical representation of subproblem one, "finding the optimal number of solutions";
[0142] S205 specifies one of the constraints of subproblem two, namely, the number of transactions stored by each edge node is set to the solution obtained from subproblem one:
[0143]
[0144] S206 specifies another constraint for subproblem two: each transaction must satisfy the MRT constraint.
[0145]
[0146] S207, Set the objective function of subproblem two to the previously defined ASE, and the goal is to maximize it:
[0147] in
[0148] S208, after simplification, yields the mathematical representation of subproblem two, "Solving the distribution matrix".
[0149] Specifically, the mathematical representation of subproblem one, "finding the optimal number of solutions," is as follows:
[0150] in
[0151]
[0152] Among them, C i OSR i , MRT, and MRT are the total node capacity, storage utilization rate, and minimum redundancy threshold defined above, respectively. The decision variables for this subproblem are q = {q1, q2, ..., q...} N}, where q i This represents the number of transactions stored in node i. Here, SQ = N × SDD 2 Therefore, minimizing SQ is the same as minimizing SDD. The constraints here are to ensure that q i The sum must meet the MRT constraint requirements of the original model; otherwise, no matter how the allocation matrix is adjusted in subsequent stages, there will be some transactions whose storage ratio is lower than the minimum redundancy threshold (MRT).
[0153] The mathematical representation of subproblem two, “solving the distribution matrix”, is as follows:
[0154] in
[0155]
[0156] Where F j This refers to the freshness of transaction j, R. i That is, the sum of the transaction freshness stored in edge node i, matrix P N×K That is, the storage allocation matrix to be determined, q i This refers to the number of transactions that node i needs to store, as calculated above. ASE is the system "security index" defined above.
[0157] Clearly, the two sub-problems derived from the decomposition have different objectives. Sub-problem one, "finding the optimal number," aims to determine the optimal number of transactions to store based on the storage capacity of each edge node, focusing on achieving a balance in storage usage. Sub-problem two, "solving the allocation matrix," uses the output of the first stage as a benchmark to formulate a specific storage scheme (i.e., matrix P) with the goal of achieving the highest possible system security. N×KThis emphasizes system security. Specifically, in the search process for subproblem two, for all candidate storage schemes, the number of transactions stored in each node is fixed to the solution of subproblem one; only the storage order changes. The goal is to search for the scheme with the largest ASE (Accumulated Transaction Allocation). Here, in the mathematical representation of subproblem two, the optimization objective ASE and MRT (Mean Transformation Time Limit) constraints remain consistent with the original model, with only the addition of constraint one, which states that the sum of the 1s in each row of the matrix to be solved is always fixed to the solution of subproblem one.
[0158] S3, Solving Subproblem 1
[0159] The third aspect of the present invention is that corresponding solution algorithms are designed for the two sub-problems mentioned above. By solving sub-problem one and sub-problem two respectively, the required transaction storage allocation scheme can be finally obtained.
[0160] For subproblem one, "finding the optimal number of nodes," a breadth-first search (BFS) algorithm is designed. BFS is used because for small-capacity storage nodes, changes in the number of nodes significantly impact the occupancy rate, while the opposite is true for large-capacity nodes. Therefore, during the traversal, the principle for changing the number of nodes should be: first increase the number of nodes with larger capacities, then increase the number of nodes with smaller capacities. This traversal order is equivalent to breadth-first search (with storage capacities arranged in descending order).
[0161] Please see Figure 2 The corresponding algorithm steps for solving subproblem one, "finding the optimal number of items," are as follows:
[0162] S301, initialize the number of solutions q, the number of layers layer, the iteration start point x, and the mean variable avg.
[0163] S302, set the first layer element of list q to K, calculate the mean variable avg, and set the iteration starting point x = layer + 1. Let the loop index i = x, and start the iteration process.
[0164] S303, for the current node i, find the optimal number j such that the difference between the storage utilization rate of node i and the average value is minimized. Then q i Set the value to j, update avg, and increment the iteration index i by 1.
[0165] S304. If i>N, stop the current iteration and execute S305; otherwise, continue executing S303.
[0166] S305, calculate the sum of the elements in list q. If the sum is not less than N×MRT×K, the algorithm terminates and outputs list q. Otherwise, set q... x The value increases by 1.
[0167] S306, if q x If the value is greater than N, then the layer number is increased by 1, and S302 is executed again. Otherwise, update avg, set the loop index i = x + 1, and then execute S303.
[0168] In S301, q = {q1, q2, ..., q} N Let q be a list of length N, used to record the current value state of the solutions. Each iteration starts from the smallest index and determines the value of the next element of list q according to a certain optimization criterion, until the last element q is reached. N The calculation is complete. Each iteration calculates a candidate optimal solution. The layer number `layer` signifies that the number of large-capacity nodes in the previous `layer` iterations is fixed at K, and `layer` also represents the current level of the state space tree. The initial value of `layer` is 1. During traversal, if no solution corresponding to the current `layer` satisfies the algorithm's termination condition, `layer` continues to increase. The mean variable `avg` is continuously updated; it records the OSR mean of several nodes that have completed previous iterations and also serves as the standard for optimizing the next element of list `q`. The iteration starting point `x` is always updated to `layer + 1`, and each iteration begins from `i = x`.
[0169] In S302, the first layer element of list q is set to K, indicating that the number of these large capacity nodes is fixed at K, and then the iteration process starts from x = layer + 1.
[0170] In S303, when node i stores q... i When the values are 1, 2, ..., K, the corresponding storage occupancy rates are L / C respectively. i 2×L / C i 3×L / C i ,…,K×L / C i Take the absolute value of the difference between these values and avg, where the smallest difference from avg is j×L / C. i This means q i When the value is j, the deviation from the OSR of the preceding node is minimized; therefore, let q... i =j, then avg is updated to (avg+j×L / C) i ) / i
[0171] In S304, if i > N, it means that the last layer has been iterated and an alternative solution has been obtained.
[0172] In S305, find the sum of the current number of solutions: sum(q) = q1 + q2 + ... + q NIf sum(q) ≥ N × MRT × K, it means the sum of the number of transactions stored in the current solution is sufficient. In this case, the algorithm terminates and outputs the current candidate solution. Otherwise, it means the sum of the number of transactions in the current solution is insufficient. In this case, an increment is applied to the current solution, let q... x The value increases by 1.
[0173] In S306, if q x ≤N, indicating that q x If the upper limit has not yet been reached after adjustment, update avg and then restart the iteration from i = x + 1. If q x >N indicates that under the current layer value conditions, even if q x The number of layers is increased to the maximum, regardless of whether an alternative solution that satisfies the algorithm's termination condition is found. Therefore, the layer number is increased by 1, and then the process enters S302 to restart the traversal with the updated iteration starting point.
[0174] S4, Solving Subproblem Two
[0175] The algorithm for solving subproblem two is based on the following:
[0176] (1) Based on the number of solutions in the second stage, q = {q1, q2, ..., q} N If we let the first q of each row i of the matrix... i When all elements are set to 1 (transaction freshness sorted in descending order), the system's "security index" ASE will inevitably reach its theoretical upper limit. This matrix is called the "ideal matrix".
[0177] (2) Although the matrix constructed according to (1) corresponds to the highest ASE, there are some transactions with lower freshness. These transactions have fewer 1 elements in their corresponding columns in the ideal matrix, indicating that their storage ratio in the system is less than the minimum redundancy threshold (MRT). Therefore, the ideal matrix must be adjusted, which means moving some of the leading 1 elements in each row of the ideal matrix to the columns containing the low-freshness transactions. Since each matrix adjustment operation is performed on the same row, this will not change the node's storage occupancy rate, and therefore will not affect the system's SDD, nor will it change the optimal number of solutions.
[0178] (3) If transaction w does not meet the minimum redundancy threshold, assume that transactions u and v at node i have spares (F). u >F v >F w If one transaction must be chosen to fill the gap in transaction w, then transaction v should be prioritized for the filling operation, rather than transaction u. This is because R... i -F u +F w <R i –F v +Fw Obviously, after the transaction u is executed to perform the filling operation, the sum of the transaction freshness R of node i i decreases faster.
[0179] (4) Suppose that during the search process, it is necessary to let transaction t fill the gap of transaction w. Suppose that transaction t of node i and node j both has a vacancy (F t >F w and R i >R j ), then node i should execute the filling operation first, rather than node j. This is because (R i -F t +F w )*R j >R i *(R j -F t +F w ). If node j is allowed to execute the filling operation, the ASE of the system will decrease faster at this time.
[0180] The u, v, w, t, i, j described above do not refer to specific nodes and transactions, but generally refer to a class of situations described by them. It is generally applicable during the search process.
[0181] Please refer to Figure 3 , based on the above several bases, the present invention designs a matrix adjustment algorithm based on greedy search for sub-question two, and its specific execution steps are as follows:
[0182] S401, according to the optimal number solution q = {q1, q2,..., q N} output by the first-stage algorithm, construct the ideal matrix P N×K , for all 1 ≤ i ≤ N, the first q i elements of the i-th row are all set to 1. All other elements are 0.
[0183] S402, MRTNUM = MRT × N × K, for all 1 ≤ j ≤ K, count the difference D j between the storage copies of each transaction j minus MRTNUM.
[0184] S403, search for the subscript H, where D H >0 and D H+1 =0.
[0185] S404, for all transactions j that do not satisfy the MRT constraint, calculate the sum S of their differences D j . Search for the subscript L that satisfies D L+1 +…+D H <S but D L +…+D H ≥S.
[0186] S405, Construct the "Quota List" T = {T L ,T L+1 ,...,T H}, where T L =S-(D L+1 +...+D H ), all other T j =D j (L+1≤j≤H).
[0187] S406, search for the row index U corresponding to the first non-all-1 row of matrix P, and the row index V corresponding to the last 1 element in column L. Let x = U, y = L, e = K.
[0188] S407, calculate the sum of the freshness R of the transactions corresponding to the 1-element of each row i (U≤i≤V) of the current matrix P. i Find R among them i Maximum and P iy For non-zero values, their row index is assigned to x.
[0189] S408, swap the 1st element in row x, column y to the 1st element in row e, T y =T y -1.
[0190] S409, If the current transaction e already satisfies the MRT constraint, then let e = e-1.
[0191] S410, if T y If y = 0, then let y = y + 1. Otherwise, continue with S407.
[0192] S411, if y = H+1, it means that all transactions have satisfied the MRT constraints, the algorithm ends and outputs matrix P. Otherwise, continue to S407.
[0193] In S401, when the number of solutions q = {q1,q2,...,q} N Once determined, each edge node i stores the top q nodes sorted by freshness. i The sum of freshness R in a transaction is called the freshness value. i The upper limit of F1. And because F1≥F2≥...≥F2... K Therefore, by using the first q rows of the i-th row... i Setting each element to 1 yields the ideal solution P in matrix form. However, the ideal matrix P is in row echelon form, and mathematically, it's easy to see that the first few columns of matrix P have more 1s than the last few. Specifically, in the K transactions, those ranked lower in freshness will not satisfy the MRT constraint. Therefore, adjustments need to be made based on the ideal matrix so that even the transactions ranked lower in freshness can satisfy the MRT constraint.
[0194] The MRTNUM calculated in S402 is the minimum number of copies of each transaction that are stored. If transaction j is stored in more copies than MRTNUM, then the difference D is... j >0; conversely, for those transactions j that do not satisfy the MRT constraints, their difference D j <0.
[0195] In the S403 search, H is the right boundary of the matrix adjustment algorithm, where the number of transactions H is exactly more than MRTNUM, and the number of transactions H+1 stored is exactly equal to MRTNUM.
[0196] In the S404 search, L is the left boundary of the matrix adjustment algorithm, where the surplus 1 elements of transactions L to H can just fill those transactions that do not satisfy the MRT constraint, while transactions L+1 to H are just not enough to fill them.
[0197] The quota list T in S405 records the fill tasks that need to be performed for each transaction. The fill task quotas for transactions L+1 to H are all equal to the difference between T and the quota list T. L This is to make up for the difference in the last digits between S and S.
[0198] In the S406 search, U represents the first row with a missing transaction, while V represents the last row where transaction L exists. The matrix adjustment algorithm is limited to the range of U≤i≤V and L≤j≤H. Irrelevant rows and columns do not need to participate in this algorithm.
[0199] Within the algorithm's limited search range, S407 selects the sum of current freshness R. i The largest row with non-empty transaction y is filled with the 1 element corresponding to transaction y in the row and placed at transaction e. Transaction y is traversed from the left, while transaction e is traversed from the right.
[0200] In S409 and S410, if transaction e already satisfies the MRT constraint, it means that the transaction with the lowest freshness among those that do not currently satisfy the MRT constraint has been filled. At this point, execution proceeds to the left with e = e-1, moving to the transaction with the second lowest freshness. If T y =0, which means that the quota for filling the task of the current transaction y has been completed. Then execute y = y + 1 to move to the right and advance to the transaction with the second highest freshness.
[0201] In S411, if y = H+1, it means that the filling tasks defined for transactions L to H have been completed. At this point, the algorithm can be terminated and matrix P can be output.
[0202] In this embodiment of the invention, five computational examples T1, T2, T3, T4, and T5 were selected. The data size of each transaction was uniformly set to L=1, the MRT was uniformly set to 1 / 3, and the transaction freshness was set within the range [100, 160]. Based on the characteristics of the industrial scenario, it was set to satisfy a normal distribution N(130, 15). 2 In different computational examples, the storage capacity of the edge nodes is set to satisfy different normal distributions. The remaining parameter settings are shown in Table 1.
[0203] Table 1
[0204]
[0205]
[0206] Please refer to Figure 4 The OSR variance of the five solutions does not exceed 0.007, and convergence is still achieved even with a large number of solutions, indicating that the OSR variance of the solutions obtained by this method remains at a low level regardless of the size of the solutions.
[0207] Please refer to Figure 5 The safety factor ASE of the solution obtained by this method is always kept at about 90% of the ideal ASE, which indicates that the solution obtained by this method is close to the ideal optimal solution and has good solution accuracy.
[0208] Please refer to Figure 6 The runtime of this method increases approximately linearly with the size of the dataset; even with a dataset size of 3000, the runtime remains at 0.25 seconds. In practical industrial IoT applications, since this method processes only transactions within a single cycle, its computational scale is limited, making it suitable for such applications.
[0209] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions, and improvements made by those skilled in the art within the scope of the technology disclosed in the present invention, and within the spirit and principles of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A blockchain transaction storage and allocation method for the Industrial Internet of Things, characterized in that: Specifically, it includes: Step S1: Establish a nonlinear programming model for the storage allocation problem of transaction data of DAG blockchain in each edge node of cloud-edge collaborative industrial IoT. Step S2: Decompose the planning model into sub-problem one "finding the optimal number" and sub-problem two "finding the allocation matrix"; Step S3: For the sub-problem "finding the optimal number", a solution algorithm based on breadth-first traversal is designed, and the solution algorithm is used to obtain the optimal number of transactions to be stored at each edge node; Step S4: For the second sub-problem, "Solving the allocation matrix", a matrix adjustment algorithm based on greedy search is designed, and the optimal solution for transaction storage allocation is obtained using the matrix adjustment algorithm. Step S1 specifically includes the following steps: Step S101: Set up an industrial Internet of Things (IoT) system, the system consisting of several industrial nodes and N The system consists of several edge nodes and connects the system to a large cloud server. Step S102: Establish a mathematical model based on the differences in node capacity in the system; in the mathematical model, the variable to be solved is a matrix. P N×K The number of rows is equal to the number of nodes. N The number of columns represents the number of transactions. K ;in, N and K Integers greater than zero; matrix P ij Defined as: ; Step S103, will N The total capacity of each edge node is denoted as follows: Ci= { C 1 , C 2 , ...,C N }, K The freshness score of each transaction is denoted as: Fj= { F 1 , F 2 , ...,F K }; Assume the data size of a single transaction is uniformly set to . L Define the storage occupancy of edge node i. OSR i for: ; Storage utilization OSR i The transactions stored in node i represent its relationship with the total capacity. The degree of occupancy; Step S104: Set the first optimization objective of the mathematical model to minimize the number of nodes. OSR Standard deviation SDD ,Right now: ; Step S105, define the sum of transaction freshness stored in edge node i as: R i , R i This characterizes the ability of edge node i to provide verification for subsequent transactions: ; Step S106, Define R i The geometric mean is the system's "safety index". ASE The second optimization objective of the mathematical model is set as maximizing ASE : ; Step S107, combining the constraints, the mathematical model is obtained as a nonlinear bi-objective 0-1 programming model: The constraints are met. , in represents the capacity of the edge device, where MRT is the minimum redundancy threshold.
2. The method according to claim 1, characterized in that: The constraints in step S107 include: First constraint: The number of transactions stored on each edge device cannot exceed its capacity. ; The second constraint is that the proportion of any transaction stored must reach a certain preset threshold, which is the minimum redundancy threshold (MRT).
3. The method according to claim 1, characterized in that: Step S1 further includes: Before step S102, the system completes the verification and consensus phases of all blockchain transactions in this cycle, and calculates the transaction freshness and classification threshold.
4. The method according to claim 1, characterized in that: Step S2 specifically includes the following steps: Step S201: Decompose the planning model into two sub-problems, namely sub-problem one "finding the optimal number" and sub-problem two "finding the allocation matrix"; Step S202: Set the objective function SQ of subproblem one as the sum of squares of the differences between the OSR and the mean of each edge node, with the goal of minimizing the objective function SQ. Step S203: In order to ensure that the subsequent solution satisfies the MRT-constraints of the original problem, the lower limit of the total number of storage transactions is set as the constraint condition of subproblem one. Step S204: Arrange the mathematical representation of subproblem one "finding the optimal number of solutions"; Step S205 specifies one of the constraints of subproblem two, namely, the number of transactions stored by each edge node is set to the solution obtained from subproblem one; Step S206 specifies another constraint for subproblem two, namely, each transaction data must satisfy the MRT constraint; Step S207: Set the objective function of subproblem 2 to ASE, with the goal of maximizing it; Step S208: Arrange the mathematical representation of subproblem two, "Solving the distribution matrix".
5. The method according to claim 4, characterized in that: The mathematical representation of subproblem one, "finding the optimal number of solutions," is as follows: ; in, This indicates the number of transactions stored in node i. SQ = N SDD 2 .
6. The method according to claim 4, characterized in that: The mathematical representation of subproblem two, "solving the distribution matrix," is as follows: ; in, For the transaction j freshness, R i Let the sum of transaction freshness stored in edge node i be the matrix. P N×K Assign a storage matrix to be determined. This represents the number of transactions stored in node i.
7. The method according to claim 1, characterized in that: The solution algorithm based on breadth-first traversal specifically includes the following steps: Step S301: Initialize the solution list. q Number of floors layer Iteration starting point x and mean variable avg; in q It is a length of N A list; Step S302, Set list q The former layer Element is K Calculate the mean variable avg Set the iteration start point x = layer +1 Let the circular index... i=x The iteration process begins. Step S303, for the current node i Find the optimal number j Make the node i Storage utilization and avg The difference is minimal; then q i Set as j ,renew avg Iteration subscript i Increase by 1; Step S304, determine if i > N If so, proceed to step S305; otherwise, proceed to step S303. Step S305, calculate the list q The sum of the elements, if not less than N×MRT×K If the condition is met, the algorithm terminates and outputs the list; otherwise, it will... q x The value increases by 1; Step S306, if q x > N If the layer number is positive, increment the layer count by 1 and then re-execute step S302; otherwise, update the layer count. avg Let the circular index i=x+1 Then proceed to step S303.
8. The method according to claim 1, characterized in that: The matrix adjustment algorithm based on greedy search specifically includes the following steps: Step S401, based on the optimal number of solutions q={q 1 ,q 2 ,...,q N } Construct the ideal matrix P N×K For all 1 i N The first q of the i-th row i All elements are set to 1, and all other elements are set to 0; Step S402, let MRTNUM = MRT × N × K For all 1 j K Count the number of storage copies of each transaction j minus MRTNUM The difference D j ;in MRTNUM The minimum number of copies of each transaction that must be stored; Step S403, search index H ,in D H >0 and D H+1 =0 ; Step S404, for all unsatisfied MRT Constrained transactions j Calculate their difference D j sum S Search subscript L ,satisfy D L+1 +…+D H < S and D L +…+D H S ; Step S405: Construct a "quota list" T={T L ,T L+1 ,...,T H } ,in T L = S-(D L+1 +...+D H ) All others T j = D j (L+1 j H) ; Step S406, Search matrix P The row index U corresponding to the first non-full 1 row, and the row index U corresponding to the last 1 element in column L. V ;make x=U , y=L , e=K ; Step S407, calculate the current matrix P Each line i(U i V) The sum of the freshness of the corresponding elements in the transaction. R i Searching for it R i Maximum and P iy For non-zero values, their row index is assigned a value. x ; Step S408, will the first x OK y Swap the first element of the column to the first element in the same row. e List, T y = T y -1 ; Step S409, if the current transaction e Satisfied MRT Constraints, then let e=e-1 ; Step S410, if T y =0 Then let y=y+1 Otherwise, proceed to step S407. Step S411, if y=H+1 The algorithm ends and outputs the matrix. P As the system's pending storage allocation scheme; otherwise, proceed to step S407.
Citation Information
Patent Citations
Block chain data storage method and device, equipment and storage medium
CN114168086A
Resource allocation method, distributed computing system and equipment
CN114581160A
Q-Learning-based edge node resource allocation method and system under power distribution Internet of Things
CN115484270A