Teacher Interval Max Days Per Week, but Only Specific Days Free

Started by OnBeyondBeing, July 28, 2018, 08:51:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

OnBeyondBeing

I'm trying to give a teacher an interval free, but only on a specific set of days.  For example:

- A teacher works an hourly interval from Hour 1 to Hour 3 on 4 days of the 5-day work week (Monday-Friday).  However, the one day he doesn't work this interval has to be either Tuesday or Wednesday.

I've normally addressed this problem by using TeacherIntervalMaxDaysPerWeek, generating a lot of schedules, and manually looking for ones when Mr. T is free on Tuesday or Wednesday.  But now I have 10 constraints like this, so it's very unlikely that all 10 teachers will be free on the correct days on the same schedule.  And looking through them all manually is very slow.

Is there any way to program this into FET?

Thank you for all your help.

Liviu Lalescu

Maybe you could add a dummy activity for T and fix it to Tuesday or Wednesday. But this introduces additional activities for T. Remove the interval max days per week.

To force T to have at least an activity on Monday Hour 1 to Hour 3 you can use the constraint activities occupy max time slots from selection (read its help). So if you know that on Monday, Thursday and Friday T must have at least 1 hour, you can add 3 such constraints (occupy max) and keep the interval max days per week.

OnBeyondBeing

Thank you very much for your quick response.

QuoteMaybe you could add a dummy activity for T and fix it to Tuesday or Wednesday. But this introduces additional activities for T. Remove the interval max days per week.

I've done something very much like that in the past, when I've been able to.  The problem is that it requires me to create activities which take up space in the teacher's schedules.  If I created fake activities to make sure this teacher is teaching Hours 1-3 on Monday, Thursday, and Friday, then the teacher is going to be "busy" for three more hours of the week.  That means FET won't put classes in those three spots.  This is a problem for many of my teachers, who are too busy to have those periods be empty.

QuoteTo force T to have at least an activity on Monday Hour 1 to Hour 3 you can use the constraint activities occupy max time slots from selection (read its help). So if you know that on Monday, Thursday and Friday T must have at least 1 hour, you can add 3 such constraints (occupy max) and keep the interval max days per week.

I read the help for Constraint Activities Occupy Max Time Slots and it was mind-blowing.  I never thought of using that constraint like that before.  I mostly use it to make sure that classes don't get placed at the beginning or end of the day too often.

This is a new idea to me, so please check my understanding:

In order to express my constraint, which was:

Quote
QuoteA teacher works an hourly interval from Hour 1 to Hour 3 on 4 days of the 5-day work week (Monday-Friday).  However, the one day he doesn't work this interval has to be either Tuesday or Wednesday.

I would need to do the following:

- Make a constraint which says Mr. T works the hourly interval Hour 1 to Hour 3 on 4 days of the 5 day work week.
- There are 5 hours each day so there are 25 hours in the week (5*5).  Mr. T works 16 hours (4*4).  I would make a constraint Activities Occupy Max Time Slots, with all 16 of Mr T.'s classes, all the hours in the week except Monday 1-3, which would be 22 hours, and a Max Occupied of 15, which is 16-1.  This guarantees that at least one of Mr. T's classes must happen during Monday 1-3.
- Repeat the Activities Occupy Max Time Slots constraint for Thursday 1-3 and Friday 1-3.

Is that all correct?

Is there any problem with doing things like this?

Liviu Lalescu

I think this is correct (I am tired, but I hope I am not mistaking).

If you know that T must work on say Monday 1-3 say at least 2 hours, you can improve the constraint, maxOccupied=16-2=14. This is better for the algorithm. If T must work at least 3 hours, add maxOccupied=16-3=13.