Description Usage Arguments Details Value Author(s) See Also Examples
This function checks the time consumed by running the grid search algorithm with a zoom as well as some other conditions.
1 2 |
FUN |
the target function to be minimized. |
grid |
an object of the class GRID from |
MoreArgs |
a list of other arguments to |
zoom |
number of (additional) rounds or layers of the zoom-in, 0 by default. |
decay |
a number in between 0 and 1 representing the decay rate of the grid sizes of the zoom. |
num |
number of points to return, i.e. the smallest |
parallel |
a boolean indicating if the parallel computation is carried out, by default |
cores |
The number of cores to use, i.e. at most how many child processes will be run simultaneously. For details, see |
silent |
a boolean indicating if the information regarding the computation is printed. |
The running of this function takes only several seconds.
So it is recommended to run this function before grid_search
to check the approximate time consumed
by grid_search
by using exactly the same arguments.
This function is extremely useful when the user is going to run grid_search
on some super-computing server
and need to know approximately how long time it will take in order to specify the corresponding settings
according to some batch system like SLURM for example.
The boolean silent
controls if there will be output in the console.
For details, see grid_search
.
a number of the time in seconds.
Yukai Yang, yukai.yang@statistik.uu.se
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 | # Rastrigin function
ndim = 2 # number of dimension
nA = 10 # parameter A
# vx in [-5.12, 5.12]
# minimizer = rep(0, ndim)
# minimum = 0
Rastrigin <- function(vx) return(nA * ndim + sum(vx*vx - nA * cos(2*pi*vx)))
# a toy example
# build the grid first
bin = c(from=-5.12, to=5.12, by=.5)
grid = build_grid(bin,bin)
# so this is a relatively sparse grid
# serial computation
ret0 = grid_search(Rastrigin, grid, silent=FALSE)
ret0$par
# If we expand the grid to allow for more points
bin = c(from=-5.12, to=5.12, by=.1)
grid = build_grid(bin,bin)
# run the check before the grid search
ret1 = grid_search_check(Rastrigin, grid, silent=FALSE)
ret1 = grid_search(Rastrigin, grid, silent=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.