## 3 Lateral Control Strategy
### Design Cost Function  
The cost function is needed to determine the optimization of the system state quantities as well as the control quantities according to the cost function in the solution process. The cost function is shown in Equation (10):  
\[J[\xi(t),u(t-1),\Delta U(t)]=\sum\
olimits_{i=1}^{N_{p}}||\eta(k+i\mid t)-\eta _{ref}(k+i\mid t)||_{Q^{+}}^{2}\sum\limits_{i=1}^{N_{c}-1}||\Delta u(k+i\mid t)|| _{R}^{2}+\rho\epsilon^{2} \tag{10}\]  
In Equation (10), \(\eta(k+i\mid t)\) is the practical outcome; \(\eta_{ref}(k+i\mid t)\) is the reference outcome; \(Q\) and \(R\) are the weight matrices; the slack factor weight ratio is \(\rho\); \(\epsilon\) is the slack ratio. In cost function, the output at future moments needs to be predicted. Convert Equation (9) as Equation (11):  
\[\chi(k)=\left[ \begin{array}{c}\xi(k)\\ u(k-1)\end{array} \right] \tag{11}\]  
A new expression for the status space equation is gained, as shown in Equation (12):  
\[\chi(k+1)=\widetilde{A}_{k}+\chi(k)+\widetilde{B}_{k}\Delta\mathrm{U}(k) \tag{12}\]  
In Equation (12), \(\widetilde{A}_{k}=\left[ \begin{array}{cccc}A_{k}&B_{k}\\ 0_{1*6}&I_{1}\end{array} \right]\), \(\widetilde{B}_{k}=\left[ \begin{array}{c}B_{k}\\ I_{1}\end{array} \right]\), \(\widetilde{C}_{k}=\left[ \begin{array}{cccc}C_{k}&0_{2*1}\end{array} \right]\), \(C_{k}=\left[ \begin{array}{cccc}0&0&1&0&0&0\\ 0&0&0&1&0\end{array} \right]\). After the above derivation, the system prediction output expression is obtained as shown in Equation (13):  
\[Y(t)=\psi\chi(t|t)+\Theta\Delta U(t) \tag{13}\]\[\text{where Y(t)}=\left( \begin{array}{c}\eta(t+1\mid t)\\ \eta(t+2\mid t)\\ \ldots\\ \eta(t+N_{p}\mid t)\end{array} \right),\psi=\left( \begin{array}{c}\widetilde{C}_{t,t}\vec{A}_{t,t}\\ \widetilde{C}_{t,t}\vec{A}_{t,t}^{2}\\ \ldots\\ \widetilde{C}_{t,t}\vec{A}_{t,t}^{N_{p}}\end{array} \right),\Delta U(t)=\left( \begin{array}{c}\Delta u(t\mid t)\\ \Delta u(t+1\mid t)\\ \ldots\\ \Delta u(t+N_{c}\mid t)\end{array} \right)\]  
\[\Theta=\left( \begin{array}{cccc}\widetilde{C}_{t,t}\vec{B}_{t,t}&0&0&0\\ \widetilde{C}_{t,t}\vec{A}_{t,t}\vec{B}_{t,t}&\widetilde{C}_{t,t}\vec{B}_{t,t }&0&0\\ \widetilde{C}_{t,t}\vec{A}_{t,t}^{2}\vec{B}_{t,t}&\widetilde{C}_{t,t}\vec{A}_ {t,t}\vec{B}_{t,t}&\widetilde{C}_{t,t}\vec{B}_{t,t}&0\\ \ldots&\widetilde{C}_{t,t}\vec{A}_{t,t}^{2}\vec{B}_{t,t}&\widetilde{C}_{t,t} \vec{A}_{t,t}\vec{B}_{t,t}&\widetilde{C}_{t,t}\vec{B}_{t,t}\\ \widetilde{C}_{t,t}\vec{A}_{t,t}^{N_{p}-2}\vec{B}_{t,t}&\widetilde{C}_{t,t} \vec{A}_{t,t}^{N_{p}-2}\vec{B}_{t,t}&\ldots\end{array} \right)\]  
To facilitate computer solutions, the cost function needs to be transformed into a simple quadratic shape, as shown in Equation (14):  
\[J(\xi(t),u(t-1),\Delta U(t))=\left[\Delta U(t)^{T},\varepsilon\right]^{T}H_{t }[\Delta U(t)^{T},\varepsilon]+G_{t}[\Delta U(t)^{T},\varepsilon] \tag{14}\]  
In Equation (14), \(H_{t}= \begin{bmatrix}\Theta_{t}^{T}Q\Theta_{t}+R&0\\ 0&\rho\end{bmatrix} \), \(G_{t}= \begin{bmatrix}2\varepsilon_{t}^{T}Q\Theta_{t}&0\end{bmatrix} \). The optimized control increase acting on the system is derived by tackling the problem in conjunction with the following constrained optimization problem:  
\[\left\{ \begin{array}{l}\Delta U_{\min}\leq\Delta U_{t}\leq\Delta U_{\max} \\ U_{\min}\leq U_{t}\leq U_{\max}\\ y_{\text{hc,min}}\leq y_{\text{hc}}\leq y_{\text{hc,max}}\\ y_{\text{sc,min}}-\varepsilon\leq y_{\text{sc}}\leq y_{\text{sc,max}}+\varepsilon \end{array} \right. \tag{15}\]  
In Equation (15), \(y_{\text{hc}}\) and \(y_{\text{sc}}\) are the hard and soft constraint outputs, respectively; \(\varepsilon\) is the relaxation factor.