summaryrefslogtreecommitdiffstats
path: root/scilab_doc/neldermead/section-simplex.tex
blob: 7b65b7251d959c45c7afaed6ff158dd34d79ed3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
\chapter{Simplex theory}

In this section, we present the various definitions connected
to simplex algorithms. We introduce several methods to measure 
the size of a simplex, including the oriented length. 
We present several methods to compute an
initial simplex, for example the regular simplex used by Spendley et al..
We also present the simplex gradient, which is a forward or a centered 
difference formula for the gradient of the cost function.
The core of this section is from \cite{Kelley1999}.

\section{The simplex}

A \emph{simplex} $S$ in $\RR^n$ is the convex hull of $n+1$ points $S=\{\bx_i\}_{i=1,n+1}$.

Box extended the Nelder-Mead algorithm to handle bound and non linear constraints \cite{Box1965}.
To be able to manage difficult cases, he uses a \emph{complex} made of $k\geq n+1$ vertices.
In this section, we will state clearly when the definition and results can be applied to a complex. 
Indeed, some definitions such as the simplex gradient cannot be extended to a \emph{complex}
and are only applicable to a \emph{simplex}.

The point $\bx_i\in\RR^n$ is the $i$-th vertex of $S$. Given a function $f(\bx)\in\RR$,
each vertex is associated with a function value $f_i = f(\bx_i)$ for $i=1,n+1$.
In simplex algorithms, the vertex are sorted by increasing function values 

\begin{eqnarray}
\label{simplex-sortedfv}
f_1 \leq f_2 \leq \ldots \leq f_n \leq f_{n+1}
\end{eqnarray}

The sorting order is not precisely defined neither in Spendley's et al paper \cite{Spendley1962}
nor in Nelder and Mead's \cite{citeulike:3009487}. 
In \cite{lagarias:112}, the sorting rules are defined precisely to be able to 
state a theoretical convergence result. In practical implementations, though, the 
ordering rules have no measurable influence.

Let $V$ denote the $n\times n$ matrix of simplex directions 
\begin{eqnarray}
\label{simplex-directions}
V(S) = (\bx_2 - \bx_1, \bx_3 - \bx_1 , \ldots , \bx_{n+1} - \bx_1) = (\bv_1, \ldots , \bv_n)
\end{eqnarray}

We say that $S$ is nonsingular if the matrix of simplex directions $V(S)$ is nonsingular.


\section{The size of the simplex}

Several methods are available to compute the size of a simplex.
In Kelley's book \cite{Kelley1999}, the author presents the diameter and the two oriented lengths.

The simplex diameter $diam(S)$ is defined by 
\begin{eqnarray}
\label{simplex-diameter}
diam(S) = \max_{i,j=1,n+1} \|\bx_i - \bx_j\|_2,
\end{eqnarray}
where $\|.\|_2$ is the euclidian norm $\|x\|_2 = \sum_{i=1,n}\bx_i^2$.
In practical implementations, computing the diameter requires two nested loops over the 
vertices of the simplex, i.e. $(n+1)^2$ operations. This is why authors generally 
prefer to use lengths which are less expensive to compute.

The two oriented lengths $\sigma_-(S)$ and $\sigma_+(S)$ are using the 
first vertex as the reference point and are defined by 

\begin{eqnarray}
\label{simplex-sigma}
\sigma_+(S) = \max_{i=2,n+1} \|\bx_i - \bx_1\|_2 \qquad \textrm { and } \qquad \sigma_-(S) = \min_{i=2,n+1} \|\bx_i - \bx_1\|_2
\end{eqnarray}

The following inequalities are satisfied between the diameter and the maximum oriented length

\begin{eqnarray}
\label{simplex-sigma-diam}
\sigma_+(S) \leq diam(S) \leq 2 \sigma_+(S)
\end{eqnarray}

In Nash's book \cite{nla.cat-vn1060620}, the size of the simplex $s_N(S)$ is measured
based on the $l1$ norm and is defined by 
\begin{eqnarray}
\label{simplex-sizenash}
s_N(S) = \sum_{i=2,n+1} \|\bx_i - \bx_1\|_1
\end{eqnarray}
where 
\begin{eqnarray}
\label{simplex-sizenash2}
\|\bx_i - \bx_1\|_1 = \sum_{j=1,n} |x_i^j - x_1^j|
\end{eqnarray}
where $x_i^j\in\RR$ is the $j$-th coordinate of the $i$-th vertex of the simplex $S$.

\section{The initial simplex}

While most of the theory can be developed without being very specific 
about the initial simplex, the initial simplex plays a very important role in practice.
All approaches are based on the initial guess $\overline{\bx}_0\in\RR^n$ and create a 
geometric shape based on this point.

In this section, we present the various approach to design the initial 
simplex. In the first part, we emphasize the importance of the initial
simplex in optimization algorithms. Then we present the regular simplex 
approach by Spendley et al., the randomized bounds approach by Box and 
Pfeffer's method.

\subsection{Importance of the initial simplex}

The initial simplex is particularily important in the case of Spendley's et al 
method, where the shape of the simplex is fixed during the iterations.
Therefore, the algorithm can only go through points which are on the pattern
defined by the initial simplex. The pattern presented in figure \ref{fig-nm-simplex-fixedshape}
is typical a fixed-shape simplex algorithm (see \cite{Torczon89multi-directionalsearch}, chapter 3, 
for other patterns of a direct search method).
If, by chance, the pattern is so that the optimum is close to one point 
defined by the pattern, the number of iteration may be small. On the contrary, the 
number of iterations may be high if the pattern does not come close to the 
optimum.

