bboptim {blackbox}R Documentation

Black-box function optimization


bboptim implements optimization of a black-box function, possibly estimated with error, using prediction of the function by smoothing of its values in a given set of points, followed by a call to optim for optimization of the predicted function. rbb samples the parameter space of the function using a crude implementation of Expected Improvement (e.g. Bingham et al., 2014) methods: points with the highest predicted probability of improvement of the response value among a set of candidates sampled uniformly are retained.


bboptim(data, ParameterNames = NULL, respName = NULL, control = list(),
        force = FALSE, optimizers = blackbox.getOption("optimizers"), precision=1e-03)



A data frame including both function parameters and function values (or “response” values).


A character vector, identifying the columns of the data that correspond to the function parameters. If NULL, all columns except the last are assumed to hold parameter values.


A character string, identifying the column of the data that corresponds to the function values. If NULL, the last column is assumed to hold function values.


A list passed to the control argument of the optim function; e.g., list(fnscale=-1) for maximization.


Boolean, passed to calcGCV. TRUE forces the analysis of data without pairs of response values for given parameter values. This is not recommended as there should be such pairs. If the response is estimated with error, this is required for good smoothing. If it is deterministic, bboptim will learn it from the information provided by the pairs.


(A vector of) character strings, from which the optimization methods are selected. Default are that of calcGCV for the smoothing step, and nloptr with its own "NLOPT_LN_BOBYQA" method for the smoothed function maximization. See the source of the function for other possible methods (the latter being subject to change with little notice).


An object of class bboptim


Number of distinct points to be returned. n+1 points will be returned (see Details). If NULL, the following default value is used: min(2^(np+1),floor(10*(1+3*log(np)))), where np is the number of function parameters.


A larger (>2n) number of points from which n are selected by an expected inmprovement criterion. If NULL, a default value computed as n*floor(10*(1+3*log(np))), where np is the number of function parameters, is used.


A number between 0 and 1. Determines the proportion of points that are sampled closer to the currently inferred maximum (see Details).


target value of prediction variance in inferred optimum.


rbb selects a proportion 1-focus of the returned points according to expected improvement, from points sampled uniformly in a space defined by a tesselation of the fitted object's parameter points. They are completed to n-1 points, by points similarly selected but within a space defined by a selection of fitted points with the best predicted response values. Finally, two replicates of the predicted optimum (the optim $par result contained in the object) are included. A total of n+1 points (n distinct) is thus returned.

Global optimization cannot be proven, but it is tested by the following criteria: (1) the predicted optimum is close enough to the optimum among assessed parameter points (i.e. either the optimum parameters are well approached or the function is flat in some way), and (2) the prediction variance at the inferred optimum is low enough (so that the predictions used in the first criterion can be trusted). Accordingly, conv_crits has elements (1) objective that indicates whether optr$value betters optr_fitted$value by more than control$reltol, if given, or else by more than sqrt(.Machine$double.eps); and (2) precision that indicates whether variance of prediction error at the inferred optimum is lower than the target precision. This variance is computed as described for predict.HLfit, with variances=list(linPred=TRUE,dispVar=TRUE).


bboptim returns an object of class bboptim, a list which includes


the result of the optim call


the root meant square prediction error of response at the optimum optr$par


the best of the fitted points, with its fitted response value and prediction RMSE


the predictor of the response (an HLfit object as returned by corrHLfit, with a predict method, etc.)


Indicators of convergence (see Details)

and some other elements.

rbb returns a data frame.


D. Bingham, P. Ranjan, and W.J. Welch (2014) Design of Computer Experiments for Optimization, Estimation of Function Contours, and Related Objectives, pp. 109-124 in Statistics in Action: A Canadian Outlook (J.F. Lawless, ed.). Chapman and Hall/CRC.


# Classical toy example with optional noise
fr <- function(v,sd) {   ## Rosenbrock Banana function 
  10 * (v["y"] - v["x"]^2)^2 + (1 - v["x"])^2 + rnorm(1,sd=sd)

# Initial parameter values, including duplicates. See ?init_grid.
parsp <- init_grid(lower=c(x=0,y=0),upper=c(x=2,y=2),nUnique=25)

#### Without noise
# add function values
simuls <- cbind(parsp,bb=apply(parsp,1,"fr",sd=0))

# optimization
bbresu <- bboptim(simuls)

# refine with additional points
if (blackbox.getOption("example_maxtime")>4) {
 while ( any( ! bbresu$conv_crits) ) {
  candidates <- rbb(bbresu)
  newsimuls <- cbind(candidates,bb=apply(candidates,1,"fr",sd=0))
  bbresu <- bboptim(rbind(bbresu$fit$data,newsimuls))

#### With noise

if (blackbox.getOption("example_maxtime")>78) {
 simuls <- cbind(parsp,bb=apply(parsp,1,"fr",sd=0.1))

 bbresu <- bboptim(simuls, precision=0.02)
 while ( any( ! bbresu$conv_crits) ) {
  candidates <- rbb(bbresu)
  newsimuls <- cbind(candidates,bb=apply(candidates,1,"fr",sd=0.1))
  bbresu <- bboptim(rbind(bbresu$fit$data,newsimuls), precision=0.02)

# basic plot
## Not run: 
opt <- bbresu$optr$par
mapMM(bbresu$fit, decorations=points(opt[1],opt[2],cex=2,pch="+"))

## End(Not run)

[Package blackbox version 1.1.43 Index]