Create an shifting index gap
Posted: Fri Jun 11, 2021 7:54 am
Hi everyone,
I'm fairly new to gams and I have a problem that I'd appreciate your input on: I have a set I which includes hours in a year so 1 to 8760. I have a variable g(h) which is index by hour h. I want to write an equation to satisfy these constraints:
g(1) + g(2) + g(3) + g(4) = 0
g(3) + g(4) + g(5) + g(6) = 0
g(5) + g(6) + g(7) + g(8) = 0
...
So starting at hour 1, the sum of the first 4 consecutive variables is zero, after that there is a shifting window of 2 indices then the sum of the next 4 indices are zero, and so on and so on until the end of the year. I can't think of how to do this. Any help is greatly appreciated! Thanks.
I'm fairly new to gams and I have a problem that I'd appreciate your input on: I have a set I which includes hours in a year so 1 to 8760. I have a variable g(h) which is index by hour h. I want to write an equation to satisfy these constraints:
g(1) + g(2) + g(3) + g(4) = 0
g(3) + g(4) + g(5) + g(6) = 0
g(5) + g(6) + g(7) + g(8) = 0
...
So starting at hour 1, the sum of the first 4 consecutive variables is zero, after that there is a shifting window of 2 indices then the sum of the next 4 indices are zero, and so on and so on until the end of the year. I can't think of how to do this. Any help is greatly appreciated! Thanks.