FET Forum

FET Development => Suggestions => Topic started by: silvia on July 07, 2009, 10:27:33 PM

Title: Min hours daily for all teachers / for a teacher
Post by: silvia on July 07, 2009, 10:27:33 PM
Hello all,
I've encountered a problem when generating timetables and would like to suggest something.
Would it be possible to do one of these 2 things?
a) lower the weight of Min hours daily for teachers
or
b) lower the minimum and allow to use 1

The law in my country says that teachers must do a minimum of 2 hours a day. OK, so far, so good. The problem is that the law is different for teachers working only part time. If they do half of the weekly hours they don't have that minimum. Well, if I set the constraint of min 2 hours a day for all teachers at 100% weight, I don't get timetables because I have this teacher who is only doing 3 hours a week. Any possibility? any ideas?
Thanks
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Liviu Lalescu on July 07, 2009, 11:08:25 PM
It is not possible to do your suggested changes. Min hours 1 means nothing. Min hours with <100% gives bad results. It is possible a trick: add 1 dummy activity (duration 1) for each such teacher :-).
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Volker Dirr on July 07, 2009, 11:21:14 PM
It mean "nothing" because you ban a free day by that.
if you realy want min 1 hour to a teacher you can use this trick:
search an activity with many subactivities add/update the min n day constraint (maybe math is teached 4 hours in a week, already splited in 1 hour per day with a min n day constraint. So you have somethink like "min 4 working days with at least one hour". just an an other activity into this min n day constraint (of course with 100%), so you have min 1 hour at 5 days. i hope you understand the workaround.)
Title: Re: Min hours daily for all teachers / for a teacher
Post by: silvia on July 08, 2009, 12:04:56 AM
the problem with this is that free days are illegal here for teachers full time. I have a timetable with a full time teacher with 1 free day, so I should restrict min 2 hours a day (the law again), but if I do that, I get an impossible timetable because I have a part time teacher with only 3 classes (this teacher can have 2 free days). This means 1 class each day, but it can't be generated because there is a restriction of Min 2 hours a day for all teachers. I think I'm stuck, hahhahaha.

I'lln try with dummy activities, but will them appear in the teacher's timetable? She will be scared to death if she sees 6 classes  ;D
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Volker Dirr on July 08, 2009, 12:24:23 AM
QuoteI'lln try with dummy activities, but will them appear in the teacher's timetable?

If the dummy activity constain only subject "---" (and of course the teacher name, but no students sets) you will not be able to see a difference between empty slot and dummy activity.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Liviu Lalescu on July 08, 2009, 02:49:38 AM
Quotethe problem with this is that free days are illegal here for teachers full time. I have a timetable with a full time teacher with 1 free day, so I should restrict min 2 hours a day (the law again), but if I do that, I get an impossible timetable because I have a part time teacher with only 3 classes (this teacher can have 2 free days). This means 1 class each day, but it can't be generated because there is a restriction of Min 2 hours a day for all teachers. I think I'm stuck, hahhahaha.

I'lln try with dummy activities, but will them appear in the teacher's timetable? She will be scared to death if she sees 6 classes  ;D

Teacher has 3 hours. Add only one dummy activity with duration 1 hour, no students.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Volker Dirr on August 31, 2009, 05:35:51 PM
i thought one more about the "min n hours per day" problem again, because we had a similar discuss at my school.

i think there is "just" a "min days per week for teacherS" constraint needed. doesn't solve that the problem in a good way?

so if you want a min n hours == 1 constraint, then you just add a "min n days per week" constraint.

if you want a min n hours ==2 constraint with allowed free days, then you add a "min n hours per day == 2" constraint.

if you want a min n hours == 2 constraint without free days, then you add a "min n hours per day ==2" and a "min n days per week == daysPerWeek" constraint.

hmm... i am currently just not sure how difficult to code that constraint.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Liviu Lalescu on August 31, 2009, 05:50:08 PM
Quotei thought one more about the "min n hours per day" problem again, because we had a similar discuss at my school.

