/
solvers.Rd
165 lines (145 loc) · 6.03 KB
/
solvers.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/solvers.R
\name{solvers}
\alias{solvers}
\title{Problem solvers}
\description{
Specify the software and configuration used to solve a conservation planning
\code{\link[=problem]{problem()}}. By default, the best available
software currently installed on the system will be used.
For information on the performance of different solvers,
please see Schuster \emph{et al.} (2020) for benchmarks comparing the
run time and solution quality of some of these solvers when applied to
different sized datasets.
}
\details{
The following solvers can be used to find solutions for a
conservation planning \code{\link[=problem]{problem()}}:
\describe{
\item{\code{\link[=add_default_solver]{add_default_solver()}}}{This solver uses the best software
currently installed on the system.}
\item{\code{\link[=add_gurobi_solver]{add_gurobi_solver()}}}{\href{https://www.gurobi.com/}{\emph{Gurobi}}
is a state-of-the-art commercial optimization software with an R package
interface. We recommend using this solver if at all possible.
It is by far the fastest of the solvers available for
generating prioritizations, however, it is not freely available. That
said, licenses are available to academics at no cost. The
\pkg{gurobi} package is distributed with the \emph{Gurobi} software
suite. This solver uses the \pkg{gurobi} package to solve problems.}
\item{\code{\link[=add_cplex_solver]{add_cplex_solver()}}}{\href{https://www.ibm.com/products/ilog-cplex-optimization-studio/cplex-optimizer}{\emph{IBM CPLEX}}
is a commercial optimization software. It is faster than the open
source solvers available for generating prioritizations, however, it
is not freely available.
Similar to the \href{https://www.gurobi.com/}{\emph{Gurobi}}
software, licenses are available to academics at no cost.
This solver uses the \pkg{cplexAPI} package to solve problems using
\emph{IBM CPLEX}.}
\item{\code{\link[=add_cbc_solver]{add_cbc_solver()}}}{\href{https://github.com/coin-or/Cbc}{\emph{CBC}} is an
open-source mixed integer programming solver that is part of the
Computational Infrastructure for Operations Research (COIN-OR) project.
Preliminary benchmarks indicate that it is the fastest open source
solver currently supported.
We recommend using this solver if both \emph{Gurobi} and \emph{IBM CPLEX} are
unavailable.
It requires the \pkg{rcbc} package, which is currently only available on
\href{https://github.com/dirkschumacher/rcbc}{GitHub}.
}
\item{\code{\link[=add_highs_solver]{add_highs_solver()}}}{\href{https://highs.dev/}{\emph{HiGHS}} is an open
source optimization software. Although this solver can have
comparable performance to the \emph{CBC} solver for particular problems and is
generally faster than the \emph{SYMPHONY} based solvers (see below), it
sometimes can take much longer than the \emph{CBC} solver for particular
problems.
}
\item{\code{\link[=add_lpsymphony_solver]{add_lpsymphony_solver()}}}{
\href{https://github.com/coin-or/SYMPHONY}{\emph{SYMPHONY}} is an
open-source mixed integer programming solver that is also part of the
COIN-OR project. Although both \emph{SYMPHONY} and \emph{CBC} are part of
the COIN-OR project, they are different software.
The \pkg{lpsymphony} package provides an interface to the \emph{SYMPHONY}
software, and is distributed through
\href{https://doi.org/doi:10.18129/B9.bioc.lpsymphony}{Bioconductor}.
We recommend using this solver if the \emph{CBC} and \emph{HiGHS} solvers cannot
be installed.
This solver can use parallel processing to solve problems, so it is
faster than \pkg{Rsymphony} package interface (see below).
}
\item{\code{\link[=add_rsymphony_solver]{add_rsymphony_solver()}}}{
This solver provides an alternative interface to the
\href{https://github.com/coin-or/SYMPHONY}{\emph{SYMPHONY}} solver using
the \pkg{Rsymphony} package.
Unlike other solvers, the \pkg{Rsymphony} package can be installed
directly from the Comprehensive R Archive Network (CRAN).
It is also the slowest of the available solvers.}
}
}
\examples{
\dontrun{
# 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_proportion_decisions()
# create vector to store plot titles
titles <- c()
# create empty stack to store solutions
s <- stack()
# if gurobi is installed: create problem with added gurobi solver
if (require("gurobi")) {
titles <- c(titles, "gurobi")
p1 <- p \%>\% add_gurobi_solver(verbose = FALSE)
s <- addLayer(s, solve(p1))
}
# if cplexAPI is installed: create problem with added CPLEX solver
if (require("cplexAPI")) {
titles <- c(titles, "CPLEX")
p2 <- p \%>\% add_cplex_solver(verbose = FALSE)
s <- addLayer(s, solve(p2))
}
# if rcbc is installed: create problem with added CBC solver
if (require("rcbc")) {
titles <- c(titles, "CBC")
p3 <- p \%>\% add_cbc_solver(verbose = FALSE)
s <- addLayer(s, solve(p3))
}
# if highs is installed: create problem with added HiGHs solver
if (require("highs")) {
titles <- c(titles, "HiGHS")
p4 <- p \%>\% add_highs_solver(verbose = FALSE)
s <- addLayer(s, solve(p4))
}
# create problem with added rsymphony solver
if (require("Rsymphony")) {
titles <- c(titles, "Rsymphony")
p5 <- p \%>\% add_rsymphony_solver(verbose = FALSE)
s <- addLayer(s, solve(p25))
}
# if lpsymphony is installed: create problem with added lpsymphony solver
if (require("lpsymphony")) {
titles <- c(titles, "lpsymphony")
p6 <- p \%>\% add_lpsymphony_solver(verbose = FALSE)
s <- addLayer(s, solve(p6))
}
# plot solutions
plot(s, main = titles, axes = FALSE, box = FALSE)
}
}
\references{
Schuster R, Hanson JO, Strimas-Mackey M, and Bennett JR (2020). Exact
integer linear programming solvers outperform simulated annealing for
solving conservation planning problems. \emph{PeerJ}, 8: e9258.
}
\seealso{
Other overviews:
\code{\link{constraints}},
\code{\link{decisions}},
\code{\link{importance}},
\code{\link{objectives}},
\code{\link{penalties}},
\code{\link{portfolios}},
\code{\link{summaries}},
\code{\link{targets}}
}
\concept{overviews}