FET Forum

FET Support (English) => Get Help => Topic started by: ellebi on August 04, 2019, 04:52:50 PM

Title: Max hours per day but only 1 time a week
Post by: ellebi on August 04, 2019, 04:52:50 PM
Dear all,
I've been using FET from last year with satisfaction, but since I started usign it, I have an unsolved question that I'd like to share with you:
is there a way to impose a max number of hours for a teacher per day, but for (example) only max 1 time a week?
In other words: I'd like to make a teacher work for 5 hours per day, (and I know how to do it) but only for 1 time in the week, not two...
For example:
Teacher with 15 hours in a week
4 working days max in a week for that teacher, with "potentially" 6 hours max per day.
I imposed 3 max first hours, 3 max last hours and 2 max gaps per week
but... here's the problem:
I often obtain a calendar wit 2 days filled wit 5 hours plus one gap per day, so that the teacher is in school for 6 hours a day for two days...
Is it possible to tell to FET to assign to this teacher only one day "full"?
Something like the max span per day, but for "n" times a week?
I hope it's all clear
Many thanks to all
Best regards
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 04, 2019, 06:20:58 PM
Hello, ellebi,

I might have an acceptable solution for you. It involves some work to add quite many constraints, it needs updating these constraints if you add activities for that teacher, and it might not be perfect for you, because it says that the teacher can have max 1 day with 5 hours, but not max 1 day with span 6:

You need for each teacher and for each pair of different days to add a constraint activities occupy max different slots from selection: add all activities of that teacher, day 1 and day 2 selected slots with X, max occupied = 9.

If you have 5 days per week, you add 5*4/2=10 constraints for each teacher. If you have 6 days per week, you add 6*5/2=15 constraints for each teacher.

Please let me know.
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 04, 2019, 08:52:50 PM
Hi Liviu,
first of all, it's an honour for me to speak with you :): your program and your work are really useful for me. It's really difficult to find people with your willingness, and please accept my apologies because I'm late with the donation that you really deserve!
In next days I will provide with pleasure and I'll let you know.

Concerning this topic: many thanks for your prompt reply: I did know the constraint you suggest to me, and I find it very powerful, even with the problem you described (a big problem when you must reload activities for some reason: now I'll go for a while OT: It would be useful a sort of Export + Import of these rules, at least when they concern the whole activities of a teacher...)

But I didn't know the "advanced" usage you've suggested now, and I think it will help me.
Only one question: in the two days (1 and 2) I must select all hours, isnt't it?
Moreover, I will think about the possibility to add some dummy activity to obtain the gap in the day: in this case if I well understand, I must set to max occupied slots the number of 10...

Thank you and
Best regards

Luca
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 04, 2019, 09:20:46 PM
Quote from: ellebi on August 04, 2019, 08:52:50 PM
Hi Liviu,
first of all, it's an honour for me to speak with you :): your program and your work are really useful for me. It's really difficult to find people with your willingness, and please accept my apologies because I'm late with the donation that you really deserve!
In next days I will provide with pleasure and I'll let you know.

Thank you for the appreciation! The honor is also mine :)

