# 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 10 % targets
p1 <- p %>% add_relative_targets(0.1)
# create problem with varying targets for each feature
targets <- c(0.1, 0.2, 0.3, 0.4, 0.5)
p2 <- p %>% add_relative_targets(targets)
# }
# NOT RUN {
# solve problem
s <- stack(solve(p1), solve(p2))
# plot solution
plot(s, main = c("10 % targets", "varying targets"), axes = FALSE,
box = FALSE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab