FET Forum

FET Support (English) => Get Help => Topic started by: sasbland on November 16, 2024, 08:57:59 PM

Title: Teacher works 4 consecutive days
Post by: sasbland on November 16, 2024, 08:57:59 PM
Hi,

I have a teacher who works 4 days a week but wants either Mon or Fri off. How do I put this constraints.

They teach 18 hrs so I was thinking of using A set of activities occupies min time slots and choose Tues, Wed, Thurs to have 15 hrs, so fet put the other 3 hrs on either Mon or Fri. But I think that's too restrictive as either Mon or Fri can have upto 5 hours.

Thank you very much.
Title: Re: Teacher works 4 consecutive days
Post by: Vangelis Karafillidis on November 16, 2024, 10:37:36 PM
Quote from: sasbland on November 16, 2024, 08:57:59 PMHi,

I have a teacher who works 4 days a week but wants either Mon or Fri off. How do I put this constraints.

They teach 18 hrs so I was thinking of using A set of activities occupies min time slots and choose Tues, Wed, Thurs to have 15 hrs, so fet put the other 3 hrs on either Mon or Fri. But I think that's too restrictive as either Mon or Fri can have upto 5 hours.

Thank you very much.

1) Constraint: Teacher - max days per week (max days = 4)
2) Constraint: Teacher - min days per week (min days = 4)
The above constraints are going to force the teacher to work for exactly 4 days.
3) Constraint: Activities - max days between a set of activities (max days = 3). Just select all the activities of this teacher.
Of course you should add some other constraints (such as max/min hours per day, max hours continuously, max gaps, etc). You might already have added these constraints for this teacher...

I hope this works.
Vangelis.
Title: Re: Teacher works 4 consecutive days
Post by: Volker Dirr on November 16, 2024, 11:13:14 PM
3) Can be maybe improved: If you have an activity with min day 100% constraint and 4 sub-activities, then you only need to select that activity instead of all activities.

An other variant is:
Add an activity with a duration as large as you has hours per day. Set activity preferred time on Monday and Friday for this activity.


Be careful with both variants. If there are a few more teachers with 4 days only that want to have similar rules, then you will become very fast impossible timetables. So do it only if you can solve your timetable easy.
Title: Re: Teacher works 4 consecutive days
Post by: sasbland on November 17, 2024, 08:37:45 AM
Thank you both. Will try them all.
Title: Re: Teacher works 4 consecutive days
Post by: Liviu Lalescu on November 17, 2024, 08:42:06 AM
Volker, your improvement might slow the generation. It is best to add max 3 days between all activities of the teacher, I think, because the search eliminates earlier wrong placements.
Title: Re: Teacher works 4 consecutive days
Post by: Vangelis Karafillidis on November 17, 2024, 08:48:14 AM
Quote from: Volker Dirr on November 16, 2024, 11:13:14 PM3) Can be maybe improved: If you have an activity with min day 100% constraint and 4 sub-activities, then you only need to select that activity instead of all activities.

Liviu has just responded about this approach. To be honest I was typing and... I thought that your approach might be better than "max days between activities" in this special case (if the user had one activity with spit = 4, min days between activities =1). The only "problem" I had, was that we didn't know this user's dataset. But Liviu has clarified what the issue is.

QuoteAn other variant is:
Add an activity with a duration as large as you has hours per day. Set activity preferred time on Monday and Friday for this activity.

Most likely the user has some constraints "max hours daily". So, this approach for some schools (for example for Greek schools), which work (let's say) 5 days per week & 7 hours per day, is virtually impossible. But your suggestion is of course useful for other schools and/or when the constraints "max hours daily" do not cause problems.
An alternative would be to add a pseudo-activity (no students, no teacher, duration = total hours per day), set preferred time slots Monday + Friday for this pseudo-activity. Then select the real activities of this teacher + the pseudo-activity, and add a constraint "a set of activities are not overlapping".

QuoteBe careful with both variants. If there are a few more teachers with 4 days only that w[ant to have similar rules, then you will become very fast impossible timetables. So do it only if you can solve your timetable easy.

I agree that we should be very careful with the constraints/rules we add. Many users tend to confuse the easiness of adding constraints with the possibility of having a solvable timetable...

Vangelis

Title: Re: Teacher works 4 consecutive days
Post by: Volker Dirr on November 17, 2024, 10:59:44 AM
Good point. True. So my optimized variant must also add also the activities that are in the initial order before the first activity with 4 sub activities with min n day 100% weight. So in best case it contains only the 4 sub activities. In worst case it contains all activities. I guess in real world dataset you need to add much less than 50% of the activities. Small disadvantage of my variant: You need to check the initial order of the activities and that can change if you modify the data set. So this is probably only a good idea if you have a very difficult data set.