This function conducts a random search on the given function with the support of parallelization and multiple termination criteria.
# S3 method for smoof_function
randomsearch(fun, design = NULL,
max.evals = 20, max.execbudget = NULL, target.fun.value = NULL,
design.y.cols = NULL, par.dir = NULL, par.jobs = NULL, ...)
# S3 method for function
randomsearch(fun, minimize = TRUE, lower, upper,
design = NULL, max.evals = 20, max.execbudget = NULL,
target.fun.value = NULL, design.y.cols = NULL, par.dir = NULL,
par.jobs = NULL, ...)
Fitness function to optimize.
Can be either a
smoof_function or a normal function that takes the numeric vector over that should be optimized as the first argument.
For one dimensional target functions you can obtain a
smoof_function by using
For multi dimensional functions use
It is possible to return even more information which will be stored in the optimization path.
To achieve this, simply append the attribute “extras” to the return value of the target function.
This has to be a named list of scalar values.
Each of these values will be stored additionally in the optimization path.
Additional arguments that will be passed to each call of
Initial design as data frame.
If the y-values are not already present in design, randomsearch will evaluate the points.
If the parameters have corresponding trafo functions, the design must not be transformed before it is passed!
Functions to generate designs are available in
NULL, which means no initial design.
Maximum number of evaulations of the objective functions.
Includes the initial design.
Exceution time budget in seconds.
Traget function value.
The name of the column containing the function outcomes.
One for single-crit optimization.
Multiple for multi-crit optimization.
Location to store parallel communication files.
tmpfile() which might not be suitable for parallelization methods that work on multiple machines.
Those need a shared directory.
How many parallel jobs do you want to run to evaluate the random search?
NULL which means 1 if no
parallelStart* function is called.
Otherwise it will detect the number through
Wheter the function should be minimized or maximized.
If this is a vector we will assume it is a multi-objective optimization.
Has to have the same length as the output of the objective function
Lower bounds on the variables.
Upper bounds on the variables.
Methods (by class)
obj.fun = makeSingleObjectiveFunction
fn = function
par.set = makeNumericParamSet
(id = "x"
, lower =
, upper = 1
, len = 2
res = randomsearch
, max.evals = 10
#> Randomsearch Result:
#> Eval no.: 9
#> x: x=-0.193,-0.873
#> y: -0.7288329