## 3 Solution Algorithm Design
### Algorithm Pseudocode  
Based on the above models and algorithms description, the algorithm pseudocode of the autonomous attack guidance with high aiming precision for UCAV in the BVR air combat is illustrated as Algorithm 1.  
```
Input:\(h\), \(D_{\min}\), \(\delta_{\max}\), \(G\), \(m_{1}\), \(m_{2}\), \(k_{1}\), \(k_{2}\), \(\gamma\), \(\mathbf{Q}\), \(n_{\max}\), \(R\), \(v_{m}\). Output: The motion state sequence of the UCAV \(\{\mathbf{x}_{u1},\mathbf{x}_{u2},\dots,\mathbf{x}_{uk},\dots\}\).
1 Initialize \(\mathbf{x}_{u0}\), \(\mathbf{x}_{t0}\), \(\mathbf{u}_{u}(t_{0})\), \(\delta_{y0}\), \(\delta_{z0}\), \(\delta_{y0}\), and \(\delta_{z0}\); set \(\mathbf{\theta}_{y}\) and \(\mathbf{\theta}_{z}\) as all-zero matrices; Let the step counter \(k\)= 0;
2 while\(D>D_{\min}\)do
3 Generate the predicted control vector \(\mathbf{u^{\prime}}_{t}(t_{k})\) and the predicted motion state \(\mathbf{x^{\prime}}_{t}(t_{k}+h)\) of the target in the next time step \(t\in[t_{k},t_{k}+h]\) based on the prediction model in Equation (16);
4 Solve the aiming error angle and its rate of change, \(\delta_{y}(t_{k})\), \(\delta_{z}(t_{k})\), \(\delta_{y}(t_{k})\), \(\delta_{z}(t_{k})\) at the current moment based on the motion states of the UCAV and the target through the aiming model of BVR attack fire control in Equations (7) and (8);
5 Initialize the iteration counter \(i=0\);
6 while\(\sqrt{\delta_{y}^{2}(t_{k}){+}\delta_{z}^{2}(t_{k})}>\delta_{\max}\) and \(i\leq C\)do
7 Use \(\delta_{y}(t_{k})\), \(\delta_{z}(t_{k})\), \(\dot{\delta}_{y}(t_{k})\), and \(\dot{\delta}_{z}(t_{k})\) to compute \(\mathbf{\xi}(\delta_{y}(t_{k}))\) and \(\mathbf{\xi}(\delta_{z}(t_{k}))\) by Equation (25);
8 Compute the error vector and the adaptive law in both horizontal and vertical directions, \(\mathbf{e}_{y}(t_{k})\), \(\mathbf{e}_{z}(t_{k})\), \(\mathbf{\theta}_{y}(t_{k})\), \(\mathbf{\theta}_{z}(t_{k})\), by Equations (19), (33) and (34);
9 Generate the control vector \(\mathbf{u^{\prime}}_{u}(t_{k})=[\mathbf{u^{\prime}}_{xu}(t_{k}),\ \mathbf{u^{\prime}}_{yu}(t_{k}),\ \mathbf{u^{\prime}}_{zu}(t_{k})]^{\rm T}\) of the UCAV in \(t\in[t_{k},t_{k}+h]\) based on the adaptive fuzzy guidance controller in Equations (24) and (34), then obtain the motion state of the UCAV \(\mathbf{x^{\prime}}_{u}(t_{k}+h)\) at \(t_{k}+h\);
10 Solve the predicted aiming error angle and its rate of change at \(t_{k}+h\), \(\delta_{y}^{\prime}(t_{k}+h)\), \(\delta_{z}^{\prime}(t_{k}+h)\), \(\delta_{y}^{\prime}(t_{k}+h)\), and \(\delta_{z}^{\prime}(t_{k}+h)\), based on \(\mathbf{x^{\prime}}_{u}(t_{k}+h)\) and \(\mathbf{x^{\prime}}_{t}(t_{k}+h)\);
11 then initialize the iteration counter;
12 Assign \(\delta_{y}^{\prime}(t_{k}+h)\), \(\delta_{z}^{\prime}(t_{k}+h)\), \(\delta_{y}^{\prime}(t_{k}+h)\), and \(\delta_{z}^{\prime}(t_{k}+h)\) to \(\delta_{y}(t_{k})\), \(\delta_{z}(t_{k})\), \(\dot{\delta}_{y}(t_{k})\), and \(\dot{\delta}_{z}(t_{k})\) in turn;
13 Set \(i=i+1\);
14
15 end while
16 Take \(\mathbf{u^{\prime}}_{u}(t_{k})\) as the actual control vector \(\mathbf{u}_{u}(t_{k})\) of the current time step \(t_{k}\) to guide the UCAV and then generate the motion state \(\mathbf{x}_{u}(t_{k}+h)\);
17 Update the actual motion states of the target \(\mathbf{x}_{t}(t_{k}+h)\); and set \(k=k+1\);
18
19 end while
20 Output the \(\{\mathbf{x}_{u1},\mathbf{x}_{u2},\dots,\mathbf{x}_{uk},\dots\}\).
```  
**Algorithm 1**The autonomous attack guidance with high aiming precision.