メインコンテンツへスキップ

Callback on MIPNODE is late or slow

回答済み

コメント

7件のコメント

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Mike,

    The MIPNODE callback is called after the MIPSOL callback which means that if any heuristic solutions are found before the first cutting plane phase, then they will be reported before you can feed your heuristic solution to Gurobi. If you know your solution beforehand, i.e., you don't have to access information from the MIPNODE callback to construct it, you should provide your solution to Gurobi as an initial point (see also How do I use MIP starts?).

    Best regards,
    Jaromił

    0
  • Mike Lang
    Gurobi-versary
    Conversationalist
    First Question

    Hi Jaromil, 

    thank you for the clarification on the MIPNODE callback. I was under the impression that it should be called earlier, I also understood that in the recent webinar on heuristics (callback example for the greedy heuristic, around 39mins into the video): https://www.gurobi.com/resource/faster-mips-using-custom-heuristics/?mkt_tok=MTgxLVpZUy0wMDUAAAF_9MZZ03YL72LHfzobyi7aWxLdlE-fWDlDABd184kd9mDDDZXCWEn1MQwyfIboCHISVs0498ukHG7HTGWepCbj2I0mwdwIJDoSaC-pjg5k8A

    I face another issue with using MIP starts (which is why I tried the callback) as my procedure uses lazy constraints. I believe this older post of yours refers to the difficulty of that combination. 

    https://support.gurobi.com/hc/en-us/community/posts/360073235912/comments/360015464812

    If I understand your post correctly, I should only add those lazy constraints that are sure to cut off the MIP start solution? In other words - my starting solution should be such that it is cut off by the lazy constraint(s) in the callback routine? Or is the other way around and it should NOT be cut off?

    Alternatively, is there another way to inject known solutions as a means to fastly provide an incumbent to a MIP that otherwise has difficulties finding the first integer solution?

    Thank you for your support!

    Best regards, 

    Mike

     

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Mike,

    I was under the impression that it should be called earlier, I also understood that in the recent webinar on heuristics

    Please note that in Greg's code and in the webinar, he mentions multiple times that a feasible solution is needed first to apply his TSP heuristics. This makes even more sense then the MIPNODE callback which uses a feasible point and injects a possibly better solution point is called after the MIPSOL callback.

    In other words - my starting solution should be such that it is cut off by the lazy constraint(s) in the callback routine?

    Yes, correct.

    Alternatively, is there another way to inject known solutions as a means to fastly provide an incumbent to a MIP that otherwise has difficulties finding the first integer solution?

    If the number of lazy constraints is not too high, i.e., you don't have exponentially many lazy constraints in worst case, then adding them as normal constraints may work well. It might even make sense if the number of lazy constraints equals (or is larger than) the number of your normal constraints. In some cases this may even speed up the optimization process, because more information is present in the model.

    Alternatively, you can use variable hints if you think that the initial point you provide is close to the optimal one. Your certainty can be set via the hint priority attribute.

    Best regards,
    Jaromił

    0
  • Mike Lang
    Gurobi-versary
    Conversationalist
    First Question

    Hi Jaromil, 

    thanks a lot for the clarification. 

    The number of lazy constraints, unfortunately, exceeds the number of my normal constraints significantly. Following your suggestion, I would like to add them as normal constraints via cbCut only when the starting solution is evaluated and then continue to add lazy constraints. Is there a way to query the status of the optimization when a callback is initiated so that it tells me when the MIP start has been evaluated?

    Thank you for your support!

    Best regards

    Mike

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Mike,

    Is there a way to query the status of the optimization when a callback is initiated so that it tells me when the MIP start has been evaluated?

    This is currently not possible.

    You could try adding your MIP start in a MIPNODE callback in the root node. To check whether you are in the root node, you can check whether the value of MIPNODE_NODCNT equals 0.

    Best regards,
    Jaromił

    0
  • Mike Lang
    Gurobi-versary
    Conversationalist
    First Question

    Hi Jaromil,

    apologies for the late reply, the workarounds did not work in my case. Therefore it would be great if the abvove-mentioned issue with using lazy constraints and MIP starts would be fixed in Gurobi 9.5 and one more reason for me to upgrade. Can you say if that is the case?

    Thank you and best regards

    Mike

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Mike,

    This behavior did not change in v9.5.0.

    Best regards,
    Jaromił

    0

サインインしてコメントを残してください。