add_nb_patches_constraint {restoptr} | R Documentation |
Add constraint to limit the number of patches (habitat + restoration)
Description
Add constraint to a restoration problem (restopt_problem()
) object
to specify the number of patches (habitat + restoration) that can be
present within a solution.
Usage
add_nb_patches_constraint(problem, min_nb_patches, max_nb_patches)
Arguments
problem |
|
min_nb_patches |
|
max_nb_patches |
|
Details
A patch is a spatially continuous set of habitat and restoration planning units. This constraints applies on the union of the set of planning units that are selected for restoration and the initial habitat patches, and allows to specify a minimum and maximum number of patches. In practice, this constraint is useful to set simple targets for structural connectivity.
Value
An updated restoration problem (restopt_problem()
) object.
See Also
Other constraints:
add_available_areas_constraint()
,
add_compactness_constraint()
,
add_components_constraint()
,
add_connected_constraint()
,
add_locked_out_constraint()
,
add_min_iic_constraint()
,
add_min_mesh_constraint()
,
add_no_new_patch_constraint()
,
add_restorable_constraint()
Examples
## 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_nb_patches_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)