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

4 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Quadratic Programming and Cone Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by