Display constraint gradient from fmincon

3 ビュー (過去 30 日間)
Pengfei
Pengfei 2012 年 5 月 17 日
Hi all, I am doing nonlinear optimization using "fmincon". There are both nonlinear objective function and nonlinear constraints. As we know that fmincon calculates the gradient of both the objective and constraint functions through finite differences. Now I want it to display the gradient of the constraint functions in the iteration process. I know how to display the gradient of the objective, with the help of optimValues.gradient. But there is no such a field as gradient regarding the constraint functions.
Any idea? Thank!

回答 (1 件)

Alan Weiss
Alan Weiss 2012 年 5 月 17 日
I believe you will have to write your own routine to calculate the gradient you want, and include it in your output function. It should call your constraint function at x and at x + delta for a variety of vectors delta that point in the coordinate directions. Yes, this does seem like a waste of time when you know fmincon has already done the evaluation, but I know of no way of extracting the information from fmincon without editing fmincon itself (or editing a subroutine or two).
It is difficult, in general, to evaluate gradients for all possible nonlinear constraints, because there can be many of them, both equality and inequality constraints. But you know your problem, and can take exactly the gradients you want.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  1 件のコメント
Pengfei
Pengfei 2012 年 5 月 18 日
All right then. Thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by