# NOT RUN {
# load data
data(sim_pu_raster, sim_pu_zones_stack, sim_features, sim_features_zones)
# create problem with maximum utility objective
p1 <- problem(sim_pu_raster, sim_features) %>%
add_max_utility_objective(5000) %>%
add_binary_decisions() %>%
add_default_solver(gap = 0)
# }
# NOT RUN {
# solve problem
s1 <- solve(p1)
# plot solution
plot(s1, main = "solution", axes = FALSE, box = FALSE)
# }
# NOT RUN {
# create multi-zone problem with maximum utility objective that
# has a single budget for all zones
p2 <- problem(sim_pu_zones_stack, sim_features_zones) %>%
add_max_utility_objective(5000) %>%
add_binary_decisions() %>%
add_default_solver(gap = 0)
# }
# NOT RUN {
# solve problem
s2 <- solve(p2)
# plot solution
plot(category_layer(s2), main = "solution", axes = FALSE, box = FALSE)
# }
# NOT RUN {
# create multi-zone problem with maximum utility objective that
# has separate budgets for each zone
p3 <- problem(sim_pu_zones_stack, sim_features_zones) %>%
add_max_utility_objective(c(1000, 2000, 3000)) %>%
add_binary_decisions() %>%
add_default_solver(gap = 0)
# }
# NOT RUN {
# solve problem
s3 <- solve(p3)
# plot solution
plot(category_layer(s3), main = "solution", axes = FALSE, box = FALSE)
# }
Run the code above in your browser using DataLab