Skip to main content
. 2026 Jul 14;26(14):4475. doi: 10.3390/s26144475
Algorithm 1 HRL for Dynamic Defense Strategy Solving
Require: System state space S, belief space M, strategy sets AA,AD. Learning rates α1,α2, discount factor γ, convergence threshold ξ, exploration rate ϵexp.
  •  1:

    Initialize:

  •  2:

    Q(1)(s,σ) and Q(2)(s,aD) with random weights;

  •  3:

    initial belief μ0D(θA).

  •  4:

    for each episode r=1,2,…,R do

  •  5:

         Observe initial system state s0∈S.

  •  6:

         while s is not terminal do

  •  7:

              High-level (Meta-Policy):

  •  8:

              Observe attacker behavior history hk.

  •  9:

              Update Bayesian belief μDk+1(θA|hk+1) using Equation (8).

  • 10:

             Select strategic posture σ∈{σpassive,σactive,σhybrid} using ϵexp-greedy policy based on Q(1)(s,σ).

  • 11:

             Low-level (Sub-Policy):

  • 12:

             Retrieve attacker cognitive error parameter δ from hypergame model.

  • 13:

             Execute specific action aD based on

        Q(2)(s,aD|σ,δ).

  • 14:

             Environment Interaction:

  • 15:

             Observe attacker action aA, next state s′, and transitions.

  • 16:

             Calculate High-level reward:

  • 17:

             R(1)=f(μD(θA))+UD(s,σ)

  • 18:

             Calculate Low-level reward:

  • 19:

             R(2)=g(δ)+UD(s,aD)

  • 20:

             Policy Update:

  • 21:

             Q(1)(s,σ)←(1−α1)Q(1)(s,σ)+α1[R(1)+γmaxσ′Q(1)(s′,σ′)].

  • 22:

             Q(2)(s,aD)←(1−α2)Q(2)(s,aD)+α2[R(2)+γmaxaD′Q(2)(s′,aD′)].

  • 23:

             s←s′.

  • 24:

         end while

  • 25:

         Convergence Check:

  • 26:

         if ∥πDr+1−πDr∥<ξ and ∥πAr+1−πAr∥<ξ then Terminate: Stable hierarchical policy profile reached.

  • 27:

         end if

  • 28:

    end for