restopt_problem {restoptr} | R Documentation |
Restoration optimization problem
Description
Create a new restoration optimization problem (RestoptProblem
) using data
that describe the spatial distribution of existing habitat (potentially at
high resolution), and parameters to derive a downsampled existing habitat
raster, suitable for a tractable optimization, and a restorable habitat
raster. Constraints can be added to a restopt problem using
add_****_constraint()
functions, and an optimization objective can be set
using set_****_objective()
functions.
Usage
restopt_problem(
existing_habitat,
habitat_threshold = 1,
aggregation_factor = 1
)
Arguments
existing_habitat |
|
habitat_threshold |
|
aggregation_factor |
|
Details
This function creates the base restoration optimization problem
object, that can be further extended with constraints and optimization
objectives. One input rasters is necessary to instantiate a restopt problem:
the existing_habitat
raster (potentially with high resolution). This raster
must contains data about where are habitat areas (raster value 1
),
non-habitat areas (raster value 0
), and areas that must not be considered
during the solving procedure (NA
or NO_DATA
). The aggregation_factor
parameter is used to down sample the existing_habitat
to a resolution that
will be tractable for the optimization engine, and the habitat_threshold
parameter indicates the minimum proportion of habitat required in aggregated
habitat pixels to consider them as habitat. Note that An aggregated pixel
will contain at most aggregation_factor^2
pixels from the input habitat
raster (cell_area
raster in this function outputs). If an aggregated pixel
is close to the spatial boundaries of the problem (i.e. NA cells), it can
contain less than aggregation_factor^2
fine grained pixel. You can get
the results of this preprocessing phase using the following methods:
get_original_habitat()
(original habitat), get_existing_habitat()
(aggregated habitat), get_cell_area()
(number of pixels in each aggregated
cells), and get_restorable_area()
(amount of restorable area – in number
of original raster pixels).
Value
A new restoration problem (RestoptProblem
) object.
None.
Examples
# load data
habitat_data <- rast(
system.file("extdata", "habitat_hi_res.tif", package = "restoptr")
)
# create problem
p <- restopt_problem(
existing_habitat = habitat_data,
aggregation_factor = 4,
habitat_threshold = 0.7
)
# Plot down sampled data
plot(c(p$data$existing_habitat, p$data$restorable_habitat))
# print problem
print(p)