max days for an activity from a day selection/min empty days from a day selectio

Started by k3nt0n, September 25, 2025, 07:00:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

k3nt0n

Hello!

Is there a way to work with days flexibly?
For example, I have many constraints like "max days for an activity (teacher/tag) from a day selection"
(In my case, I will tag all activities of a teacher in a building to constrain him to go to the far building only one or two days, but letting the program decide which ones)
And the opposite constraint to assign one or more free days within a specific set of days.
For example, I want the free day not to fall on Monday or Friday.
So
"min empty days from a day selection"
(in my case, a free day, on Tuesday, Wednesday, or Thursday)

Thaks you
Andrea

Liviu Lalescu

Hello, Andrea,

1) Max days for a set of activities (or more advanced, like from a day selection) is not done. It is possible to implement, and I can add this in the list of suggestions if you need, so please let me know if my following solution does not work: could you add a dummy teacher for this set of activities and constrain this teacher's max days per week?

Edit: for 1 day, you could use activities same starting day or max 0 days between activities.

2) To ensure the teacher works on Monday and on Friday, you might add one or two constraints activities occupy min time slots from selection.

k3nt0n

Hi Liviu,
the second suggestion is excellent,
but it doesn't seem to work,
in multiple generations,
with two constraints for a teacher
100% 2 hours Monday + 100% 2 hours Friday
often the day off falls on Monday or Friday anyway

So i swith on the workaround again ...
- activity prefered time from selection (monday and friday) about 40%-60%
that slow down very much the algoritm

Liviu Lalescu

Hello, Andrea,

I think I will try to add a new constraint for your first part: activities occupy max (1 or 2) sets of time slots from selection. I will let you know.

The second part should work, but note that X (red) is selected. You need to select with X (red) Monday/Friday in two constraints. Please try again and let me know.

k3nt0n

It would be great to have a constraint like this.

I don't understand when you say
Quoteactivities occupy max (1 or 2) sets of time slots from selection
You mean a static selection or a quantity of time not referred to a precise slots, that the algoritm can move where is better to place it?
In my mind are specific activities that we want to place all together in one or two days without fix the days.
By now i had to fix a day for the far building and this limit the algoritm freedom to find unvisible solutions (the beauty of NP-Hard problems and PLI)

This new constraint appear to me similar to the "max days per week for a teacher" is not?
Where teacher become activity tag and we can select a subset of the week.


For the second part, you're right; I had inverted the selection.
Would it be difficult replace the X with a ✓ and invert red and green in this kind of selections? (Just for a more intuitive interface, not necessary indeed)

I'm wondering if matematically 2) is the dual of 1)
1) can be: fix some free day and let the others to be accoupied until a bound
2) can be: fix some accoupied day and let the others to be free until a bound
funny

Thanks you Liviu!!

Liviu Lalescu

I am too tired now. I'll read again in the morning your post and try to answer.

What I can say is that I just made activities occupy max sets of time slots from selection. You can select any number of sets of slots, and choose 1 or 2 occupied max (you will choose 1 or 2, from the interface).

Liviu Lalescu

Dear Andrea,

New snapshot, announced here on the forum on the Snapshots board: https://lalescu.ro/liviu/fet/forum/index.php?topic=6618.0 . You can download the snapshot from that post (link).

I made for you this new constraint, and the check mark sign (and different colors).

Please test and let me know.

Thank you!