constrain using optimization varible

1 次查看(过去 30 天)
Hello!
i'm intresting in optimization with constrains. I have 2 functions:
and i have this foloowing constrains:
my optimization varibles here are .
i wish the constrains will be kept in every t from t=0 until t.
but instand i get that it kept only when t = sol.t, so in the last time step.
how sould i adress it?
thank u!
my colde look like that:
%% Optimization problem
prob = optimproblem('ObjectiveSense','max');
%optimization varibles - change here
delta = optimvar('delta',1);
eta = optimvar('eta',1);
alpha = optimvar('alpha',1);
beta = optimvar('beta',1);
t = optimvar('t',1);
T = alpha*t^2+eta*t+beta;
T_dot = 2*alpha*t+eta;
omega = delta*t;
%% Constrains
cons1 = T <= T_max;
cons2 = T >= T_min;
cons3 = omega <= omega_max;
cons4 = omega >= omega_min;
cons5 = T_dot <= T_dot_max;
cons6 = T_dot >= T_dot_min;
prob.Constraints.cons1 = cons1;
prob.Constraints.cons2 = cons2;
prob.Constraints.cons3 = cons3;
prob.Constraints.cons4 = cons4;
prob.Constraints.cons5 = cons5;
prob.Constraints.cons6 = cons6;

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by