Add settings to a restoration problem (restopt_problem()
) object
to customize the optimization procedure.
Usage
add_settings(
problem,
precision = 4,
time_limit = 0,
nb_solutions = 1,
optimality_gap = 0,
solution_name_prefix = "Solution "
)
Arguments
- problem
restopt_problem()
Restoration problem object.- precision
integer
Precision for calculations. Defaults to 4.- time_limit
integer
Maximum permitted run time for optimization (seconds). Defaults to 0.- nb_solutions
integer
Number of desired solutions. Defaults to 1.- optimality_gap
numeric
Optimality gap (between 0 and 1). For example, an argument of 0.1 means that solutions should be within 10% of optimality. Defaults to 0, such that optimal solutions are returned.- solution_name_prefix
character
Prefix for the name of solutions. Defaults to "Solution "
Value
An updated restoration problem (restopt_problem()
) object.
Examples
# \donttest{
# 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 = 16,
habitat_threshold = 0.7
) %>%
add_settings(time_limit = 1, precision = 4, nb_solutions = 2)
# 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: No optimization objective
#> -----------------------------------------------------------------
#> constraints: none defined
#> -----------------------------------------------------------------
#> settings:
#> - precision = 4
#> - time_limit = 1
#> - nb_solutions = 2
#> - optimality_gap = 0
#> - solution_name_prefix = Solution
#> -----------------------------------------------------------------
# }