Learn R Programming

⚠️There's a newer version (1.5.0) of this package.Take me there.

bbotk - Black-Box Optimization Toolkit

Package website: release

This package provides a common framework for optimization including

  • Optimizer: Objects of this class allow you to optimize an object of the class OptimInstance.
  • OptimInstance: Defines the optimization problem, consisting of an Objective, the search_space and a Terminator. All evaluations on the OptimInstance will be automatically stored in its own Archive.
  • Objective: Objects of this class contain the objective function. The class ensures that the objective function is called in the right way and defines, whether the function should be minimized or maximized.
  • Terminator: Objects of this class control the termination of the optimization independent of the optimizer.

Various optimization methods are already implemented e.g. grid search, random search and generalized simulated annealing.

Installation

CRAN version

install.packages("bbotk")

Development version

remotes::install_github("mlr-org/bbotk")

Example

library(bbotk)
library(paradox)

# Define objective function
fun = function(xs) {
  - (xs[[1]] - 2)^2 - (xs[[2]] + 3)^2 + 10
}

# Set domain
domain = ParamSet$new(list(
  ParamDbl$new("x1", -10, 10), 
  ParamDbl$new("x2", -5, 5)
))

# Set codomain
codomain = ParamSet$new(list(
  ParamDbl$new("y", tags = "maximize")
))

# Create Objective object
obfun = ObjectiveRFun$new(
  fun = fun,
  domain = domain,
  codomain = codomain, 
  properties = "deterministic"
)

# Define termination criterion
terminator = trm("evals", n_evals = 20)

# Create optimization instance
instance = OptimInstanceSingleCrit$new(
  objective = obfun, 
  terminator = terminator
)

# Load optimizer
optimizer = opt("gensa")

# Trigger optimization
optimizer$optimize(instance)

# View results
instance$result

Copy Link

Version

Install

install.packages('bbotk')

Monthly Downloads

5,373

Version

0.2.0

License

LGPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Marc Becker

Last Published

July 24th, 2020

Functions in bbotk (0.2.0)

Optimizer

Optimizer
Archive

Logging object for objective function evaluations
OptimInstanceSingleCrit

Optimization Instance with budget and archive
ObjectiveRFunDt

Objective interface for basic R functions.
Terminator

Abstract Terminator Class
OptimInstance

Optimization Instance with budget and archive
Objective

Objective function with domain and co-domain
OptimInstanceMultiCrit

Optimization Instance with budget and archive
mlr_optimizers_grid_search

Optimization via Grid Search
mlr_optimizers

Dictionary of Optimizer
mlr_optimizers_design_points

Optimization via Design Points
mlr_terminators_none

Terminator that never stops.
ObjectiveRFun

Objective interface with custom R function
OptimizerNLoptr

Optimization via Non-linear Optimization
is_dominated

Calculate which points are dominated
trm

Syntactic Sugar Terminator Construction
mlr_terminators_stagnation_batch

Terminator that stops when optimization does not improve
mlr_terminators_perf_reached

Terminator that stops when a performance level has been reached
mlr_optimizers_gensa

Optimization via Generalized Simulated Annealing
bbotk_assertions

Assertion for bbotk objects
bbotk-package

bbotk: Black-Box Optimization Toolkit
mlr_terminators_combo

Combine Terminators
mlr_terminators_evals

Terminator that stops after a number of evaluations
mlr_terminators_run_time

Terminator that stops according to the run time
mlr_optimizers_random_search

Optimization via Random Search
assign_result_default

Default assign_result function
mlr_terminators

Dictionary of Terminators
opt

Syntactic Sugar Optimizer Construction
mlr_terminators_clock_time

Terminator that stops according to the clock time
mlr_terminators_stagnation

Terminator that stops when optimization does not improve
bbotk_reflections

Reflections for bbotk
transform_xdt_to_xss

Calculates the transformed x-values
optimize_default

Default optimization function