# Patent

## Title
Method for task offloading based on power control and resource allocation in industrial internet of things

## Abstract

A method for task offloading based on power control and resource allocation in the Industrial Internet of Things includes establishing a computing model for computation tasks at different offloading locations, constructing communication power control, resource allocation and computation offloading problems as a mixed integer non-linear programming model, solving them using a deep reinforcement learning algorithm to obtain an optimal strategy for offloading of the computation tasks, thus achieving communication power optimization and cross-domain resource allocation.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
The present application is a continuation-in-part of International Application No. PCT/CN2020/138947 filed Dec. 24, 2022, which claims priority to Chinese Patent Application No. 202010018997.9 filed on Jan. 8, 2020, the disclosures of which are incorporated herein in their entirety by reference.


FIELD OF THE INVENTION
The present invention relates to the field of Industrial Internet of Things, and particularly to a method for task offloading based on power control and resource allocation in the Industrial Internet of Things.
DESCRIPTION OF THE PRIOR ART
The Industrial Internet of Things is an application and expansion of the Internet of Things technology to the industrial sector. Compared with other applications of the Internet of Things, such as intelligent healthcare and intelligent traffic, the industrial sector poses more demanding requirements on the real-time properties and reliability of data. Related studies have shown that most collected industrial data needs to be stored and processed in real time. Therefore, research on efficient task processing strategies capable of meeting the low delay and high reliability requirements is highly necessary.
Development of the Industrial Internet of Things is imposing higher requirements on computational architectures. Cloud computing, as a common computational architecture, possesses abundant computing resources and storage resources. Users, through uploading data to a cloud server for computation, can reduce terminal devices' computational burden. However, in the environment at an industrial site with a large number of devices which generate computation-intensive tasks having demanding requirements on processing delay, uploading massive data to a cloud server would not only lead to network congestion but also produce a great delay. Therefore, edge computing becomes a suitable computational architecture for industrial networking. It can leverage the computing and storage capacity of network edge devices to extend the capabilities of cloud computing to network edges, providing abundant computing resources while effectively reducing network delay and alleviating the stress of network load. Edge computing, thanks to its low delay and high bandwidth advantages, is applicable to many computation-intensive and latency-critical scenarios.
The Industrial Internet of Things, after being combined with edge computing, has brought some new modes and challenges to task processing in networks. Firstly, in the complicated environment at an industrial site, the heterogeneity of underlying devices leads to different computing and communicating capabilities of devices, and computation tasks generated by them have different data volume, computational load and delay requirements. The devices need an optimal computing model that can satisfy the tasks' requirements. Secondly, when a device chooses to offload a task to an edge server for computation, it needs to select a suitable edge server enabling increased computational efficiency. Meanwhile, the edge server also needs to allocate appropriate computing resources to the task to be offloaded to it. Prior research work has generally focused only on the allocation of computing resources, but in practical scenarios, wireless network resources are also a key factor that limits task offloading. Therefore, it is necessary to combine computing resources, communication resources and computing models to optimize task offloading to obtain an optimal strategy for task offloading.
Thus, based on the above analysis, in the Industrial Internet of Things that combines edge computing and industrial wireless technologies, there is an urgent need for an effective task offloading method and resource allocation strategy that can minimize a device's task processing overhead and meet the delay requirements for real time storage and processing of industrial data.
Therefore, those skilled in the art are directing their effort toward developing a method for task offloading based on power control and resource allocation in the Industrial Internet of Things.
SUMMARY OF THE INVENTION
In view of the above described shortcomings of the prior art, the technical problem to be solved by the present invention is to provide a method of computing task offloading in the Industrial Internet of Things to achieve communication power optimization and cross-domain resource allocation. This method, on the premise of satisfying the communication power requirements and computing capacity constraints of devices, through communication power control, allocation of computing resources of edge servers, offloading location decision and the like for devices in different cluster domains, achieves the minimization of task offloading overhead.
To achieve the above objects, the present invention provides a method for task offloading based on power control and resource allocation in the Industrial Internet of Things, comprising the steps of:
Step 1: configuring an Industrial Internet of Things network, wherein the Industrial Internet of Things network comprises a plurality of switches and a plurality of devices, the plurality of switches communicating with one another in a wired fashion. The method may include partitioning the Industrial Internet of Things network into a plurality of cluster domains according to communication coverage ranges of the plurality of switches, wherein each of the plurality of cluster domains comprises one edge server and at least one device of the plurality of devices, the at least one device wirelessly communicating with a switch in the cluster domain where it is in, computing capacity of the edge server being fjS, computing capacity of each of the at least one device being fiL, each of the at least one device configured to generate one computation task Qi, the computation task Qi configured to contain a task data volume indicator di and a task computational load indicator ci. The method may include configuring offloading locations for the computation task, wherein the offloading locations include a first offloading location, a second offloading location and a third offloading location, wherein the first offloading location is the device itself, the second offloading location is a second edge server, the second edge server comprising the edge server in the cluster domain where the device is in, the device offloading, via the second switch, the computation task to the second edge server for computation, the second switch comprising the switch in the cluster domain where the device is in, the second edge server configured to allocate, to the computation task offloaded to it, a certain proportion of computing resources, and the third offloading location is a third edge server, the third edge server comprising the edge server in another cluster domain where the device is not in, the device offloading, via the second switch and a third switch, the computation task to the third edge server for computation, the third switch comprising a switch in the cluster domain where the third edge server is in, the third edge server configured to allocate, to the computation task offloaded to it, a certain proportion of computing resources.
In the case of the computation task being executed at the first offloading location, the method may include establishing a first computing model. In the case of the computation task being executed at the second offloading location, the method may include establishing a second computing model. In the case of the computation task being executed at the third offloading location, the method may include establishing a third computing model.
Step 2: based on the first computing model, the second computing model and the third computing model, establishing a total overhead model for all the computation tasks in the Industrial Internet of Things network, constructing an objective function and constructing a mixed integer non-linear programming problem.
Step 3: decomposing the non-linear programming problem in Step 2 into a communication power optimization problem and a computing resource allocation problem, obtaining optimal communication power at an extreme value point or a boundary of a domain of definition of the communication power optimization problem, using a method of Lagrange multipliers and a system of simultaneous equations of KKT conditions to derive an optimal computing resource allocation strategy for computing resource allocation, substituting the optimal communication power and the optimal computing resource allocation strategy into the objective function to obtain an offloading location decision problem model.
Step 4: based on the offloading location decision problem model obtained in Step 3, establishing a reinforcement learning model, using a deep reinforcement learning algorithm to train parameters of a depth neural network so as to maximize a cumulative reward of the reinforcement learning model from multi-step iteration, obtaining an optimal offloading location decision for the computation tasks, obtaining a joint optimization strategy comprising the optimal communication power, the optimal computing resource allocation strategy and the optimal offloading location decision.
Further, the first computing model comprises first time consumption, first energy consumption and first overhead.
Further, the first time consumption is



 
  
   t
   i
   L
  
  =
  
   
    
     c
     i
    
    
     f
     i
     L
    
   
   .
  
 



Further, the first energy consumption is eiL=ζi(fiL)2ci, where ζi is an energy consumption density of the device i for execution of the computation task.
Further, the first overhead is uiL=αi·tiL+(1−αi)·eiL, where αi is a weight factor and αi ∈ (0,1).
Additionally, the second computing model comprises second time consumption, second energy consumption and second overhead.
Further, the second time consumption is



 
  
   t
   i
   
    L
    ⁢
    S
   
  
  =
  
   
    
     
      d
      i
     
     
      r
      i
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
   =
   
    
     
      d
      i
     
     
      
       B
       i
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
  
 



where γi represents the second edge server that executes the computation task Qi and γi ∈ {1,2, . . . , N}, κiγi represents a proportion of computing capacity allocated by the second edge server γi to the computation task Qi,
a total wireless communication bandwidth of the second switch Sj is Bj, an ensemble of devices in the cluster domain where the device is in is Ψj, the size of an actual bandwidth allocated to the device i is



 
  
   
    B
    i
   
   =
   
    
     
      d
      i
     
     
      
       ∑
       
        k
        ∈
        
         ψ
         j
        
       
      
      
       
        x
        k
       
       ·
       
        d
        k
       
      
     
    
    ·
    
     B
     j
    
   
  
  ,
 



where xi is a binary variable, and xi=0 means the computation task is executed at the first offloading location, while xi=1 means the computation task is executed at the second edge server,
the device i wirelessly communicates with the second switch using time division multiple access (TDMA) at a data transmission rate that is



 
  
   r
   i
  
  =
  
   
    B
    i
   
   ⁢
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
  
 



where pi is communication transmission power of the device i, gi is a channel gain between the device i and the switch, N0 is a single-sided power spectral density of channel noise.
Further, the second energy consumption is



 
  
   e
   i
   
    L
    ⁢
    S
   
  
  =
  
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      r
      i
     
    
   
   =
   
    
     p
     i
    
    ·
    
     
      
       d
       i
      
      
       
        B
        i
       
       ⁢
       
        
         log
         2
        
        (
        
         1
         +
         
          
           
            p
            i
           
           ⁢
           
            g
            i
           
          
          
           
            N
            0
           
           ⁢
           
            B
            i
           
          
         
        
        )
       
      
     
     .
    
   
  
 



Further, the second overhead is
uiLS=αi·tiLS+(1−αi)·eiLS, where αi is a weight factor and αi ∈ (0,1).
Further, the third computing model comprises third time consumption, third energy consumption and third overhead.
Further, a data transmission rate between the second switch and the third switch is a constant rw; the third time consumption is



 
  
   t
   i
   OS
  
  =
  
   
    
     
      d
      i
     
     
      r
      i
     
    
    +
    
     
      d
      i
     
     
      r
      w
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
   =
   
    
     
      d
      i
     
     
      
       B
       i
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
    +
    
     
      d
      i
     
     
      r
      w
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
  
 



