Skip to main content

Cuts Parameter and B&B Root Node User Cuts

Answered

Comments

6 comments

  • David Torres Sanchez
    • Gurobi Staff Gurobi Staff

    Hi Marius,

    From the  GRBCallback::addCut() docs:

    You should consider setting parameter PreCrush to value 1 when adding your own cuts. This setting shuts off a few presolve reductions that can sometimes prevent your cut from being applied to the presolved model (which would result in your cut being silently ignored).

    Could you try setting this parameter and repeating the experiments?

    Cheers, 
    David

    0
  • Marius Roland
    • Gurobi-versary
    • First Comment
    • First Question

    Hello David, 

    Thanks for the quick reply :)!

    I tried with PreCrush set to the value 1 and it does not change anything. I still have the same behavior as in the first log I added. 

    In addition, you can observe in the first log file that the cuts are indeed added as confirmed by the statement:

    Cutting planes:
      User: 3

    Thanks for your help, 

    Marius

    0
  • David Torres Sanchez
    • Gurobi Staff Gurobi Staff

    That is interesting. What value of \(\texttt{where}\) are you using to add these cuts?

    Additionally, are you cutting off integer solutions? From the same link:

    they can cut off continuous solutions, but they may not cut off integer solutions that respect the original constraints of the model. Ignoring this restriction will lead to incorrect solutions.

    Cheers, 
    David

    0
  • Marius Roland
    • Gurobi-versary
    • First Comment
    • First Question

    This is the callback function I use: 

    def cb_covering(model, where):
        if where == GRB.Callback.MIPNODE:
            node_count = model.cbGet(GRB.Callback.MIPNODE_NODCNT)
            condition = (node_count == 0)
            # Starting cb based on condition
            if condition:
                status = model.cbGet(GRB.Callback.MIPNODE_STATUS)
                if status == GRB.OPTIMAL:

    This means: 1) It checks if we are in a MIPNODE 2) It checks that we are in node zero 3) It checks if the LP of the node is solved to optimality. 

    Maybe it might be related to these conditions? 

    Marius

    0
  • Riley Clement
    • Gurobi Staff Gurobi Staff

    I am not surprised if this is normal behavior, users don't typically have a great deal of control over how and when their user-cuts are used.  What happens if you set NodeLimit=1?  I'm wondering if an approach could work where you set this, wait till the solve terminates, set NodeLimit=float("infinity"), then call optimize() to resume the solve.

    - Riley

    1
  • Marius Roland
    • Gurobi-versary
    • First Comment
    • First Question

    Hello Riley, 

    Thanks a lot for your comment. 

    Unfortunately setting  NodeLimit=1 and then re-optimizing with NodeLimit=float("infinity") does not work for me. 

    Marius 

    0

Please sign in to leave a comment.