# Neldermead Object Configuration

### Description

Configure the current neldermead object with the given value for the given key.

### Usage

1 | ```
neldermead.set(this = NULL, key = NULL, value = NULL)
``` |

### Arguments

`this` |
The current neldermead object. |

`key` |
The key to configure. See details for the list of possible keys. |

`value` |
The value to assign to the key. |

### Details

`neldermead.set`

sets the content of the `key`

element of
the neldermead object `this`

to `value`

. If `key`

is a
sub-element of `this$optbase`

, `value`

is assigned by
`optimbase.set`

.

The main available keys are the following:

- '-verbose'
Set to 1 to enable verbose logging.

- '-verbosetermination'
Set to 1 to enable verbose termination logging.

- '-x0'
The initial guess, as a n x 1 column vector, where n is the number of variables.

- '-maxfunevals'
The maximum number of function evaluations. If this criteria is triggered during optimization, the status of the optimization is set to 'maxfuneval'.

- '-maxiter'
The maximum number of iterations. If this criteria is triggered during optimization, the status of the optimization is set to 'maxiter'.

option

- '-tolfunabsolute'
The absolute tolerance for the function value.

- '-tolfunrelative'
The relative tolerance for the function value.

- '-tolfunmethod'
The method used for the tolerance on function value in the termination criteria. The following values are available: TRUE, FALSE. If this criteria is triggered, the status of the optimization is set to 'tolf'.

- '-tolxabsolute'
The absolute tolerance on x.

- '-tolxrelative'
The relative tolerance on x.

- '-tolxmethod'
The method used for the tolerance on x in the termination criteria. The following values are available: TRUE, FALSE. If this criteria is triggered during optimization, the status of the optimization is set to 'tolx'.

- '-function'
The objective function, which computes the value of the cost and the non linear constraints, if any. See

`vignette('neldermead',package='neldermead')`

for the details of the communication between the optimization system and the cost function.- '-costfargument'
An additionnal argument, passed to the cost function.

- '-outputcommand'
A command which is called back for output. See

`vignette('neldermead',package='neldermead')`

for the details of the communication between the optimization system and the output command function.- '-outputcommandarg'
An additionnal argument, passed to the output command.

option

- '-numberofvariables'
The number of variables to optimize.

- '-storehistory'
Set to TRUE to enable the history storing.

- '-boundsmin'
The minimum bounds for the parameters.

- '-boundsmax'
The maximum bounds for the parameters.

- '-nbineqconst'
The number of inequality constraints.

- '-method'
The name of the algorithm to use. The following methods are available:

- 'fixed'
the fixed simplex shape algorithm of Spendley et al. This algorithm is for unconstrained problems (i.e. bounds and non linear constraints are not taken into account)

- 'variable'
the variable simplex shape algorithm of Nelder and Mead. This algorithm is for unconstrained problems (i.e. bounds and non linear constraints are not taken into account)

- 'box'
Box's complex algorithm. This algorithm takes into account bounds and nonlinear inequality constraints.

- 'mine'
the user-defined algorithm, associated with the

`mymethod`

element. See`vignette('neldermead',package='neldermead')`

for details.

- '-simplex0method'
The method to use to compute the initial simplex. The first vertex in the simplex is always the initial guess associated with the

`x0`

element. The following methods are available:- 'given'
The coordinates associated with the

`coords0`

element are used to compute the initial simplex, with arbitrary number of vertices. This allows the user to setup the initial simplex by a specific method which is not provided by the current package (for example with a simplex computed from a design of experiments). This allows also to configure the initial simplex so that a specific behaviour of the algorithm is to be reproduced (for example the Mac Kinnon test case). The given matrix is expected to have nbve rows and n columns, where n is the dimension of the problem and nbve is the number of vertices.- 'axes'
The simplex is computed from the coordinate axes and the length associated with the

`simplex0length`

element.- 'spendley'
The simplex is computed so that it is regular with the length associated with the

