Skip to main content
. 2026 Oct 4;26(19):6295. doi: 10.3390/s26196295
Algorithm 1 Pseudocode of the DDPG-HP Algorithm.
Input: State observation s, sampling time Ts = 0.02 s, total duration Tf = 20 s
Random initialization:
Critic network Q(s, a|θc) and Target-Critic network Q′(s, a|θc′)
Actor network μ(s |θμ) and Target-Actor network μ′(s|θμ′)
Experience replay pool D with capacity = 106, minibatch = 128
OU noise: initial variance = 1.2, variance decay rate = 1 × 10−6
Training loop:
For episode = 1 to Nmax do:
    Initialize environment state s = [xcar, ycar, vcar, …, xp, yp, vp]
    For t = 1 to ceil (Tf/Ts) do:
        Select action at based on current policy and OU noise
        Execute action at = [throttle/brake, steeR]T
        Obtain reward rt and next state st+1
        Store experience (st, at, rt, st+1) into replay pool D
        If number of samples in D ≥ 128 then:
            Randomly sample 128 experiences as minibatch (si, ai, ri, si+1)
            Compute TD error δi;
            Update Critic network parameters: θc←θc+αc∇θcL(θc)
            Update Actor network parameters: θμ←θμ+αa∇θμJ(θμ)
            Soft update target networks:
θc′←τθc+(1−τ)θc′  θμ′←τθμ+(1−τ)θμ′

            End
        End
        If convergence criterion is met then
            Stop training
        End
End
Return: Trained Actor network μ(s|θμ)