Max hours daily for a teacher with a student set

Started by lalloso, September 15, 2013, 03:23:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lalloso

Hello,
this is maybe the third year that I use fet to generate the timetable for our high school.  :)
Every year it takes a bit of time to rember how to use it properly and this year I've a new idea.
I often split an activity of 6 hours in 5 days as 2 + 1 + 1 +1 and then I set at 95% min days between activities in order not to have more than 2 hours per day with the same teacher. I'm not interested in having 2 hours consecutive if they happen the same day except for the first activity that I set with a two hours duration by myself.
So wouldn't be easier for FET (and me) to avoid completely the min days between activities constraint and just to add a max hours daily for a teacher with a student set ?
Unfortunately some teacher has more than one activity with a student set so I think this would be not the same as "max hours daily for an activity".

Ciao!

Liviu Lalescu

Why don't you add an activity tag for those activities and use teacher activity tag max hours daily?

lalloso

I think this maybe similar or the same as an old post of mine;
http://lalescu.ro/liviu/fet/forum/index.php?topic=1502.0;topicseen

I think I can't use Teacher activity tag max hours daily because the teacher can do up to 5 hours daily, the problem is that she can't see the same students for more than 3 hours daily.

Let's suppose I have teacher T with
- an activity 1 in class 1A of 6 hours in 5 days and
- an activity 2 in classes 1A,1B of 9 hours in 5 days
with constraints
- I don't any class to see teacher T more than three hours daily
- I want at least 2 consecutive hours of activity 1 but I'm not interested in how al other hours get splitted/grouped

Is the following correct?

1) I split activity 1 as 2 +1+1+1+1 and activity 2 as 1+1+1+1+1+1+1+1+1
2) I avoid at all min days between activities
3) I set a TAG such as max3h for both activities
4) I use the constraint max hours daily with an activity tag for all students

My idea is that this could lead to more possible solutions than splitting activity 2 in 3 +2 +2 +1+1 but I'm not sure because on performance hints it's suggested to split the activities to match the number of working days.


Liviu Lalescu

The link is wrong.

Yes, your steps are correct, but define two activity tags and set teacher activity_tag_1 max 3 hours daily then teacher activity_tag_2 max 3 hours daily. So, different activity tags for different students sets.

Your approach is better for performance, but only if you don't add min days constraints.

Volker Dirr

Maybe think about this:

I prefer to split an activity into max (number of days per week) and use 100% weight.
So activity 1 is fine.
I prefer to split activity 2 as 2+2+2+2+1
So in worst case there are 4 hours per day.

Now try if the timetable is still solvable.

If it is still solveable use constraint "same day" for the first subactivity of activity 1 (duration 2) and the last subactivity of activity 2 (duration 2).
So there are always 3 hours per day.

lalloso

Quote from: Liviu Lalescu on September 15, 2013, 04:54:13 PM
The link is wrong.

Yes, your steps are correct, but define two activity tags and set teacher activity_tag_1 max 3 hours daily then teacher activity_tag_2 max 3 hours daily. So, different activity tags for different students sets.

Your approach is better for performance, but only if you don't add min days constraints.

Sorry here should be the right link:
http://lalescu.ro/liviu/fet/forum/index.php?topic=407.0;topicseen

I don't understand your example with the tags. If i do as you say I think that it could happen that there are three hours 1A and then two hours of 1A,1B in the same day and I don't want this. Could you please explain better?

lalloso

Quote from: Volker Dirr on September 15, 2013, 05:17:33 PM
Maybe think about this:

I prefer to split an activity into max (number of days per week) and use 100% weight.
So activity 1 is fine.
I prefer to split activity 2 as 2+2+2+2+1
So in worst case there are 4 hours per day.

Now try if the timetable is still solvable.

If it is still solveable use constraint "same day" for the first subactivity of activity 1 (duration 2) and the last subactivity of activity 2 (duration 2).
So there are always 3 hours per day.

Thanks, this also could be useful but I think it is a bit complex for me. :o

Liviu Lalescu

Quote from: lalloso on September 15, 2013, 05:29:45 PM
I don't understand your example with the tags. If i do as you say I think that it could happen that there are three hours 1A and then two hours of 1A,1B in the same day and I don't want this. Could you please explain better?

Then, maybe add constraints activity tag max hours daily for students sets? And add different tags for different activities?

Please excuse me if I don't understand, I am a bit tired.

lalloso

Quote from: Volker Dirr on September 15, 2013, 05:17:33 PM
Maybe think about this:

I prefer to split an activity into max (number of days per week) and use 100% weight.
So activity 1 is fine.
I prefer to split activity 2 as 2+2+2+2+1
So in worst case there are 4 hours per day.

Now try if the timetable is still solvable.

If it is still solveable use constraint "same day" for the first subactivity of activity 1 (duration 2) and the last subactivity of activity 2 (duration 2).
So there are always 3 hours per day.

I've read your manual where you also suggest to use always 100% constraints whenever possible.

When you say to use 100% in this post you mean to set minimum days between activities = 1 day at 100 %?

