Accessing the last element of a variable in GAMS -
i have set:
set t /t1*t6/;
let consider there variable called var. have constraint last element of var less 20.
variable var(t);
equation const;
const..
var('t6') < 20;
i replace 't6' in last line card(t), if size of t changes not have change manually.
you can use dollar condition limit equation last period:
const(t)$(card(t)).. var(t) < 20;
or define singleton subset end condition so:
singleton set tend(t); tend(t) = yes$(card(t)); const.. var(tend) < 20;
Comments
Post a Comment