Skip to main content
. 2024 Nov 25;24(23):7514. doi: 10.3390/s24237514
Algorithm 3 Deep Q-Learning with Experience Replay.
1: Initialize replay memory D to capacity N;
2: Initialize action-value function Q with random weights
3: for episodes = 1, M do
Initialize sequence s1={x1} and preprocessed sequenced φ1=φ(s1)
4:   for t = 1,T do
5:   With probability ε select a random action select a random action αt
6:   otherwise select αt=maxaQ*(φ(st),α,θ)
7:   Execute action αt in emulator and observe reward rt and image xt+1
7:   Set st+1=st,αt,xt+1 and preprocess φt+1=φ(st+1)
8:   Store transition (φt,αt,rt,φt+1) in D
9:   Sample random minibatch of transitions (φj,αj,rj,φj+1) from D
9:   Set yj= using the RMSprop update rule
10:   Perform a gradient descent step on (yjQ(φj,aj;θ))2
11:    end for
12: end for