Set an objective to minimize the amount restoration area.
Source:R/set_min_restore_objective.R
set_min_restore_objective.Rd
Specify that a restoration problem (restopt_problem()
) should minimize
the restoration area needed to reach the habitat proportion threshold
specified in the problem description.
Arguments
- problem
restopt_problem()
Restoration problem object.
Value
An updated restoration problem (restopt_problem()
) object.
Details
The restoration area corresponds to the minimum amount of area that must be restored in the selected planning units to reach the minimum habitat proportion threshold specified in the problem description,
See also
Other objectives:
set_max_iic_objective()
,
set_max_mesh_objective()
,
set_max_nb_pus_objective()
,
set_max_restore_objective()
,
set_min_nb_pus_objective()
,
set_no_objective()
Examples
# \donttest{
# load data
habitat_data <- rast(
system.file("extdata", "habitat_hi_res.tif", package = "restoptr")
)
locked_out_data <- rast(
system.file("extdata", "locked_out.tif", package = "restoptr")
)
# plot data
plot(rast(list(habitat_data, locked_out_data)), nc = 2)
# create problem with locked out constraints
p <- restopt_problem(
existing_habitat = habitat_data,
aggregation_factor = 16,
habitat_threshold = 0.7
) %>%
set_min_restore_objective() %>%
add_restorable_constraint(
min_restore = 5,
max_restore = 5,
) %>%
add_locked_out_constraint(data = locked_out_data) %>%
add_settings(time_limit = 1)
# print problem
print(p)
#> -----------------------------------------------------------------
#> Restopt
#> -----------------------------------------------------------------
#> original habitat: habitat_hi_res.tif
#> aggregation factor: 16
#> habitat threshold: 0.7
#> existing habitat: in memory
#> restorable habitat: in memory
#> -----------------------------------------------------------------
#> objective: Minimize restoration area
#> -----------------------------------------------------------------
#> constraints:
#> - restorable (min_restore = 5, max_restore = 5, min_proportion = 1, unit = ha)
#> - locked out (data = in memory)
#> -----------------------------------------------------------------
#> settings:
#> - precision = 4
#> - time_limit = 1
#> - nb_solutions = 1
#> - optimality_gap = 0
#> - solution_name_prefix = Solution
#> -----------------------------------------------------------------
# solve problem
s <- solve(p)
#> Good news: the solver found 1 solution statisfying the constraints that was proven optimal ! (solving time = 0 s)
# plot solution
plot(s)
# }