Specify the software and configuration used to solve a conservation planning problem. By default, the best available software currently installed on the system will be used.

Details

The following solvers can be used to find solutions for a conservation planning problem:

add_default_solver

This solver uses the best software currently installed on the system.

add_gurobi_solver

Gurobi is a state-of-the-art commercial optimization software with an R package interface. It is by far the fastest of the solvers available in this package, however, it is also the only solver that is not freely available. That said, licenses are available to academics at no cost. The gurobi package is distributed with the Gurobi software suite. This solver uses the gurobi package to solve problems.

add_rsymphony_solver

SYMPHONY is an open-source integer programming solver that is part of the Computational Infrastructure for Operations Research (COIN-OR) project, an initiative to promote development of open-source tools for operations research (a field that includes linear programming). The Rsymphony package provides an interface to COIN-OR and is available on CRAN. This solver uses the Rsymphony package to solve problems.

add_lpsymphony_solver

The lpsymphony package provides a different interface to the COIN-OR software suite. Unlike the Rsymhpony package, the lpsymphony package is distributed through Bioconductor. The lpsymphony package may be easier to install on Windows or Max OSX systems than the Rsymphony package.

See also

Examples

# load data data(sim_pu_raster, sim_features) # create basic problem p <- problem(sim_pu_raster, sim_features) %>% add_min_set_objective() %>% add_relative_targets(0.1) %>% add_binary_decisions() # create vector to store plot titles titles <- c() # create empty stack to store solutions s <- stack() # create problem with added rsymphony solver and limit the time spent # searching for the optimal solution to 2 seconds if (require("Rsymphony")) { titles <- c(titles, "Rsymphony (2s)") p1 <- p %>% add_rsymphony_solver(time_limit = 2) s <- addLayer(s, solve(p1)) } # create problem with added rsymphony solver and limit the time spent # searching for the optimal solution to 5 seconds if (require("Rsymphony")) { titles <- c(titles, "Rsymphony (5s)") p2 <- p %>% add_rsymphony_solver(time_limit = 5) s <- addLayer(s, solve(p2)) } # if the gurobi is installed: create problem with added gurobi solver if (require("gurobi")) { titles <- c(titles, "gurobi (5s)") p3 <- p %>% add_gurobi_solver(gap = 0.1, presolve = 2, time_limit = 5) s <- addLayer(s, solve(p3)) }
#> Optimize a model with 5 rows, 90 columns and 450 nonzeros #> Variable types: 0 continuous, 90 integer (90 binary) #> Coefficient statistics: #> Matrix range [2e-01, 9e-01] #> Objective range [2e+02, 2e+02] #> Bounds range [1e+00, 1e+00] #> RHS range [3e+00, 8e+00] #> Found heuristic solution: objective 2337.9617505 #> Presolve time: 0.00s #> Presolved: 5 rows, 90 columns, 450 nonzeros #> Variable types: 0 continuous, 90 integer (90 binary) #> Presolved: 5 rows, 90 columns, 450 nonzeros #> #> #> Root relaxation: objective 1.931582e+03, 12 iterations, 0.00 seconds #> #> Nodes | Current Node | Objective Bounds | Work #> Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time #> #> 0 0 1931.58191 0 4 2337.96175 1931.58191 17.4% - 0s #> H 0 0 1985.6818841 1931.58191 2.72% - 0s #> #> Explored 1 nodes (12 simplex iterations) in 0.00 seconds #> Thread count was 1 (of 4 available processors) #> #> Solution count 2: 1985.68 2337.96 #> #> Optimal solution found (tolerance 1.00e-01) #> Best objective 1.985681884076e+03, best bound 1.931581908865e+03, gap 2.7245%
# if the lpsymphony is installed: create problem with added lpsymphony solver # note that this solver is skipped on Linux systems due to instability # issues if (require("lpsymphony") & isTRUE(Sys.info()[["sysname"]] != "Linux")) { titles <- c(titles, "lpsymphony") p4 <- p %>% add_lpsymphony_solver(gap = 0.1, time_limit = 10) s <- addLayer(s, solve(p4)) } # plot solutions plot(s, main = titles, axes = FALSE, box = FALSE)