FET Forum

FET Support (English) => Get Help => Topic started by: arley on February 28, 2023, 03:55:35 AM

Title: Having a hard time setting up certain constraints
Post by: arley on February 28, 2023, 03:55:35 AM
Hi! I want to preface this by saying that English is not my first language, and that I have Autism Spectrum Disorder. Usually I understand most things written in English, but not all the time. And I have a pretty hard time following directions unless I can understand them very unambiguously. Thank you in advance for your patience!

Reading the FET Manual, I couldn't understand how to set up a particular set of constraints. I'll give a concrete example, as follows. I teach Mathematics to 4 different groups of students. Each group should have 6 periods of Mathematics per week. Preferably, those groups should have at least 2 consecutive periods in any given day, and at most 3 consecutive periods. Ideally, they should have 2 periods in 3 different days, but 3 periods in 2 different days is also good. Having anywhere from 1 period to 4 periods in any given day is acceptable, but should be avoided if possible. Is it possible for me to set this up on FET?
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on February 28, 2023, 05:09:31 AM
Hello and welcome!

Maybe this could work:

1) The activity is divided 2+2+1+1, min 1 days between activities, 0%, consecutive if same day
2) A constraint min 1 days between activities 2+2, 95%
3) A constraint students set/teacher activity tag min 2 hours daily, 95% (add a tag to these activities)
4) A constraint activities same starting day 1+1, 75%.

You can play with these weights.

Not perfect, this does not allow 2+1+1+1+1, and should be tested, I hope I am not mistaking.
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on February 28, 2023, 05:36:04 AM
Notes: (1) is ensuring no more than 2 activities are on the same day (FET algorithm does not allow this if you add a constraint min days between activities), and (3) - activate the constraint from the advanced settings, without worrying.
Title: Re: Having a hard time setting up certain constraints
Post by: arley on February 28, 2023, 07:42:46 PM
Quote from: Liviu Lalescu on February 28, 2023, 05:36:04 AMNotes: (1) is ensuring no more than 2 activities are on the same day (FET algorithm does not allow this if you add a constraint min days between activities), and (3) - activate the constraint from the advanced settings, without worrying.


First of all, thank you very much for the help!

How exactly do I accomplish Step 3? What kind of tag should I add to what? I think I already "unlocked" it in the settings, but I'm not sure what to do now. Would it be a new tag for every subject that has a lot of periods in a week?
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on February 28, 2023, 07:57:02 PM
You are welcome! :)

Yes, I think you need to add a tag for each subject like this (like math), say the tags are "TMath" and "TEnglish" (for subjects math and English, respectively), or any other names you like. Then I think you need to add the constraint activity tag min 2 hours daily for students (not for teachers, as I re-read your first post). I am not sure if the constraint for each involved students set or for all. I think for all students might work. And select "Allow empty days".

I am sorry if you have very many subjects like this, because there are a lot of constraints to add, manually. If you know programming, you might develop a program to write the XML fet file. Its structure is simple. Or I could try to help you with automating these tasks from the FET interface as a customization, but I cannot promise.

You might want to try only on a few activities at the beginning, generating some timetables, to make sure my solution works. You should sometimes obtain 2+2+2 and sometimes (less often) 3+3. So make a preliminary test so that you won't input all the constraints and then we discover I made a mistake in my analysis.
Title: Re: Having a hard time setting up certain constraints
Post by: arley on February 28, 2023, 08:28:22 PM
Quote from: Liviu Lalescu on February 28, 2023, 07:57:02 PMI am sorry if you have very many subjects like this, because there are a lot of constraints to add, manually. If you know programming, you might develop a program to write the XML fet file. Its structure is simple. Or I could try to help you with automating these tasks from the FET interface as a customization, but I cannot promise.


I could code LaTeX/tikz all day long, but my experience with other languages is limited. Still, I thought about doing that, writing a script to generate my fet file! I'll read your documentation in the next month or so to automate this task, but for now I think I'll be adding it manually. Again, thank you very much for the support!! :)
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on February 28, 2023, 08:30:54 PM
You are welcome! I wish you success, and please let me know your results.
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on February 28, 2023, 09:00:17 PM
I have a trick for you, if you want to add categories of weights of constraints, which can be changed easily with a single Find+Replace:

Add a weight like 75.124 (%). This way, if it is too low or too high, you can edit the XML fet file with a text editor and change <Weight_Percentage>75.124</Weight_Percentage> to, say, <Weight_Percentage>90.124</Weight_Percentage>.

So, keep the digits after the decimal dot in different categories: category (2) and (4), say respectively .123 and .124, or other values you like.
Title: Re: Having a hard time setting up certain constraints
Post by: arley on March 01, 2023, 12:03:50 AM
Quote from: Liviu Lalescu on February 28, 2023, 07:57:02 PMYou might want to try only on a few activities at the beginning, generating some timetables, to make sure my solution works. You should sometimes obtain 2+2+2 and sometimes (less often) 3+3. So make a preliminary test so that you won't input all the constraints and then we discover I made a mistake in my analysis.


About that third constraint (the tag one), FET tells me that 100% weight is mandatory. Yet it's still running very fast. Maybe my school is just comparatively small. I don't seem to get any 3+3, only 2+2+2, but that's a good thing.

I'll add the rest of the groups to see what happens, but it's looking really good for now. The groups missing might be less than half of the total, and they don't share many teachers with the groups I've already added, so I don't think the added complexity will make it impossible to run.
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on March 01, 2023, 08:41:37 AM
Oh, I forgot that tag min hours daily is mandatory with 100%... hmm, this will forbid duration 1 on a single day.

But maybe a solution is possible using only 2+2+2 or 3+3 (so, not using activities with duration 1).

Please try on a single activity to check that 3+3 is allowed. If activities are 2+2+1+1 (A1, A2, A3, A4 indexes), force A1 and A3 on a day with a constraint activities same starting day 100%, and the same for A2 and A4. After checking, remove these test constraints.

You could also send me your file to check.
Title: Re: Having a hard time setting up certain constraints
Post by: arley on March 02, 2023, 12:29:05 AM
For now it's all going fine. Sometimes I get 2+2+2 and sometimes I get 3+3. I have another question, but I'm gonna open another thread to keep things organized in this public forum. This specific issue seem to have been resolved.
Title: Re: Having a hard time setting up certain constraints
Post by: Liviu Lalescu on March 02, 2023, 01:20:55 AM
Great!