FET Forum

FET Support (English) => General Stuff => Topic started by: sasbland on August 27, 2021, 11:12:00 AM

Title: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 27, 2021, 11:12:00 AM
Hi,

It turns out we can't fix a lunch break so now our periods are

P1 8:30 – 9:30
P2 9:45 – 10:45
P3 11:00 – 12:00
P4 12:15 – 13:15
P5 13:30 – 14:30
P6 14:45 – 15:45
P7 16:00 -17:00
P8 17:15 – 18:15

and lunch break can be one out of p4 or p5 and it doesn't have to be the same everyday.

Question 1: How do I set this one up?

I'm thinking of creating activity called lunch, 5 sessions with min 1 day at 100% weight, then choose preferred time slots for those 2 periods. Is this the right approach? Do I have create this activity for each subgroup? What about the teacher? How do I ensure they also have a lunch break?

Question 2: I would like a teacher who starts early to finish their day early, say p1-p6. And teachers who needs to do p8 starts at p2 for example. Again it can be any days. How do I do this one?

Many thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 27, 2021, 12:10:53 PM
Hello,

Question 1: This could be implemented very easily in the code, but as a hack. Many other users asked this, but unfortunately it cannot be implemented perfectly, as the (majority of) other constraints. The reason is counting the gaps, and it cannot be treated reasonable, universally. So:

a) You could use a customization (I did something similar here: https://lalescu.ro/liviu/fet/download/custom/poetasandaluces/, but for p3 and p4);

b) Your approach: yes, add such activities for each subgroup and each teacher;

c) Use the constraint activities occupy max time slots from selection: add n_subgroups x n_days_per_week such constraints, all the activities of that subgroup, select the two slots p4 and p5, max occupied = 1. The same for the teachers.

Question 2: You could use teachers max span per day. But p1-p7 and p2-p8 (max 7) or p1-p6 and p3-p8 (max 6). Otherwise (p1-p6 and p2-p8) you might need a customization.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 28, 2021, 12:19:32 AM
Thanks very much. What is the difference between activity preferred time slots and activity occupied max time slots?
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 28, 2021, 01:15:34 AM
I also have another question.

According to the 8 periods above, how can I set that each group of student only starts in p1 one day a week or 2 days a week? Or similarly, they only have p8 one day a week? I want to avoid students starting early or finishing late on too many days. And similarly for a teacher. Thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 28, 2021, 08:13:57 AM
Quote from: sasbland on August 28, 2021, 12:19:32 AM
Thanks very much. What is the difference between activity preferred time slots and activity occupied max time slots?

Preferred time slots: A set of/an activity can only be in these slots.

Occupy max: Please read the Help there.

Quote from: sasbland on August 28, 2021, 01:15:34 AM
I also have another question.

According to the 8 periods above, how can I set that each group of student only starts in p1 one day a week or 2 days a week? Or similarly, they only have p8 one day a week? I want to avoid students starting early or finishing late on too many days. And similarly for a teacher. Thanks.

Teachers/students interval max days per week.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 28, 2021, 08:54:48 PM
Thanks. I'll try that.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 28, 2021, 11:39:29 PM
I have come across a new problem.  Now that I add activity lunch, I will need some lessons (either 2 hr or 3 hr lessons)  to be able to split over lunch break, to give more flexibility. Otherwise the timetable is impossible. Is there a way I can do that? Thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 29, 2021, 08:25:47 AM
Maybe by luck the timetable is not impossible?

There is no way to allow an activity with duration 2 or 3 split over a break. The activity is indivisible.

There is the constraint two (three) activities grouped, which allows two (three) activities to be grouped splitting over a break. But you have no usual break (constraint break).

I can think only that you could use a customization (I apologize for the frequent customization proposals, but some features cannot be universal).
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 29, 2021, 10:12:22 PM
Unfortunately our main constraint is that we don't have enough rooms. So we need the ​timetable to spread out as much as we can even though there is no clash in lessons or teachers.

Where do I start with customisation? Will it work for any 'new' file or only this time?

Many thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 29, 2021, 11:12:59 PM
Sorry but I have another question. We have a support class for some students only. Is it possible to set this to be either at the beginning or the end of the day, so students who don't need the support do not have a gap during the day.

In my original timetable (p1-p6) I used preferred time slots and picked p1,p2,p5,p6. Students who don't take support class will just come in late or go home early.

