getting the dual variables

Skip to first unread message

juan raposo

Jun 27, 2023, 2:33:56 PMJun 27
to Pyomo Forum
I'm currently working on a mixed integer linear program in which I have binary and NonNegativeReal variables. Is it possible to obtain its dual variables? I am asking this because  when I try to get some specific dual variable associated to a constraint, I get an error message such as: 

 KeyError: "Component with id '1595808824672': Lower_W[HYDRO_RES,1]"

And when using instance.dual.display() I get the following message:

   dual : Direction=Suffix.IMPORT_EXPORT, Datatype=None Key : Value

Also the motive of this question is because I ve seen the following discussion at StackOverflow:

Could someone confirm if this is true? 

In case it is not, I am sharing my code of my GitHub repository:


David Woodruff

Jun 27, 2023, 5:26:32 PMJun 27
The statement on the stack overflow page you cited (that you can't get duals for a problem with integer variables) is true enough for your purposes.

You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages