MARL-based block chain Internet of Things cooperative resource allocation optimization method
By using multi-agent reinforcement learning algorithms in the IoT environment to optimize the allocation of blockchain IoT resources, the energy overhead and complex computing problems caused by the blockchain consensus program are solved, and efficient resource allocation and task offloading in edge computing are achieved. Data security.
Patent Information
- Application Number
- CN202410694281.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-23
AI Technical Summary
In the Internet of Things environment, the energy overhead and complex computing problems caused by the blockchain consensus program make it difficult to effectively ensure task offloading and data security in edge computing.
A collaborative resource allocation optimization method for the blockchain Internet of Things based on multi-agent reinforcement learning (MARL) is adopted. By building a blockchain-based MEC system, the task offloading strategy and transmission model are defined, and the distributed MARL algorithm is combined to optimize task offloading and zoning. The blockchain mining process realizes collaborative task offloading and block mining.
Efficient resource allocation for task offloading in the edge computing environment is achieved, system overhead is reduced, the security of data exchange is ensured, and the security of the edge network is improved.
Smart Images

Figure CN118540740A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of resource allocation optimization methods, and specifically relates to a blockchain Internet of Things collaborative resource allocation optimization method based on MARL. Background Art
[0002] Advances in the Internet of Things (IoT) have promoted the popularity of numerous mobile applications. According to the latest statistics, by 2022, more than 29 billion mobile devices will be connected through the Internet, and almost all of these devices will be used in various applications in our daily lives, such as smart healthcare, self-driving cars, virtual reality, etc. These applications mainly rely on mobile devices (MDs), such as laptops, tablets, and smartphones, to collect data from IoT sensors to serve end users. To meet the growing computing needs of users. Mobile edge computing (MEC) is considered to be an extension of cloud computing as a promising technology for data computing and communication in mobile networks. Instead of transmitting computing requests to a central computing station, MEC places servers at the edge of the mobile network with computing and storage resources to improve the computing performance of MDs. Multiple distributed MDs naturally share the computing and communication resources of base stations to process data tasks, thereby reducing business latency and improving service quality.
[0003] However, the design of efficient task offloading schemes for MDs still faces considerable challenges. On the one hand, since there is no trusted entity to audit the data transmission process or ensure the security protection of sensitive and personal data in the system, it is often difficult to fully guarantee the security and authenticity of the data interaction or sharing process. On the other hand, since many IoT nodes are lightweight with limited computing power and energy resources, it is difficult for these IoT nodes to independently perform massive or complex data tasks. Therefore, there may be a large number of (MDs) that require computationally intensive services at the same time, and each MD always aims to occupy as many edge resources as possible, which may cause network traffic congestion. Due to limited storage and computing resources, it will be difficult for MEC servers to provide their computing services. Therefore, it is very important to develop an intelligent and cooperative offloading scheme to guide the offloading actions of all MDs in a distributed MEC system.
[0004] In addition, the dynamic communication between IoT devices, MD and MEC servers, and the migration of IoT data tasks in MEC networks may lead to security vulnerabilities. Blockchain is widely regarded as a promising data security technology and is a distributed open data structure for recording and storing transactions. In IoT scenarios, the decentralization, sharing and tamper-proof features of blockchain can be used to ensure the integrity and security of data. Consensus mechanisms such as proof of work (PoW), practical Byzantine fault tolerance (PBFT) and delegated Byzantine fault tolerance (DBFT) are used to ensure data consistency of blockchain.
[0005] Unlike traditional MEC systems that usually rely on a central server to coordinate MEC operations, blockchain helps build decentralized edge communications without the need for a single authority, eliminating the risk of a single point of failure. The main purpose is to verify data transactions, aiming to guarantee the security of the edge network involved. In addition, since blockchain and MEC have the same decentralized characteristics, it will become natural to combine the two advanced technologies. Each MD joins the block mining process to maintain the operation of the blockchain in MEC. Therefore, in a blockchain-based MEC system, the MD performs mining and the data blocks are protected and linked through an immutable ledger. As more and more devices mine the blockchain, the security of the edge network also increases accordingly. Nevertheless, the energy overhead and complex computing problems caused by the blockchain consensus procedure cannot be ignored. Summary of the invention
[0006] In response to the technical problems of energy consumption and complex calculations caused by the above-mentioned blockchain consensus program, the present invention provides a blockchain Internet of Things collaborative resource allocation optimization method based on MARL, aiming to achieve the comprehensive design of task offloading and blockchain in edge computing.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] A MARL-based blockchain Internet of Things collaborative resource allocation optimization method includes the following steps:
[0009] S1. Build key network components of blockchain-based MEC system;
[0010] S2. Build a transmission model. The transmission channel is used for data transmission from MD to MEC server.
[0011] S3, MD receives various computing data through IoT devices and blockchain systems. MD will offload computing tasks to MEC servers for data processing according to the offloading strategy. The computing model includes local execution and MEC server execution;
[0012] S4. When the intelligent edge node uploads data to the MD through a request, the MD can collect the corresponding data and package it into a transaction, and then send the transaction to the blockchain network to reach a consensus;
[0013] S5, respectively calculate the unloading utility, benefit, and system utility, and define the state space and action space;
[0014] S6. Collaborative task offloading and block mining based on distributed MARL.
[0015] The key network components for building a blockchain-based MEC system in S1 include:
[0016] IoT Sensors: IoT sensors use cameras, smart watches, and devices responsible for sensing the physical environment. Each IoT device is considered a lightweight node and transmits this data wirelessly to the MD for necessary data processing to serve the end user.
[0017] Edge devices: Each MD manages some IoT sensors within its coverage area. Depending on user needs, the MD can use its computing power to process data tasks locally, or offload to a nearby MEC server via wireless transmission. The MD also participates in block mining, i.e. transaction verification and block generation, through the PBFT consensus mechanism.
[0018] MEC server: In the blockchain-based mobile edge computing system, there is a MEC server located at the base station to handle the massive data tasks offloaded from the MD, which requires a higher data transmission rate and lower transmission delay;
[0019] Blockchain: The blockchain network is deployed on the MEC system, and each MD acts as a blockchain; the unchangeable data collected by IoT sensors can be recorded as a transaction and transmitted to the blockchain at each time slot t for information verification and consensus.
[0020] The method for constructing the transmission model in S2 is:
[0021] Define a task offloading strategy that uses variables Indicates that when When , it means task Y from MD n Offload to the MEC server via subchannel k, otherwise Each computing task can be executed locally in the MD or offloaded to the MEC server under the offloading strategy. Let p represent the transmission power strategy of the MD, where MD sends task Y through channel k n The transmit power when offloading to the base station is subject to the maximum budget ; Assume that each MD and base station has an antenna for uplink communication; It is expressed as the uplink channel gain between MD and base station on channel k; In order to derive the wireless transmission rate, it is necessary to first obtain the total system bandwidth W;
[0022] W=B MEC / K[Hz] (1)
[0023] Then, the transmission data rate of MD is calculated as:
[0024]
[0025] where σ 2 is the background noise variance, and the second term in the denominator is the interference between mobile users in the same channel.
[0026] The local execution in S3 is:
[0027] MD performs task D on n The processing delay caused It is expressed as:
[0028]
[0029] The energy consumption of MD when executing tasks locally is:
[0030]
[0031] in, It represents the computing resources allocated to the MD for executing data tasks, which should not exceed its total computing capacity, and r represents the energy coefficient.
[0032] The MEC server in S3 executes:
[0033] The latency and energy cost of data tasks are calculated by and Calculated
[0034]
[0035]
[0036] Among them, D n is the data task size, F MEC Calculates the CPU frequency of the MEC server.
[0037] The blockchain network in S4 has a total of M consensus nodes, represented by m = {1, 2, ..., M}; PBFT is used as the intelligent consensus protocol. When the number of faulty nodes is less than M / 3, it can ensure the effectiveness of the system; the PBFT consensus mechanism is an algorithm mechanism based on message passing consistency. It takes five stages for each node in the system to reach a consensus, namely, the request stage, the pre-preparation stage, the preparation stage, the submission stage, and the reply stage; therefore, the total computing cycle of a consensus process of a block containing computing task data is
[0038]
[0039] Where g(t) represents the total transaction size, which depends on the block size; o(t) represents the average transaction size, λ represents the probability of correctly verifying a transaction at the request stage; the time required to verify the signature and message authentication code is denoted by θ, and the time required to generate the signature and MAC is denoted by δ;
[0040] In addition, based on the total CPU consumption cycles required for a consensus process, the service delay caused by the consensus process can be calculated as follows
[0041]
[0042] Among them, t n represents the broadcast delay between nodes, i n (t) represents the block interval used to generate new blocks.
[0043] The method for calculating the unloading utility in S5 is:
[0044] In MEC systems, offloading utility is mainly determined by their task computation time T n and energy consumption E n To express;
[0045]
[0046] Define a utility function to evaluate the offloading utility, which is specified as the trade-off between the time and energy consumption of a task compared to local execution.
[0047]
[0048] Among them, the uninstall utility function reflects the improvement in quality of service (QoE) relative to local execution; when the MD executes the task locally, the offloading utility is equal to 0; if the computational cost of the offloading mode is lower than that of the local execution mode, the offloading utility is is positive, which indicates that the offloading QoE improves; however, if too many tasks are offloaded, the MD may suffer higher latency due to traffic congestion, which will degrade the QoE; therefore, the offloading utility is a negative number;
[0049] The calculation method of the income is:
[0050] According to the maximum delay time of the task, the mining utility of MD in MEC system is specified as:
[0051]
[0052] Similarly, when the MD time is higher than the maximum delay time to complete the task, the utility is negative; otherwise it is positive.
[0053] The calculation method of the system utility in S5 is:
[0054] By optimizing offloading decisions, channel selection, transmit power allocation, computational resource allocation, and block interval control to maximize the system utility, the proposed optimization problem is then defined as follows:
[0055]
[0056]
[0057] Among them, β is the weight factor; in this optimization problem, constraints C1 and C4 indicate that each task can be executed locally or offloaded to the MEC server via a subchannel; C2 represents the transmission power constraint of each MD; C3 and C6 stipulate that each MD must allocate computing resources to perform computing tasks, but cannot exceed the total computing budget F max ; Each MD must also allocate CPU resources for block verification at the maximum CPU capacity; C5 ensures that each data task needs to be completed under the delay threshold; therefore, the reward function can be expressed by R(t)
[0058]
[0059] Where τ represents the penalty;
[0060] The state space is defined as:
[0061] The agent in the mobile edge device first observes and perceives the environmental state, and then the agent gains experience and updates the decision-making strategy by perceiving the environmental state information; the environmental state in the collaborative blockchain resource allocation network includes 4 components, which can be expressed as follows
[0062] S(t)={S task (t),S channel (t),Spower (t),S res (t)} (15)
[0063] Where S task (t) The state is defined as S task (t)=[D n ,C n ], D n ,C n They represent the size of the MD computing task and the CPU cycles required to complete the computing task; S channel (t) The state is defined as: b n,k (t) indicates that MD occupies the subchannel at time t, then it is 1, otherwise it is 0; S power (t) The status is similar: P N,K represents the transmission power of MD in subchannel k; finally, S res (t) state is represented by: Sres(t) = {ν1(t), ν2(t) ... ν N (t)},ν N (t) represents the status of the currently available computing resources and CPU resources of the MD.
[0064] The action space in S5 is defined as:
[0065] The action space includes offloading decision, channel selection, transmit power selection, computational resource allocation and CPU resource allocation, and block interval, which is given by
[0066]
[0067] in, represents the task offloading decision from MD to MEC server, x n =0 means that the MEC server processes the computing task locally, otherwise, x n =1; p n (t) is the transmission power allocation when data is transmitted from MD to MEC server; k(t) represents that MD selects available channels according to the current channel status to offload tasks to MEC server; φ n (t) represent the computing resources and CPU resources allocated by MD respectively; i n (t) represents the block interval.
[0068] The method of collaborative task offloading and block mining based on distributed MARL in S6 is:
[0069] The offloading algorithm consists of two types of neural networks, called actor and critic networks. The actor network takes the state as input and outputs a probability distribution over all possible actions to take in a given state. The critic network takes the current state as input and outputs the action value for that state, which represents the expected reward for taking an action in the current state.
[0070] The MAPPO method prevents policy updates from taking too large a step by limiting the difference between the new policy and the old policy in each update; this controlled similarity in updates helps improve training stability; in addition, importance sampling allows policy evaluation and policy optimization in a multi-agent environment to better understand and improve each agent’s policy.
[0071]
[0072] Here ρ represents the probability ratio between the new strategy and the old strategy, represents the advantage function, clip(ρ,1-ε,1+ε) represents the clipping of ρ to ensure that it remains within the specified range; in addition, the critic updates the Q function by minimizing the loss function, which is expressed as
[0073]
[0074] Where V n,φ (s(t)) represents the current value function estimate, represents the objective value function; the parameters φ of the critic network are adjusted to minimize the loss and improve the approximation of the value function.
[0075] Compared with the prior art, the present invention has the following beneficial effects:
[0076] In order to ensure secure data exchange, the present invention introduces and applies blockchain technology. The present invention proposes a novel collaborative offloading scheme that prompts MDs to jointly learn offloading strategies. To achieve this goal, resources such as decision offloading, transmission power, block interval and channel are jointly optimized. The goal of the present invention is to minimize system overhead. The present invention models the optimization problem as a Markov decision process (MDP) and uses the MARL algorithm to solve it. Experimental results show the significant advantages of the scheme proposed in the present invention. In addition, future work should focus on solving privacy issues through blockchain technology and developing solutions for users outside the coverage of base stations. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0078] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0079] Figure 1 It is a system model diagram of the present invention;
[0080] Figure 2 This is a blockchain consensus process diagram of the present invention;
[0081] Figure 3 This is a multi-agent reinforcement learning framework diagram of the present invention;
[0082] Figure 4 A comparison chart of average system rewards of different algorithms of the present invention;
[0083] Figure 5 This is a comparison diagram of the average unloading utilities of different algorithms of the present invention;
[0084] Figure 6 This is a comparison chart of average rewards of different algorithms of the present invention;
[0085] Figure 7 A diagram showing the relationship between the reward and the task size of the system of the present invention;
[0086] Figure 8 A diagram showing the relationship between the reward and the channel bandwidth of the system of the present invention;
[0087] Fig. 9 A diagram showing the relationship between the reward and transmission power of the system of the present invention. DETAILED DESCRIPTION
[0088] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. These descriptions are only to further illustrate the features and advantages of the present invention, rather than to limit the claims of the present invention. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0089] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0090] 1. System Model and Architecture
[0091] In this embodiment, the blockchain-based MEC system model includes a network model, a transmission model, and a blockchain model. Then the task offloading process is described in detail.
[0092] 1. Network Model
[0093] In this embodiment, a MEC system for cooperative task offloading supporting blockchain is considered. Figure 1 As shown. The blockchain network consists of a MEC server, multiple mobile edge devices, and multiple IoT sensors. The blockchain is used as a decentralized database to record IoT transactions and securely manage data exchange between IoT devices, MDs, and MEC servers. In this embodiment, n = {1, 2, ..., N} represents the MD set. Without losing generality, this embodiment assumes that each mobile edge device has an IoT data processing task Y to be executed. n ={C n ,D n ,Q n}, here C n Indicates the CPU cycles required to complete the task, D n Indicates the size of the transmission task, Q n Indicates the maximum delay allowed for task completion time. At the same time, each MD acts as a corresponding blockchain node and participates in block mining by using the PBFT consensus mechanism. Therefore, if the number of MDs increases or decreases in actual scenarios, the blockchain nodes can also be changed accordingly.
[0094] The key network components of the blockchain-based MEC system are described as follows:
[0095] IoT Sensors: IoT sensors such as cameras, smart watches and other devices are responsible for sensing the physical environment. Each IoT device is considered as a lightweight node and transmits this data wirelessly to the MD for necessary data processing to serve the end user.
[0096] Edge devices: Each MD manages some IoT sensors within its coverage area. Depending on user needs, the MD can use its computing power to process data tasks locally, or offload to a nearby MEC server via wireless transmission. The MD also participates in block mining, i.e., transaction verification and block generation, through the PBFT consensus mechanism.
[0097] MEC server: In the blockchain-based mobile edge computing system, there is a MEC server located at the base station to handle the massive data tasks offloaded from the MD, which requires a higher data transmission rate and lower transmission delay.
[0098] Blockchain: The blockchain network is deployed on the MEC system, and each MD acts as a blockchain. The unchangeable data collected by IoT sensors can be recorded as a transaction and transmitted to the blockchain for information verification and consensus at each time slot t.
[0099] 2. Transmission model
[0100] For the transmission model, the transmission channel is used to transmit data from the MD to the MEC server. This embodiment defines a task offloading strategy, which uses the variable Indicates that when When , it means task Y from MD n Offload to MEC server via subband k, otherwise x n = 0. Each computing task can be executed locally in the MD or offloaded to the MEC server under the offloading strategy. Let p represent the transmission power strategy of the MD, where MD sends task Y through channel k n The transmit power when offloading to the base station is subject to the maximum budget In addition, this embodiment assumes that each MD and base station has an antenna for uplink communication. It is expressed as the uplink channel gain between MD and base station on channel k. In order to derive the wireless transmission rate, the total system bandwidth W needs to be obtained first.
[0101] W=B MEC / K[Hz] (1)
[0102] Then, the transmission data rate of MD can be calculated as
[22] :
[0103]
[0104] where σ 2 is the background noise variance, and the second term in the denominator is the interference between mobile users in the same channel.
[0105] 3. Computational Model
[0106] In the system model of this embodiment, MD receives various computing data through IoT devices and blockchain systems. In order to improve computing efficiency, MD will offload computing tasks to MEC servers for data processing according to the offloading strategy. Therefore, this embodiment considers two computing models: local execution and MEC server execution.
[0107] Local execution: MD executes task D on n The processing delay caused It can be expressed as follows
[0108]
[0109] The energy consumption of MD when executing tasks locally is
[0110]
[0111] in It represents the computing resources allocated to the MD for executing data tasks, which should not exceed its total computing capacity, and r represents the energy coefficient.
[0112] MEC server execution: Compared with local devices, MEC servers have stronger computing power. If MD chooses MEC server to execute computing tasks, its delay and energy cost mainly come from MD data transmission and MEC server data processing. Therefore, the delay time and energy cost of data tasks can be calculated by and Calculated
[0113]
[0114] Among them, D n is the data task size, F MEC Calculates the CPU frequency of the MEC server.
[0115] 4. Blockchain Model
[0116] In the blockchain-based MEC system, MD not only performs a large number of tasks uploaded from IoT devices, but also handles a large number of heavy and complex computing tasks generated by the blockchain consensus process. In order to process transactions, MD acts as a blockchain for mining. When the intelligent edge node uploads data to MD through a request, MD can collect the corresponding data and package it into a transaction, and then send the transaction to the blockchain network to reach a consensus, such as Figure 2 shown.
[0117] For the blockchain system, there are M consensus nodes, expressed as m = {1, 2, ..., M}. In addition, this embodiment adopts PBFT as the intelligent consensus protocol, which has been widely recognized by the academic community and can ensure the effectiveness of the system when the number of faulty nodes is less than M / 3. The PBFT consensus mechanism is an algorithm mechanism based on message passing consistency. It takes five stages for each node in the system to reach a consensus, namely the request stage, the pre-preparation stage, the preparation stage, the submission stage, and the reply stage. Therefore, the total computing cycle of a consensus process of a block containing computing task data is
[0118]
[0119] Here g(t) represents the total transaction size, which depends on the block size. o(t) represents the average transaction size and λ represents the probability of correctly verifying a transaction at the request stage. The time required to verify the signature and message authentication code is denoted by θ, and the time required to generate the signature and MAC is denoted by δ.
[0120] In addition, based on the total CPU consumption cycles required for a consensus process, the service delay caused by the consensus process can be calculated as follows
[0121]
[0122] where t n represents the broadcast delay between nodes, i n (t) represents the block interval used to generate new blocks.
[0123] 2. Problem Statement
[0124] In this embodiment, in order to describe the optimization problem, this embodiment proposes a joint consideration of the unloading utility and the mining utility, gives a system utility formula, and proposes a new MARL algorithm to solve it.
[0125] 1. Uninstall Utility
[0126] In MEC systems, offloading utility is mainly determined by their task computation time (T n ) and energy consumption (E n ) to indicate.
[0127]
[0128] This embodiment defines a utility function to evaluate the offloading utility, which is specified as the trade-off between the time and energy consumption of a task compared to local execution.
[0129]
[0130] Here, uninstall the utility function It reflects the improvement of quality of service (QoE) relative to local execution. When MD executes the task locally, the offloading utility is equal to 0. If the computational cost of the offloading mode is lower than that of the local execution mode, the offloading utility is is positive, which indicates that the offloading QoE improves. However, if too many tasks are offloaded, the MD may suffer higher latency due to traffic congestion, which will degrade the QoE. Therefore, the offloading utility Is a negative number.
[0131] 2. Benefits
[0132] This embodiment uses the time formula (8) to construct the mining efficiency in task offloading. The utility is formulated according to the maximum delay time of the task. This embodiment can specify the mining utility of the MD in the MEC system as
[0133]
[0134] Similarly, when the MD time is higher than the maximum delay time to complete the task, the utility is negative; otherwise it is positive.
[0135] 3. System Utility
[0136] In mobile edge computing and systems, the optimization goal is to optimize long-term system energy consumption, service delay and block mining. Therefore, this embodiment proposes an optimization problem to maximize system utility by optimizing offloading decisions, channel selection, transmit power allocation, computing resource allocation and block interval control. Then, the proposed optimization problem is defined as follows
[0137]
[0138] Where W1 and W2 are weight factors. In this optimization problem, constraints C1 and C4 indicate that each task can be executed locally or offloaded to the MEC server via a subchannel. C2 represents the transmission power constraint of each MD; C3 and C6 stipulate that each MD must allocate computing resources to perform computing tasks, but cannot exceed the total computing budget F max Each MD must also allocate CPU resources for block verification at the maximum CPU capacity; C5 ensures that each data task needs to be completed under the delay threshold. Therefore, the reward function can be expressed by R(t)
[0139]
[0140] Where τ represents the penalty.
[0141] 4. State Space
[0142] The agent in the mobile edge device first observes and perceives the environment state, and then the agent gains experience and updates the decision-making strategy by perceiving the environment state information. The environment state in the collaborative blockchain resource allocation network includes 4 components, which can be expressed as follows
[0143] S(t)={S task (t),S channel (t),S power (t),S res (t)} (15)
[0144] Where S task (t) The state is defined as S task (t)=[D n ,C n ], D n ,C n They represent the MD computing task size and the CPU cycles required to complete the computing task. channel (t) The state is defined as: b n,k (t) indicates that MD occupies the subchannel at time t, then it is 1, otherwise it is 0. power (t) The status is similar: P N,K represents the transmission power of MD in subchannel k. Finally, S res (t) state is represented by: Sres(t) = {ν1(t), ν2(t) ... ν N (t)},ν N (t) represents the status of the currently available computing resources and CPU resources of the MD.
[0145] 5. Action Space
[0146] In the whole system, the agent needs to dynamically adjust its behavior to handle task execution and block mining to maximize long-term rewards. Therefore, the action space includes offloading decisions, channel selection, transmit power selection, computing resource allocation and CPU resource allocation, and block interval. It can be given by the following formula
[0147]
[0148] in, represents the task offloading decision from MD to MEC server, x n =0 means that the MEC server processes the computing task locally, otherwise, x n =1; p n (t) is the transmission power allocation when data is transmitted from MD to MEC server; φ n(t) represent the computing resources and CPU resources allocated by MD respectively; i n (t) represents the block interval.
[0149] 3. Collaborative Task Offloading and Block Mining Based on Distributed MARL
[0150] In the blockchain-based collaborative task offloading and block mining problem, due to the partially observable environment, traditional single-agent or non-cooperative multi-agent solutions cannot obtain the MD cooperation strategy. Therefore, an improved MARL method MAPPO algorithm is proposed to solve the collaborative resource allocation problem of blockchain-based Internet of Things. The offloading algorithm of this embodiment is composed of two types of neural networks, called actor and critic networks. The actor network takes the state as input and outputs the probability distribution of all possible actions to be taken in a given state. The critic network takes the current state as input and outputs the action value of the state, which represents the expected reward for taking an action in the current state. Figure 3 shown.
[0151] The MAPPO method prevents policy updates from taking too large a step by limiting the difference between the new policy and the old policy in each update. This control of similarity in updates helps improve training stability. In addition, importance sampling allows for policy evaluation and policy optimization in a multi-agent environment to better understand and improve each agent’s policy.
[0152]
[0153] Here ρ represents the probability ratio between the new strategy and the old strategy, represents the advantage function, and clip(ρ,1-ε,1+ε) represents the clipping of ρ to ensure that it remains within the specified range. In addition, the critic updates the Q function by minimizing the loss function, which is expressed as
[0154]
[0155] Where V n,φ (s(t)) represents the current value function estimate, Denotes the objective value function. The parameters φ of the critic network are adjusted to minimize the loss and improve the approximation of the value function.
[0156] IV. Experiment and Analysis
[0157] 1. Experimental parameters
[0158] In this simulation, TensorFlow 1.13.1 and Python 3.7.5 were used to perform the experimental simulation on Windows 11. In order to simplify the network model, this embodiment only considers one base station equipped with an MEC server and various mobile devices randomly distributed in the coverage area. If the user is outside the coverage area, it means that the BS does not provide wireless access services for the user. This embodiment lists other parameter settings in the scenario, as shown in Table 1.
[0159] Table 1 Simulation parameters
[0160]
[0161] 2. Evaluate training performance
[0162] This example first evaluates the training performance of the proposed algorithm. In order to demonstrate the advantages of the proposed cooperative MAPPO algorithm, this example first demonstrates the convergence of the proposed scheme by comparing it with three other different algorithms.
[0163] 1. This embodiment scheme: using MAPPO algorithm;
[0164] 2. Comparison algorithm: Multi-Agent Deep Deterministic Policy Algorithm (MADDPG);
[0165] 3. No offloading decision-making scheme: Execute computing tasks locally;
[0166] 4. All offloading decision plan: MEC server performs computing tasks.
[0167] Figure 4 The average system reward of the MEC system as the number of episodes increases is shown. It is obvious that the MAPPO scheme of this embodiment shows greater robustness and outperforms in terms of average system reward compared to the baseline scheme. This improvement is attributed to the fact that the proposed solution enables mobile devices to collaborate, reduces channel congestion, minimizes user interference, and improves the efficiency of computing resources, thereby improving the overall system return. The results show that as the number of mobile devices increases, the cooperation strategy learned by MAPPO becomes critical in effectively offloading collaborative edge tasks. Compared with MADDPG, this scheme does not require a central server to train and update the global model, thereby improving the convergence performance. Although the MADDPG scheme has better reward performance than the latter two schemes, it still faces the problem of non-stationary learning, resulting in lower average rewards than the MAPPO scheme.
[0168] Figure 5 and Figure 6The average offloading utility and reward of the MEC system as the number of episodes increases are shown. The MAPPO algorithm of this embodiment outperforms the baseline scheme (local execution and full offloading) in terms of offloading utility and reward. The solution proposed in this embodiment promotes collaboration between mobile devices, reduces channel congestion, and improves the efficiency of computing resources, thereby enhancing the return of the overall system. The MADDPG method usually relies on centralized decision-making, which inevitably may introduce additional delays, heavy communication overhead, and a large-scale state space. Compared with MADDPG, this scheme does not require a central server to train and update the global model. This improvement helps to improve convergence performance. The scheme without making an offloading decision produced zero In the first 50 episodes of all offloading scenarios, negative offloading utilities are observed, indicating that during this period, the computational cost of the offloading mode exceeds the cost of local execution. However, as the number of episodes increases, the learning curve of the scheme continues to rise until it reaches a steady state.
[0169] 3. Performance analysis of different solutions
[0170] In order to further verify the effectiveness of the proposed solution, this embodiment considers four comparison schemes.
[0171] 1) Solution of this embodiment: Use MAPPO algorithm.
[0172] 2) Fixed block interval scheme: The frequency of generating blocks is the same.
[0173] 3) Proposed fixed transmission power scheme: The transmission power is fixed.
[0174] 4) Existing work: No options for adjustment or selection
[0175] This example evaluates the impact of different task sizes on the average offloading utility, such as Figure 7 As shown in Figure 3, the average reward increases first and then decreases as the task size increases. This is because when the tasks are small, the MEC system can effectively use its computing resources to process all offloaded tasks. However, once a certain critical point is reached (Data Size = 6), the system reward decreases due to resource consumption and offloading of large computing tasks from mobile devices to the MEC server. The advantages of the proposed MAPPO scheme over the baseline scheme become more obvious, with a larger performance gap and better utility.
[0176] Figure 8 and Fig. 9The changes in system utility under different schemes with changes in bandwidth and transmission power are described. It can also be noted that with the increase of bandwidth and transmission power, the average reward gradually increases and eventually stabilizes. Due to the joint optimization of offloading decisions, bandwidth, transmission power and computing resources, the solution proposed in this embodiment is always better than other existing solutions.
[0177] This embodiment explores and proposes a blockchain-based IoT collaborative resource allocation scheme, aiming to achieve a comprehensive design of task offloading and blockchain in edge computing. First, in order to ensure secure data exchange, this embodiment introduces and applies blockchain technology. Subsequently, this embodiment proposes a novel collaborative offloading scheme that prompts MDs to jointly learn offloading strategies. To achieve this goal, this embodiment jointly optimizes resources such as decision offloading, transmission power, block interval, and channel. The goal of this embodiment is to minimize system overhead. This embodiment models the optimization problem as a Markov decision process (MDP) and uses the MARL algorithm to solve it. The experimental results show the significant advantages of the scheme proposed in this embodiment. In addition, future work should focus on solving privacy issues through blockchain technology and developing solutions for users located outside the coverage of base stations.
[0178] Only the preferred embodiments of the present invention are described in detail above, but the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention, and various changes should be included in the protection scope of the present invention.
Claims
1. A MARL-based blockchain Internet of Things collaborative resource allocation optimization method, characterized in that: The following steps are involved: S1. Build key network components of blockchain-based MEC system; S2. Build a transmission model. The transmission channel is used for data transmission from MD to MEC server. S3, MD receives various computing data through IoT devices and blockchain systems. MD will offload computing tasks to MEC servers for data processing according to the offloading strategy. The computing model includes local execution and MEC server execution; S4. When the intelligent edge node uploads data to the MD through a request, the MD can collect the corresponding data and package it into a transaction, and then send the transaction to the blockchain network to reach a consensus; S5, respectively calculate the unloading utility, benefit, and system utility, and define the state space and action space; S6. Collaborative task offloading and block mining based on distributed MARL.
2. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The key network components for building a blockchain-based MEC system in S1 include: IoT sensors: IoT sensors use cameras, smart watches, and other devices responsible for sensing the physical environment. Each IoT device is considered a lightweight node and transmits this data wirelessly to the MD for necessary data processing to serve the end user. Edge devices: Each MD manages some IoT sensors within its coverage area. Depending on user needs, the MD can use its computing power to process data tasks locally, or offload to a nearby MEC server via wireless transmission. The MD also participates in block mining, i.e. transaction verification and block generation, through the PBFT consensus mechanism. MEC server: In the blockchain-based mobile edge computing system, there is a MEC server located at the base station to handle the massive data tasks offloaded from the MD, which requires a higher data transmission rate and lower transmission delay; Blockchain: The blockchain network is deployed on the MEC system, and each MD acts as a blockchain; the unchangeable data collected by IoT sensors can be recorded as a transaction and transmitted to the blockchain at each time slot t for information verification and consensus.
3. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The method for constructing the transmission model in S2 is: Define a task offloading strategy that uses variables Indicates that when When , it means task Y from MD n Offload to the MEC server via subchannel k, otherwise Each computing task can be executed locally in the MD or offloaded to the MEC server under the offloading strategy. Let p represent the transmission power strategy of the MD, where MD sends task Y through channel k n The transmit power when offloading to the base station is subject to the maximum budget ; Assume that each MD and base station has an antenna for uplink communication; It is expressed as the uplink channel gain between MD and base station on channel k; In order to derive the wireless transmission rate, it is necessary to first obtain the total system bandwidth W; W=B MEC / K[Hz] (1) Then, the transmission data rate of MD is calculated as: where σ 2 is the background noise variance, and the second term in the denominator is the interference between mobile users in the same channel.
4. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The local execution in S3 is: MD performs task D on n The processing delay caused It is expressed as: The energy consumption of MD when executing tasks locally is: in, It represents the computing resources allocated to the MD for executing data tasks, which should not exceed its total computing capacity, and r represents the energy coefficient.
5. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The MEC server in S3 executes: The latency and energy cost of data tasks are calculated by and Calculated Among them, D n is the data task size, F MEC Calculates the CPU frequency of the MEC server.
6. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The blockchain network in S4 has a total of M consensus nodes, represented by m = {1, 2, ..., M}; PBFT is used as the intelligent consensus protocol. When the number of faulty nodes is less than M / 3, it can ensure the effectiveness of the system; the PBFT consensus mechanism is an algorithm mechanism based on message passing consistency. It takes five stages for each node in the system to reach a consensus, namely, the request stage, the pre-preparation stage, the preparation stage, the submission stage, and the reply stage; therefore, the total computing cycle of a consensus process of a block containing computing task data is Where g(t) represents the total transaction size, which depends on the block size; o(t) represents the average transaction size, λ represents the probability of correctly verifying a transaction at the request stage; the time required to verify the signature and message authentication code is denoted by θ, and the time required to generate the signature and MAC is denoted by δ; In addition, based on the total CPU consumption cycles required for a consensus process, the service delay caused by the consensus process can be calculated as follows Among them, t n represents the broadcast delay between nodes, i n (t) represents the block interval used to generate new blocks.
7. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The method for calculating the unloading utility in S5 is: In MEC systems, offloading utility is mainly determined by their task computation time T n and energy consumption E n To express; Define a utility function to evaluate the offloading utility, which is specified as the trade-off between the time and energy consumption of a task compared to local execution Among them, the uninstall utility function reflects the improvement in quality of service (QoE) relative to local execution; when the MD executes the task locally, the offloading utility is equal to 0; if the computational cost of the offloading mode is lower than that of the local execution mode, the offloading utility is is positive, which indicates that the offloading QoE improves; however, if too many tasks are offloaded, the MD may suffer higher latency due to traffic congestion, which will degrade the QoE; therefore, the offloading utility is a negative number; The calculation method of the income is: According to the maximum delay time of the task, the mining utility of MD in MEC system is specified as: Similarly, when the MD time is higher than the maximum delay time to complete the task, the utility is negative; otherwise it is positive.
8. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The calculation method of the system utility in S5 is: By optimizing offloading decisions, channel selection, transmit power allocation, computational resource allocation, and block interval control to maximize the system utility, the proposed optimization problem is then defined as follows: Among them, β is the weight factor; in this optimization problem, constraints C1 and C4 indicate that each task can be executed locally or offloaded to the MEC server via a subchannel; C2 represents the transmission power constraint of each MD; C3 and C6 stipulate that each MD must allocate computing resources to perform computing tasks, but cannot exceed the total computing budget F max ; Each MD must also allocate CPU resources for block verification at the maximum CPU capacity; C5 ensures that each data task needs to be completed under the delay threshold; therefore, the reward function can be expressed by R(t) Where τ represents the penalty; The state space is defined as: The agent in the mobile edge device first observes and perceives the environmental state, and then the agent gains experience and updates the decision-making strategy by perceiving the environmental state information; the environmental state in the collaborative blockchain resource allocation network includes 4 components, which can be expressed as follows S(t)={S task (t),S channel (t),S power (t),S res (t)}(15) Where S task (t) The state is defined as S task (t)=[D n ,C n ], D n ,C n They represent the size of the MD computing task and the CPU cycles required to complete the computing task; S channel (t) The state is defined as: b n,k (t) indicates that MD occupies the subchannel at time t, then it is 1, otherwise it is 0; S power (t) The status is similar: P N,K represents the transmission power of MD in subchannel k; finally, S res (t) state is represented by: S res (t)={ν1(t),ν2(t)...ν N (t)},ν N (t) represents the status of the currently available computing resources and CPU resources of the MD.
9. According to a MARL-based blockchain Internet of Things collaborative resource allocation optimization method according to claim 1, it is characterized in that: The action space in S5 is defined as: The action space includes offloading decision, channel selection, transmit power selection, computational resource allocation and CPU resource allocation, and block interval, which is given by in, represents the task offloading decision from MD to MEC server, x n =0 means that the MEC server processes the computing task locally, otherwise, x n =1; p n (t) is the transmission power allocation when data is transmitted from MD to MEC server; k(t) represents that MD selects available channels according to the current channel status to offload tasks to MEC server; Respectively represent the computing resources and CPU resources allocated by MD; i n (t) represents the block interval.
10. The MARL-based blockchain IoT collaborative resource allocation optimization method according to claim 1 is characterized in that: The method of collaborative task offloading and block mining based on distributed MARL in S6 is: The offloading algorithm consists of two types of neural networks, called actor and critic networks. The actor network takes the state as input and outputs a probability distribution over all possible actions to take in a given state. The critic network takes the current state as input and outputs the action value for that state, which represents the expected reward for taking an action in the current state. The MAPPO method prevents the policy update step from being too large by limiting the difference between the new policy and the old policy in each update; this control of similarity in updates helps improve the stability of training; Additionally, importance sampling allows for policy evaluation and policy optimization in multi-agent environments to better understand and improve each agent’s policy. Here ρ represents the probability ratio between the new strategy and the old strategy, represents the advantage function, clip(ρ,1-ε,1+ε) represents the clipping of ρ to ensure that it remains within the specified range; in addition, the critic updates the Q function by minimizing the loss function, which is expressed as Where V n,φ (s(t)) represents the current value function estimate, represents the objective value function; the parameters φ of the critic network are adjusted to minimize the loss and improve the approximation of the value function.
Citation Information
Cited By
Industrial internet performance improvement method based on intelligent block chain fragmentation
CN119109924A
Chain network cooperative distributed consensus method based on DAG block chain
CN119892340A
A chain network collaborative distributed consensus method based on a DAG blockchain
CN119892340B
