View source: R/eval_objective_summary.R
| eval_objective_summary | R Documentation |
Calculate the objective value of a solution to a conservation planning problem.
eval_objective_summary(x, solution, include_penalties = TRUE)
## S3 method for class 'ConservationProblem'
eval_objective_summary(x, solution, include_penalties = TRUE)
## S3 method for class 'MultiConservationProblem'
eval_objective_summary(x, solution, include_penalties = TRUE)
x |
|
solution |
|
include_penalties |
|
The mathematical objective function of an optimization problem describes
the performance metric that is minimized or maximized during
optimization.
In a conservation planning problem(), objectives specify the primary
metric should be maximized or minimized (e.g., add_min_set_objective()
specify that costs should be minimized) and penalties can
(optionally) be used to specify additional metrics that should be maximized
or minimized during optimization
(e.g., add_boundary_penalties() specify that spatial
fragmentation should be minimized).
Given this, the mathematical objective function of a
conservation planning problem() is calculated based on
a weighted sum of the objectives and penalties
(i.e., where the weights are the penalty values specified
in the penalties function).
A tibble::tibble() object describing the performance of the solution.
It contains the following columns.
character name of problem. Note that this column
is only present if x is a multi_problem() object.
numeric objective value.
Other functions for summarizing solutions:
eval_asym_connectivity_summary(),
eval_boundary_summary(),
eval_connectivity_summary(),
eval_cost_summary(),
eval_feature_representation_summary(),
eval_n_summary(),
eval_target_coverage_summary()
# set seed for reproducibility
set.seed(500)
# load data
sim_pu_raster <- get_sim_pu_raster()
sim_features <- get_sim_features()
# build conservation problem with boundary penalties
p1 <-
problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.1) %>%
add_binary_decisions() %>%
add_default_solver(verbose = FALSE)
# solve the problem
s1 <- solve(p1)
# print solution
print(s1)
# calculate objective value including penalties
v1 <- eval_objective_summary(p1, s1, include_penalties = TRUE)
print(v1)
# calculate objective value excluding penalties
v2 <- eval_objective_summary(p1, s1, include_penalties = FALSE)
print(v2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.