Weights of constraints and relative priorities

Started by maxi_mus, January 19, 2024, 03:53:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Liviu Lalescu

Yes, indeed, add a break in the last hours of all the afternoons.

maxi_mus

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.

Liviu Lalescu

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. :)

maxi_mus

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 :-(

Liviu Lalescu

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.

Volker Dirr

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%.

maxi_mus

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.

maxi_mus

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?

Volker Dirr

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.

maxi_mus

#24
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.

maxi_mus

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%.

Volker Dirr

#26
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?

Liviu Lalescu

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!

maxi_mus

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.

maxi_mus

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!!