where di|ri is a transmission time for the device to offload the computation task to the second switch, di|rw is a transmission time for the second switch to offload the computation task to the third switch,



 
  
   c
   i
  
  
   
    κ
    i
    
     γ
     i
    
   
   ⁢
   
    f
    
     γ
     i
    
    S
   
  
 



is a computation time of the computation task on the third edge server,

γi represents the third edge server that executes the computation task Qi and γi ∈ {1,2, . . . , N}, κiγi represents a proportion of computing capacity allocated by the third edge server γi to the computation task Qi;
a total wireless communication bandwidth of the second switch Sj is Bj, an ensemble of devices in the cluster domain where the device is in is Ψj, the size of an actual bandwidth allocated to the device i is



 
  
   
    B
    i
   
   =
   
    
     
      d
      i
     
     
      
       ∑
       
        k
        ∈
        
         ψ
         j
        
       
      
      
       
        x
        k
       
       ·
       
        d
        k
       
      
     
    
    ·
    
     B
     j
    
   
  
  ,
 



where xi is a binary variable and xi=0 means the computation task is executed at the first offloading location, while xi=1 means the computation task is executed at the third edge server;
the device i wirelessly communicates with the second switch using time division multiple access (TDMA) at a data transmission rate that is



 
  
   r
   i
  
  =
  
   
    B
    i
   
   ⁢
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
  
 



where pi is communication transmission power of the device i, gi is a channel gain between the device i and the switch, N0 is a single-sided power spectral density of channel noise.
Further, the third energy consumption is



 
  
   e
   i
   OS
  
  =
  
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      r
      i
     
    
   
   =
   
    
     p
     i
    
    ·
    
     
      
       d
       i
      
      
       
        B
        i
       
       ⁢
       
        
         log
         2
        
        (
        
         1
         +
         
          
           
            p
            i
           
           ⁢
           
            g
            i
           
          
          
           
            N
            0
           
           ⁢
           
            B
            i
           
          
         
        
        )
       
      
     
     .
    
   
  
 



Further, the third overhead is uiOS=αi·tiOS+(1−αi)·eiOS.
Further, establishing the total offloading overhead model for all the computation tasks in the Industrial Internet of Things network in Step 2 comprises: defining a first decision variable xi={0,1}, wherein xi=0 means the computation task is executed at the first offloading location, while xi=1 means the computation task is offloaded to the edge server for computation; defining a second decision variable βi={0,1}, wherein βi=0 means the computation task is executed at the first offloading location or the second offloading location, while βi=1 means the computation task is executed at the third offloading location; defining a third decision variable γi, wherein γi represents the edge server that executes the computation task and γi ∈ {1,2, . . . , N},
overhead for the computation task Qi is

ui=(1−xi)uiL+xi(uiLS+βi(uiOS−uiLS)),

total overhead for all the computation tasks in the Industrial Internet of Things network is



 
  U
  =
  
   
    
     ∑
     
      i
      =
      1
     
     M
    
    
     u
     i
    
   
   =
   
    
     ∑
     
      i
      =
      1
     
     M
    
    
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          u
          i
          
           L
           ⁢
           S
          
         
         +
         
          
           β
           i
          
          (
          
           
            u
            i
            OS
           
           -
           
            u
            i
            
             L
             ⁢
             S
            
           
          
          )
         
        
        )
       
      
      ]
     
     .
    
   
  
 



Further, constructing the mixed integer non-linear programming problem in Step 2 comprises:
constructing an objective function



 
  
   f
   ⁡
   (
   
    κ
    ,
    p
    ,
    x
    ,
    γ
    ,
    β
   
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     M
    
    
     u
     i
    
   
   =
   
    
     
      ∑
      
       i
       =
       1
      
      M
     
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          u
          i
          
           L
           ⁢
           S
          
         
         +
         
          
           β
           i
          
          (
          
           
            u
            i
            
             O
             ⁢
             S
            
           
           -
           
            u
            i
            
             L
             ⁢
             S
            
           
          
          )
         
        
        )
       
      
      ]
     
    
    =
    
     
      ∑
      
       i
       =
       1
      
      M
     
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          
           α
           i
          
          ·
          
           (
           
            
             
              d
              i
             
             
              
               B
               i
              
              ⁢
              
               
                log
                2
               
               (
               
                1
                +
                
                 
                  
                   p
                   i
                  
                  ⁢
                  
                   g
                   i
                  
                 
                 
                  
                   N
                   0
                  
                  ⁢
                  
                   B
                   i
                  
                 
                
               
               )
              
             
            
            +
            
             
              c
              i
             
             
              
               κ
               i
               
                γ
                i
               
              
              ⁢
              
               f
               
                γ
                i
               
               S
              
             
            
           
           )
          
         
         +
         
          
           (
           
            1
            -
            
             α
             i
            
           
           )
          
          ·
          
           p
           i
          
          ·
          
           
            d
            i
           
           
            
             B
             i
            
            ⁢
            
             
              log
              2
             
             (
             
              1
              +
              
               
                
                 p
                 i
                
                ⁢
                
                 g
                 i
                
               
               
                
                 N
                 0
                
                ⁢
                
                 B
                 i
                
               
              
             
             )
            
           
          
         
         +
         
          
           α
           i
          
          ·
          
           β
           i
          
          ·
          
           
            d
            i
           
           
            r
            w
           
          
         
        
        )
       
      
      ]
     
    
   
  
 



where, constraints are:



 
  
   
    
     ∑
     
      i
      ∈
      
       O
       
        γ
        i
       
      
     
    
    
     κ
     i
     
      γ
      i
     
    
   
   ≤
   1
  
  ;
 



pi≤pimax; xi∈[0,1], l=1,2, . . . , n; βi∈{0,1}, t=1,2, . . . ,m; γi∈{1,2, . . . ,n}; Oγi represents a set of computation tasks processed on the edge server γi, the optimization variables κiγi, pi are continuous variables, xi, βi and γi are integer variables.

Further, Step 3 comprises: according to the offloading location where the computation task is executed, substituting a set of feasible solutions, x0, β0 and γ0, into the objective function to obtain a function of the continuous variable κi and a function of the continuous variable pi; transforming the function of the continuous variable pi into a communication power optimization problem and solving it to obtain the optimal communication power p*i; transforming the function of the continuous variable κi into a computing resource allocation problem and solving it to obtain the optimal computing resource allocation strategy κ*i; substituting the optimal communication power p*i and the optimal computing resource allocation strategy κ*i into the original objective function to obtain the offloading location decision problem expressed as:



 
  
   f
   ⁡
   (
   
    x
    ,
    γ
    ,
    β
   
   )
  
  =
  
   
    ∑
    
     i
     =
     1
    
    M
   
   
    [
    
     
      
       (
       
        1
        -
        
         x
         i
        
       
       )
      
      ⁢
      
       u
       i
       L
      
     
     +
     
      
       x
       i
      
      (
      
       
        
         α
         i
        
        ·
        
         (
         
          
           
            d
            i
           
           
            
             B
             i
            
            ⁢
            
             
              log
              2
             
             (
             
              1
              +
              
               
                
                 p
                 i
                 *
                
                ⁢
                
                 g
                 i
                
               
               
                
                 N
                 0
                
                ⁢
                
                 B
                 i
                
               
              
             
             )
            
           
          
          +
          
           
            c
            i
           
           
            
             κ
             i
             *
            
            ⁢
            
             f
             
              γ
              i
             
             S
            
           
          
         
         )
        
       
       +
       
        
         (
         
          1
          -
          
           α
           i
          
         
         )
        
        ·
        
         p
         i
         *
        
        ·
        
         
          d
          i
         
         
          
           B
           i
          
          ⁢
          
           
            log
            2
           
           (
           
            1
            +
            
             
              
               p
               i
               *
              
              ⁢
              
               g
               i
              
             
             
              
               N
               0
              
              ⁢
              
               B
               i
              
             
            
           
           )
          
         
        
       
       +
       
        
         α
         i
        
        ·
        
         β
         i
        
        ·
        
         
          d
          i
         
         
          r
          w
         
        
       
      
      )
     
    
    ]
   
  
 



Further, the communication power optimization problem is configured to leverage the nature of the function to solve the optimal communication power.
Further, the computing resource allocation problem is configured to first leverage the convex optimization theory to make a decision and then use a method of Lagrange multipliers and KKT (Karush-Kuhn-Tucker) conditions to solve the optimal allocation strategy.
Further, Step 4 comprises:
Step 4.1: defining a state, an action and a reward;
Step 4.2: initializing a memory buffer area, the memory buffer area configured to store at least one set of memory data, the memory data comprising a current state, a current action, a current reward and a subsequent state, and initializing a weight of a value function network to make network parameters of the objective function the same as network parameters of the value function;
Step 4.3: initializing a state of the value function network, computing total time consumption T and total energy consumption E of all the computation tasks, taking a result of the computation as a state s1, and inputting the state s1 to the value function network to obtain corresponding outputs of the value function in response to different actions taken in the state s1;
Step 4.4: selecting a current action using a ε-greedy strategy, after executing the current action, obtaining an immediate reward and proceeding to the next state obtaining an immediate reward and proceeding to the next state st+1, storing each set of the memory data in the memory buffer area;
Step 4.5: stochastically sampling a plurality of the memory data from the memory buffer area, in case of the current state being a final state, configuring a temporal difference target as rj, in case of the current state not being a final state, inputting each of the plurality of the memory data to the objective function network to compute the temporal difference target, the objective function giving a network output as



 
  
   r
   +
   
    γ
    
     max
     
      a
      ′
     
    
    
     Q
     ⁡
     (
     
      
       s
       ′
      
      ,
      
       
        a
        ′
       
       ;
       
        θ
        -
       
      
     
     )
    
   
  
  ;
 



