Choose survivors during a MIES iteration using the "Plus" survival strategy, i.e. combining all alive individuals from the latest and from prior generations indiscriminately and choosing survivors using a survival Selector operator.

When mu is greater than the number of alive individuals, then all individuals survive.

mies_survival_plus(inst, mu, survival_selector, ...)

Arguments

inst

(OptimInstance)
Optimization instance to evaluate.

mu

(integer(1))
Population target size, non-negative integer.

survival_selector

(Selector)
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 Selectors always try to maximize fitness.
The Selector must be primed on inst$search_space; this includes the "budget" component when performing multi-fidelity optimization.
The given Selector may not return duplicates.

...

(any)
Ignored, for compatibility with other mies_survival_* functions.

Value

invisible data.table: The value of inst$archive$data, changed in-place with eol set to the current generation for non-survivors.

Examples

set.seed(1)
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)
offspring = generate_design_random(oi$search_space, 2)$data
mies_evaluate_offspring(oi, offspring = offspring)

# State before: different generations of individuals. Alive individuals have
# 'eol' set to 'NA'.
oi$archive
#> <Archive>
#>        x     y   dob   eol  x_id     Obj           timestamp batch_nr
#>    <num> <num> <num> <num> <num>   <num>              <POSc>    <int>
#> 1: -0.41  3.45     1    NA     1 0.00075 2024-05-13 04:41:10        1
#> 2:  0.23 -0.79     1    NA     2 0.50760 2024-05-13 04:41:10        1
#> 3:  1.44  3.39     1    NA     3 0.21083 2024-05-13 04:41:10        1
#> 4:  3.67  1.77     2    NA     4 0.11765 2024-05-13 04:41:10        2
#> 5:  1.96 -1.63     2    NA     5 0.00148 2024-05-13 04:41:10        2

s = sel("best")
s$prime(oi$search_space)
mies_survival_plus(oi, mu = 3, survival_selector = s)

# sel("best") lets only the three best individuals survive.
# The others have 'eol = 2' (the current generation).
oi$archive
#> <Archive>
#>        x     y   dob   eol  x_id     Obj           timestamp batch_nr
#>    <num> <num> <num> <num> <num>   <num>              <POSc>    <int>
#> 1: -0.41  3.45     1     2     1 0.00075 2024-05-13 04:41:10        1
#> 2:  0.23 -0.79     1    NA     2 0.50760 2024-05-13 04:41:10        1
#> 3:  1.44  3.39     1    NA     3 0.21083 2024-05-13 04:41:10        1
#> 4:  3.67  1.77     2    NA     4 0.11765 2024-05-13 04:41:10        2
#> 5:  1.96 -1.63     2     2     5 0.00148 2024-05-13 04:41:10        2