# 1e6+ constrained optimization problems

**URL:** <https://discourse.julialang.org/t/1e6-constrained-optimization-problems/22032>\
**Category:** Optimization (Mathematical)\
**Created:** [March 19, 2019, 10:32am UTC](https://discourse.julialang.org/t/1e6-constrained-optimization-problems/22032 "2019-03-19T10:32:59Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![pkofod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pkofod/32/2179_2.png) [@pkofod](https://discourse.julialang.org/u/pkofod)\
**Post date:** [March 22, 2019, 8:29pm UTC](https://discourse.julialang.org/t/1e6-constrained-optimization-problems/22032/16 "2019-03-22T20:29:44Z")

</div>

> [@PaulBreiding](#):
>
> Hi all,
> 
> let me add some lines to the discussion:
> 
> In my opinion, if you want to solve a set of equations, and you can formulate them as polynomial equations, you should ALWAYS solve the equations and not use optimization algorithms. Even, if you have logs( ) or exps( ) often you can add some artificial variables to get polynomial equations (for instance, if you have sin(x) and cos(x) add c and s with the additional equation c^2+s^2=1).
> 
> Let me explain this, because it goes a bit contrary to common knowledge: say the system is f=0. Then, the optimization problem is min |f(x)| plus constraints. It gives the gradient equation Jf(x)^Tf(x)=0. This equation usually has much more solutions than f = 0 (namely, all the local extrema). Hence, for finding the actual minimum one has to do a lot more work. On the other hand, solving f = 0, even without constraints, is much cheaper. And: one can check constraints a posteriori.

Totally agree! If you can transform your problem into another problem with robust solution methods, you should. However, it’s still not clear to me what OP actually wants to solve once he turns to his “advanced model”. In the end, there are only so many tricks and transformations you can do, and you might have to turn to local, general purpose nonlinear solvers in the end.

The reason why I took the bait on least squares solving was that that was used in the reference code, so I thought it might be a non-linear least squares problem they actually wanted to solve, but it appears that the previous choice to use scipy’s minpack wrapper was simply that you _can_ in principle solve the system of equations by minimizing a sum of squares (and hoping that you are actually able to find a zero-residual solution).

---

_[View the full topic](https://discourse.julialang.org/t/1e6-constrained-optimization-problems/22032)._
