Getting the dual variable values when the model status is 4(INF_OR_UNBD)
AnsweredHello guys, I am running the benders algo, When my subproblem is feasible I am using the following line to get the dual variable value:
gp.quicksum(BigM*deltars2kE[r,s,k]*subproblem.getConstrByName("UE_EV_2[E,{},{},{}]".format(r,s,k)).Pi for r,s in drs.keys() for k in K)
And it works. But when my subproblem becomes infeasible or unbounded and I want to take the dual variable values I am using the exact same code but with .FarkasDual instead of .Pi
gp.quicksum(BigM*deltars2kE[r,s,k]*subproblem.getConstrByName("UE_EV_2[E,{},{},{}]".format(r,s,k)).FarkasDual for r,s in drs.keys() for k in K)
Then I get the following error:
AttributeError: Unable to retrieve attribute 'FarkasDual'.
Am I doing something wrong? Are there any specific conditions that the attribute FarkasDual works?
-
Official comment
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. -
From the FarkasDual documentation:
These attributes are only available when parameter InfUnbdInfo is set to 1.
Have you set the InfUnbdInfo parameter to 1?
0 -
Thank you Eli, that was the problem, enjoy your holidays!
Kind regards
Iason0
Post is closed for comments.
Comments
3 comments