Nonlinear optimization with fmincon - How to write an objective function with variables that affects optimised variables
1 view (last 30 days)
Show older comments
I would like to maximize the sum of six variables in the vector "x" which depends on the value of 6 more variables and 12 nonlinear equalities. I know is hard, but complexity of the equations does not allow to have only six equations for the system. The algortihms are not capable of performing iterations and complying all equalities. I have already calculated the first gradients of the objective and constraints to have efficient iteration. However, I get an unfeasible point when tolerance constraint is reached.
I hope anyone would come up with a suggestion. I am using algortihms such as sqp and active-set getting quite similar results. It is true that there is one solution of the 12 variable equation system that reaches the maximum value; however, I do not know whether it is far better to isolate the problem of the first six variable, with only bound constraints, and then perform fsolve to calculate the other six variables.
F=-sum(x(1:6))
s.t.
eq(1)=b(1)*x(1)^2+a(1)*x(1)+P+x(7)+dp(1)+14.69-Pder(1);
eq(2)=b(2)*x(2)^2+a(2)*x(2)+P+x(7)+dp(2)+14.69-Pder(2);
eq(3)=b(3)*x(3)^2+a(3)*x(3)+P+x(7)+dp(3)+14.69-Pder(3);
eq(4)=b(4)*x(4)^2+a(4)*x(4)+P+x(7)+x(8)+dp(4)+14.69-Pder(4);
eq(5)=b(5)*x(5)^2+a(5)*x(5)+P+x(7)+x(8)+dp(5)+14.69-Pder(5);
eq(6)=b(6)*x(6)^2+a(6)*x(6)+P+x(7)+x(8)+x(9)+dp(6)+14.69-Pder(6);
eq(7)=dv(1,1)*x(10)^2+dv(2,1)*x(10)+dv(3,1)-x(7);
eq(8)=dv(1,2)*x(11)^2+dv(2,2)*x(11)+dv(3,2)-x(8);
eq(9)=dv(1,3)*x(12)^2+dv(2,3)*x(12)+dv(3,3)-x(9);
eq(10)=sum(x(1:6))*cv(1)-x(10)*(P3+0.5*x(7)+14.69);
eq(11)=sum(x(4:6))*cv(2)-x(11)*(P3+x(7)+0.5*x(8)+14.69);
eq(12)=x(6)*cv(3)-x(12)*(P3+x(7)+x(8)+0.5*x(9)+14.69);
Thanks in advance.
6 Comments
Bruno Luong
on 8 Nov 2018
Edited: Bruno Luong
on 8 Nov 2018
Agree with Tosten, such system usually give a set of discrete solution(s) that can be empty as well.
Nothing smart to optimize a function on top of it beside enumerate all the solutions (of the 12 constraints) then check the score.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!