Howcan I tell TEf about this constraints !??

Started by Chafik Graiguer, September 12, 2008, 10:10:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chafik Graiguer

Hello and thank you for this soft and discussion board..

How can I tell FET about the following constraints?

constraints:

SCHOOL:
- day has two (2) studying periods and one (1) lunch period
- A morning period from 08H00 to 12H00 , four (4) timeslots,each timeslot is one hour
- A lunch period from 12H00 to 14H00  students have to go home to take launch, no activity, school isclosing down.
- An afternoon period from 14H00 to 18H00.  four (4) timeslots,each timeslot is one hour


TEACHERS:
- if a teacher has activities in a given day, he works only one period either morning or afternoon but never both;
- no gaps between timeslots

STUDENTS:
- can have lesson in the both periods;
- in a given period, no gaps between the timeslots;

The most important thing is that:
For Students and teachers:
- in a given period, minimum of adjacent timeslots with activity is 2, never one;

for students: Gaps between activities and lunch break are legal (acceptable gaps) ( for example, students can have lesson for two hours/activity in the morning and for two other hours at the afternoon, no matter where they are located, as long as the two mornin or afternoon activities are adjacents, consecutives)

Liviu Lalescu

#1
Your data is too complicated to enter directly into FET.

I thought of something: make 2 timetables, one for the first period and one for the second.

Add constraints:

students no gaps

teachers no gaps

teachers min hours daily 2 (this means that in each working day they must have 2 hours - "intelligent" constraint)

students min hours daily 2 (but this means that they have lessons in each day, because the constraint is not "intelligent")

Decide which activities go in the first period and add them to the timetable data.

Decide for each teacher the maximum days per week in which he works in the first period - add constraints teacher max days per week.

Generate timetable - this is for the first period.

Select new file.

Now, see which teachers work in the morning and add constraints teacher not available to specify that they are not available in these days in the afternoon.

Now repeat the same steps as for morning.

Maybe you can obtain a feasible timetable, but you need to decide to split activities into 2 sets: morning and afternoon - choice is your's.

Liviu Lalescu

#2
I have thought some more, and I found another possible approach (no need to split into 2 the activities - FET can do that):

Add 2*number of days, days 1..n correspond to morning and n+1..2*n corresponding to afternoon.

Drawbacks:

1) Students min hours daily is not intelligent, so all days must have at least 2 hours for each student. I can give you however a FET version just for you, with intelligent min hours for students (only a minor change in the sources, I have reasons not to include it in the official FET - it gives impossible timetables for other data).

2) You cannot say for each teacher that he wants to work only in the morning or in the afternoon each real day.

I'll think some more and let you know. Maybe you can also think of something to solve point 2).

Volker Dirr

#3
I think you can do it with a single timetable.

Just do this:

add 12 periods (hours)
add 3 activity tags "morning", "lunch" and "afternoon"
add constraint activity tag  preferd time with tag "morning" at all slots in the morning. similar with "lunch" and "afternoon".

add 10 dummy activities with all years (stundents), no teachers, subject "lunch" or "---" and activity tag "lunch".
that is needed because you want to add constraint students don't have a gap.
also this is needed, because teachers are only allowed to work at the morning or afternoon. so they have two gaps at lunch time.

i fear your teachers don't have gaps is pretty hard. (how do you want to substitude ill teachers if no one has gaps?) i recommend to start with allowing 1 gap. (if you need to allow more gaps, you also need to seperate the lunch time into more periods.)

now like liviu told: decide which activity should be in the morning and which should be in the evening. set this as activity tag.

i am not sure if my variant is to hard, because it mean a stundent can not have school from 08.00 to 12:00, then 2 hours lunch, 2 hours free and the last 2 hours school. also it is not possible that a students already have period from "11:00-12:00" free. maybe that constraint is to hard to you, but give it a try.

hmmm....
by thinking about it, it would be also possible to not differ between "morning" and "afternoon". so you only need activity tags "possible slot" and "lunch".

Liviu Lalescu

I have thought some more. I think the second solution I told you about is possible. I also can help you with providing custom made FET to allow intelligent students min hours and to specify that for all teachers, they must work either in the morning or in the afternoon.

Chafik Graiguer

#5
many many thanks for prompt reply

QuoteI have thought some more. I think the second solution I told you about is possible. I also can help you with providing custom made FET to allow intelligent students min hours and to specify that for all teachers, they must work either in the morning or in the afternoon.
such a customised FET version will be very wellcomed

Now I will rty to understand your suggesed workarounds along with those of  Volker Dirr


I think I was not so clear :(
Quote
1) Students min hours daily is not intelligent, so all days must have at least 2 hours for each student. I can give you however a FET version just for you, with intelligent min hours for students


I said:
The most important thing is that:
For Students and teachers:
- in a given period, minimum of adjacent timeslots with activity is 2, never one;
I had to add:
But free day/period is also OK
in other words:
If FET schedule some activities for a teacher or a students on monday morning or afternoon, the minimum number of  contiguous activity should be 2
But if FET didnot schedule any activity on monday, it will be ok also  :)

