| get_runs | R Documentation |
Extract the run table from a solutionset-class object.
get_runs(x)
x |
A |
A run represents an attempted optimization solve. Each run has a unique
run_id. Only runs that produce a stored solution receive a
solution_id.
The solution_id is numeric and matches the corresponding
run_id. Therefore, if a run fails or is infeasible, its
solution_id is NA; if a later run succeeds, its
solution_id keeps the same value as its run_id.
This function is the user-facing place where the relationship between attempted runs and stored solutions is reported.
Objective values are not returned by get_runs(). To extract objective
values, use get_objectives.
A data.frame with one row per attempted optimization run.
The table contains run metadata and the numeric mapping between
run_id and solution_id, but not objective-value columns.
get_objectives,
solution_filter,
set_runs_grid,
set_runs_manual
# Load a complete simulated planning problem.
example_data <- load_sim_multiaction()
problem <- create_problem(
pu = example_data$planning_units,
features = example_data$features,
dist_features = example_data$dist_features,
cost = "cost"
) |>
add_actions(
example_data$actions,
cost = example_data$action_costs
) |>
add_effects(
example_data$effect_assumptions
) |>
add_constraint_targets_relative(0.05) |>
add_objective_min_cost(alias = "cost", include_pu_cost = FALSE) |>
add_objective_max_effect(alias = "benefit") |>
set_method_weighted_sum(
aliases = c("cost", "benefit"),
runs = set_runs_grid(n = 3),
normalize_weights = TRUE
)
if (requireNamespace("rcbc", quietly = TRUE)) {
problem <- set_solver_cbc(
problem,
verbose = FALSE
)
solutions <- solve(problem)
get_runs(solutions)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.