Failure in initial objective function evaluation. FMINCON cannot continue

1 回表示 (過去 30 日間)
Ni Ho
Ni Ho 2019 年 5 月 21 日
編集済み: Matt J 2019 年 5 月 21 日
Hi!
Im trying to solve a optimization problem with non linear constraints using fmincon.
This is my function that I want to minimize:
F1 = @(x)L1'.*(x);
L1 is a previously defined vector.
This is how I use fmincon:
options = optimset('GradObj','off','GradConstr','off','Display','iter','Diagnostics','on');
A = [];
B = [];
Aeq = [];
Beq = [];
LB = [];
UB = [];
x = fmincon(@(x) F1(x,L1),X0,A,B,Aeq,Beq,LB,UB,@(x) mynonlcon(x,a,b,epsilon),options)
Where mynonlcon is a function file containing my non linear constraints c and ceq.
I get the error:
Error in fmincon (line 546)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in HA3_test_2 (line 102)
x = fmincon(@(x) F1(x,L1),X0,A,B,Aeq,Beq,LB,UB,@(x) mynonlcon(x,a,b,epsilon),options)
Caused by:
Failure in initial objective function evaluation. FMINCON cannot continue.
So my question is, what am I doing wrong? I cant seem to get past this problem.
I've never used fmincon before so I basically have no idea what I need to do to figure this out.

回答 (1 件)

Matt J
Matt J 2019 年 5 月 21 日
Test F1 on X0 before you give it to fmincon.
  2 件のコメント
Ni Ho
Ni Ho 2019 年 5 月 21 日
I've tried it and it seems to be fine, it returns a vector like I want it to.
Matt J
Matt J 2019 年 5 月 21 日
編集済み: Matt J 2019 年 5 月 21 日
fmincon expects the objective function to return a scalar. Is this supposed to be a least squares minimization? If so, then you must sum the squares yourself explicitly.

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

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by