Constraints on variable number of periods per day

Started by totera, July 05, 2019, 07:04:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

totera

Hello, a problem. Classes can have six 5-period days or, as an alternative, Physical Education in the 6th period of a day (Monday to Friday), only 4 periods on Saturday and 5 periods in the other four days.
While it is easy to impose max one 6th period and possibly only PE in it, I can't find a constraint to make Saturday the shorter day.

Volker Dirr

Just set a break constraint on saturday in the last hour(s).

Liviu Lalescu

I am not sure I understand correctly. Either students set not available or break on Saturday 5th hour (easy case), or, for each students set, a constraint activities occupy max time slots from selection: all activities of that students set, selected slots = all Saturday, max occupied = 4 (if you don't know which hour(s) to forbid on Saturday).

totera

Thank you for your quick reply.

I'll try to give a better explanation.
Most of classes have the following timetable:
-MTWTFS
1oooooo
2oooooo
3oooooo
4oooooo
5oooooo
6xxxxxx


Anyway, to take advantage of the school gym some classes have a 6th period on a single day from Monday to Friday and in compensation they end Saturday lessons after 4th period, so they have a similar timetable:
-MTWTFS
1oooooo
2oooooo
3oooooo
4oooooo
5ooooox
6xxoxxx


In the past years, it was predetermined before the generation of the timetable which classes had a 6th period, so it was possible for them to set 5th period on Saturday unavailable.

Now, since Saturday is a "difficult" day, since it is requested as free day by many teachers, I would like to let FET decide the classes with a 6x5 timetable and the classes with a 6th period and a shorter Saturday.
Unfortunately, I am not able to force the 5th period to be always occupied from Monday to Friday, and FET produces class timetables with 5 periods on Saturday and 4 periods e.g. on Monday, which is not acceptable.

Liviu Lalescu

I think there are two possible solutions, both using the same constraint type, activities occupy max time slots from selection:

Add not available/break Sat 6th, then:

1) One constraint for each primary students set: select all the slots other than Mon-Fri 5th, and add all activities of that students set, and max occupied so that the 5th slots Mon-Fri will always be occupied, all of them (see the constraint's help on how to do this).

2) One constraint for each primary students set, select these 6 slots: Mon-Fri 6th, and Sat 5th. All activities of this students set, max occupied = 1.

I hope I am not mistaking. Please let me know.

Volker Dirr

#5
I don't know your students structure, just don't forget that "for each students set" doesn't mean you need to add them for every (sub-)group which you are using. You only need to do it for the years.

Liviu Lalescu

#6
Quote from: Volker Dirr on July 06, 2019, 08:22:35 AM
I don't know your students structure, just don't forget that "for each students set" doesn't mean you need to add them for every (sub-)group which you are using. You only need to do it for the years.

No, sorry, Volker, he needs to do it for every primary students set: subgroup or, if the group does not contain a subgroup, for a group or, if the year does not contain a group, for a year.

Add all activities of each primary students set, including those of the superior year (for the primary students set = a group) and superior group and superior year (for the primary students set = a subgroup).

Volker Dirr

#7
sorry, my second post is missunderstandable.
i just mean the not available students constraint. In that case only year name, not for each group.

totera

Quote from: Liviu Lalescu on July 06, 2019, 08:05:57 AM
I think there are two possible solutions, both using the same constraint type, activities occupy max time slots from selection:

Add not available/break Sat 6th, then:

1) One constraint for each primary students set: select all the slots other than Mon-Fri 5th, and add all activities of that students set, and max occupied so that the 5th slots Mon-Fri will always be occupied, all of them (see the constraint's help on how to do this).

2) One constraint for each primary students set, select these 6 slots: Mon-Fri 6th, and Sat 5th. All activities of this students set, max occupied = 1.

I hope I am not mistaking. Please let me know.
Thanks Liviu, solution 2 is working perfectly!