Students (set) / teacher(s) max single gaps in selected time slots

Started by yush, July 03, 2025, 09:23:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yush

I am using this constraint but seems that it is not working. I want to use it to avoid two consecutive gaps, so, I added a dummy activity called "Free". With this constraint on, we should not see this:

Subject A
Free
- gap -
Subject B

But I am seeing it.

Try the attached file. Stop it when it hit 604 or 612. Check the timetable for student 2C-1 (for 604) or 2B-1 for (612). You will see the scenario above, which should not be possible.

The constraint is set under "A set of students", for 2A-1, 2B-1 and 2C-1.

Am I setting up wrong? Or is it a bug?

Liviu Lalescu

Yush, I don't understand more things:

1) This is another topic than your constraint, max single gaps in selected time slots.
2) The timetable for 2C-1 is full. Why can't you use max 0 gaps per week?
3) The incomplete timetable for 2C-1 may contain gaps, because there are 3 more activities-hours to be placed (149 versus 152).

yush

Quote from: Liviu Lalescu on July 03, 2025, 10:35:29 AMYush, I don't understand more things:

1) This is another topic than your constraint, max single gaps in selected time slots.
2) The timetable for 2C-1 is full. Why can't you use max 0 gaps per week?
3) The incomplete timetable for 2C-1 may contain gaps, because there are 3 more activities-hours to be placed (149 versus 152).


3) This makes me understand why it isn't working for me.
2) Yes, when it is completed, it would be all filled. However, I am hoping to use this as a trick to avoid a certain configuration. In particular, I don't want FET to ever allow this to happen:

Subject A
- Gap -
Subject B

In other words, ALWAYS place activities next to each other. This is not actually want I need, but I am simplifying a very complicated need into the essential. So, I was hoping that this no-gap constaint is honored at all time, not just when the student set is finished.

Why? The long story is, as I am working on this very difficult timetable that I have (I have a solution now. But me being me, I am studying it to see how I can optimize it), I realize that the bulk of the problem is a certain layout will eventually lead to impossible situations toward the end. In this case, if there are too many gaps, or if the gaps is not placed just in the right way, there will not be enough slots for the last few activities.

In theory, FET should be able to move things around until enough slots are freed up. Unfortunately, I find that if the early activities are placed with gaps, these gaps are very difficult to be removed as those early activities are "buried" so deep with other activities, hundreds of activities deep.

So, my strategy is to give it structure, hence, you see me adding all those "preferred starting time" to make sure that activities are not placed in slots that is anything less than optimal. The improvement is drastic. With my added constraints, I get good result (though never full result, at in 1100/1137) about 50% of the time, as opposed to 2% of the time in the past. My theory is, since the default is random placement, it tends to "spread". However, with my timetable, I needed so many things to happen at the same time, I need everthing to be optimally "packed", not spreaded.

Hope the long story makes sense.




yush

For example, in the afternoon, I have 9 slots/hours (15 real minutes per slot). If it place a 3 + 5, the 1 hour would be wasted, leading the not enough open slot for the last activity. For that 9 hours, 3+3+3 is ok. 4+5 is ok. 4+4 is sometimes ok, but 3 + 5 is definitely not ok, so I want to avoid that.

Can't think of other ways to avoid that.

Liviu Lalescu

I like your style, Yush! You want to go to the root of the problem and ensure optimum behavior.

It is possible to make a custom constraint with what you need: respecting the no gaps even for a partial timetable. I will help you with this. It will be, at least for now, a custom version, not official FET, and I will think of the feasibility of adding it to the official FET.

Let me know if you need it.

yush

Quote from: Liviu Lalescu on July 03, 2025, 11:15:01 AMI like your style, Yush! You want to go to the root of the problem and ensure optimum behavior.

It is possible to make a custom constraint with what you need: respecting the no gaps even for a partial timetable. I will help you with this. It will be, at least for now, a custom version, not official FET, and I will think of the feasibility of adding it to the official FET.

Let me know if you need it.


Yes, if it doesn't impact the performance too much. I suppose checking it everytime an activity is placed as opposed to just at the end is a big different.

Also, I will have to re-learn how to compile things on my Mac. Last time I did it was over 10 years ago! Getting older makes me I am less confidence about learning or re-learning new things!

Liviu Lalescu

The speed of checking the constraint is the same. Instead of:

n_hours_placed + n_gaps <= n_activity_hours_for_subgroup

I will check that

n_gaps <= 0

at the current step, or something like that, I will see more precisely in the code.

For what constraints? Students (set) max single gaps in selected time slots?

yush

Yes, "Students (set) max single gaps in selected time slots?" would work.

Liviu Lalescu


yush

Quote from: Liviu Lalescu on July 03, 2025, 11:34:07 AMOK, I will try now and let you know soon.


Thanks! Downloading and installing Qt for Mac and Xcode!

Liviu Lalescu

I am sure Darren would like to help us if you run into a problem.

yush

Quote from: Liviu Lalescu on July 03, 2025, 11:52:58 AMI am sure Darren would like to help us if you run into a problem.


I think I will need his help. Downloading Qt, it says it's going take over 1 day to finish the download!

Liviu Lalescu

Might get much better in a few minutes. Try again a bit later.

yush


Liviu Lalescu

Code ready. A bit over 6 minutes to get a timetable for you, in 8 threads. OK?

I will now put the custom version.