Generate a portfolio of solutions for a conservation planning
problem
using Bender's cuts (discussed in Rodrigues
et al. 2000).
add_cuts_portfolio(x, number_solutions = 10L)
x 


number_solutions 

ConservationProblemclass
object with the portfolio
added to it.
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.
Please note that version 4.0.1 attempted to use the Gurobi
solution pool to speed up the process of obtaining multiple solutions.
However, it would sometimes return solutions that were not within the
specified optimality gap. To address this, all solution pool methods are
provided by the add_pool_portfolio
function.
Rodrigues AS, Cerdeira OJ, and Gaston KJ (2000) Flexibility, efficiency, and accountability: adapting reserve selection algorithms to more complex conservation problems. Ecography, 23: 565574.
# 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)# solve problem and generate 10 solutions within 20 % of optimality s1 < solve(p1) # plot solutions in portfolio plot(stack(s1), axes = FALSE, box = FALSE)# build multizone 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)#> List of 10 #> $ solution_1 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_2 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_3 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_4 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_5 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_6 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_7 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_8 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_9 :Formal class 'RasterStack' [package "raster"] with 11 slots #> $ solution_10:Formal class 'RasterStack' [package "raster"] with 11 slots #>  attr(*, "objective")= Named num [1:10] 12615 12312 12381 12404 12173 ... #> .. attr(*, "names")= chr [1:10] "solution_1" "solution_2" "solution_3" "solution_4" ... #>  attr(*, "status")= Named chr [1:10] "OPTIMAL" "OPTIMAL" "OPTIMAL" "OPTIMAL" ... #> .. attr(*, "names")= chr [1:10] "solution_1" "solution_2" "solution_3" "solution_4" ... #>  attr(*, "runtime")= Named num [1:10] 0.00655 0.00649 0.00676 0.00689 0.00719 ... #> .. attr(*, "names")= chr [1:10] "solution_1" "solution_2" "solution_3" "solution_4" ...