Group: sci.op-research
From: Peter
Date: Saturday, March 15, 2008 3:11 PM
Subject: Two subsequent non-zero binary variables

Hey Guys,

I have a set of binary variables y(i), where i= 1,2, ...,10. I wish to
write a constraint to enforce that exactly two subsequent binary
variables be equal to 1 and the rest be equal to zero (this might also
include y(1) and y(10) ), i.e.:

y(i) and y(i+1) = 1 and the rest equl to zero, for some i, except
1
or
y(1) and y(10)= 1 and the rest equal to zero,

and exactly tow binary varialbes should be nonzero:
sum(i, y (i) ) = 2

Is there any way to do this using linear constraints?