Constraint of optimization problem
이전 댓글 표시
Hi!
I am really desperate and I wish you can help me
I need to optimize (maximize) the function:
(a1*w1)+(a2*w2)+(a3*w3)+(a4*w4)+(a5*w5)+(a6*w6)
where the variables are w1, w2, w3, w4, w5 y w5 and a1, a2, a3, a4, a5 and a6 are constants
The Constraints are:
prob.Constraints.cons1 = w1+w2+w3+w4+w5+w6 == 1;
prob.Constraints.cons2 = w1>= 0;
prob.Constraints.cons3 = w2>= 0;
prob.Constraints.cons4 = w3>= 0;
prob.Constraints.cons5 = w4>= 0;
prob.Constraints.cons6 = w5>= 0;
prob.Constraints.cons7 = w6>= 0;
y=sort((w1*vector(:,1))+(w2*vector(:,2))+(w3*vector(:,3))+(w4*vector(:,4))+(w5*vector(:,5))+(w6*vector(:,6)));
prom=mean(y(1:r,:));
y1=prom<=0.0131;
prob.Constraints.cons8 = y1;
where vector is a 1000-by-1 vector and r=100
The problem is that the sort function doesn't work with optimization variable
Do you know if it is possible to optimize with coinstraints like that?
Thanks!!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!