The problem with this approach I think is that the same teacher has maybe another single hour of another course with the same student set so there is still the risk that he meets the same students too many hours (e.g. 4) in one day.

I was trying with 1+1+1+1.... because I was thinking that this way FET would have had more possibilities to solve the timetable and thus a faster computation but now I'm not sure anymore. I've also read the important tips section of documentation where the first tip suggests a third and different approach. I'm a bit confused. :-\

By the way, when you say check that the timetable is still solvable how much time should i wait?
For example if FET solved the timetable in 3 minutes, than with the new constraint "Same day" how much extra time should I accomodate?

Volker Dirr

#9
QuoteWhen you say to use 100% in this post you mean to set minimum days between activities = 1 day at 100 %?
yes.

QuoteThe problem with this approach I think is that the same teacher has maybe another single hour of another course with the same student set so there is still the risk that he meets the same students too many hours (e.g. 4) in one day.

I know. That is why i talked about both activities. If there even more then 2 activities, then you can..
a)... do the same "trick" with the 3rd activity
or
b)... "merge" that (or some of that) activities to a single one and do the same "trick"

QuoteI was trying with 1+1+1+1.... because I was thinking that this way FET would have had more possibilities to solve the timetable and thus a faster computation but now I'm not sure anymore. I've also read the important tips section of documentation where the first tip suggests a third and different approach. I'm a bit confused. :-\

Of course there are more possibilities, but why let FET search this possibilities if you don't like them? So i recommend to use 100% only. The timetables are "better" and it's easier to find bugs.

QuoteBy the way, when you say check that the timetable is still solvable how much time should i wait? For example if FET solved the timetable in 3 minutes, than with the new constraint "Same day" how much extra time should I accomodate?

Difficult to say: That is depending on your dataset and what you want to do next.
If you don't want to add (much) more constraints, then FET can get much time.
If you need to add a lot of other constraints, then FET should be able to solve it "fast". You might skip that constraints if they are not highly needed and add others first.

Times will be different with your dataset, i just talk about my difficult dataset (If i have an easy timetable, then you can replace the "half an hour" to max 5 minutes):
If i work with my dataset, then I "know" that it is ok if FET was able to place around 90% after a half hour. In that cases FET was always able to solve it (sometimes just it need just a few minutes more and sometime a few hours.)
If i work with my dataset and FET placed less then around 50% after half an hour, then there was always a bug in my dataset. So there where impossible constraints/data, but FET tried to "solve" even it is impossible. I "just check" my dataset set then. In many cases it is easy for a human to see that bug if you know where to search. Then I fix it and let FET generate again.
(If there are values between 50% and 90% after half an hour, then i just wait some more time and decide a bit later again.)
These percentages are only "correct" for my dataset (around 600 activities.)
If you have less activities, then you might need to increase the 50% and 90% limit.
If you have more activities, then i think these percentages are also ok.

lalloso

Quote from: Volker Dirr on September 21, 2013, 10:21:13 AM

Difficult to say: That is depending on your dataset and what you want to do next.
If you don't want to add (much) more constraints, then FET can get much time.
If you need to add a lot of other constraints, then FET should be able to solve it "fast". You might skip that constraints if they are not highly needed and add others first.

Times will be different with your dataset, i just talk about my difficult dataset (If i have an easy timetable, then you can replace the "half an hour" to max 5 minutes):
If i work with my dataset, then I "know" that it is ok if FET was able to place around 90% after a half hour. In that cases FET was always able to solve it (sometimes just it need just a few minutes more and sometime a few hours.)
If i work with my dataset and FET placed less then around 50% after half an hour, then there was always a bug in my dataset. So there where impossible constraints/data, but FET tried to "solve" even it is impossible. I "just check" my dataset set then. In many cases it is easy for a human to see that bug if you know where to search. Then I fix it and let FET generate again.
(If there are values between 50% and 90% after half an hour, then i just wait some more time and decide a bit later again.)
These percentages are only "correct" for my dataset (around 600 activities.)
If you have less activities, then you might need to increase the 50% and 90% limit.
If you have more activities, then i think these percentages are also ok.

I have about 160 activities and FET places about 140 almost at the start, it then usually increases that number slowly until it solves. But if there is a bug I don't think I spot any special abnormal behaviour in FET

Volker Dirr

QuoteI have about 160 activities and FET places about 140 almost at the start, it then usually increases that number slowly until it solves. But if there is a bug I don't think I spot any special abnormal behaviour in FET

If you have such an low number of activities you might see this behaviour if you have an bug:
The number of placed activities increase (it might hang sometimes a bit or even step a bit back). Then you will see that the number of placed activities decrease (slowly) again without increasing (big) again. It's hard so tell you exact numbers, because that highly depend on your dataset.

lalloso

Hello,
I just want to thank you once again.
The idea of 100% constraints is very helpful (if understood properly).

Since I use one of the not perfectly optimized constraints involving tag I have very different times to solutions, but is okay.

At least I think that is the reason.

See the attached screenshot for example.

Thanks!