Crawling amoebas
I just finished implementing the Nelder-Mead algorithm for finding the minima of functions. This is a fairly robust algorithm that operates in
dimensions. It requires no information on derivatives, and can efficiently crawl through valleys and the eyes of needles. How? Simulate an idealized amoeba!
Say you have a function
which you want to minimize. Construct an
-dimensional simplex (the simplex is the higher dimensional analog of the triangle or tetrahedron). Now let the simplex, consisting of points
crawl around
.
For each iteration, let
be the worst of the
(in the sense that it has the largest value of
),
be the second worst, and
be the best. Also, let
.
We will also need the vector which describes reflecting one point through the hyperplane formed by the rest of the points of the simplex. This is given by
, the vector to the center of mass of that hyperplane.
We make the simplex crawl according to the following algorithm:
- If
, try going twice as far beyond the simplex:
, then replace
with whichever gives of a lower value of
:
or
. - Otherwise, if
, then we just replace
with
(the reflection isn’t promising enough to try the extension). - At this point life is looking bad. Try just pulling
in towards the rest of the simplex: if
, replace
with
. - If even that isn’t an improvement, we try to go to a smaller length scale (it may be that we’re hovering over a narrow valley, or even across several valleys, and are being confused by this). To do this, we contract the simplex around
. Take
, add to it whichever is better of
and
(remember that we only tested up to the point where
was better than
). Then we start again with the new simplex
where the
are drawn from
the better of
and
.
Wikipedia has a very nice animated gif of a simplex crawling according to these rules.
I have one serious problem with the simplex algorithm: I have no idea to prove when or if it will work. There are modifications of it to try to improve its reliability, particularly in high dimensions, but I know of no theoretical examination of these properties.
Leave a comment