FET Forum

FET Support (English) => Get Help => Topic started by: potrempe on August 07, 2024, 07:12:47 PM

Title: Min hours between activities?
Post by: potrempe on August 07, 2024, 07:12:47 PM
Hi! Long time FET user (13 years) but it's the first time I'm stumped enough and cannot figure out a way to implement a constraint.

The school I'm generating a timetable with has 5 school hours (P1 to P5) for each day of the week (D1 to D5), so that's 25 hours a week. All students have 25 hours of courses, so no gaps in the schedule.

For certain subjects that are taught twice a week or more, I need to make sure that a subject is not taught on the last hour of a day and on the first hour of the next day. So for example, if students of group G1 have Music on P5 of D2, they should not have Music on P1 of D3, the earliest would be P3 of D3.

So what I'm trying to implement is some kind of "Min hours between activities". In the case above, I would add a constraint for two "Music" activities for a group G1 with a minimum of 3 hours between them. So:

Thanks a lot!
Title: Re: Min hours between activities?
Post by: Liviu Lalescu on August 07, 2024, 07:25:54 PM
Hello, and welcome to the forum! :)

I was just about to write this:

---
I think the solution is very easy: students min resting hours. You have instructions there in the dialog. I think this is the only constraint in which FET considers activities on different days as being consecutive.
---

but it is unfortunately wrong, because it applies to all the activities of that students set.

However, we might solve this by adding dummy students sets and use the above constraint. Say real students S. Say dummy students DS, add for them only the activities of S and Music. Then same starting time constraint for S and DS Music (respectively). Then constrain DS with min resting hours.

Another possibility to deny FET the option of occupying 2 slots with activities from a set is constraint activities occupy max time slots from selection. Select all the activities of S and Music, select with X (red) D2-P5 and D3-P1, max occupied = 1. Many constraints to add (4 for each such activities), and I am not sure it works if you want more than 1 resting hour.

Another possibility is a customization (but you cannot take benefit then from future FET versions unless we update this custom version), or a new FET official constraint, but I am not sure it is quite useful for other users, and also it is difficult to come up with a good name for this constraint.
Title: Re: Min hours between activities?
Post by: potrempe on August 07, 2024, 07:59:00 PM
Wow thanks a lot for the quick and thorough answer :)

I checked my data and I have 31 different student sets with a total of 44 subjects for these student sets, so I would need to add 176 "activities occupy max time slots from selection" constraints. As the dialog box says "Please do not overuse this constraint" at the top, I don't think I'll do this ;)

I will try adding Dummy students, 2-3 groups at first, then the full 44 if it works properly. Instead of using "Same starting time" constraints for S and DS Music (respectively), wouldn't directly adding a Dummy student group along with the real group in the Activity work?
Title: Re: Min hours between activities?
Post by: Liviu Lalescu on August 07, 2024, 08:10:28 PM
Quote from: potrempe on August 07, 2024, 07:59:00 PMWow thanks a lot for the quick and thorough answer :)

You're welcome! Thank you! :)

QuoteI checked my data and I have 31 different student sets with a total of 44 subjects for these student sets, so I would need to add 176 "activities occupy max time slots from selection" constraints. As the dialog box says "Please do not overuse this constraint" at the top, I don't think I'll do this ;)

This warning might need to be considered for removal. 176 constraints of this type is very acceptable for the algorithm. The warning was meant to avoid overuse in case other constraints are much more effective, like max hours daily.

QuoteI will try adding Dummy students, 2-3 groups at first, then the full 44 if it works properly. Instead of using "Same starting time" constraints for S and DS Music (respectively), wouldn't directly adding a Dummy student group along with the real group in the Activity work?

Oh, sure! I am a bit tired, I guess.

Maybe some new official FET constraints are needed, maybe adding some additional features to the "min gaps (hours) between activities" or "students min gaps between activity tag", to consider the days of the week to be continuous. I will add this in the TODO list.