Reputation: 451
I want to import elements or members into a GAMS set from other sources, say SQL DB. For example set p plant /p1,p2,p3.../ These elements are successfully imported, however, it seems that they are not ordered, because errors will be reported when I use condition clause like ord(p) > 3 in constraints.
I know that elements are ordered as they initially created. So these imported elements are supposed to follow the sequence as imported. When I display this set, elements are shown as p1, p2, p3...
So I am really confused about the ordering of imported elements. I want to figure out the reason and if there are ways I can fix their order. Thanks.
Upvotes: 1
Views: 159
Reputation: 102
you could add the following after loading the data
ALIAS(*,universe);
display universe;
$exit;
You should then see the order of your loaded set elements and where the misordering might have appeared. If you absolutely cant order the set in your source query (sql db) a hack would be to initiate a helper set before loading the actual data.
set helper /p1*p100000/;
Upvotes: 1