In this timetable, although I have 8 periods, it's very likely that students' day will only occupy 6 periods (either p1-p7 or p2-p8). So I can't do preferred time slots anymore as I don't know when they will start and end.  I can see the constraint activity ends student's day but not start the day.

Many thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 30, 2021, 08:33:38 AM
Quote from: sasbland on August 29, 2021, 10:12:22 PM
Unfortunately our main constraint is that we don't have enough rooms. So we need the ​timetable to spread out as much as we can even though there is no clash in lessons or teachers.

Where do I start with customisation? Will it work for any 'new' file or only this time?

Many thanks.

You could use constraints for preferred rooms and see if the timetable is still possible.

I was thinking of a customization of the constraint two activities grouped, which means a custom version of the code of FET-6.1.5 (currently). This will be possible to be ported on future versions of FET.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 30, 2021, 08:47:32 AM
Quote from: sasbland on August 29, 2021, 11:12:59 PM
Sorry but I have another question. We have a support class for some students only. Is it possible to set this to be either at the beginning or the end of the day, so students who don't need the support do not have a gap during the day.

In my original timetable (p1-p6) I used preferred time slots and picked p1,p2,p5,p6. Students who don't take support class will just come in late or go home early.

In this timetable, although I have 8 periods, it's very likely that students' day will only occupy 6 periods (either p1-p7 or p2-p8). So I can't do preferred time slots anymore as I don't know when they will start and end.  I can see the constraint activity ends student's day but not start the day.

Many thanks.

It is impossible to add a perfect constraint activities begin or end students day. It might be possible as a (difficult) customization as a hack, but it is ugly.

The easy and good way is to use the students' divisions. Say if Support is optional, you can divide the year by one category which is: Support: HAVE_SUPPORT and DON_T_HAVE_SUPPORT, along with the other possible categories. This way, if you add max 0 gaps to all students, this will include the option of 0 gaps for those who don't have Support. Let me know if you need more help or a small example file. There is some help in the FAQ for this one (and old entry, now it is easier to divide by categories), see:

---
Q: More information about students' structure

A: The students' structure is very flexible and permits any institution structure.
...
---
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 30, 2021, 11:35:35 AM
Quote from: sasbland on August 29, 2021, 11:12:59 PM
Sorry but I have another question. We have a support class for some students only. Is it possible to set this to be either at the beginning or the end of the day, so students who don't need the support do not have a gap during the day.

In my original timetable (p1-p6) I used preferred time slots and picked p1,p2,p5,p6. Students who don't take support class will just come in late or go home early.

In this timetable, although I have 8 periods, it's very likely that students' day will only occupy 6 periods (either p1-p7 or p2-p8). So I can't do preferred time slots anymore as I don't know when they will start and end.  I can see the constraint activity ends student's day but not start the day.

Many thanks.

I attach a small example file for dealing with optional subjects which need to begin or end the day.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 30, 2021, 06:31:02 PM
Thanks so much. I'll look into splitting students again.


I was thinking of a customization of the constraint two activities grouped, which means a custom version of the code of FET-6.1.5 (currently). This will be possible to be ported on future versions of FET.

I'm very interested in this if it's not too much of a trouble for you. We definitely lack rooms and that's the main reason we stretch the day from 6 periods to 8.

Many thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 30, 2021, 06:46:47 PM
Quote from: sasbland on August 30, 2021, 06:31:02 PM
I'm very interested in this if it's not too much of a trouble for you. We definitely lack rooms and that's the main reason we stretch the day from 6 periods to 8.

OK. We can try. I am thinking of modifying only the core part of the constraint two activities grouped, so that if the activities are interrupted by p3 or p4, it is allowed.

Let me know.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 30, 2021, 08:57:43 PM
Thanks so much. Actually it is p4 or p5 that are designated as lunch break and would like the activities to be split over this if need to. Thanks again.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 30, 2021, 09:08:35 PM
OK, I will try. Now it is 23:02 here, so probably tomorrow.

I could use an example file from you, but I can also derive one myself.

So, you have activities with duration 2 or 3 which can be stretched over a break. So, they will be 1+1 or respectively 2+1, and you will add a constraint two activities grouped for each such pair. I assume the 2+1 components of the ones with duration 3 are equivalent.

