Set the objective of a conservation planning problem() to minimize the cost of the solution whilst ensuring that all targets are met. This objective is similar to that used in Marxan and is detailed in Rodrigues et al. (2000).

add_min_set_objective(x)

## Arguments

x problem() (i.e. ConservationProblem) object.

## Value

Object (i.e. ConservationProblem) with the objective added to it.

## Details

A problem objective is used to specify the overall goal of the conservation planning problem. Please note that all conservation planning problems formulated in the prioritizr package require the addition of objectives---failing to do so will return an error message when attempting to solve problem.

In the context of systematic reserve design, the minimum set objective seeks to find the set of planning units that minimizes the overall cost of a reserve network, while meeting a set of representation targets for the conservation features. This objective is equivalent to a simplified Marxan reserve design problem with the Boundary Length Modifier (BLM) set to zero.

The minimum set objective for the reserve design problem can be expressed mathematically for a set of planning units ($$I$$ indexed by $$i$$) and a set of features ($$J$$ indexed by $$j$$) as:

$$\mathit{Minimize} \space \sum_{i = 1}^{I} x_i c_i \\ \mathit{subject \space to} \\ \sum_{i = 1}^{I} x_i r_{ij} \geq T_j \space \forall \space j \in J$$

Here, $$x_i$$ is the decisions variable (e.g. specifying whether planning unit $$i$$ has been selected (1) or not (0)), $$c_i$$ is the cost of planning unit $$i$$, $$r_{ij}$$ is the amount of feature $$j$$ in planning unit $$i$$, and $$T_j$$ is the target for feature $$j$$. The first term is the objective function and the second is the set of constraints. In words this says find the set of planning units that meets all the representation targets while minimizing the overall cost.

Rodrigues AS, Cerdeira OJ, and Gaston KJ (2000) Flexibility, efficiency, and accountability: adapting reserve selection algorithms to more complex conservation problems. Ecography, 23: 565--574.

## Examples

# set seed for reproducibility
set.seed(500)

data(sim_pu_raster, sim_features, sim_pu_zones_stack, sim_features_zones)

# create minimal problem with minimum set objective
p1 <- problem(sim_pu_raster, sim_features) %>%
# \dontrun{
# solve problem
s1 <- solve(p1)#> Gurobi Optimizer version 9.0.2 build v9.0.2rc0 (linux64)
#> Optimize a model with 5 rows, 90 columns and 450 nonzeros
#> Model fingerprint: 0x6442bf6e
#> Variable types: 0 continuous, 90 integer (90 binary)
#> Coefficient statistics:
#>   Matrix range     [2e-01, 9e-01]
#>   Objective range  [2e+02, 2e+02]
#>   Bounds range     [1e+00, 1e+00]
#>   RHS range        [3e+00, 8e+00]
#> Found heuristic solution: objective 2337.9617505
#> Presolve time: 0.00s
#> Presolved: 5 rows, 90 columns, 450 nonzeros
#> Variable types: 0 continuous, 90 integer (90 binary)
#> Presolved: 5 rows, 90 columns, 450 nonzeros
#>
#>
#> Root relaxation: objective 1.931582e+03, 12 iterations, 0.00 seconds
#>
#>     Nodes    |    Current Node    |     Objective Bounds      |     Work
#>  Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time
#>
#>      0     0 1931.58191    0    4 2337.96175 1931.58191  17.4%     -    0s
#> H    0     0                    1987.3985265 1931.58191  2.81%     -    0s
#>
#> Explored 1 nodes (12 simplex iterations) in 0.00 seconds
#> Thread count was 1 (of 4 available processors)
#>
#> Solution count 2: 1987.4 2337.96
#>
#> Optimal solution found (tolerance 1.00e-01)
#> Best objective 1.987398526526e+03, best bound 1.931581908865e+03, gap 2.8085%
# plot solution
plot(s1, main = "solution", axes = FALSE, box = FALSE) # }

# create multi-zone problem with minimum set objective
targets_matrix <- matrix(rpois(15, 1), nrow = 5, ncol = 3)

p2 <- problem(sim_pu_zones_stack, sim_features_zones) %>%
# \dontrun{
# solve problem
s2 <- solve(p2)#> Gurobi Optimizer version 9.0.2 build v9.0.2rc0 (linux64)
#> Optimize a model with 105 rows, 270 columns and 1620 nonzeros
#> Model fingerprint: 0xa65df5d2
#> Variable types: 0 continuous, 270 integer (270 binary)
#> Coefficient statistics:
#>   Matrix range     [2e-01, 1e+00]
#>   Objective range  [2e+02, 2e+02]
#>   Bounds range     [1e+00, 1e+00]
#>   RHS range        [1e+00, 3e+00]
#> Found heuristic solution: objective 3524.7950998
#> Presolve removed 7 rows and 0 columns
#> Presolve time: 0.00s
#> Presolved: 98 rows, 270 columns, 990 nonzeros
#> Variable types: 0 continuous, 270 integer (270 binary)
#> Presolved: 98 rows, 270 columns, 990 nonzeros
#>
#>
#> Root relaxation: objective 2.642776e+03, 9 iterations, 0.00 seconds
#>
#>     Nodes    |    Current Node    |     Objective Bounds      |     Work
#>  Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time
#>
#>      0     0 2642.77567    0    5 3524.79510 2642.77567  25.0%     -    0s
#> H    0     0                    2875.8073247 2642.77567  8.10%     -    0s
#>
#> Explored 1 nodes (9 simplex iterations) in 0.00 seconds
#> Thread count was 1 (of 4 available processors)
#>
#> Solution count 2: 2875.81 3524.8
#>
#> Optimal solution found (tolerance 1.00e-01)
#> Best objective 2.875807324677e+03, best bound 2.642775673413e+03, gap 8.1032%
# plot solution
plot(category_layer(s2), main = "solution", axes = FALSE, box = FALSE) # }