Quote
Concerning this topic: many thanks for your prompt reply: I did know the constraint you suggest to me, and I find it very powerful, even with the problem you described (a big problem when you must reload activities for some reason: now I'll go for a while OT: It would be useful a sort of Export + Import of these rules, at least when they concern the whole activities of a teacher...)

Each constraint must contain all the activities of that teacher. So if the ids of the activities remain the same, it is not a problem.

About import/export of the constraints: it is complicated for me, I am not experienced in this. But open the .fet XML file with a text editor or an XML editor, and see the section <Time_Constraints_List>. The constraints are very easy to understand. You can generate this text automatically. It is the advantage of FET open file format.

Quote
But I didn't know the "advanced" usage you've suggested now, and I think it will help me.
Only one question: in the two days (1 and 2) I must select all hours, isnt't it?
Moreover, I will think about the possibility to add some dummy activity to obtain the gap in the day: in this case if I well understand, I must set to max occupied slots the number of 10...

Thank you and
Best regards

Luca

For each teacher, select each possible pair of days. In each pair (say 2 and 5) select all slots of these two days, with X. Then add the constraint and move to the next pair of days.

Hmm, if you add dummy activities for the gaps I think it won't work. See: if you impose max 11, you may get on day 1     5 activities and 1 dummy, and in day 2    5 activities and 1 gap. If you impose max 10, it rules out day 1   5 activities 1 dummy and day 2    4 activities and 1 dummy.

Also the dummy activities (gap activities) pose problems for min days per week and min hours daily.

You are welcome, Luca!! :)
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 04, 2019, 09:25:31 PM
Yes,I think It's clear...
Many thanks again, I'll let you know if I need further help...
Best regards!
Luca
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 04, 2019, 09:30:48 PM
You are welcome! Let me know if you succeed.
Title: Re: Max hours per day but only 1 time a week
Post by: bachiri401 on August 04, 2019, 10:27:30 PM
Sorry to enterveen here but I think the constraint max/min hours per  day should be modified ( max / min hours per day for all days except 1/2....)
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 05, 2019, 08:06:23 AM
In the meanwhile, I try to take advantage from this conversation asking to you some clarrificaton about the costraint I tried to use on this peoblem.
In Italian is "Un insegnante fa lezione in un intervallo orario massimo n giorni a settimana": I set it from 1 to 6 once a week, but I think it was in conflict with the max hour per day (5) already setted because it try ti fill the 6 hours with activities, and gaps are not considered in the count, I'm correct?
Is there a way to use this constraint, may be in association with other workarounds?
Not urgent, only if you can!! :-)
Thank you
Best regards
Luca
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 05, 2019, 09:51:54 AM
Quote from: ellebi on August 05, 2019, 08:06:23 AM
In the meanwhile, I try to take advantage from this conversation asking to you some clarrificaton about the costraint I tried to use on this peoblem.
In Italian is "Un insegnante fa lezione in un intervallo orario massimo n giorni a settimana": I set it from 1 to 6 once a week, but I think it was in conflict with the max hour per day (5) already setted because it try ti fill the 6 hours with activities, and gaps are not considered in the count, I'm correct?
Is there a way to use this constraint, may be in association with other workarounds?
Not urgent, only if you can!! :-)
Thank you
Best regards
Luca

The interval max days per week works differently: in this interval, there can be activities only n time per week. So you want the teacher to work max 1 day per week. If I say from 4 to 6 max 2 per week, in the other days the teacher has no activities from 4 to 6. Please let me know if it is clear now.
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 05, 2019, 10:50:03 AM
Quote from: bachiri401 on August 04, 2019, 10:27:30 PM
Sorry to enterveen here but I think the constraint max/min hours per  day should be modified ( max / min hours per day for all days except 1/2....)

It is a very nice idea, but it is complicated to implement. I will think some more, but I will probably just add this in the TODO for now.

If there were constraints max 0 gaps or no gaps constraints, it would have been not so complicated. But the general case looks ugly.

I will consider this proposal and think of it in the future.

For other users: do you consider it useful for max hours daily allowing 1 day exception (maybe only for the teachers)?
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 05, 2019, 07:17:15 PM
Quote from: Liviu Lalescu on August 05, 2019, 09:51:54 AM
The interval max days per week works differently: in this interval, there can be activities only n time per week. So you want the teacher to work max 1 day per week. If I say from 4 to 6 max 2 per week, in the other days the teacher has no activities from 4 to 6. Please let me know if it is clear now.

Ops, it's so clear that I'm asking to me why I had this doubt...

Quote from: Liviu Lalescu on August 05, 2019, 10:50:03 AM
For other users: do you consider it useful for max hours daily allowing 1 day exception (maybe only for the teachers)?
To me, it would be very useful, but only if I can choose the teacher(s) setting the general rule and the exception. If the constraint would work for all teachers, imho would not so useful (if I correctly understood your proposal!).

Thank you for all the proposals in this thread, now I "metabolize" them all and I'll proceed.
To simplify my work, I think I'll have also to work with "min hours per day", so to better distribute the hours of the teacher in the week.

Have a nice evening!

