Last chance! 50% off unlimited learning
Sale ends in
As part of the "rolling-tide" multifidelity-setup, do reevaluation of configurations with
higher fidelity that have survived lower-fidelity selection. The evaluations are done as part of the
current generation, so the dob
value is not increased.
This function should only be called when doing rolling-tide multifidelity, and should not be part of the MIES cycle otherwise.
mies_step_fidelity(
inst,
budget_id,
fidelity,
current_gen_only = FALSE,
fidelity_monotonic = TRUE,
additional_components = NULL
)
data.table
: the performance values returned when evaluating the offspring
values
through eval_batch
.
(OptimInstance
)
Optimization instance to evaluate.
(character(1)
)
Budget component that is set to the fidelity
value.
(atomic(1)
)
Atomic scalar indicating the value to be assigned to the budget_id
component of offspring.
(logical(1)
)
Whether to only re-evaluate survivors individuals generated in the latest generation (TRUE
), or re-evaluate all currently alive
individuals (FALSE
). In any case, only individuals that were not already evaluated with the chosen fidelity are evaluated,
so this will usually only have an effect when the fidelity of surviving individuals changed between generations.
(logical(1)
)
Whether to only re-evaluate configurations for which the fidelity would increase. Default TRUE
.
(ParamSet
| NULL
)
Additional components to optimize over, not included in search_space
, but possibly used for self-adaption. This must be the ParamSet
of mies_init_population()
's additional_component_sampler
argument.
Other mies building blocks:
mies_evaluate_offspring()
,
mies_generate_offspring()
,
mies_get_fitnesses()
,
mies_init_population()
,
mies_select_from_archive()
,
mies_survival_comma()
,
mies_survival_plus()
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)
)
budget_id = "y"
# Create an initial population with fidelity ("y") value 1
mies_init_population(oi, mu = 2, budget_id = budget_id, fidelity = 1)
oi$archive
# Re-evaluate these individuals with higher fidelity
mies_step_fidelity(oi, budget_id = budget_id, fidelity = 2)
oi$archive
# The following creates a new generation without killing the initial
# generation
offspring = data.frame(x = 0:1)
mies_evaluate_offspring(oi, offspring = offspring, budget_id = budget_id,
fidelity = 3)
oi$archive
# Re-evaluate only individuals from last generation by setting current_gen_only
mies_step_fidelity(oi, budget_id = budget_id, fidelity = 4,
current_gen_only = TRUE)
oi$archive
# Default: Re-evaluate all that *increase* fidelity: Only the initial
# population is re-evaluated here.
mies_step_fidelity(oi, budget_id = budget_id, fidelity = 3)
oi$archive
# To also re-evaluate individuals with *higher* fidelity, use
# 'fidelity_monotonic = FALSE'. This does not re-evaluate the points that already have
# the requested fidelity, however.
mies_step_fidelity(oi, budget_id = budget_id, fidelity = 3, fidelity_monotonic = FALSE)
oi$archive
Run the code above in your browser using DataLab