Generate a portfolio based on defaults.
Arguments
- x
problem()object.
Value
An updated problem() object with the portfolio added to it.
Details
By default, this is portfolio is added to problem() objects if no
other portfolios is manually specified. In particular, this
function adds the add_single_portfolio() function to x so
that only a single solution is generated.
See also
Other functions for adding portfolios:
add_cuts_portfolio(),
add_extra_portfolio(),
add_gap_portfolio(),
add_shuffle_portfolio(),
add_single_portfolio(),
add_top_portfolio()
Examples
# set seed for reproducibility
set.seed(600)
# load data
sim_pu_raster <- get_sim_pu_raster()
sim_features <- get_sim_features()
# create minimal problem with default portfolio
p <-
problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.05) %>%
add_default_portfolio() %>%
add_default_solver(gap = 0, verbose = FALSE)
# solve problem
s <- solve(p)
# plot solution
plot(s)
