# 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 using Ferrier et al. 2000 method
fs1 <- ferrier_score(p1, s1)
# print irreplaceability scores,
# each planning unit has an irreplaceability score for each feature
# (as indicated by the column names) and each planning unit also
# has an overall total irreplaceability score (in the "total" column)
print(fs1)
# plot total irreplaceability scores
plot(fs1, axes = FALSE, box = FALSE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab