Return one solution per instance for different targets values. This
function assumes that the minimizeCosts model is being used. As well as the
prioriactions()
function, it inherits all arguments from inputData()
,
problem()
and solve()
.
evalTarget(values = c(), ...)
numeric
. Proportion of maximum value of benefits to verify (both
recovery and conservation benefits). This information can be obtained with
getPotentialBenefit()
function. More than one value is needed.
arguments inherited from inputData()
, problem()
,
and solve()
functions.
An object of class portfolio.
evalTarget()
creates and solves multiple instances, of the corresponding
multi-actions planning problem, for different proportions of maximum benefit values
as target values. It is assumed that the same proportion is applied for the maximum
benefit in recovery and conservation. Alternatively, this
could be obtained by executing function prioriactions()
or by steps the inputData()
,
problem()
and solve()
functions; using, in each run, different targets values.
However, the evalTarget()
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 target values are updated); and 2) the
output is a portfolio object, which allows
obtaining information about the group of solutions (including all get functions).
# \donttest{
# set seed for reproducibility
set.seed(14)
## Create model and solve
port <- evalTarget(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(0.1, 0.3, 0.5),
time_limit = 50,
output_file = FALSE,
cores = 2)
#> *********************************
#> Iteration 1 of 3: Prop0.1
#> *********************************
#> 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
#> Gurobi Optimizer version 10.0.0 build v10.0.0rc2 (linux64)
#>
#> CPU model: 12th Gen Intel(R) Core(TM) i5-1240P, instruction set [SSE2|AVX|AVX2]
#> Thread count: 16 physical cores, 16 logical processors, using up to 2 threads
#>
#> Optimize a model with 284 rows, 396 columns and 785 nonzeros
#> Model fingerprint: 0xf11c1fb5
#> Variable types: 176 continuous, 220 integer (220 binary)
#> Coefficient statistics:
#> Matrix range [5e-01, 2e+00]
#> Objective range [1e+00, 1e+01]
#> Bounds range [1e+00, 1e+00]
#> RHS range [2e-01, 6e+00]
#> Found heuristic solution: objective 964.0000000
#> Found heuristic solution: objective 168.0000000
#> Presolve removed 250 rows and 282 columns
#> Presolve time: 0.00s
#> Presolved: 34 rows, 114 columns, 229 nonzeros
#> Found heuristic solution: objective 75.0000000
#> Variable types: 0 continuous, 114 integer (98 binary)
#> Found heuristic solution: objective 69.0000000
#>
#> Root relaxation: objective 5.300000e+01, 27 iterations, 0.00 seconds (0.00 work units)
#>
#> Nodes | Current Node | Objective Bounds | Work
#> Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
#>
#> 0 0 53.00000 0 6 69.00000 53.00000 23.2% - 0s
#> H 0 0 60.0000000 53.00000 11.7% - 0s
#> * 0 0 0 57.0000000 57.00000 0.00% - 0s
#>
#> Cutting planes:
#> Gomory: 2
#> Cover: 3
#> MIR: 3
#>
#> Explored 1 nodes (34 simplex iterations) in 0.00 seconds (0.00 work units)
#> Thread count was 2 (of 16 available processors)
#>
#> Solution count 6: 57 60 69 ... 964
#>
#> Optimal solution found (tolerance 0.00e+00)
#> Best objective 5.700000000000e+01, best bound 5.700000000000e+01, gap 0.0000%
#> *********************************
#> Iteration 2 of 3: Prop0.3
#> *********************************
#> 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
#> Gurobi Optimizer version 10.0.0 build v10.0.0rc2 (linux64)
#>
#> CPU model: 12th Gen Intel(R) Core(TM) i5-1240P, instruction set [SSE2|AVX|AVX2]
#> Thread count: 16 physical cores, 16 logical processors, using up to 2 threads
#>
#> Optimize a model with 284 rows, 396 columns and 785 nonzeros
#> Model fingerprint: 0xd3db0e90
#> Variable types: 176 continuous, 220 integer (220 binary)
#> Coefficient statistics:
#> Matrix range [5e-01, 2e+00]
#> Objective range [1e+00, 1e+01]
#> Bounds range [1e+00, 1e+00]
#> RHS range [6e-01, 2e+01]
#> Found heuristic solution: objective 964.0000000
#> Found heuristic solution: objective 445.0000000
#> Presolve removed 250 rows and 277 columns
#> Presolve time: 0.00s
#> Presolved: 34 rows, 119 columns, 237 nonzeros
#> Found heuristic solution: objective 254.0000000
#> Variable types: 0 continuous, 119 integer (101 binary)
#> Found heuristic solution: objective 246.0000000
#>
#> Root relaxation: objective 1.865000e+02, 34 iterations, 0.00 seconds (0.00 work units)
#>
#> Nodes | Current Node | Objective Bounds | Work
#> Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
#>
#> 0 0 186.50000 0 8 246.00000 186.50000 24.2% - 0s
#> H 0 0 205.0000000 186.50000 9.02% - 0s
#> 0 0 193.00000 0 2 205.00000 193.00000 5.85% - 0s
#> H 0 0 197.0000000 193.00000 2.03% - 0s
#> 0 0 194.50000 0 2 197.00000 194.50000 1.27% - 0s
#> 0 0 195.00000 0 4 197.00000 195.00000 1.02% - 0s
#> 0 0 195.50000 0 3 197.00000 195.50000 0.76% - 0s
#> * 0 0 0 196.0000000 196.00000 0.00% - 0s
#>
#> Cutting planes:
#> Gomory: 2
#> Cover: 7
#> Zero half: 1
#> Relax-and-lift: 1
#>
#> Explored 1 nodes (52 simplex iterations) in 0.00 seconds (0.00 work units)
#> Thread count was 2 (of 16 available processors)
#>
#> Solution count 7: 196 197 205 ... 964
#>
#> Optimal solution found (tolerance 0.00e+00)
#> Best objective 1.960000000000e+02, best bound 1.960000000000e+02, gap 0.0000%
#> *********************************
#> Iteration 3 of 3: Prop0.5
#> *********************************
#> 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
#> Gurobi Optimizer version 10.0.0 build v10.0.0rc2 (linux64)
#>
#> CPU model: 12th Gen Intel(R) Core(TM) i5-1240P, instruction set [SSE2|AVX|AVX2]
#> Thread count: 16 physical cores, 16 logical processors, using up to 2 threads
#>
#> Optimize a model with 284 rows, 396 columns and 785 nonzeros
#> Model fingerprint: 0xfbf37033
#> Variable types: 176 continuous, 220 integer (220 binary)
#> Coefficient statistics:
#> Matrix range [5e-01, 2e+00]
#> Objective range [1e+00, 1e+01]
#> Bounds range [1e+00, 1e+00]
#> RHS range [1e+00, 3e+01]
#> Found heuristic solution: objective 964.0000000
#> Found heuristic solution: objective 601.0000000
#> Presolve removed 250 rows and 277 columns
#> Presolve time: 0.00s
#> Presolved: 34 rows, 119 columns, 237 nonzeros
#> Found heuristic solution: objective 401.0000000
#> Variable types: 0 continuous, 119 integer (101 binary)
#> Found heuristic solution: objective 387.0000000
#>
#> Root relaxation: objective 3.485000e+02, 32 iterations, 0.00 seconds (0.00 work units)
#>
#> Nodes | Current Node | Objective Bounds | Work
#> Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
#>
#> 0 0 348.50000 0 10 387.00000 348.50000 9.95% - 0s
#> H 0 0 376.0000000 348.50000 7.31% - 0s
#> H 0 0 370.0000000 348.50000 5.81% - 0s
#> H 0 0 369.0000000 348.50000 5.56% - 0s
#> 0 0 358.00000 0 4 369.00000 358.00000 2.98% - 0s
#> H 0 0 362.0000000 358.00000 1.10% - 0s
#> 0 0 359.00000 0 11 362.00000 359.00000 0.83% - 0s
#> 0 0 359.00000 0 6 362.00000 359.00000 0.83% - 0s
#> H 0 0 361.0000000 359.00000 0.55% - 0s
#> 0 0 359.50000 0 13 361.00000 359.50000 0.42% - 0s
#> 0 0 infeasible 0 361.00000 361.00000 0.00% - 0s
#>
#> Explored 1 nodes (93 simplex iterations) in 0.01 seconds (0.00 work units)
#> Thread count was 2 (of 16 available processors)
#>
#> Solution count 9: 361 362 369 ... 964
#>
#> Optimal solution found (tolerance 0.00e+00)
#> Best objective 3.610000000000e+02, best bound 3.610000000000e+02, gap 0.0000%
getCost(port)
#> solution_name monitoring threat_1 threat_2
#> 1 Prop0.1 30 2 25
#> 2 Prop0.3 98 26 72
#> 3 Prop0.5 186 65 110
# }