Stoner
Stoner

Reputation: 906

How can I get an element of a particular index from a set in GAMS?

Suppose I have the set ``codes" in GAMS:

SET    
      codes /aaa, aab, aac, aad, aae/;

How can I then say get the 3rd element (or any element) in the set in GAMS?

Upvotes: 1

Views: 321

Answers (1)

Lutz
Lutz

Reputation: 2292

Are you looking for the "ord" operator like this?

SET
      codes /aaa, aab, aac, aad, aae/
      selected(codes);

selected(codes) = ord(codes)=3;

Display selected;

Upvotes: 2

Related Questions