KappaExact
AnsweredHow 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)
-
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
Please sign in to leave a comment.
Comments
2 comments