KappaExact
回答済みHow do I access KappaExact? The examples in the doc say to simply use something like this:
def kappa(mpsfile):
m = gp.read(mpsfile)
m.optimize()
kappa_exact_value = m.KappaExact
print("Kappa Exact Value:", kappa_exact_value)
But this gives an error:
File "/home/magalati/workplace/scripts/gurobi/gurobi/kappa.py", line 10, in kappa
kappa_exact_value = m.KappaExact
File "src/gurobipy/model.pxi", line 368, in gurobipy.Model.__getattr__
File "src/gurobipy/model.pxi", line 1896, in gurobipy.Model.getAttr
File "src/gurobipy/attrutil.pxi", line 103, in gurobipy._getattr
AttributeError: Unable to retrieve attribute 'KappaExact'
Warning: environment still referenced so free is deferred (Continue to use WLS)
-
正式なコメント
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. -
Hi Matt,
Is the model a LP? It will need to be for KappaExact to be available since it requires a basis. If it is a MILP then you could use:
r = m.relax()
r.params.OutputFlag=0
r.optimize()
kappa_exact_value = r.KappaExact- Riley
0 -
Got it. The model is a MILP and I had not relaxed it. Thank you.
0
投稿コメントは受け付けていません。
コメント
3件のコメント