Provides general information about the process of solving.
getPerformance(x)
getPerformance()
function returns five specific fields:
solution_name: indicates the name of the solution, by default is sol.
objective_value: indicates the value of the objective function of a given solution.
This value depends on the type of model solved (more information in the problem()
function).
gap: returns the relative MIP optimality gap of a solution. It is measured as the ratio between the objective function induced by the best known (primal solution) integer solution and the objective function induced by the best node in the search tree (dual solution).
solving_time: indicates the solving time of mathematical model.
status: provides the status of solver at the end of the optimization period. This can have six states:
Optimal solution (according to gap tolerance) : When the resolution of the model stop when
the quality of the solution (gap) is less than or equal to gap_limit (parameter of the solve()
function).
No solution (model was proven to be infeasible or unbounded): When the model is infeasible.
Feasible solution (according to time limit): When the resolution of the model stops when a
time_limit has been reached finding a feasible solution (parameter of the solve()
function).
No solution (according to time limit): When the resolution of the model stops when a time_limit
has been reached without finding a feasible solution (parameter of the solve()
function).
First feasible solution: When the resolution of the model stops when it has found the first
feasible solution (solution_limit = TRUE parameter in solve()
function).
No solution information is available: For any other case.
# \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 = 2, 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.13s
#> 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.47 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.67 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%
# get solution gap
getPerformance(s)
#> solution_name objective_value gap solving_time
#> 1 sol 863 0 0.674
#> status
#> 1 Optimal solution (according to gap tolerance: 0)
# }