Main Menu

Gaps between days?

Started by Macuyiko, November 06, 2008, 04:02:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Macuyiko

Hi, is it possible to prevent day-gaps from happening? An example:

Nr. Days: 3
Hours/day: 6

I want teachers to use a minimum of days, I do this by assigning a Max-Days constraints for every teacher. If a teacher has e.g. 5 activities, the maximum days is 1, when a teacher has 8 activitities, the maximum number of days is 2 (ceil(nr-activities/hours-per-day)).

I now have teachers who have activitities at day 1 and day 2 (or 2 and 3), this is fine. I also have teachers with activities at day 1 and 3, and I want to prevent this from happening. I've thought this was done with the ConstraintTeachersMaxGapsPerWeek-constraint, but this doesn't seem to be the case.

Is there a way to solve this? Thanks!

Liviu Lalescu

#1
QuoteHi, is it possible to prevent day-gaps from happening? An example:

Nr. Days: 3
Hours/day: 6

I want teachers to use a minimum of days, I do this by assigning a Max-Days constraints for every teacher. If a teacher has e.g. 5 activities, the maximum days is 1, when a teacher has 8 activitities, the maximum number of days is 2 (ceil(nr-activities/hours-per-day)).


An alternative to this approach might be to add constraint teachers min 4 hours daily. Please think of this and use the approach which is best for you or which is fastest (I don't know which of these 2 is faster).

Quote

I now have teachers who have activitities at day 1 and day 2 (or 2 and 3), this is fine. I also have teachers with activities at day 1 and 3, and I want to prevent this from happening. I've thought this was done with the ConstraintTeachersMaxGapsPerWeek-constraint, but this doesn't seem to be the case.

Is there a way to solve this? Thanks!

This is an unusual constraint.

Max gaps per week means the sum of the gaps in each day, so an empty day has 0 gaps.

My solution: constrain the teachers with 2 days per week to have lessons on day 2. Choose a component of a split activity (say split activity is A (A1, A2) ) and add constraint activity preferred starting times for A1 to all periods of day 2. It is best to choose a component of a split activity, because the other component is on the other day. If you choose an activity which is not split, the timetable will be more constrained than necessary.

Please let me know.

Macuyiko

#2
Thanks for your response.

Quote
An alternative to this approach might be to add constraint teachers min 4 hours daily. Please think of this and use the approach which is best for you or which is fastest (I don't know which of these 2 is faster).

I think I expressed myself incorrectly, by 'a minimum of days' I meant 'as less as possible days' (less is better), not 'x days or more'

Quote
Max gaps per week means the sum of the gaps in each day, so an empty day has 0 gaps.

I see, I figured as much, thanks for clearing this up.

Quote
My solution: constrain the teachers with 2 days per week to have lessons on day 2. Choose a component of a split activity (say split activity is A (A1, A2) ) ...

Yes, that might work, but the problem would remain if I would have for example 5 days. I will then have to choose if I start at day 2 (and preferred 3), or 3 (with 4), etc... Also: manually choosing at which day to start could make solving the timetable harder than needed (meaning: harder then when using an algorithm to heuristically find the best days), I think.

I know this is quite unusual, but I thought this would be possible because the problem is almost the same as with the normal gaps (but with free days instead of hours).

Another option I could try is to use one day and a lot of hours, and splitting this list afterwards. But then it would be difficult to implement the 'less days used is better' constraint.

I look forward to other ideas/solutions.

Liviu Lalescu

Quote
I think I expressed myself incorrectly, by 'a minimum of days' I meant 'as less as possible days' (less is better), not 'x days or more'
If you say that each teacher must have at least (min) 4 hours per day, FET will put 8 hours in 2 days and 5 hours in 1 day.

Quote
Yes, that might work, but the problem would remain if I would have for example 5 days. I will then have to choose if I start at day 2 (and preferred 3), or 3 (with 4), etc...
OK, you are right.

Quote
Also: manually choosing at which day to start could make solving the timetable harder than needed (meaning: harder then when using an algorithm to heuristically find the best days), I think.
If it is an activity split into 2 (components must be in 2 different days) and you have 3 days, then doing it like I suggested does not make the timetable harder to find.

Quote
I know this is quite unusual, but I thought this would be possible because the problem is almost the same as with the normal gaps (but with free days instead of hours).

It is not difficult to add, but I prefer not to, because there are too much constraints already. People might become puzzled.

If you need each teacher with 2 working days per week to have lessons only in 2 adjacent days, this could be done. I could do that as a special version just for you (custom version). Please tell me if you really need this constraint.

Quote
Another option I could try is to use one day and a lot of hours, and splitting this list afterwards. But then it would be difficult to implement the 'less days used is better' constraint.

This I think cannot be applied in your case.

Macuyiko

QuoteIf it is an activity split into 2 (components must be in 2 different days) and you have 3 days, then doing it like I suggested does not make the timetable harder to find.

That is true, but I was also assuming cases with four or more days.

QuoteIt is not difficult to add, but I prefer not to, because there are too much constraints already. People might become puzzled.

If you need each teacher with 2 working days per week to have lessons only in 2 adjacent days, this could be done. I could do that as a special version just for you (custom version). Please tell me if you really need this constraint.

If it would not require too much work or time on your part, I would be grateful for a custom version. I would not require an updated GUI, a new XML constraint and modified solver code would suffice. (I'm still trying to figure out the source code, but not knowing C++ in depth, it is quite hard to understand it right away.)

Thanks for all your help so far!

Liviu Lalescu

Could you work with a version with no XML constraint? Only the algorithm cares that each teacher with max 2 days per week has the working days consecutive.

Macuyiko

If the case of 3 out of 5 days would work as well (also consecutive), I could work without an extra XML-constraint, yes.

Liviu Lalescu

#7
OK, I'll try this, I'll let you know.

LATER EDIT: Just to make sure, I'll add a constraint so that teachers must have all days consecutive. The number of days will be specified by you with constraint teacher max days per week.

Macuyiko

QuoteOK, I'll try this, I'll let you know.

LATER EDIT: Just to make sure, I'll add a constraint so that teachers must have all days consecutive. The number of days will be specified by you with constraint teacher max days per week.

I've already added max days per week-constraints for every teacher, so that should work.

Thanks in advance!

Liviu Lalescu

Maybe you could send me your input file, so I can check this new feature. Send it here or by e-mail or as a personal message. I'll keep it private if needed.

I'll start working in a few hours from now.

Macuyiko

#10
E-mail sent to *** [at] lalescu [dot] ro.

Liviu Lalescu

Thank you, I received it. I am working now. I'll modify your post, so that the e-mail is not present anymore. I am afraid of spam.

Liviu Lalescu

I have made it, please see custom versions of FET.

Please tell me, where is this version used? (country, region, etc.) so I can write it like on the other versions.

Macuyiko

#13
QuoteI have made it, please see custom versions of FET.

Please tell me, where is this version used? (country, region, etc.) so I can write it like on the other versions.

Sure, I'm from Belgium, but I'm not using FET in a traditional school context. I'm using it to schedule meetings between two parties.

Still: it might be possible that you want to have teachers working in consecutive days. Actually, the same might be even more true for students, which are often living in the city where they are studying during the week. Students prefer to have consecutive days, so that they can leave for home earlier (e.g.: on Thursday night), or go to their dorm rooms later (e.g.: on Monday night instead of Sunday). Perhaps other FET-users would like this functionality as well.

In any case, I'm very happy with the provided custom version.

Liviu Lalescu

Quote
QuoteI have made it, please see custom versions of FET.

Please tell me, where is this version used? (country, region, etc.) so I can write it like on the other versions.

Sure, I'm from Belgium, but I'm not using FET in a traditional school context. I'm using it to schedule meetings between two parties.

Still: it might be possible that you want to have teachers working in consecutive days. Actually, the same might be even more true for students, which are often living in the city where they are studying during the week. Students prefer to have consecutive days, so that they can leave for home earlier (e.g.: on Thursday night), or go to their dorm rooms later (e.g.: on Monday night instead of Sunday). Perhaps other FET-users would like this functionality as well.

In any case, I'm very happy with the provided custom version.

I'll write that your version is for meetings, I won't put the country.

I'll wait for more feed-back from users, if they request this, I'll add it. The correct way to add it: constraint teacher(s) or students (set) max days span. But for students is more complicated to add, because of the algorithm. Also, I prefer not to add this constraint, because might confuse some users.