## Is it possible to use sets and variables this way ?

Problems with syntax of GAMS
Sisco
User
Posts: 2
Joined: 3 months ago

### Is it possible to use sets and variables this way ?

Hi,

I would like a variable T to be defined in such a way that it takes the following values : T(1) to T(10)

The thing is, my problem requires using two sets in a specific way :
Is it possible to use sets B (1 to 4) and C (1 to 3) so that I can write something like T( B+3*(C-1) ) and finally have T(1) to T(10) ?

If it is possible, I don't know how I would have to define my variable T and the associated set T(?) ?
If not, is there another trick that could be useful ?

Thank for the help !
Sim

User
Posts: 108
Joined: 1 year ago

### Re: Is it possible to use sets and variables this way ?

hmm. I didn't really understand how the requirement arose, but,just in case:

you are aware of this notation, right ?

Code: Select all

``````set setForT /1*10/;
variable T(setForT); ``````

Sisco
User
Posts: 2
Joined: 3 months ago

### Re: Is it possible to use sets and variables this way ?

Yes I know this one.

The requirement comes from a discretization method called "orthogonal collocation on finite elements".

I have E elements in time and N collocation points in each element. The problem is at the bounds between elements. I could write my variables this way : T(E,N).
But There would be redundant variables and equations at each bounds.

Thus, I try to write it in another way to reduce the global size of my problem.

Sim