SeqComp is used to realize a substitution rest, always in combination with sc3.AddHard.
import sc3
for person in A_Member_in_All:
vlist=[]
s='Python Substite'+' '+staffdef[person]+'\n'
Sat_WORKCNT=[]
Sun_WORKCNT=[]
Sub_CNT=[]
Half_CNT=[]
for day in ThisMonth:
v=sc3.GetShiftVar(person,day,'Visit_Shift')
vD=sc3.GetShiftVar(person,day,'Sub_Shift')
vH=sc3.GetShiftVar(person,day,'Half_Shift')
if day in Sat:
Sat_WORKCNT.append(v)
sc3.AddHard(~vD,'No Sub_Shift on Sat.'+str(person))
sc3.AddHard(~vH,'No Half_Shift on Sat.'+str(person))
elif day in Sun:
Sun_WORKCNT.append(v)
sc3.AddHard(~vD,'No Sub_Shift on Sun.'+str(person))
sc3.AddHard(~vH,'No Half_Shift on Sun.'+str(person))
else:
Sub_CNT.append(vD)
Half_CNT.append(vH)
vlist.append(v)
sc3.AddHard(sc3.SeqComp(Half_CNT,Sat_WORKCNT),'seqComp+str(person)')
sc3.AddHard(sc3.SeqComp(Sub_CNT,Sun_WORKCNT),'seqComp+str(person)')
sc3.SeqComp(List1,List2)
SeqComp is a function that returns True if X(i)==Y(i) when X(i) is an element of List1 and Y(i) is an element of List2, and when combined with AddHard, it constrains ΣX(i)==ΣY(i).