Square root in objective function must appear as nonlinear constraints for optimization?
41 views (last 30 days)
Show older comments
Commented: Pedro Luis Camuñas on 5 Aug 2020
The title already described my question. Let me give a specific example:
If I have in my objective function for fmincon to optimize. During the iterations, may be smaller than 0.
Therefore, do I need to write as nonlinear constraints or does Matlab already take account of the problem?
Thank you very much!
Matt J on 6 Mar 2019
Edited: Matt J on 6 Mar 2019
You should omit square roots, because they introduce both unneccesary additional computation and non-differentiability into the cost function, which breaks the theoretical assumptions of fmincon. In your example, the problem could be equivalently posed without square roots as
Matt J on 7 Mar 2019
Edited: Matt J on 7 Mar 2019
One general way to get rid of sqrt expressions in the objective is to replace them with an additional nonlinearly constrained variable, e.g., instead of
All of the above expressions, both in the objective and the constraints, are now differentiable everywhere.
SandeepKumar R on 6 Mar 2019
Yes, you need to specify that constraint as ignoring this will lead infeasibilty. This is true for any optimizer
Walter Roberson on 6 Mar 2019
if you have fractional power of a polynomial (not a multinomial) then manually solve for the bounds and express them as bounds constraints . Bounds constraints are respected in most situations .
You might end up with discontinuous ranges. If so it can often be more efficient to run the ranges as separate problems and take the best solution afterwards . Nonlinear constraints are much less efficient to deal with .
Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!