Skip to contents

Specify that a restoration problem (restopt_problem()) should satisfy the constraints without optimization objective.

Usage

set_no_objective(problem)

Arguments

problem

restopt_problem() Restoration problem object.

Value

An updated restoration problem (restopt_problem()) object.

Details

Using set_no_objective() in a restopt problem, the solver will return the first solution found satisfying the constraint, without any optimization objective. This "no objective" setting is set by default when creating a restopt problem.

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
  ) %>% set_no_objective()

# 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 = 0
#>   - nb_solutions = 1
#>   - optimality_gap = 0
#>   - solution_name_prefix = Solution  
#> ----------------------------------------------------------------- 

# Solve problem
s <- solve(p)
#> Good news: the solver found 1 solution satisfying the constraints ! (solving time = 0.1 s)
# plot solution
plot(s)

# }