Gradient optimization problem with fmincon

Hi I'm currently working on an optimzation problem where I need to optimization a design dimension to minimize the ROI with Sequential Quadratic Programing with fmincon. However, I don't really know how the fmincon work and how my constrain will need to implement into the code. I'm new to matlab
Thank you for your time,
Here is my equation and constrain that I want to put in Matlab
with r is the radius and l is the length of the tank

11 件のコメント

Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
ROI is the function that I want to minimize using fmincon
Torsten
Torsten 2021 年 5 月 19 日
What are you trying to minimize ?
Your ROI is constant and equals -0.95.
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
I tried to minimize the ROI
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
ROI depends on radius and length
I found the constraint between them and other requirements constraints. I just don't know how to do fmincon and how to put those constraint. Please help
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 5 月 19 日
Here are your variables are r and l. What constraints (in a range of numbers) do you have for r (radius) and l (length)?
Torsten
Torsten 2021 年 5 月 19 日
Your ROI doesn't depend on l and r.
It's constant and equals -0.95.
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
Can you explain me why it doesn't depend on it cuz the volume change in the response of r and l. If r and l change the ROI needs to be changed also. how do you get -0.95 from it
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
these are the constrainst
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
This is the volume function
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
my initial design is 5000 for length and 500 for radius
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
yeah you are right it doesn't depends. I think in this case imma minimize the volume

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

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 5 月 19 日

0 投票

Here is a simple solution to your exercise. Adjust your constrains for r (radius) and l (length).
% NOTE: RL(1) is R and RL(2) is L.
ROI =@(RL) (.05*(509.7*pi(RL(1)^3+RL(1)^2*RL(2))+5.505e3*RL(1)^2)-509.7*pi*(RL(1)^3+RL(1)^2*RL(2))+5.505e3*RL(1)^2)/(509.7*pi*(RL(1)^3+RL(1)^2*RL(2))+5.505e3*RL(1)^3);
Rb = [0,0];
% NOTE: 0<=R<=5; 0<=L<=15; Thus, Rb= [0, 0]; and Lb = [5, 15];
Lb = [5, 15];
% No Other constraints are considered here
A = [];
b = [];
Aeq = [];
beq = [];
x0 = (Lb + Rb)/2;
RL = fmincon(ROI,x0,A,b,Aeq,beq,Lb,Rb);
R = RL(1);
L = RL(2);
fprintf('Found values: R = %f [ft] L = %f [ft] \n', [R, L])
Good luck.

9 件のコメント

Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
can you explain for me what is Lb and Rb
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
Thank you so much
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
what is @RL is it the first derivative in term of r and l
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 5 月 19 日
RL is the variable: RL = [r, l];
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 5 月 19 日
編集済み: Sulaymon Eshkabilov 2021 年 5 月 19 日
Now you have edited your problem statement significantly from the initially posted one. That means your function for minimization would be V(r, l) in the proposed code of mine.
And the constrains for r and l need to be inserted properly.
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
ok do I need to delete the x0 ( it's the midpoint, isn't it)
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 5 月 19 日
That is an initial guess value. The search starts w.r.t x0 values. Good luck with your sims.
Dai Nguyen
Dai Nguyen 2021 年 5 月 19 日
Yeah I tried to put the constraints but my constraints is non linear
c(1)= L + R - 131.23; % height of tank
c(2) = 1224.303*RL(1)^2; % height of distance, fuel needed
c(3) = (RL(1)*RL(2))/(2*(RL(2)+RL(1)))- 0.25; % thickness of tank
Torsten
Torsten 2021 年 5 月 20 日
編集済み: Torsten 2021 年 5 月 20 日
The first constraint is linear, the second is superfluous and the third can be put in function "nonlcon".
Read the documentation of fmincon for more details.

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

カテゴリ

製品

質問済み:

2021 年 5 月 19 日

編集済み:

2021 年 5 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by