Step 4.6: taking the network outputs of the value function as estimated values, taking the network outputs of the objective function as a labeled value, using an SGD (Stochastic Gradient Descent) algorithm to update the network parameters of the value function,
wherein an expression of the SGD algorithm is



 
  
   
    Δ
    ⁢
    θ
   
   =
   
    
     ∇
     
      Q
      ⁡
      (
      
       s
       ,
       
        a
        ;
        θ
       
      
      )
     
    
    ×
    
     α
     [
     
      r
      +
      
       γ
       
        max
        
         a
         ′
        
       
       
        Q
        ⁡
        (
        
         
          s
          ′
         
         ,
         
          
           a
           ′
          
          ;
          
           θ
           -
          
         
        
        )
       
      
      -
      
       Q
       ⁡
       (
       
        s
        ,
        
         a
         ;
         θ
        
       
       )
      
     
     ]
    
   
  
  ,
 



the network parameters of the value function are configured to be updated according to the formula θ=θ+Δθ;
Step 4.7: repeating Steps 4.4 to 4.6 until the network parameters of the value function are updated for a fixed number of times, valuing the objective function network with the network parameters of the value function in the current state, outputting an optimal state and an action associated with the optimal state.
Further, the state comprises the total time consumption T and the total energy consumption E of all the computation tasks, the total time consumption T being the sum of the first time consumption, the second time consumption and the third time consumption of all the computation tasks, the total energy consumption E being the sum of the first energy consumption, the second energy consumption and the third energy consumption of all the computation tasks;
the action comprises a first decision variable vector [x1,x2, . . . ,xm] a second decision variable vector [β1,β2, . . . ,βm] and a third decision variable vector [γ1,γ2, . . . ,γm],
wherein the first decision variable vector is configured to determine whether the computation tasks need to be offloaded, the second decision variable vector is configured to determine whether the computation tasks are computed on the edge servers in the cluster domains where the devices are in, the third decision variable vector is configured to determine the edge servers where the computation tasks are on, an action space of the action is α=[x1,x2, . . . ,xm,β1,β2, . . . ,βm,γ1,γ2, . . . ,γm];
the reward is configured as a reward function



 
  
   r
   =
   
    
     
      U
      local
     
     -
     U
    
    
     U
     local
    
   
  
  ,
 



where Ulocal is total overhead when all the computation tasks are computed at the first offloading locations, U is total overhead required to complete all the computation tasks under the current decision.
The present invention is based on cross-domain offloading in the Industrial Internet of Things to construct a computation task offloading model in a cross-domain network, which minimizes offloading overhead for all computation tasks, thus satisfying the requirements of computation-intensive tasks in an industrial environment on computation energy consumption and processing delay. The present invention takes into account communication power optimization, computing resource allocation and offloading location decision problems, establishes a mixed integer non-linear programming problem and decompose the problem into three optimization sub-problems which are then solved. For the offloading location decision problem, a deep reinforcement learning algorithm is adopted to solve it, and a reinforcement learning model for task offloading in the cross-domain network is constructed. This not only can reduce task offloading overhead but also has low temporal complexity.
Below, the concept, structural details and resulting technical effects of the present invention will be further described with reference to the accompanying drawings to provide a full understanding of the objects, features and effects of the invention.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a schematic diagram of a cross-domain network based computation task offloading model of the present invention;
FIG. 2 is a schematic flow diagram of a task offloading method of the present invention;
FIG. 3 is a flow diagram of deep reinforcement learning based offloading location decision of the present invention.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
Below, the accompanying drawings of this specification are referenced to introduce many preferred embodiments of the present invention so that the techniques thereof become more apparent and readily understood. The present invention may be embodied in many different forms of embodiment, and the protection scope of the invention is not limited only to the embodiments mentioned herein.
Throughout the accompanying drawings, structurally identical parts are indicated with identical reference numerals, and structurally or functionally similar components are indicated with similar reference numerals. The size and thickness of each component in the drawings are arbitrarily depicted, and the present invention is not limited to any size or thickness of each component. For greater clarity of illustration, the thicknesses of some parts are exaggerated as appropriate somewhere in the drawings.
Shown in FIG. 1 is a cross-domain network based computation task offloading model.
A method used thereby for task offloading based on power control and resource allocation includes the steps as follows, with reference to FIG. 2:
Step 1: configure an Industrial Internet of Things network, wherein, the Industrial Internet of Things network includes a plurality of switches and a plurality of devices, and the plurality of switches communicate with one another in a wired fashion. The plurality of devices may be any device used at industrial site, including, but not limited to, machines that produce products, product transportation devices such as AGVs and hoisting machinery, and detection devices.
According to communication coverage ranges of the plurality of switches, the Industrial Internet of Things network is partitioned into a plurality of cluster domains.
Each of the plurality of cluster domains includes one edge server and at least one device. The device in each cluster domain communicates with a switch in the cluster domain wirelessly, and through the switch in the cluster domain where it is in, offloads a computation task to an edge server in this cluster domain for computation. Devices cannot directly communicate with switches in different cluster domains, but switches in different cluster domains can communicate with one another in a wired fashion. Therefore, a computation task from a device in a cluster domain can be offloaded by a switch in this cluster domain to the edge server in another cluster domain for computation. Computing capacity of the edge server is denoted as fjS, and computing capacity of each device is denoted as fiL. Each device is configured to generate one computation task Qi. The computation task Qi is configured to contain a data volume indicator di of the task and a computational load indicator ci of the task.
Offloading locations for the computation task are configured. As shown in FIG. 1, a device 11 in a first cluster domain 1 will be described to exemplify the offloading location configuration process for the computation task. It should be understood that computation tasks generated by devices in other cluster domains are subject to offloading location configuration processes all following the same steps.
The offloading locations include a first offloading location, a second offloading location and a third offloading location, wherein the first offloading location is the device 11 itself that generates the computation task. The second offloading location is a second edge server. The second edge server includes an edge server 12 in the first cluster domain 1 where the device 11 is in. The device 11 offloads, via a second switch, the computation task to the second edge server 12 for computation. The second switch includes a switch 13 in the first cluster domain 1 where the device 11 is in. The second edge server is configured to allocate, to the computation task offloaded to it, a certain proportion of computing resources. The third offloading location is a third edge server. The third edge server includes the edge server in another cluster domain where the device 11 is not in, such as an edge server 22 in a second cluster domain 2, or an edge server 23 in a third cluster domain 3. The device 11 offloads, via the second switch and a third switch, the computation task to the third edge server for computation. The third switch includes a switch in another cluster domain where the device 11 is not in, such as a switch 23 in the second cluster domain 2, or an edge server 33 in the third cluster domain 3. The third edge server is configured to allocate, to the computation task offloaded to it, a certain proportion of computing resources.
In case of the computation task being executed at the first offloading location, a first computing model is established.
In case of the computation task being executed at the second offloading location, a second computing model is established.
In case of the computation task being executed at the third offloading location, a third computing model is established.
Step 2: Based on the first computing model, the second computing model and the third computing model, establish a total overhead model for all the computation tasks in the Industrial Internet of Things network, and construct a mixed integer non-linear programming problem.
Step 3: Decompose the non-linear programming problem in Step 2 into a communication power optimization problem and a computing resource allocation problem, obtain optimal communication power at an extreme value point or a boundary of a domain of definition of the communication power optimization problem, use a method of Lagrange multipliers and a system of simultaneous equations of KKT conditions to derive an optimal computing resource allocation strategy for computing resource allocation, substitute the optimal communication power and the optimal computing resource allocation strategy into the objective function to obtain an offloading location decision problem model.
Step 4: Based on the communication power and the computing resource allocation strategy obtained in Step 3, establish a reinforcement learning model, use a deep reinforcement learning algorithm to train parameters of a depth neural network so as to maximize a cumulative reward of the reinforcement learning model from multi-step iteration, obtain an optimal offloading location decision for the computation tasks, obtain a joint optimization strategy including the optimal communication power, the optimal computing resource allocation strategy and the optimal offloading location decision.
In Step 1, n switches are arranged in an industrial network system, and according to communication coverage ranges of these switches, the network is partitioned into n cluster domains. Aside each switch, there is arranged one edge server with computing capacity of fjS. In the network, there are m on-site devices scattered in the n cluster domains. Computing capacity of each on-site device is fiL, and each device will generate one computation task Qi. The task Qi includes two indicators: data volume size di of the task and computational load ci of the task. Each task is made available with three computation options, which are respectively computation on the specific device, computation on the edge server in the respective cluster domain, and computation on the edge server in another cluster domain.
Computation on the device (first computing model):
First time consumption of computation on the device is



 
  
   t
   i
   L
  
  =
  
   
    c
    i
   
   
    f
    i
    L
   
  
 