Luca

Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 05, 2019, 07:32:18 PM
Quote from: ellebi on August 05, 2019, 07:17:15 PM
Quote from: Liviu Lalescu on August 05, 2019, 10:50:03 AM
For other users: do you consider it useful for max hours daily allowing 1 day exception (maybe only for the teachers)?
To me, it would be very useful, but only if I can choose the teacher(s) setting the general rule and the exception. If the constraint would work for all teachers, imho would not so useful (if I correctly understood your proposal!).

Thank you for all the proposals in this thread, now I "metabolize" them all and I'll proceed.
To simplify my work, I think I'll have also to work with "min hours per day", so to better distribute the hours of the teacher in the week.

Have a nice evening!

Luca

Teacher/teachers max hours daily with 1 day exception. So you can select a teacher or all the teachers.

Thank you! Success!
Title: Re: Max hours per day but only 1 time a week
Post by: bachiri401 on August 05, 2019, 07:46:49 PM
why don't you let the exception optional (except 1 /2 /3 ....day)
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 05, 2019, 07:53:32 PM
Because it is not useful I think and because already with 1 day exception the code looks very complicated for me. I will think of it, but I think I won't add it soon even with 1 day exception.
Title: Re: Max hours per day but only 1 time a week
Post by: bachiri401 on August 05, 2019, 08:06:39 PM
sometimes we need to make a teacher work 6 hours a day for three days for example except two days (5 times in total days)
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 05, 2019, 08:11:19 PM
OK, so it might be useful in maybe extreme cases. But it sure looks complicated.
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 05, 2019, 09:23:59 PM
Quote from: ellebi on August 04, 2019, 08:52:50 PM
...please accept my apologies because I'm late with the donation that you really deserve!
In next days I will provide with pleasure and I'll let you know.

Donation sent, as promised!
:D
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 06, 2019, 08:47:45 AM
Quote from: Liviu Lalescu on August 05, 2019, 10:50:03 AM
For other users: do you consider it useful for max hours daily allowing 1 day exception (maybe only for the teachers)?

It would be possible to extend this possibility also to "Max span per day for a teacher" constraint?
I prefere it to "max hours per day" because it includes gaps
Thank you
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 06, 2019, 09:46:15 AM
Quote from: ellebi on August 05, 2019, 09:23:59 PM
Quote from: ellebi on August 04, 2019, 08:52:50 PM
...please accept my apologies because I'm late with the donation that you really deserve!
In next days I will provide with pleasure and I'll let you know.

Donation sent, as promised!
:D

Thank you! I received it and will add it now.

:)
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 06, 2019, 08:13:05 PM
Quote from: ellebi on August 06, 2019, 08:47:45 AM
Quote from: Liviu Lalescu on August 05, 2019, 10:50:03 AM
For other users: do you consider it useful for max hours daily allowing 1 day exception (maybe only for the teachers)?

It would be possible to extend this possibility also to "Max span per day for a teacher" constraint?
I prefere it to "max hours per day" because it includes gaps
Thank you

I will add these suggestions in the TODO, like this: The initial suggestion is by Luca: Allow 1 day exceptions for the constraints of type teacher(s) max hours daily and teacher(s) max span per day, in which day the teacher(s) can have +1 more hours/span. The additional words by bachiri401: Allow a number n of days exception for the constraints of type teacher(s)/students (set) max/min hours daily.

Luca, your suggestion is easier than max hours daily. But:

1) It is not quite FET style to add exceptions to constraints.

2) It might lead to performance problems, I am not sure if my idea of implementing it is perfect.

So I propose you to create a custom version for you, max span per day for teacher has a check box, allow one day with +1 span. If it works correctly, I will think some more on adding it to the official.

Let me know.

Now I will add your suggestions in the TODO file.
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 07, 2019, 04:49:18 PM
See also: https://lalescu.ro/liviu/fet/forum/index.php?topic=3915.0
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 07, 2019, 07:02:04 PM
I am seriously thinking of this: a check box for constraints teacher(s) max hours daily / max span per day, "Except one day with +1". It is not easy and contains critical code, that is why I am still not that eager to add it. It also isn't exactly a FET-style constraint.

