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

compile(x, ...)

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

Arguments

x

ProjectProblem object.

...

not used.

Value

OptimizationProblem object.

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.

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)
#> Project Prioritization Problem
#>   actions          F1_action, F2_action, F3_action, ... (6 actions)
#>   projects         F1_project, F2_project, F3_project, ... (6 projects)
#>   features         F1, F2, F3, ... (5 features)
#>   action costs:    min: 0, max: 103.22583
#>   project success: min: 0.81379, max: 1
#>   objective:       Maximum richness objective [budget (200)]
#>   targets:         none
#>   weights:         default
#>   decisions        Binary decision 
#>   constraints:     <none>
#>   solver:          default

# compile problem
o <- compile(p)

# print compiled problem
print(o)
#> optimization problem
#>   objective:    linear
#>   model sense: max
#>   dimensions:  47, 47, 103 (nrow, ncol, ncell)
#>   variables:   42 (B), 5 (S)