So is there any constraint like this:
Minimum contiguous activity,
because a single hour/activity at morning or afternoon is not allowed

Chafik Graiguer

#6
a photo is worth than 100 words
in the followings images, timeslot 5 and 6 are lunch break
Please, notice that gaps around lunch break dont matter, they are fully legal !! as long as minimum contiguous activity is 2 !!!


1- a "good" timetable sample for students:



2- another "good" timetable for students:



3- a third sample for students:


4- this is even better for students:


5- and finally some sample timetable sfor teachers:



6- and this is a more compact timetable for teacher:

Liviu Lalescu

Yes, I understood correctly your problem. Min hours daily should be 2 for teachers and students. I'll make you a custom FET, with days: day FET 1 is real day 1 morning, day FET 2 is real day 1 afternoon, day FET 3 is real day 2 morning, day FET 4 is real day 2 afternoon, and so on.

The custom version I'll send you makes impossible for teachers to have lessons in FET day 1 & 2, in FET day 3&4... at the same time, and also makes possible for students to have no hours in a day and minimum 2 in other days.

To make a schedule better, with more hours per day for students/teachers, you can raise the number of minimum hours daily for a students set/teacher or for all from 2 to 3.

Liviu Lalescu

#8
I have made a special version just for you. Links:

http://timetabling.de/download/custom/alfaromeo/fet-5_6_4-alfaromeo.exe
http://timetabling.de/download/custom/alfaromeo/fet-5_6_4-alfaromeo.tar.bz2

Please let me know your results/problems.

This custom version adds intelligent students min hours daily and automatic constraint that teachers cannot work in days 1&2, in days 3&4 ... at the same time (like you need). This constraint is not listed in the timeconstraints list.

Please read my other posts above (without the first one) to know how to input your data.

Please let me know if you succeed. If there are bugs, I will solve them.

Chafik Graiguer

#9
Thnk you very much
really appreciate the help
I will give it a try
But I strill have two questions:
- does this version tolerate gaps eventualy located around lunch break ( eventualy located before or after lunch break)!?
in other words: can this version make distinction between illegal gaps located between morning or afternoon activities, and legal gaps located apound lunch break . I dont want FET to hang forever trying to eliminate those gaps
- a cosmetic concern: How can I join the two halfs days at final stage (printing) !?

Chafik Graiguer

#10
Hi Volker_dirr
Quotei am not sure if my variant is to hard, because it mean a stundent can not have school from 08.00 to 12:00, then 2 hours lunch, 2 hours free and the last 2 hours school. also it is not possible that a students already have period from "11:00-12:00" free. maybe that constraint is to hard to you, but give it a try.
If you look at the images above, you will notice that this senario is legal




Quote
hmmm....
by thinking about it, it would be also possible to not differ between "morning" and "afternoon". so you only need activity tags "possible slot" and "lunch".
I will give it a try also

Best regards


Liviu Lalescu

#11
Quote
- does this version tolerate gaps located around lunch break !?
in other words: can this version make distinction between illegal gaps located between morning or afternoon activities, and legal gaps located apound lunch break . I dont want FET to hang forever trying to eliminate those gaps

Yes, because FET sees 2*n days, each day is separate from the others. You just have to add max gaps per week teachers and students -> 0. Each day will have no gaps in this way, but it is allowed to have gaps between days.

Quote
- a cosmetic concern: How can I join the two halfs days at final stage (printing) !?

I think the first step is to obtain a good solution. Then, we can think of a solution to this.

Chafik Graiguer

Quote
Yes, because FET sees 2*n days, each day is separate from the others. You just have to add max gaps per week teachers and students -> 0. Each day will have no gaps in this way, but it is allowed to have gaps in between days.
sorry !! I am a little bit confused
If my understanding is correct, the day 1 is monday morning, day 2 is monday afternoon... and so on
Well,  from the teacher's pointview, he will have lesson only in day 1 or day 2
my qusetion: how many hours shall I put in each "artificial" days? 4 hours or 10 hours (morning+lunch break+afternoon)?

Quote
You just have to add max gaps per week teachers and students -> 0
this means that students will never have lesson in both morning and afternoon  in the artificial day 1 for example.
So I only have to put 4 hours/timeslots in each "artificial" day


Liviu Lalescu

#13
Each artificial day (FET day) will have 4 hours. Forget about the 2 hour break, it is not needed anymore.

I added a constraint that days 2*i-1 and 2*i cannot have both hours for teachers only. Students are allowed to have hours in both days.

If you have 5 days with 4+2+4 hours (real life), then add 10 days with 4 hours per day in FET.

Chafik Graiguer

QuoteEach artificial day (FET day) will have 4 hours. Forget about the 2 hour break, it is not needed anymore.
...
If you have 5 days with 4+2+4 hours (real life), then add 10 days with 4 hours per day in FET.
ok   :)
I get it now