# NOT RUN {
# load data
data(sim_pu_raster, sim_features)
# create problem
p <- problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.1) %>%
add_binary_decisions()
# }
# NOT RUN {
# if the package is installed then add solver and generate solution
if (require("Rsymphony")) {
# specify solver and generate solution
s <- p %>% add_rsymphony_solver(time_limit = 10) %>%
solve()
# plot solutions
plot(stack(sim_pu_raster, s), main = c("planning units", "solution"),
axes = FALSE, box = FALSE)
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab