0

how can I model the incremental summation of one variable in GAMS constraints like the following:

y(t) is variable;

t is period index that t=1,…,4;

in constraints section I want this summation in each period:

t=1 : y(t=1) < t * 10
t=2 : y(t=2) < t * 10 – y(t=1)
t=3 : y(t=3) < t * 10 – y(t=2) – y(t=1)
t=4 : y(t=3) < t * 10 – y(t=3) – y(t=2) – y(t=1)
Bista
  • 7,869
  • 3
  • 27
  • 55

1 Answers1

0
set t /1,2,3,4/;
* Create an alias of set t
alias (t,t1);
variable y(t);
equation incremental_summation(t);

* use ord and $-condition to formulate your equation
incremental_summation(t)..
y(t) <= t * 10 - sum(t1$(ord(t1)<ord(t)),y(y));
Catyes
  • 1
  • 1