Nonlinear optimization with fmincon - How to write an objective function with variables that affects optimised variables
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 8 de Nov. de 2018
To confirm, you need to adjust 12 variables, and there are 12 nonlinear equalities, and the final cost is based upon the sum of six variables?
Torsten
el 8 de Nov. de 2018
And you start from a feasible point of your system of 12 equations in 12 unknowns ?
Ramiro Canchucaja
el 8 de Nov. de 2018
Torsten
el 8 de Nov. de 2018
If all the other variables in the system of equations except x1,...,x12 are given constants, the system usually has a unique solution. So I don't understand what you want to minimize here if there usually is only one feasible point.
Try to solve your system using "fsolve" first and see what the solver returns.
Bruno Luong
el 8 de Nov. de 2018
Editada: Bruno Luong
el 8 de Nov. de 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.
Ramiro Canchucaja
el 8 de Nov. de 2018
Respuestas (0)
Categorías
Más información sobre Systems of Nonlinear Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!