View source: R/multi_compile.R
| multi_compile | R Documentation |
Compile multiple OptimizationProblem objects for
multi-objective optimization.
multi_compile(x, ...)
## S3 method for class 'MultiConservationProblem'
multi_compile(x, ...)
## S3 method for class 'list'
multi_compile(x, ...)
x |
|
... |
arguments passed to |
A list containing a ($obj) numeric matrix with the coefficients
for each of the objectives (i.e., rows correspond to different
objectives and columns correspond to different decision variables),
($modelsense) character vector indicating if each
objective should be maximized or minimized
(i.e., each element corresponds to a different objective),
and a ($opt) OptimizationProblem object with all
of the constraints present in x (note that the objective coefficients
in the returned object are all zero).
See compile() to create an OptimizationProblem object.
# import data
sim_pu_raster <- get_sim_pu_raster()
sim_features <- get_sim_features()
# define a total conservation budget (30% of total cost)
budget <- terra::global(sim_pu_raster, "sum", na.rm = TRUE)[[1]] * 0.3
# create multi-objective conservation planning problem
mp <-
multi_problem(
keystone_obj =
problem(sim_pu_raster, sim_features[[1:3]]) %>%
add_min_shortfall_objective(budget) %>%
add_relative_targets(0.4) %>%
add_binary_decisions(),
iconic_obj =
problem(sim_pu_raster, sim_features[[4:5]]) %>%
add_min_shortfall_objective(budget) %>%
add_relative_targets(0.45) %>%
add_binary_decisions()
)
# compile into multi-objective optimization problem
mo <- multi_compile(mp)
# print multi-objective optimization problem
print(mo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.