constrain using optimization varible

조회 수: 2 (최근 30일)
eden meirovich
eden meirovich 2021년 1월 19일
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에서 Nonlinear Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by