How can I supply gradient for a nonlinear equality constraint but not for a nonlinear inequality constraint in fmincon

4 views (last 30 days)
I'm working on a minimization problem and I have a nonlinear equality constraint ceq(x)=0 and I have supplied gradient Dceq(x). Gradient checks and fmincon performs much better with 'SpecifyConstraintGradient' set to true.
Now, I'd like to add a nonlinear inequality constraint of the form
c(x) <= 0
but I don't know how to compute the gradient Dc(x) analytically. Is there a way to add the inequality constraint c(x) without supplying its gradient while still supplying the gradient Dceq of the equality constraint? It seems that 'SpecifyConstraintGradient' applies to both equality and inequality constraints.
In my situation, fmincon performs poorly without supplying the gradient of the equality constraint. The inequality constraint ceq(x) is a smooth function x, I just don't have an analytic expression for it: ceq(x) is basically - eig(m(x)) where m is a matrix computed smoothly from x.

Accepted Answer

Matt J
Matt J on 4 Aug 2016
You could supply your own finite difference approximation for Dc. There are FEX submissions that can facilitate this, e.g.,

More Answers (0)

Categories

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!