# NOT RUN {
# load data
data(sim_pu_raster, sim_features)
# create base problem
p <- problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_binary_decisions()
# create problem with targets to secure 3 amounts for each feature
p1 <- p %>% add_absolute_targets(3)
# create problem with varying targets for each feature
targets <- c(1, 2, 3, 2, 1)
p2 <- p %>% add_absolute_targets(targets)
# }
# NOT RUN {
# solve problem
s <- stack(solve(p1), solve(p2))
# plot solution
plot(s, main = c("targets for 3", "varying targets"), axes = FALSE,
box = FALSE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab