フィルターのクリア

How to set lower bound lb as a function of optimization variable.

4 ビュー (過去 30 日間)
Sol Elec
Sol Elec 2024 年 5 月 10 日
コメント済み: Sol Elec 2024 年 5 月 12 日
I am solving one optimization using fmincon. Objectives function is a variable of x1,x2,x3.
B= 0; c =[ 0 0.1736 0.0693; 0 0 0.1736]
c = 2x3
0 0.1736 0.0693 0 0 0.1736
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
l_op = 6.3247;
rho = 1.225;
R=37.5; A = pi * R^2;
Z = 8;
n =3;
k= 0.1;
Th = sym('Th', [1, n]);
x = sym('x', [1, n]);
Lam = sym('Lam', [1, n]);
Pt = sym('P_opt', [1, n]);
Per = sym('Per', [1, n]);
z = sym('z', [1, n]);
z(1) = Z;
for i = 1:n
if i > 1
term_sum = 0;
for j = 1:i-1
term_sum = term_sum + ((1 - sqrt(1 - Th(j))) * c(j, i))^2;
end
z(i) = Z * (1 - sqrt(term_sum));
end
Lam(i) = (x(i) * R) / z(i);
Th(i) = (0.000086 * B - 0.0026) * Lam(i)^3 + (-0.0018 * B + 0.0481) * Lam(i)^2 + (0.008 * B - 0.165) * Lam(i) + (-0.0116 * B + 0.3);
Per(i) = 0.22 * (116 / (Lam(i) + 0.08 * B) - 4.06 / (B^3 + 1) - 0.4 * B - 5) * exp(-12.5 / (Lam(i) + 0.08 * B) + 0.4375 / (B^3 + 1));
Pt(i) = 0.5 * rho * A * Per(i) * z(i)^3;
end
objective = -sum(Pt)
objective = 
Obj = matlabFunction(objective, 'Vars', {x});
% Lower and upper bounds
lb = 0.1687 * z(i) % z(i) is a function of x(i) *corrected
Unrecognized function or variable 'v'.
ub = 1.6867*ones(1,n);
% Initial guess
x0 = ones(1,n);
% Constraints
Aeq = [];
beq = [];
% Optimization using fmincon
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'interior-point');
% % Optimize the objective function
[x_opt, fval_opt] = fmincon(Obj, x0, [], [], Aeq, beq, lb, ub, [], options);
In my optimization lower bound of the optimization is a function of optimaztion variables. How can I solve it? fmincon can be able to do it or another optimization tools can be chosen?
  2 件のコメント
John D'Errico
John D'Errico 2024 年 5 月 10 日
That is not a "bound" constraint. It is an inequality constraint.
Sol Elec
Sol Elec 2024 年 5 月 10 日
How can I modify it? Becuase z(i) is the function of x(i)? @John D'Errico

サインインしてコメントする。

回答 (1 件)

Torsten
Torsten 2024 年 5 月 10 日
編集済み: Torsten 2024 年 5 月 10 日
Use function "nonlcon" to define nonlinear equality and inequality constraints.
If v(i) depends linearly on the solution variable vector x, you could also use A and b in the call to "fmincon":
  17 件のコメント
Torsten
Torsten 2024 年 5 月 12 日
編集済み: Torsten 2024 年 5 月 12 日
I just saw that z is defined in your loop. In this case, simply use
zfun = matlabFunction(z,'Vars',{x})
nonlcon = @(x)deal(0.1687*zfun(x)-x,[])
Here it is assumed that the x passed from "fmincon" to "nonlcon" is a row vector.
Sol Elec
Sol Elec 2024 年 5 月 12 日
Thanks a lot for your valuable input regarding this. @Torsten @Walter Roberson.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultiobjective Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by