I'm using AddExactlyOne
from Python or-tools CP-SAT for the nurses scheduling problem.
(Using the from ortools.sat.python import cp_model
code at the bottom of the link)
However, this code used AddExactlyOne
to assign exact only one nurse in a shift. What I want to do is to assign exactly two nurses in a shift.
I tried:
model.Add(sum(shifts[(n, d, s)] for n in all_nurses) == 2)
instead of:
model.AddExactlyOne(shifts[(n, d, s)] for n in all_nurses)
, which is already stated in the code.
However, no luck.
Any idea how to assign exactly two nurses in a shift? Something like: AddExactlyTwo
instead of AddExactlyOne
?
Thanks in advance.