Finding the Minimum Cost

Hey everyone,
I have a problem to solve...
I have to find the dimensions of a cylindrical tank that holds a specific volume at the lowest cost. It consists of a cylinder with 2 plates at either end.
Parameters are:
tank volume = 0.8 m^3
tank thickness = 3 cm
tank material density = 8000 kg/m^3
max diameter = 1.5 m
max cylinder length = 2 m
material cost = 4.5 $/kg
welding cost = 20 $/m
I know how to calculate any specific volume of material from the radius and the length for the material cost.
I also know how to calculate all the weld lengths for that too.
What I need help with is how could I make an IF ELSE statement that generates all the possible values of the radius and length of the cylinder where the volume = 0.8m^3 so that I can then sub those values into my cost evaluation formula.
Any help is greatly appreciated even if just a link to something I should read, Im really stuck.

2 件のコメント

Walter Roberson
Walter Roberson 2012 年 5 月 4 日
There are an infinite number of radius / length combinations that meet the volume requirements. You cannot generate all of them individually.
Anthony James
Anthony James 2013 年 4 月 29 日
Thanks for taking the time out to give us a hand. Have a good starting point and can improve on the user friendliness of my program. Then hopefully get a few pictures in for top marks.

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

 採用された回答

Image Analyst
Image Analyst 2012 年 5 月 4 日

0 投票

You can do it numerically if you want using an exhaustive brute force method (which is also pretty fast): I've left out some parts for you to do, but when I ran it I got this:
The lowest cost was $6523.24.
The best length was ------. (You run it to find out)
The best radius was ------.
Here's the code:
tank_volume = 0.8 %m^3
tank_thickness = 3 %cm
tank_material_density = 8000% kg/m^3
max_diameter = 1.5% m
max_cylinder_length = 2% m
material_cost = 4.5 %$/kg
welding_cost = 20 %$/m
lowestCost = inf;
for cylinderLength = 0.001 : 0.001 : 2
radius = sqrt(tank_volume / (pi * cylinderLength));
surfaceAreaTop = 2 * pi * radius^2;
surfaceAreaSide = ?????????;
surfaceArea = surfaceAreaTop * 2 + surfaceAreaSide;
tank_weight = ?????????; * tank_thickness/100;
totalCost = tank_weight * material_cost + welding_cost * cylinderLength;
if totalCost < lowestCost
% Save lowestCost, bestLength, bestRadius.
?????????;
end
end
fprintf('The lowest cost was $%.2f.\nThe best length was %.3f.\nThe best radius was %f.\n',...
lowestCost, bestLength, bestRadius);

3 件のコメント

Jacob
Jacob 2012 年 5 月 12 日
Thank you so much for this answer. I've modified to take weld length as edge of both the inner and outer edge of the cylinder instead of a function of the cylinderLength. Also stepped up the accuracy a bit with cylinderLength = 0.0001 : 0.0001 : 2 . Works Great , might see if I can modify to take the initially defined parameters as input in stead. Thanks again !
Image Analyst
Image Analyst 2012 年 5 月 12 日
I used 0.001 because that was just perfect for 3 digits of accuracy. Going any more than that will get you more digits of "accuracy" but that's really not warranted since your initial parameters were not specified accurately out to the 4th or 10th decimal place. So your "accuracy" is really kind of fake, since what you got would change a lot if the tank volume were 8.04 instead of 8.00. You can do tests to see where it starts to change in your total cost if you change any of the parameters. And, in fact it won't make any real world difference if you're accurate to the nearest micro-cent when payments in the real world are made to the nearest cent. None the less, it's no big deal for the computer to calculate out to the nearest nano-cent if you tell it to, so you can do that if you want, I'm just telling you some real world, practical considerations.
Anthony James
Anthony James 2013 年 4 月 29 日
Good Work thanks Image Analyst

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 5 月 4 日

0 投票

Construct the cost formula in one parameter and use one of the minimizers on it. Or if you have the symbolic toolbox, do minimization the calculus way (differentiate, find the zeros of that, etc.)

カテゴリ

ヘルプ センター および File ExchangeElementary Math についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by