bboptim {blackbox} | R Documentation |

## Black-box function optimization

### Description

`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.

### Usage

```
bboptim(data, ParameterNames = NULL, respName = NULL, control = list(),
force = FALSE, optimizers = blackbox.getOption("optimizers"), precision=1e-03)
rbb(object,n=NULL,from=NULL,focus=0.75)
```

### Arguments

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

`ParameterNames` |
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. |

`respName` |
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. |

`control` |
A list passed to the |

`force` |
Boolean, passed to |

`optimizers` |
(A vector of) character strings, from which the optimization methods are selected. Default are that of |

`object` |
An object of class |

`n` |
Number of distinct points to be returned. n+1 points will be returned (see Details). If |

`from` |
A larger (>2n) number of points from which |

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

`precision` |
target value of prediction variance in inferred optimum. |

### Details

`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)`

.

### Value

`bboptim`

returns an object of class `bboptim`

, a list which includes

`optr` |
the result of the |

`RMSE` |
the root meant square prediction error of response at the optimum |

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

`fit` |
the predictor of the response (an |

`conv_crits` |
Indicators of convergence (see Details) |

and some other elements.

`rbb`

returns a data frame.

### References

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.

### Examples

```
# 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)
}
set.seed(123)
# 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)
print(bbresu)
# refine with additional points
if (blackbox.getOption("example_maxtime")>4) {
while ( any( ! bbresu$conv_crits) ) {
print(unlist(bbresu$optr[c("par","value")]))
candidates <- rbb(bbresu)
newsimuls <- cbind(candidates,bb=apply(candidates,1,"fr",sd=0))
bbresu <- bboptim(rbind(bbresu$fit$data,newsimuls))
}
print(bbresu)
}
#### With noise
if (blackbox.getOption("example_maxtime")>78) {
set.seed(123)
simuls <- cbind(parsp,bb=apply(parsp,1,"fr",sd=0.1))
bbresu <- bboptim(simuls, precision=0.02)
while ( any( ! bbresu$conv_crits) ) {
print(unlist(bbresu$optr[c("par","value")]))
candidates <- rbb(bbresu)
newsimuls <- cbind(candidates,bb=apply(candidates,1,"fr",sd=0.1))
bbresu <- bboptim(rbind(bbresu$fit$data,newsimuls), precision=0.02)
}
print(bbresu)
}
# basic plot
## Not run:
require(spaMM)
opt <- bbresu$optr$par
mapMM(bbresu$fit, decorations=points(opt[1],opt[2],cex=2,pch="+"))
## End(Not run)
```

*blackbox*version 1.1.46 Index]