Title: | Multi-Action Conservation Planning |
---|---|
Description: | This uses a mixed integer mathematical programming (MIP) approach for building and solving multi-action planning problems, where the goal is to find an optimal combination of management actions that abate threats, in an efficient way while accounting for spatial aspects. Thus, optimizing the connectivity and conservation effectiveness of the prioritized units and of the deployed actions. The package is capable of handling different commercial (gurobi, CPLEX) and non-commercial (symphony, CBC) MIP solvers. Gurobi optimization solver can be installed using comprehensive instructions in the 'gurobi' installation vignette of the prioritizr package (available in <https://prioritizr.net/articles/gurobi_installation_guide.html>). Instead, 'CPLEX' optimization solver can be obtain from IBM CPLEX web page (available here <https://www.ibm.com/es-es/products/ilog-cplex-optimization-studio>). Additionally, the 'rcbc' R package (available at <https://github.com/dirkschumacher/rcbc>) can be used to obtain solutions using the CBC optimization software (<https://github.com/coin-or/Cbc>). Methods used in the package refers to Salgado-Rojas et al. (2020) <doi:10.1016/j.ecolmodel.2019.108901>, Beyer et al. (2016) <doi:10.1016/j.ecolmodel.2016.02.005>, Cattarino et al. (2015) <doi:10.1371/journal.pone.0128027> and Watts et al. (2009) <doi:10.1016/j.envsoft.2009.06.005>. See the prioriactions website for more information, documentations and examples. |
Authors: | Jose Salgado-Rojas [aut, cre], Irlanda Ceballos-Fuentealba [aut], Virgilio Hermoso [aut], Eduardo Alvarez-Miranda [aut], Jordi Garcia-Gonzalo [aut] |
Maintainer: | Jose Salgado-Rojas <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.5.0 |
Built: | 2025-02-07 05:20:57 UTC |
Source: | https://github.com/prioriactions/prioriactions |
This class is used to represent data of the instances of the corresponding
multi-action planning problem. It includes several methods for retrieving the information
of the instance (such as the spatial allocation of threats and species, the cost
of management actions or the structure of the spatial connectivity across
the area where the planning is carried out. This class is created using the
inputData()
function.
No return value.
list
object containing data.
integer
. Number of possible actions.
character
name):data.frame()
. Object stored in the data
field with the corresponding name
.
The argument name
indicates the name of arguments of the
problem
function ("pu", "features", "dist_features", "threats",
"dist_threats", "sensitivity"
or "boundary").
integer
. Number of features.
character
. Names of features.
numeric
vector()
. Cost of monitoring each planning unit.
integer
. Number of planning units.
numeric
vector()
. Cost of actions each planning unit and threat.
character
. Names of threats.
integer
. Number of threats.
Print basic information of the data instance.
Call print method.
## set seed for reproducibility set.seed(14) ## Set prioriactions path prioriactions_path <- system.file("extdata/example_input/", package = "prioriactions") ## Load in planning unit data pu_data <- data.table::fread(paste0(prioriactions_path,"/pu.dat"), data.table = FALSE) head(pu_data) ## Load in feature data features_data <- data.table::fread(paste0(prioriactions_path,"/features.dat"), data.table = FALSE) head(features_data) ## Load in planning unit vs feature data dist_features_data <- data.table::fread(paste0(prioriactions_path,"/dist_features.dat"), data.table = FALSE) head(dist_features_data) ## Load in the threats data threats_data <- data.table::fread(paste0(prioriactions_path,"/threats.dat"), data.table = FALSE) head(threats_data) ## Load in the threats distribution data dist_threats_data <- data.table::fread(paste0(prioriactions_path,"/dist_threats.dat"), data.table = FALSE) head(dist_threats_data) ## Load in the sensitivity data sensitivity_data <- data.table::fread(paste0(prioriactions_path,"/sensitivity.dat"), data.table = FALSE) head(sensitivity_data) ## Load in the boundary data boundary_data <- data.table::fread(paste0(prioriactions_path,"/boundary.dat"), data.table = FALSE) head(boundary_data) ## Create instance problem_data <- inputData( pu = pu_data, features = features_data, dist_features = dist_features_data, dist_threats = dist_threats_data, threats = threats_data, sensitivity = sensitivity_data, boundary = boundary_data ) ## Summary print(problem_data) ## Use class methods problem_data$getData("features") problem_data$getFeatureAmount() problem_data$getFeatureNames() problem_data$getMonitoringCosts() problem_data$getPlanningUnitsAmount() problem_data$getActionCosts() problem_data$getThreatNames() problem_data$getThreatsAmount() problem_data$print()
## set seed for reproducibility set.seed(14) ## Set prioriactions path prioriactions_path <- system.file("extdata/example_input/", package = "prioriactions") ## Load in planning unit data pu_data <- data.table::fread(paste0(prioriactions_path,"/pu.dat"), data.table = FALSE) head(pu_data) ## Load in feature data features_data <- data.table::fread(paste0(prioriactions_path,"/features.dat"), data.table = FALSE) head(features_data) ## Load in planning unit vs feature data dist_features_data <- data.table::fread(paste0(prioriactions_path,"/dist_features.dat"), data.table = FALSE) head(dist_features_data) ## Load in the threats data threats_data <- data.table::fread(paste0(prioriactions_path,"/threats.dat"), data.table = FALSE) head(threats_data) ## Load in the threats distribution data dist_threats_data <- data.table::fread(paste0(prioriactions_path,"/dist_threats.dat"), data.table = FALSE) head(dist_threats_data) ## Load in the sensitivity data sensitivity_data <- data.table::fread(paste0(prioriactions_path,"/sensitivity.dat"), data.table = FALSE) head(sensitivity_data) ## Load in the boundary data boundary_data <- data.table::fread(paste0(prioriactions_path,"/boundary.dat"), data.table = FALSE) head(boundary_data) ## Create instance problem_data <- inputData( pu = pu_data, features = features_data, dist_features = dist_features_data, dist_threats = dist_threats_data, threats = threats_data, sensitivity = sensitivity_data, boundary = boundary_data ) ## Summary print(problem_data) ## Use class methods problem_data$getData("features") problem_data$getFeatureAmount() problem_data$getFeatureNames() problem_data$getMonitoringCosts() problem_data$getPlanningUnitsAmount() problem_data$getActionCosts() problem_data$getThreatNames() problem_data$getThreatsAmount() problem_data$print()
Return one solution per instance for different values of blm. Like
prioriactions()
function, it inherits all arguments from inputData()
,
problem()
and solve()
.
evalBlm(values = c(), ...)
evalBlm(values = c(), ...)
values |
|
... |
arguments inherited from |
evalblm()
creates and solves multiple instances, of the corresponding
multi-actions planning problem, for different values of blm. Alternatively, this
could be obtained by executing function prioriactions()
or by steps the inputData()
,
problem()
and solve()
functions; using, in each run, different blm values.
However, the evalblm()
function has two advantages with
respect to this manual approach: : 1)
it is more efficient to create the models (this is because the model is created
just once and, at each iteration, only the blm values are updated); and 2) the
output is a portfolio object, which allows
obtaining information about the group of solutions (including all get functions).
An object of class portfolio.
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalBlm(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(0.0, 0.01, 0.02, 0.03), model_type = "minimizeCosts", time_limit = 50, output_file = FALSE, cores = 2) getConnectivityPenalty(port)
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalBlm(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(0.0, 0.01, 0.02, 0.03), model_type = "minimizeCosts", time_limit = 50, output_file = FALSE, cores = 2) getConnectivityPenalty(port)
Return one solution per instance for different values of budgets. This
function assumes that the maximizeBenefits option is being used (note that
the minimizeCosts option does not require setting a maximum budget). Like
prioriactions()
function, it inherits all arguments from inputData()
,
problem()
and solve()
.
evalBudget(values = c(), ...)
evalBudget(values = c(), ...)
values |
|
... |
arguments inherited from |
evalBudget()
creates and solves multiple instances, of the corresponding
multi-actions planning problem, for different values of maximum budgets. Alternatively, this
could be obtained by executing function prioriactions()
or by steps the inputData()
,
problem()
and solve()
functions; using, in each run, different budgets values.
However, the evalBudget()
function has two advantages with
respect to this manual approach: : 1)
it is more efficient to create the models (this is because the model is created
just once and, at each iteration, only the budget values are updated); and 2) the
output is a portfolio object, which allows
obtaining information about the group of solutions (including all get functions).
An object of class portfolio.
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalBudget(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(1, 10, 50, 100), time_limit = 50, output_file = FALSE, cores = 2) getSolutionBenefit(port)
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalBudget(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(1, 10, 50, 100), time_limit = 50, output_file = FALSE, cores = 2) getSolutionBenefit(port)
Return one solution per instance for different targets values. This
function assumes that the minimizeCosts model is being used. As well as the
prioriactions()
function, it inherits all arguments from inputData()
,
problem()
and solve()
.
evalTarget(values = c(), ...)
evalTarget(values = c(), ...)
values |
|
... |
arguments inherited from |
evalTarget()
creates and solves multiple instances, of the corresponding
multi-actions planning problem, for different proportions of maximum benefit values
as target values. It is assumed that the same proportion is applied for the maximum
benefit in recovery and conservation. Alternatively, this
could be obtained by executing function prioriactions()
or by steps the inputData()
,
problem()
and solve()
functions; using, in each run, different targets values.
However, the evalTarget()
function has two advantages with
respect to this manual approach: : 1)
it is more efficient to create the models (this is because the model is created
just once and, at each iteration, only the target values are updated); and 2) the
output is a portfolio object, which allows
obtaining information about the group of solutions (including all get functions).
An object of class portfolio.
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalTarget(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(0.1, 0.3, 0.5), time_limit = 50, output_file = FALSE, cores = 2) getCost(port)
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalTarget(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(0.1, 0.3, 0.5), time_limit = 50, output_file = FALSE, cores = 2) getCost(port)
Returns the spatial deployment of the actions for each planning unit of the corresponding solution.
getActions(x, format = "wide")
getActions(x, format = "wide")
x |
|
format |
|
getActions()
function assumes that actions can be of three types:
to abate specific threats: these actions have the id corresponding to the threat to be abate.
to conservation: that indicates if the planning unit is selected to conservative any feature that is not threatened.
to connectivity: that indicates if the planning unit is selected only by connectivity (i.e. without performing conservation actions or actions against a threat in said unit).
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get actions information in large format actions <- getActions(s, format = "large") head(actions) # get actions information in wide format actions <- getActions(s, format = "wide") head(actions)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get actions information in large format actions <- getActions(s, format = "large") head(actions) # get actions information in wide format actions <- getActions(s, format = "wide") head(actions)
Provides the connectivity penalty value for all actions and planning units in a solution.
getConnectivityPenalty(x)
getConnectivityPenalty(x)
x |
The connectivity penalty among is calculated as the sum of all
connectivity penalties by each action and planning unit in the solution. This can be expressed
mathematically for a set of planning units
indexed by
and
, and
a set of threats
indexed by
as:
Where, is the decisions variable that specify
whether an action has been selected to abate threat
in planning unit
(1) or not (0),
is the connectivity penalty that applies
when a solution contains planning unit
but not
o viceversa.
Note that there is an action per threat, so it is assumed that the index of the threat coincides with the index of the action used to abate it.
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 0.03) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get connectivity penalty values getConnectivityPenalty(s)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 0.03) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get connectivity penalty values getConnectivityPenalty(s)
Provides the sum of costs to actions and monitoring applied in a solution.
getCost(x)
getCost(x)
x |
The cost value is calculated as the sum of all the individual costs
of actions and monitoring carried out in each of the planning units. This can be expressed
mathematically for a set of planning units
indexed by
, and
a set of threats
indexed by
as:
Where, is the decisions variable that specify
whether an action has been selected to abate threat
in planning unit
(1) or not (0),
is the action cost to abate threat
in planning unit
and
is the monitoring cost of
planning unit
. The cost of monitoring is applied to all planning units
where some type of action has been selected (conservation action, to abate threats
or connectivity).
Note that there is an action per threat, so it is assumed that the index of the threat coincides with the index of the action used to abate it.
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) ## Get costs getCost(s)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) ## Get costs getCost(s)
Provides general information about the mathematical model.
getModelInfo(x)
getModelInfo(x)
x |
optimizationProblem, solution or portfolio object. |
getModelInfo()
function returns five specific fields:
solution_name: indicates the name of the solution, by default is sol.
model_sense: returns the optimization sense (i.e., it indicates whether the objective function is minimized or maximize).
n_constraints: returns the number of constraints in the corresponding mathematical optimization model.
n_variables: returns the number of variables in the corresponding mathematical optimization model.
size: returns the size of the constraints' coefficients matrix A number of constraints and number of variables).
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) # get model information getModelInfo(problem_model)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) # get model information getModelInfo(problem_model)
Provides general information about the process of solving.
getPerformance(x)
getPerformance(x)
x |
getPerformance()
function returns five specific fields:
solution_name: indicates the name of the solution, by default is sol.
objective_value: indicates the value of the objective function of a given solution.
This value depends on the type of model solved (more information in the problem()
function).
gap: returns the relative MIP optimality gap of a solution. It is measured as the ratio between the objective function induced by the best known (primal solution) integer solution and the objective function induced by the best node in the search tree (dual solution).
solving_time: indicates the solving time of mathematical model.
status: provides the status of solver at the end of the optimization period. This can have six states:
Optimal solution (according to gap tolerance) : When the resolution of the model stop when
the quality of the solution (gap) is less than or equal to gap_limit (parameter of the solve()
function).
No solution (model was proven to be infeasible or unbounded): When the model is infeasible.
Feasible solution (according to time limit): When the resolution of the model stops when a
time_limit has been reached finding a feasible solution (parameter of the solve()
function).
No solution (according to time limit): When the resolution of the model stops when a time_limit
has been reached without finding a feasible solution (parameter of the solve()
function).
First feasible solution: When the resolution of the model stops when it has found the first
feasible solution (solution_limit = TRUE parameter in solve()
function).
No solution information is available: For any other case.
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get solution gap getPerformance(s)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get solution gap getPerformance(s)
Provides the maximum values of benefits to achieve for each feature given a set of data inputs.
getPotentialBenefit(x)
getPotentialBenefit(x)
x |
|
For a given feature , let
be the set of planning units associated with
,
let
is the amount of feature
in planning unit
, let
be the
set of threats associated with
, and let
be the set of threats associated with
.
The local benefit associated with
in a unit
is given by:
Where is a decision variable such that
if an
action againts threat
is applied in unit
, and
, otherwise.
This expression for the probability of persistence of the feature (
)
is defined only for the cases where we work with values of binary intensities
(presence or absence of threats). See the sensitivities
vignette to know the work with continuous intensities.
While the total benefit is calculated as the sum of the local benefits per feature:
Since the potential benefit is being calculated, all variables are assumed to be equal
to 1; that is, all possible actions are carried out, and only those that have a lock-out
status are kept out of the planning (see
inputData()
function for more information).
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Get maximum benefits to obtain getPotentialBenefit(problem_data)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Get maximum benefits to obtain getPotentialBenefit(problem_data)
Returns the total benefit induced by the corresponding solution. The total benefit is computed as the sum of the benefits obtained, for all features, across all the units in the planning area.
getSolutionBenefit(x, type = "total")
getSolutionBenefit(x, type = "total")
x |
|
type |
|
For a given feature , let
be the set of planning units associated with
,
let
is the amount of feature
in planning unit
, let
be the
set of threats associated with
, and let
be the set of threats associated with
.
The local benefit associated with
in a unit
is given by:
Where is a decision variable such that
if an
action againts threat
is applied in unit
, and
, otherwise.
This expression for the probability of persistence of the feature (
)
is defined only for the cases where we work with values of binary intensities
(presence or absence of threats). See the sensitivities
vignette to know the work with continuous intensities.
While the total benefit is calculated as the sum of the local benefits per feature:
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Get maximum benefits to obtain getPotentialBenefit(problem_data) ## Create optimization model problem_model <- problem(x = problem_data) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get local benefits of solution local_benefit <- getSolutionBenefit(s, type = "local") head(local_benefit) # get total benefits of solution total_benefit <- getSolutionBenefit(s, type = "total") head(total_benefit)
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Get maximum benefits to obtain getPotentialBenefit(problem_data) ## Create optimization model problem_model <- problem(x = problem_data) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 2, output_file = FALSE, cores = 2) # get local benefits of solution local_benefit <- getSolutionBenefit(s, type = "local") head(local_benefit) # get total benefits of solution total_benefit <- getSolutionBenefit(s, type = "total") head(total_benefit)
Create the data object with information about the multi-action conservation planning problem. This function is used to specify all the data that defines the spatial prioritization problem (planning units data, feature data, threats data, and their spatial distributions.)
inputData(pu, features, dist_features, threats, dist_threats, ...) ## S4 method for signature ## 'data.frame,data.frame,data.frame,data.frame,data.frame' inputData( pu, features, dist_features, threats, dist_threats, sensitivity = NULL, boundary = NULL )
inputData(pu, features, dist_features, threats, dist_threats, ...) ## S4 method for signature ## 'data.frame,data.frame,data.frame,data.frame,data.frame' inputData( pu, features, dist_features, threats, dist_threats, sensitivity = NULL, boundary = NULL )
pu |
Object of class
|
features |
Object of class The Note that by default only information on recovery targets is necessary,
while conservation targets equal to zero are assumed. The maximum values of
benefits to achieve both recovery and conservation per feature can be verified
with the This file must contain the following columns:
|
dist_features |
Object of class
|
threats |
Object of class
|
dist_threats |
Object of class
|
... |
Unused arguments, reserved for future expansion. |
sensitivity |
(optional) Object of class Sensitivity can be parameterized in two ways: binary; the feature is
sensitive or not, or continuous; with response curves of the probability of
persistence of the features to threats. For the first case, it is only necessary
to indicate the ids of the threats and the respective features sensitive to them.
In the second case, the response can be parameterized through four values:
Note that optional parameters delta1, delta2, delta3 and delta4 can be provided independently. |
boundary |
(optional) Object of class
|
An object of class data.
Ball I, Possingham H, Watts, M. Marxan and relatives: software for spatial conservation prioritization. Spatial conservation prioritisation: quantitative methods and computational tools 2009.
For more information on the correct format for Marxan input data, see the official Marxan website and Ball et al. (2009).
## set seed for reproducibility set.seed(14) ## Set prioriactions path prioriactions_path <- system.file("extdata/example_input/", package = "prioriactions") ## Load in planning unit data pu_data <- data.table::fread(paste0(prioriactions_path,"/pu.dat"), data.table = FALSE) head(pu_data) ## Load in feature data features_data <- data.table::fread(paste0(prioriactions_path,"/features.dat"), data.table = FALSE) head(features_data) ## Load in planning unit vs feature data dist_features_data <- data.table::fread(paste0(prioriactions_path,"/dist_features.dat"), data.table = FALSE) head(dist_features_data) ## Load in the threats data threats_data <- data.table::fread(paste0(prioriactions_path,"/threats.dat"), data.table = FALSE) head(threats_data) ## Load in the threats distribution data dist_threats_data <- data.table::fread(paste0(prioriactions_path,"/dist_threats.dat"), data.table = FALSE) head(dist_threats_data) ## Load in the sensitivity data sensitivity_data <- data.table::fread(paste0(prioriactions_path,"/sensitivity.dat"), data.table = FALSE) head(sensitivity_data) ## Load in the boundary data boundary_data <- data.table::fread(paste0(prioriactions_path,"/boundary.dat"), data.table = FALSE) head(boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Summary print(problem_data)
## set seed for reproducibility set.seed(14) ## Set prioriactions path prioriactions_path <- system.file("extdata/example_input/", package = "prioriactions") ## Load in planning unit data pu_data <- data.table::fread(paste0(prioriactions_path,"/pu.dat"), data.table = FALSE) head(pu_data) ## Load in feature data features_data <- data.table::fread(paste0(prioriactions_path,"/features.dat"), data.table = FALSE) head(features_data) ## Load in planning unit vs feature data dist_features_data <- data.table::fread(paste0(prioriactions_path,"/dist_features.dat"), data.table = FALSE) head(dist_features_data) ## Load in the threats data threats_data <- data.table::fread(paste0(prioriactions_path,"/threats.dat"), data.table = FALSE) head(threats_data) ## Load in the threats distribution data dist_threats_data <- data.table::fread(paste0(prioriactions_path,"/dist_threats.dat"), data.table = FALSE) head(dist_threats_data) ## Load in the sensitivity data sensitivity_data <- data.table::fread(paste0(prioriactions_path,"/sensitivity.dat"), data.table = FALSE) head(sensitivity_data) ## Load in the boundary data boundary_data <- data.table::fread(paste0(prioriactions_path,"/boundary.dat"), data.table = FALSE) head(boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Summary print(problem_data)
This class encodes the corresponding optimization model. It is created
using problem()
function.
No return value.
list
object containing data
of the mathematical model.
object of class
data-class()
that contains the data input.
character
name)vector()
. Object stored in the data
field with the
corresponding name
. The data correspond to the different parts of
the mathematical model. The argument name
can be made to the
following: "obj", "rhs", "sense", "vtype", "A", "bounds" or "modelsense".
list()
of
vector()
. Object stored in the data
. It contains all information relative
to the mathematical model, such as "obj", "rhs", etc.
Print basic information of the optimization model.
Call print method.
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Use class methods head(problem_model$getData("obj")) problem_model$print()
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Use class methods head(problem_model$getData("obj")) problem_model$print()
This class encodes for the solutions obtained when solving
multiple instances. This includes several methods
to obtain information about both the optimization process and the solution associated with
the planning units and conservation actions. It is created using the eval functions
(e.g. evalTarget()
or evalBudget()
).
No return value.
list
. Object containing data on the results of the optimization process.
character
. Label indicating the name of solutions.
Print basic information of the model solution.
Call print method.
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalBlm(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(0.0, 0.01, 0.02, 0.03), model_type = "minimizeCosts", time_limit = 50, output_file = FALSE, cores = 2) ## Use class methods port$getNames() port$print()
# set seed for reproducibility set.seed(14) ## Create model and solve port <- evalBlm(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, values = c(0.0, 0.01, 0.02, 0.03), model_type = "minimizeCosts", time_limit = 50, output_file = FALSE, cores = 2) ## Use class methods port$getNames() port$print()
Displays information about an object.
## S3 method for class 'Data' print(x, ...) ## S3 method for class 'OptimizationProblem' print(x, ...) ## S3 method for class 'Solution' print(x, ...) ## S3 method for class 'Portfolio' print(x, ...)
## S3 method for class 'Data' print(x, ...) ## S3 method for class 'OptimizationProblem' print(x, ...) ## S3 method for class 'Solution' print(x, ...) ## S3 method for class 'Portfolio' print(x, ...)
x |
Any object. |
... |
Not used. |
None.
Create and solve a multi-actions planning problem. It can be used
instead of following the sequence of the inputData()
, problem()
and solve()
functions.
prioriactions(...)
prioriactions(...)
... |
arguments inherited from |
An object of class solution.
## This example uses input files included into package. ## set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance s <- prioriactions(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, model_type = "minimizeCosts", time_limit = 50, output_file = FALSE, cores = 2) print(s)
## This example uses input files included into package. ## set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance s <- prioriactions(pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data, model_type = "minimizeCosts", time_limit = 50, output_file = FALSE, cores = 2) print(s)
Create an optimization model for the multi-action conservation planning problem, following the mathematical formulations used in Salgado-Rojas et al. (2020).
problem( x, model_type = "minimizeCosts", budget = 0, blm = 0, curve = 1, segments = 3 )
problem( x, model_type = "minimizeCosts", budget = 0, blm = 0, curve = 1, segments = 3 )
x |
data object. Data used in a problem of
prioritization of multiple conservation actions. This object must be created using the
|
model_type |
|
budget |
|
blm |
|
curve |
|
segments |
|
Currently the problem function allows you to create two types of mathematical programming models:
This model seeks to find the set of actions that minimizes the overall planning costs, while meeting a set of representation targets for the conservation features.
This model can be expressed mathematically for a set of planning units
indexed by
a set of features
indexed by
, and
a set of threats
indexed by
as:
Where, is a decisions variable that specifies whether an action to abate
threat
in planning unit
has been selected (1) or not (0),
is the cost of the action to abate the threat
in the planning unit
,
is the monitoring cost of planning unit
,
is the probability of persistence of the feature
in the planning unit
(ranging between 0 and 1),
is the amount of
feature
in planning unit
.
is the recovery target for feature
.
In the case of working with conservation target, the following constraint is necessary:
With, as the probability of persistence by conservation of the feature s in the planning unit i
(ranging between 0 and 1). It is only present when there is no spatial co-occurrence between
a feature and its threats (i.e.
). In the case of binary threat
intensities it is assumed as 1.
is the
conservation target for feature
.
The maximize benefits model seeks to find the set of actions that maximizes the sum of benefits of all features, while the cost of performing actions and monitoring does not exceed a certain budget. Using the terminology presented above, this model can be expressed mathematically as:
Where is the benefit of the feature
in a planning unit
and it
is calculated by multiplying the probability of persistence of the feature in the
unit by its corresponding amount, i.e.,
. When we talk about
recovering, the probability of persistence is a measure of the number of actions taken against the threats that
affect said feature. For more information on its calculation, see the
getSolutionBenefit()
or getPotentialBenefit()
functions references.
As a way of including the risk associated with calculating our probability of
persistence of the features and in turn, avoiding that many low probabilities
of persistence end up reaching the proposed targets, is that we add the curve
parameter. That incorporates an exponent (values of 1: linear, 2: quadratic
or 3: cubic) to the calculation of the probability of persistence. Thus penalizing
the low probabilities in the sum of the benefits achieved.
Since prioriactions
works with linear models, we use a piecewise linearization strategy to
work with non-linear curves in . The
segments
parameter indicates how well the expression
approximates the curved used in . A higher number implies a better
approximation but increases the resolution complexity. Note that for a linear curve
(
curve
= 1) it is not necessary to set a segment
parameter.
Parameters blm
and blm_actions
allow controlling the spatial connectivity
of the selected units and of the deployed actions, respectively (similar to BLM in Marxan).
An object of class optimizationProblem.
For more information regarding the arguments
curve
and segments
, see the supplementary material
of Salgado-Rojas et al. (2020)..
## This example uses input files included into package. ## set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create minimizeCosts model model_min <- problem(x = problem_data, blm = 1, model_type = "minimizeCosts") #' ## Create maximazeBenefits model model_max <- problem(x = problem_data, model_type = "maximizeBenefits", budget = 100)
## This example uses input files included into package. ## set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create minimizeCosts model model_min <- problem(x = problem_data, blm = 1, model_type = "minimizeCosts") #' ## Create maximazeBenefits model model_max <- problem(x = problem_data, model_type = "maximizeBenefits", budget = 100)
Display information about an object.
## S4 method for signature 'Data' show(x) ## S4 method for signature 'OptimizationProblem' show(x) ## S4 method for signature 'Portfolio' show(x)
## S4 method for signature 'Data' show(x) ## S4 method for signature 'OptimizationProblem' show(x) ## S4 method for signature 'Portfolio' show(x)
x |
Any object. |
Simulated data for making prioritizations.
sim_pu_data
Planning units are represented as tabular data.
sim_features_data
Features are represented as tabular data.
sim_dist_features_data
The simulated distribution of four features.
sim_threats_data
Threats are represented as tabular data.
sim_dist_threats_data
The simulated threats of two threats.
sim_sensitivity_data
Sensitivity of features to threats as tabular data.
sim_boundary_data
Boundary data between one hundred planning units.
data(sim_pu_data) data(sim_features_data) data(sim_dist_features_data) data(sim_threats_data) data(sim_dist_threats_data) data(sim_sensitivity_data) data(sim_boundary_data)
data(sim_pu_data) data(sim_features_data) data(sim_dist_features_data) data(sim_threats_data) data(sim_dist_threats_data) data(sim_sensitivity_data) data(sim_boundary_data)
data.frame object.
data.frame object.
data.frame object.
data.frame object.
data.frame object.
data.frame object.
data.frame object.
## Not run: # load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) # plot examples library(raster) r <- raster::raster(ncol=10, nrow=10, xmn=0, xmx=10, ymn=0, ymx=10) # plot cost of pu's values(r) <- sim_pu_data$monitoring_cost plot(r) # plot feature distribution of feature 1 features <- tidyr::spread(data = sim_dist_features_data, key = feature, value = amount, fill = 0) values(r) <- features$'1' plot(r) ## End(Not run)
## Not run: # load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) # plot examples library(raster) r <- raster::raster(ncol=10, nrow=10, xmn=0, xmx=10, ymn=0, ymx=10) # plot cost of pu's values(r) <- sim_pu_data$monitoring_cost plot(r) # plot feature distribution of feature 1 features <- tidyr::spread(data = sim_dist_features_data, key = feature, value = amount, fill = 0) values(r) <- features$'1' plot(r) ## End(Not run)
This class is used to represent the solution of the MIP (Mixed-Integer Programming) model.
This includes several methods
to obtain information about both the optimization process and the solution associated with
the planning units and actions. It is created using the solve()
function.
No return value.
list
. Object containing data on the results of the optimization process.
Print basic information of the model solution.
Call print method.
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 5, output_file = FALSE, cores = 2) ## Use class methods s$print()
# set seed for reproducibility set.seed(14) ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Solve the optimization model s <- solve(a = problem_model, time_limit = 5, output_file = FALSE, cores = 2) ## Use class methods s$print()
Solves the optimization model associated with the multi-action
conservation planning problem. This function is used to solve
the mathematical model created by the problem()
function.
solve( a, solver = "", gap_limit = 0, time_limit = .Machine$integer.max, solution_limit = FALSE, cores = 2, verbose = TRUE, name_output_file = "output", output_file = TRUE )
solve( a, solver = "", gap_limit = 0, time_limit = .Machine$integer.max, solution_limit = FALSE, cores = 2, verbose = TRUE, name_output_file = "output", output_file = TRUE )
a |
optimizationProblem object. Optimization model created
for the problem of prioritization of multiple conservation actions. This object must be
created using the |
solver |
|
gap_limit |
|
time_limit |
|
solution_limit |
|
cores |
|
verbose |
|
name_output_file |
|
output_file |
|
The solvers supported by the solve()
function are
described below.
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, also this solver 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.
CPLEX solver
cplex is a state-of-the-art commercial optimization software with an R package interface. Like Gurobi, it is not freely accessible, but we can obtain academic licenses. We recommend using this solver if the Gurobi solver is not available. Licenses are available for the IBM CPLEX software to academics at no cost here. This solver uses the Rcplex package to solve problems.
CBC solver
CBC is an open-source mixed integer linear programming solver written in C++. It is part of the Computational Infrastructure for Operations Research (COIN-OR) project interface. rcbc package to solve problems is now available only on Github. Please ensure that you closely adhere to the detailed installation instructions provided here for proper setup.
Symphony 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.
An object of class solution.
For more information on how to install and obtain an academic license of the Gurobi solver, see the Gurobi installation guide, which can be found online at prioritizr vignette. Just like Gurobi, cplex needs an academic licence to work. Details about how to install the cplex solver, see the webpage IBM CPLEX. Once installed, see the Rcplex installation guide, which can be found online at Rcplex package.
## Not run: ## This example uses input files included into package. ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Solve the optimization model using a gap_limit and gurobi solver ## NOTE: The Gurobi solver must be previously installed and must have a valid license! s1 <- solve(a = problem_model, solver = "gurobi", gap_limit = 0.01, output_file = FALSE, cores = 2) print(s1) ## Solve the optimization model using a gap_limit and symphony solver s2 <- solve(a = problem_model, solver = "symphony", gap_limit = 0.01, output_file = FALSE, cores = 2) print(s2) ## Solve the optimization model using a time_limit and gurobi solver s3 <- solve(a = problem_model, solver = "gurobi", time_limit = 10, output_file = FALSE, cores = 2) print(s3) ## End(Not run)
## Not run: ## This example uses input files included into package. ## Load data data(sim_pu_data, sim_features_data, sim_dist_features_data, sim_threats_data, sim_dist_threats_data, sim_sensitivity_data, sim_boundary_data) ## Create data instance problem_data <- inputData( pu = sim_pu_data, features = sim_features_data, dist_features = sim_dist_features_data, threats = sim_threats_data, dist_threats = sim_dist_threats_data, sensitivity = sim_sensitivity_data, boundary = sim_boundary_data ) ## Create optimization model problem_model <- problem(x = problem_data, blm = 1) ## Solve the optimization model using a gap_limit and gurobi solver ## NOTE: The Gurobi solver must be previously installed and must have a valid license! s1 <- solve(a = problem_model, solver = "gurobi", gap_limit = 0.01, output_file = FALSE, cores = 2) print(s1) ## Solve the optimization model using a gap_limit and symphony solver s2 <- solve(a = problem_model, solver = "symphony", gap_limit = 0.01, output_file = FALSE, cores = 2) print(s2) ## Solve the optimization model using a time_limit and gurobi solver s3 <- solve(a = problem_model, solver = "gurobi", time_limit = 10, output_file = FALSE, cores = 2) print(s3) ## End(Not run)