[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] manipulating parameter indices

From: Kevin Hunter
Subject: Re: [Help-glpk] manipulating parameter indices
Date: Sat, 30 Jun 2012 18:58:41 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

At 12:59am -0400 Sat, 30 Jun 2012, Glpk Xypron wrote:
try the following:

set EFF, dimen 5;
set inputs := setof{(i,p,v,o,e) in EFF}i;
set process := setof{(i,p,v,o,e) in EFF}p;
set vintage := setof{(i,p,v,o,e) in EFF}v;
set outputs := setof{(i,p,v,o,e) in EFF}o;
set S := setof{(i,p,v,o,e) in EFF} (i,p,v,o);
param eff{(i,p,v,o) in S} := sum{(i,p,v,o,e) in EFF}e;
display eff;
set EFF :=
# input     process        vintage output      efficieny
   coal      coal_pp        2015    electricity 0.4
   uranium   nuclear_pp     2015    electricity 0.4
   sunlight  passive_solar  2020    heat        0.6;

Most excellent! I was not aware that I could use sets in this manner. That is exactly the functionality for which I was searching. Thank you.

I was similarly not aware of how to use setof, and with this piece, I was able to clean up a bunch of other sections to my model as well.

Thank you again,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]