Skip to main content

Obtain the set of fractional solutions when I stop the running of a MIP

Ongoing

Comments

2 comments

  • David Torres Sanchez
    Gurobi Staff Gurobi Staff

    Hi Marina,

    I guess this will work; you will get the relaxation solution for all the nodes, including the last one explored before hitting the work limit.
    If you keep and over-write \(\texttt{fractional}\) every time, you will end up with the last relaxation available before hitting the work limit.

    I guess you can also check the \(\texttt{WORK}\) callback attribute manually if you want. Something like:

    def my_callback(model, where):
        if where == GRB.Callback.MIPNODE:
            status = m.cbGet(GRB.Callback.MIPNODE_STATUS)
            work = m.cbGet(GRB.Callback.WORK)
          if status == GRB.OPTIMAL and work > myworklimit - smallnumber:
              fractional = m.cbGetNodeRel(m._x)

    Or, even better, pair relaxation solutions with the current work and then you can filter them as you like at the end.

    Cheers, 
    David

    0
  • Marina AM
    First Comment
    First Question

    Hi David,

    Thanks for your response, I have edited the code because I did not add the code lines where I store all the fractional solutions.

    The idea to get fractional solutions is to take advantage of the results obtained by MIP during the WorkLimit specified. If I get relaxed solution I would lose some information.

    Is there any way to get the state of the tree to know which binary variables have been discarded as 0/1 (the leaf nodes that have been disposed) and thus know with certainty what value they will have?

    Cheers,

    Marina

     

    0

Please sign in to leave a comment.