marxan_problem: Marxan conservation problem

Description Usage Arguments Value Examples

Description

Create a Marxan conservation problem. Although users are encouraged to build and tailor conservation planning problems to suit their own needs, sometimes it is easier to use a more familiar "canned" approach. This function provides a convenient wrapper for generating and solving Marxan-style conservation problems. If users already have their conservation planning data in the Marxan input format, this function can also be used to read Marxan data files and solve the Marxan-style problems using exact algorithm solvers.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
marxan_problem(x, ...)

## Default S3 method:
marxan_problem(x, features, targets,
  targets_type = c("relative", "absolute"), locked_in = waiver(),
  locked_out = waiver(), penalty = 0, edge_factor = 0.5, ...)

## S3 method for class 'data.frame'
marxan_problem(x, spec, puvspr, bound = NULL, blm = 0,
  asymmetric_connectivity = FALSE, ...)

## S3 method for class 'character'
marxan_problem(x, ...)

Arguments

x

character file path for Marxan input file (typically called "input.dat"), a data.frame object containing planning unit data following conventions (ie. 'pu.dat'), or a Spatial-class or Raster-class object containing planning unit data.

...

not used

features

Raster-class object containing data on the distribution of features across the study area.

targets

numeric amount of each feature to be represented in the solution.

targets_type

character name indicating if the targets are expressed as "relative" (eg. 0.2 meaning that 20 % of a feature needs to be conserved), or "absolute" (eg. 200 meaning that 200 units of a feature need to be conserved) amounts.

locked_in

Object that determines which planning units that should be locked in. See details for more information.

locked_out

Object that determines which planning units that should be locked out. See details for more information.

penalty

numeric penalty for exposed edges. This is equivalent to the boundary length modifier (BLM) parameter in marxan.net.

edge_factor

numeric proportion to scale edges that do not have any neighboring planning units. For example, an edge factor of 0.5 is commonly used for planning units along the coast line.

spec

data.frame containing information on the features. The argument to spec must follow the conventions used by Marxan. Each row corresponds to a different feature. It must also contain the following columns:

"id"

integer unique identifier for each feature These identifiers are used in the argument to rij_data.

"name"

character name for each feature.

"prop"

numeric relative target for each feature (optional).

'

"amount"

numeric absolute target for each feature (optional).

puvspr

data.frame containing information on the amount of each feature in each planning unit. Similar to spec, the argument to puvspr must follow the conventions used by Marxan. It must contain the following columns:

"pu"

integer planning unit identifier.

"species"

integer feature identifier.

"amount"

numeric amount of the feature in the planning unit.

bound

puvspr data.frame containing information on the planning units' boundaries or the connectivity between planning units. Similar to spec, the argument to bound must follow the conventions used by Marxan. It must contain the following columns:

"id1"

integer planning unit identifier.

"id2"

integer planning unit identifier.

"boundary"

numeric length of shared boundary between planning units, or the strength of the connectivity between the two planning units.

blm

numeric boundary length modifier. This argument only has an effect when argument to x is a data.frame. Defaults to zero.

asymmetric_connectivity

logical does the argument to bound denote asymmetric connectivity between planning units? This argument only has an effect when argument to bound is a data.frame. Defaults to FALSE.

Value

ConservationProblem-class object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# create Marxan problem using spatial data
data(sim_pu_raster, sim_features)
p1 <- marxan_problem(sim_pu_raster, features=sim_features, targets=0.2,
                     targets_type="relative", penalty=1,
                     edge_factor=0.5)


# solve problem
s1 <- solve(p1)

# show solution
plot(s1)


# create marxan problem using marxan input files
input_file <- system.file("extdata/input.dat", package="prioritizrutils")
p2 <- marxan_problem(input_file)


# solve problem
s2 <- solve(p2)

# count number of selected planning units in solution
print(sum(s2))

prioritizr/prioritizrutils documentation built on May 25, 2019, 12:20 p.m.