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);vvsuvg:hv=Embed(v,E)

  • 2 

      Vu=vs;Qv=vs;QE=;C;π;M=SelfAttnE

  • 3 

      fork=1KmaxandnotconvergedC:

  • 4 

      P=SoftmaxDecoderE,Vu;Xnew=TopNPM

  • 5 

      Vu+={xXnew|CrossAttn(x,Vg)τ}

  • 6 

      whileQv:

  • 7 

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

  • 8 

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

  • 9 

      ĉ=Regressorhi,hj;ifgi+ĉ<gj:parentj=i;updatehj;updateC,πifjVg

  • 10 

    θθηĉcgt2;resetQE;reorderQv

  • 11 

    returnCCA?PathSmooth(π,SelfAttn):Ø