Managing gaps

Started by Jack_Pk, September 23, 2025, 07:28:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jack_Pk

Hello everybody!

I am struggling with a very complex school timetable due to a large number of non-negotiable constraints.
My school has a daily timetable of six blocks, five days a week, but teachers can never work more than four hours. Normally, there is the possibility of having a gap. Therefore, schedules such as four consecutive hours, or 3-gap-1, 2-gap-2, etc. are acceptable.
Unable to finalize the schedule in any way, I obtained a small additional margin of freedom: I am allowed to give all teachers two gaps once a week.

I thought I had solved my problems this way: max 2 gaps per day + max 6 gaps per week. I assumed that this way, even if there was a day with 2 gaps, I would have at most one gap on the remaining 4 days.
Unfortunately, I hadn't counted on FET deciding to eliminate gaps altogether on some days and put two on others.  So I have teachers who have no gaps for two days a week (which is fine), but then have two gaps on three days a week (very bad).

My question is: is it possible to impose a maximum of two gaps once a week and a maximum of one gap for all other days?

Thank you in advance.



Translated with DeepL.com (free version)

Liviu Lalescu

#1
Hello, Jack!

You could add a dummy activity for each teacher, A1,A2,A3,A4,A5,A6 (durations 1+1+1+1+1+1), min 1 days (A1,A2,A3,A4,A5), 100% (notice A6 is not constrained). Then max 0 gaps for each teacher.

xtzetzias

I was about to suggest the same as Liviu, but with 1+1+1+1+2 hours (if you don't mind 2 consecutive gaps) or the dummy activity with 1+1+1+1+1 and a second dummy activity, with only one hour. Of course, 0 gaps for everyone. I use the extra hour, because i think you mean that 5 gaps are not enough.

Liviu Lalescu

Thank you, xtzetzias! I corrected my post above (should be 6 activities, duration 1 each, and only 5 of them in a constraint min 1 days between activities 100%).

It is best not to have an activity with duration 2, because this would constrain the timetable more than necessary.

xtzetzias

Ok, now it's better than my solution with two activities. I'm not sure i understand how A6 is not constrained, but i will look into it (it probably has to do with the min 1 constraint, which i do not know)

Liviu Lalescu

A constraint min days between activities can be edited in its list of constraints dialog.

xtzetzias

Thanks! Yes, i just found it. Guess i haven't got familiar enough with activities' constaints...

Jack_Pk

Thank you for the replies. Your suggestions didn't fully meet my needs: creating six dummies would have forced all teachers to have the same number of free hours, whereas I wanted FET to use those only when strictly necessary.
 
The dummy-based approach was still the right one, though it needed refinement: I labeled all school activities as "regular" (max 4 hours per day), assigned one dummy hour to each teacher, and set a maximum of one free hour per day. This way, FET used the dummy as a wildcard, leaving only a few "unlucky" teachers with a double free hour, while for the others the dummy was placed at the start or end of the day, effectively disappearing.

Thanks for the help!
Bye bye.

xtzetzias

A suggestion I've made could solve your problem. If there was a constraint "Min gaps per day" you could just set min gaps per day to 1, max gaps per day to 2 and max gaps per week to 6.
Liviu says it's difficult to impliment. I hope he will be able to do it :-)

Vangelis Karafillidis

Hello.

There are some "indirect" ways that result in min gaps per day = 1. For example you could use a combination of pseudo-activities and a combination of constraints in order to "force" FET to generate a timetable with min gaps per day = 1 for a teacher. But, the user needs accuracy and of course much time and effort in order to add all these pseudo-activities and constraints even just for one single teacher.

Vangelis.