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.
miesmuschel
provides evolutionary black box optimization
algorithms, building on the bbotk
package.
miesmuschel
offers both ready-to-use optimization
algorithms, as well as their fundamental building blocks that can be
used to manually construct specialized optimization loops.
(also giving a hint on how to pronounce
“miesmuschel
”)
The R software package miesmuschel
Offers opt-algorithms, so crucial
bbotk
is its base,
it’s a powerful tool
For optimization, it’s truly no fool
Ready-made or D-I-Y, the choice is yours
With miesmuschel
, your options are wide open doors
So when you do optimize, just give it a try
With miesmuschel
, surely, success is nigh!
Although miesmuschel
is currently still evolving, it can
already be used for optimization. All exported functions are thoroughly
documented.
Install the github version, using remotes
:
::install_github("mlr-org/miesmuschel") remotes
library("bbotk")
library("paradox")
::threshold("warn")
lgr
<- ObjectiveRFun$new(
objective fun = function(xs) {
<- exp(-xs$x^2 - xs$y^2) + 2 * exp(-(2 - xs$x)^2 - (2 - xs$y)^2)
z list(Obj = z)
},domain = ps(x = p_dbl(-2, 4), y = p_dbl(-2, 4)),
codomain = ps(Obj = p_dbl(tags = "maximize"))
)
bbotk::Optimizer
ObjectThis is the recommended way of using miesmuschel
.
# Get a new OptimInstance
<- OptimInstanceSingleCrit$new(objective,
oi terminator = trm("evals", n_evals = 100)
)
library("miesmuschel")
# Get operators
<- mut("gauss", sdev = 0.1)
op.m <- rec("xounif", p = .3)
op.r <- sel("random")
op.parent <- sel("best")
op.survival
# Create OptimizerMies object
<- opt("mies", mutator = op.m, recombinator = op.r,
mies parent_selector = op.parent, survival_selector = op.survival,
mu = 3, lambda = 2)
# mies$optimize performs MIES optimization and returns the optimum
$optimize(oi)
mies#> x y x_domain Obj
#> 1: 1.935055 1.973867 <list[2]> 1.990703
mies_*
Functions DirectlyThis gives more flexibility when designing ES algorithms, but it is also more verbose and error-prone.
# Get a new OptimInstance
<- OptimInstanceSingleCrit$new(objective,
oi terminator = trm("evals", n_evals = 100)
)
library("miesmuschel")
# Get operators
<- mut("gauss", sdev = 0.1)
op.m <- rec("xounif", p = .3)
op.r <- sel("random")
op.parent <- sel("best")
op.survival
# Prime operators
mies_prime_operators(list(op.m), list(op.r), list(op.parent, op.survival),
search_space = oi$search_space)
# Sample first generation
mies_init_population(oi, 3)
# This is the first generation
$archive$data[, .(x, y, Obj, dob, eol)]
oi#> x y Obj dob eol
#> 1: 3.8516312 1.2386550 0.03633278 1 NA
#> 2: -1.6478480 -0.9080712 0.02901343 1 NA
#> 3: -0.4215587 0.8250017 0.42529339 1 NA
# Select parents, recombine, mutate
<- mies_generate_offspring(oi, 2, op.parent, op.m, op.r)
offspring
# This is the first offspring population
offspring#> x y
#> 1: 2.762783 -0.24885684
#> 2: -1.439780 -0.05699817
# Evaluate offspring (and append to oi archive)
mies_evaluate_offspring(oi, offspring)
# State of the archive now: Second generation has `dob` == 2
$archive$data[, .(x, y, Obj, dob, eol)]
oi#> x y Obj dob eol
#> 1: 3.8516312 1.23865501 0.036332776 1 NA
#> 2: -1.6478480 -0.90807120 0.029013430 1 NA
#> 3: -0.4215587 0.82500173 0.425293387 1 NA
#> 4: 2.7627829 -0.24885684 0.007566604 2 NA
#> 5: -1.4397798 -0.05699817 0.125404228 2 NA
# Selecto for survival
mies_survival_plus(oi, 3, op.survival)
# Survivors have `eol` NA, two individuals 'died' in generation 2
$archive$data[, .(x, y, Obj, dob, eol)]
oi#> x y Obj dob eol
#> 1: 3.8516312 1.23865501 0.036332776 1 NA
#> 2: -1.6478480 -0.90807120 0.029013430 1 2
#> 3: -0.4215587 0.82500173 0.425293387 1 NA
#> 4: 2.7627829 -0.24885684 0.007566604 2 2
#> 5: -1.4397798 -0.05699817 0.125404228 2 NA
# Perform MIES loop until terminated. This gives an expected `terminated` error
repeat {
<- mies_generate_offspring(oi, 2, op.parent, op.m, op.r)
offspring mies_evaluate_offspring(oi, offspring)
mies_survival_plus(oi, 3, op.survival)
}
# Best result:
$archive$data[which.max(Obj)]
oi#> x y dob eol Obj x_domain timestamp batch_nr
#> 1: 2.021887 2.164051 46 NA 1.946115 <list[2]> 2021-02-15 01:56:23 46
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.