min activities in a building

Started by Benahmed Abdelkrim, February 28, 2026, 11:14:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Benahmed Abdelkrim

#45
QuoteBut why should each building have at least one activity?
A brief explanation:
If you've seen, each building represents a real room, and each real room can accommodate two teachers (in other cases more than 2). To avoid having a building without any teachers, each building (real room) is required to have at least one activity.
B.A/krim

Benahmed Abdelkrim

#46
In the example attached above, we have 19 real rooms and 18 available time slots, so the number of so-called "real" activities is calculated by the following operation:
19×18=342 activities;

This number of so-called "real" activities must first be calculated and assigned to a set of teachers who teach the subject called "sub1" in order to guarantee that each real room (building) has at least one activity.
These "real" activities take place in the real rooms: R1, R2, R3, ...,R19

The total number of activities is calculated using the following formula:
each teacher is assumed to work 6 half-days/week, there are 2 available time slots/ half-day, and 40 teachers, therefore:
 the total number of activities = 6 × 2 × 40 = 480 activities

The pseudo activities are easily calculated using the following operation:
480 - 342 = 138 pseudo activities.

These pseudo-activities are assigned to a set of teachers who teach the subject, called "sub2", and take place in the pseudo rooms: r1, r2, r3, ..., r19.
B.A/krim

Liviu Lalescu

Hmm... Benahmed, I think I understand. But this way you are kind of doing the timetable manually. You are restricting the teachers and choosing the building for them, instead of letting FET do that.

I think the slow min one hour per building is better, because it has liberty. It is slow, indeed, but it cannot be improved.

Benahmed Abdelkrim

#48
The speed has slowed down, It became a matter of hours! That's why I thought of this trick to optimize generation time and make it shorter. In a few seconds, sometimes 1 or 2 minutes, you can get a solution instead of waiting for tiring hours...

Yes, perhaps a manual solution as you described; letting the program freely choose the building is better, but sometimes we're impatient and should do things ourselves instead of letting the program do it, and guide it towards a faster solution...
B.A/krim

Liviu Lalescu

But, Banahmed, why can't you use a constraint activities min n_buildings simultaneous in selected time slots?

Benahmed Abdelkrim

Quote from: Liviu Lalescu on March 13, 2026, 08:59:47 AMBut, Banahmed, why can't you use a constraint activities min n_buildings simultaneous in selected time slots?

I didn't understand?
B.A/krim

Liviu Lalescu

A constraint activities min simultaneous in selected time slots (min simultaneous activities from a set in selected time slots). Min simultaneous = number of buildings, selected activities = all activities, selected slots = all without breaks, not allowed empty slots.

Benahmed Abdelkrim

#52
Quote from: Liviu Lalescu on March 13, 2026, 09:31:24 AMA constraint activities min simultaneous in selected time slots (min simultaneous activities from a set in selected time slots). Min simultaneous = number of buildings, selected activities = all activities, selected slots = all without breaks, not allowed empty slots.

I use this constraint, as you have seen in the attached files above, but it alone does not guarantee that each building receives at least one activity.

You can see the example illustrated in the attached file below...
B.A/krim

Liviu Lalescu

I'll see a bit later. I'll try to think of a solution.

Liviu Lalescu

I'm trying to think of the best approach to your problem, Benahmed.

Liviu Lalescu

I have an idea to improve the new constraint buildings min one activity. I'll let you know. It is a bit complicated.

Benahmed Abdelkrim

Quote from: Liviu Lalescu on March 13, 2026, 11:40:48 AMI have an idea to improve the new constraint buildings min one activity. I'll let you know. It is a bit complicated.

Good News! I wish you success!
B.A/krim

Liviu Lalescu

Dear Benahmed,

It was difficult, but maybe I obtained a good speedup. Please check the new version, fet-7.8.0-nsrt2: https://lalescu.ro/liviu/fet/download/custom/nsrt/

Please let me know!

Benahmed Abdelkrim

B.A/krim

Liviu Lalescu