The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
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[@]metanet.ch.
Package website: release | dev
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.
There are several sections about black-box optimization in the mlr3book. Often the sections about tuning are also relevant for general black-box optimization.
bb_optimize
function.Install the latest release from CRAN.
install.packages("bbotk")
Install the development version from GitHub.
::pkg_install("mlr-org/bbotk") pak
# define the objective function
= function(xs) {
fun - (xs[[1]] - 2)^2 - (xs[[2]] + 3)^2 + 10
}
# set domain
= ps(
domain x1 = p_dbl(-10, 10),
x2 = p_dbl(-5, 5)
)
# set codomain
= ps(
codomain y = p_dbl(tags = "maximize")
)
# create objective
= ObjectiveRFun$new(
objective fun = fun,
domain = domain,
codomain = codomain,
properties = "deterministic"
)
# initialize instance
= oi(
instance objective = objective,
terminator = trm("evals", n_evals = 20)
)
# load optimizer
= opt("gensa")
optimizer
# trigger optimization
$optimize(instance) optimizer
## x1 x2 x_domain y
## 1: 2 -3 <list[2]> 10
# best performing configuration
$result instance
## 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 2024-08-13 17:52:54 1 -4.689827 -1.278761
## 2: -5.930364 -4.400474 -54.851999 2024-08-13 17:52:54 2 -5.930364 -4.400474
## 3: 7.170817 -1.519948 -18.927907 2024-08-13 17:52:54 3 7.170817 -1.519948
## 4: 2.045200 -1.519948 7.807403 2024-08-13 17:52:54 4 2.045200 -1.519948
## 5: 2.045200 -2.064742 9.123250 2024-08-13 17:52:54 5 2.045200 -2.064742
## ---
## 16: 2.000000 -3.000000 10.000000 2024-08-13 17:52:54 16 2.000000 -3.000000
## 17: 2.000001 -3.000000 10.000000 2024-08-13 17:52:54 17 2.000001 -3.000000
## 18: 1.999999 -3.000000 10.000000 2024-08-13 17:52:54 18 1.999999 -3.000000
## 19: 2.000000 -2.999999 10.000000 2024-08-13 17:52:54 19 2.000000 -2.999999
## 20: 2.000000 -3.000001 10.000000 2024-08-13 17:52:54 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.