I am trying to use the SQP solver with a nonlinear constraint. The solver requires a linear constraint so I am trying to approximate the constraint with the first-order Taylor approximation. Is this to correct way how to use SQP solvers or is this either a completely wrong or naive approach?
Problem formulation $$\min_{x} \quad x^2 \\ \textrm{s.t.} \quad g(x): \cos{(x)} \geq 0.7 \\$$
SQP solver formulation $$\min_{x} \quad xPx \\ \textrm{s.t.} \quad l \leq Ax \leq u\\$$
1st order Taylor around of nonlinear constraint $g(x)$ $$g(x): \quad \cos{(x)}\geq 0.7 \\ \textrm{1st order Taylor around }x_0\textrm{:} \quad g(x_0) + \frac{\partial g(x_0)}{\partial x_0}(x-x_0) \geq 0.7 \\ \quad g(x_0) + \frac{\partial g(x_0)}{\partial x_0}x - \frac{\partial g(x_0)}{\partial x_0}x_0 \geq 0.7 \\$$
Expressing $l$ bound and $A$ matrix for SQP solver: $$ 0.7 \leq g(x_0) + \frac{\partial g(x_0)}{\partial x_0}x - \frac{\partial g(x_0)}{\partial x_0}x_0 \\ 0.7 - g(x_0) + \frac{\partial g(x_0)}{\partial x_0}x_0 \leq \frac{\partial g(x_0)}{\partial x_0}x \\ l = 0.7 - g(x_0) + \frac{\partial g(x_0)}{\partial x_0}x_0\\ A = \frac{\partial g(x_0)}{\partial x_0}\\ l \leq Ax $$