Skip to main content
. 2025 Jul 30;25(15):4699. doi: 10.3390/s25154699
Algorithm 1 T-ASTAR: Transformer-driven Adaptive Search and Reasoning
Input: Start vstart, Target set of states Vgoal, Environmental observation O, Maximum number of iterations Kmax
Output: Optimal path π∗, Path cost Cbest
  • 1 

      E=TransformerEncoder(O);∀v∈vsuvg:hv=Embed(v,E)

  • 2 

      Vu=vs;Qv=vs;QE=∅;C∗←∞;π∗←∅;M=SelfAttnE

  • 3 

      fork=1…KmaxandnotconvergedC∗:

  • 4 

      P=SoftmaxDecoderE,Vu;Xnew=TopNP⊙M

  • 5 

      Vu+={x∈Xnew|CrossAttn(x,Vg)≥τ}

  • 6 

      whileQv≠∅:

  • 7 

      v=popminQv,fv·σα;N=TransformerExpandv,E

  • 8 

      QE+={(v,w)|w∈N};foreach(i,j)∈QE

  • 9 

      ĉ=Regressorhi,hj;ifgi+ĉ<gj:parentj=i;updatehj;updateC∗,π∗ifj∈Vg

  • 10 

    θ←θ−η∇ĉ−cgt2;resetQE;reorderQv

  • 11 

    returnC∗≤CA?PathSmooth(π∗,SelfAttn):Ø