# NOT RUN {
# load data
data(sim_pu_raster, sim_pu_polygons, sim_features)
# build minimal conservation problem with raster data
p1 <- problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.1) %>%
add_binary_decisions() %>%
add_default_solver(gap = 0, verbose = FALSE)
# solve the problem
# }
# NOT RUN {
s1 <- solve(p1)
# }
# NOT RUN {
# plot solution
# }
# NOT RUN {
plot(s1, main = "solution", axes = FALSE, box = FALSE)
# }
# NOT RUN {
# calculate irreplaceability scores using replacement cost scores
# }
# NOT RUN {
rc1 <- replacement_cost(p1, s1)
# }
# NOT RUN {
# calculate irreplaceability scores using rarity weighted richness scores
# }
# NOT RUN {
rc2 <- rarity_weighted_richness(p1, s1)
# }
# NOT RUN {
# plot irreplaceability scores
# }
# NOT RUN {
plot(stack(rc1, rc2), axes = FALSE, box = FALSE,
main = c("replacement cost", "rarity weighted richness"))
# }
Run the code above in your browser using DataLab