# Investigation of Guidewire Deformation in Blood Vessels Based on an SQP Algorithm
## Materials and Methods
### SQP Algorithm  
Sequential quadratic programming (SQP) is currently recognized as one of the best algorithms for dealing with medium- and small-scale nonlinear programming problems [23; 24; 25]. The algorithm obtains the optimal solution of the original problem by simplifying the original problem into a series of quadratic programming subproblems. If the optimal solution can be obtained, it is considered to be the optimal solution of the original nonlinear programming problem. Otherwise, it takes a quadratic approximation to the Lagrangian function, and the approximate solution is used to replace the new quadratic programming problem, and the iteration is continued. In addition, it can also be used for optimization problems with strong nonlinearity [26; 27]. A typical nonlinear programming problem has the form shown in Equations (1) and (2). \[\text{Objective function is}\qquad\qquad\text{min f}(\mathbf{x}),\,\mathbf{x} =[x_{1},\,x_{2},\,x_{3},\,\ldots,\,x_{m}]^{\text{T}} \tag{1}\]  
\[\text{and constraint condition is}\qquad\mathbf{G}(\mathbf{x})=[g_{1}(\mathbf{x}), \,g_{2}(\mathbf{x}),\,g_{3}(\mathbf{x}),\,\ldots,\,g_{m}(\mathbf{x})]^{T} \leq\ 0, \tag{2}\]  
where \(\mathbf{x}\) is the design parameter vector, \(\mathbf{f}(\mathbf{x})\) is the scalar form. \(\mathbf{G}(\mathbf{x})\) is a constraint function vector, which can be an equality constraint or an inequality constraint. The SQP algorithm solves the QP (Quadratic Program) subproblem after taking the quadratic approximation of the Lagrangian function in Equation (3). \[\text{L}(\mathbf{x},\,\lambda)=\text{f}(\mathbf{x})+\sum_{\text{i}=1}^{\text {m}}\ \lambda_{\text{i}}g_{\text{i}}(\mathbf{x}), \tag{3}\]  
where \(\lambda\) is the Lagrangian factor. The QP subproblem expressed as per Equations (4) and (5) can be obtained by linearizing nonlinear constraints. \[\text{The objective function is}\qquad\qquad\text{min}\frac{1}{2}\text{d}^{\text{T}} \mathbf{H}_{\text{k}}\text{d}+\
abla\text{f}(\mathbf{x}_{\text{k}})^{\text{T }}\text{d}, \tag{4}\]  
\[\text{and the constraint function is}\qquad\
abla\text{g}_{\text{i}}(\mathbf{x})^{\text{T }}\text{d}\ +\ \text{g}_{\text{i}}(\mathbf{x})=0,\ \text{i}=1,\,2,\,\ldots,\,\text{m}, \tag{5}\]  
where d is the full variable search direction, \(\
abla\) is the gradient, and matrix \(\mathbf{H}\) is the positive definite quasi-Newton approximation of the Hessian matrix of the Lagrangian function, which is calculated by the BFGS method. And Equation (4) can be solved by any QP algorithm. The implementation of the SQP algorithm used in this paper mainly includes the following three steps:  
\(\bullet\)Updating the Hessian matrix H of the Lagrange function according to Equation (6)  
\[\mathbf{H}_{\text{k}+1}=\mathbf{H}_{\text{k}}+\frac{\text{q}_{\text{k}}\text {q}_{\text{k}}^{\text{T}}}{\text{q}_{\text{k}}^{\text{T}}\text{s}_{\text{k}} }-\frac{\mathbf{H}_{\text{k}}^{\text{T}}\mathbf{H}_{\text{k}}}{\text{s}_{ \text{k}}^{\text{T}}\mathbf{H}_{\text{k}}\text{s}_{\text{k}}}, \tag{6}\]  
where  
\[\text{q}_{\text{k}}=\
abla\text{f}(\mathbf{x}_{\text{k}+1})+\sum_{\text{i}=1}^Solving the quadratic programming problem  
For each main iteration of the SQP algorithm, we need to solve a QP subproblem as shown in the following Equations (9) and (10).  
\[\text{The objective function is :}\qquad\min\limits_{\mathbf{x}\in\mathbb{R}^{n}} =\frac{1}{2}\mathbf{x}^{\mathrm{T}}\mathbf{H}\mathbf{x}+c^{\mathrm{T}} \mathbf{x}, \tag{9}\]  
\[\text{and the constraints are :}\qquad\mathrm{w}_{\mathrm{i}}\mathbf{x}\ \leq\ b_{\mathrm{i}},\ \mathrm{i}=1,\ 2,\ \dots,\ \mathrm{m}, \tag{10}\]  
where \(\mathrm{w}_{\mathrm{i}}\) is the i-th row of matrix \(\mathbf{w}\in\mathbb{R}^{\mathrm{m}\times\mathrm{n}}\). The solution process can be divided into two steps: first, calculate the feasible point of the solution, secondly, generate an iterative sequence of feasible points, and the sequence converges to the solution of the problem.