Return one solution per instance for different values of budgets. This function assumes that the maximizeBenefits option is being used (note that the minimizeCosts option does not require setting a maximum budget). Like prioriactions() function, it inherits all arguments from inputData(), problem() and solve().

evalBudget(values = c(), ...)

Arguments

values

numeric. Values of budget to verify. More than one value is needed.

...

arguments inherited from inputData(), problem(), and solve() functions.

Value

An object of class portfolio.

Details

evalBudget() creates and solves multiple instances, of the corresponding multi-actions planning problem, for different values of maximum budgets. Alternatively, this could be obtained by executing function prioriactions() or by steps the inputData(), problem() and solve() functions; using, in each run, different budgets values. However, the evalBudget() function has two advantages with respect to this manual approach: : 1) it is more efficient to create the models (this is because the model is created just once and, at each iteration, only the budget values are updated); and 2) the output is a portfolio object, which allows obtaining information about the group of solutions (including all get functions).

Examples

# \donttest{
# set seed for reproducibility
set.seed(14)

## Create model and solve
port <- evalBudget(pu = sim_pu_data, features = sim_features_data,
                dist_features = sim_dist_features_data,
                threats = sim_threats_data,
                dist_threats = sim_dist_threats_data,
                sensitivity = sim_sensitivity_data,
                boundary = sim_boundary_data,
                values = c(1, 10, 50, 100),
                time_limit = 50,
                output_file = FALSE,
                cores = 2)
#> *********************************
#>  Iteration 1 of 4: Budget1
#> *********************************
#> Warning: The blm argument was set to 0, so the boundary data has no effect
#> Warning: Some blm_actions argument were set to 0, so the boundary data has no effect for these cases
#> Rcplex: num variables=396 num constraints=277
#> *********************************
#>  Iteration 2 of 4: Budget10
#> *********************************
#> Warning: The blm argument was set to 0, so the boundary data has no effect
#> Warning: Some blm_actions argument were set to 0, so the boundary data has no effect for these cases
#> Rcplex: num variables=396 num constraints=277
#> *********************************
#>  Iteration 3 of 4: Budget50
#> *********************************
#> Warning: The blm argument was set to 0, so the boundary data has no effect
#> Warning: Some blm_actions argument were set to 0, so the boundary data has no effect for these cases
#> Rcplex: num variables=396 num constraints=277
#> *********************************
#>  Iteration 4 of 4: Budget100
#> *********************************
#> Warning: The blm argument was set to 0, so the boundary data has no effect
#> Warning: Some blm_actions argument were set to 0, so the boundary data has no effect for these cases
#> Rcplex: num variables=396 num constraints=277

getSolutionBenefit(port)
#>    solution_name feature benefit.conservation benefit.recovery benefit.total
#> 1        Budget1       1                    0                0             0
#> 2        Budget1       2                    0                0             0
#> 3        Budget1       3                    0                0             0
#> 4        Budget1       4                    0                0             0
#> 5       Budget10       1                    0                0             0
#> 6       Budget10       2                    2                2             4
#> 7       Budget10       3                    2                2             4
#> 8       Budget10       4                    0                0             0
#> 9       Budget50       1                    0                1             1
#> 10      Budget50       2                    2                8            10
#> 11      Budget50       3                    8                8            16
#> 12      Budget50       4                    0                1             1
#> 13     Budget100       1                    0                2             2
#> 14     Budget100       2                    2               16            18
#> 15     Budget100       3                    8               17            25
#> 16     Budget100       4                    0                3             3
# }