In Python Tutorial 3, we will look at how to write the And operation, which is exactly the same constraint in three different ways: since it is an And operation, the constraint is that all elements (2th, 9th, 15th, 23th, 30th) are Paid holidays.
import sc3
for person in A_Member_in_All:
vlist=[]
s='Python Paid Holidays'+' '+staffdef[person]+'\n'
counter=0
for day in Mon:
v=sc3.GetShiftVar(person,day,'Paid_Holiday')
vlist.append(v)
if counter==0:
vand=v
else:
vand=vand & v
counter+=1
sc3.AddHard(vand,s)#
sc3.AddHard(sc3.And(vlist),s)#equivalent constraints as above
sc3.AddHard(vlist[0] & vlist[1] & vlist[2] & vlist[3] & vlist[4],s)#equivalent constraints as above