Hi there I have a problem with fmincon function.
I have written the code belowe, when I have run it, Matlab run only one cycle and giving me the message
"Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.
Error in fmincon (line 824)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in myfuny (line 62)
x=fmincon(@process,x0,A,b,Aeq,beq,lb,ub,nonlcon);
function [x]= myfun()
x0(1)=1;
x0(2)=0.3;
x0(3)=0.9;
x0(4)=35;
x0(5)=0.9;
x0(6)=35;
x0(7)=0.9;
x0(8)=35;
x0(9)=0.9;
x0(10)=5;
x0(11)=300;
x0(12)=1;
x0(13)=20;
x0(14)=20;
x0(15)=1000;
x0(16)=2*alpha;
lb=[1 0.3 0.9 0.1 0.9 0.1 0.9 0.1 0.9 5 0.9 1 1 1 1 1];
ub=[5 20 300 35 300 35 300 35 300 100 300 5 1000 1000 1000 100000];
A=[];
b=[];
Aeq=[];
beq=[];
nonlcon=@productivity;
x=fmincon(@process,x0,A,b,Aeq,beq,lb,ub,nonlcon); %minimise the process cost
end

답변 (1개)

Samatha Aleti
Samatha Aleti 2020년 3월 24일

0 개 추천

Hi,
This error occurs if the objective function "funfcn" returns an invalid value such as Inf or NaN or complex number etc., when evaluating at the point “X”. Try evaluating the function at “X and modify it accordingly to avoid invalid values.
Refer the following MATLAB Answer explaining about similar error, which might help you in debugging and fixing your issue:

카테고리

도움말 센터File Exchange에서 Argument Definitions에 대해 자세히 알아보기

질문:

2020년 3월 22일

댓글:

2020년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by