This project is an answer project for StackOverflow per the following link.
I’m trying to add more constraints to the problem. For instance:
- Nurse A cannot work shifts 2 and 3 on Monday,
- Nurse B can only work shifts 1 and 3 across all days.
How would one go about implementing a constraint like this?
We have implemented it ,based on the following project.
Maximum-length-series-of-shifts slow down solving speed
It is not a good idea to write constraints for everything. We recommend following directions.
- Permanent rules should be constrained.
- Write shift/task schedule inputs for monthly rules as much as possible.
- Itemize table items on the staff property sheet by constraining the rules which may be used in the future or can not be handled by schedules.
It takes a certain amount of time and skill to constrain and debug constraints.
Once the system is up and running, it must be easily operated and maintained for even those unfamiliar with IT, by simply entering monthly schedules, and changing table items on the staff property sheet.
Nurse A cannot work shifts 2 and 3 on Monday,
Here, we assume;
|shift 3||Night shift|
We can define A new shift label “Nan” , i.e., not afternoon and not night shift.
Nurse B can only work shifts 1 and 3 across all days.
If the rule is permanent, we can achieve the constraint by uncheking the shift table for the staff below.
To make the table items above, we define following group properties.
To make the table item works as a constraint, we we add new constraints as follows.
We should revise the row constraints because staff may change by the change of the table.
Here ,we should define Not the group property as follows.
In summary, changes to table items correspond to changes to constraints. Now you don’t have to add or change row/column constraints later. If possible, make choices in the table beforehand to anticipate possible future changes.
File → Open Project File from Github