I have a general question regarding the use of weights in FET.
As far as I understand it weights in FET are tied to the number of retries to try and find a solution.
Let's say I want to do something like this: I would like to have a constraint like 'a set of activities has a set of preferred time slots', but I want this constraint to only have an effect IF no additional gaps for teachers are introduced. Is this possible?
Also, is it possible to somehow minimize maximum gaps per week for a teacher / for all teachers? The given constraint 'Max gaps per week for a teacher / for all teachers' only allows a fixed number, and the constraint with the fixed number has to be a hard constraint (100%). Is this the only way to minimize gaps?
A very long time ago, with a proprietary program, I noticed that if I did not put a limit on teachers' gaps and let the program generate, it found 4 gaps at best. If I specifically put max 2 gaps, it found a timetable in a comparable time. Also in FET, I deduced that it is best to allow only 100% for the max gaps constraints. Otherwise, the timetable would be weak. Or maybe a weight like 99.999% might be useful, but I am not sure.
It might be possible to set this condition, as a custom version, but looks complicated, I am not sure.
Yes, in the official FET the only way to minimize the gaps is to use 100% and progressively lower this value as you find new timetables. It might be possible in a custom version to add weights <100% for max gaps, but unfortunately now, after so many other constraints depending on max gaps only having 100%, this would imply many difficult changes.
OK, so if I understand you correctly, the only way to do what I want with the given rules is to manually try lowering the maximum gaps teacher per teacher, and when I have optimized this, only then try with nice-to-have rules that try to achieve certain goals regarding a set of activities has a set of preferred time slots?
A slightly related question, there is no way to redefine what exactly counts as a gap, right?
If a teacher has a lesson in hour 1, and the next one in hour 4, does this count as 1 or 2 gaps?
Depending on the answer this might actually be THE reason why I will always use MA mode. Because in my country, having a gap between morning and afternoon lessons isn't all that relevant, especially for teachers who live close to the school. What's much more relevant is having no gaps within the morning and within the afternoon, and to have at least 2 lessons per morning or afternoon.
Yes, indeed. And after optimizing the gaps, you could use subactivities preferred times, only for the first component, with 100%, and so on, because working with weights <100% for preferred times is not very good (in general, weights <100% are to be avoided, except min days between activities).
Two gaps, categorically. Maybe one gap counting could be possible as a customization, but might be very complicated and implemented not perfectly, I am not sure.
Yes, definitely use the Mornings-Afternoons mode.
Is it possible to somehow change mode or do I have to reenter all the data again?
Oh, no reentering :)
File menu, Mode, Mornings-Afternoons (with your Official mode file opened). FET will inform you of the potential problems regarding the conversion.
Then you'll need to modify a bit the preferred times constraints and I am not sure if the constraints of type teachers/students min max days per week to be for real day, but only if you have these constraints.
But, by all means, make a backup before and keep it.
Thank you! One more question regarding gaps and then I'll stop bugging you and try to figure stuff out myself, at least til next week :D
In MA mode, is it still possible to make a constraint for gaps between morning and afternoon lessons?
You are welcome!
I just checked, and I think you mean the existing constraints teachers/students max gaps per real day and teachers/students max gaps per week per real day. You need to enable these constraints first (don't worry, they work well).
Quote from: Liviu Lalescu on January 19, 2024, 07:35:41 PMFile menu, Mode, Mornings-Afternoons (with your Official mode file opened). FET will inform you of the potential problems regarding the conversion.
Then you'll need to modify a bit the preferred times constraints and I am not sure if the constraints of type teachers/students min max days per week to be for real day, but only if you have these constraints.
But what do I have to change about the days and hours? After changing mode, there are still the same 5 days and the same hours... Do I have to make pseudo-days Monday morning, monday afternoon etc.? I cannot find anything about this in the 2 user manuals nor the FAQ...
Modify the days and the hours: make 10 FET days and max(real hours morning, real hours afternoon) FET hours.
I'm sorry, but I need some more help on this topic, I searched the forum and the documentation, but came up short.
I did what you said (10 FET days, the hours are still the same as before). How can I now map the correct hours to the according days? You said in post #7 that it's possible to set gaps for real days, but how does FET even know what a real day is now?
Is this defined by the order of the days?
There is Help for Morocco/Algeria in FET, and examples.
FET day 1 is real day 1 morning, FET day 2 is real day 1 afternoon, ..., FET day 10 is real day 5 afternoon.
FET will consider a real day gap = sum of gaps from FET day 1 and FET day 2 and the gaps between these two FET days.
Ok, but how do I map the correct hours to the half days? Or do all hours exist on all days, and I have to for example disable any activities on (FET day) monday morning (hours) afternoon hours, monday afternoon morning hours, etc.?
I do not understand exactly.
In Morocco and Algeria they have 4 hours in the morning and 4 in the afternoon (in some schools 5 morning and 5 afternoon hours). They also have 5 or 6 real days. So there are 10 or 12 FET days, and 4 or 5 hours per FET day.
Ah, now I understand. I misread what you wrote on post #9:
QuoteModify the days and the hours: make 10 FET days and max(real hours morning, real hours afternoon) FET hours.
I thought you meant to keep all the real hours. This means there are no actual hours (real time of day) in MA mode, just slots.
So if a school has 5 slots in the morning and 4 in the afternoon, then I guess FET will just act as if there are also 5 in the afternoon, but I have to disable all activities on the 5th slot of the afternoon, correct?
Yes, indeed, add a break in the last hours of all the afternoons.
OK. I've got it to work now. Thanks as always for your help!
I did find an error, however. Constraint a set of activities has same starting day (any hours) does not work anymore in MA mode. I'm assuming this is because 'day' here means FET day, not actual day.
You are welcome!
It is not actually an error, but an inconvenient feature.
However, FET was crafted following the suggestions of many users. So, there is a solution: max 0 days between activities. You'll find written there that max days is for real days. :)
One other thing: Why is 'an activity/a set of activities ends students day' limited to 100% weight? This is very bad for me, this is actually one of the main reasons why I tried MA mode in the first place :-(
I don't remember why you needed end students' day and used instead the MA mode.
If you want, we can explore to customize FET to allow <100% for this constraint, and see how it behaves. 100% only is kind of logical for the algorithm, cannot exactly explain.
A bit fun: Well, if it is your main reason, then 100% is fine.
But a bit more detailed: There are mainly 2 reasons why Liviu done some constraints only with 100% possible.
a) because with some constraints values below 100% doesn't work fine. You will probably get an as bad result with 99% as with 1%. You probably won't notice a differnce between that values. But as Liviu said. He might try with a custom version. Please don't forget that this is much work in research. Please support him in that case.
b) because with some constraints generating will be much much slower with values below 100%.
I'll try to explain in a bit more detail:
The most important thing I couldn't achieve in regular mode is this: IF a class has activities on an afternoon, then there have to be at least two lessons. This now works.
The second thing, by far not as important, is this: Gym (sports) should always be at the end of the morning or the afternoon, for obvious reasons. (But not 100%.) I simulated this in regular mode by disabling all but the last slots in the morning, but for the afternoon this trick won't work, because FET can always plan shorter or longer afternoons. Maybe there is another trick to achieve the same goal.
Quote from: Liviu Lalescu on January 29, 2024, 10:25:42 PMI don't remember why you needed end students' day and used instead the MA mode.
If you want, we can explore to customize FET to allow <100% for this constraint, and see how it behaves. 100% only is kind of logical for the algorithm, cannot exactly explain.
That would be great!
I understand why from a technical standpoint you would only allow this constraint to be 100%. I'm asking more from a users standpoint. What use case is there where a lesson absolutely always has to end a day?
I myself always use only 100% weight for all constraints. I never use lower values.
About your gym. Well you can calculate very easy if that is possible at you school. So this mean in total you have only 5*2=10 free slots for the gym. I don't know how big your gym is. Maybe there can be 3 classes in the gym. In that case you have 3*10=30 slots. So if you have max 30 classes at your school it might be possible.
But if you have for example only 1 teacher for this subjects, then it is impossible, since he can teach 3 classes at the same time. So you need at least 3 teachers.
And this also mean the gym will be always totally full in these slots, while it is empty in the other slots.
Even i understand the idea to place sport always last in the gym, since this might be nice out of the view from a single class. This might be bad or impossible for the whole school.
In fact there are also disadvantages, since sometimes it is much better if the gym is not fully loaded. The classes have more space and there will be much less noise.
So overall there are advantages and disadvantages.
Quote from: Volker Dirr on January 29, 2024, 10:52:30 PMI myself always use only 100% weight for all constraints. I never use lower values.
I don't understand. Are you talking about this type of constraint in particular, or in general?
If the latter, that makes no sense to me, unless I fail to understand something fundamental about the way the algorithm works. Let's take any example of something you might want to achieve, but you know can never be achieved 100% of the time due to hard constraints. For example, you want as few Math lessons as possible to be in the afternoon. However, you know (or at least suspect) that this is not possible 100% of the time. So what would be the alternative here, make no constraint at all? Then you have many Math lessons in the afternoon, instead of just some.
Quote from: Volker Dirr on January 29, 2024, 10:52:30 PMAbout your gym. Well you can calculate very easy if that is possible at you school. So this mean in total you have only 5*2=10 free slots for the gym. I don't know how big your gym is. Maybe there can be 3 classes in the gym. In that case you have 3*10=30 slots. So if you have max 30 classes at your school it might be possible.
But if you have for example only 1 teacher for this subjects, then it is impossible, since he can teach 3 classes at the same time. So you need at least 3 teachers.
And this also mean the gym will be always totally full in these slots, while it is empty in the other slots.
Even i understand the idea to place sport always last in the gym, since this might be nice out of the view from a single class. This might be bad or impossible for the whole school.
In fact there are also disadvantages, since sometimes it is much better if the gym is not fully loaded. The classes have more space and there will be much less noise.
So overall there are advantages and disadvantages.
Maybe I didn't explain this well enough. It's not an issue about having too few capacities, or about advantages or disadvantages.
I want (certain) gym activities to always be at the end of the morning or the afternoon. However, I don't necessarily want to define this as a hard constraint, because other things are more important.
In case of the morning, this can be achieved by marking the possible slots with '
an activity has a set of preferred time slots'. However, for the afternoons, this isn't possible, since the afternoons don't have a fixed number of hours, so the slots I want to avoid are dynamic and the beforehand mentioned constraint won't work.
THAT'S why I'd like to use the 'activities and students day' constraint with less than 100%.
I am talking about 100% constraint in general. I always use only 100% constraints.
If i know that 100% is not possible, then there are 2 variants:
a) i fix the bug to make it possible (I know that is not always possible, but sometimes. For example for min days time constraints it is easy always possible)
b) I do the 100% only for a lower/higher value. So instead of selecting all activities, i select some activities. Or by increasing/decreasing the additional value of that constraint.
About the gym. Yes, i think I understood your request correct. Maybe reread my answer and/or answer me this:
You wrote: "I want (certain) gym activities to always be at the end of the morning or the afternoon."
Why do you want that? What is the advantages if you do that?
Then reread my answer and think again. What is the disadvantage if you don't do it? What is the disadvantage if you do it?
Do you get it now? EVERY Constraint has advantages and disadvantages. You should be able to always tell someone why you added a constraint. If you can't tell someone the advantage of a constraint, then don't add it, since it is unneeded in that case. Why should i add a constraint if there is no advantage?
I decided to allow in the official version a weight <100% for the constraints of type activity(ies) begin/end teachers/students day. I made it and seems OK.
Please test and let me know: https://lalescu.ro/liviu/fet/download/test/
Thank you for the suggestion!
Quote from: Volker Dirr on January 30, 2024, 01:26:56 PMI am talking about 100% constraint in general. I always use only 100% constraints.
If i know that 100% is not possible, then there are 2 variants:
a) i fix the bug to make it possible (I know that is not always possible, but sometimes. For example for min days time constraints it is easy always possible)
b) I do the 100% only for a lower/higher value. So instead of selecting all activities, i select some activities. Or by increasing/decreasing the additional value of that constraint.
I understand your approach, but that doesn't make any sense to me (personally). Using that approach would completely defeat the purpose of why I am using an optimization software in the first place. Concrete example: I'd like most of Math, German and French lessons to be in the afternoon. Also, as previously discussed, I would like gym to be at the last lesson of the day. And then, I would also like to minimize the number of mornings where classes start at the second hour. To achieve this, I would spend ages adding and removing single activities/constraints with 100% weight. At some point, the time and effort would become so big that there would be no advantage over planning the whole schedule manually.
QuoteAbout the gym. Yes, i think I understood your request correct. Maybe reread my answer and/or answer me this:
You wrote: "I want (certain) gym activities to always be at the end of the morning or the afternoon."
Why do you want that? What is the advantages if you do that?
Then reread my answer and think again. What is the disadvantage if you don't do it? What is the disadvantage if you do it?
Do you get it now? EVERY Constraint has advantages and disadvantages. You should be able to always tell someone why you added a constraint. If you can't tell someone the advantage of a constraint, then don't add it, since it is unneeded in that case. Why should i add a constraint if there is no advantage?
I'm not sure I follow you here. The advantage is, that people can go home and shower.
What I am doing is taking real life examples and trying to see if I can implement everything in FET. So all my requirements are real requirements by real teachers in real schools. I am extremely grateful to Liviu for helping me out with tricks and even changing FET to meet my needs. Conversely, I hope that my input has some limited value to you, to show you where FET's features still have limitations that would be needed in real life situations.
Quote from: Liviu Lalescu on January 30, 2024, 08:12:26 PMI decided to allow in the official version a weight <100% for the constraints of type activity(ies) begin/end teachers/students day. I made it and seems OK.
Please test and let me know: https://lalescu.ro/liviu/fet/download/test/
Thank you for the suggestion!
THANK YOU very much!!
You are welcome! Please let me know if you tested and works as expected. I intend to release the final version in about a week, so please let me know.
Quote from: maxi_mus on January 31, 2024, 11:32:09 AM[...] Concrete example: I'd like most of Math, German and French lessons to be in the afternoon. [...] I would spend ages adding and removing single activities/constraints with 100% weight. At some point, the time and effort would become so big that there would be no advantage over planning the whole schedule manually.
Well, you probably need ages for this, since you don't know how to do it. I don't need to add/remove every single constraint for this.
I do it similar and for example with my dataset I only need to add 2 single constraints to care about 50% of all German, Mathe and English lessons. The trick is using subactivity constraints :-)
Depending on your dataset you might need between 2 or 12 constraints only to care about ALL that activities. (In my dataset i need to add 12 for all, and my data set has ~1000 hours in total.)
Similar to your other examples. It it can be very easy to care about 100% always just with a few constraints if you know how to do it. It also helps finding bugs and understanding the timetable.
Quote from: maxi_mus on January 31, 2024, 11:32:09 AMI'm not sure I follow you here. The advantage is, that people can go home and shower.
What I am doing is taking real life examples and trying to see if I can implement everything in FET. So all my requirements are real requirements by real teachers in real schools. I am extremely grateful to Liviu for helping me out with tricks and even changing FET to meet my needs. Conversely, I hope that my input has some limited value to you, to show you where FET's features still have limitations that would be needed in real life situations.
I am not a coder in my professional life (even i can code). I am a teacher in professional life. So i am talking about real data sets at my school(s).
Exactly. I understand the shower argument. That is one advantage if you don't have showers in your gym. Or if pupils don't want to use the shower in the gym. Depending on your school the older pupils don't have got a problem with using the shower at school and they will use it and so there is no problem for them.
But there are also many disadvantages like i wrote. There is no "correct" answer for stuff like that. EVERY activity and EVERY constraints has always advantages and disadvantages. You should always think about every advantages and disadvantage. You should always think out of 3 perspectives: The students perspective, the teachers perspective and the schools perspective. In many cases an advantage for one guy, will be an disadvantage for an other guy. So with every constraint and every activity that you add, you should understand why you are doing it. What the disadvantages and what the advantages are.
I always do that if you make timetables. And if you do that it has of course a small disadvantage, since i need to think bit more. But the advantage is, that i understand my timetable better. I can find bugs faster by that, i have less unhappy guys with the timetable and i can explain the very rare unhappy guys why i was forced to give them a "bad" timetable. Why their missing advantage is an advantage for a lot of other guys.
Thanks for the explanation. I'm very aware that every constraint has disadvantages, although I would word that a bit differently - every constrain limits the possibilities for other all other (possible or desired) constraints.
Just a little info on my background, I helped clients set up a tool that does automatic shift planning for a number of years. Setting up hard and soft constraints and prioritizing them was my daily business.
To understand your 'strategy' of how to only use hard constraints, I would probably have to see you work with FET and be able to ask you a bunch of questions, but I don't want to take up any more of your time. But I'm assuming there is good reason why FET also has the possibilities to set soft constraints, and I'd rather work with it using them, at least for the time being ;-)
Yes. The less then 100% time constraint has the advantage that you can try to care about constraints if you don't understand why the fail with 100%. In the final stage a timetable might be so difficult to understand, that you might not understand it.
So if it is "the last" constraint, then it is of course ok if you use them to optimize your timetable some more.
But i saw a lot of guys that do more or less use only constraint with less then 100% and then they wonder that sometimes generating is very slow and they don't understand what they are doing.
Less then 100% is fine, if it is the last constraint. I highly always suggest to use 100% to all other constraints.
Quote from: Liviu Lalescu on January 31, 2024, 12:03:51 PMYou are welcome! Please let me know if you tested and works as expected. I intend to release the final version in about a week, so please let me know.
@maxi_mus , did you see this post? I would really like to hear/confirm your feed-back.
Yes, I saw it. The problem is, I don't work on Windows normally, so I have to get a machine running first. I hope to have time for this this afternoon, otherwise Friday at the latest.
I think me must research in that some more then only with a single data set. We should at least check 2 types of data sets. Data sets with fully loaded students timetable and data sets with not fully loaded students timetable.
Quote from: maxi_mus on January 31, 2024, 01:50:17 PMYes, I saw it. The problem is, I don't work on Windows normally, so I have to get a machine running first. I hope to have time for this this afternoon, otherwise Friday at the latest.
Thank you, sorry!
No, it's for me to say sorry, you have helped me so much, I want to help you in return.
Quote from: Volker Dirr on January 31, 2024, 01:51:56 PMI think me must research in that some more then only with a single data set. We should at least check 2 types of data sets. Data sets with fully loaded students timetable and data sets with not fully loaded students timetable.
I checked with Romania/Pedagogic and with German sample, and seemed perfect. Please check also yourself with other easy files.
My Windows version is too old :-/
Quote from: maxi_mus on January 31, 2024, 02:02:55 PMMy Windows version is too old :-/
I was just on the point of compiling a new snapshot, with minor changes. If you can test, I will compile also a snapshot for Windows 7 and 8.1. Do you need 64bit or 32bit?
It runs Win7 32
OK, I'll put this soon. I need maybe less than an hour (tar.bz2, Win 10 64bit, and Win 7 32bit).
I added it here: https://lalescu.ro/liviu/fet/download/test/
I downloaded it, the schedule generation is running. This might take some time though because it's a really old machine.
Thank you! No hurry.
I am just interested in your opinion, when it finishes, if allowing weights<100% is useful for you and other users.
I don't remember exactly why I disallowed <100% from a long time ago...
I'm not quite sure how you I can tell you if it's useful. If it works, it's useful for sure. But all that I can really do is compare with a previous computed version and see if more of the activities in question are actually at the end of the day...
BTW, for morning afternoon mode, it seems to me that the names of the constraints are ambiguous. For example, 'a set of activities end students day' is clear in original mode, but in MA mode, this means FET days (right?) and not actual days. Would it make sense to rename this stuff so it's not ambiguous? This is perhaps something I cloud help you with.
Right.
In the MA mode, "days" generally means "FET days". Only for min/max days between activities we use min/max days and min/max half days. But I will add your suggestion in the TODO.
I added a new snapshot, with improvements in these begin/end day with <100%; this time I did not add Win 7 32bit, but if you want I can do it.
OK so here is my feedback for the 90% weight for activity ends students days: It works really well as far as I can tell. I saw a number of results where it actually managed to place every single relevant activity at the end of a students day, but also one result where it didn't, which means the 90% is working ;-)
If there's anything else I can help you with, please let me know. I think it would be great if you added this in an official release.
Sorry for my late response BTW, I can't work on Tuesdays and Thursdays currently.
Thank you for the answer!
I hope I'll add this <100% in the official. I hope to release the official with Qt 6.6.2, on 7 February.
No problem.