how to solve a multi-objective nonlinear optimization problem with constraints ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
tty
el 18 de Dic. de 2022
Respondida: Alan Weiss
el 22 de Dic. de 2022
Hello , I have a nonlinear eqt that describes the evolution of my system : dxdt=Ax(t)+Bu(t),with
A=[sqrt(2) 1;2 sqrt(3)]; B=[1 4;3 1]; and u=K1*x+b1. K1 is 2x2 matrix and b1 is 2x1.
I want to find K1 and b1 such that I maximize xdot11 at a point v1 under these constraints :
n1'*B*(K1*v1+b1)+n1'*A*v1<=0;
n4'*B*(K1*v1+b1)+n4'*A*v1<=0;
n1'*xdot11<= 0 ;
K1*v1+b1 <= 2;
K1*v1+b1 >=- 2;
n4'*xdot12<= 0 ;
n1=[0;-1]; n4=[-1;0]
My code is :
clc;
close all;
v1=[80;60];
n1=[0;-1]; n4=[-1;0]; % normal vectors
A=[sqrt(2) 1;2 sqrt(3)];
B=[1 4;3 1];
prob1 = optimproblem;
K1 = optimvar("K1",2,2); % create the optim. variable K1
b1 = optimvar("b1",2,1);
xdot11=((A(1,1)+B(1,1)*K1(1,1)+B(1,2)*K1(2,1))*v1(1))+((A(1,2)+B(1,1)*K1(1,2)+B(1,2)*K1(2,2))*v1(2))+B(1, ...
1)*b1(1)+B(1,2)*b1(2);
xdot21=((A(2,1)+B(2,1)*K1(1,1)+B(2,2)*K1(2,1))*v1(1))+((A(2,2)+B(2,1)*K1(1,2)+B(2,2)*K1(2,2))*v1(2))+B(2, ...
1)*b1(1)+B(2,2)*b1(2);
Obj =-xdot11;
prob1.Objective=Obj
constr1=n1'*B*(K1*v1+b1)+n1'*A*v1<=0;
constr2=n4'*B*(K1*v1+b1)+n4'*A*v1<=0;
constr3=n1'*xdot11<= 0 ;
constr4=K1*v1+b1 <= 2;
constr5=K1*v1+b1 >=- 2;
constr6=n4'*xdot21<= 0 ;
prob1.Constraints.Constr1=constr1;
prob1.Constraints.Constr2=constr2;
prob1.Constraints.Constr3=constr3;
prob1.Constraints.Constr4=constr4;
prob1.Constraints.Constr5=constr5;
prob1.Constraints.Constr6=constr6;
show(prob1);
x0.K1=zeros(2);
x0.b1=[1;1];
sol =fsolve(prob1,x0);
when I run my code , I get this error :
Unable to perform assignment because dot indexing is not supported for variables of this type.
I tried to solve it with fmincon but it requires to put all of the control variables into one vector x and I didn't know how to define the x0 in this case..
I will be very thankfull for your help.
7 comentarios
Torsten
el 18 de Dic. de 2022
I must admit that I still don't understand
I want to find K1 and b1 such that I maximize xdot11 at a point v1 under these constraints :
What is v1 ? How does it correspond to something you get from or input into your differential equations ?
Respuesta aceptada
Alan Weiss
el 22 de Dic. de 2022
For an example that optimizes the solution of an ODE using optimization variables, see Fit ODE Parameters using Optimization Variables. That example shows calling ode45 to solve the ODE, and has an optimization problem built around this ODE solver.
For an entirely different approach, see Discretized Optimal Trajectory, Problem-Based. I don't know if this approach is relevant to your problem.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!