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

4 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Quadratic Programming and Cone Programming en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by