mies_init_population {miesmuschel} | R Documentation |
Initialize MIES Optimization
Description
Set up an OptimInstance
for MIES optimization.
This adds the dob
and eol
columns to the instance's archive, and makes sure there are at least mu
survivors
(i.e. entries with eol
set to NA
) present. If there are already >= mu
prior evaluations present, then the last
mu
of these remain alive (the other's eol
set to 0); otherwise, up to mu
new randomly sampled configurations
are evaluated and added to the archive and have eol
set to NA
.
Usage
mies_init_population(
inst,
mu,
initializer = generate_design_random,
survival_selector = SelectorBest$new()$prime(inst$search_space),
budget_id = NULL,
fidelity = NULL,
fidelity_new_individuals_only = FALSE,
fidelity_monotonic = TRUE,
additional_component_sampler = NULL
)
Arguments
inst |
(OptimInstance )
Optimization instance to evaluate.
|
mu |
(integer(1) )
Population target size, non-negative integer.
|
initializer |
(function )
Function that generates a Design object, with arguments param_set and n , functioning like paradox::generate_design_random
or paradox::generate_design_lhs . Note that paradox::generate_design_grid can not be used and must be wrapped with
a custom function that ensures that only n individuals are produced. The generated design must correspond to the inst 's $search_space ; for
components that are not in the objective's search space, the additional_component_sampler is used.
|
survival_selector |
(Selector )
Used when the given OptimInstance already contains more individuals than mu .
Selector operator that selects surviving individuals depending on configuration values
and objective results, When survival_selector$operate() is called, then objectives that
are being minimized are multiplied with -1 (through mies_get_fitnesses ), since Selector s always try to maximize fitness.
The Selector must be primed on inst$search_space ; this includes the "budget" component
when performing multi-fidelity optimization. Default is SelectorBest .
The given Selector may not return duplicates.
|
budget_id |
(character(1) | NULL )
Budget component when doing multi-fidelity optimization. This component of the search space is added
to individuals according to fidelity . Should be NULL when no multi-fidelity optimization is performed (default).
|
fidelity |
(atomic(1) | NULL )
Atomic scalar indicating the value to be assigned to the budget_id component of offspring.
This value must be NULL if no multi-fidelity optimization is performed (the default).
|
fidelity_new_individuals_only |
(logical(1) )
When fidelity is not NULL : Whether to re-evaluate individuals that are already present in inst should they have a smaller (if fidelity_monotonic is TRUE ) or different
(if fidelity_monotonic is FALSE ) value from the one given to fidelity . Default FALSE . Ignored when fidelity is NULL .
|
fidelity_monotonic |
(logical(1) )
Whether to only re-evaluate configurations for which the fidelity would increase. Default TRUE .
Ignored when fidelity is NULL or when fidelity_new_individuals_only is TRUE .
|
additional_component_sampler |
(Sampler | NULL )
Sampler for components of individuals that are not part of inst 's $search_space . These components
are never used for performance evaluation, but they may be useful for self-adaptive OperatorCombination s. See the description
of mies_prime_operators() on how operators need to be primed to respect additional components.
It is possible that additional_component_sampler is used for more rows than initializer , which happens
when the inst 's $archive contains prior evaluations that are alive, but does not contain columns pertaining to additional columns,
or contains all these columns but there are rows that are NA valued. If only some of the columns are present, or if all these columns
are present but there are rows that are only NA valued for some columns, then an error is thrown.
Default is NULL : no additional components.
|
Value
invisible OptimInstance
: the input
instance, modified by-reference.
See Also
Other mies building blocks:
mies_evaluate_offspring()
,
mies_generate_offspring()
,
mies_get_fitnesses()
,
mies_select_from_archive()
,
mies_step_fidelity()
,
mies_survival_comma()
,
mies_survival_plus()
Examples
library("bbotk")
lgr::threshold("warn")
# Define the objective to optimize
objective <- ObjectiveRFun$new(
fun = function(xs) {
z <- exp(-xs$x^2 - xs$y^2) + 2 * exp(-(2 - xs$x)^2 - (2 - xs$y)^2)
list(Obj = z)
},
domain = ps(x = p_dbl(-2, 4), y = p_dbl(-2, 4)),
codomain = ps(Obj = p_dbl(tags = "maximize"))
)
# Get a new OptimInstance
oi <- OptimInstanceSingleCrit$new(objective,
terminator = trm("evals", n_evals = 100)
)
mies_init_population(inst = oi, mu = 3)
# 3 evaluations, archive contains 'dob' and 'eol'
oi$archive
###
# Advanced demo, making use of additional components and fidelity
##
# Get a new OptimInstance
oi <- OptimInstanceSingleCrit$new(objective,
terminator = trm("evals", n_evals = 100)
)
mies_init_population(inst = oi, mu = 3, budget_id = "y", fidelity = 2,
additional_component_sampler = Sampler1DRfun$new(
param = ps(additional = p_dbl(-1, 1)), rfun = function(n) rep(-1, n)
)
)
# 3 evaluations. We also have 'additional', sampled from rfun (always -1),
# which is ignored by the objective. Besides, we have "y", which is 2,
# according to 'fidelity'.
oi$archive
[Package
miesmuschel version 0.0.4-2
Index]