Description Usage Arguments Value See Also Examples
Add penalties to a conservation problem to favor solutions that select planning units with high connectivity between them.
1 | add_connectivity_penalties(x, penalty, connectivity_data)
|
x |
|
penalty |
|
connectivity_data |
|
ConservationProblem-class
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # load data
data(sim_pu_points, sim_features)
# create a symmetric connectivity matrix where the connectivity between
# two planning units is the inverse distance between them
sc_matrix <- (1 / (as.matrix(dist(sim_pu_points@coords)) + 1))
# remove connections between planning unitswith little connectivity
sc_matrix[sc_matrix < 0.85] <- 0
# create basic problem
p1 <- problem(sim_pu_points, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.2)
# create problem with low connectivity penalties
p2 <- p1 %>% add_connectivity_penalties(25, sc_matrix)
# create problem with higher connectivity penalties
p3 <- p1 %>% add_connectivity_penalties(50, sc_matrix)
# create an asymmetric connectivity matrix where links from even numered
# units to odd numbered units have half the connectivity as from odd
# numbered units to even units
even_units <- seq(2, length(sim_pu_points), 2)
odd_units <- seq(1, length(sim_pu_points), 2)
ac_matrix <- sc_matrix
ac_matrix[even_units, odd_units] <- 0.5 * ac_matrix[even_units, odd_units]
# create problem with asymmetric connectivity and high penalties
p4 <- p1 %>% add_connectivity_penalties(50, ac_matrix)
# solve problems
s <- list(solve(p1), solve(p2), solve(p3), solve(p4))
# plot solutions
par(mfrow=c(2,2))
plot(s[[1]], pch=19, main="basic solution", cex = 1.5)
points(s[[1]][s[[1]]$solution==1, ], col = "darkgreen", pch = 19, cex = 1.5)
plot(s[[2]], pch=19, main="small penalties", cex = 1.5)
points(s[[2]][s[[2]]$solution==1, ], col = "darkgreen", pch = 19, cex = 1.5)
plot(s[[3]], pch=19, main="high penalties", cex = 1.5)
points(s[[3]][s[[3]]$solution==1, ], col = "darkgreen", pch = 19, cex = 1.5)
plot(s[[4]], pch=19, main="asymmetric connectivity", cex = 1.5)
points(s[[4]][s[[4]]$solution==1, ], col = "darkgreen", pch=19, cex = 1.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.