First energy consumption of computation on the device is eiL=ζi(fiL)2ci, where ζi is an energy consumption density for computation on the device i.
First overhead for computation on the device is uiL=αi·tiL+(1−αi)·eiL, where αi is a weight factor and αi∈(0,1).
Offloading of the computation task to the edge server in the respective cluster domain where the device is in and computation thereon (second computing model).
Time consumption of computation on the edge server in the local cluster domain is a task transmission time plus a computation time. At first, a wireless transmission model is established.
Within the same cluster domain, during a data uploading process from a device to the switch, a single wireless frequency is used. As uplinks of different devices suffer from interference with one another, which affects the transmission rate and transmission quality, a time division multiple access (TDMA) technique is employed. The TDMA technique divides time into periodic, non-overlapping frames, and each TDMA frame is divided into a number of time slots. Devices transmit data in the respectively assigned time slots, enabling many-to-one communication without mutual interference. This increases the utilization of wireless channel resources and, at locations with heavy network load, allows for desirable utilization of wireless channels, ensuring transmission quality and rate and providing tasks with real time guarantees. Since tasks from devices in the cluster domain are offloaded to different locations and have different requirements on channel resources, a dynamic time slot allocation algorithm is adopted, in which only when a device is in need of data transmission, it is allocated with a time slot. This avoids interference with the uplink of another device and increases time slot utilization.
A TDMA frame is structured to contain header bits, several time slots and tail bits. Each time slot contains information such as synchronization bits, user information bits and guard bits. Among these, data to be transmitted is contained in the user information bits, and is also a main part of TDMA frame transmission. If a total wireless communication bandwidth for the switch j in the cluster domain is Bj, then a total bandwidth that one TDMA frame can allocate will be Bj. It is necessary to, according to the number of devices in need of offloading and data volumes of the tasks in the cluster domain, to carry out time slot and bandwidth allocation for the devices. Assuming that, in the cluster domain of the switch Sj, a corresponding ensemble of devices is



 
  
   B
   i
  
  =
  
   
    
     d
     i
    
    
     
      ∑
      
       k
       ∈
       
        ψ
        j
       
      
     
     
      
       x
       k
      
      ·
      
       d
       k
      
     
    
   
   ·
   
    B
    j
   
  
 



Ψj, and that corresponding rules are determined according to the actual topology of the network, then according to the dynamic time slot allocation algorithm, time slot and bandwidth allocation is carried out for devices in need of task offloading. Allocation proportions are determined according to data volume sizes of the tasks. Then, the size of an actual bandwidth allocated to the device i is:

where xi is a binary variable. xi=0 means the task is computed on the device, while xi=1 means the task is offloaded to the edge server for computation.
The Shannon formula is used to derive a data transmission rate at which the device transmits the task:



 
  
   r
   i
  
  =
  
   
    B
    i
   
   ⁢
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
  
 



where Bi is a wireless channel bandwidth allocated to the device i, pi is communication transmission power of the device, gi is a channel gain between the device i and the switch, N0 is a single-sided power spectral density of channel noise. Second time consumption can be obtained as



 
  
   t
   i
   LS
  
  =
  
   
    
     d
     i
    
    
     
      B
      i
     
     ⁢
       
     
      
       log
        
      
      2
     
     ⁢
     
      (
      
       1
       +
       
        
         
          p
          i
         
         ⁢
         
          g
          i
         
        
        
         
          N
          0
         
         ⁢
         
          B
          i
         
        
       
      
      )
     
    
   
   +
   
    
     c
     i
    
    
     
      κ
      i
      
       γ
       i
      
     
     ⁢
     
      f
      
       γ
       i
      
      S
     
    
   
  
 



where γi denotes the location of the edge server for the computation task Qi and γi ∈ {1,2, . . . , N}, κiγi represents a proportion of computing capacity allocated by the edge server γi to the task Qi. As what is to be optimized according to the present invention takes into account only the device, energy consumption is equal to the second energy consumption of the device for transmitting the task to the switch in the respective cluster domain. That is,



 
  
   e
   i
   
    L
    ⁢
    S
   
  
  =
  
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      r
      i
     
    
   
   =
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      
       B
       i
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
   
  
 



Second overhead for computation in the respective cluster domain is



 
  
   u
   i
   
    L
    ⁢
    S
   
  
  =
  
   
    
     
      α
      i
     
     ·
     
      t
      i
      
       L
       ⁢
       S
      
     
    
    +
    
     
      (
      
       1
       -
       
        α
        i
       
      
      )
     
     ·
     
      e
      i
      
       L
       ⁢
       S
      
     
    
   
   =
   
    
     
      α
      i
     
     ·
     
      (
      
       
        
         d
         i
        
        
         
          B
          i
         
         ⁢
         
          
           log
           2
          
          (
          
           1
           +
           
            
             
              p
              i
             
             ⁢
             
              g
              i
             
            
            
             
              N
              0
             
             ⁢
             
              B
              i
             
            
           
          
          )
         
        
       
       +
       
        
         c
         i
        
        
         
          κ
          i
          
           γ
           i
          
         
         ⁢
         
          f
          
           γ
           i
          
          S
         
        
       
      
      )
     
    
    +
    
     
      (
      
       1
       -
       
        α
        i
       
      
      )
     
     ·
     
      p
      i
     
     ·
     
      
       d
       i
      
      
       
        B
        i
       
       ⁢
       
        
         log
         2
        
        (
        
         1
         +
         
          
           
            p
            i
           
           ⁢
           
            g
            i
           
          
          
           
            N
            0
           
           ⁢
           
            B
            i
           
          
         
        
        )
       
      
     
    
   
  
 



Offloading of the computation task to the edge server in another cluster domain and computation thereon (third computing model).
For offloading the computation task to the edge server in another cluster domain, the transmission path is two-hop, i.e., first from the device to the switch in the local cluster domain, and then from the switch in the local cluster domain to the switch in the destination cluster domain. The switches in different cluster domains are connected in a wired fashion, and a data transmission rate between them is a constant rw. Time consumption of computation of the computation task on the edge server in the other cluster domain consists of three parts: a transmission time for the device to offload the task to the switch in the respective cluster domain, a transmission time for the switch in the respective cluster domain to offload the task to the switch in the destination cluster domain, and a computation time of the task on the edge server in the destination cluster domain. Therefore, third time consumption is



 
  
   t
   i
   OS
  
  =
  
   
    
     
      d
      i
     
     
      r
      i
     
    
    +
    
     
      d
      i
     
     
      r
      w
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
   =
   
    
     
      d
      i
     
     
      
       B
       
        i
          
       
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
    +
    
     
      d
      i
     
     
      r
      w
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
  
 



Third energy consumption is



 
  
   e
   i
   OS
  
  =
  
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      r
      i
     
    
   
   =
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      
       B
       
        i
          
       
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
   
  
 



Here, similarly, only energy consumption for the device to transmit the task to the switch in the respective cluster domain is considered.
Third overhead is uiOS=αi·tiOS+(1−αi)·eiOS.
Step 2 specifically involves:
based on the three computing models established in Step 1, establishing a total overhead model for the offloading of the computation task. First of all, a decision variable xi={0,1} is defined so that xi=0 means the computation task is computed on the local device, while xi=1 means the computation task is offloaded to an edge server for computation. A decision variable βi={0,1} is defined so that βi=0 means the computation task is executed on the edge server in the respective cluster domain, while βi=1 means the computation task is executed on the edge



 
  U
  =
  
   
    
     ∑
     
      i
      =
      1
     
     M
    
    
     u
     i
    
   
   =
   
    
     ∑
     
      i
      =
      1
     
     M
    
    
     [
     
      
       
        (
        
         1
         -
         
          x
          i
         
        
        )
       
       ⁢
       
        u
        i
        L
       
      
      +
      
       
        x
        i
       
       (
       
        
         u
         i
         
          L
          ⁢
          S
         
        
        +
        
         
          β
          i
         
         (
         
          
           u
           i
           OS
          
          -
          
           u
           i
           
            L
            ⁢
            S
           
          
         
         )
        
       
       )
      
     
     ]
    
   
  
 



server in another cluster domain. The location of an edge server is denoted as γi, where γi ∈ {1,2, . . . , N}. Total overhead for offloading of the computation task Qi is ui=(1−xi)uiL+xi(uiLS+βi(uiOS−uiLS)). Thus, total overhead for offloading of all the computation tasks in the Industrial Internet of Things network is:

The following objective function is constructed:



 
  
   f
   ⁡
   (
   
    κ
    ,
    p
    ,
    x
    ,
    γ
    ,
    β
   
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     M
    
    
     u
     1
    
   
   =
   
    
     
      ∑
      
       i
       =
       1
      
      M
     
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          u
          i
          
           L
           ⁢
           S
          
         
         +
         
          
           β
           i
          
          (
          
           
            u
            i
            
             O
             ⁢
             S
            
           
           -
           
            u
            i
            
             L
             ⁢
             S
            
           
          
          )
         
        
        )
       
      
      ]
     
    
    =
    
     
      ∑
      
       i
       =
       1
      
      M
     
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          
           α
           i
          
          ·
          
           (
           
            
             
              d
              i
             
             
              
               B
               i
              
              ⁢
              
               
                log
                2
               
               (
               
                1
                +
                
                 
                  
                   p
                   i
                  
                  ⁢
                  
                   g
                   i
                  
                 
                 
                  
                   N
                   0
                  
                  ⁢
                  
                   B
                   i
                  
                 
                
               
               )
              
             
            
            +
            
             
              c
              i
             
             
              
               κ
               i
               
                γ
                i
               
              
              ⁢
              
               f
               
                γ
                i
               
               S
              
             
            
           
           )
          
         
         +
         
          
           (
           
            1
            -
            
             α
             i
            
           
           )
          
          ·
          
           p
           i
          
          ·
          
           
            d
            i
           
           
            
             B
             i
            
            ⁢
            
             
              log
              2
             
             (
             
              1
              +
              
               
                
                 p
                 i
                
                ⁢
                
                 g
                 i
                
               
               
                
                 N
                 0
                
                ⁢
                
                 B
                 i
                
               
              
             
             )
            
           
          
         
         +
         
          
           α
           i
          
          ·
          
           β
           i
          
          ·
          
           
            d
            i
           
           
            r
            w
           
          
         
        
       
      
      ]
     
    
   
  
 



