In Python Tutorial 6, we constrain using a dedicated inequality constraint function.
We realize the specification that out of 5 Mondays, there is only 1 Monday that is not a paid holiday, means 4 Mondays that are paid holidays.
import sc3
import itertools
for person in A_Member_in_All:
vlist=[]
s='Python Paid Holiday'+' '+staffdef[person]+'\n'
for day in Mon:
v=sc3.GetShiftVar(person,day,'Paid_Holiday')
vlist.append(v)
sc3.AddHard(sc3.SeqLE(4,4,vlist),s)
[Python Tutorial 5](. /chapter10) realizes the same specification.
sc3.SeqLE(min,max,List)
The format of the inequality is as above: the List must be a Shift Variable or a List of Variables by the result of other And/Or, Not, etc. operations.