[python] Constraint2
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- def const_maxDaysInCalendarWeek(self, maxWorkedDays: int = 5) :
- """
- No worker can work more than maxWorkedDays in any maxRange of consecutive days in the same calendar week
- """
- for cycle in self.cycles:
- for day in self.days :
- if (day % 7 == 0) :
- cd = sum(self.assignments[(cycle, d)] for d in range(day, day + 7))
- self.model.Add(cd <= maxWorkedDays)
Editor
You can edit this paste and save as new: