Add Bender's cuts portfolio
Generate a portfolio of solutions for a conservation planning
problem() using Bender's cuts (discussed in Rodrigues
et al. 2000). This is recommended as a replacement for
add_gap_portfolio() when the Gurobi software is not
available.
add_cuts_portfolio(x, number_solutions = 10L)
x |
|
number_solutions |
|
This strategy for generating a portfolio of solutions involves solving the problem multiple times and adding additional constraints to forbid previously obtained solutions. In general, this strategy is most useful when problems take a long time to solve and benefit from having multiple threads allocated for solving an individual problem.
Object (i.e. ConservationProblem) with the portfolio
added to it.
In early versions (< 4.0.1), this function was only compatible with
Gurobi (i.e. add_gurobi_solver()). To provide functionality with
exact algorithm solvers, this function now adds constraints to the
problem formulation to generate multiple solutions.
Rodrigues AS, Cerdeira OJ, and Gaston KJ (2000) Flexibility, efficiency, and accountability: adapting reserve selection algorithms to more complex conservation problems. Ecography, 23: 565–574.
# set seed for reproducibility
set.seed(500)
# load data
data(sim_pu_raster, sim_features, sim_pu_zones_stack, sim_features_zones)
# create minimal problem with cuts portfolio
p1 <- problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.2) %>%
add_cuts_portfolio(10) %>%
add_default_solver(gap = 0.2, verbose = FALSE)
## Not run:
# solve problem and generate 10 solutions within 20% of optimality
s1 <- solve(p1)
# plot solutions in portfolio
plot(stack(s1), axes = FALSE, box = FALSE)
## End(Not run)
# build multi-zone conservation problem with cuts portfolio
p2 <- problem(sim_pu_zones_stack, sim_features_zones) %>%
add_min_set_objective() %>%
add_relative_targets(matrix(runif(15, 0.1, 0.2), nrow = 5,
ncol = 3)) %>%
add_binary_decisions() %>%
add_cuts_portfolio(10) %>%
add_default_solver(gap = 0.2, verbose = FALSE)
## Not run:
# solve the problem
s2 <- solve(p2)
# print solution
str(s2, max.level = 1)
# plot solutions in portfolio
plot(stack(lapply(s2, category_layer)), main = "solution", axes = FALSE,
box = FALSE)
## End(Not run)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.