View source: R/build-multiscale-objective-data.R
| build_multiscale_objective_data | R Documentation |
Combines the planning-unit hierarchy, costs, and feature amounts into the data used for multiscale minimum-set optimization and solution evaluation.
build_multiscale_objective_data(
pu,
maps,
cost_col = "area_km2",
feature_cols,
native_cols = NULL,
tol = 1e-06
)
pu |
A planning-unit object. Its row order must match |
maps |
A hierarchy object returned by |
cost_col |
Character name of the spatially additive planning-unit cost column. |
feature_cols |
A character vector or named character vector identifying
the multiscale feature columns, typically the output of
|
native_cols |
Optional character vector identifying native-resolution feature columns. When supplied, native and atom-based totals are compared as a diagnostic. |
tol |
Numeric relative tolerance used for hierarchy reconciliation and diagnostic checks. |
The prepared data combine cost and feature representation across nested planning-unit resolutions. This allows planning units selected at different resolutions to contribute toward the same feature representation while shared spatial contributions are accounted for once.
The planning-unit row order used to build this object must also be used for the corresponding conservation problem and solution evaluation.
A multiscale_objective_data object for use with
add_multiscale_min_set() and eval_multiscale_atom_solution().
Other multiscale minimum-set:
add_multiscale_min_set(),
add_multiscale_min_set_objective(),
add_multiscale_relative_targets(),
build_multiscale_atoms(),
build_multiscale_feature_atoms(),
eval_multiscale_atom_solution(),
load_multiscale_feature(),
multiscale_feature_cols()
# Small hierarchy: a parent and two of its seven children.
# Feature amounts below are already prepared and additive.
pu <- data.frame(
h3_address = c("872a1072bffffff", "882a1072b1fffff", "882a1072b3fffff"),
res = c(7L, 8L, 8L), area_km2 = c(14, 2, 2),
msopt_A = c(3, 1, 2), msopt_B = c(6, 2, 1),
selected = c(1L, 1L, 0L))
maps <- build_h3_maps(pu, res_levels = c(7L, 8L))
ms_data <- build_multiscale_objective_data(
pu = pu, maps = maps,
feature_cols = c(A = "msopt_A", B = "msopt_B"))
result <- eval_multiscale_atom_solution(pu,
solution_col = "selected", data = ms_data,
targets = c(A = 2/3, B = 1/2))
result$relative_held
result$target_met
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.