Constraints of this function are:



 
  
   
    
     ∑
     
      i
      ∈
      
       O
       
        γ
        i
       
      
     
    
    
     κ
     i
     
      γ
      i
     
    
   
   ≤
   1
  
    
  ;
 



pi≤pimax; xi∈{0,1}, l=1,2, . . . ,m; βiε{0,1}, l=1,2, . . . ,m; γi ∈ {1,2, . . . , N}. Where, Oγ, represents a set of computation tasks processed on the edge server γi, the optimization variables κiγi, pi are continuous variables, xi, βi and γi are integer variables. As such, a mixed integer non-linear programming problem is constructed.

In Step 3, the mixed integer non-linear programming problem constructed in Step 2 is solved.
In Step 3, a given set of feasible solutions corresponding to the offloading location of the computation task, x0, β0 and γ0, is substituted into the original objective function. Assuming there are l on-site devices choosing to offload the computation tasks to edge servers for processing, in which p devices choose to offload the tasks to the edge servers in other cluster domains for processing and the remaining devices choose local computation, then in the objective function, there remain only the continuous variables κi and pi. The objective function is expressed as:



 
  
   f
   ⁡
   (
   
    κ
    ,
    p
   
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     l
    
    
     [
     
      
       
        α
        i
       
       ·
       
        (
        
         
          
           d
           i
          
          
           
            B
            
             i
               
            
           
           ⁢
           
            
             log
             2
            
            (
            
             1
             +
             
              
               
                p
                i
               
               ⁢
               
                g
                i
               
              
              
               
                N
                0
               
               ⁢
               
                B
                i
               
              
             
            
            )
           
          
         
         +
         
          
           c
           i
          
          
           
            κ
            i
            
             γ
             i
            
           
           ⁢
           
            f
            
             γ
             i
            
            S
           
          
         
        
        )
       
      
      +
      
       
        (
        
         1
         -
         
          α
          i
         
        
        )
       
       ·
       
        p
        i
       
       ·
       
        
         d
         i
        
        
         
          B
          
           i
             
          
         
         ⁢
         
          
           log
           2
          
          (
          
           1
           +
           
            
             
              p
              i
             
             ⁢
             
              g
              i
             
            
            
             
              N
              0
             
             ⁢
             
              B
              i
             
            
           
          
          )
         
        
       
      
     
     ]
    
   
   +
   
    
     ∑
     
      i
      =
      1
     
     p
    
     
    
     
      
       α
       i
      
      ·
      
       
        d
        i
       
       
        r
        w
       
      
     
     ⁢
     
      
       ∑
       
        i
        =
        
         M
         -
         l
         +
         1
        
       
       M
      
       
      
       
        α
        i
       
       ·
       
        
         c
         i
        
        
         f
         i
         L
        
       
      
     
    
   
  
 



The non-linear programming problem is decomposed into a communication power optimization problem and a computing resource allocation problem. The following functions and constraints are obtained:



 
  
   g
   ⁡
   (
   p
   )
  
  =
  
   
    ∑
    
     i
     =
     l
    
    l
   
    
   
    [
    
     
      
       α
       i
      
      ·
      
       
        d
        i
       
       
        
         B
         
          i
            
         
        
        ⁢
        
         
          log
          2
         
         (
         
          1
          +
          
           
            
             p
             i
            
            ⁢
            
             g
             i
            
           
           
            
             N
             0
            
            ⁢
            
             B
             i
            
           
          
         
         )
        
       
      
     
     +
     
      
       (
       
        1
        -
        
         α
         i
        
       
       )
      
      ·
      
       p
       i
      
      ·
      
       
        d
        i
       
       
        
         B
         
          i
            
         
        
        ⁢
        
         
          log
          2
         
         (
         
          1
          +
          
           
            
             p
             i
            
            ⁢
            
             g
             i
            
           
           
            
             N
             0
            
            ⁢
            
             B
             i
            
           
          
         
         )
        
       
      
     
    
    ]
   
  
 



with the corresponding constraint pi≤pimax;
and



 
  
   h
   ⁡
   (
   κ
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     l
    
    
     
      α
      i
     
     ·
     
      
       c
       i
      
      
       
        κ
        i
        
         γ
         i
        
       
       ⁢
       
        f
        
         γ
         i
        
        S
       
      
     
    
   
   +
   
    
     ∑
     
      i
      =
      1
     
     p
    
    
     
      α
      i
     
     ·
     
      
       d
       i
      
      
       r
       w
      
     
    
   
   +
   
    
     ∑
     
      i
      =
      
       M
       -
       l
       +
       1
      
     
     M
    
    
     
      α
      i
     
     ·
     
      
       c
       i
      
      
       f
       i
       L
      
     
    
   
  
 



with the corresponding constraint



 
  
   
    ∑
    
     i
     ∈
     
      O
      
       γ
       i
      
     
    
   
   
    κ
    i
    
     γ
     i
    
   
  
  ≤
  1.
 



For the communication power optimization problem g(p), parameter substitutions are made by letting



 
  
   A
   =
   
    
     
      α
      i
     
     ·
     
      d
      i
     
    
    
     B
     i
    
   
  
  ,
  
   B
   =
   
    
     
      (
      
       1
       -
       
        α
        i
       
      
      )
     
     ·
     
      d
      i
     
    
    
     B
     i
    
   
  
  ,
  
   C
   =
   
    
     g
     i
    
    
     
      N
      0
     
     ⁢
     
      B
      i
     
    
   
  
  ,
 



qi=log2(1+C·pi). Thus,




 
  
   
    p
    i
   
   =
   
    
     
      2
      
       q
       i
      
     
     -
     1
    
    C
   
  
  ,
 



and the original function is transformed into




 
  
   G
   ⁡
   (
   
    q
    i
   
   )
  
  =
  
   
    A
    ·
    
     1
     
      q
      i
     
    
   
   +
   
    B
    ·
    
     
      
       
        2
        
         q
         i
        
       
       -
       1
      
      
       C
       ·
       
        q
        i
       
      
     
     .
    
   
  
 



A first-order derivative of this is obtained as




 
  
   
    
     G
     ′
    
    (
    
     q
     i
    
    )
   
   =
   
    
     
      -
      A
     
     ·
     
      1
      
       q
       i
       2
      
     
    
    +
    
     
      B
      C
     
     ·
     
      
       
        ln
        ⁢
        
         2
         ·
         
          q
          i
         
         ·
         
          2
          
           q
           i
          
         
        
       
       -
       
        2
        
         q
         i
        
       
       +
       1
      
      
       q
       i
       2
      
     
    
   
  
  ,
 



and a second-order derivative as




 
  
   
    G
    ′′
   
   (
   q
   )
  
  =
  
   
    
     
      2
      ⁢
      A
     
     
      q
      i
      3
     
    
    +
    
     
      B
      c
     
     ·
     
      
       
        
         
          (
          
           ln
           ⁢
           2
          
          )
         
         2
        
        ·
        
         q
         i
         2
        
        ·
        
         2
         
          q
          i
         
        
       
       +
       
        2
        ·
        
         2
         
          q
          i
         
        
       
       -
       
        2
        ⁢
        ln
        ⁢
        
         2
         ·
         
          q
          i
         
         ·
         
          2
          
           q
           i
          
         
        
       
       -
       2
      
      
       q
       i
       3
      
     
    
   
   =
   
    
     
      2
      ⁢
      A
     
     
      q
      i
      3
     
    
    +
    
     
      B
      C
     
     ·
     
      
       
        ln
        ⁢
        
         2
         ·
         
          q
          i
         
         ·
         
          2
          
           q
           i
          
         
        
        ⁢
        
         (
         
          
           ln
           ⁢
           
            2
            ·
            
             q
             1
            
           
          
          -
          2
         
         )
        
       
       +
       
        2
        ·
        
         (
         
          
           2
           
            q
            i
           
          
          -
          1
         
         )
        
       
      
      
       q
       i
       3
      
     
    
   
  
 



Let y=ln2·qi·2qi (ln2·qi−2)+2·(2qi−1), y′=(ln2)2·qi2·2qi>0. Thus, y monotonically increases in the domain of definition qi>0. Moreover, as y(qi=0)=0,




 
  
   
    
     ln
     ⁢
     
      2
      ·
      
       q
       i
      
      ·
      
       2
       
        q
        i
       
      
     
     ⁢
     
      (
      
       
        ln
        ⁢
        
         2
         ·
         
          q
          i
         
        
       
       -
       2
      
      )
     
    
    +
    
     2
     ·
     
      (
      
       
        2
        
         q
         i
        
       
       -
       1
      
      )
     
    
   
   
    q
    i
    3
   
  
  >
  0
 



is always true in the domain of definition qi>0. Therefore, G′′(qi)>0, i.e., the function G(q) is a convex function.

Since G′′(qi)>0, G′(qi) monotonically increases in the domain of definition. Let G′(qi)=0, then we obtain the value of qi0 at which first-order derivative is zero. Thus, if qi∈(0,qi0) and G′(qi)<0, then G(q) monotonically decreases. If qi∈(qi0,∞) and G′(qi)>0, then G(q) monotonically increases. From a range in which the value of pi is constrained, a range in which the value of qi is constrained is obtained as



 
  
   q
   i
  
  ≤
  
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
        max
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
   .
  
 



If




 
  
   
    q
    i
    0
   
   ≤
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
        max
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
  
  ,
 



then the optimal value will be qi0. That is,




 
  
   p
   i
   *
  
  =
  
   
    
     
      (
      
       
        2
        
         q
         0
        
       
       -
       1
      
      )
     
     ⁢
     
      N
      0
     
     ⁢
     
      B
      i
     
    
    
     g
     i
    
   
   .
  
 



Otherwise, the optimal value will be




 
  
   
    log
    2
   
   (
   
    1
    +
    
     
      
       p
       i
       max
      
      ⁢
      
       g
       i
      
     
     
      
       N
       0
      
      ⁢
      
       B
       i
      
     
    
   
   )
  
  .
 



That is, p*i=pimax.

Through calculating a Hessian matrix of the function h(κ) over the variable κ, it can be proved that the function h(κ) is a convex function over the variable κ. Moreover, since the constraints are linear, the resource allocation sub-problem is a convex optimization problem over the variable κ. A Lagrange function of h(κ) is established as



 
  
   L
   ⁡
   (
   
    κ
    ,
    v
   
   )
  
  =
  
   
    h
    ⁡
    (
    κ
    )
   
   -
   
    
     ∑
     
      j
      =
      1
     
     n
    
    
     
      
       v
       j
      
      (
      
       1
       -
       
        
         ∑
         
          i
          ∈
          
           O
           
            γ
            i
           
          
         
        
        
         κ
         i
         
          γ
          i
         
        
       
      
      )
     
     .
    
   
  
 



Solving it using the KKT conditions results in an optimal computing resource allocation strategy as




 
  
   κ
   i
   *
  
  =
  
   
    
     
      c
      i
     
    
    
     
      ∑
      
       i
       ∈
       
        O
        j
       
      
     
     
      
       c
       i
      
     
    
   
   .
  
 



By substituting the optimal communication power, p*i and optimal computing resource allocation strategy κ*i into the original objective function, we obtain an offloading location decision problem expressed as:



 
  
   f
   ⁡
   (
   
    x
    ,
    γ
    ,
    β
   
   )
  
  =
  
   
    ∑
    
     i
     =
     1
    
    M
   
   
    [
    
     
      
       (
       
        1
        -
        
         x
         i
        
       
       )
      
      ⁢
      
       u
       i
       L
      
     
     +
     
      
       x
       i
      
      (
      
       
        
         α
         i
        
        ·
        
         (
         
          
           
            d
            i
           
           
            
             B
             i
            
            ⁢
            
             
              log
              2
             
             (
             
              1
              +
              
               
                
                 p
                 i
                 *
                
                ⁢
                
                 g
                 i
                
               
               
                
                 N
                 0
                
                ⁢
                
                 B
                 i
                
               
              
             
             )
            
           
          
          +
          
           
            c
            i
           
           
            
             κ
             i
             *
            
            ⁢
            
             f
             
              γ
              i
             
             S
            
           
          
         
         )
        
       
       +
       
        
         (
         
          1
          -
          
           α
           i
          
         
         )
        
        ·
        
         p
         i
         *
        
        ·
        
         
          d
          i
         
         
          
           B
           i
          
          ⁢
          
           
            log
            2
           
           (
           
            1
            +
            
             
              
               p
               i
               *
              
              ⁢
              
               g
               i
              
             
             
              
               N
               0
              
              ⁢
              
               B
               i
              
             
            
           
           )
          
         
        
       
       +
       
        
         α
         i
        
        ·
        
         β
         i
        
        ·
        
         
          d
          i
         
         
          r
          w
         
        
       
      
      )
     
    
    ]
   
  
 



This offloading location decision problem is an integer linear programming problem over the variables xi, βi and γi. In Step 4, a deep reinforcement learning algorithm is adopted for solution. Reinforcement learning has three key components: state, action and reward. For the offloading location decision problem model in this application, the three components are defined as follows.
State: a state of the system is total time consumption T and total energy consumption E of all the tasks.
Action: an action of the system consist of three parts, which are respectively the variable [x1,x2, . . . ,xm] determining whether a task needs to be offloaded, the variable [β1,β2, . . . ,βm] determining whether a task is computed on the edge server in the respective cluster domain, and the variable [γ1,γ2, . . . ,γm] of the edge server location for a computation task. Therefore, an action space is defined as α=[x1,x2, . . . ,xm,β1,β2, . . . ,βmγ1,γ2, . . . ,γm].
Reward: when the system in a state s takes an action a to transition to the next state s′, an immediate reward is given as R (s,a). The goal of reinforcement learning is to find a continuous optimal strategy that maximizes the total reward, while the objective function requires computation overhead for all the tasks to be shortest. Therefore, a reward of the system is defined as:



 
  r
  =
  
   
    
     U
     local
    
    -
    U
   
   
    U
    local
   
  
 



where Ulocal is total overhead when all the tasks are computed on the devices, U is total overhead required to complete the tasks when the system takes the current decision. Therefore, the value of the objective function is negatively correlated to the reward function. At the maxima of the reward function, the minima of the objective function can be obtained.
As shown in FIG. 3, in Step 4, the deep reinforcement learning includes the steps of:
Step 4.1: defining a state, an action and a reward;
Step 4.2: initializing a memory buffer area, the memory buffer area configured to store at least one set of memory data, the memory data including a current state, a current action, a current reward and a subsequent state, and initializing a weight of a value function network to make network parameters of the objective function the same as network parameters of the value function;
Step 4.3: initializing a state of the value function network, computing total time consumption T and total energy consumption E of all the computation tasks, taking a result of the computation as a state s1, and inputting the state s1 to the value function network to obtain corresponding outputs of the value function in response to different actions taken in the state s1;
Step 4.4: performing action selection using a ε-greedy strategy by stochastically selecting an action αt at a probability of ε or, otherwise, selecting an action that maximizes the value function, obtaining an immediate reward and proceeding to the next state st+1 as a result of executing the action, and storing each set of such memory data (including the state, action, immediate reward and next state) in the memory buffer area for network training;
Step 4.5: stochastically sampling a plurality of the memory data from the memory buffer area, in case of the current state being a final state, configuring a temporal difference target as rj, in case of the current state not being a final state, inputting each of the plurality of the memory data to the objective function network to compute the temporal difference target, the objective function giving a network output as



 
  
   r
   +
   
    γ
     
    
     max
     
      a
      ′
     
    
     
    
     Q
     ⁡
     (
     
      
       s
       ′
      
      ,
      
       
        a
        ′
       
       ;
       
        θ
        -
       
      
     
     )
    
   
  
  ;
 



Step 4.6: taking the network outputs of the value function as estimated values, taking the network output of the objective function as a labeled value, using an SGD (Stochastic Gradient Descent) algorithm to update the network parameters of the value function,
wherein an expression of the SGD algorithm is



 
  
   
    Δ
    ⁢
    θ
   
   =
   
    
     ∇
     
      Q
      ⁡
      (
      
       s
       ,
       
        a
        ;
        θ
       
      
      )
     
    
    ×
    
     α
     [
     
      r
      +
      
       γ
       
        max
        
         a
         ′
        
       
       
        Q
        ⁡
        (
        
         
          s
          ′
         
         ,
         
          a
          ′
         
         ,
         
          θ
          -
         
        
        )
       
      
      -
      
       Q
       ⁡
       (
       
        s
        ,
        
         a
         ;
         θ
        
       
       )
      
     
     ]
    
   
  
  ,
 



the network parameters of the value function are configured to be updated according to the formula θ=θ+Δθ;
Step 4.7: repeating Steps 4.4 to 4.6 until the network parameters of the value function are updated for a fixed number of times, valuing the objective function network with the network parameters of the value function in the current state, outputting an optimal state and an action associated with the optimal state. Moreover, this valuation approach weakens the relevance between successive data and increases stability of the network parameters.
Preferred specific embodiments have been described in detail above. It should be understood that, those of ordinary skill in the art, without the need for creative effort, can make various modifications and changes, based on the concept of the present invention. Accordingly, all the technical solutions that can be obtained by those skilled in the art by logical analysis, inference or limited experimentation in accordance with the concept of the invention on the basis of the prior art are intended to fall within the protection scope as defined by the claims.

## Claims

1. A method for task offloading based on power control and resource allocation in the Industrial Internet of Things, comprising steps of:
step 1: configuring an Industrial Internet of Things network,
wherein the Industrial Internet of Things network comprises a plurality of switches and a plurality of devices, the plurality of switches communicating with one another in a wired fashion,
partitioning the Industrial Internet of Things network into a plurality of cluster domains according to communication coverage ranges of the plurality of switches,
wherein each of the plurality of cluster domains comprises one edge server and at least one device of the plurality of devices, the at least one device wirelessly communicating with a switch in the cluster domain where it is in, computing capacity of the edge server being fjS, computing capacity of each of the at least one device being fiL, each of the at least one device configured to generate one computation task Qi, the computation task Q. configured to contain a task data volume indicator di and a task computational load indicator ci,
executing the computation task on a device of the plurality of devices, and establishing a first computing model; wherein the first computing model comprises first time consumption tiL, first energy consumption eiL and first overhead uiL;
offloading the computation task to a first edge server for computation thereon, and establishing a second computing model; wherein the first edge server comprising an edge server in a cluster domain where the device is in, the device offloading, via a first switch, the computation task to the first edge server for computation, the first switch comprising a switch in the cluster domain where the device is in, the first edge server configured to allocate, to the computation task offloaded to the first edge server, computing resources; wherein the second computing model comprises second time consumption tiLS, second energy consumption eiLS and second overhead uiLS;
offloading the computation task to a second edge server for computation thereon, and establishing a third computing model; wherein the second edge server comprising an edge server in another cluster domain where the device is not in, the device offloading, via the first switch and a second switch, the computation task to the second edge server for computation, the second switch comprising a switch in a cluster domain where the second edge server is in, the second edge server configured to allocate, to the computation task offloaded to the second edge server, computing resources; wherein the third computing model comprises third time consumption tiOS, third energy consumption eiOS and third overhead uiOS;
step 2: based on the first computing model, the second computing model and the third computing model, establishing a total overhead model for all computation tasks in the Industrial Internet of Things network, constructing an objective function and constructing a mixed integer non-linear programming problem; wherein the step 2 comprises:
defining a first decision variable xi={0,1}, wherein xi=0 means the computation task is executed at the device, while xi=1 means the computation task is offloaded to an edge server for computation;
defining a second decision variable βi={0,1}, wherein βi=0 means the computation task is executred at the first edge server, while βi=1 means the computation task is executed at the second edge server;
defining a third decision variable γi, wherein γi represents the edge server that executes the computation task and γi ∈{1,2. . . ,N},
overhead for the computation task Qi is


ui=(1−xi)uiL+xi(uiLS+βi(uiOS−uiLS))


total overhead U for all the computation tasks in the Industrial Internet of Things network is




 
  U
  =
  
   
    
     ∑
     
      i
      =
      1
     
     M
    
     
    
     u
     i
    
   
   =
   
    
     ∑
     
      i
      =
      1
     
     M
    
     
    
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          u
          i
          LS
         
         +
         
          
           β
           i
          
          (
          
           
            u
            i
            OS
           
           -
           
            u
            i
            LS
           
          
          )
         
        
        )
       
      
      ]
     
     .
    
   
  
 


