How to distinguish the scenarios between "TIMEOUT with feasible solution" and "TIMEOUT without feasible solution"?
回答済みHi,
I'm trying to distinguish the scenarios mentioned in the title, in Python.
More specifically, I have code like:
...
m.optimize()
res = {}
# In this case, I clearly know there is not solution
if m.Status == GRB.INFEASIBLE:
return res, m
# However, in other cases, I want to extract as much information
# as I can
res['LB'] = m.ObjBound # It has a bound
res['UB'] = m.ObjVar # It has a feasible solution
res['decisions'] = m.getAttr(...) # Extract decision variables
...
return res, m
Is there any way to distinguish these cases without running into `GurobiError` or `AttributeError`? (We'd prefer not to use try-catch here for some reasons)
Thanks.
0
-
Hi Shizhe,
I expect checking that the result of Model.SolCount() is non-zero will solve your problem.
- Riley
0
サインインしてコメントを残してください。
コメント
1件のコメント