design optimization assignment6
DESCRIPTION
design optim. HWTRANSCRIPT
Design Optimization
HomeWork 6
GROUP NUMBER - 7TEAM MEMBERS
Umang Umeshkumar Dighe – 1000677463Nandakumar Vijayakumar – 1000859743
Warren Freitas - 1000980315
Prob.1 Three water pipes are to be buried underground in a rectangular channel. The inner dimensions of the channel are W m by H m. Find the inner diameters of the pipe to maximize the water carrying capacity of the system assuming the pipe wall thickness is 5% of the inner diameter.
General Approach to solve the problem
To maximize the water flow, we need to maximize the combined Cross section area of the three circular pipes or minimize (-) Area i.e minimize ¿−∑ A=−(r1
2+r 22+r 3
2)
There will be two types of constraints used to solve the problem:
1) All three circles are inside the rectangular channel. Mathematically, this will translate to xa≥0
xc≤10
yd≥0
yb≤10
x i≥0
xk≤10
y l≥0
y j≤10
xe≥0
xg≤10
yh≥0
y f ≤10
For setting additional tangent to circle a, an equality boundary condition was given for fmincon and UTA_fmincon
xa−r 1=0Also, let “t” be the thickness of the pipe,Therefore,
t 1=0.05 r1t 2=0.05 r2t 3=0.05 r3
1
2) The circles do not intersect i.e distance between any two circle centers is D≥rm+rn+tm+ tn
Solve the problem by fmincon
Objective function code
function f=HW4_OBJ_1(X)x1=X(1);y1=X(2);r1=X(3);x2=X(4);y2=X(5);r2=X(6);x3=X(7);y3=X(8);r3=X(9); f=-(r1^2+r2^2+r3^2); end
2
a
b
c
d
i
j
k
l
e
f
g
h
Main code
clc;clear;%% 1. Use specific objective and constraint functionsW=10;H=10; WH=max([W H]); ObjFun=@HW6_OBJ_1; ConFun=@HW6_CON_1; LB=[0 0 0 0 0 0 0 0 0 ]+.1; UB=WH*[1 1 1 1 1 1 1 1 1 ]; X0=(LB+UB)/2; OP=optimset('disp','iter'); X0=[0 0 0 0 0 0 0 0 0]; [Xopt1,Fopt1]=fmincon(ObjFun,X0,[],[],[],[],LB,UB,ConFun)r1=Xopt1(3);r2=Xopt1(6);r3=Xopt1(9); x1=Xopt1(1)y1=Xopt1(2)x2=Xopt1(4)y2=Xopt1(5) t1=0.05*r1t2=0.05*r2t3=0.05*r3 r1=r1-t1r2=r2-t2r3=r3-t3
constraint function
function [g,heq]=HW6_CON_1(X)W=10;H=10;x1=X(1);y1=X(2);r1=X(3);x2=X(4);y2=X(5);r2=X(6);x3=X(7);y3=X(8);r3=X(9); gA=[r1-x1; r1+x1-W; r2-x2; r2+x2-W; r3-x3; r3+x3-W; r1-y1; r1+y1-H; r2-y2;
3
r2+y2-H; r3-y3; r3+y3-H; ]; % (B) pipes do not intersectD1=sqrt((x1-x2)^2+(y1-y2)^2);D2=sqrt((x2-x3)^2+(y2-y3)^2);D3=sqrt((x3-x1)^2+(y3-y1)^2);gB=[(r1+r2)-D1; (r2+r3)-D2; (r1+r3)-D3; ];g=[gA;gB];heq=[x1-r1]; end
Solve the problem by UTA_ fmincon
Main Code
clc;clear;%% 1. Use specific objective and constraint functionsW=10;H=10; WH=max([W H]); ObjFun=’HW6_OBJ_1’; ConFun=’HW6_CON_1’; LB=[0 0 0 0 0 0 0 0 0 ]+.1; UB=WH*[1 1 1 1 1 1 1 1 1 ]; X0=(LB+UB)/2; OP=optimset('disp','iter'); X0=[0 0 0 0 0 0 0 0 0]; [Xopt1,Fopt1]=UTA_fmincon(ObjFun, ConFun,X0,LB,UB,)r1=Xopt1(3);r2=Xopt1(6);r3=Xopt1(9); x1=Xopt1(1)y1=Xopt1(2)x2=Xopt1(4)y2=Xopt1(5) t1=0.05*r1t2=0.05*r2t3=0.05*r3 r1=r1-t1r2=r2-t2r3=r3-t3
4
Constrain Function
function [g,heq]=HW6_CON_1(X)W=10;H=10;x1=X(1);y1=X(2);r1=X(3);x2=X(4);y2=X(5);r2=X(6);x3=X(7);y3=X(8);r3=X(9); gA=[r1-x1; r1+x1-W; r2-x2; r2+x2-W; r3-x3; r3+x3-W; r1-y1; r1+y1-H; r2-y2; r2+y2-H; r3-y3; r3+y3-H; ]; % (B) pipes do not intersectD1=sqrt((x1-x2)^2+(y1-y2)^2);D2=sqrt((x2-x3)^2+(y2-y3)^2);D3=sqrt((x3-x1)^2+(y3-y1)^2);gB=[(r1+r2)-D1; (r2+r3)-D2; (r1+r3)-D3; ];g=[gA;gB];heq=[x1-r1]; end
Solve the problem by PSO
The solution by PSO method was unstable. The objective function value and design parameter values were changing even without making any change to the program during consecutive runs
Matlab Code used for PSO method
Main File
clc;clear all;
5
Data='psomain'OUT=pso2007(Data)
Data File
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Description of PSO data file NP=5;% number of populations Niter=20;% no. of iterations % PSO parameters r1=2; rp1=2; % Penalty parameter rmax=100000000; % Plot options IPLOT=0; % if IPLOT ==1 then plot otherwise don't plot % Problem type selection I=3; % I=2 for unconstrained problems and I=3 for constrained problems % I=2 for unconstrained problems and I=3 for constrained problems % define objective & constraint functions FUNcon='HW6_CON_1'; FUNobj='HW6_OBJ_1'; % Define design variable bounds W=10;H=10; WH=max(W,H) XL=[0 0 0 0 0 0 0 0 0]; %lower bounds XU=WH*[1 1 1 1 1 1 1 1 1]; % upper bounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Solution
6
Rectangular channel with sides [10,10] (both fmincon and UTA_fmincon give same radius and thickness values )
10,10
radiusthicknes
s x ycircle 1 4.75 0.25 5 5circle 2 0.815 0.0429 9.1421 0.8579circle 3 0.815 0.0429 9.1421 9.1421
7
Solution
Rectangular channel with sides [10,20] (both fmincon and UTA_fmincon give same radius and thickness values )
10,20
radiusthicknes
s x ycircle 1 4.75 0.25 5 15circle 2 1.1875 0.0625 8.75 10circle 3 4.75 0.25 5 5
8
Solution
Rectangular channel with sides [10,40] (both fmincon and UTA_fmincon give same radius and thickness values )
10,40
radiusthicknes
s x ycircle 1 4.75 0.25 5 35circle 2 4.75 0.25 5 17.5079circle 3 4.75 0.25 5 5.5485
SOLUTION
9
PSO
Rectangular channel with sides [10,10]
10,10Diamete
rthicknes
s x ycircle 1 9.46 0.25 5 5circle 2 1.62 0.0429 0.85 0.85circle 3 1.62 0.0429 0.85 9.14
Since the PSO code does optimization by stochastic method, the code was highly instable, and since the number of iteration and population had to increase with the increase in the function value to get the optimized solution, the CPU time increased considerably. So only the optimization of case [10,10] was performed with PSO.
10