Create a boolean constraint that requires a registered metric to meet or exceed (or undercut, for minimised metrics) a specified threshold during optimisation. These constraints can be supplied to optimize_panel() via its constraints argument.

min_metric_constraint(metric, threshold, params = list(), label = NULL)

Arguments

metric

Character scalar naming a registered metric function.

threshold

Numeric scalar describing the required metric level.

params

Optional named list of additional parameters forwarded to the metric function (e.g., cutoff probabilities for sensitivity).

label

Optional human-readable label for the constraint; defaults to paste0("min_", metric, "_", threshold).

Value

A constraint descriptor (list) with elements label, fun, threshold, metric, and direction.