Borrar filtros
Borrar filtros

How can I call intermediate functions within fmincon?

2 visualizaciones (últimos 30 días)
Hau Kit Yong
Hau Kit Yong el 31 de Ag. de 2018
Comentada: Hau Kit Yong el 31 de Ag. de 2018
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.

Respuesta aceptada

Alan Weiss
Alan Weiss el 31 de Ag. de 2018
It is possible that you could use the technique in Objective and Nonlinear Constraints in the Same Function.
Alan Weiss
MATLAB mathematical toolbox documentation

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by