|
Algorithm 2 DualContextAtt DQN Algorithm |
Step 1: Initialize
Initialize Q-network and target Q-network with dueling architecture and context-aware self-attention.
Initialize replay buffer D.
for each episode do
Reset environment and observe initial state s.
for each time step do
Select action using -greedy:
Execute , observe reward and next state .
Store in buffer D.
Sample mini-batch of transitions from D.
Step 2: Compute Target Q-values
Step 3: Compute Predicted Q-values with Attention Fusion
Compute value stream
Compute advantage stream
Compute attention fusion weight
Step 4: Compute Loss (MSE)
where
Step 5: Update Parameters
Perform gradient descent on
Update target network parameters: periodically
end for
end for
Step 6: Repeat Until Convergence
Repeat steps until convergence or maximum episodes.
|