Learn R Programming

oppr (version 1.0.0)

weights: Weights

Description

Weights are used to specify the relative importance for specific features persisting into the future. Please note that only some objectives require weights, and attempting to solve a problem that does not require weights will throw a warning and the weights will be ignored.

Arguments

Details

Currently, only one function can be used to specify weights:

add_feature_weights

Set feature weights for a project prioritization problem.

See Also

constraints, decisions, objectives, problem, solvers, targets.

Examples

Run this code
# NOT RUN {
# load data
data(sim_projects, sim_features, sim_actions)

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

# }
# NOT RUN {
# solve problem
s <- solve(p)

# print solution
print(s)

# plot solution
plot(p, s)
# }

Run the code above in your browser using DataLab