Set 5

advertisement

EGR 599 Advanced Engineering Math II _____________________

LAST NAME, FIRST

Problem set #5

1 . (P. 16.5 Chapra 1 ) Recently chemical engineers have become involved in the area known as waste minimization. This involves the operation of a chemical plant so that impacts on the environment are minimized. Suppose a refinery develops a product, Z 1, made from two raw materials X and Y . The production of 1 metric ton of the product involves 1 ton of X and 2.5 tons of Y and produces 1 ton of a liquid waste, W . The engineers have come up with three alternative ways to handle the waste:

* Produce a ton of a secondary product, Z 2, by adding an additional ton of X to each ton of W .

* Produce a ton of another secondary product, Z 3, by adding an additional ton of Y to each ton of W .

* Treat the waste so that it is permissible to discharge it.

Note: One tone of W is reduced for each ton of secondary product produced.

The products yield profits of $2500,  $50, and $200/ton for Z 1, Z 2, and Z 3 respectively. Note that producing Z 2 actually creates a loss. The treatment process costs $300/ton. In addition, the company has access to a limit of 7500 and 10,000 tons of X and Y , respectively, during the production period. Determine how much of the products and waste must be created in order to maximize profit.

Solution

An LP formulation for this problem can be set up as

Maximize: P = 2500 Z 1  50 Z 2 + 200 Z 3  300 W

Since W = Z 1  Z 2  Z 3, the objective function becomes

P = 2500 Z 1  50 Z 2 + 200 Z 3  300( Z 1  Z 2  Z 3) = 2200 Z 1 + 250 Z 2 + 500 Z 3

Subject to

Z 1 + Z 2  7500

2.5

Z 1 + Z 3  10000

Z 1, Z 2, Z 3, and W  0

The following Matlab program statements are used to solve this linear programming problem

% Set 5, problem 1 f=[-2200;-250;-500];

A=[1 1 0;2.5 0 1;0 0 0];

1 Chapra and Canale, Numerical Methods for Engineers , Mc-Graw Hill, 4 th Edition, 2002

b=[7500;10000;0];

Aeq=zeros(3,3); beq=zeros(3,1);

LB=[0;0;0];UB=[inf;inf;inf]; x=linprog(f,A,b,Aeq,beq,LB,UB)

>> s5p1

Optimization terminated successfully. x =

1.0e+003 *

4.0000

3.5000

0.0000

Therefore

Z 1 = 4000, Z 2 = 3500, Z 3 = 0, and W = 500. The profit is then

P = 2200 Z 1 + 250 Z 2 + 500 Z 3

P = 2200  4000 + 250  3500 = $9,675,000

2 . (P. 16.11 Chapra 1 ) You must design a triangular open channel to carry a waste stream from a chemical plant to a waste stabilization pond. The mean velocity increases with the hydraulic radius, R h

= A / P , where A is the cross-sectional area and P (= 2 d /sin  ) equals the wetted perimeter. Because the maximum flow rate corresponds to the maximum velocity, the optimal design amounts to minimizing the wetted parameter. Determine the dimensions to minimize the wetted perimeter for a given cross-sectional area. w d s

 e

Solution

The following formulas can be developed: e

 w

2

  tan

1 d e

(1)

(2) s

 d

2  e

2

P

2 s

(3)

(4)

A

 wd

(5)

2

The minimum wetted perimeter should occur when the derivative of the perimeter with respect to one of the primary dimensions (i.e., w or d ) flattens out. That is, the slope is zero.

In the case of the width, this would be expressed by: dP

0 dw

If the second derivative at this point is positive, the value of w is at a minimum. To formulate P in terms of w , substitute Eqs. 1 and 5 into 3 to yield s

( 2 A / w )

2 

( w / 2 )

2

Substitute this into Eq. 4 to give

P

2 ( 2 A / w )

2 

( w / 2 )

2

(6)

(7)

Differentiating Eq. 7 yields dP dw

8 A

2

/ w

3

( 2 A / w )

2 

 w / 2

( w / 2 )

2

0

Therefore, at the minimum

(8)

8 A

2

/ w

3  w / 2

0 which can be solved for w

2 A

This can be substituted back into Eq. 5 to give

(10)

(9) d

A

(11)

Thus, we arrive at the general conclusion that the optimal channel occurs when w = 2 d .

Inspection of Eq. 2 indicates that this corresponds to  = 45 o .

The development of the second derivative is tedious, but results in d

2

P

32

A

2

( 2 A / w )

2 

( w / 2 )

