Re: [Gurobi] Incumbent solution and solution of current relaxation

314 views
Skip to first unread message

Sonja Mars

unread,
Feb 13, 2015, 8:03:53 AM2/13/15
to gur...@googlegroups.com
Hi,

You can only be at one "where" at the same time. It is not possible to have "where==MIPNODE and where==MIPSOL". where== MIPSOL is triggered when a new solution is found. At that point in the algorithm a optimal relaxation solution does not necessarily exist (for example the relaxation for that node might not have been solved yet). Additionally, if you are at MIPNODE a feasible solution might not have been found yet, so you cannot access it.

What you can do is to write to something like this:

if where==MIIPNODE:
call getNodeRel()
get MIPNODE_NODCNT

else if where==MIPSOL:
call getSolution()
get MIPSOL_NODCNT

and then you can compare the node counts (MIPNODE_NODCNT and MIPSOL_NODCNT) to ensure both solutions are from the same node. See here for more information about our Callback Codes:
http://www.gurobi.com/documentation/6.0/reference-manual/callback_codes#sec:CallbackCodes

Best regards,
Sonja

-----------------------------------------------------------------
Dr. Sonja Mars
Gurobi Optimization



> On 10 Feb 2015, at 19:11, Wellington Previero <wpre...@gmail.com> wrote:
>
> In my callback, each new incumbent solution is found, I would also like to get the solution of the relaxation in the current node. The code below does not display any response, because is not possible to have True for where == GRB.CB_MIPNODE AND where == GRB.CB_MIPSOL.
>
>
> if( where == GRB.CB_MIPNODE && getIntInfo(GRB.CB_MIPNODE_STATUS) == GRB.OPTIMAL && where == GRB.CB_MIPSOL ){
> double[] solutionRelax = getNodeRel(var);
> double[] solutionInteger = getSolution(var);
> for(int i = 0; i < solutionInteger.lenght; i++){
> System.out.println(var[i].get(GRB.StringAttr.VarName) + "= " + solutionRelax[i] + " " + solutionInteger[i]);
> }
> }
>
> Anyone have any suggestions?
> Thank you very much!
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages