I am currently working on a timetable for a primary school. We are not allowed to let children go home before noon, so I would like to add a constraint, that doesn't allow students to leave early. I already added a constraint "Max gaps per week for all students". The problem is the two days where they have a free afternoon.
I also tried the constraint "A set of activities has a set of preferred time slots" and set it to 95% but now the timetable generation takes a very long time (I haven't yet tried if it actually finishes).
Is there any trick to have compulsory hours for all students?
In normal case there is one big trick:
Limit available afternoon times. So all in total you force most of the activities in the morning. Of course you need to force as many as there are needed to fill the morning 100%.
There are 2 variants:
a) Select yourself allowed afternoon subjects. Force all other in the morning. For example allow only sports, music, art, ... in the afternoon.
b) Don't select the afternoon subjects. This might be much easier to schedule; but it also might produce ,,bad" timetables for the students, since 2 hours math in the afternoon.
There are a lot of variants how to enter that. Impossible to tell you the best one without knowing your data set.
One variant for b) is for example this:
If the students have got 31 hours per week, and there is only 5*6=30 hours space in the morning: This mean there will be 1 hour in the afternoon. So if you disallow 4 times the afternoon it will force a morning without gaps. So adding a constraint like ,,fet → data → students constraints → A students set works in an hourly interval max per week" is a clever way to get such a result. As you can see with such a constraint even a "Students max gaps per week" constraint is unneeded, since it is impossible to get gaps then. Reasing your question i guess you need to disallow 2 afternoons with such an constraint only.
Please give us more information about your dataset if you need more help.
I just found a trick myself: I simply added a pseudo activity at noon with every student. Now they have to stay in school until then, since there are no gaps allowed.
Ah... you talked about the noon slot only.
Instead of a pseudo activity it might be ( - depending on your dataset - ) much faster if you:
a) use not available time constraint or break constraint in that slot
b) don't add that hour name at all. so remove it (this will be faster if you generate a timetable)
I think what poses a big problem (which I haven't mentioned in my original post) is that there are quite a few activities with only half the class present, which either have to be at the same time as an activity with the other half of the class and another teacher or in the first or the last timeslot of the day. FET usually filled the mornings fine, but often for only half the students.
Also you mentioned removing the noon time slot would be faster. I'm thinking about adding another timeslot for the long break in the middle of the morning, because one of our teachers has to change buildings for certain classes. The change schouldn't happen when there's only a five minute break. Do you think that's a bad idea?
Quote from: Leo Rellez on March 11, 2019, 11:02:47 PM
I think what poses a big problem (which I haven't mentioned in my original post) is that there are quite a few activities with only half the class present, which either have to be at the same time as an activity with the other half of the class and another teacher or in the first or the last timeslot of the day. FET usually filled the mornings fine, but often for only half the students.
There are at least 3 variants about those activities (activities with only have of the class):
a) Set a constraint "must end students day" for those activities.
or
b) Allow those activities only in the 1st hour. (If students are allowed to come to the 2nd hour)
or
c) Divide the class/group correct and set only the correct (sub)-group to those activities
Quote from: Leo Rellez on March 11, 2019, 11:02:47 PM
Also you mentioned removing the noon time slot would be faster. I'm thinking about adding another timeslot for the long break in the middle of the morning, because one of our teachers has to change buildings for certain classes. The change schouldn't happen when there's only a five minute break. Do you think that's a bad idea?
It is a good idea to keep the noon time slot if you need to care about those buildings changes.
Sorry for replying so late:
To force a students set have activities in some slots, you can use the magic constraint activities occupy max time slots from selection (read the Help for this constraint).