Optimizing a nonlinear function with both equality and inequality contraints I have the non-linear optimization problem
$$\min f(a,b,c,x)=\int_0^R\frac{y}{1+(2ay+b)^2}dy =\frac{\log(\frac{(2aR+b)^2+1}{b^2+1})-2b(\arctan(2aR+b)-\arctan(b))}{8a^2}$$
subject to the constraints
$$\begin{align}
g_1(a,b,c,x)&=2\pi (\frac{aR^4}{4}+\frac{bR^3}{3}+\frac{cR^2}{2})-V=0,\\
g_2(a,b,c,x)&=-(ax^2+bx+c)\leq 0,\ \ \ \ (0 \leq x \leq R)
\end{align}$$
where $R$ and $V$ are positive constants. I am ultimately looking for a triplet $(a,b,c)$ that minimizes $f$ and satisfies the constraints for all $x \in [0,R]$. First of all, I noticed that the $x \in [0,R]$ part can be handled by replacing $g_2$ with a new function $g_2^\ast$ defined by
$$g_2^\ast(a,b,c,x)=-(ax^2+bx+c)\cdot x(x-R)\leq 0.$$
It seems pretty clear that this would most likely not have a clean closed-form solution, and after some calculations, Sage seems to struggle to symbolically solve the system of equations given by even just forming the Lagrangian
$$\mathcal{L}(a,b,c,\lambda)=f(a,b,c,x)+\lambda g_1(a,b,c,x)$$
for the equality constraint and taking
$$\nabla \mathcal{L}(a,b,c,\lambda)=0.$$
From what I've learned so far, I'd assume that to solve the full problem with all the constraints implemented, I would form the (new, disregard the above example) Lagrangian
$$\mathcal{L}(a,b,c,x,\lambda,\mu)=f(a,b,c,x)+\lambda g_1(a,b,c,x)+\mu g_2^\ast(a,b,c,x)$$
and solve the system given by
$$\nabla \mathcal{L}(a,b,c,x,\lambda,\mu)=0.$$
I have concluded that this problem could probably only be solved numerically, and am looking for some method to do so. After some google searches, I have stumbled upon Sequential Quadratic Programming which (from what I've read off of Wikipedia) would allow one to numerically estimate solutions to nonlinear programming problems. Furthermore, I have found that since this problem involves both inequality and equality constraints, the usual method of Lagrange multipliers may not be sufficient, and that after an optimal solution is found numerically, checking it with the KKT conditions would verify its optimality(though not a necessary condition since my function is non-convex). As a result, it would be great if someone could direct me to any programs which could carry out these calculations or implement these algorithms for me, and also explain how to apply the KKT conditions here to verify the calculations after such numerical estimates have been made.
I am very new to optimization, only just familiar with Lagrange multipliers, so please let me know if I have made mistakes or misunderstood something. Thanks in advance!
 A: If the $g_2$ constraint isn’t active, the $g_1$ constraint isn’t actually a constraint, since $c$ doesn’t occur in the objective function, so $g_1=0$ can be satisfied by just picking the required value of $c$. So the first step is to find the local minima, if any, of the objective function without constraints. (You can make it arbitrarily small by making $a$ and/or $b$ arbitrarily large, but I suspect that would violate the $g_2$ constraint – otherwise there would be no global minimum.)
The other alternative is that the $g_2$ constraint is active, that is, that $g_2=0$ at some value of $x$. There are only three possibilities for this value: $x=0$, $x=R$ or $x=-\frac b{2a}$, the extremum of $g_2(x)$. You can go through these three cases and solve the resulting one-dimensional optimization problem for each case. The first two yield another linear equation between $a$, $b$ and $c$, which lets you eliminate $c$ in the $g_1$ constraint to obtain a linear relationship between $a$ and $b$, which you can substitute into the objective function, yielding a function of one variable whose derivative is a rational function, which you can minimize analytically or numerically. The third case, $x=-\frac b{2a}$, is only slightly more complicated – it leads to $c=\frac{b^2}{4a}$, which turns the $g_1$ constraint into a quadratic relationship between $a$ and $b$. This case would perhaps be a bit of a hassle to minimize analytically, but also straightforward to treat numerically. In the end, you’ll have several candidates for the minimum – three from the three constraint cases, and any local minima without constraints. The minimum, if any, is the lowest of these that fulfils the entire $g_2$ constraint.