constructing the objective function as follows:




 
  
   f
   ⁡
   (
   
    κ
    ,
    p
    ,
    x
    ,
    γ
    ,
    β
   
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     M
    
     
    
     u
     i
    
   
   =
   
    
     
      ∑
      
       i
       =
       1
      
      M
     
      
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       +
       
        
         x
         i
        
        (
        
         
          u
          i
          LS
         
         +
         
          
           β
           i
          
          (
          
           
            u
            i
            OS
           
           -
           
            u
            i
            LS
           
          
          )
         
        
        )
       
      
      ]
     
    
    =
    
     
      ∑
      
       i
       =
       1
      
      M
     
      
     
      [
      
       
        
         (
         
          1
          -
          
           x
           i
          
         
         )
        
        ⁢
        
         u
         i
         L
        
       
       ⁢
       
        +
        
         
          x
          i
         
         (
         
          
           
            α
            i
           
           ·
           
            (
            
             
              
               d
               i
              
              
               
                B
                i
               
               ⁢
               
                
                 log
                 2
                
                (
                
                 1
                 +
                 
                  
                   
                    p
                    i
                   
                   ⁢
                   
                    g
                    i
                   
                  
                  
                   
                    N
                    0
                   
                   ⁢
                   
                    B
                    i
                   
                  
                 
                
                )
               
              
             
             +
             
              
               c
               i
              
              
               
                κ
                i
                
                 γ
                 i
                
               
               ⁢
               
                f
                
                 γ
                 i
                
                S
               
              
             
            
            )
           
          
          +
          
           
            (
            
             1
             -
             
              α
              i
             
            
            )
           
           ·
           
            p
            i
           
           ·
           
            
             d
             i
            
            
             
              B
              i
             
             ⁢
             
              
               log
               2
              
              (
              
               1
               +
               
                
                 
                  p
                  i
                 
                 ⁢
                 
                  g
                  i
                 
                
                
                 
                  N
                  0
                 
                 ⁢
                 
                  B
                  i
                 
                
               
              
              )
             
            
           
          
          +
          
           
            α
            i
           
           ·
           
            β
            i
           
           ·
           
            
             d
             i
            
            
             r
             w
            
           
          
         
         )
        
       
      
      ]
     
    
   
  
 


