Description Usage Arguments Value Note Author(s) References Examples
Just demo functions that can be optimized for testing purposes.
1 2 3 4 5 | sample_function (param_vec, maxwaittime = 0)
sample_function2 (param_vec, maxwaittime = 0)
ackley_function (param_vec, maxwaittime = 0)
griewank_function (param_vec, maxwaittime = 0)
rastrigin_function(param_vec, maxwaittime = 0)
|
param_vec |
parameter vector |
maxwaittime |
when not set, the function is evaluated at maximum speed, otherwise a random delay of up to maxwaittime is introduced. Useful for simulating heterogenous clusters. |
Function value as defined by the respective function.
Minimum values: sample_function: -2*dimensions sample_function2: -5 Ackley: -20-e Griewank: 0 Rastrigin: -dimensions
Till Francke
Ackley, D. H. (1987) A Connectionist Machine for Genetic Hillclimbing, Kluwer, Norwell, MA.
Griewank, A. O. (1981) Generalized descent for global optimization, Journal of Optimization Theory and Applications, 34, 11-39.
Rastrigin, L. A. (1974) Systems of Extremal Control, Nauka, Moscow. in Russian.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ##sample_function is currently defined as
sample_function <-
function(param_vec,maxwaittime=0) #objective function to be minimized
{
obj=0
for (i in 1:NROW(param_vec))
obj=obj+(cos(param_vec[i])+1)
obj=-abs(obj)
# r <- sqrt((param_vec[1]*4)^2+(param_vec[2]*4)^2)
# obj=-5 * sin(r)/r
# if (runif(1,0,1)>0.95)
# {
# cat("error in objective function simulated by slave ",mpi.comm.rank(), file=paste("slave",mpi.comm.rank(),".log",sep=""))
# error("error in objective function simulated by slave ",mpi.comm.rank())
# }
if (maxwaittime>0) #function to be run on slaves, with random delay
{
starttime=Sys.time()
waittime= runif(1,0,maxwaittime)
while (as.numeric(Sys.time()-starttime)<waittime)
{
}
}
return(obj)
}
## sample_function2 is currently defined as
sample_function2 <-
function(param_vec,maxwaittime=0) #objective function to be minimized
{
r <- max(1e-320,sqrt((param_vec[1]*4)^2+(param_vec[2]*4)^2))
obj=-5 * sin(r)/r
if (maxwaittime>0) #function to be run on slaves, with random delay
{
starttime=Sys.time()
waittime= runif(1,0,maxwaittime)
while (as.numeric(Sys.time()-starttime)<waittime)
{
}
}
return(obj)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.