Activities that don't trigger space/room rules (movable breaks)

Started by Corfiot, September 26, 2018, 11:51:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Corfiot

Woa I didn't notice that feature. I'll test it next time someone requests a change and let you know how it goes.

Volker Dirr

I fear i am right with (2). Your bug is that you didn't noticed that i talk about a special variant. That special variant don't need so much checks. of course the current max occupy constraint is (nearly) perfect.

Example:
teacher need "lunch" at 6th or 7th hour.
so i suggest "max occupy 1 at hour 6th or 7th per day.

So in my variant the constraint only need to read 2 timeslots each day to answer the question. So at normal timetables it need to read only 2*5=10 interger values.
But the current max occupy constraint also need to check if the activity at that slot is also a selected activity from the constraint. Most teachers work over 20 hours per week. So in worst case it need to check 5*20=100 integer values. So it will be slower.

Liviu Lalescu

Quote from: Volker Dirr on September 27, 2018, 06:36:51 PM
I fear i am right with (2). Your bug is that you didn't noticed that i talk about a special variant. That special variant don't need so much checks. of course the current max occupy constraint is (nearly) perfect.

Example:
teacher need "lunch" at 6th or 7th hour.
so i suggest "max occupy 1 at hour 6th or 7th per day.

So in my variant the constraint only need to read 2 timeslots each day to answer the question. So at normal timetables it need to read only 2*5=10 interger values.
But the current max occupy constraint also need to check if the activity at that slot is also a selected activity from the constraint. Most teachers work over 20 hours per week. So in worst case it need to check 5*20=100 integer values. So it will be slower.

I challenge your 2*5: the algorithm needs to go through these two slots, but how do you know they belong to teacher T?

More about present code: I used QSet-s, for best performance. See generate.cpp, lines 9728-9861.

Volker Dirr

because i suggest to read them from "teachersTimetable". I only need to check if the value is >=0. I don't need to check the exact number.

Liviu Lalescu

Quote from: Volker Dirr on September 27, 2018, 07:35:16 PM
because i suggest to read them from "teachersTimetable". I only need to check if the value is >=0. I don't need to check the exact number.

Good observation, Volker! Yes, indeed, the magic constraint "activities occupy max time slots from selection" is very general (admitting activities from more teachers/students), and this is also a weak point, not only a strong point.

So, your code is directly proportional with the number of time slots in the constraint, and mine with the number of activities in the constraint  :)   I think both our ideas are optimal.