필터 지우기
필터 지우기

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 CenterFile Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by