Do not group activities on consecutive days for teacher has just 8 hours a week

Started by kilindor, January 25, 2026, 03:05:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kilindor

Hi everyone.
I have a teacher who only works 8 hours a week, and a maximum of 3 days.
I want the teacher to work one day, then not work the next, and then work the third day... and so on.
I mean, I don't want to group activities on consecutive days.
thanks for help.

Liviu Lalescu

Hello, kilindor,

Easy: either teacher(s) no two consecutive days, or 4 constraints teacher(s) two mutually exclusive time slots (for each pair of adjacent days).

kilindor

Thank you Liviu for your quick reply, I'll try.


I have another question about "max half days between a set of activites" constraint wich I put to prevent teacher from working saturday evening and monday morning (morning-evening mode).
When I set weight to 100%, the table doesn't generate at all after several attempts, sometimes it reaches n-1 activity and loop for hours. BUT when I reduce weight to 70% I got a one successful table generation and the constraint was not broken.
What I mean is the table was generated as if the constraint weighed is 100%.
So WHY the table is generated with weight of 70%, BUT didn't generated with 100% Or is it just a coincidence and a stroke of luck.


Thanks a lot.

Liviu Lalescu

You are welcome!

Just a stroke of luck. I advise you to generate multiple if you have a multi-core processor, and there are more chances of a solution.

Also, if you want 100%, you can use a constraint teacher mutually exclusive sets of time slots.

kilindor

Thank you very much Mr Liviu.
HHH It's really strange, by reducing the weight I got three timetables, one yesterday and two today without breaking the constraint.
It's been more than a week the table didn't generate with a weight of 100% or 99%. But with 70% it did. ;D  ;D
Anyway thank you very much.

kilindor

Quote from: Liviu Lalescu on January 25, 2026, 07:09:18 PMYou are welcome!

Just a stroke of luck. I advise you to generate multiple if you have a multi-core processor, and there are more chances of a solution.

Also, if you want 100%, you can use a constraint teacher mutually exclusive sets of time slots.

Yes I use multiple generation (4 at same time), I don't have a strong laptop but it serves its purpose, If it successfully generates a table, the generation time is approximately one hour (50 minutes - 40 minutes - 1 hour and 10 minutes)..

If you can explain me how to use "teacher mutually exclusive sets of time slots" constraint, if the teacher works on sunday evening, he will not work on monday evening.

Liviu Lalescu

Teacher pair of mutually excl. sets of time slots: first slots mo evening, second set of slots su evening.

I am sorry, my health is not OK, I cannot answer too well. I'll write later.



Liviu Lalescu

Thank you!

You add a constraint "A teacher has a pair of mutually exclusive sets of time slots". Select the teacher, then in first set of selected time slots select all the slots of Monday evening, and in the second set of selected time slots select all the slots of Sunday evening.

Please let me know if you succeeded.

kilindor

Yes, I understand, thank you very much. I'm waiting to get a timetable with this constraint.

kilindor

Sorry I have more one question hh.

It is about morning-evening mode.

Is there a constraint preventing groups from studying only in the last two hours of the day?
For instance, studying is from 9 to 1 PM, then from 2 to 6 PM.
Some groups in some days only study from 4 to 6 PM, with the rest of the day free.

I want to prevent this.

I don't want to use "min hours 3" constraint because there is no problem for groups to study only 2 hours at day, BUT not the last two hours.

Thank you.

Liviu Lalescu

Absolutely no problem!  :)

Unfortunately, this is more complicated. We already have this in the TODO, I think, and it is a kind of conditional constraint: if the students set has an activity in the last slot, it must have at least 3 activities on that real day. I'll also add your suggestion in the TODO.

It is a research problem, and I would agree to try it, but I would need financial support, which unfortunately is very low for FET.

kilindor

Yes it is a conditional constraint, and I hope will added in the future.

Right now FET has more than enough of beautiful constraints that assist us building nice timetable.

I wish you more success.

Liviu Lalescu


kilindor

Liviu, Related to the topic, is there a constraint that prevents the teacher from having 3 consecutive days of rest?

For instance, if the teacher works on Monday, he won't work until Friday, which means 3 consecutive days of rest (sometimes FET gives this pattern).

I want to prevent this, and give him max 2 consecutive days of rest.

I tried "max gaps per week for real days for a teacher = 16 (which means 2 days)" constraint, but it didn't work.