Skip to main content

Setting an upper bound constraint to maximization objective (MIP)

Answered

Comments

3 comments

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Neta,

    It's almost certainly a bad idea. See the discussion here:
    https://or.stackexchange.com/questions/419/feeding-known-lower-bounds-to-solvers

    - Riley

    0
  • neta katz
    First Comment
    First Question

    thank you for thw quick response.

    Could you suggest another way I can leverage this prior knowledge?

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Neta,

    If you have a known dual bound which is better than Gurobi's current dual bound then you can calculate a MIP gap yourself, which will be smaller, and it may enable you to terminate your solve earlier.  You would do this with a callback.  In Python:

    YOUR_DUAL_BOUND = ...

    def callback(model, where):
        if where == GRB.Callback.MIPSOL:
            objbst = model.cbGet(GRB.Callback.MIPSOL_OBJBST)
            gap = abs(objbst - YOUR_DUAL_BOUND) / abs(objbst)

            if gap < model.params.MIPGap:
                model.terminate()

    model = gp.Model()
    # define model

    model.optimize(callback)

    This won't improve the search in any way but it could help you save some time if you're termination criteria is based on the MIP Gap.

    - Riley

     

    0

Please sign in to leave a comment.