## 8 Solving the Trajectory Planning Problem  
As explained in the preceding sections, several constraints (e.g., soft and hard) are imposed to ensure dynamic feasibility, smooth navigation, handling disturbances, etc. Hence, optimal trajectory planning is posed as a constraint optimization problem in most situations. Constraint-based optimization problems are solved in two different ways: adding hard constraints or introducing soft constraints. In general, a constraint-based optimization problem can be formulated as a quadruple, i.e., \(P_{constraint}=(c,g1,g2,J)\), where \(c\) stands for performance index or cost function, whereas equality and inequality constraints are given by \(g1\) and \(g2\), respectively. The objective function is given by \(J\). In hard-constraint-based formulation, the optimal solution, i.e., \(\mathbf{w}\), for \(P_{constraint}\) is calculated, ensuring all the constraints. In soft constraints formulation, the objective function does not need to satisfy all the constraints, but satisfying those constraints will improve the final \(\mathbf{w}\). [PERSON] and [PERSON] [53] took the lead in proposing a successful approach for trajectory generation as a hard-constraint-based optimization approach, i.e., minimum-snap. Subsequently, in [35], the researchers extended the minimum-snap trajectory generation as an unconstrained or soft-constraint-based optimization problem. When generating trajectories, ensuring a collision-free path is essential. Hence, representing free space in a structured way and imposing obstacle constraints for trajectory generation is a must for safety. Free space can be represented in different ways, such as cubes [26; 74], spheres [82; 118], and polyhedrons [32]. The intuition of these approaches is to apply path planning through the free space to obtain the intermediate waypoints. Once intermediate waypoints are extracted, the trajectory generation procedure is utilized for retrieving a smooth, feasible, and collision-free trajectory. On the other hand, in [21; 25; 26], kinodynamic path planning followed by B-spline-based trajectory generation is considered. Most of the works that were proposed for soft-constraint-based trajectory generation formulated optimal trajectory planning as nonlinear optimization problems in which smoothness and safety were introduced as soft constraints. Most of the time gradient-descent-based [50] or gradient-free approaches [37; 54] were applied for minimizing the cost of smoothness and safety. The constraints optimization problem can be designed in either QP or NLP form. In QP, the procedure is to minimize or maximize the objective subject to a set of linear constraints in most situations. On the other hand, nonquadratic programming is used to handle the nonlinear constraints each of which has a unique nature to solve the problem. In general, the QP objective can be described as:  
\[ \begin{split}\min_{\mathbf{x}}&\frac{1}{2}\mathbf{ x}^{T}Q\mathbf{x}+c^{T}\mathbf{x}\\ \text{s.t.}& A\mathbf{x}\succeq b,\end{split}  \tag{63}\]  
where \(A\mathbf{x}\succeq b\) stands for the set of linear inequalities and \(Q\) is a positive symmetric matrix. There are various ways to solve QP, including interior point, active set, and gradient projection. In some situations, multiple variables that are to be optimized are integer values; those are solved as MIQP. For example, FASTER [119] used MIQP for safe trajectory planning with aggressive controls [36]. Most of the recent optimal trajectory planning techniques [19; 29; 30; 37] were formulated as gradient-based trajectory optimization (GTO) in which optimization problem was designed as a nonlinear form. The gradient descent is performed with respect to each parametrization index of \(\Gamma\) to minimize the difference, i.e., \(\Gamma_{i+1}-\Gamma_{i}\). Hence, \(\Gamma_{i+1}\) can be determined by solving the following optimization problem, as given in [50; 120].