The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

bbotk - Black-Box Optimization Toolkit

Package website: release | dev

r-cmd-check CRAN Status Badge Mattermost

bbotk is a black-box optimization framework for R. It features highly configurable search spaces via the paradox package and optimizes every user-defined objective function. The package includes several optimization algorithms e.g. Random Search, Grid Search, Iterated Racing, Bayesian Optimization (in mlr3mbo) and Hyperband (in mlr3hyperband). bbotk is the base package of mlr3tuning, mlr3fselect and miesmuschel.

Resources

There are several sections about black-box optimization in the mlr3book. Often the sections about tuning are also relevant for general black-box optimization.

Installation

Install the latest release from CRAN.

install.packages("bbotk")

Install the development version from GitHub.

pak::pkg_install("mlr-org/bbotk")

Example

# define the objective function
fun = function(xs) {
  list(y = - (xs[[1]] - 2)^2 - (xs[[2]] + 3)^2 + 10)
}

# set domain
domain = ps(
  x1 = p_dbl(-10, 10),
  x2 = p_dbl(-5, 5)
)

# set codomain
codomain = ps(
  y = p_dbl(tags = "maximize")
)

# create objective
objective = ObjectiveRFun$new(
  fun = fun,
  domain = domain,
  codomain = codomain,
  properties = "deterministic"
)

# initialize instance
instance = oi(
  objective = objective,
  terminator = trm("evals", n_evals = 20)
)

# load optimizer
optimizer = opt("gensa")

# trigger optimization
optimizer$optimize(instance)
##    x1 x2  x_domain  y
## 1:  2 -3 <list[2]> 10
# best performing configuration
instance$result
##    x1 x2  x_domain  y
## 1:  2 -3 <list[2]> 10
# all evaluated configuration
as.data.table(instance$archive)
##            x1        x2          y           timestamp batch_nr x_domain_x1 x_domain_x2
##  1: -4.689827 -1.278761 -37.716445 2025-10-24 11:01:00        1   -4.689827   -1.278761
##  2: -5.930364 -4.400474 -54.851999 2025-10-24 11:01:00        2   -5.930364   -4.400474
##  3:  7.170817 -1.519948 -18.927907 2025-10-24 11:01:00        3    7.170817   -1.519948
##  4:  2.045200 -1.519948   7.807403 2025-10-24 11:01:00        4    2.045200   -1.519948
##  5:  2.045200 -2.064742   9.123250 2025-10-24 11:01:00        5    2.045200   -2.064742
## ---                                                                                    
## 16:  2.000000 -3.000000  10.000000 2025-10-24 11:01:00       16    2.000000   -3.000000
## 17:  2.000001 -3.000000  10.000000 2025-10-24 11:01:00       17    2.000001   -3.000000
## 18:  1.999999 -3.000000  10.000000 2025-10-24 11:01:00       18    1.999999   -3.000000
## 19:  2.000000 -2.999999  10.000000 2025-10-24 11:01:00       19    2.000000   -2.999999
## 20:  2.000000 -3.000001  10.000000 2025-10-24 11:01:00       20    2.000000   -3.000001

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.