Using the optimal value printed by Gurobi
AnsweredHow do I use the value of the optimized objective function? I.e I wish to use the Optimal objective.
Gurobi Optimizer version 9.1.0 build v9.1.0rc0 (win64)
Thread count: 2 physical cores, 2 logical processors, using up to 2 threads
Optimize a model with 7 rows, 2 columns and 9 nonzeros
Model fingerprint: 0xe878c395
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [1e+00, 3e+00]
Presolve removed 5 rows and 0 columns
Presolve time: 0.08s
Presolved: 2 rows, 2 columns, 4 nonzeros
Iteration Objective Primal Inf. Dual Inf. Time
0 0.0000000e+00 1.000000e+00 0.000000e+00 0s
1 0.0000000e+00 0.000000e+00 0.000000e+00 0s
Solved in 1 iterations and 0.15 seconds
Optimal objective 0.000000000e+00
0
-
Hi Varun,
You can get all model information through accessing its Attributes. In particular, you can access the optimal objective value via the ObjVal attribute of your model and the variable values at the optimal solution via the X attribute of the variables. For an example usage, please have a look at lines 38 - 41 of the mip1.py example.
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment