Custom FET BP - block planning (Need help choosing a custom version)

Started by ChicagoPianoTuner, July 24, 2019, 01:36:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ChicagoPianoTuner

It's taking a bit longer than anticipated - adding rooming constraints brought up some other issues under the surface that I have to fix. I have to stop working for a few hours, but will definitely get you something later today.


Liviu Lalescu


ChicagoPianoTuner

Great!

I have another question. I am trying to balance the number of students in each section of a course. Example: I have two teachers who teach the same FET subject, S; each teacher has one activity. If there are 40 students who request the subject, I want the balance to be 20/20, or maybe 15/25, but not 2/38. That's okay, I can do it with max simultaneous activities = 25 or something like that; this forces the other 15 into a different section. This works if the two sections are taught by the same teacher or different teachers - no matter.

But imagine I have the same two teachers, T1 and T2, teaching the same subject S, and T1 teaches one activity A1, but T2 teaches two activities, A2 and A3, both subject S. If I now have 48 students who request the subject, and if I use max simultaneous = 25, I could have 25 students in A1 and 23in A2 and 0 in A3. Or 22/22/4, or something similar. Imagine I want to have a minimum of 7 students in each activity.

I could solve it with tricks: in the case above, I could add a number of dummy activities 75 (max simultaneous * number activities) - 48 (number real requests) = 27, force all dummies to be in the same slots as the real courses (using the same basic set of constraints as I would usually use), and then do something like max simultaneous dummy activities in one slot = max students - min students = 25 - 7 = 18.

The same problem and solution work if there are 2 activities (either by the same teacher or different teachers) and there are, for example, max students per section + 1 who request the course, e.g. 26 in my example above. Create 50 - 26 = 24 dummy activities, allow max dummy activities = 25 - 7 = 18 in one slot, guaranteed to have 7 real students in each section.

Maybe there is a better trick. Can you think of one?

An ideal constraint would do something like "if there are ANY activities in this time slot, there must be at least SOME MINIMUM number of activities in this time slot." But I am not sure if such a constraint is very difficult to create, or would slow down generation a lot. But I can say (and maybe Darren can agree) that setting minimum class sizes would be a very useful feature.

Liviu Lalescu

I must admit I did not read carefully for now, but don't you have activities min simultaneous in selected time slots with allow empty slots = true?

ChicagoPianoTuner

Oh! I never noticed the "allow empty slots" there. I think that will work. Great. Thank you! :D

Darren McDonald

Quote from: Liviu Lalescu on June 18, 2020, 07:13:14 PM
I must admit I did not read carefully for now, but don't you have activities min simultaneous in selected time slots with allow empty slots = true?

This is what I did with mine too—using both max/min simultaneous activities from a set in selected time slots, with allow empty slots = true. You can add these on a subject by subject basis, and simply select all (real) block slots, since allowing empty slots means you don't have to worry when those classes get scheduled.

Doing this for the multi-section courses was handy, and it allows you to do course-by-course balancing.

ChicagoPianoTuner

Quote from: Darren McDonald on June 18, 2020, 07:16:32 PM
Quote from: Liviu Lalescu on June 18, 2020, 07:13:14 PM
I must admit I did not read carefully for now, but don't you have activities min simultaneous in selected time slots with allow empty slots = true?

This is what I did with mine too—using both max/min simultaneous activities from a set in selected time slots, with allow empty slots = true. You can add these on a subject by subject basis, and simply select all (real) block slots, since allowing empty slots means you don't have to worry when those classes get scheduled.

Doing this for the multi-section courses was handy, and it allows you to do course-by-course balancing.
Great - thanks Darren. Out of curiosity, did you have to deal with different courses in each semester? All of the courses for our senior school go for the entire school year, but some middle school courses only happen for half the year. I'm considering a few ways to tackle this problem, but I was wondering if you had to deal with it. Just to clarify, this is a separate issue to the one I just asked about :)

Darren McDonald

