我有一个护士问题,一天只有一个班次分配给一名员工,但另外我有以下限制:
一天的工作是这样的[开始,结束]:
Shift 0: rest
Shift 1: [8:00, 15:00]
Shift 2: [15:00, 22:00]
Shift 3: [8:00, 22:00]
Shift n: ...
我曾尝试以布尔函数为例对问题进行建模:
shifts = {}
for n in all_nurses:
for d in all_days:
for s in all_shifts:
shifts[(n, d, s)] = model.NewBoolVar('shift_n%id%is%i' % (n, d, s))
但是当我需要添加与时间和间隔相关的约束时,我发现很难表达上面的约束
有什么建议吗?它可以用另一种方式建模吗
你看过the shift scheduling example吗
这是编码的in this constraint
相关问题 更多 >
编程相关推荐