FMINCON - Failure in initial objective function evaluation. FMINCON cannot continue.

11 visualizaciones (últimos 30 días)
I am trying to minimise a self-written objective function, called S_min, subject to simple linear inequality constraints. Since S_max is a function of 5 arguments but I only want to optimise over the first 2, I use a function handle:
fun = @(x,y) S_min(x,y,2,MU1,P_max); % MU1, P_max defined above [not shown]
And then implement the optimisation through:
fmincon(fun, [0.5,6], A ,B); % A, B defined above [not shown]
I checked that fun(0.5,6), i.e. evaluated at the starting values, gives a correct, scalar, answer; and that the vector [0.5,6] satisfies inequality constraints, i.e. A.*[0.5,6]<=B.
However, when trying to minimise as above, I get the following error message:
"Error in fmincon (line 536) [...]
Failure in initial objective function evaluation. FMINCON cannot continue."
This is surprising as the function should evaluate correctly at this point.
Is there anything I can do to fix this?

Respuesta aceptada

Matt J
Matt J el 30 de Oct. de 2016
Editada: Matt J el 30 de Oct. de 2016
FMINCON expects your function handle to look like this,
fun = @(p) S_min(p(1),p(2),2,MU1,P_max);

Más respuestas (0)

Categorías

Más información sobre Linear Least Squares en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by