2 (12) dw

2 w

4

Since A and w are by definition positive, the second derivative will always be positive.

3 . (P. 16.14 Chapra 1 ) A finite-element model of a cantilever beam subject to loading and moments is given by optimizing f ( x , y ) = 5 x 2

 xy + 2.5

y 2

 x

 y where x = end displacement and y = end moment. Find the values of x and y that minimize f ( x , y ). x y x i+1 = x i  H i

-1  f ( x i )

Solution

(1)

 f ( x i ) =

10

 x x

5 y y

1

1

 f

 x

= 10 x  y  1,

 f

 y

 2

 x

2 f

= 10 ,

 2 f

 x

 y

 2 f

 y

 x

% Set 5, problem 3 x=1;y =1; disp('x y')

Hes=[10, -1; -1, 5]; iHes=inv(Hes); for i=1:10

=  1,

 2

 y

2 f

= 

= 5

=

1

 x + 5 y  1

delf=[10*x - y - 1; - x + 5*y - 1];

dx=-iHes*delf;

x=x+dx(1);

y=y+dx(2);

fprintf('%10.6f %10.6f \n',x,y)

if max(abs(dx))<1e-5,break,end end f=5*x^2-x*y+2.5*y^2-x-y; fprintf('f = %10.6f\n',f)

>> s5p3 x y

0.122449 0.224490

0.122449 0.224490 f = -0.173469

4. (E. 2.5 Van Nostrand) Find the stationary points for the following constrained problem using the method of Lagrange Multipliers

Optimize: y

Subject to:

( x

1

, f ( x x

2

1

) =

, x

2 x

1 x

) =

2 x

1

2 + x

2

2  1 = 0

Use Newton method with four different initial guesses given in Table 1

Table 1 : Initial guesses x

1

1 x

2

1

-1

-1

1

-1

-1

-1

1

-1 1

Solution

The Lagrangian, or augmented, function is formed as shown below

L

= y +  f = x

1 x

2

+  ( x

1

2 + x

2

2  1) x

1

, x

2

, and  can be solved from the following equations

L

/  x

1

= x

2

+ 2  x

1

= 0  f

1

= x

2

+ 2  x

1

= 0

L /  x

2

= x

1

+ 2  x

2

= 0  f

2

= x

1

+ 2  x

2

= 0

L /   = x

1

2 + x

2

2  1 = 0  f

3

= x

1

2 + x

2

2  1 = 0

 f

1

 x

1

= 2 

 f

1

 x

2

= 1

 f

1

 

= 2 x

1

1

 f

2

 x

1

= 1

 f

2

 x

2

= 2 

 f

 x

1

3 = 2 x

1

 f

3

 x

2

= 2 x

2

% Set 5, problem 4

% Newton Method for set of nonlinear equations

%

 f

 

 f

 

2

3

= 2

= 0 x

2

f1='x2+2*lamda*x1'; f2='x1+2*lamda*x2'; f3= 'x1^2+x2^2-1' ;

% Initial guess

% x1v=[1 -1 1 -1];x2v=[1 -1 -1 1];lamdav=[-1 -1 1 1]; for j=1:4 x1=x1v(j);x2=x2v(j);lamda=lamdav(j); fprintf('x1 = %10.5f, x2 = %10.5f, lamda = %10.5f\n',x1,x2,lamda) for i=1:10 f=[eval(f1); eval(f2); eval(f3)];

Jac=[2*lamda, 1, 2*x1

1, 2*lamda, 2*x2

2*x1, 2*x2, 0];

% dx=Jac\f; x1=x1-dx(1);x2=x2-dx(2);lamda=lamda-dx(3); fprintf('x1 = %10.5f, x2 = %10.5f, lamda = %10.5f\n',x1,x2,lamda) if max(abs(dx))<.001,break, end end disp(' ') end

