max gaps between a set of activities?

Started by pnlshd, July 23, 2023, 06:40:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pnlshd

I need a set of activities to be all in the same day and also consecutive.

I managed to make them in the same day by using max days between activities set to zero, but it is still not consecutive.

You may find an activity in the first hour and the rest starting from the 3rd hour for example.

All of these type of activities that I want both consecutive and in the same day have the same subject and teacher too if this is useful.

Grouping can achieve this but it doesn't work for more than 3 activities and I may need more. Also grouping is not as universal of a constraint like a max gaps between activities constraint concept for example.

Thank you.


Liviu Lalescu

Hello,

A better usage is if you use same starting day instead of max days between. It optimizes better the initial order. But it is not very important.

I think I need to implement this constraint, it is useful. I am thinking of: ConstraintMaxHoursSpanBetweenActivities (or Hourly instead of Hours?). Do you have a better name suggestion?

So, if you have activities with durations 2,1,1 you need to add max hourly span = 4, and also same starting day and possibly activities not overlapping (if they don't have common teachers/students).

Will you help me testing it, if I make it?

Thank you for the suggestion!

Liviu Lalescu

#2
I think a nice name might be ConstraintActivitiesMaxHourlySpan.

I need to ask you something first, though: do you know about the constraint students teacher max span per day? Can't you use it?

Volker Dirr

He wrote always same subject and teacher. So i guess he has different students.

But maybe it is always in the same room and you can just use something like "max room changes" for the teacher?

Liviu Lalescu

I made a small mistake. It should be teacher max span per day, not students. But am not sure it can be applied.

I don't like the solution with rooms changes.

pnlshd

#5
Hello,

Thank you for your reply.

Thanks for suggesting Activities Have Same Starting Day constraint instead of max days between activities, I believe it is more straightforward and will make timetable generation faster.

Regarding Activities Max Hourly Span, this is exactly what I need!

I will definitely help you test it on real data and get back to you with the results.

I will have to set it to the number of activities each teacher has in each subject (maybe using some automation from my side to do it for all subjects and teachers)

I have just noticed that this will solve another problem I had solved before using activities occupy max time slots from selection constraint where I would select all of the available slots for all the activities of each subject and limit it to the max number any teacher has so to maximize overlapping and finish earlier this day for the subject (a requirement).

Using the new constraint I will set the same value for it on all of the subject activities for each subject (no dummy select all available slots here) and also apply it again for the activities of each subject for each teacher to achieve consecutiveness.

I have already used max room changes = 0 for the teacher and it doesn't help. He may have an activity with subject A and then another one with subject B then A again in the same room while I want As to be consecutive and Bs too if they happen to be in the same day for this teacher.

If they are in different days then each subject activities will be consecutive already because teachers have no gaps.

Quick Edit: I have just noticed your suggestion of teacher max span per day and I think it can work as a good temporary solution if I apply it to all teachers each with a different value representing the max number of activities he has for any subject.

This way I may guarantee that each subject will be in a separate day and thus consecutive.

Thank you for that too!

Liviu Lalescu

#6
Hello!

You are welcome!

I just looked in the code. Same starting day or max 0 days between activities will show the same behavior while sorting for the initial order or generating; only when removing redundant constraints is better. So it is not an important thing.

The new ConstraintActivitiesMaxHourlySpan will be certainly quite complicated to implement, but I am willing to do it. So please let me know if the temporary solution using teacher max span per day is not perfectly useful; if it is not and the new constraint type is necessary, I will begin working right now.

You are certainly an advanced FET user :) You can tell me more details, if you want, and I am interested in your input file(s) (here or by email).

pnlshd

Hello!

This is a nice compliment from the maker of this genius program :)

Thank you for all of your efforts!

Okay I will keep using max days between activities then if there is not much difference.

Teacher max span per day is a good temporary solution but the only drawback is some optimization for some teachers and I will give an example.

If a teacher teaches 3 subjects in say 10 activities. Sub A has 5 activities, Sub B has 3, Sub C has 2 activities.

If the day has 7 slots then it is possible that in a day he has 5 A and 2 C in the same day NOT ORDERED. So maybe 2 As and 2 Cs then 3 As.

With a max teacher span of the maximum number of activities he has for any subject which equals 5 here because subject A has 5, it is ensured that subject A will have its own day and all of its activities will be consecutive.

But there is a chance that in another day he has the activities of both B and C and it will not be guaranteed that Bs are consecutive and Cs are consecutive. This is the problem of using this constraint to satisfy the requirement and that is why I would need an activities max hourly span constraint here to act as a universal solution for this problem.

If you need the input file for testing I would gladly send it directly to you after I make some modifications.

Please let me know when you are done with it so I can test it myself too.

Thank you!


Liviu Lalescu

:) Thank you also for the compliment!

You can keep max days for the present, but for the future files you may consider same starting day. As I told you, it removes better the redundant constraints of type min days between activities in that advanced option (I am not sure you used it).

I am interested in your file(s), to see your data and constraints and also to test the new constraint. I will also make my own files to test. Also, after I hopefully implement the new constraint, I would like to see your updated file, which uses the new constraint type.

I will write here as soon as I have something. From my past experience and judging the request, I assume I might be ready in 1-2 days with something functional.

What operating system version do you use? For instance, do I need to compile for Windows 10 64 bit for you to test a snapshot? Or you can use the sources?

pnlshd

Thanks 😊

I don't use min days between constraints but I will definitely take your advice and use same starting day in the future.

Okay I will make my modifications and send you the input file.

I will be waiting to update it with the new constraint and send it too.

I prefer to use it compiled for windows 10/11 ×64.

All the best!

Liviu Lalescu


Liviu Lalescu

#11
Hello again,

It seems that I am ready with the engine part (most important and a bit difficult). Now I have a bit of tedious job of adding it in the interface and testing, but I hope in a few hours I'll be ready. I'll let you know.

If everything is OK, I hope to release a new version in a few days.

pnlshd

Hello,

That is very good to hear! Great job!

I have also sent you my input file privately.

Can't wait to try it.

Liviu Lalescu

The coding is ready and seems to work :)

But I want to test more thoroughly, translate the new fields, and then I need to compile for Windows for you. I think in an hour or maximum two I should be ready with a snapshot.

I won't use your file, it is too difficult. And anyway you'll check the new constraint on it. Only after you add the new constraint in your file I will be again interested in it.

pnlshd

That is great news 🥳

I will be waiting for the snapshot.

Yeah my file is a bit complicated, I think it would be a good challenge for the new constraint :)