Help setting constraints for married teachers.

Started by Vinicius Rocha, June 27, 2026, 06:38:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vinicius Rocha

Hi, this is the first time i'm using fet and I'm having trouble with a constraint. In my teachers' set i have some married ones. Some of the couples (the ones with small children) ask to never be allocated at the same shift (morning, afternoon or night), the same day is ok, but not the same shift. I believe that if I add a tag, say TeacherA, to the activities of teacher A, and the same for teacher B, so the constraint A set of activity tags are not overlapping will make their schedules not overlap, the individual hours, but not the whole shift. Is it possible in any way?

Thanks in advance.

Liviu Lalescu

#1
Hello, and welcome!

Indeed, you are right about A set of activity tags are not overlapping, is not perfect for you.

Are you using FET in the Official mode? A FET day is a real-life day, having a morning, an afternoon, and a night (on the same FET day)?

Volker Dirr

Good question.
If your timetable is not too difficult (or in worst case if we don't have better ideas) i suggest this as an quick and "dirty" solution:

Just set "not available" times for that 2 guys; so that it is impossible for them to have overlapping shifts.

Vinicius Rocha

Quote from: Liviu Lalescu on June 27, 2026, 06:49:01 PMHello, and welcome!

Indeed, you are right about A set of activity tags are not overlapping, is not perfect for you.

Are you using FET in the Official mode? A FET day is a real-life day, having a morning, an afternoon, and a night (on the same FET day)?


Hi, Liviu, thanks a lot for the reply. Yes, official mode and each fet day is a real day with 15 hours. Would your suggestion be something in the line of making each shift a day? I didn't think about that but thinking about it now it looks like it may work.

Liviu Lalescu

Yes, a possible solution would be to make a FET day = a real-life shift; please note that if you need real min days between activities in you file, the constraint min days between activities will work differently. Then, you need to add min 1 FET days between each pair of activities of A and B. But it is a lot of work.

I am too tired now, I need to sleep. I'll try tomorrow to think of a solution and let you know if I find a trick.

Liviu Lalescu

#5
Hello again, vinomartins,

1) The tricks to work with current FET:

a) Each real-life shift will be a FET day. So you'll have 3 x 5 (or 6?) = 15 (or 18?) FET days.
b) For each 2 excluding teachers TA and TB, add a third teacher, TC. You will add TC in all the activities of TA and TB.
c) Activities of TA have tag ATA, and activities of TB have tag ATB.
d) Add a constraint TC max 1 activity tags per day from set (ATA, ATB).

Take care that the constraints min days between activities work with FET days.

2) A perfect constraint, so you don't need tricks, might be: "a set of activities has max n activity tags from a set in selected time slots", where n is in your case 1, or some other new constraints (maybe similar for teachers and students, not only for activities). I will add this in the list of the suggestions, the TODO list, and think of it. The big problem is the lack of financial support for FET. If the international community of users would sponsor me for my price for this new constraint, I would do it.

Hmm, I might add constraint "activities max activity tags from a set in selected time slots" soon (these days), even if not sponsored. It is a necessary constraint. Let me know if you are interested in helping me testing it, if I will be able to do it!

Vinicius Rocha

Hi, Liviu and Volker. Thank you both for your answers. As I mentioned, this is the first time I'm using FET, i'm adding the constraints gradually, but all activities' and teachers' time restrictions are already added, so it would be a lot of work to redo everything with new days. I believe I'll just follow Volker's suggestion and create hard restrictions on these couples.

If you create the constraint I'll be happy to test it, maybe my sample space is too small but I can try (2 couples on this situation, funnily enough, the other couples want to be allocated at the same shift so they can have the same free shifts).

For context, I'm trying to create a timetable for the public institution in Brazil where I teach, we've both highschool and undergrad courses, ~450 subjects and ~100 teachers. The timetable was done by hand, replicating the previous ones, but as some new restrictions and changes in the courses appeared it has became impossible to do it by hand. I was told that there was no budget for buying a software license for timetabling, someone tried before me. For now FET seems to work in our situation, but I haven't included all the restrictions and rooms/lab specifications yet. Thanks a lot Liviu for this nice software.

Liviu Lalescu

Hello, vinomartins,

I actually decided on adding this new constraint. I hope to have something ready for testing later tonight or tomorrow afternoon, so please stay tuned for it! I hope you can help me testing. Also, maybe you would like to send me your file so that I can check on my computer (liv4 AT lalescu DOT ro, or here if it is public).

What compiled version would you need for testing? (I mean Windows, GNU/Linux? I cannot help with macOS, personally, but maybe Volker can)

Vinicius Rocha

I'm on Gnu/Linux. I'll send the .fet file by e-mail. Thanks a lot.

Liviu Lalescu

Thank you, as well! Do you need the bin executable for GNU/Linux, or you compile the sources tar.xz?

I'll wait for your email.

Vinicius Rocha

I'm using the binaries. I just sent you the email.

Liviu Lalescu

Email received! Thank you! Please write me also the names of the pairs of involved teachers!

Liviu Lalescu

The engine part (most important part) compiles correctly (not tested yet). I'll now have the interface part (most boring part), and maybe in 6 hours we'll have a snapshot.

Liviu Lalescu

I wrote an initial code which compiles:
https://lalescu.ro/liviu/Backup-fet/
, but I am too tired to continue working now. I hope tomorrow afternoon I might publish a tested working snapshot.