`simplex0length`

element (i.e. all the edges have the same length).- 'pfeffer'
The simplex is computed from an heuristic, in the neighborhood of the initial guess. This initial simplex depends on the -simplex0deltausual and -simplex0deltazero.

- 'randbounds'
The simplex is computed from the bounds and a random number. This option is available only if bounds are available: if bounds are not available, an error is generated. This method is usually associated with Box's algorithm. The number of vertices in the simplex is taken from the

`boxnbpoints`

element.

- '-coords0'
The coordinates of the vertices of the initial simplex. If the

`simplex0method`

element is set to 'given', these coordinates are used to compute the initial simplex. This matrix is expected to have shape nbve x n, where nbve is the number of vertices and n is the number of variables.- '-simplex0length'
The length to use when the initial simplex is computed with the 'axes' or 'spendley' methods. If the initial simplex is computed from 'spendley' method, the length is expected to be a scalar value. If the initial simplex is computed from 'axes' method, it may be either a scalar value or a vector of values, of length n, where n is the number of variables.

- '-simplex0deltausual'
The relative delta for non-zero parameters in 'pfeffer' method.

- '-simplex0deltazero'
The absolute delta for non-zero parameters in 'pfeffer' method.

- '-rho'
The reflection coefficient. This parameter is used when the

`method`

element is set to 'fixed' or 'variable'.- '-chi'
The expansion coefficient. This parameter is used when the

`method`

element is set to 'variable'.- '-gamma'
The contraction coefficient. This parameter is used when the

`method`

element is set to 'variable'.- '-sigma'
The shrinkage coefficient. This parameter is used when the

`method`

element is set to 'fixed' or 'variable'.- '-tolsimplexizemethod'
Set to FALSE to disable the tolerance on the simplex size. If this criteria is triggered, the status of the optimization is set to 'tolsize'. When this criteria is enabled, the values of the

`tolsimplexizeabsolute`

and`tolsimplexizerelative`

elements are used in the termination criteria. The method to compute the size is the 'sigmaplus' method.- '-tolsimplexizeabsolute'
The absolute tolerance on the simplex size.

- '-tolsimplexizerelative'
The relative tolerance on the simplex size.

- '-tolssizedeltafvmethod'
Set to TRUE to enable the termination criteria based on the size of the simplex and the difference of function value in the simplex. If this criteria is triggered, the status of the optimization is set to 'tolsizedeltafv'. This termination criteria uses the values of the

`tolsimplexizeabsolute`

and`toldeltafv`

elements.

option

- '-toldeltafv'
The absolute tolerance on the difference between the highest and the lowest function values.

- '-tolvarianceflag'
Set to TRUE to enable the termination criteria based on the variance of the function value. If this criteria is triggered, the status of the optimization is set to 'tolvariance'. This criteria is suggested by Nelder and Mead.

- '-tolabsolutevariance'
The absolute tolerance on the variance of the function values of the simplex.

- '-tolrelativevariance'
The relative tolerance on the variance of the function values of the simplex.

- '-kelleystagnationflag'
Set to TRUE to enable the termination criteria using Kelley's stagnation detection, based on sufficient decrease condition. If this criteria is triggered, the status of the optimization is set to 'kelleystagnation'.

- '-kelleynormalizationflag'
Set to FALSE to disable the normalization of the alpha coefficient in Kelley's stagnation detection, i.e. use the value of the

`kelleystagnationalpha0`

element as is. Default value is TRUE, i.e. the simplex gradient of the initial simplex is takeoptionn into account in the stagnation detection.- '-kelleystagnationalpha0'
The parameter used in Kelley's stagnation detection.

- '-restartflag'
Set to TRUE to enable the automatic restart of the algorithm.

- '-restartdetection'
The method to detect if the automatic restart must be performed. The following methods are available:

- 'oneill'
The factorial local optimality test by O'Neill is used. If the test finds a local point which is better than the computed optimum, a restart is performed.

