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

조회 수: 11 (최근 30일)
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?

채택된 답변

Matt J
Matt J 2016년 10월 30일
편집: Matt J 2016년 10월 30일
FMINCON expects your function handle to look like this,
fun = @(p) S_min(p(1),p(2),2,MU1,P_max);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by