Hello,

I have a set t which is the total number of months and a binary variable b(t).

I want to have a constraint that sets b(t) less or equal to 1 each year in a single constraint.

I can do this with predetermined time periods and multiple constraint like for example with 36 months:

eq1… sum(t (ord(t) >=1 and ord(t) <= 12), b(t)) =l= 1;
eq2.. sum(t (ord(t) >=13 and ord(t) <= 24), b(t)) =l= 1;

eq3… sum(t $ (ord(t) >=25 and ord(t) <= 36), b(t)) =l= 1;

Is there a way to do this in a single line and generalize for multiple years?

Thank you.