- 'kelley'
The sufficient decrease condition by O'Neill is used. If the test finds that the status of the optimization is 'kelleystagnation', a restart is performed. This status may be generated if the -kelleystagnationflag option is set to TRUE.

- '-restartmax'
The maximum number of restarts, when automatic restart is enabled via the -restartflag option.

- '-restarteps'
The absolute epsilon value used to check for optimality in the factorial O'Neill restart detection.

- '-restartstep'
The absolute step length used to check for optimality in the factorial O'Neill restart detection.

- '-restartsimplexmethod'
The method to compute the initial simplex after a restart. The following methods are available.

- 'given'
The coordinates associated with the

`coords0`

element are used to compute the initial simplex, with arbitrary number of vertices. This allow the user to setup the initial simplex by a specific method which is not provided by the current package (for example with a simplex computed from a design of experiments). This allows also to configure the initial simplex so that a specific behaviour of the algorithm is to be reproduced (for example the Mc Kinnon test case). The given matrix is expected to have nbve rows and n columns, where n is the dimension of the problem and nbve is the number of vertices.- 'axes'
The simplex is computed from the coordinate axes and the length associated with the -simplex0length option.

- 'spendley'
The simplex is computed so that it is regular with the length associated with the -simplex0length option (i.e. all the edges have the same length).

- 'pfeffer'
The simplex is computed from an heuristic, in the neighborhood of the initial guess. This initial simplex depends on the -simplex0deltausual and -simplex0deltazero.

- 'randbounds'
The simplex is computed from the bounds and a random number. This option is available only if bounds are available: if bounds are not available, an error is generated. This method is usually associated with Box's algorithm. The number of vertices in the simplex is taken from the -boxnbpoints option.

- 'oriented'
The simplex is computed so that it is oriented, as suggested by Kelley.

- '-scalingsimplex0'
The algorithm used to scale the initial simplex into the nonlinear constraints. The following two algorithms are provided:

- 'tox0'
scales the vertices toward the initial guess.

- 'tocentroid'
scales the vertices toward the centroid, as recommended by Box.

If the centroid happens to be unfeasible, because the constraints are not convex, the scaling of the initial simplex toward the centroid may fail. Since the initial guess is always feasible, scaling toward the initial guess cannot fail.

- '-boxnbpoints'
The number of points in the initial simplex, when the -simplex0method is set to 'randbounds'. The value of this option is also use to update the simplex when a restart is performed and the -restartsimplexmethod option is set to 'randbounds'. The default value is so that the number of points is twice the number of variables of the problem.

- '-boxineqscaling'
The scaling coefficient used to scale the trial point for function improvement or into the constraints of Box's algorithm.

- '-guinalphamin'
The minimum value of alpha when scaling the vertices of the simplex into nonlinear constraints in Box's algorithm.

- '-boxreflect'
The reflection factor in Box's algorithm.

- '-boxtermination'
Set to TRUE to enable Box's termination criteria.

- '-boxtolf'
The absolute tolerance on difference of function values in the simplex, suggested by Box. This tolerance is used if the -

`boxtermination`

element is set to TRUE.- '-boxnbmatch'
The number of consecutive match of Box's termination criteria.

- '-boxboundsalpha'
The parameter used to project the vertices into the bounds in Box's algorithm.

- '-mymethod'
A user-derined simplex algorithm. See

`vignette('neldermead',package='neldermead')`

for details.- '-myterminate'
A user-defined terminate function. See

`vignette('neldermead',package='neldermead')`

for details.- '-myterminateflag'
Set to TRUE to enable the user-defined terminate function.

### Value

An updated neldermead object.

### Author(s)

Author of Scilab neldermead module: Michael Baudin (INRIA - Digiteo)

Author of R adaptation: Sebastien Bihorel (sb.pmlab@gmail.com)

### See Also

`neldermead`