where, constraints are Σi∈oyκiγi ≤1; pi≤pimax; xi∈{0,1}, i=1,2, . . . , m, βi∈{0,1}, i=1,2. . . m, γi∈{1,2, . . . , n}, Oyi represents a set of the computation tasks processed on the edge server γi, wherein optimization variables κiγi , Pi are continuous variables, xi, βi and γi are integer variables, thereby constructing the mixed integer non-linear programming problem;
Step 3: decomposing the non-linear programming problem in the step 2 into a communication power optimization problem and a computing resource allocation problem, obtaining optimal communication power at an extreme value point or a boundary of a domain of definition of the communication power optimization problem, using a method of Lagrange multipliers and a system of simultaneous equations of Karush-Kuhn-Tucker (KKT) conditions to derive an optimal computing resource allocation strategy for computing resource allocation, substituting the optimal communication power and the optimal computing resource allocation strategy into the objective function to obtain an offloading location decision problem model; wherein, the step of decomposing the non-linear programming problem into the communication power optimization problem and the computing resource allocation problem comprises:
substituting a given set feasible solutions into the objective function, assuming there are l devices choosing to offload the computation tasks to edge servers for processing, in which there are p devices to offload the computation tasks to the second edge server for processing and the remaining devices choose the first edge server, then in the objective function, there remain only the continuous variables κi and pi thereby the objective function is expressed as:




 
  
   f
   ⁡
   (
   
    κ
    ,
    p
   
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     I
    
     
    
     [
     
      
       
        α
        i
       
       ·
       
        (
        
         
          
           d
           i
          
          
           
            B
            i
           
           ⁢
           
            
             log
             2
            
            (
            
             1
             +
             
              
               
                p
                i
               
               ⁢
               
                g
                i
               
              
              
               
                N
                0
               
               ⁢
               
                B
                i
               
              
             
            
            )
           
          
         
         +
         
          
           c
           i
          
          
           
            κ
            i
            
             γ
             i
            
           
           ⁢
           
            f
            
             γ
             i
            
            S
           
          
         
        
        )
       
      
      +
      
       
        (
        
         1
         -
         
          α
          i
         
        
        )
       
       ·
       
        p
        i
       
       ·
       
        
         d
         i
        
        
         
          B
          i
         
         ⁢
         
          
           log
           2
          
          (
          
           1
           +
           
            
             
              p
              i
             
             ⁢
             
              g
              i
             
            
            
             
              N
              0
             
             ⁢
             
              B
              i
             
            
           
          
          )
         
        
       
      
     
     ]
    
   
   +
   
    
     ∑
     
      i
      =
      1
     
     p
    
    
     
      α
      i
     
     ·
     
      
       d
       i
      
      
       r
       w
      
     
    
   
   +
   
    
     ∑
     
      i
      =
      
       M
       -
       i
       +
       2
      
     
     M
    
    
     
      α
      i
     
     ·
     
      
       c
       i
      
      
       f
       i
       L
      
     
    
   
  
 


wherein the communication power optimization problem is expressed as:




 
  
   g
   ⁡
   (
   p
   )
  
  =
  
   
    ∑
    
     i
     =
     1
    
    I
   
    
   
    [
    
     
      
       α
       i
      
      ·
      
       
        d
        i
       
       
        
         B
         i
        
        ⁢
        
         
          log
          2
         
         (
         
          1
          +
          
           
            
             p
             i
            
            ⁢
            
             g
             i
            
           
           
            
             N
             0
            
            ⁢
            
             B
             i
            
           
          
         
         )
        
       
      
     
     +
     
      
       (
       
        1
        -
        
         α
         i
        
       
       )
      
      ·
      
       p
       i
      
      ·
      
       
        d
        i
       
       
        
         B
         i
        
        ⁢
        
         
          log
          2
         
         (
         
          1
          +
          
           
            
             p
             i
            
            ⁢
            
             g
             i
            
           
           
            
             N
             0
            
            ⁢
            
             B
             i
            
           
          
         
         )
        
       
      
     
    
    ]
   
  
 


with a corresponding constraint pi≤pimax;
wherein the computing resource allocation problem is expressed as:




 
  
   λ
   ⁡
   (
   k
   )
  
  =
  
   
    
     ∑
     
      i
      =
      1
     
     I
    
     
    
     
      α
      i
     
     ·
     
      
       c
       i
      
      
       
        κ
        i
        
         γ
         i
        
       
       ⁢
       
        f
        
         γ
         i
        
        S
       
      
     
    
   
   +
   
    
     ∑
     
      i
      =
      1
     
     p
    
    
     
      α
      i
     
     ·
     
      
       d
       i
      
      
       r
       w
      
     
    
   
   +
   
    
     ∑
     
      i
      =
      
       M
       -
       i
       +
       2
      
     
     M
    
    
     
      α
      i
     
     ·
     
      
       c
       i
      
      
       f
       i
       L
      
     
    
   
  
 


with a corresponding constraint Σi∈qγiκiγi≤1;
solving the communication power optimization problem to obtain an optimal comminication power pi solving the computing resource allocation problem to obtain an optimal computing resource allocation strategy κi substituting the optimal communication power pi and the optimal computing resource allocation strategy κi into the original objective function to obtain an offloading location decision problem expressed as:




 
  
   f
   ⁡
   (
   
    x
    ,
    γ
    ,
    β
   
   )
  
  =
  
   
    ∑
    
     i
     =
     1
    
    M
   
    
   
    
     [
     
      
       
        (
        
         1
         -
         
          x
          i
         
        
        )
       
       ⁢
       
        u
        i
        L
       
      
      +
      
       
        x
        i
       
       (
       
        
         
          α
          i
         
         ·
         
          (
          
           
            
             d
             i
            
            
             
              B
              i
             
             ⁢
             
              
               log
               2
              
              (
              
               1
               +
               
                
                 
                  p
                  i
                  *
                 
                 ⁢
                 
                  g
                  i
                 
                
                
                 
                  N
                  0
                 
                 ⁢
                 
                  B
                  i
                 
                
               
              
              )
             
            
           
           +
           
            
             c
             i
            
            
             
              κ
              i
              *
             
             ⁢
             
              f
              
               γ
               i
              
              S
             
            
           
          
          )
         
        
        +
        
         
          (
          
           1
           -
           
            α
            i
           
          
          )
         
         ·
         
          p
          i
          *
         
         ·
         
          
           d
           i
          
          
           
            B
            i
           
           ⁢
           
            
             log
             2
            
            (
            
             1
             +
             
              
               
                p
                i
                *
               
               ⁢
               
                g
                i
               
              
              
               
                N
                0
               
               ⁢
               
                B
                i
               
              
             
            
            )
           
          
         
        
        +
        
         
          α
          i
         
         ·
         
          β
          i
         
         ·
         
          
           d
           i
          
          
           r
           w
          
         
        
       
       )
      
     
     ]
    
    .
   
  
 


step 4: based on the offloading location decision problem model obtained in the step 3, establishing a reinforcement learning model, using a deep reinforcement learning algorithm to train parameters of a depth neural network so as to maximize a cumulative reward of the reinforcement learning model from multi-step iteration, obtaining an optimal offloading location decision for the computation tasks, obtaining a joint optimization strategy comprising the optimal communication power, the optimal computing resource allocation strategy and the optimal offloading location decision, wherein the step 4 comprises;
stp 4.1: defining a state, an action and a reward; wherein the state is a state of system which comprises total time consumption T and total energy consumption E of all the tasks, the action comprises a first decision variable vector [x1, x2, . . . xm], a second decision variable vector [β1, β2, . . . βm] and a third decision variable vetor [κ1, κ2, . . . κm];
wherein the first decision variable vector is configured to determine whether the computation tasks need to be offloaded, the second decision variable vector is configured to determine whether the computation tasks are computed on the edge servers in the cluster domains where the devices are in, the third decision variable vector is configured to determine the edge servers where the computation tasks are on, an action space of the action is α=[xi, x2, . . . xm, β1, β2, . . . βm, γ1, γ2, . . . γm];
when the system in a state s takes an action α to transition to a next state s′, an immediate reward is given as R(s,α), the reward of the system is defined as




 
  
   r
   =
   
    
     
      U
      local
     
     -
     U
    
    
     U
     local
    
   
  
  ,
 



wherein Ulocal is total overhead when all the computation tasks are computed at the first offloading locations, U is total overhead required to complete all the computation tasks under a current decision;
step 4.2: initializing a memory buffer area the memory buffer area configured to store at least one set of memory data, the memory data comprising a current state, a current action, a current reward and a subsequent state, and initializing a weight of a value function network to make network parameters of the objective function the same as network parameters of the value funciton;
step 4.3: initializing a state of the value function network, computing total time consumption T and total energy consumption E of all the computation tasks, taking a result of the computation as a state S1 and inputting the state S1to the value function network to obtain corresponding outputs of the value function in response to different actions taken in the state S1;
step 4.4: selecting a current action using a ∈-greedy strategy, after executing the current action, obtaining an immediate reward and proceeding to a next state St+1 , storing each set of the memory data in the memory buffer area,
step 4.5: stochastically sampling a plurality of the memory data from the memory buffer area in case of the current state being a final state, configuring a temporal difference target as ri in case of the current state not being a final state, inputting each of the plurality of the memory data to the objective function network to compute the temporal difference target, the objective function giving a network output as




 
  
   r
   +
   
    γ
     
    
     max
     
      a
      ′
     
    
     
    
     Q
     ⁡
     (
     
      
       s
       ′
      
      ,
      
       
        a
        ′
       
       ;
       
        θ
        -
       
      
     
     )
    
   
  
  ;
 


step 4.6: taking the network outputs of the value function as estimated values, taking the network outputs of the objective function as a labeled value, using an SGD (Stochastic Gradient Descent) algorithm to update the network parameters of the value function,
wherein an expression of the SGD algorithm is


∇θ=∇Q(s, α; θ) Xα[r=γmaxQ(s′, α′; θ−)−Q(s, α; θ)]


the network parameters of the value function are configured to be updated according to the forumula θ=θ+∇θ;
step 4.7: repeating steps 4.4 to 4.6 until the network parameters of the value function are updated for a fixed number of times, valuing the objective function network with the network parameters of the value function in the current state, outputting an optimal state and an acton associated with the optimal state.

2. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 1, wherein the first time consumption is



 
  
   t
   i
   L
  
  =
  
   
    
     c
     i
    
    
     f
     i
     L
    
   
   .

3. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 2, wherein the first energy consumption is eiL=ζi(ƒiL)ci, where ζi is an energy consumption density of a device i for execution of the computation task.

4. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 3, wherein the first overhead is uiL=αi·tiL=(1−αi) ·eiL, where αi is a weight factor and αi∈(0,1).

5. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 4, wherein the second time consumption is



 
  
   t
   i
   LS
  
  =
  
   
    
     
      d
      i
     
     
      r
      i
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
   =
   
    
     
      d
      i
     
     
      
       B
       i
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
  
 


where yi represents the second edge server that executes the computation task Qi and Yi∈{1,2, . . . N}, kiYi represents a proportion of computing capacity allocated by the first edge server Yi to the computation task Qi,
a total wireless communication bandwidth of the first switch Si is Bi, an ensemble of devices in the cluster domain where the device is in is Ψi, the size of an actual bandwidth allocated to the device i is




 
  
   
    B
    i
   
   =
   
    
     
      d
      i
     
     
      
       ∑
       
        k
         
        ∈
        
         Ψ
         j
        
       
      
      
       
        x
        k
       
       ·
       
        d
        k
       
      
     
    
    ·
    
     B
     j
    
   
  
  ,
 


where xi is a binary variable, and xi=0 means the computation task is executed at the device, while xi=1 means the computation task is executed at the edge server,
the device i wirelessly communicates with the first switch using time division multiple access (TDMA) at a data transmission rate that is




 
  
   r
   i
  
  =
  
   
    B
    i
   
   ⁢
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
  
 


where pi is communication transmission power of the device i, gi is a channel gain between the device i and the switch, No is a single-sided power spectral density of channel noise.

6. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 5, wherein the second energy consumption is



 
  
   e
   i
   LS
  
  =
  
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      r
      i
     
    
   
   =
   
    
     p
     i
    
    ·
    
     
      
       d
       i
      
      
       
        B
        i
       
       ⁢
       
        
         log
         2
        
        (
        
         1
         +
         
          
           
            p
            i
           
           ⁢
           
            g
            i
           
          
          
           
            N
            0
           
           ⁢
           
            B
            i
           
          
         
        
        )
       
      
     
     .

7. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 6, wherein the second overhead is uiLS=αi·tiLS=(1−αi) ·eiLS, where αi is a weight factor and αi∈(0,1).

8. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 7, wherein a data transmission rate between the first switch and the second switch is a constant rw; the third time consumption is



 
  
   t
   i
   OS
  
  =
  
   
    
     
      d
      i
     
     
      r
      i
     
    
    +
    
     
      d
      i
     
     
      r
      w
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        
         γ
          
        
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
   =
   
    
     
      d
      i
     
     
      
       B
       i
      
      ⁢
      
       
        log
        2
       
       (
       
        1
        +
        
         
          
           p
           i
          
          ⁢
          
           g
           i
          
         
         
          
           N
           0
          
          ⁢
          
           B
           i
          
         
        
       
       )
      
     
    
    +
    
     
      d
      i
     
     
      r
      w
     
    
    +
    
     
      c
      i
     
     
      
       κ
       i
       
        γ
        i
       
      
      ⁢
      
       f
       
        γ
        i
       
       S
      
     
    
   
  
 


where di|ri is a transmission time for the device to offload the computation task to the first switch, di|rw is a transmission time for the first switch to offload the computation task to the second switch,




 
  
   c
   i
  
  
   
    κ
    i
    
     γ
     i
    
   
   ⁢
   
    f
    
     γ
     i
    
    S
   
  
 



is a computation time of the computation task on the second edge server,
Yi represents the second edge server that executes the computation task Qi and Yi∈}1,2, . . . N}, Kiyi represents a proportion of computing capacity allocated by the second edge server Yi to the computation task Qi;
a total wireless communication bandwidth of the first switch Si is Bi, an ensemble of devices in the cluster domain where the device is in is Ψi, a size of an actual bandwidth allocated to the device i is




 
  
   
    B
    i
   
   =
   
    
     
      d
      i
     
     
      
       ∑
       
        k
         
        ∈
        
         Ψ
         j
        
       
      
      
       
        x
        k
       
       ·
       
        d
        k
       
      
     
    
    ·
    
     B
     j
    
   
  
  ,
 


