FET Forum

FET Support (English) => Get Help on Your Input File => Topic started by: infoo_ on February 21, 2025, 10:59:40 PM

Title: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 21, 2025, 10:59:40 PM
Hello

I tried to generate a timetable from the attached file, but 2 seconds later it get stucks at 257 out of 323 activities.

It seems the path to found a solution is similar to this answer:

Quote from: Volker Dirr on January 18, 2023, 11:37:29 AMSo please check carefully in the first problem (with time constraint) which activity is number 283.
Then delete the constraints. And check the order of the activities is changed. The old activity 283 might no be at a totaly different place! Please let FET generate and check if it was able to place the "old 283" (might be now "400"). Only if it place the activity you might have found the problem. Check the new activity that isn't able to be placed. It might be a new problem or still the old one! If it is a new problem, then fix the new problem. If you can't see a problem, then it might be still the old problem! In that case the old acitity 283 and the "new" activity have the "same" problem. (So they might share the same room, the same teacher or the same room). If both activities have such a "share" thing, then normaly there is the bug that you need to solve.

It's hard for me to figure out how to solve it. That is, I do not understand the steps to follow.

All activated constraints are necessary. Maybe splitting subactivities can work, but I don't realize which is the first one I should pay attention to.

I tried to read the menu dialog. It starts saying:

QuotePlease check the constraints related to following possibly problematic activity (or teacher(s), or students set(s)):
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Id: 131 (    1/5 - RODRIGUEZ - LENGUA Y LITER - 2C - 2C)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

But then it says:

QuotePlease check the constraints related to the last activities in the list below, which might be impossible to schedule:

Here are the placed activities which lead to an inconsistency, in order from the first one to the last (the last one FET failed to schedule and the last ones are most likely impossible):

Then a long list of activities are mentioned, so I guess I should start looking the last ones of that list, which are:

Quote...
No: 250, Id: 61 (    2/5 - TALARICO - LENGUA Y LITER - 1C - 1C)
No: 251, Id: 124 (    2/5 - MIGUEZ - MATEMATICA - 2C - 2C)
No: 252, Id: 80 (1 - PRIMA - T. ED DIGITAL - 2C - 2C)
No: 253, Id: 196 (2/4 -     RUSSO - ORGANIZACIONES - 3C - 3C)
No: 254, Id: 130 (    2/5 - RODRIGUEZ - LENGUA Y LITER - 2C - 2C)
No: 255, Id: 129 (2/5 -     RODRIGUEZ - LENGUA Y LITER - 2C - 2C)
No: 256, Id: 131 (    1/5 - RODRIGUEZ - LENGUA Y LITER - 2C - 2C)
No: 257, Id: 195 (    2/4 - RODRIGUEZ - LENGUA Y LITER - 3C - 3C)
No: 258, Id: 194 (2/4 -     RODRIGUEZ - LENGUA Y LITER - 3C - 3C)

Volker says "please check carefully in the first problem (with time constraint)" but I don't know if it related to the first activity of the list (id 131) or the last activity of the list (id 194).

How to proceed?
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 12:42:53 AM
I can't find the problem.

All my attempts were on afternoon (1ยบ 12:50-13:30 and so on) because the menu dialog throws a lot of activities related to those hours.

So I manually checked that teachers available times constraints fill necessary slots for total duration of activities in courses 1C,2C,3C,4C and 5C.

Then I splitted some 2+2 activities (min days between=1 constraint) into 2+1+1. For each new activity created, two min days=1 constraints were added.

I also tried to deactivate some min days between constraints for courses 2C,3C without success.

What could be happening?
Title: Re: Stuck generation and I don't know how to fix it
Post by: Liviu Lalescu on February 22, 2025, 05:08:35 AM
The id 131 is what made the generation impossible, because it is the highest activity which could not be placed.
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 22, 2025, 10:33:10 AM
It is always good to try a minimum example to catch the bug.
In your case it is in group 2c.
See attached file and fix the bug there.
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 08:34:00 PM
Hello

Quote from: Liviu Lalescu on February 22, 2025, 05:08:35 AMThe id 131 is what made the generation impossible, because it is the highest activity which could not be placed.

