Skip to main content

Scientific Computing

Non-linear Optimis...

Derivative-fr... []

This material has been adapted from material by Martin Robinson from the "Scientific Computing" module of the SABS R³ Center for Doctoral Training.

This material has been adapted from material by Martin Robinson from the "Scientific Computing" module of the SABS R³ Center for Doctoral Training.

Creative Commons License
This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

This course material was developed as part of UNIVERSE-HPC, which is funded through the SPF ExCALIBUR programme under grant number EP/W035731/1

Creative Commons License

Nelder-Mead method

The Nelder-Mead method is popular and implementations exist in many optimisation software libraries. It is based on the idea of a simplex in parameter space of dimension nn, which is formed from the convex hull of n+1n + 1 points in Rn\mathcal{R}^n. These points xix_i are ordered according to their function value so that

f(x1)f(x2)f(xn+1)f(x_1) \le f(x_2) \le \cdots \le f(x_{n+1})

For each iteration of the algorithm, there are five different points of interest, the first of which is the centroid of the nn points with the lowest ff values

xˉ=1ni=1nxi\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i

The other four points are defined by considering the line joining xˉ\bar{x} and the point with the highest ff value xn+1x_{n+1}

xˉ(t)=xˉ+t(xn+1xˉ)\bar{x}(t) = \bar{x} + t(x_{n+1} - \bar{x})

The four points are the reflection, expanding, the inside contraction and outside contraction points, given by xˉ(1)\bar{x}(-1), xˉ(2)\bar{x}(-2), xˉ(1/2)\bar{x}(1/2), and xˉ(1/2)\bar{x}(-1/2) respectively.

The Nelder-Mead algorithm tries to replace xn+1x_{n+1} by reflecting, expanding, or contracting the simplex to one of these points. If it cannot find a better point, then all the vertices on the simplex are shrunk towards the best vertex x1x_1.

Nelder–Mead simplex search over the Rosenbrock banana
function

Algorithm

Scholarpedia and Wikipedia provide diagrams and pseudocode of the Nelder-Mead algorithm, as does Chapter 9.5 of the Nocedal and Write textbook given below

Initialisation and termination

It is not obvious how Nelder-Mead should be initialised, given a single starting point x0x_0 by the user. The (Gau 2012) paper provides an initialisation routine that was also used in MATLAB's fminsearch function. The x0x_0 point is used as one of the vertices, with the remaining nn vertices set to x0+τieix_0 + \tau_i e_i, where eie_i is a unit vector in the ithi^{th} coordinate and

τi={0.05 if (x0)i0,0.00025 if (x0)i=0,\tau_i = \begin{cases} 0.05 \text{ if }(x_0)_i \ne 0,\\ 0.00025 \text{ if }(x_0)_i = 0,\\ \end{cases}

For termination, Nelder and Mead recommended stopping the iteration when the standard deviation of the function evaluations reduces below a certain tolerance. MATLAB's fminsearch terminates when max_2in+1f_if_1TolFun\max\_{2 \le i \le n+1} |f\_i - f\_1| \le \text{TolFun} and max_2in+1x_ix_1TolX\max\_{2 \le i \le n+1} || x\_i - x\_1 ||_\infty \le \text{TolX}, or if the maximum number of iterations of function evaluations is reached.

Other Reading

Problems

Nelder-Mead algorithm

Code up the Nelder-Mead algorithm and compare its performance against the steepest descent, Newton and dogleg algorithms you did in the last lesson. You can evaluate them on the 2D quadratic function f(x,y)=x2+y2f(x, y) = x^2 + y^2, the 2D Rosenbrock function or on one of many different optimisation test functions