But if more people will vote for this new addition, I will consider it.

So far, there were two users needing it: ellebi and totera.
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 07, 2019, 08:39:09 PM
bachiri401, I also know you suggested this (in fact even a more general approach), but I think you are not needing this for yourself, but suggesting this more like a good-to-have facility. If you want, I can also add you in the list.
Title: Re: Max hours per day but only 1 time a week
Post by: ellebi on August 08, 2019, 06:47:32 AM
Quote from: Liviu Lalescu on August 06, 2019, 08:13:05 PM

So I propose you to create a custom version for you, max span per day for teacher has a check box, allow one day with +1 span. If it works correctly, I will think some more on adding it to the official.
Let me know.

Ciao Liviu, sorry of I'm late, in these days I've other problems that keep me away from the timetable (and FET!)...

I'm really interested on this feature, but I don't want create too much work for you.
If you have time, I'll test it with pleasure, if not, I'proceed in some way! :-)

Thank you
Ciao
Title: Re: Max hours per day but only 1 time a week
Post by: bachiri401 on August 09, 2019, 11:28:57 AM
Yes with great pleasure :)
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 09, 2019, 12:14:04 PM
OK, so there are 3 users suggesting this.
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on August 10, 2019, 03:38:17 PM
Quote from: ellebi on August 08, 2019, 06:47:32 AM
Quote from: Liviu Lalescu on August 06, 2019, 08:13:05 PM

So I propose you to create a custom version for you, max span per day for teacher has a check box, allow one day with +1 span. If it works correctly, I will think some more on adding it to the official.
Let me know.

Ciao Liviu, sorry of I'm late, in these days I've other problems that keep me away from the timetable (and FET!)...

I'm really interested on this feature, but I don't want create too much work for you.
If you have time, I'll test it with pleasure, if not, I'proceed in some way! :-)

Thank you
Ciao

I made it, it was not very easy. Get it from https://lalescu.ro/liviu/fet/download/custom/luca/

Please let me know.

I did not test much.
Title: Re: Max hours per day but only 1 time a week
Post by: totera on August 25, 2019, 11:35:12 PM
Thanks Liviu,
in fact this is a problem I had with several teachers last year.
I'll do some tests with the custom version then I'll tell you.
Title: Re: Max hours per day but only 1 time a week
Post by: totera on September 24, 2019, 10:36:29 PM
Hi Liviu,
I've been using FET 5.39.0-luca-snapshot-10-aug-2019-16_56 version with the "Allow one day exception plus one" checkbox checked on several "Add teacher max span per day" constraints in the last weeks and everything is working fine.
I don't know if this is a thorough test, but I think you can take into consideration to add it in the official version.
Again thank you so much for all your work!
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on September 25, 2019, 08:31:25 AM
Hello, totera,

Please tell me, is this useful for you and you don't need teachers max hours daily with exceptions? Because teachers max hours daily with 1 days exception is too difficult for me.

I saw that you proposed last year max hours daily. So I want to ask you if max span per day is useful for you instead of max hours daily.

Please answer as soon as possible, because I am preparing the official release soon.
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on September 25, 2019, 12:45:32 PM
OK, I decided to add it to the official FET. Get it from https://lalescu.ro/liviu/fet/download/test/

I corrected a serious bug with this occasion (sometimes, if the user added >= 2 constraints of this type for a teacher/more teachers).
Title: Re: Max hours per day but only 1 time a week
Post by: totera on October 01, 2019, 11:44:11 PM
Quote from: Liviu Lalescu on September 25, 2019, 08:31:25 AM
Please tell me, is this useful for you and you don't need teachers max hours daily with exceptions? Because teachers max hours daily with 1 days exception is too difficult for me.

I saw that you proposed last year max hours daily. So I want to ask you if max span per day is useful for you instead of max hours daily.

After I used it, I find max span per day with exceptions definitely a very useful constraint, even more that max hours daily with exceptions.
Title: Re: Max hours per day but only 1 time a week
Post by: Liviu Lalescu on October 01, 2019, 11:47:20 PM
Thank you!  :)  I hope in a few days I will release the official FET, with this new feature.