Research Article

Machine Learning-Based Two-Stage Task Offloading Optimization for Power Distribution Internet of Things

Algorithm 1

ML-based two-stage task offloading optimization algorithm.
1: Input:, , .
2: Output: and
  
3: Phase 1. Initialization
4:  Initialize .
5: Fordo
6:  Phase 2. Large-Timescale First-Stage Server Selection
7:  Step 1:
8:  Initialize , , and .
9:  Step 2:
10:   and calculate the preference values and
   based on (11) and (12) and establish the preference lists and .
11:  Step 3:
12:  While and do
13:    proposes to its most preferred server based on .
14:   Fordo
15:    If the sum of temporary matches and new proposals for is less than quota then
16:     Temporarily match with the devices, update
  , and remove the matched devices from .
17:    else
18:     Temporarily match with its most preferred
   devices and update . Remove matched devices
  from and add unmatched devices into . Unmatched
  devices remove from .
19:    End if
20:    If the sum of matches for is equal to then
21:     Remove from .
22:    End if
23:   End for
24:  End while
25:  Fordo
26:   Phase 3. Small-Timescale Second-Stage Channel
  Selection
27:    makes the action decision based on (18).
28:    calculates and based on (14) and
  (15)
29:   Update and based on (16) and (17).
30:  End for
31: End for