How can I call intermediate functions within fmincon?

1 回表示 (過去 30 日間)
Hau Kit Yong
Hau Kit Yong 2018 年 8 月 31 日
コメント済み: Hau Kit Yong 2018 年 8 月 31 日
I am trying to minimize a nonlinear problem using fmincon. The evaluation of my objective, f, and constraints, g, require not only a vector of design variables, x, but also a vector of state variables, y(x), i.e. f = f(x,y(x)) and g = g(x,y(x)). The evaluation of y for a certain x is performed through an expensive fixed-point iteration procedure.
I am having difficulties injecting this iteration procedure efficiently into fmincon. I want to run the procedure only once for every vector x that fmincon returns and then feed the resulting y into f and g. However, due to the input structure of fmincon, I am forced to run the procedure once for every call to f or g, instead of once for every x. I cannot combine the x and y vectors, as fmincon will mistake y for design variables. I also cannot run the procedure externally from fmincon, as y changes depending on x.
I am considering two solutions to this, one using global variables, and the other using the 'Outputfcn' field in optimoptions. I have not explored both solutions in detail yet. 'Outputfcn' does not look too promising though, as its documentation specifies that it can only used for displaying data from the algorithm, but can not be used for setting values.

採用された回答

Alan Weiss
Alan Weiss 2018 年 8 月 31 日
It is possible that you could use the technique in Objective and Nonlinear Constraints in the Same Function.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 件のコメント
Hau Kit Yong
Hau Kit Yong 2018 年 8 月 31 日
This looks very promising. Thank you!

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by