Obtain root relaxation time
AnsweredI'm studying on mixed integer programming formulations for single machine scheduling problems.
When I launch Gurobi for my model there is lot of informations about the optimization like the objective bound , the runtime ect. We have diferent function to obtain these informations but i need to collect the root relaxation time and the objective value associat to this relaxation.
Do you know the function for obtain that?
-
Hi Théo,
The information you want to access is not available after the optimization has finished. Thus, you can use callbacks to access the information you seek. The MIPNODE_NODCNT value can be used to check whether you are in the root node. If it is \(=0\), then you are in the root node. Then, you can access the MIPNODE_OBJBND value to get the relaxation objective value and RUNTIME to get the runtime so far.
As already mentioned, alternatively, you can use the MESSAGE callback to access the log strings.Another option would be to set the parameter NodeLimit=0 and access the attributes ObjBound and Runtime.
Best regards,
Jaromił1 -
Hi Théo,
You can access the information you are looking for via callbacks. In particular, you should check out the MIPNODE callback with its MIPNODE_NODCNT and MIPNODE_OBJBND values.
An alternative would be to use the MESSAGE callback and parse the log string MSG_STRING value.
Best regards,
Jaromił0 -
Hi Jaromil,
I forgot to mention that I use JuMP and Julia for my work.
I don't really undersant why I should use the MIPNODE callback because for exemple my terminal is like :
Presolve removed 360 rows and 40 columns
Presolve time: 0.07s
Presolved: 1400 rows, 1680 columns, 8679 nonzeros
Variable types: 0 continuous, 1680 integer (1600 binary)
Root relaxation: objective 0.000000e+00, 430 iterations, 0.02 seconds
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node TimeAnd I want to get this information :
Root relaxation: objective 0.000000e+00, 430 iterations, 0.02 seconds
For exemple if I want the number of Node, I just have to use this function :
MOI.get(model, MOI.NodeCount())
If I understood correctly MIPNODE_NODCNT give me the number of node and MIPNODE_OBJBND give me the objective bound, but it's not what I want
0 -
Oh! Ok I understand.
Thank you very much Jaromil
Cordialy,
Théo
0 -
Hello,
I took back what you said last time. I tried to use de MESSAGE callback for exemple but on every call I get a 0 and I don't know why. I tested with other Callback Codes and I still get 0.
My callback function (in Julia) is like :
function my_callback_function(cb_data, cb_where::Cint)
if cb_where == GRB_CB_MESSAGE
resultP = Ref{Cstring}()
println(GRBcbget(cb_data, cb_where, GRB_CB_MSG_STRING,resultP))
end
return
end0 -
Hi,
According to the Julia documentation, they don't support the MESSAGE callback. However, they seem to support the MIPNODE callback. Did you think about switching to Gurobi's native Python API? It is intuitive and the switch should be easy for you, given the fact that you already have Julia code.
Best regards,
Jaromił0 -
Hi,
Sorry I forgot to answer you. The problem is solved and therefore I use the MIPNODE callback.
Théo
0
Please sign in to leave a comment.
Comments
7 comments