compile: Compile a problem

View source: R/compile.R

compileR Documentation

Compile a problem

Description

Compile a project prioritization problem() into a general purpose format for optimization.

Usage

compile(x, ...)

## S3 method for class 'ProjectProblem'
compile(x, ...)

Arguments

x

ProjectProblem object.

...

not used.

Details

This function might be useful for those interested in understanding how their project prioritization problem() is expressed as a mathematical problem. However, if the problem just needs to be solved, then the solve() function should be used instead.

Value

OptimizationProblem object.

Examples

# load data
data(sim_projects, sim_features, sim_actions)

# build problem with maximum richness objective, $200 budget, and
# binary decisions
p <- problem(sim_projects, sim_actions, sim_features,
             "name", "success", "name", "cost", "name") %>%
     add_max_richness_objective(budget = 200) %>%
     add_binary_decisions()

# print problem
print(p)

# compile problem
o <- compile(p)

# print compiled problem
print(o)

prioritizr/ppr documentation built on Sept. 10, 2022, 1:18 p.m.