mies_get_generation_results {miesmuschel}R Documentation

Get Performance Values by Generation

Description

Get evaluated performance values from an OptimInstance for all individuals that were alive at a given generation. Depending on survivors_only, all individuals alive at the end of a generation are returned, or all individuals alive at any point during a generation.

The resulting data.table object is formatted for easy manipulation to get relevant information about optimization progress. To get aggregated values per generation, use by = "dob".

Usage

mies_get_generation_results(
  inst,
  as_fitnesses = TRUE,
  survivors_only = TRUE,
  condition_on_budget_id = NULL
)

Arguments

inst

(OptimInstance)
Optimization instance to evaluate.

as_fitnesses

(logical(1))
Whether to transform performance values into "fitness" values that are always to be maximized. This means that values that objectives that should originally be minimized are multiplied with -1, and that parts of the objective codomain that are neither being minimized nor maximized are dropped. Default TRUE.

survivors_only

(logical(1))
Whether to ignore configurations that have "eol" set to the given generation, i.e. individuals that were killed during that generation. When this is TRUE (default), then only individuals that are alive at the end of a generation are considered; otherwise all individuals alive at any point of a generation are considered. If it is TRUE, this leads to individuals that have "dob" == "eol" being ignored.

condition_on_budget_id

(character(1) | NULL)
Budget component when doing multi-fidelity optimization. When this is given, then for each generation, only individuals with the highest value for this component are considered. If survivors_only is TRUE, this means the highest value of all survivors of a given generation, if it is FALSE, then it is the highest value of all individuals alive at any point of a generation. To ignore possible budget-parameters, set this to NULL (default). This is inparticular necessary when fidelity is not monotonically increasing (e.g. if it is categorical).

Value

a data.table with the column "dob", indicating the generation, as well as further columns named by the OptimInstance's objectives.

See Also

Other aggregation methods: mies_aggregate_generations(), mies_aggregate_single_generation()

Examples

library("bbotk")
lgr::threshold("warn")

# Define the objective to optimize
objective <- ObjectiveRFun$new(
  fun = function(xs) {
    z <- 10 - 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 = "minimize"))
)

oi <- OptimInstanceSingleCrit$new(objective,
  terminator = trm("evals", n_evals = 6)
)

op <- opt("mies",
  lambda = 2, mu = 2,
  mutator = mut("gauss", sdev = 0.1),
  recombinator = rec("xounif"),
  parent_selector = sel("best")
)
set.seed(1)
op$optimize(oi)

# negates objectives that are minimized:
mies_get_generation_results(oi)

# real objective values:
mies_get_generation_results(oi, as_fitnesses = FALSE)

# Individuals that died are included:
mies_get_generation_results(oi, survivors_only = FALSE)

[Package miesmuschel version 0.0.4 Index]