Adding a constraint in @confun constrained optimization
显示 更早的评论
Hello, I am struggling to add a second constraint in my optimization problem... My obj function is:
function f = objfun(X)
for i=1..18;
f=sum(exp-(10*X(i)); end
My 1st constraint is a non linear inequality :
function [c,ceq]=confun(X)
ceq = [];
c(1) =(-0.35*X(3)+0.35*X(9)+1.3333*X(10))^2-(0.3333*X(13)+0.3182*X(3)-0.6364*X(6)+0.3182*X(9)-X(17))^2-(0.015/2)^2;
My second constraint is also a non linear inequality which I can't code, here is what I want to verify:
% I need that all the values from 0 to the X(i) to be generated (the optimum X(i)), the condition 1 is verified.
Would you note that ub and lb and all the other entries for fmincon are known and my problem is only in the @confun
[x,fval]= fmincon(@objfun,x0,A,b,Aeq,beq,lb,ub,@confun,options)
A = [];
b = [];
Aeq = [];
beq = [];
x0 = [0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016,0.0016];
lb = [0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015,0.0015];
ub = [0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015,0.015];
options = optimoptions(@fmincon,'Algorithm','sqp');
2 个评论
Alan Weiss
2018-11-1
Sorry, I don't understand what you mean by your second constraint. The only description you gave is "I need that all the values from 0 to the X(i) to be generated (the optimum X(i)), the condition 1 is verified." I have no idea what that means.
Alan Weiss
MATLAB mathematical toolbox documentation
Mondher Souilah
2018-11-1
编辑:Mondher Souilah
2018-11-2
采纳的回答
更多回答(1 个)
Alan Weiss
2018-11-2
1 个投票
Alan Weiss
MATLAB mathematical toolbox documentation
类别
在 帮助中心 和 File Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
