how to use the data numbers in a table as a set

Problems with syntax of GAMS
Post Reply
paganini
User
User
Posts: 15
Joined: 5 years ago

how to use the data numbers in a table as a set

Post by paganini »

Hi there, this is my question:
I have a table over set "nl" which is the number of lines in a power system problem and the table has two columns "f_bus, t_bus".
how can I define other sets so-called " ff and tt " and take the value of "f_bus and t_bus" as the set's element?
in this case I'm trying to make ff / 1,2,2,4,5,5/ and tt /2,3,4,5,6,7/
here's the code:

Code: Select all

sets nl     number of lines / 1*6 /
     ff(nl)
     tt(nl)
     ;

table branchdata(nl,*)

          f_bus    t_bus
1         1        2
2         2        3
3         2        4
4         4        5
5         5        6
6         5        7
;

parameters f(nl) , t(nl);
f(nl) = branchdata(nl,"f_bus");
t(nl) = branchdata(nl,"t_bus");

ff(nl) = f(nl);
tt(nl) = t(nl);

display ff,tt;
thanks.
Post Reply