sets in gams

I declare the set k as follows:
SET k /1 * 3/ ;

Later in my model I am using the expression

X(i,j,‘3’) = …

In this expression ‘3’ denotes the last element of the set k.

My question is: Is it possible to write X(i,j,last element of k) instead of X(i,j,‘3’) ? How can I do this?

The reason for asking is, that I would like to be able to change the cardinality of k without having to go through the rest of the model.

Hi
You can either use card in the equation

X(i,j,k)$(ord(k) = card(k)) = ...

or use a dynamic set:

SET k /1 * 3/,
       klast(k) ;

klast(k)$(ord(k) = card(k))= YES;

X(i,j,klast) = ....

In both cases, you can change the cardinality of the set and this will be reflected in your assignment of X.

Cheers
Renger