## Appendix A Trajectory Planning
### Predictive Optimization Method  
A predictive control-based trajectory planning is presented in this section, and then the Neural Network-based method is used to make the trajectory planning faster since the computation of the quadratic optimization function is time-consuming. The results of the model predictive optimization approach are used to compute the weights of the edges which are used in the motion-planning layer. The basis of the discretized state space representation is the dynamic bicycle model (see: Equation (A2)), which can be written in the following form:  
\[x(k+1)=\phi x(k)+\Gamma u(k),\] (A4)  
where \(\phi=e^{AT_{s}}\) and \(\Gamma=\int\limits_{kT_{s}}^{(k+1)T_{s}}e^{A((K+1)T_{s}-\tau)}Bd\tau\). The states of the discrete state space representation are: \(x= \begin{bmatrix}y&v_{y}&\dot{\psi}&\psi&\delta\end{bmatrix} ^{T}\). In order to minimize the lateral acceleration, the output of the model is the lateral position and lateral acceleration of the controlled vehicle. Using Equation (A6) the output matrix can be formed as: \(C= \begin{bmatrix}1&0&0&0&0\\ 0&0&0&0&\frac{v_{s}^{2}}{l_{1}+l_{2}}\end{bmatrix} \). In this case, the lateral acceleration of the vehicle can be approximated as \(a_{lat}=\frac{v_{s}^{2}}{R}\). Using the kinematic bicycle model, the radius of the given trajectory can be computed as:  
\[R=\frac{l_{1}+l_{2}}{tan(\delta)}\] (A5)  
Assuming small angles: \(tan(\delta)\approx\delta\). The lateral acceleration of the vehicle can be approximated by the following equation:  
\[a_{lat}=\frac{v_{s}^{2}\delta}{l_{1}+l_{2}}.\] (A6)  
The error, which is measured from the reference vector, can be defined as [PERSON] et al. [9]:  
\[e_{y}=y(U)-\mathcal{R},\] (A7)  
where \(\mathcal{R}\) is the reference lateral position of the vehicle. The control signal is computed through the minimization process. The minimization function can be written as  
\[J(U,x(k))=\frac{1}{2}\sum_{i=k}^{n+k}e_{y}(U)^{T}\xi e_{y}(U)+U^{T}\lambda U,\] (A8)  
where \(U= \begin{bmatrix}u(k)&\dots&u(k+n)\end{bmatrix} ^{T}\). Moreover, \(\xi\) and \(\lambda\) are weighting matrices. This leads to a quadratic optimization problem, which can be formulated as  
\[\min_{u(k+1),u(k+2),\dots u(k+n)}J(U,x(k))\quad\text{s.t. }\quad \begin{cases}H_{ in}U<b\\ l_{l}\leq u_{i}\leq l_{u},\end{cases} \] (A9)  
where \(H_{in}\) is responsible for the limitation of the states. Which can be computed from the dynamics of the controlled vehicle. During the trajectory planning, several constraints must be defined to the states in order to guarantee the safety and comfort requirements. Control input of the system also must be limited within \((l_{l},l_{u})\), taking into account the limitations of a real system. During the trajectory planning several limitations must be taken into account in order to guarantee the safety and comfort requirements. The optimization problem is solved with the following limitations:  
* Lateral position. It is necessary to limit the lateral error measured from the reference trajectory in order to avoid dangerous motion of the vehicle. Moreover, it is important to guarantee that the reference lateral position is reached by the planned trajectory at the end point. During the computation, the maximum deviation measured from the reference trajectory is set to \(|e_{max}|=0.5\,\mathrm{m}\). * Yaw angle. Another important point of the trajectory planning is the yaw angle of the vehicle. The feasible trajectory must ensure that the yaw angle of the vehicle is the same as the yaw angle of the reference trajectory. * Steering angle. The steering angle and its rate must be also bounded. \(\Delta\delta_{min}\leq\Delta\delta\leq\Delta\delta_{max}\) and \(\delta_{min}\leq\delta\leq\delta_{max}\), where the bounds can be calculated from the limits of the actuator. Moreover the limitations help to guarantee comfort and safety requirements. * Lateral acceleration. During the trajectory planning, the lateral acceleration is minimized. Using the computed data (see Section 3.1), the bounds are set to \(a_{lat,b}\geq|a_{lat}|\).