Get relaxed solution value in callback MIPNODE
AnsweredHow do I retrieve the value of the relaxed solution using the Java API when my callback is called in a MIPNODE and CB_MIPNODE_STATUS is OPTIMAL?
In the documentation page I see:
MIPNODE_OBJBST MIPNODE double Current best objective.,
MIPNODE_OBJBND MIPNODE double Current best objective bound,
MIPNODE_REL MIPNODE double Relaxation solution for the current node, when its optimization status is GRB_OPTIMAL (C only).
The first and second ones provide the bound for the *integer* solution (right?), and the third one is only available from C (the JVM crash badly if I attempt to `getDoubleInfo(GRB.CB_MIPNODE_REL)`).
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
To access the node relaxation solution through the JAVA API, you have to use the GRBCallback.getNodeRel() method.
0 -
In that way I still have to compute the obj function value, is there any shortcut? (a workaround could be to assign the obj function to a single variable and then read its relaxed value...)
0 -
In that way I still have to compute the obj function value, is there any shortcut? (a workaround could be to assign the obj function to a single variable and then read its relaxed value...)
Unfortunately, there is currently no shortcut. Introducing an auxiliary variable to capture the value of the objective function is the correct way to go here.
0
Post is closed for comments.
Comments
4 comments