# Data Mining Algorithms In R/Packages/optimsimplex/optimsimplex.new

## Description

optimsimplex.new creates a simplex list object which contains, among other elements, a matrix of vertices and a vector of function values calculated at those vertices. The object is actually created by a secondary function based upon the value of the method argument:

NULL -> optimsimplex.coords
’axes’ -> optimsimplex.axes
’pfeffer’ -> optimsimplex.pfeffer
’randbounds’ -> optimsimplex.randbounds
’spendley’ -> optimsimplex.spendley
’oriented’ -> optimsimplex.oriented

## Usage

```   optimsimplex.new(coords = NULL, fun = NULL, data = NULL, method = NULL, x0 = NULL, len = NULL, deltausual = NULL, deltazero = NULL,
boundsmax = NULL, boundsmin = NULL, nbve = NULL, simplex0 = NULL)
optimsimplex.coords(coords = NULL, fun = NULL, data = NULL)
optimsimplex.axes(x0 = NULL, fun = NULL, len = NULL, data = NULL)
optimsimplex.pfeffer(x0 = NULL, fun = NULL, deltausual = NULL, deltazero = NULL, data = NULL)
optimsimplex.randbounds(x0 = NULL, fun = NULL, boundsmin = NULL, boundsmax = NULL, nbve = NULL, data = NULL)
optimsimplex.spendley(x0 = NULL, fun = NULL, len = NULL, data = NULL)
optimsimplex.oriented(simplex0 = NULL, fun = NULL, data = NULL)
```

## Arguments

 coords The matrix of point estimate coordinates in the simplex. The coords matrix is expected to be a nbve x n matrix, where n is the dimension of the space and nbve is the number of vertices in the simplex, with nbve>= n+1. Only used if method is set to NULL. fun The function to compute at vertices. The function is expected to have the following input and output arguments: ``` myfunction <- function(x, this){ ... return(list(f=f,this=this)) } ``` where x is a row vector and this a user-defined data, i.e. the data argument. data A user-defined data passed to the function. If data is provided, it is passed to the callback function both as an input and output argument. data may be used if the function uses some additional parameters. It is returned as an output parameter because the function may modify the data while computing the function value. This feature may be used, for example, to count the number of times that the function has been called. method The method used to create the new optimsimplex object, either ’axes’, ’pfeffer’, ’randbounds’, ’spendley’ or ’oriented’. x0 The initial point estimates, as a row vector of length n. len The dimension of the simplex. If length is a value, that unique length is used in all directions. If length is a vector with n values, each length is used with the corresponding direction. Only used if method is set to ’axes’ or ’spendley’. deltausual The absolute delta for non-zero values. Only used if method is set to ’pfeffer’. deltazero The absolute delta for zero values. Only used if method is set to ’pfeffer’. boundsmin A vector of minimum bounds. Only used if method is set to ’randbounds’. boundsmax A vector of maximum bounds. Only used if method is set to ’randbounds’. nbve The total number of vertices in the simplex. Only used if method is set to ’randbounds’. simplex0 The initial simplex. Only used if method is set to ’oriented’.

## Details

All arguments of optimsimplex.new are optional. If no input is provided, the new simplex object is empty.
If method is NULL, the new simplex object is created by optimsimplex.coords. If coords is NULL, the simplex object is empty; otherwise, coords is used as the initial vertice coordinates in the new simplex.
If method is set to ’axes’, the new simplex object is created by optimsimplex.axes. The initial vertice coordinates are stored in a nbve x n matrix built as follows:

```    [,1]   | x0[1] ... x0[n] |   | len[1] ...   0    |
[,.]   |  ...  ...  ...  | + |  ...   ...  ...   |
[,nbve] | x0[1] ... x0[n] |   |   0    ... len[n] |
```

If method is set to ’pfeffer’, the new simplex object is created by optimsimplex.pfeffer using the Pfeffer’s method, i.e. a relative delta for non-zero values and an absolute delta for zero values.
If method is set to ’randbounds’, the new simplex object is created by optimsimplex.randbounds. The initial vertice coordinates are stored in a nbve x n matrix consisting of the initial point estimates (on the first row) and a (nbve-1) x n matrix of randomly sampled numbers between the specified the bounds. The number of vertices nbve in the simplex is arbitrary.
If method is set to ’spendley’, the new simplex object is created by optimsimplex.spendley using the Spendely’s method, i.e. a regular simplex made of nbve = n+1 vertices.
If method is set to ’oriented’, the new simplex object is created by optimsimplex.oriented in sorted order. The new simplex has the same sigma- length of the base simplex, but is "oriented" depending on the function value. The created simplex may be used, as Kelley suggests, for a restart of Nelder-Mead algorithm.

## Value

Return a list with the following elements:

newobj A list with a ’type’ attribute set to ’T_SIMPLEX’ and with the following elements:
verbose The verbose option, controlling the amount of messages. Set to 0.
x The coordinates of the vertices, with size nbve x n.
n The dimension of the space.
fv The values of the function at given vertices. It is a column matrix of length nbve.
nbve The number of vertices.
data The updated data input argument.

## Authors

Author of Scilab optimsimplex module: Michael Baudin (INRIA - Digiteo)
Author of R adaptation: Sebastien Bihorel (sb.pmlab@gmail.com)

## References

"A Simplex Method for Function Minimization", Nelder, J. A. and Mead, R. The Computer Journal, January, 1965, 308-313
"Sequential Application of Simplex Designs in Optimisation and Evolutionary Operation", W. Spendley, G. R. Hext, F. R. Himsworth, Technometrics, Vol. 4, No. 4 (Nov., 1962), pp. 441-461, Section 3.1
"A New Method of Constrained Optimization and a Comparison With Other Methods", M. J. Box, The Computer Journal 1965 8(1):42-52, 1965 by British Computer Society
"Detection and Remediation of Stagnation in the Nelder-Mead Algorithm Using a Sufficient Decrease Condition", SIAM J. on Optimization, Kelley C.T., 1999
"Multi-Directional Search: A Direct Search Algorithm for Parallel Machines", by E. Boyd, Kenneth W. Kennedy, Richard A. Tapia, Virginia Joanne Torczon, Virginia Joanne Torczon, 1989, Phd Thesis, Rice University
"Grid Restrained Nelder-Mead Algorithm", Arpad Burmen, Janez Puhan, Tadej Tuma, Computational Optimization and Applications, Volume 34 , Issue 3 (July 2006), Pages: 359 - 375
"A convergent variant of the Nelder-Mead algorithm", C. J. Price, I. D. Coope, D. Byatt, Journal of Optimization Theory and Applications, Volume 113 , Issue 1 (April 2002), Pages: 5 - 19
"Global Optimization Of Lennard-Jones Atomic Clusters", Ellen Fan, Thesis, February 26, 2002, McMaster University

## Examples

```   myfun <- function(x,this){return(list(f=sum(x^2),this=this))}
mat <- matrix(c(0,1,0,0,0,1),ncol=2)

optimsimplex.new()
optimsimplex.new(coords=mat,x0=1:4,fun=myfun)
optimsimplex.new(method='axes',x0=1:4,fun=myfun)
optimsimplex.new(method='pfeffer',x0=1:6,fun=myfun)
opt <- optimsimplex.new(method='randbounds',x0=1:6,boundsmin=rep(0,6), boundsmax=rep(10,6),fun=myfun)
opt
optimsimplex.new(method='spendley',x0=1:6,fun=myfun,len=10)
optimsimplex.new(method='oriented',simplex=opt\$newobj,fun=myfun)
```