How to translate GAMS $ operator to pyomo?

44 views
Skip to first unread message

ye wang

unread,
Sep 12, 2021, 3:48:18 PM9/12/21
to Pyomo Forum
Hello,
I am new to pyomo and I have a question regarding sets.
I have some sets in gams:
Set 
        i 'hot streams' / 1*2 /
        j 'cold streams' / 1*2 /; 
 Set 
       k 'temperature locations nok + 1' / 1*3 / 
       st(k) 'stages'; 
Singleton Set 
      firstK(k) 'first temperature location' 
      lastK(k) 'last temperature location'; 

st(k) = yes$(ord(k) < card(k));
firstK(k) = yes$(ord(k) = 1); 
lastK(k) = yes$(ord(k) = card(k));

How to translate ‘st(k)’, 'firstK(k)', 'lastK(k)' in pyomo?

Another question
How to translate equation with $ in gams to pyomo? Like this:

eh(i,k)$st(k).. fh(i)*(th(i,k) - th(i,k+1)) =e= sum(j, q(i,j,k)); 
ec(j,k)$st(k).. fc(j)*(tc(j,k) - tc(j,k+1)) =e= sum(i,q(i,j,k));

THX
Reply all
Reply to author
Forward
0 new messages