In the Project Job Scheduling example, how to disable a time interval? The jobs are not started and not work during this period.
For example, in a factory, weekends (Saturday and Sunday) do not work. Therefore, startDate and endDate need to be restricted as follows:
- If a startDate located on the weekend, the startDate will be postponed to the next Monday.
- If an endDate is located on a weekend, extend the duration of the job, let it ends at the next week's work-day.
For 1st case above, I can add a hard constraint that penalizes startDate when it is located on weekends. But for the 2nd case, there is no way to think of it. I have tried adding a judgment to the getEndDate method of Allocation - if the endDate is located on the weekend, the duration of the job will be extended by 2 days. But it triggers an Score Corruption exception.
So, do you guys have a better idea to achieve this requirement?
Many thanks in advance!