i think there is "just" a "min days per week for teacherS" constraint needed. doesn't solve that the problem in a good way?

so if you want a min n hours == 1 constraint, then you just add a "min n days per week" constraint.

if you want a min n hours ==2 constraint with allowed free days, then you add a "min n hours per day == 2" constraint.

if you want a min n hours == 2 constraint without free days, then you add a "min n hours per day ==2" and a "min n days per week == daysPerWeek" constraint.

hmm... i am currently just not sure how difficult to code that constraint.

It is easy to code. Just make the teacher(s) min hours daily non-intelligent. But I don't want to add alternative to min hours daily to have intelligent or non-intelligent, because people might obtain impossible timetables. I can tell you what to modify to make this. You'll have to compile your own FET.

I refer to latest snapshot 5.11.0:

In generate.cpp, lines: 7050, 7079, 7113, 7142. Make the tests already true (like add 1|| oldcondition).

This way, you can add min 1 hours daily for necessary teachers. You also need to modify the dialog of min n days, to accept 1 hour (because it only accepts >=2 values). Also, you need to modify in generate_pre.cpp, because FET complains if below 2 min hours.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Volker Dirr on August 31, 2009, 06:37:08 PM
no, i think you didn't understood my idea 100%, because with my variant it is also possible that a teacher still have a definied number of free days, while your solution mean a teacher will never have a free day.
(the number of free days is just 0 if you do a "min n day == daysPerWeek" constraint. but of course it should be also possible to use lower values.
so currently things like that are only possible by workarounds with min hours per day or min n days bewteen activities.
with a min n days per week you don't need that workarounds anymore.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Liviu Lalescu on August 31, 2009, 06:43:21 PM
It is not difficult, but I am not sure about performance. This constraint must be coupled with min hours daily, otherwise the algorithm might be too slow/not converge.

I'll think about it. Added in TODO.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Volker Dirr on August 31, 2009, 07:02:43 PM
maybe you can (also) try to coupled it with max days per week? but you know much better then me.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: Liviu Lalescu on August 31, 2009, 07:04:07 PM
Quotemaybe you can (also) try to coupled it with max days per week? but you know much better then me.

No, max and min constraints are separated.
Title: Re: Min hours daily for all teachers / for a teacher
Post by: silvia on September 01, 2009, 12:31:27 AM
Quotei thought one more about the "min n hours per day" problem again, because we had a similar discuss at my school.

i think there is "just" a "min days per week for teacherS" constraint needed. doesn't solve that the problem in a good way?

so if you want a min n hours == 1 constraint, then you just add a "min n days per week" constraint.

if you want a min n hours ==2 constraint with allowed free days, then you add a "min n hours per day == 2" constraint.

if you want a min n hours == 2 constraint without free days, then you add a "min n hours per day ==2" and a "min n days per week == daysPerWeek" constraint.

hmm... i am currently just not sure how difficult to code that constraint.

That would be a solution, yes, at least for our school system. The reason why I suggested an additional  min 1 hour a day is because if a teacher gets one day with 1 hour, I can complete his timetable with surveillance (3 for each full time teacher). This way, that teacher will be within the law (working EVERY day and a minimum of 2 activities a day, and a maximum of 6 activities a day). There's no maximum of gaps a day.

We have a frame timetable of 7 hours on monday, tuesday and thursday, and 6 hours on wednesday and friday.

Of these 33 periods, each teacher must have 18 hours of class, 3 of surveillance and the rest (up to 24) of permanence (just being there available).

We try to give eache teacher a maximum of two 7th period (thanks for that modification). The rest of the timetable, counting lessons, surveillance and gaps (permanence) must not be less than 2 a day, not less than 5 days a week, no more than 6 classes a day, etc.

I hope this is understandable, because it's very late and I'm a bit sleepy :-)