compile: Compile a problem

Description Usage Arguments Details Value Examples

Description

Compile a ConservationProblem-class into an OptimizationProblem-class object.

Usage

1
2
3
4
compile(x, ...)

## S3 method for class 'ConservationProblem'
compile(x, compressed_formulation = NA, ...)

Arguments

x

ConservationProblem-class object.

...

not used.

compressed_formulation

logical should the conservation problem compiled into a compressed version of a planning problem? If TRUE then the problem is expressed using the compressed formulation. If FALSE then the problem is expressed using the expanded formulation. If NA, then the compressed is used unless one of the constraints requires the expanded formulation. This argument defaults to NA.

Details

In nearly all cases, the default argument to formulation should be used. The only situation where manually setting the argument to formulation is desireable is during testing. Manually setting the argument to formulation will at best have no effect on the problem. At worst, it may result in an error, a mis-specfied problem, or unnecessarily long solve times.

Value

OptimizationProblem-class object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# build minimal conservation problem
p <- problem(sim_pu_raster, sim_features) %>%
  add_min_set_objective() %>%
  add_relative_targets(0.1)

# compile the conservation problem into an optimization problem
o <- compile(p)

# print the optimization problem
print(o)

# print the optimization problem
print(o)

prioritizr/prioritizrutils documentation built on May 25, 2019, 12:20 p.m.