I guess this is the id number from where we need to start checking. Ok.

Then you say "because it is the highest activity which could not be placed", what does "highest activity" mean?
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 08:36:04 PM
SORRY, I (Volker Dirr) sadly modified your/this post :-(
Title: Re: Stuck generation and I don't know how to fix it
Post by: Liviu Lalescu on February 22, 2025, 08:38:59 PM
Quote from: infoo_ on February 22, 2025, 08:34:00 PMHello

Quote from: Liviu Lalescu on February 22, 2025, 05:08:35 AMThe id 131 is what made the generation impossible, because it is the highest activity which could not be placed.

I guess this is the id number from where we need to start checking. Ok.

Then you say "because it is the highest activity which could not be placed", what does "highest activity" mean?

The activities are placed in order, say A1,..,Ai-1,Ai,Ai+1,...,An. This is the initial order reported by FET. If FET cannot place from Ai to An, then Ai is the highest I was referring to, and A1...Ai define an impossible partial data.
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 08:42:10 PM
Quote from: Liviu Lalescu on February 22, 2025, 08:38:59 PMThe activities are placed in order, say A1,..,Ai-1,Ai,Ai+1,...,An. This is the initial order reported by FET. If FET cannot place from Ai to An, then Ai is the highest I was referring to, and A1...Ai define an impossible partial data.

How can A1,..,Ai-1,Ai,Ai+1,...,An be placed in order if FET cannot place from Ai to An? It wouldn't be called "ordered placed activities", isn't it? Sorry if it is a silly question, but it is hard for me to understand the fundamentals about the generation
Title: Re: Stuck generation and I don't know how to fix it
Post by: Liviu Lalescu on February 22, 2025, 08:44:09 PM
Quote from: infoo_ on February 22, 2025, 08:42:10 PM
Quote from: Liviu Lalescu on February 22, 2025, 08:38:59 PMThe activities are placed in order, say A1,..,Ai-1,Ai,Ai+1,...,An. This is the initial order reported by FET. If FET cannot place from Ai to An, then Ai is the highest I was referring to, and A1...Ai define an impossible partial data.

How can A1,..,Ai-1,Ai,Ai+1,...,An be placed in order if FET cannot place from Ai to An? It wouldn't be called "ordered placed activities", isn't it? Sorry if it is a silly question, but it is hard for me to understand the fundamentals about the generation

FET tries to place A1,...,Ai-1, and places them. Then it cannot place Ai.

A1...An is only the initial order, and FET tries to place them in this order. A1 is the most difficult activity, An is the easiest.
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 22, 2025, 08:59:44 PM
Ahh... Sorry. I sadly modified your post :-(
@Liviu, is there a way to UNDO my modification of post #5 ?

I only wanted to answer:
QuoteHowever, this is not enough for the original file

Because you have more bugs in your file.
Just do again a minimum example file with only group 2a. It also doesn't generate. You must fix that bug.

BTW: In my opinion deactivating that min day time constraint is not a clever bug fix, since you might get in worst case 3 hours continuously. You should think about the bug more detailed and find a better solution.
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 09:02:28 PM
Quote from: Liviu Lalescu on February 22, 2025, 08:44:09 PMFET tries to place A1,...,Ai-1, and places them. Then it cannot place Ai.

A1...An is only the initial order, and FET tries to place them in this order. A1 is the most difficult activity, An is the easiest.

Ok.

Quote from: Volker Dirr on February 22, 2025, 08:59:44 PMBecause you have more bugs in your file.
Just do again a minimum example file with only group 2a. It also doesn't generate. You must fix that bug.

BTW: In my opinion deactivating that min day time constraint is not a clever bug fix, since you might get in worst case 3 hours continuously. You should think about the bug more detailed and find a better solution.

Your "not clever bug fix" was right. Even with min days constraints deactivated it does not finish generating.

The report places 4C as a problematic group. Also 2A.

I will be extremely grateful if you guide me to find the bug. I don't need you to give me the solution, but where to start looking
Title: Re: Stuck generation and I don't know how to fix it
Post by: Liviu Lalescu on February 22, 2025, 09:05:38 PM
Volker, I think there is no Undo on the forum.

infoo_, you can remove students/teachers/activities until a minimum file is unsolvable. You can choose which activities to remove from the initial order. Remove Ai+1, ..., An. Remove constraints while the file is still unsolvable.

Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 22, 2025, 09:14:49 PM
Yes. In your example file you can remove all (except the basic) room constraints.
And you can remove all students, except group 2a.
You will see, that this minimum example is also not solve able.
You need to find a good bug fix for that minimum example also.
(It looks like you have very many teachers not available times. Please think carefully about that. You should use that only if it is 100% needed; don't use it if a teacher want to have free at that time, just because he likes it. There must be a critical reason for this; like working at an other school. In all other cases you should only use max gaps constraints to make nice timetables for teachers.)
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 09:19:02 PM
Ok. I will try to do it.

Before starting to remove students/teachers/activities, I would like to know if breaking 2+2 activities into 2+1+1 activities can fix the bug(s).

However, I don't know if there is an automatization for this to divide all 2+2 into 2+1+1, because doing it manually takes too long

I remember from previous timetables that with a couple of activities divided in that way, satisfactory schedules were found by FET.

What do you think? Would it be possible to find those "magical" activities to try to make it solvable?
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 22, 2025, 09:23:52 PM
Quote from: Volker Dirr on February 22, 2025, 09:14:49 PMYou will see, that this minimum example is also not solve able.

I see. As asked before, maybe breaking 2+2 acts into 2+1+1 can help a lot?

Quote from: Volker Dirr on February 22, 2025, 09:14:49 PM(It looks like you have very many teachers not available times. Please think carefully about that. You should use that only if it is 100% needed; don't use it if a teacher want to have free at that time, just because he likes it. There must be a critical reason for this; like working at an other school. In all other cases you should only use max gaps constraints to make nice timetables for teachers.)

Teachers not available times are done by teachers. They send their available times and I just put them into FET.

This year a lot of teachers have marked little available hours. They work on other schools, and we ask they to please mark wide availability times, but many do not do so-

I think this is 80% of the problem

Title: Re: Stuck generation and I don't know how to fix it
Post by: Liviu Lalescu on February 22, 2025, 09:24:12 PM
Hmm... sorry, I cannot help you with this.
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 22, 2025, 09:26:41 PM
Quote from: infoo_ on February 22, 2025, 09:19:02 PMBefore starting to remove students/teachers/activities, I would like to know if breaking 2+2 activities into 2+1+1 activities can fix the bug(s).
[...]
What do you think? Would it be possible to find those "magical" activities to try to make it solvable?

Might be possible. But for that I must read your data set more carefully to answer it. That is over my time limit for free support.

But in my opinion from my quick reading only: You have much too many teachers not available times. I bet at least a few of them have no "real" reason. You should remove them all if they are not 100% needed. Set max gaps constraints to make nice timetables for teachers.
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 22, 2025, 09:31:24 PM
Quote from: infoo_ on February 22, 2025, 09:23:52 PMTeachers not available times are done by teachers. They send their available times and I just put them into FET.

This year a lot of teachers have marked little available hours. They work on other schools, and we ask they to please mark wide availability times, but many do not do so-

I think this is 80% of the problem

Yes. That is a problem. It doesn't work like that. You will get impossible timetables if teachers can just choose the free times.
First: Teachers must tell you reasons. No good reason -> No not available time
Second: If they work at other schools, then it is clever if you talk with the timetable maker of the other school(s).
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 23, 2025, 12:11:42 AM
I know...

Thank you for your help

With respect to 2A, @Volker Dirr deactivating this works fine 2A:

Min days between activities, WP:100%, NA:3, Id:73, Id:74, Id:75, mD:1, CSD:yes

After so many attempts, I see a problem with 4C and 5C. My timetable only has those groups. It got stuck
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 23, 2025, 12:46:53 AM
As I already said: In my opinion removing min n day constraints is not a good variant to fix that problems. You should remove teachers not available times. It is much too easy to get impossible timetables if just a few teachers select the same not available times.
It is not normal that teachers can select so many not available times. In normal case teachers shouldn't have not available time constraints at all. Set only not available times if they are forced to work at that times. Don't give them not available times, just because they want to go shopping or sleep longer or clean the car or lawn mowing or watch tv. You must remove all that times. The teachers get paid for their work.
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 23, 2025, 01:00:16 AM
There are many "bad" constraints and/or activity plannings in that data set.

For example teacher VAZQUEZ:
He is not available on the last day in the morning. He can only work in the evening.
But you gave him only activities of students that have no activities in the evening at all. They have only activities in the morning.
And you have a lot of those "bugs".

You must do a better activity planning or you must remove that not available time constraints of the teachers. The min n day constraints are needed by the students. You can't remove that constraints. The teachers get money to teach the students. You can't set the students bad constraints. You must remove the unnecessary not available time constraints from the teachers or you must do a better activity planning.
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 23, 2025, 01:19:21 AM
Thanks for looking the data

I am not sure if I understood you correctly

Quote from: Volker Dirr on February 23, 2025, 01:00:16 AMHe is not available on the last day in the morning. He can only work in the evening.

You mean on day VIERNES? Because he is free first three days on first seven hours (7 am to 12:05 am). And he is free on the last hour of every day (17:50 to 18:30). He has good availability in the mornings, but not so in the afternoons

Quote from: Volker Dirr on February 23, 2025, 01:00:16 AMBut you gave him only activities of students that have no activities in the evening at all. They have only activities in the morning.

VAZQUEZ teachs in groups 3A, 3B, 4A and 4B (morning groups). CERAVOLO (VAZQUEZ) teachs in groups 4C and 5C (afternoons).

VAZQUEZ and CERAVOLO (VAZQUEZ) are the same teacher, so he teachs both on mornings and afternoons. So that probably caused the confusion

In general, Ta and Tb (Ta) always refers to the same teacher Ta. This is due sometimes Tb (Ta) can have different availability times than Ta, and sometimes they share the same availability. That's why activities not overlapping constraints play a crucial role here: if those constraints were not present and a timetable with Ta teaching at same time as Tb (Ta) was found, it is not correct (Ta would be teaching in two groups at the same time)
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 23, 2025, 10:53:59 AM
Quote from: infoo_ on February 23, 2025, 01:19:21 AM[...]VAZQUEZ teachs in groups 3A, 3B, 4A and 4B (morning groups).

Yes, but he is not available in the morning on Friday. He is only available in the evening. So he will never be able to teach in the evening, since he has only morning groups.
And it looks like you have also other teachers with those situations.

Like I said: You must remove all not available times that have not a good reason. In all other cases you will just get impossible timetables like now and if you don't remove those times, then you might only get solutions if you do very bad timetables for students or if you swap the teachers of activities. But that last 2 variants are bad. Remove that many not available time constraints. That is not normal. You can't let the teacher choose the not available hours. That is in normal case always impossible (except if you have much luck). If just a few teacher select the same not available time, you will get impossible data sets, like right now. You are the boss, you pay the teachers so you can tell them when they must come to work and when they don't need to come to work. If the teachers thinks shopping, walking with the dog and watching tv is more imported then earning money, then hire other teachers or pay them less money (I now, you can't do that by law. But I think you know what I want to tell you with that).
You can give the teachers nice timetables by adding max gaps time constraints with a low max value. And by adding min hours per day constraints. Most teachers will like that. (Yes, I know. I low number of teachers like gaps. So don't give that teachers a max gaps constraint or even add them a max continuously hours constraint)
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 23, 2025, 09:47:57 PM
Quote from: Volker Dirr on February 23, 2025, 10:53:59 AMAnd it looks like you have also other teachers with those situations.

Right. However, that does not imply bugs. Currently I am looking for the bug(s)

Quote from: Volker Dirr on February 23, 2025, 10:53:59 AMLike I said: You must remove all not available times that have not a good reason. In all other cases you will just get impossible timetables like now and if you don't remove those times, then you might only get solutions if you do very bad timetables for students or if you swap the teachers of activities. But that last 2 variants are bad. Remove that many not available time constraints. That is not normal. You can't let the teacher choose the not available hours. That is in normal case always impossible (except if you have much luck). If just a few teacher select the same not available time, you will get impossible data sets, like right now. You are the boss, you pay the teachers so you can tell them when they must come to work and when they don't need to come to work. If the teachers thinks shopping, walking with the dog and watching tv is more imported then earning money, then hire other teachers or pay them less money (I now, you can't do that by law. But I think you know what I want to tell you with that).
You can give the teachers nice timetables by adding max gaps time constraints with a low max value. And by adding min hours per day constraints. Most teachers will like that. (Yes, I know. I low number of teachers like gaps. So don't give that teachers a max gaps constraint or even add them a max continuously hours constraint)

I agree with you, but I am not a head of school. I will try to convince the authorities to talk with teachers

Today is Sunday, so tomorrow I will contact school

In the meantime I could not generate a timetable for courses 4C and 5C. I am convinced that there is at least a bug between those.

In the attached file you can see I have splitted the following activities (also I have fixed the slots of a constraint that I had put wrong):

    246 - 2/4 - ACCORINTI - MATEMATICA - 4C - 4C -
    THIS
    263 - 2/4 - TALARICO - LENGUA Y LITER - 4C - 4C -
    THIS
    319 - 2/4 - MIGUEZ - MATEMATICA - 5C - 5C -
    THIS
    321 - 2/4 - PASQUALI - QUIMICA - 5C - 5C -
    THIS
    327 - 2/4 - TALARICO - LENGUA Y LITER - 5C - 5C -
    THIS

Combinations.png

As you can see in the previous image, I took the job to try the 32 combinations between these 5 activities, alternating between the splitted ones (1+1) and the non-splitted ones (2).

In all generations it was stuck in about the same number of activities.

If you can take a look at it to identify the bug, I think it would be the starting point to notify the school of that, instead of asking them to talk to the majority of teachers throughout them.

That is, warning that some teachers of 2 courses must extend their available time is worth more than warning that teachers of 15 courses must extend their available time. And I'm determined to find it, but for now I couldn't

Thank you very much for your understanding and I appreciate any help
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 23, 2025, 10:38:25 PM
No time to read that all. Too much work for free support.
But you can check it yourself pretty quick: Set them all to 1+1 and set weight = 0%. Because FET is in that case allowed to place them together. If 1+1 with weight = 0% doesn't work, then all your combinations won't work. If you use weight = 0%, (and don't delete the min day constraint), then you can also see in the log file if FET placed them on the same day.
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 23, 2025, 11:01:50 PM
Quote from: Volker Dirr on February 23, 2025, 10:38:25 PMSet them all to 1+1 and set weight = 0%

What weight are you referring to? The activities don't have weight as far as I know, and min days constraints were deactivated before anything (those who impact 2+2 activities)
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 23, 2025, 11:23:52 PM
If you already deleted the min n day constraints, then it is like 0%, just that you can't see in the log files if the activities are placed consecutive. In fact it even allows more, since they can be placed now not consecutive at the same day.
So if you set 1+1 and deleted the min n day, then ALL your combinations are IMPOSSIBLE, because 1+1 in fact allow to put them together to 2. You don't need to check anymore if 2 is possible. If 1+1 is impossible, then 2 is also impossible.
see the pictures here:
https://www.timetabling.de/manual/FET-manual.en.html#id_15

I must sleep now and work tomorrow. So It will take some time before reading here again.
Title: Re: Stuck generation and I don't know how to fix it
Post by: infoo_ on February 24, 2025, 01:12:51 PM
Quote from: Volker Dirr on February 23, 2025, 11:23:52 PMYou don't need to check anymore if 2 is possible. If 1+1 is impossible, then 2 is also impossible.

I tested with 2+2 and 2+1+1 activities, but you mean that testing with 2+1+1 also include 2+2 with all min days constraints deactivated?
Title: Re: Stuck generation and I don't know how to fix it
Post by: Volker Dirr on February 24, 2025, 02:07:22 PM
If you testes 2+1+1 with weight 0% and it fails, then you already know that 2+2 is impossible, since 2+2 is a possible situation if you set 2+1+1 with weight 0% .
So you don't need to test 2+2 anymore.