\begin{figure}
\begin{center}
\includegraphics[width=7cm]{simplex_initialfixed.png}
\end{center}
\caption{Typical pattern with fixed-shape Spendley's et al algorithm}
\label{fig-nm-simplex-fixedshape}
\end{figure}

The variable-shape simplex algorithm designed by Nelder and Mead is also very
sensitive to the initial simplex.
One of the problems is that the initial simplex should be consistently scaled 
with respect to the unknown $x$.
In \cite{parkinson1972}, "An investigation into the efficiency of variants on the simplex method", 
Parkinson and Hutchinson explored 
several ways of improvement. First, they investigate the sensitivity
of the algorithm to the initial simplex. Two parameters were investigated,
i.e. the initial length and the orientation of the simplex. 
The conclusion of their study with respect to the initial simplex is 
the following. "The orientation of the initial simplex has a significant effect 
on efficiency, but the relationship can be too sensitive for an automatic 
predictor to provide sufficient accuracy at this time."

Since no initial simplex clearly improves on the others, in practice, 
it may be convenient to try different approaches.

\subsection{Spendley's et al simplex}

In their paper \cite{Spendley1962}, Spendley et al. use a regular 
simplex with given size $\ell>0$. We define the parameters $p,q>0$ as 
\begin{eqnarray}
p &=& \frac{1}{n\sqrt{2}} \left(n-1 + \sqrt{n+1}\right), \\
q &=& \frac{1}{n\sqrt{2}} \left(\sqrt{n+1} - 1\right).
\end{eqnarray}
We can now define the vertices of the simplex $S=\{\bx_i\}_{i=1,n+1}$.
The first vertex of the simplex is the initial guess 
\begin{eqnarray}
\bx_1 &=& \overline{\bx}_0.
\end{eqnarray}
The other vertices are defined by $\bx_i = \left( x_i^1, \ldots x_i^n\right)\in\RR^n$
where the coordinates $x_i^j$ are 
\begin{eqnarray}
x_i^j &=& 
\left\{
\begin{array}{l}
\overline{x}_0^j + \ell p, \textrm{ if } j=i-1,\\
\overline{x}_0^j + \ell q, \textrm{ if } j\neq i-1,\\
\end{array}
\right.
\end{eqnarray}
for $i=2,n+1$ where $\ell \in\RR$ is the length of the simplex ($\ell>0$). Notice that this 
length is the same for all the vertices which keeps the simplex regular.

The regular initial simplex is presented in figure \ref{fig-nm-simplex-regular}.

\begin{figure}
\begin{center}
\includegraphics[width=10cm]{simplex_regular.png}
\end{center}
\caption{Regular simplex in 2 dimensions}
\label{fig-nm-simplex-regular}
\end{figure}

\subsection{Simplex along the axes}

A very efficient and simple approach leads to an axis-by-axis simplex.
This simplex depends on a vector of positive lengths $\bl\in\RR^n$.
The first vertex of the simplex is the initial guess 
\begin{eqnarray}
\bx_1 &=& \overline{\bx}_0.
\end{eqnarray}
The other vertices are defined by 
\begin{eqnarray}
x_i^j &=& 
\left\{
\begin{array}{l}
\overline{x}_0^j + \bl_j, \textrm{ if } j=i-1,\\
\overline{x}_0^j, \textrm{ if } j\neq i-1,\\
\end{array}
\right.
\end{eqnarray}
for $i=2,n+1$ 

This kind of simplex is presented in figure \ref{fig-nm-simplex-axes}.
The axis-by-axis approach is used in the very popular Nelder-Mead 
algorithm provided in Numerical Recipes in C \cite{NumericalRecipes}.
As stated in \cite{NumericalRecipes}, the length vector $\bl$ can 
be used as a guess for the characteristic length scale of the problem.

\begin{figure}
\begin{center}
\includegraphics[width=10cm]{simplex_axes.png}
\end{center}
\caption{Axis-based simplex in 2 dimensions}
\label{fig-nm-simplex-axes}
\end{figure}

\subsection{Randomized bounds}

Assume that the variable $\bx\in\RR^n$ is bounded so that 
\begin{eqnarray}
m^j \leq x^j \leq M^j,
\end{eqnarray}
for $j=1,n$, where $m_j,M_j\in\RR$ are minimum and maximum bounds and $m_j\leq M_j$.
A method suggested by Box in \cite{Box1965} is based on the use of 
pseudo-random numbers. Let $\{\theta_i^j\}_{i=1,n+1,j=1,n}\in[0,1]$ be 
a sequence of random numbers uniform in the interval $[0,1]$.
The first vertex of the simplex is the initial guess 
\begin{eqnarray}
\bx_1 &=& \overline{\bx}_0.
\end{eqnarray}
The other vertices are defined by 
\begin{eqnarray}
x_i^j &=& m^j + \theta_i^j (M^j - m^j),
\end{eqnarray}
for $i=2,n+1$.

\subsection{Pfeffer's method}

This initial simplex is used in the function \scifunction{fminsearch}
and presented in \cite{Fan2002}. It is due to L. Pfeffer at Stanford.

TODO...

\section{The simplex gradient}

TODO...