



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




ME2016D, Fall 2008, Dr. Ferri Name: ________________________ Test 2, November 5
This is a closed-book, closed-notes test. No calculators are allowed. You are allowed to refer to a single 8.5x11 inch page of notes. The sheet must be single-sided and must be handwritten. Show all of your work to receive credit.
Honor Pledge: On my honor, I pledge that I have neither given nor received any inappropriate aid in the preparation of this test.
Signature
Problem 1 (10) __________
Problem 2 (10) __________
Problem 3 (10) ___________
Problem 4 (10) _________
Problem 5 (10) _________
Total (50) ______________
Problem 1. (10 points) The figure below shows the feasible region (shaded) and the bounding constraint lines for a linear programming problem. (a) If the objective is to MINIMIZE z = x 1 (^) + x 2 , give the approximate values of x1 and x2 that minimize z without violating any constraints. (b) If the objective is to MAXIMIZE z = x 1 (^) + x 2 , give the approximate values of x1 and x2 that maximize z without violating any constraints. (c) If the objective is to minimize z = x 1 (^) + x 2 ,
give Matlab expressions to define all quantities in the following call to linprog.
» x = linprog(f,A,b,Aeq,beq,LB,UB)
(a) The contour lines for z = x 1 + x 2 have a slope of -45O. The -45O^ line closest to the origin leaves the feasible region at the point labeled (a) above. This occurs approximately at (2.5, 0.75)
(b) The -45O^ line furthest from the origin leaves the feasible region at the point labeled (b) above. This occurs approximately at (5,1.75)
(c) There are several possibilities. First, note that the feasible region is defined by the 5 inequalities:
(^1 2 3 4 5 6 )
1
2
3
4
5
6
x (^2)
x (^1)
(^1 2 3 4 5 6 )
1
2
3
4
5
6
(a)
(b)
Problem 2. (10 points, 2 points each) The contour plot for a certain function f( x 1 , x 2 ) is shown in the figure below. The number near each contour gives the values of f along each curve.
(a) Starting from the point x 0 , draw and clearly label the direction of the gradient vector.
(b) Consider a gradient-search technique initiated at the point (x 0 , y 0 ) and intended to find the point at which f( x 1 , x 2 ) is maximized. Draw and clearly label the approximate location of the next point, (x 1 , y 1 ) in a gradient search routine.
(c) In the Golden Section search technique, why are the interior points x 1 and x 2 chosen based on the
The golden ratio is used to place the two evaluation points x 1 and x 2. The Golden ratio ensures that in the next iteration, one of the two xi values will be exactly in place for one of the two x locations. It makes sure that only one function evaluation per iteration is needed.
(d) LU decomposition is used to solve the linear system [A]*x = b, where [A] is a 1000x matrix and x and b are 1000x1 vectors. It takes100 milliseconds to compute L and U and 1 millisecond to perform the forward and backward substitutions to solve for x. Approximately how long will it take to compute the inverse of the matrix [A]? Explain your reasoning.
Calculating the inverse of a nxn matrix is equivalent to solving [A]x = b n-times. Thus, the inverse would take 100 milliseconds to compute the LU decomposition, and then 10001 milliseconds to get each column of [A]-1. Total time would be 1100 msec, or 1.1 sec.
(e) If [ A ] (^) ∞ = 1 2 e , and [ A ] −^1 1 4 e ∞ = , and if the percent error in the elements of b are known to
(1e-5)% accuracy, to what accuracy do you anticipate the solution for x to be?
First, note that the cond(A, inf) = (1e2)(1e4)=1e6. We also know that ( )
x b cond A x b
Therefore, the relative error in x should be approximately (1e6)*(1e-5)% = 10%
x
y
5 3 f = 1 9 8 7
(x 0 , y 0 )
(x 1 , y 1 )
Gradient direction
Problem 3. (10 points) A function f(x) is known to possess a single maximum over the range xL =0 to xU = 100. The Golden Section algorithm is applied to find the maximum of the function, generating the table below. The numerical results in some of the boxes have been hidden. (a) Based on the results shown, which box must contain the larger value, A or B? Why? (b) What is the numerical value that should appear in box C? (c) At the end of three iterations, what is the best guess for the maximizing value of x? (d) Over what range of values is the true maximum known to lie?
A
iteration x 1 x (^2)
1
xL xU f 1 f 2 d
0 100 61.8034 38.1966 61.
2
3
(^0) 61.8034 38.1966 23.6068 (^) 5192.21 4249.86 (^) 38.
23.6068 61.8034^ 47.2136 (^) 38.1966 5136.03 (^) 5192.21 23.
B
C
(a) Since xL did not change, it must be the cae that f 2 > f 1 in row 1. Thus, B contained the larger value.
(b) xL should be equal to x 1 – d, so xL should be 23.
(c) The Golden-Section answer is the value of either x 1 or x 2 , whichever has the larger value of f. In this case, the GS answer is x = x 2 = 38.
(d) The true optimum must lie between the row-3 values of xL and x 1 , so 23.6 < xmax < 47.
Problem 5. (10 points) The following code is supposed to perform a standard Gauss-Seidel iteration method. (a) What are the equations that are being solved? Give numerical values for [A] and b? (b) Solve the equations from part (a) using Gaussian elimination. Be sure to implement partial pivoting when the situation warrants it and show your steps. (c) Change the code to implement a Successive-Over-Relaxation (SOR) technique with lambda = 1.5. Clearly indicate the changes that need to be made.
N=10; lambda = 1.5; x1=1; x2=1; x3=1; for j=1:N; x1 = (1-lambda)x1 + lambda** ( 2 - x2 - x3); x2 = (1-lambda)x2 + lambda** ( 3 - 2x1 - x3)/2; x3 = (1-lambda)x3 + lambda* ( 4 - x1)/3; end
(a) The Gauss-Seidel equations correspond to a system of equations [ A ] x = b with
1 2 3
x x x
(b) Pivot rows 1 and 2
1 2 3
x x x
f 21 = ½, f 31 = ½,
1 2 3
x x x
Pivot rows 2 and 3 to complete the Gaussian Elimination process:
1 2 3
x x x
Back-Subs: x 3 = 1; x 2 = -(2.5 – 2.5x 1 ) = 0; x 3 = (3 – 2x 2 –x 3 )/2 = 1;
Get x = [1 0 1]T
(c) Changes in RED above.