The above figure shows the previous last state, there was a solution.
Now let’s solve this with the number of “Night Shift” set to 4 as follows.



It doesn’t come back, but eventually, we end up with no solution.



The analysis shows the cause of the problem is related to the last change constraint; the number of night shifts should be four for all staff members. Remember, we narrowed the range of the night shift from 3-5 to 4.

In this example, it is necessary to have some play in the night shift range.

At the same time, you probably felt that it would be difficult to ensure that all constraints are adhered to.
We discuss the measures to the problem in next .