Inverting sets

Problems with syntax of GAMS
Post Reply
M.Walde
User
User
Posts: 16
Joined: 1 year ago

Inverting sets

Post by M.Walde » 1 year ago

Hi everyone,

I have a question according to sets.

Imagine the set n, the set i and the subset x(n,i). Is there an easy way to for the equation x(n,i+1) = x(n^-1,i)?

Here is what I mean in a more detailed way:

set n /1*3/
i /1*20/
x(n,i);

So x got 3 values. Let's say they get some values in the time step 8:
x(1,8) = 2
x(2,8) = 5
x(3,8) = 16

No I want to attach the values in the next timestep to:
x(1,9) = 16
x(2,9) = 5
x(3,9) = 2

The change should be dependent on some conditions, but i think it is easy to do this with binary variables.

I hope you understand, what I want to do. Thanks in advance!

Cheers

cladelpino
User
User
Posts: 108
Joined: 2 years ago

Re: Inverting sets

Post by cladelpino » 1 year ago

What does n^-1 means in this :
x(n,i+1) = x(n^-1,i)
?

Are there always three members of n and the last and the first "exchange" each other sequentially ? ie:

x(1,1)=1
x(2,1)=2
x(3,1)=3
x(1,2)=3
x(2,2)=2
x(3,2)=1
x(1,3)=1
x(2,2)=2
x(3,3)=3

Are valid values ?

M.Walde
User
User
Posts: 16
Joined: 1 year ago

Re: Inverting sets

Post by M.Walde » 1 year ago

Hi cladelpiano,

n^-1 should mean, that it is the inverted value. The equation should express, when n is 3:
x(1,i+1) = x(3,i)
x(2,i+1) = x(2,i)
x(3,i+1) = x(1,i)

n is not supposed to have 3 members all the time. It represents the number of nodes for a system, so it should be flexible.
i represents the time. The values should not exchange every timestep, but dependent on the values of the binary variables chg(i+1) and dis(i+1).

Does that answer your question?

Cheers

cladelpino
User
User
Posts: 108
Joined: 2 years ago

Re: Inverting sets

Post by cladelpino » 1 year ago

ehh... no ?
n^-1 should mean, that it is the inverted value.
What do you mean by "inverted" ? Why is inverted(1)=3 and inverted(3)=1 ?

Is it exchanging the last and first element ? For example for n= 4

x(1,i+1) = x(4,i)
x(2,i+1) = x(2,i)
x(3,i+1) = x(3,i)
x(4,i+1) = x(1,i)

Post Reply