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

4 ビュー (過去 30 日間)
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.

採用された回答

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeQuadratic Programming and Cone Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by