solution_statistics {oppr} | R Documentation |
Solution statistics
Description
Calculate statistics describing a solution to a project prioritization
problem()
.
Usage
solution_statistics(x, solution)
Arguments
x |
project prioritization |
solution |
|
Value
A tibble::tibble()
table containing the following
columns:
"cost"
numeric
cost of each solution."obj"
numeric
objective value for each solution. This is calculated using the objective function defined for the argument tox
.x$project_names()
numeric
column for each project indicating if it was completely funded (with a value of 1) or not (with a value of 0).x$feature_names()
numeric
column for each feature indicating the probability that it will persist into the future given each solution.
See Also
objectives, replacement_costs()
,
project_cost_effectiveness()
.
Examples
# load data
data(sim_projects, sim_features, sim_actions)
# print project data
print(sim_projects)
# print action data
print(sim_features)
# print feature data
print(sim_actions)
# build problem
p <- problem(sim_projects, sim_actions, sim_features,
"name", "success", "name", "cost", "name") %>%
add_max_richness_objective(budget = 400) %>%
add_feature_weights("weight") %>%
add_binary_decisions()
# print problem
print(p)
# create a table with some solutions
solutions <- data.frame(F1_action = c(0, 1, 1),
F2_action = c(0, 1, 0),
F3_action = c(0, 1, 1),
F4_action = c(0, 1, 0),
F5_action = c(0, 1, 1),
baseline_action = c(1, 1, 1))
# print the solutions
# the first solution only has the baseline action funded
# the second solution has every action funded
# the third solution has only some actions funded
print(solutions)
# calculate statistics
solution_statistics(p, solutions)