Tier 3 – Nelder-Mead Iteration [3/5] Complete one iteration of the Nelder-Mead Simplex Method by following steps (1) to (3) in the provided algorithm. Use initial guesses of x(1) = (-4,0]”, x(2) = (-4,1)”, and x(3) = (-3.5, 0.5]”. Save your file as tier3_#########. Report the values of f(x(1)). f(x(2)), and f(x(3)) AFTER one iteration using fprintf statement(s) AND plot the points of BOTH triangles on a contour plot of f(x). Hint: Only one answer should change. The plot should make it clear if it worked correctly. Tier 4 – Nelder-Mead Algorithm Without Shrinking [4/5] Complete the Nelder-Mead Simplex Method by following steps (1) to (4) in the provided algorithm. However, in step 4 do not check to see if the triangle must be shrunk; instead, always just assume you can return to step (2). Use the same initial guesses of x(1) = (-4,01″, x(2) = (-4,1)”, and x(3) = (-3.5, 0.5]”. Use a maximum number of iterations of 20. Save your file as tier4_#########. Report the values of f(x(1)), f(x(2)), and f(x(3)) AFTER all of the iterations have completed using fprintf statement(s) AND plot the points of ALL triangles on a contour plot of f(x). Hint: This will only “trap” the solution in a larger triangle and then get stuck. It will thus take all 20 iterations (this is normal). You will likely want to use the function sortinghat. Nelder-Mead Algorithm For the following minimization problem where is a scalar and x = [X1 X2] is a two-dimensional vector: min o = f(x) The Nelder-Mead procedure is: 1. Initialization Choose 3 distinct points {x(1),x(2), x(3) Set stopping tolerance e > 0. 2. Move Direction Evaluate {9(x(i)), (x(2)), 4(x(3))} Sort x( from highest to lowest according to $(x) (recall we want to minimize). Consider the new order of x to be in its sorted order (x(1) highest … (3) lowest). Compute middle of x(2) and x(3) as x(m) =} (x(2) + x(3)). Compute the “flip” direction as Ax = x(m) – x(1). IF Ax|< € STOP → Report the optimum as x (m) 3. Replace Worst Point Replace the WORST point (1) as: x(1) = x(1) + 24x 4. Shrink the Triangle if Necessary IF Ax is exactly – Ax from the previous iteration, the current triangle is too big. Shrink current triangle by setting xhew = } [x(1) + x(“] where i = 2, 3 Return to step 2 ELSE Return to step 2 You have been provided with some functions to help you. They are LOCKED via protected file (-p) status and may not be opened. Here is what they do: • [] = m3 contour() is a function that accepts no inputs and gives no outputs, but is DOES create a contour plot of the function we are trying to minimize. x(1) • [] = plot triangle (x) requires a 3 x 2 input x = x(2) and plots those points as a triangle Lx(3)] (for example, on the contour plot provided by m3 contour). [x_sorted) – sortinghat (x,col, option) accepts any matrix x and returns the same matrix with the rows sorted according to column col from highest to lowest. The input option can be left out, but it will accept ‘on’ if you are feeling spicy. Here is an example: 1 4 9 – 2 -5 1 1993 >> sortinghat (X, 3) 1 i 2 4 99 -5 • [x] = sortme () produces a matrix x to be used for the bonus question. Show transcribed image text Tier 3 – Nelder-Mead Iteration [3/5] Complete one iteration of the Nelder-Mead Simplex Method by following steps (1) to (3) in the provided algorithm. Use initial guesses of x(1) = (-4,0]”, x(2) = (-4,1)”, and x(3) = (-3.5, 0.5]”. Save your file as tier3_#########. Report the values of f(x(1)). f(x(2)), and f(x(3)) AFTER one iteration using fprintf statement(s) AND plot the points of BOTH triangles on a contour plot of f(x). Hint: Only one answer should change. The plot should make it clear if it worked correctly. Tier 4 – Nelder-Mead Algorithm Without Shrinking [4/5] Complete the Nelder-Mead Simplex Method by following steps (1) to (4) in the provided algorithm. However, in step 4 do not check to see if the triangle must be shrunk; instead, always just assume you can return to step (2). Use the same initial guesses of x(1) = (-4,01″, x(2) = (-4,1)”, and x(3) = (-3.5, 0.5]”. Use a maximum number of iterations of 20. Save your file as tier4_#########. Report the values of f(x(1)), f(x(2)), and f(x(3)) AFTER all of the iterations have completed using fprintf statement(s) AND plot the points of ALL triangles on a contour plot of f(x). Hint: This will only “trap” the solution in a larger triangle and then get stuck. It will thus take all 20 iterations (this is normal). You will likely want to use the function sortinghat.

Nelder-Mead Algorithm For the following minimization problem where is a scalar and x = [X1 X2] is a two-dimensional vector: min o = f(x) The Nelder-Mead procedure is: 1. Initialization Choose 3 distinct points {x(1),x(2), x(3) Set stopping tolerance e > 0. 2. Move Direction Evaluate {9(x(i)), (x(2)), 4(x(3))} Sort x( from highest to lowest according to $(x) (recall we want to minimize). Consider the new order of x to be in its sorted order (x(1) highest … (3) lowest). Compute middle of x(2) and x(3) as x(m) =} (x(2) + x(3)). Compute the “flip” direction as Ax = x(m) – x(1). IF Ax|> sortinghat (X, 3) 1 i 2 4 99 -5 • [x] = sortme () produces a matrix x to be used for the bonus question.

## Expert Answer

Answer to Tier 3 – Nelder-Mead Iteration [3/5] Complete one iteration of the Nelder-Mead Simplex Method by following steps (1) to …