weights | R Documentation |
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.
Currently, only one function can be used to specify weights:
add_feature_weights()
Set feature weights for a project prioritization problem()
.
constraints, decisions,
objectives, problem()
,
solvers, targets.
# 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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.