Skip to main content

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

Ongoing

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • David Torres Sanchez
    • 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
    • Gurobi-versary
    • 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

Post is closed for comments.