Specify that the HiGHS software should be used to solve a conservation planning problem (Huangfu and Hall 2018). This function can also be used to customize the behavior of the solver. It requires the highs package to be installed.
Usage
add_highs_solver(
x,
gap = 0.1,
time_limit = .Machine$integer.max,
presolve = TRUE,
threads = 1,
verbose = TRUE,
control = list()
)Arguments
- x
problem()object.- gap
numericgap to optimality. This gap is relative and expresses the acceptable deviance from the optimal objective. For example, a value of 0.01 will result in the solver stopping when it has found a solution within 1% of optimality. Additionally, a value of 0 will result in the solver stopping when it has found an optimal solution. The default value is 0.1 (i.e., 10% from optimality).- time_limit
numerictime limit (seconds) for generating solutions. The solver will return the current best solution when this time limit is exceeded. The default value is the largest integer value (i.e.,.Machine$integer.max), effectively meaning that solver will keep running until a solution within the optimality gap is found.- presolve
logicalattempt to simplify the problem before solving it? Defaults toTRUE.- threads
integernumber of threads to use for the optimization algorithm. The default value is 1.- verbose
logicalshould information be printed while solving optimization problems? Defaults toTRUE.- control
listwith additional parameters for tuning the optimization process. For example,control = list(simplex_strategy = 1)could be used to set thesimplex_strategyparameter. See the online documentation for information on the parameters.
Value
An updated problem() object with the solver added to it.
Details
HiGHS is an open source optimization software.
Although this solver can have comparable performance to the CBC solver
(i.e., add_cbc_solver()) for particular problems and is generally faster
than the SYMPHONY based solvers (i.e., add_rsymphony_solver(),
add_lpsymphony_solver()), it can sometimes take much longer than the
CBC solver for particular problems. This solver is recommended if
the add_gurobi_solver(), add_cplex_solver(), add_cbc_solver() cannot
be used.
References
Huangfu Q and Hall JAJ (2018). Parallelizing the dual revised simplex method. Mathematical Programming Computation, 10: 119-142.
See also
Other solvers:
add_cbc_solver(),
add_cplex_solver(),
add_default_solver(),
add_gurobi_solver(),
add_lsymphony_solver,
add_rsymphony_solver()
Examples
# \dontrun{
# load data
sim_pu_raster <- get_sim_pu_raster()
sim_features <- get_sim_features()
# create problem
p <-
problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.1) %>%
add_binary_decisions() %>%
add_highs_solver(gap = 0, verbose = FALSE)
# generate solution
s <- solve(p)
# plot solution
plot(s, main = "solution", axes = FALSE)
# }