where xi is a binary variable and xi=0 means the computation task is executed at the device, while xi=1 means the computation task is executed at the second edge server;
the device i wirelessly communicates with the first switch using time division multiple access (TDMA) at a data transmission rate that is




 
  
   r
   i
  
  =
  
   
    B
    i
   
   ⁢
   
    
     log
     2
    
    (
    
     1
     +
     
      
       
        p
        i
       
       ⁢
       
        g
        i
       
      
      
       
        N
        0
       
       ⁢
       
        B
        i
       
      
     
    
    )
   
  
 


where Pi is communication transmission power of the device i, gi is a channel gain between the device i and the switch, No is a single-sided power spectral density of channel noise.

9. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 8, wherein the third energy consumption is



 
  
   e
   i
   OS
  
  =
  
   
    
     p
     i
    
    ·
    
     
      d
      i
     
     
      r
      i
     
    
   
   =
   
    
     p
     i
    
    ·
    
     
      
       d
       i
      
      
       
        B
        i
       
       ⁢
       
        
         log
         2
        
        (
        
         1
         +
         
          
           
            p
            i
           
           ⁢
           
            g
            i
           
          
          
           
            N
            0
           
           ⁢
           
            B
            i
           
          
         
        
        )
       
      
     
     .

10. The method for task offloading based on power control and resource allocation in the Industrial Internet of Things as in claim 9, wherein the third overhead is uiOS=αi·tiOS+(1−αi)·eiOS.