Fmincon problem with nonlcon
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Samatha Aleti
le 24 Mar 2020
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:
Voir également
Catégories
En savoir plus sur Nonlinear Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!