# NOT RUN {
# seed seed for reproducibility
set.seed(600)
# load data
data(sim_pu_raster, sim_features)
# create minimal problem with binary decisions
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)
# }
# NOT RUN {
# solve problem
s1 <- solve(p1)
# print solution
print(s1)
# plot solution
plot(s1, main = "solution", axes = FALSE, box = FALSE)
# calculate irreplaceability scores
rwr1 <- rarity_weighted_richness(p1, s1)
# print irreplaceability scores
print(rwr1)
# plot irreplaceability scores
plot(rwr1, main = "rarity weighted richness", axes = FALSE, box = FALSE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab