add_locked_out_constraints: Add locked out constraints

Description Usage Arguments Details Value See Also Examples

Description

Add constraints to ensure that certain planning units are not prioritized in the solution. For example, it may be useful to lock out planning units that have been degraded and are not longer suitable for conserving species.

Usage

1

Arguments

x

ConservationProblem-class object.

locked_out

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

Details

The locked out planning units can be specified in several different ways:

integer

vector of indices pertaining to which planning units should be locked out.

character

column name in the attribute table values indicating if planning units should be locked out. This option is only available if the planning units in x are a Spatial-class object. The column in the attribute table should have logical (ie. TRUE or FALSE) values indicating if the planning unit is to be locked out.

Raster-class object

planning units in x that intersect with cells in y are locked out. Specifically, only if the intersect with cells in y are that are not equal to zero or NA.

Spatial-class object.

planning units in x that spatially intersect with locked_in are locked out.

Value

ConservationProblem-class object.

See Also

constraints, penalties.

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# create basic problem
p1 <- problem(sim_pu_polygons, sim_features) %>%
  add_min_set_objective() %>%
  add_relative_targets(0.2)

# create problem with added locked out constraints using integers
p2 <- p1 %>% add_locked_out_constraints(which(sim_pu_polygons$locked_in))

# create problem with added locked out constraints using a field name
p3 <- p1 %>% add_locked_out_constraints("locked_out")

# create problem with added locked out constraints using raster data
p4 <- p1 %>% add_locked_out_constraints(sim_locked_out_raster)

# create problem with added locked out constraints using spatial polygons
# data
locked_out <- sim_pu_polygons[sim_pu_polygons$locked_out == 1,]
p5 <- p1 %>% add_locked_out_constraints(locked_out)


# solve problems
s1 <- solve(p1)
s2 <- solve(p2)
s3 <- solve(p3)
s4 <- solve(p4)
s5 <- solve(p5)

# plot solutions
par(mfrow=c(3,2))
plot(s1, main="none locked out")
plot(s1[s1$solution==1,], col="darkgreen", add=TRUE)

plot(s2, main="locked out (integer input)")
plot(s2[s2$solution==1,], col="darkgreen", add=TRUE)

plot(s3, main="locked out (character input)")
plot(s3[s3$solution==1,], col="darkgreen", add=TRUE)

plot(s4, main="locked out (raster input)")
plot(s4[s4$solution==1,], col="darkgreen", add=TRUE)

plot(s5, main="locked out (polygon input)")
plot(s5[s5$solution==1,], col="darkgreen", add=TRUE)

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