Quote from: ChicagoPianoTuner on June 18, 2020, 07:24:30 PM
Out of curiosity, did you have to deal with different courses in each semester? All of the courses for our senior school go for the entire school year, but some middle school courses only happen for half the year. I'm considering a few ways to tackle this problem, but I was wondering if you had to deal with it. Just to clarify, this is a separate issue to the one I just asked about :)

As it happens, I did have to deal with semester courses. We have a set of Humanities courses (Economics, Geography, History, and Philosophy) that are taken as half-year courses, and we do something similar for science classes. These courses all run at the same time (so, in the same "real" block), and students choose two to study (so Econ and Philosophy, etc.), and do one in Semester 1, the other in Semester 2. (They also make a backup choice, but we managed to give everyone their top two choices this year. If it's more complicated next year I may use your approach with multiple overflow blocks.)

To figure our the best arrangement, I set up a FET-BP file just for this "option" block. Each course was a "day", with two "hours," Semester 1 and Semester 2. Economics, for example, was offered in both Semester 1 and Semester 2, but there was also a third section offered only in Semester 2. So there were two Economics "days," with a break scheduled to prevent activities occurring in Semester 1 for Economics "day two" (and similarly for some other courses).

My scenario was pretty simple, so I don't know if this will be of any help in your case!

ChicagoPianoTuner

#294
Ahh, I see, yes, that's a bit simpler than my scenario.

Just to lay out my ideas here: I can think of two ways to do it. Both methods involve making 2 subactivities for each activity that lasts the full year, and just one subactivity for the half-year courses.

First, I could try to do it with tricks. FET days are still real teachers, but FET teachers are two versions of a real teacher - there's T1_sem1 and T1_sem2. All of T1_sem1s activities and T1_sem2s activities must fall on FET day T1. But I would also need dummy students to accommodate. And dummy rooms. Oof. Lots of tricks.

Second, I could double the number of hours while keeping the number of days the same. So hours are A_sem1, B_sem1, ..., A_sem2, ..., H_sem2. Now courses that happen for the full year are forced to be on the same FET day (real teacher) using activities same starting day (any hour), and I can force component 1 to be in the first semester/hours using set of subactivities has a set of preferred starting times. The problem is I don't know how to ensure that two subactivities that represent a full-year course are separated by precisely 11 hours (I have 8 real blocks and 3 fake blocks, so A_sem1 and A_sem2 are 11 hours apart). I can use min gaps between set of activities, but without max gaps between set of activities I don't know how to do it.

ChicagoPianoTuner

#295
Hmm. Maybe I can use constraint three activities grouped, two activities are the subactivities from the full-year course, and the third activity is a dummy activity with duration = 10. And I can add this constraint only to the "teacher" course, not the choices students make, so there aren't that many constraints.

Liviu Lalescu

1) Maybe add also 2 constraints two activities are ordered if you add three grouped.
2) Min gaps between activities considers the number of slots between them, so I think it should be 10 (if the first activity has duration 1).
3) Maybe if you add for all the activities (including students) it will help FET better.
4) It might be slow if you use three activities are grouped for this trick.

ChicagoPianoTuner

Quote from: Liviu Lalescu on June 18, 2020, 08:13:53 PM
1) Maybe add also 2 constraints two activities are ordered if you add three grouped.
Yes, good point.
Quote
2) Min gaps between activities considers the number of slots between them, so I think it should be 10 (if the first activity has duration 1).
I won't need min gaps if I use three grouped with the middle one duration = 10
Quote
3) Maybe if you add for all the activities (including students) it will help FET better.
Okay, I can add more constraints.
Quote
4) It might be slow if you use three activities are grouped for this trick.
I'm not sure what my other options are :(

Liviu Lalescu

(4): It is easy to add a constraint max gaps between activities. In theory. In practice it is tedious. If really needed and useful, I could add it.

ChicagoPianoTuner

I am happy to use this method for now. Maybe if another user requests it, you can consider that it would make my problem easier to solve as well and that will be a good reason for you to implement the constraint.

Also, I can let you know if the generation is impossibly slow with this method and maybe that will be a reason to implement the new constraint. But definitely don't do it for me now - leave it until later.