Min continuous gaps in interval

Started by Liviu Lalescu, February 23, 2017, 07:20:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Liviu Lalescu

As suggested by rodolforg, in his code: https://bitbucket.org/rodolforg/fet/commits/7700ce47e4df23d546cef3c4504c5a1b89a5b1bb#Lsrc/engine/generate.cppF7687T7689

I am thinking of adding a new constraint, teacher(s)/students (set) min continuous gaps in interval, where the user selects the length of the min continuous gaps and the possible start and possible end.

It is for letting teachers/students to have a lunch break.

Please let me know what do you think about this. The length of the gaps, the start and end -> are these values enough to describe the constraint?


Benahmed Abdelkrim

 very good idea. I hope this new feature will satisfy the Algerian specifics. So we can be used directly the official version...
B.A/krim

Volker Dirr

in my opinion you should add this new constraint only if it is possible to optimize it very well. it must be (nearly) as good as doing the same with pseudo activities.
i currently care about that constraint very simply by adding pseudo activities "lunch" and allow only hour 6 and 7 (with min day 100% constraint).
if the solution with pseudo activities is faster than this new constraint, you should not implement it.

Liviu Lalescu

Quote from: Benahmed Abdelkrim on February 23, 2017, 08:04:54 PM
very good idea. I hope this new feature will satisfy the Algerian specifics. So we can be used directly the official version...

No, it cannot be used by Algeria, because you add max gaps for students/teachers = 0, and you want to have gaps each day.

This is a reason why I am afraid to add this constraint, people might misuse it.

Quote from: Volker Dirr on February 23, 2017, 08:08:21 PM
in my opinion you should add this new constraint only if it is possible to optimize it very well. it must be (nearly) as good as doing the same with pseudo activities.
i currently care about that constraint very simply by adding pseudo activities "lunch" and allow only hour 6 and 7 (with min day 100% constraint).
if the solution with pseudo activities is faster than this new constraint, you should not implement it.


Your trick does not work if you have teachers min hours daily, because the pseudo activities are treated as activities.

The implementation will be good, don't worry. rodolforg showed me the way, and it is good.

Volker Dirr

#4
You are right, the trick doesn't work for teachers; but i don't need it for teachers. as you can see i use it only for students. they must have that.
i hope you also saw that i use the "group activities in the initial order" option to improve generating time. so the new constrait must be able to care also very early, since without that generating is slower. i just done a quick reading of the source. it might do it, but i think we should do a benchmark "pseudo activities" vs "new constraint".

Liviu Lalescu

Quote from: Volker Dirr on February 23, 2017, 08:33:32 PM
You are right, the trick doesn't work for teachers; but i don't need it for teachers. as you can see i use it only for students. they must have that.
i hope you also saw that i use the "group activities in the initial order" option to improve generating time. so the new constrait must be able to care also very early, since without that generating is slower. i just done a quick reading of the source. it might do it, but i think we should do a benchmark "pseudo activities" vs "new constraint".

I think rodolforg's way is better/faster.

If I implement this constraint, I hope you will help me testing on your file.

Volker Dirr

yes, i will test of course. i am not sure if it is faster, since the pseudo activities are checked before checking that new constraints. so in worst case speed won't be faster. on the other hand the advantage is that it won't place the pseudo activities at not allowed times and check that. i guess/hope overall both variants will need very similar time.

Liviu Lalescu

There are possible more variants:

- If the teacher does not have activities before or after the interval, he can skip having min gaps continuously in this interval

or

- He must have min gaps continuously no matter if he does not have activities before the interval or after.

How to implement the constraint?

Volker Dirr

#8
Quote from: Liviu Lalescu on February 23, 2017, 08:58:45 PM- If the teacher does not have activities before or after the interval, he can skip having min gaps continuously in this interval

In my opinion this is the (only?) correct way to implement it.


Quote from: Liviu Lalescu on February 23, 2017, 08:58:45 PM- He must have min gaps continuously no matter if he does not have activities before the interval or after.

This is in my opinion incorrect, because it might/will force a lot of other gaps.
If the teacher need to have it (because he maybe supervise at that time), than that is a payed hour/activity. so it should be added as a "real" activity for the teacher; not as a constraint.

Liviu Lalescu

Quote from: Volker Dirr on February 23, 2017, 08:33:32 PM
You are right, the trick doesn't work for teachers; but i don't need it for teachers. as you can see i use it only for students. they must have that.
i hope you also saw that i use the "group activities in the initial order" option to improve generating time. so the new constrait must be able to care also very early, since without that generating is slower. i just done a quick reading of the source. it might do it, but i think we should do a benchmark "pseudo activities" vs "new constraint".

Hmm, there might be problems of understanding with this new constraint. I assume you added 0 gaps constraints for the students. Then this continuous gap will be counted and the timetable will be impossible. This is a serious problem and I cannot see an (easy) solution.

Volker Dirr

just adding max 1 gap per day will help (i guess). But like i said: i fear the new constraint might be slower than doing it with pseudo activities.

Liviu Lalescu

Quote from: Volker Dirr on February 23, 2017, 09:14:51 PM
This is in my opinion incorrect, because it might/will force a lot of other gaps.
If the teacher need to have it (because he maybe supervise at that time), than that is a payed hour/activity. so it should be added as a "real" activity for the teacher; not as a constraint.

I do not understand this paragraph. But I believe you :)

Quote from: Volker Dirr on February 23, 2017, 09:22:26 PM
just adding max 1 gap per day will help (i guess). But like i said: i fear the new constraint might be slower than doing it with pseudo activities.

Don't worry, it should be better than with pseudo activities.

But the user needs to know this problem with gaps. Also, he might get an unwanted gap in a day without pause.

rodolforg

Quote from: Liviu Lalescu on February 23, 2017, 09:20:37 PM
Hmm, there might be problems of understanding with this new constraint. I assume you added 0 gaps constraints for the students. Then this continuous gap will be counted and the timetable will be impossible. This is a serious problem and I cannot see an (easy) solution.

There are other similar cases that FET does not (yet) check if it is an impossible timetable:

  • A student set must start early (max beginning at second hour) but you only allow them to work on that interval a max days per week less than DAYS_PER_WEEK (and there is not enough room to lazy days)
  • I forgot ;)

Liviu Lalescu

Quote from: rodolforg on February 28, 2017, 05:45:47 PM
Quote from: Liviu Lalescu on February 23, 2017, 09:20:37 PM
Hmm, there might be problems of understanding with this new constraint. I assume you added 0 gaps constraints for the students. Then this continuous gap will be counted and the timetable will be impossible. This is a serious problem and I cannot see an (easy) solution.

There are other similar cases that FET does not (yet) check if it is an impossible timetable:

  • A student set must start early (max beginning at second hour) but you only allow them to work on that interval a max days per week less than DAYS_PER_WEEK (and there is not enough room to lazy days)
  • I forgot ;)

Yes, but the user should easily understand the situation (with max beginnings and interval max days). But for the min gaps in interval the user cannot understand that easily.