>> s5p4 x1 = 1.00000, x2 = 1.00000, lamda = -1.00000 x1 = 0.75000, x2 = 0.75000, lamda = -0.62500 x1 = 0.70833, x2 = 0.70833, lamda = -0.50694 x1 = 0.70711, x2 = 0.70711, lamda = -0.50001 x1 = 0.70711, x2 = 0.70711, lamda = -0.50000 x1 = -1.00000, x2 = -1.00000, lamda = -1.00000 x1 = -0.75000, x2 = -0.75000, lamda = -0.62500 x1 = -0.70833, x2 = -0.70833, lamda = -0.50694 x1 = -0.70711, x2 = -0.70711, lamda = -0.50001 x1 = -0.70711, x2 = -0.70711, lamda = -0.50000 x1 = 1.00000, x2 = -1.00000, lamda = 1.00000 x1 = 0.75000, x2 = -0.75000, lamda = 0.62500 x1 = 0.70833, x2 = -0.70833, lamda = 0.50694 x1 = 0.70711, x2 = -0.70711, lamda = 0.50001 x1 = 0.70711, x2 = -0.70711, lamda = 0.50000 x1 = -1.00000, x2 = 1.00000, lamda = 1.00000 x1 = -0.75000, x2 = 0.75000, lamda = 0.62500 x1 = -0.70833, x2 = 0.70833, lamda = 0.50694 x1 = -0.70711, x2 = 0.70711, lamda = 0.50001 x1 = -0.70711, x2 = 0.70711, lamda = 0.50000

5. (P. 6.12 Van Nostrand) Solve five iteration for the following optimization problem by successive linear programming starting at x

0

(1, 1) and using the bounds u j

 x jk

=

 1.

= 1, and l j

 x jk

Subject to

Maximize: 4 x

1

+ x

2 x

1

2 + 2 x

2

2  20.25 x

1

2  x

2

2  8.25

We have c j

=

 y

 x j

( x k

), a ij

=

 f

 x i j

(

Therefore c

1

=

 y

 x

1

( x k

) = 4, c

2

= a

11

=

 f

1

 x

1

( x k

) = 2 x

1

( x k

) a

21

=

 f

 x

1

2 ( x

From the general equations k

) = 2 x

1

( x k

)

 y

 x

2 x k

(

) x k

Solution

) = 1 a a

12

22

=

=

 f

1

 x

2

 f

2

 x

2

( x k

) = 4 x

2

( x k

)

( x k

) =  2 x

2

( x k

)

Optimize: y ( x )  y ( x k

) = j n 

1 c j

 x

 j

 j n 

1 c j

 x

 j

Subject to: j n 

1 a ij

 x

 j

 n  j

1 a ij

 x

 j

 b i

 f i

( x k

) for i = 1, 2, ..., m (3.4-3) l j

 x jk

  x j

+   x j

  u j

 x jk

for j = 1, 2, ..., n

The linear programming problem becomes

Maximize: y ( x )  y ( x k

) = c

1

 x

1

+ + c

2

 x

2

+  c

1

 x

1

  c

2

 x

2

Subject to: a

11

 x

1

+ + a

12

 x

2

+  a

11

 x

1

  a

12

 x

2

  b

1

 f

1

( x k

) a

21

 x

1

+ + a

22

 x

2

+  a

21

 x

1

  a

22

 x

2

  b

2

 f

2

( x k

)

 1   x

1

+   x

1

  1

 1   x

2

+   x

2

  1

Substituting all the coefficients ( c

1

, c

2

, a

11

, a

12

, a

21

, and a

22

) into the above equations, we have

Maximize: y ( x )  y ( x k

) = 4  x

1

+ +  x

2

+  4  x

1

   x

2

Subject to: 2 x

1

 x

1

+ + 4 x

2

 x

2

+  2 x

1

 x

1

  4 x

2

 x

2

  20.25  ( x

1

2 + x

2

2 )

2 x

1

 x

1

+  2 x

2

 x

2

+  2 x

1

 x

1

 + 2 x

2

 x

2

  8.25  ( x

1

2  x

2

2 )

 x

1

+   x

1

  1

 x

2

+   x

2

  1

  x

1

+ +  x

1

  1

  x

2

+ +  x

2

  1

With the starting point x

1

= 1 and x

2

= 1, the above equations become

Maximize: y ( x )  y ( x k

) = 4  x

1

+ +  x

2

+  4  x

1

   x

2

Subject to: 2  x

1

+ + 4  x

2

+  2  x

1

  4  x

2

  18.25

2  x

1

+  2  x

2

+  2  x

1

 + 2

 x

1

+   x

1

  1

 x

2

+   x

2

  1

  x

1

+ +  x

1

  1

Solving by the Simplex method gives

 x

1

+ = 1

  x

2

+ +  x

 x

2

+ = 1

2

  1

 x

1

 = 0

 x

2

 x

8.25

2

 = 0

The new point x

1

is computed as follow x

1,1

= x

1,0

+  x

1

+   x

1

 = 1 + 1  0 = 2 x

2,1

= x

2,0

+  x

2

+   x

2

 = 1 + 1  0 = 2

