This class is used to represent the solution of the MIP (Mixed-Integer Programming) model.
This includes several methods
to obtain information about both the optimization process and the solution associated with
the planning units and actions. It is created using the solve()
function.
No return value.
list
. Object containing data on the results of the optimization process.
Print basic information of the model solution.
Call print method.
# \donttest{
# set seed for reproducibility
set.seed(14)
## Load data
data(sim_pu_data, sim_features_data, sim_dist_features_data,
sim_threats_data, sim_dist_threats_data, sim_sensitivity_data,
sim_boundary_data)
## Create data instance
problem_data <- inputData(
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
)
## Create optimization model
problem_model <- problem(x = problem_data, blm = 1)
#> Warning: Some blm_actions argument were set to 0, so the boundary data has no effect for these cases
## Solve the optimization model
s <- solve(a = problem_model, time_limit = 5, output_file = FALSE, cores = 2)
#> 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 29984 rows, 10296 columns and 70085 nonzeros
#> Model fingerprint: 0xac37cd06
#> Variable types: 176 continuous, 10120 integer (10120 binary)
#> Coefficient statistics:
#> Matrix range [5e-01, 2e+00]
#> Objective range [1e+00, 7e+02]
#> Bounds range [1e+00, 1e+00]
#> RHS range [1e+00, 5e+01]
#> Found heuristic solution: objective 964.0000000
#> Presolve removed 19990 rows and 5131 columns
#> Presolve time: 0.15s
#> Presolved: 9994 rows, 5165 columns, 20209 nonzeros
#> Variable types: 0 continuous, 5165 integer (5160 binary)
#> Found heuristic solution: objective 868.0000000
#>
#> Root relaxation: objective 8.477969e+02, 7968 iterations, 0.46 seconds (1.09 work units)
#>
#> Nodes | Current Node | Objective Bounds | Work
#> Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
#>
#> 0 0 847.79687 0 5133 868.00000 847.79687 2.33% - 0s
#> 0 0 862.00000 0 1 868.00000 862.00000 0.69% - 0s
#> H 0 0 865.0000000 862.00000 0.35% - 0s
#> H 0 0 863.0000000 862.00000 0.12% - 0s
#> 0 0 cutoff 0 863.00000 863.00000 0.00% - 0s
#>
#> Cutting planes:
#> Cover: 2
#> RLT: 2
#>
#> Explored 1 nodes (8025 simplex iterations) in 0.69 seconds (1.40 work units)
#> Thread count was 2 (of 16 available processors)
#>
#> Solution count 4: 863 865 868 964
#>
#> Optimal solution found (tolerance 0.00e+00)
#> Best objective 8.629999999999e+02, best bound 8.629999999999e+02, gap 0.0000%
## Use class methods
s$print()
#> Solution overview
#> name: sol
#> objective value: 863
#> gap: 0%
#> status: Optimal solution (according to gap tolerance: 0)
#> runtime: 0.688 sec
# }