Description Usage Arguments Value Note Examples

`estimateGradient`

approximates the gradient of a single-objective function
`fn`

in position `x`

based on small changes in one direction per
dimension of `x`

.

*\nabla f(\mathbf{x}) = \frac{f(\mathbf{x} + \boldsymbol{\varepsilon}) - f(\mathbf{x})}{||\boldsymbol{\varepsilon}||}*

The gradient approximation is performed separately for each dimension of the search space.
That is, the i-th element of the gradient results from a slight step (step size: `prec.grad`

)
of the i-th element of `x`

, while all remaining elements of `x`

are not altered.

In contrast to the aforementioned function, `estimateGradientBothDirections`

performs a small step in both directions (of the i-th element) of `x`

.

*\nabla f(\mathbf{x}) = \frac{f(\mathbf{x} + \boldsymbol{\varepsilon}) - f(\mathbf{x} - \boldsymbol{\varepsilon})}{2 \cdot ||\boldsymbol{\varepsilon}||}*

1 2 3 4 5 | ```
estimateGradientSingleDirection(fn, ind, side = NULL,
prec.grad = 1e-06, check.data = TRUE, lower, upper, ...)
estimateGradientBothDirections(fn, ind, prec.grad = 1e-04,
check.data = TRUE, lower, upper, ...)
``` |

`fn` |
[ |

`ind` |
[ |

`side` |
[ |

`prec.grad` |
[ |

`check.data` |
[ |

`lower` |
[ |

`upper` |
[ |

`...` |
Further arguments to be passed to |

[`numeric(d)`

]

This function basically is a slightly modified version of
`numDeriv::grad(..., method = "simple")`

and was mainly developed for
internal usage to have a speed up over the aforementioned version. However,
this speed up will only have an effect, if you call this function very
frequently and if you turn off the sanity checks.

ATTENTION: Only turn off the sanity checks (`check.data = FALSE`

),
if you can ensure that all input parameters are provided in the correct format.

1 2 3 4 | ```
fn = function(x) sum(x^2)
estimateGradientSingleDirection(fn, c(0.3, 0.5))
estimateGradientSingleDirection(fn, c(0.3, 0.5), side = rep(FALSE, 2L))
estimateGradientBothDirections(fn, c(0.3, 0.5))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.