S3 optimsimplex class

Share:

Description

These functions support the S3 class 'optimsimplex' and are intended to either create objects of this class or check if an object is of this class.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  optimsimplex(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.tostring(x)
  
  ## S3 method for class 'optimsimplex'
print(x,...)
  
  ## S3 method for class 'optimsimplex'
is(x)
  

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 additionnal 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'.

x

An object of class 'optimsimplex'.

...

optional arguments to 'print' or 'plot' methods.

Details

All arguments of optimsimplex are optional. If no input is provided, the new optimsimplex object is empty.

If method is NULL, the new optimsimplex object is created by optimsimplex.coords. If coords is NULL, the optimsimplex object is empty; otherwise, coords is used as the initial vertice coordinates in the new simplex.

If method is set to '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 optimsimplex object is created 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 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 optimsimplex is arbitrary.

If method is set to 'spendley', the new optimsimplex object is created using the Spendely's method, i.e. a regular simplex made of nbve = n+1 vertices.

If method is set to 'oriented', the new optimsimplex object is created 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 optimsimplex may be used, as Kelley suggests, for a restart of Nelder-Mead algorithm.

The optimsimplex.tostring function is a utility function, which formats the content of a optimsimplex object into a single string of characters.

Value

The optimsimplex function returns a list with the following elements:

newobj

An object of class 'simplex', i.e. a list with the following elements:

verbose

The verbose option, controlling the amount of messages. Set to FALSE.

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.

Author(s)

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  myfun <- function(x,this){return(list(f=sum(x^2),this=this))}
  mat <- matrix(c(0,1,0,0,0,1),ncol=2)
  
  optimsimplex()
  optimsimplex(coords=mat,x0=1:4,fun=myfun)
  optimsimplex(method='axes',x0=1:4,fun=myfun)
  optimsimplex(method='pfeffer',x0=1:6,fun=myfun)
  opt <- optimsimplex(method='randbounds',x0=1:6,boundsmin=rep(0,6),
                          boundsmax=rep(10,6),fun=myfun)
  opt
  optimsimplex(method='spendley',x0=1:6,fun=myfun,len=10)
  optimsimplex(method='oriented',simplex=opt$newobj,fun=myfun)