# Adaptive Cruise Control for Cut-In Scenarios Based on Model Predictive Control Algorithm
## 4 Host Vehicle Trajectory Tracking Control
### Objective Function and Constraint Establishment  
The control purpose of the ACC-MPC is that the host vehicle can stably follow the reference trajectory of the system under the constraints of ensuring safety and comfort, so the objective function is:  
\[J=\sum_{i=1}^{p}\left\|\mathbf{Q}(\mathbf{y}_{c}(k+i|k)-\mathbf{y}_{ref}(k+i))\right\|^{2 }+\sum_{i=1}^{m-1}\left\|\mathbf{R}\mathbf{u}(k+i)\right\|^{2} \tag{56}\]  
Figure 20: The law that the reference trajectory changes with the cut-in possibility.  
Where \(\mathbf{Q}\) and \(\mathbf{R}\) are the weight coefficient matrices, respectively, \(\mathbf{u}\) is the control vector. \(p\) is the prediction horizon, \(m\) is the control horizon, \(p\geq m\), \(\mathbf{y}_{c}(k+i|k)\) is the prediction output vector of time \(k+i\) by the MPC-ACC system at \(k\) time, and \(\mathbf{y}_{ref}(k+i)\) is the reference trajectory of the system at \(k+i\) time. The penalty term \(\mathbf{y}_{c}(k+i|k)-\mathbf{y}_{ref}(k+i)\) is to ensure that the difference between the output trajectory of the system and the reference trajectory is as small as possible; that is, during the following process, the relative distance between the host vehicle and the preceding vehicle or the cut-in vehicle is as close as possible to the inter-vehicle distance. The relative velocity between them is as close as possible to 0. The penalty term \(\mathbf{u}(k+i)\) is to make the desired acceleration as small as possible.  
When solving the optimal solution of the MPC-ACC, it is also necessary to satisfy various constraints in the process of following the preceding vehicle. First of all, in order to ensure the driving safety of the host vehicle during following, the longitudinal relative distance between the host vehicle and the preceding vehicle or the cut-in vehicle must meet the minimum safe distance constraint:  
\[\Delta x(k)\geq d_{c} \tag{57}\]  
where \(d_{c}\) is the minimum safety relative distance.  
Secondly, considering the road velocity limit, the host vehicle's maximum acceleration capacity, maximum braking capacity, the velocity, and acceleration constraints are:  
\[\begin{array}{l}v_{Hmin}\leq v_{H}(k)\leq v_{Hmax}\\ a_{Hmin}\leq a_{H}(k)\leq a_{Hmax}\\ u_{min}\leq u(k)\leq u_{max}\end{array} \tag{58}\]  
In addition, driving comfort can be expressed by jerk. The smaller the absolute value of jerk is, the higher the driving comfort that can be obtained [28]. In order to ensure driving comfort, the host vehicle satisfies the constraints:  
\[\begin{array}{l}\text{Jerk}_{min}\leq\text{Jerk}_{H}(k)\leq\text{Jerk}_{max }\end{array} \tag{59}\]  
The final constraints are:  
\[\left\{\begin{array}{l}\Delta x(k)\geq d_{c}\\ v_{Hmin}\leq v_{H}(k)\leq v_{Hmax}\\ a_{Hmin}\leq a_{H}(k)\leq a_{Hmax}\\ u_{min}\leq u(k)\leq u_{max}\\ Jerk_{min}\leq\text{Jerk}_{H}(k)\leq\text{Jerk}_{max}\end{array}\right. \tag{60}\]  
Based on Equation (56) and inequalities (60), the optimization problem of the MPC-ACC can be formulated as follows  
\[\underset{U(k)}{\text{min}}J(x(k),u(k)) \tag{61}\]  
subject to:  
\[\Delta x(k)\geq d_{c}\]  
\[v_{Hmin}\leq v_{H}(k)\leq v_{Hmax}\]  
\[a_{Hmin}\leq a_{H}(k)\leq a_{Hmax}\]  
\[u_{min}\leq u(k)\leq u_{max}\]  
\[\text{Jerk}_{min}\leq\text{Jerk}_{H}(k)\leq\text{Jerk}_{max}\]  
where,  
\[J=\sum_{i=1}^{p}\|\mathbf{Q}(\mathbf{y}_{c}(k+i|k)-\mathbf{y}_{ref}(k+i))\|^{2}+\sum_{i=1} ^{m-1}\|\mathbf{Ru}(k+i)\|^{2}\]