View source: R/add_single_portfolio.R
| add_single_portfolio | R Documentation |
Generate a portfolio containing a single solution.
add_single_portfolio(x)
x |
|
An updated problem() object with the portfolio added to it.
Other functions for adding portfolios:
add_cuts_portfolio(),
add_default_portfolio(),
add_extra_portfolio(),
add_gap_portfolio(),
add_shuffle_portfolio(),
add_top_portfolio()
# 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_single_portfolio() %>%
add_default_solver(gap = 0, verbose = FALSE)
# solve problem
s <- solve(p)
# plot solution
plot(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.