View source: R/marxan_problem.R
| marxan_problem | R Documentation |
Create a conservation planning problem() following the
mathematical formulations used in Marxan (detailed in Beyer
et al. 2016). Note that these problems are solved using
exact algorithms and not simulated annealing (i.e., the Marxan software).
Please note that the vroom package is required to import Marxan data
files.
marxan_problem(x, ...)
## Default S3 method:
marxan_problem(x, ...)
## S3 method for class 'data.frame'
marxan_problem(x, spec, puvspr, bound = NULL, blm = 0, symmetric = TRUE, ...)
## S3 method for class 'character'
marxan_problem(x, ...)
x |
|
... |
not used. |
spec |
'
|
puvspr |
|
bound |
|
blm |
|
symmetric |
|
This function is provided as a convenient interface for solving
Marxan problems using the prioritizr package. Note that this
function does not support all of the functionality provided by the
Marxan software. In particular, only the following parameters
supported: "INPUTDIR", "SPECNAME", "PUNAME", "PUVSPRNAME", "BOUNDNAME", "BLM", and "ASYMMETRICCONNECTIVITY". Additionally, for the species data (i.e., argument to spec), only the "id", "name", "prop", and "amount"' columns are considered.
A problem() object.
In previous versions, this function could not accommodate asymmetric connectivity data. It has now been updated to handle asymmetric connectivity data.
Ball IR, Possingham HP, and Watts M (2009) Marxan and relatives: Software for spatial conservation prioritisation in Spatial conservation prioritisation: Quantitative methods and computational tools. Eds Moilanen A, Wilson KA, and Possingham HP. Oxford University Press, Oxford, UK.
Beyer HL, Dujardin Y, Watts ME, and Possingham HP (2016) Solving conservation planning problems with integer linear programming. Ecological Modelling, 228: 14–22.
Serra N, Kockel A, Game ET, Grantham H, Possingham HP, and McGowan J (2020) Marxan User Manual: For Marxan version 2.43 and above. The Nature Conservancy (TNC), Arlington, Virginia, United States and Pacific Marine Analysis and Research Association (PacMARA), Victoria, British Columbia, Canada.
For more information on the correct format for for Marxan input data, see the official Marxan website, Ball et al. (2009), Serra et al. (2020).
# create Marxan problem using Marxan input file
# (note this example requires the vroom package to be installed)
## Not run:
input_file <- system.file("extdata/marxan/input.dat", package = "prioritizr")
p1 <-
marxan_problem(input_file) %>%
add_default_solver(verbose = FALSE)
# solve problem
s1 <- solve(p1)
# print solution
head(s1)
# create Marxan problem using data.frames that have been loaded into R
# (note this example also requires the vroom package to be installed)
## load in planning unit data
pu_path <- system.file("extdata/marxan/input/pu.dat", package = "prioritizr")
pu_dat <- vroom::vroom(pu_path)
head(pu_dat)
## load in feature data
spec_path <- system.file(
"extdata/marxan/input/spec.dat", package = "prioritizr"
)
spec_dat <- vroom::vroom(spec_path)
head(spec_dat)
## load in planning unit vs feature data
puvspr_path <- system.file(
"extdata/marxan/input/puvspr.dat", package = "prioritizr"
)
puvspr_dat <- vroom::vroom(puvspr_path)
head(puvspr_dat)
## load in the boundary data
bound_path <- system.file(
"extdata/marxan/input/bound.dat", package = "prioritizr"
)
bound_dat <- vroom::vroom(bound_path)
head(bound_dat)
# create problem without the boundary data
p2 <-
marxan_problem(pu_dat, spec_dat, puvspr_dat) %>%
add_default_solver(verbose = FALSE)
# solve problem
s2 <- solve(p2)
# print solution
head(s2)
# create problem with the boundary data and a boundary length modifier
# set to 5
p3 <-
marxan_problem(pu_dat, spec_dat, puvspr_dat, bound_dat, blm = 5) %>%
add_default_solver(verbose = FALSE)
# solve problem
s3 <- solve(p3)
# print solution
head(s3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.