Learn R Programming

prioritizr (version 3.0.4)

add_connected_constraints: Add connected constraints

Description

Add constraints to a conservation problem to ensure that all selected planning units are spatially connected to each other.

Usage

add_connected_constraints(x, ...)

Arguments

...

arguments passed to connected_matrix.

Value

ConservationProblem-class object with the constraint added to it.

Details

The mathematical ideas that underpin this function inspired by \"Onal and Briers (2006).

References

\"Onal H and Briers RA (2006) Optimal selection of a connected reserve network. Operations Research, 54: 379--388.

See Also

constraints.

Examples

Run this code
# NOT RUN {
# create basic problem
p1 <- problem(sim_pu_raster, sim_features) %>%
      add_min_set_objective() %>%
      add_relative_targets(0.2)

# create problem with added connected constraints
p2 <- p1 %>% add_connected_constraints()
# }
# NOT RUN {
# solve problems
s <- stack(solve(p1), solve(p2))

# plot solutions
plot(s, main = c("basic solution", "connected solution"), axes = FALSE,
     box = FALSE)
# }

Run the code above in your browser using DataLab