This project is an answer project for StackOverflow per the following link.
This project is not for newbie.
In a sliding 6 week window, each nurse must have at least 14 consecutive days with no shifts (i.e., be assigned to shift O).
We have implemented it ,based on the following project.
Maximum-length-series-of-shifts slow down solving speed
Since 2 weeks vacation is really a big problem, so we modeled here just 1 week vacation in this month.
But we are sure you can try the 2 weeks in the same manner.
We are adding a vacation shift to clearly distinguish shifts in the solution display.
We change the finish date to span 6 weeks.
Here is a overall constraints about the vacation.
You may be thinking, “Why do we need so many constraints?” or “Isn’t this redundant?”
But these are all necessary constraints.
Let’s look at them one by one. The next constraint is that there is only one vacation per week this month. This is a direct statement to the specification. You may think, “Isn’t this enough?
OK, we uncheck the remaining constraints as follows.
And, the solution becomes;
So, this is not the solution we want. Yes, we have one week vacation on every staff. However unnecessary vacation exists in many portions.
To remove all unnecessary vacations, we implement following constraints.
First, we removes vacations more than 7 days.
Second, we remove vacations less than 7 days.
File → Open Project File from Github