Skip to main content
. 2025 Aug 6;25(15):4838. doi: 10.3390/s25154838
Algorithm 2: Actor Network Forward Pass for Joint Action Generation
Input: GNN node embeddings H, vehicle embedding hveh, task features Xtask, global stats gstats
Output: Joint action Ki,λi,αi, log probability logπKi,λi,αiSt
1: Phase A: Select Offloading Target via Attention
2: qatt  MLPqueryhvehXtaskgstats
3: Ctarget  [h_veh, h_rsu_1, ..., h_rsu_M]
4:for each candidate cj in Ctarget do
5:   ej  (qatt  cj) / sqrt (Demb)
6: end for
7: Mask scores for invalid/unavailable targets
8: Ptarget Softmax([e0,e1,,eM])
9: Sample target index Ki ~ Categorical (Ptarget)
10: htarget  Ctarget [Ki]
11: Phase B: Determine Continuous Ratios
12: if Ki = 0 then 
13:   λi  0, αi ← 1
14: else
15:   aλ,bλ  SoftplusMLPλhvehhtargetXtaskgstats + 1
16:   Sample offload ratio λi ~ Beataλ,bλ
17:   aα,bα SoftplusMLPαhvehhtargetXtaskgstatsλi + 1
18:   Sample resource ratio αi ~ Beataα,bα
19: end if
20: Calculate total log probability log π from the distributions
21:return Ki,λi,αi, logπKi,λi,αiSt