If solver hits time limit, is a solution output?

Answered

Comments

3 comments

  • Yuriy Zinchenko

    Yes, the incumbent (if such is found) will be accessible through 'x' field of you variables.

    0
    Comment actions Permalink
  • Sam Ganzfried

    I just tried an example where model.get(GRB.IntAttr.Status) had a value of 9 (TIME_LIMIT status),

    and when I call get(GRB.DoubleAttr.X)

    I get:

    Exception in thread "main" gurobi.GRBException: Error at GRBVar.get
    at gurobi.GRBVar.get(GRBVar.java:124)

     

     

    0
    Comment actions Permalink
  • Yuriy Zinchenko

    You should check if the incumbent was found first, before querying for the X property.  You can do this by checking SolCount, https://www.gurobi.com/documentation/9.0/refman/solcount.html#attr:SolCount

    (please see our examples for more illustration in the online doc)

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk