How to emulate a second level of subgroups with common parents

Started by Julio González Gil, January 16, 2017, 12:08:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Julio González Gil

Hi everyone.

First of all, thanks to Liviu Lalescu and Volker Dirr for this excellent software.

I am trying to help a friend here with a particular group structure, and trying to get rid of the problems so we can have the time table ASAP and we can help you with the Russian translation (I noticed there are several things without translation), maybe creating windows installers with NSIS and DEB/RPM packages, so it's easier to distribute FET (maybe I could even help you with a Continuous Integration if you are interested)

Now, going back to the problem:

In this particular case, the timetable has several groups for each year (in our case, a year is not a year but a Degree), for example:

LD11, LD32, LD33

The groups study all the theory together, but for the practical activities they are distributed differently depending on the activity:

- Either two subgroups (let's call them P1 and P2) with equal size.
- Either three subgroups (let's call them B1, B2, B3) with equal size.

With the current distribution of students:

- B1 contains half of P1.
- B2 contains the other half from P1 and half of P2
- B3 contains the last half for P2.

So P1 is "parent" for B1 and B2, and P2 is "parent" for B2 and B3

Obviously this allows activities for B1, B2, and B3 to happen at the same time, but also for P1 and B3, and P2 and B1.

This is what I already achieved, after adding all the activities, by adding constraints "A set of activities are not overlapping":

- Activities from P1 never happen at the same activites from B1.
- Activities from P1 never happen at the same activites from B2.
- Activities from P2 never happen at the same activites from B2.
- Activities from P1 never happen at the same activites from B3.

This works without any issue.

But the problem is that no student can have more than 4 hours of lessons each day without gaps (each day have 6 hours), and since Bs are not related to Ps (since all of them are subgroups, with one of the groups as parent), the restriction "Max hours daily for all students" does not work.

In other words, the sequence  "A, P1, P1, B2, B2" does not trigger the constraint since for FET P1 and P2 are different subgroups. It also doesn't prevent gaps for sequences such as "P1, P1, B2, B1" despite some students will be present at P1 and B1, but not at P2.

I tried several things like:

- Applying "Max hours daily for a students set" for all of the groups.
- Creating tags B1, B2 and B3 and adding them to all theory and practice activities showing which Bs are part of each P, and showing that all Bs are part of each group, then I tried to enable the constraint "Max hours continuously with an activity tag for all students" and "Max hours continuously with an activity tag for a students set" and it is not working.
- Playing with the availability for the students sets reducing each day to four hours, but it doesn't help as if I restrict the groups to have only four hours available, the teachers are not able to teach all the activities.

Does anyone has any suggestion about how to proceed?

At this moment I can't publish the .fet file or tables, but I'll request permission to do so if you fell that it can help.

Liviu Lalescu

#1
Thank you for your kind words! Did you obtain good timetables for other files?

Did you see the constraint activities occupy max time slots from selection? You can add a set of activities, select a single day, and say that max occupied is 4. If you add n_days_per_week constraints, you can obtain a custom max hours daily.

But I think you are complicating things. I think you just need to divide the year by 2 categories (divisions P1, P2, and divisions B1, B2, B3). Then maybe delete useless subgroups, like B3_P1, and use subgroups like B2_P1.

Please let me know.

Liviu Lalescu

#2
I forgot:

About the Russian translation: if you want, I'll talk to the current translator (I think he abandoned the work) and assign you. Just let me know.

About a Windows installer: I prefer to keep things simple, without an installer. But I may change my mind.

About .deb and .rpm packages: yes, this would be useful. If you manage these, I will put a link to your page, in a similar way with the Mac executable.

About giving your .fet input file: it might help. You can also send the input file by email to me or Volker.

Julio González Gil

Thanks for your help!

Quote from: Liviu Lalescu on January 16, 2017, 07:48:11 AM
Thank you for your kind words! Did you obtain good timetables for other files?

Yes, FET is doing a nice job when there are only subgroups P* or B* for a given group  :)

Quote from: Liviu Lalescu on January 16, 2017, 07:48:11 AM
Did you see the constraint activities occupy max time slots from selection? You can add a set of activities, select a single day, and say that max occupied is 4. If you add n_days_per_week constraints, you can obtain a custom max hours daily.

But I think you are complicating things. I think you just need to divide the year by 2 categories (divisions P1, P2, and divisions B1, B2, B3). Then maybe delete useless subgroups, like B3_P1, and use subgroups like B2_P1.

The problem with the constraints is that (if I understand the idea) I would need to create four "activities occupy max time slots " constraints for each group using P and B (we have four of them).

- Full group, P1 activities, B1 activities
- Full group, P1, B2
- Full group, P2, B2
- Full group, P2, B3

And most probably I would need to repeat this for each one of the days (we have 12 as we configured two weeks of six days) so this will go against the advice of not adding too many constraints of this tipe.

However I am not sure what do you mean with "n_days_per_week" constraints.

About the categories and divisions I think I can get the idea, but in this case there will be separate tables for P1 and P2 (as both will be groups, not subgroups), while what is needed is a table for the group which contains all the info for the common lessons (theory) and all practice lessons for P1, P2, B1, B2 and B3.

As I think my explanation wasn't too clear, I'll post a couple of screenshots (one with student groups and one with chunk of a timetable). The original stuff produced by FET is on the left, but I provide the translation (without subject names) on the right.

In this case, and only for this day, students' availability is restricted (first hour is not available), but other than that it is fine as an example.

As you can see FET is working charmly, as it can fill the five slots.

However a student such as for example student #2 would have 5 hours, because he belongs to SD31-P1, SD-31 (theory lessons), and SD31-B1

So in the end what I guess I need is something like "restrict max number of hours that several sets of students can study per day" so all sets are considered for the calculation and I can combine .

My friend just told me that I can share the .fet file, so it is now attached to this post.

Instead of having a look at LD101 (ЛД101) which is the first we added and more or less is working because students can't study during the last two hours in any case, I suggest you have a look at SD31 (СД31). П1 is P1, П2 is P2, Б1 is B1, Б2 is B2 and Б3 is B3.

Liviu Lalescu

#4
Quote from: juliogonzalez on January 16, 2017, 04:34:27 PM
Quote from: Liviu Lalescu on January 16, 2017, 07:48:11 AM
Did you see the constraint activities occupy max time slots from selection? You can add a set of activities, select a single day, and say that max occupied is 4. If you add n_days_per_week constraints, you can obtain a custom max hours daily.

But I think you are complicating things. I think you just need to divide the year by 2 categories (divisions P1, P2, and divisions B1, B2, B3). Then maybe delete useless subgroups, like B3_P1, and use subgroups like B2_P1.

The problem with the constraints is that (if I understand the idea) I would need to create four "activities occupy max time slots " constraints for each group using P and B (we have four of them).

- Full group, P1 activities, B1 activities
- Full group, P1, B2
- Full group, P2, B2
- Full group, P2, B3

And most probably I would need to repeat this for each one of the days (we have 12 as we configured two weeks of six days) so this will go against the advice of not adding too many constraints of this tipe.

However I am not sure what do you mean with "n_days_per_week" constraints.

Just the answer for the first part now (I'll answer a bit later for the rest of your message, after reading more carefully):

I invite you to neglect the warning about not adding too many constraints activities occupy max time slots from selection :)  . The constraint is working good in the way I recommended you to use it, even if there are very many constraints. The only bad thing is that you need to work a bit to add the constraints.

About n_days_per_week constraints: I meant you need to add 12 constraints for each part, as you guessed.

Liviu Lalescu

#5
Quote from: juliogonzalez on January 16, 2017, 04:34:27 PM
About the categories and divisions I think I can get the idea, but in this case there will be separate tables for P1 and P2 (as both will be groups, not subgroups), while what is needed is a table for the group which contains all the info for the common lessons (theory) and all practice lessons for P1, P2, B1, B2 and B3.

The first observation is that it would be best to use categories (automatic division of years into groups and subgroups). In my opinion it is more important to have a correct structure of the students than just a nice visualization of the timetable.

But I hope there is good news even for this problem: you could view the activities' timetable, or even a nicer idea: define dummy activity tags (without any constraints attached to them), and add them to the activities, as necessary, so that the activity tags' timetable will show what you need. An activity may have more activity tags attached. Please let me know if you understand me and if this works.

Julio González Gil

#6
Hi again.

Yes, I think I understand both ideas (I hope!).

The problem about the first one is that it will generate a lot of constraints (unless I'm wrong):

- 4 for each day (each P/B combination)
- 12*4 for each group (LD101, LD102...) having both P and B
- And since we have 7 groups with this configuration, that's 336 restrictions.

Most probably too much, even if I just ignore the warning about this kind of constraints.

So for me you are obviously right, and the way to go is using a proper group/subgroup division.

If I understand the idea correctly, that means:

- The groups (LD101, LD201...) being years and not groups as now
- Two groups (from FET perspective) being LD101-P1 and LD101-P2.
- LD101-P1 will contain LD101-P1-B1 and LD101-P1-B2 as subgroups.
- LD101-P2 will contain LD101-P2-B2 and LD101-P2-B3 as subgroups.

Then fake tags with the same names as the groups -years for FET- such as LD101, LD201... to be assigned to the activities:

- Theory activities will be assigned to years (FET)
- Practice activities will use the correct groups or subgroups:
  * P1 will use group LD101-P1
  * P2 will use subgroups LD101P2
  * B1 will use subgroup LD101-P1-B1.
  * B2 will use subgroups LD101-P1-B2 and LD101-P2-B2.
  * B3 will use subgroups LD-101-P2-B3.
- All activities (both theory and practice) will have the tag for the parent group (i.e. LD101).

So in this case:

- LD101-P1 and LD102-P2 activities happen at the same time as long as they use different teachers, or can't if they use the same (which is correct).
- B activities won't require "A set of activities are not overlapping" anymore since the subgroups will prevent it.
- The constraint "Max hours daily for all students" will work even for B* since for example LD101-P1-B1 is a children of LD101-P1 which itself is a children of LD101.

To make it more graphical, the attached screenshots is what I need for every group having both P and B, plus a dummy tag LD101 (and the same for the rest of groups, of course).

And finally, since I am using activity tags, I can use "Activity Tags" at the HTML pages to visualize each real group with the only drawback that when there are subgroups I will need to manually calculate the correct B according to the rules above.

Is that the idea?

Liviu Lalescu

#7
Quote from: juliogonzalez on January 16, 2017, 07:55:27 PM
Hi again.

Yes, I think I understand both ideas (I hope!).

The problem about the first one is that it will generate a lot of constraints (unless I'm wrong):

- 4 for each day (each P/B combination)
- 12*4 for each group (LD101, LD102...) having both P and B
- And since we have 7 groups with this configuration, that's 336 restrictions.

Most probably too much, even if I just ignore the warning about this kind of constraints.

Yes, a large number. Not too much for the timetable generation. I worked with more constraints of this type and it was OK. The constraint is highly optimized. The only problem is your patience to input them - or do you have a script to generate the .fet file?

Quote
So for me you are obviously right, and the way to go is using a proper group/subgroup division.

If I understand the idea correctly, that means:

- The groups (LD101, LD201...) being years and not groups as now
- Two groups (from FET perspective) being LD101-P1 and LD101-P2.
- LD101-P1 will contain LD101-P1-B1 and LD101-P1-B2 as subgroups.
- LD101-P2 will contain LD101-P2-B2 and LD101-P2-B3 as subgroups.

Then fake tags with the same names as the groups -years for FET- such as LD101, LD201... to be assigned to the activities:

- Theory activities will be assigned to years (FET)
- Practice activities will use the correct groups or subgroups:
  * P1 will use group LD101-P1
  * P2 will use subgroups LD101P2
  * B1 will use subgroup LD101-P1-B1.
  * B2 will use subgroups LD101-P1-B2 and LD101-P2-B2.
  * B3 will use subgroups LD-101-P2-B3.
- All activities (both theory and practice) will have the tag for the parent group (i.e. LD101).

So in this case:

- LD101-P1 and LD102-P2 activities happen at the same time as long as they use different teachers, or can't if they use the same (which is correct).
- B activities won't require "A set of activities are not overlapping" anymore since the subgroups will prevent it.
- The constraint "Max hours daily for all students" will work even for B* since for example LD101-P1-B1 is a children of LD101-P1 which itself is a children of LD101.

To make it more graphical, the attached screenshots is what I need for every group having both P and B, plus a dummy tag LD101 (and the same for the rest of groups, of course).

I think your idea works. But I was thinking of something a bit different. LD101 a year, divide it automatically by 2 categories: (P1, P2) and (B1, B2, B3). Then, you will have 2*3=6 subgroups in LD101: LD101_P1_B1, LD101_P1_B2, LD101_P1_B3, LD101_P2_B1, LD101_P2_B2, LD101_P2_B3, and 2+3=5 groups: LD101_P1, LD101_P2, LD101_B1, LD101_B2, LD101_B3. You can remove the empty subgroups, like LD101_P1_B3, if I understood correctly. Then for activities you can use the year, the group or the subgroup, as you wish. You can add more students sets per activity. For the group P1 you will use the subgroups LD101_P1_B1, LD101_P1_B2, or the group LD101_P1 (but be careful with LD101_P1_B3, it is I think necessary to remove it in this case, so you don't have problems with it).

It is a bit difficult for me to visualize this whole situation. But I hope I am right and it works. Please do a small test. Please let me know.

Quote
And finally, since I am using activity tags, I can use "Activity Tags" at the HTML pages to visualize each real group with the only drawback that when there are subgroups I will need to manually calculate the correct B according to the rules above.

Is that the idea?

I do not understand the drawback - manually calculate the correct B? You just add a dummy activity tag for each activity to group this activity to an activity tag section in the activity tags timetable.

Julio González Gil

#8
Quote from: Liviu Lalescu on January 16, 2017, 08:26:46 PM
Yes, a large number. Not too much for the timetable generation. I worked with more constraints of this type and it was OK. The constraint is highly optimized. The only problem is your patience to input them - or do you have a script to generate the .fet file?

I am not using a script right now. I could do it, of course, but most probably the correct solution is using correct group division.

I could add the constraints or even script the input. But the person who is going to use the program is not so technical, and will need to understand how to do it, so the group division solution is far way better.

Quote from: Liviu Lalescu on January 16, 2017, 08:26:46 PM
I think your idea works. But I was thinking of something a bit different. LD101 a year, divide it automatically by 2 categories: (P1, P2) and (B1, B2, B3). Then, you will have 2*3=6 subgroups in LD101: LD101_P1_B1, LD101_P1_B2, LD101_P1_B3, LD101_P2_B1, LD101_P2_B2, LD101_P2_B3. You can remove the empty subgroups, like LD101_P1_B3, if I understood correctly. Then for activities you can use the year, the group or the subgroup, as you wish. You can add more students sets per activity. For the group P1 you will use the subgroups LD101_P1_B1, LD101_P1_B2, or the group LD101_P1 (but be careful with LD101_P1_B3, it is I think necessary to remove it in this case, so you don't have problems with it).

It is a bit difficult for me to visualize this whole situation. But I hope I am right and it works. Please do a small test. Please let me know.

Absolutely right! It is hard to visualize it but you understood the problem correctly.

However when I divide automatically (I create two categories, assign P1 and P2 for the first one and B1, B2, B3 for the second one as you can see at the screenshots) I get 5 groups (P1, P2, B1, B3, B2) and 12 subgroups with all the possible combinations between Ps and Bs. I think this is the expected behaviour.

So to get the screenshots you saw at the previous post, I divided automatically and then removed groups LD101-B1, LD101-B2 and LD101-B3 and also subgroups LD101_P1_B3 nor LD101_P2_B1 (as you correctly guessed, I do not need them).

Just in case, I am adding a couple of screenshots on how I divided, and the resultant .fet file.

I will make a small test with one of the groups tomorrow and will let you know, but I have the feeling that it will work perfectly  :D

Quote from: Liviu Lalescu on January 16, 2017, 08:26:46 PM
I do not understand the drawback - manually calculate the correct B? You just add a dummy activity tag for each activity to group this activity to an activity tag section in the activity tags timetable.

Once again, you are right, I was thinking of a dummy tag just for the group (year), but I can create one tag for each group, P and B as needed.

Thank you for your patience and support!

PS: I will let you know about the other things I mentioned soon, as soon as the time table is ready.

My girlfriend will took out over the translation as she is a Russian language teacher and she's willing to help as a way to thank you, and I will help you with the technical stuff (RPM/DEB, maybe the windows installer if I show you the benefits and you thing it can help -we can use NSIS which is Free Software and it works even under Linux to package for windows-, and maybe a Continous Integration if you want to automatically build and package all the changes you make and check that it works -instead of doing it manually-).

And needless to say, we'll send you a donation, as both you and the program are preventing someone becoming crazy making the timetable ;-)

Liviu Lalescu

I'm glad it seems to work :)  But there are only 6 subgroups. The groups are overlapping and sharing subgroups.

I'll answer to the rest tomorrow.

Liviu Lalescu

Thank you for your kind words!

You might want to read the FAQ: "Q: How to define the students into sections?" and "Q: How can one work with overlapping structures of students?". And I think in Volker's manual there are some words about this.

I'll write the Russian translator, by email and on the forum. Anyway, I think he abandoned the translation. Your girlfriend might choose to start with a fresh translation or continue the current one.

Liviu Lalescu

I talked to Ilya (the old Russian translator) and he said he cannot continue with the translation.

Future correspondence about the Russian translation would be best to be taken on the dedicated thread, http://lalescu.ro/liviu/fet/forum/index.php?topic=699.0

Julio González Gil

Quote from: Liviu Lalescu on January 17, 2017, 11:27:23 AM
Thank you for your kind words!

You might want to read the FAQ: "Q: How to define the students into sections?" and "Q: How can one work with overlapping structures of students?". And I think in Volker's manual there are some words about this.

Now that I had a second look at that part of the FAQ, I was able to understand how to apply it to this P/B problem and how the subgroups created by the division process, while not useful to be assigned to activities, can help to identify relationships between groups.

So I didn't really need to even use any kind of tags: looking the activities by year showed all the info for the groups, and the problem is now 100% solved  :D

Now were are struggling with all the restrictions we need, which are almost more than activities, and I hope the timetable will be ready during this week.

Quote from: Liviu Lalescu on January 17, 2017, 03:36:30 PM
I talked to Ilya (the old Russian translator) and he said he cannot continue with the translation.

Future correspondence about the Russian translation would be best to be taken on the dedicated thread, http://lalescu.ro/liviu/fet/forum/index.php?topic=699.0

Got it! She already wrote a message there and, as soon as we all have timetable ready, I will show her how to make the translations (she's not IT so I will need to help her with QT Linguist installation and some first steps), and I will have a look at the other things mentioned (I'll send you an email with a few questions about how you manage your code so I can see how I can integrate this with package generation).

Thanks a lot for your for all your help and patience!

Liviu Lalescu