View source: R/add_components_constraint.R
add_components_constraint | R Documentation |
Add constraint to a restoration problem (restopt_problem()
) object
to specify the number of connected components that can be
present within a solution.
add_components_constraint(problem, min_nb_components, max_nb_components)
problem |
|
min_nb_components |
|
max_nb_components |
|
A connected component is a spatially continuous set of planning units. This constraints applies on the set of planning units that are selected for restoration, and allows to specify a minimum and maximum number of connected components. In practice, this constraint is useful to ensure the feasibility of a restoration project, and to integrate economies of scale. Continuous restoration areas (i.e. less connected components) are usually associated with lower costs, because it ensures that restoration sites are not too far away from each other (e.g. lower travel costs between sites, less areas to monitor, etc.). On the other hand, it can be useful to enforce several disconnected restoration areas to ensure that hazards (e.g. fire) do not strike all planning units at the same time.
An updated restoration problem (restopt_problem()
) object.
Other constraints:
add_available_areas_constraint()
,
add_compactness_constraint()
,
add_connected_constraint()
,
add_locked_out_constraint()
,
add_min_iic_constraint()
,
add_min_mesh_constraint()
,
add_nb_patches_constraint()
,
add_no_new_patch_constraint()
,
add_restorable_constraint()
## Not run:
# load data
habitat_data <- rast(
system.file("extdata", "habitat_hi_res.tif", package = "restoptr")
)
# create problem
p <- restopt_problem(
existing_habitat = habitat_data,
aggregation_factor = 16,
habitat_threshold = 0.7
) %>%
add_restorable_constraint(
min_restore = 10,
max_restore = 100,
) %>%
add_components_constraint(1, 1)
# plot preprocessed data
plot(rast(list(p$data$existing_habitat, p$data$restorable_habitat)), nc = 2)
# print problem
print(p)
# Solve problem
s <- solve(p)
# plot solution
plot(s)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.