Max days between activities

Started by ChicagoPianoTuner, May 05, 2015, 01:14:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ChicagoPianoTuner

I have a question about the use of "Max days between activities."  Does this only work for subactivities?  Here's the problem I'm trying to solve:

I have a 10-day week.  I have an activity that meets 6 times in those 10 days.  I have used "a subactivity has a set of preferred starting times" to ensure that 3 meetings are in the first 5 days of the week and 3 are in the second 5 days.  My 10 days are Monday1, Tuesday 1,...Friday1, Monday 2,..., Friday 2.

With my current constraints, it is possible for subactivities to be placed on Monday 1, Tuesday 1, Wednesday 1, Wednesday 2, Thursday 2, Friday 2.  I want to stop this from happening in such a way that no more than 3 days go by without an activity meeting.

Is it possible to solve this problem using max days between activities?  If so, how?

Thanks!

Volker Dirr

i think you must choose 3 of the 6 subactivities and (also) add a min n day = 3, weight 100% constraint. (so keep the min n day = 1 with all 6 subactivities.)

ChicagoPianoTuner

Hmm, okay, I understand.  Is there a clever way to do this for many activities at once?  Or do I have to do it individually for all activities?

Volker Dirr

Many at once... hmmm... depending on your current dataset, you might try this (even it is a bit different from your suggestion):
I guess you want to do that for all "main" subjects like English, Math, ...

fet->data-> activities -> a set of subactivities has prefferd starting times
select a subject and add:
for component number 1: allow only Mon1 and Tue1
for component number 2: allow only Thu1 and Fri2
for component number 3: allow only Tue2 and Wen2 (and maybe Thu2)

So overall you need to add only (number of subjects) * 3 constraints.

Liviu Lalescu

Quote from: ChicagoPianoTuner on May 05, 2015, 01:14:27 PM
With my current constraints, it is possible for subactivities to be placed on Monday 1, Tuesday 1, Wednesday 1, Wednesday 2, Thursday 2, Friday 2.  I want to stop this from happening in such a way that no more than 3 days go by without an activity meeting.

I think I have a nice idea: consider (sub)activities in order as they appear throughout the week: A1, A2, ..., A6. Then add max days between activities A1 and A2, max 4 days between activities, then for A2 and A3, ..., for A5 and A6 (5 constraints). But you have to add them by hand (or by a script to generate the XML .fet input file or partial code).

ChicagoPianoTuner

Quote from: Liviu Lalescu on May 05, 2015, 02:21:02 PM
I think I have a nice idea: consider (sub)activities in order as they appear throughout the week: A1, A2, ..., A6. Then add max days between activities A1 and A2, max 4 days between activities, then for A2 and A3, ..., for A5 and A6 (5 constraints). But you have to add them by hand (or by a script to generate the XML .fet input file or partial code).

I thought about something like this, but will FET always put A1 before A2 in terms of which day of the week it is on?

Liviu Lalescu

#6
Quote from: ChicagoPianoTuner on May 05, 2015, 02:29:05 PM
I thought about something like this, but will FET always put A1 before A2 in terms of which day of the week it is on?

Sorry, I forgot. You need to add also 5 constraints two activities ordered (first A1, second A2; first A2, second A3, ..., first A5, second A6).


ChicagoPianoTuner

I was thinking about this, and I think I have a solution.  If I have A1, A2, and A3 scheduled for the first week, and A4, A5, and A6 scheduled for the second week (all using a set of subactivities have a set of preferred starting times), would I be able to force A3 and A4 to be consecutive and set a max days between = 3?  That avoids having A1/Mon1 A2/Tue1 A3/Wed1 A4/Wed2 A5/Thur2 A6/Fri2.  But it does not address the equally bad possibility of having A1/Wed1 A2/Thur1 A3/Fri1 A4/Mon2 A5/Tue2 A6/Wed2.  To solve that problem, I was thinking set min days between A1 and A6 to be 6 (or maybe even 7) days.  Do you think that would work?

Liviu Lalescu

I guess you need to add 5 "two activities ordered" constraints, for A1, A2; A2, A3; ..., A5, A6, then the max days, as you say, then yes, it might work a min days. It might not be the best in terms of optimization of the algorithm, but it might work well in practice.

Not optimum, because the generation might place A2, A3, A4, A5, then A1, then it sees that A6 cannot be placed and needs to remove some previously placed activities. But it might not be a noticeable problem in practice and the algorithm might work very well.

ChicagoPianoTuner

Ah, I understand.  The problem in this specific instance is that A1 has a duration of 2, while all other activities have a duration of 1, so I don't necessarily want to specify that the student begins the week with the double lesson.  So maybe just include constraints for A2:A3, A3:A4, etc?  And just leave A1 free to float about as needed?

Liviu Lalescu

#10
Quote from: ChicagoPianoTuner on May 11, 2015, 02:48:33 PM
The problem in this specific instance is that A1 has a duration of 2, while all other activities have a duration of 1, so I don't necessarily want to specify that the student begins the week with the double lesson.  So maybe just include constraints for A2:A3, A3:A4, etc?  And just leave A1 free to float about as needed?

This situation is tricky. In this case, you can add min 6 days between A2 and A6 (not between A1 and A6), but some good positions might be rejected. You need to think carefully to your problem, but it seems to me a perfect solution using just tricks with the official FET might not be possible.

Hey, I might have a very nice solution (but it involves more work to add the constraints and data): add a fake more hour to each day, not allowed to usual activities, and the only possibility to place 4 fake (sub)activities (A7,A8,A9,A10), each with duration 1. Then, each of these 4 (sub)activities is in a different day than A1..A6 (add a single min days between activities, 100%, min 1 day, A1..A10). And now the nice part: two constraints activities occupy max 3 time slots from selection, A7..A10; first one, slots Thu1-fake hour, Fri1-fake hour, Mon2-fake hour, Tue2-fake hour; second one: Mon1-fake hour, Tue1-fake hour, Thu2-fake hour, Fri2-fake hour. This is also efficient for the FET algorithm.

Please let me know.

ChicagoPianoTuner

Quote from: Liviu Lalescu on May 11, 2015, 04:09:05 PM
And now the nice part: two constraints activities occupy max 3 time slots from selection, A7..A10; first one, slots Thu1, Fri1, Mon2, Tue2; second one: Mon1, Tue1, Thu2, Fri2. This is also efficient for the FET algorithm.

I was with you until this part.  Can you explain in a bit more detail please?

Liviu Lalescu

#12
First constraint activities occupy max time slots from selection: activities A7, A8, A9, A10, occupy max 3 time slots, selected time slots = Thu1-special_hour, Fri1-special_hour, Mon2-special_hour, Tue2-special_hour (4 selected slots, marked with X). This makes A7-A10 impossible to be placed all four on exactly Thu1, Fri1, Mon2, Tue2. The other constraint is similar.

Please let me know.

Liviu Lalescu

#13
I forgot: you need to make the dummy activities A7..A10 not overlapping, by adding the same dummy teacher (or students set) to them or by a constraint activities not overlapping.