Page 1 of 1

Is it possible to use sets and variables this way ?

Posted: Fri May 18, 2018 1:56 pm
by Sisco
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

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

Posted: Fri May 18, 2018 4:57 pm
by cladelpino
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); 

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

Posted: Fri May 18, 2018 5:11 pm
by Sisco
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