The periods P4 and P5 between them will be ignored, like a constraint break's X slots.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 31, 2021, 11:08:14 AM
I hope I got it correctly: https://lalescu.ro/liviu/fet/download/custom/sasbland/

I tested it, but also please test it as well. There is also a small file for you to use (sometimes two grouped activities spread over P4/P5, but sometimes not, you can generate more timetables).
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on August 31, 2021, 07:30:43 PM
Hi, thanks so much for your work. I had a look and still not quite clear. Do I pick 2 activities myself to group together? Won't that limit the choice for FET as actually I don't mind which activities will stretch over the break.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 31, 2021, 07:44:05 PM
Oh, I think I understand better. So you have activities split as 1+1 or 1+1+1 and you need them, if they are on the same day, to be consecutive, but allowing to split across P4/P5?

I will try to make this, which will be a bit more complicated, so that any activities from the same large big split activity will be allowed to split over P4/P5.

Could you confirm, please?

Also, please let me know if you need an automatic alternative break P4/P5 for each teacher/students subgroup.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on August 31, 2021, 09:04:23 PM
I hope I did it correctly now: https://lalescu.ro/liviu/fet/download/custom/sasbland/ . It was more complicated and I still fear a bit of generation bugs, so please report if the file is impossible and you think it should solve.

Activities with min days between them constraints, with consecutive if same day, can stretch over the break P4/P5, and each teacher and subgroup must have a break P4 or P5 each day.

In P4 or P5 the gaps are counted. If you want not to count them, please let me know (it will be a bit complicated, but might be necessary if you care about gaps). Or maybe if you want 0 gaps for the students, you will permit 1 gap per day for them, for instance.

There are two small examples.

Please let me know.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on September 01, 2021, 08:50:54 AM
I discovered some bugs, the problem was more difficult than I initially estimated. I have just put a new version on the same link: https://lalescu.ro/liviu/fet/download/custom/sasbland/
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on September 01, 2021, 08:55:07 AM
I'm sorry I didn't explain clearly and maybe wasted your time.  My activities can be either 1+1, 2+1, 2+2, 2+3 or 2+2+2 and I have not put consecutive constraints on any of them as ideally we prefer them not to be on the same day at all (if it's soft conflict and they are on the same day, I generate again)

I would like the 2 or the 3 hr sessions to be able to split over the p4 or p5 if that is possible.

I'll have a look at your new version today. I can send you my fet file that I've done so far too. It's not complete yet as we have more activities to add and we haven't finalise on the teacher and the room. Could I email it to you rather than putting it here?

Many thanks.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on September 01, 2021, 09:17:42 AM
No problem!  :)

By 2+2+2 do you mean a large activity split into 3 (sub)activities, each with duration 2? By 2+3 do you mean a large activity split into 2 (sub)activities, with duration 2, respectively 3?

Yes, sure, you can send by email, since it is private information. You can find my email here: https://lalescu.ro/liviu/contact/

Your situation is a difficult one, since a (sub)activity in FET cannot split over some hours. It is a fundamental thing. One thing we could do is to input (sub)activities with duration 1 or 2. FET won't put more than two (sub)activities on the same day when consecutive if same day is true. And we could input the weight 0%, so that FET won't waste computing time.

What I am suggesting: for 1+1, 2+1, 2+2, 2+3 or 2+2+2, you will input instead 1+1, 1+1+1, 1+1+1+1, 1+1+1+2, and 1+1+1+1+1+1, with min days constraint having weight 0% and consecutive if same day = true. FET won't put 3 subactivities on the same day if consecutive if same day = true, and the two subactivities on a day can spread over P4/P5. A drawback is that you might end up for instance in 2+1 (1+1+1) with the activities on 3 days, 1+1+1, not on 2 days. But if this is not acceptable, I might improvise something also for this.

This will be similar to the current custom version for you (sasbland3, currently).

I have a question: you said for instance that a possible variant is 2+2+2. Could it be allowed in this case a 1+1+2+2? Or 2+3, could it be for instance scheduled as 1+1+1+2?

I will wait for your email and then maybe get a better idea.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: sasbland on September 01, 2021, 12:24:50 PM
Thanks so much. I have sent you an email.
Title: Re: Allow a lunchbreak in any 2 periods
Post by: Liviu Lalescu on September 01, 2021, 03:01:25 PM
I added the latest version: https://lalescu.ro/liviu/fet/download/custom/sasbland/