% set 5, problem 5 x1=1;x2=1; fprintf('Starting point x1 = %8.4f, x2 = %8.4f\n',x1,x2) f=[-4;-1;4;1;0;0];

Aeq=zeros(6,6); beq=zeros(6,1);xc=beq;yc=xc;

LB=[0;0;0;0;0;0];UB=[1;1;1;1;1;1]; xc(1)=x1;yc(1)=x2; r3=1;r4=1;r5=1;r6=1; for i=2:5

A=[2*x1 4*x2 -2*x1 -4*x2 0 0 ;2*x1 -2*x2 -2*x1 2*x2 0 0;1 0 -1 0 0 0;0 1 0 -1 0 0;-1 0

1 0 0 0;0 -1 0 1 0 0];

r1=20.25-(x1^2+x2^2);

r2=8.25-(x1^2-x2^2);

b=[r1;r2;r3;r4;r5;r6];

x=linprog(f,A,b,Aeq,beq,LB,UB);

fprintf('dx1+ = %8.4f, dx2+ = %8.4f, dx1- = %8.4f, dx2- = %8.4f\n',x(1),x(2),x(3),x(4))

x1=x1+x(1)-x(3);xc(i)=x1;

x2=x2+x(2)-x(4);yc(i)=x2;

fprintf('New point x1 = %8.4f, x2 = %8.4f\n',x1,x2) end x=linspace(0,sqrt(20.25),50);x1p=linspace(sqrt(8.25),5,50); f1=sqrt((20.25-x.*x)/2);f2=sqrt(x1p.^2-8.25); plot(x,f1,x1p,f2,'--',xc,yc,'o') xlabel('x1');ylabel('x2') grid on legend('x1^2+2*x2^2=20.25','x1^2-x2^2=8.25','Solution points')

>> s5p5

Starting point x1 = 1.0000, x2 = 1.0000

Optimization terminated successfully. dx1+ = 1.0000, dx2+ = 1.0000, dx1- = 0.0000, dx2- = 0.0000

New point x1 = 2.0000, x2 = 2.0000

Optimization terminated successfully. dx1+ = 1.0000, dx2+ = 1.0000, dx1- = 0.0000, dx2- = 0.0000

New point x1 = 3.0000, x2 = 3.0000

Optimization terminated successfully. dx1+ = 1.0000, dx2+ = 0.3437, dx1- = 0.0000, dx2- = 0.6563

New point x1 = 4.0000, x2 = 2.6875

Optimization terminated successfully. dx1+ = 0.3647, dx2+ = 0.4242, dx1- = 0.5325, dx2- = 0.5758

New point x1 = 3.8322, x2 = 2.5359

4.5

4

3.5

3

2.5

2

1.5

1

0.5

0

0 0.5

1 1.5

2 2.5

x1

3 x1

2 x1

2

+2*x2

2

=20.25

-x2

2

=8.25

Solution points

3.5

4 4.5

5

6. Minimize the function f ( x , y ) = ( x

2) 4 + ( x

2) 2 y 2 + ( y + 1) 2 , using Newton method with x 0 =

[1 1] T . x i+1 = x i  H i

-1  f ( x i )

Solution

(1)

 f ( x i ) =

4 (

2 ( x x

2 )

2 )

3

2

 y

2 ( x

2 (

 y

2 ) y

2

1 )

 f

 x

= 4( x  2) 3 + 2( x  2) y 2 ,

 f

 y

= 2( x  2)

 2

 x

2 f

= 12( x  2) 2 + 2 y 2 ,

 2 f

 x

 y

 2 f

 y

 x

= 4(

% Set 5, problem 6 x  2) y ,

2 y

2 f

= 2( x 

= 4(

2) 2 x  2)

+ 2 y

2 y + 2( y + 1) x=1;y =1; disp('x y') for i=1:10

delf=[ 4*(x - 2)^33 + 2*(x - 2)*y^2; 2*(x - 2)^2*y + 2*(y + 1)];

Hes=[12*(x - 2)^2 + 2*y^2, 4*(x - 2)*y; 4*(x - 2)*y, 2*(x - 2)^2 + 2];

dx=-inv(Hes)*delf;

x=x+dx(1);

y=y+dx(2);

fprintf('%10.6f %10.6f \n',x,y)

if max(abs(dx))<1e-5,break,end end

>> s5p6 x y

1.000000 -0.500000

1.391304 -0.695652

1.539386 -0.821160

1.751884 -0.957583

1.956901 -1.033780

1.996908 -1.001704

1.999989 -1.000010

2.000000 -1.000000

2.000000 -1.000000

Download