FET Forum

FET Support (English) => Get Help => Topic started by: zt3 on July 17, 2016, 08:21:06 AM

Title: How to group students with optional course?
Post by: zt3 on July 17, 2016, 08:21:06 AM
In my case, students have both mandatory and optional subjects.
They will choose which subject (choosed by default for mandatory ones) to join on the network.
And several teachers (determined before choosing) will teach the same subject in parallel, therefore the students choosing the same subject have to be splitted into groups.
We start course timetabling after we collcect the results (e.g. how many students choosed xxx course).

But we do not know how to group students so that fet can do timetabling well.
Student A may choose subject B and C. If A is in group B1 and C1, then we have to set the constraint that B1 and C1 cannot take place at the same time. But it is not feasible to set so many contraints manully.
 
Title: Re: How to group students with optional course?
Post by: Volker Dirr on July 17, 2016, 09:31:53 AM
it's depending on how/that they choose.

a) students choose like this:
- please select a religion: jwish, Christian, Moslem, ...
- please select a main subject: French, Technology,  Social sciences, ...
- please select a sport: Football, Soccer, Dance, ...

and in the timetable most religions are at the same time. most main subjects are at the same time. most sports are at the same time. ...
in that case please use the split year automatilcy feature.
please read http://www.timetabling.de/manual/FET-manual.en.html#id_12

b) students choose like this:
- here are (nearly) all subjects: jwish, Christian, Moslem,  French, Technology,  Social sciences, Football, Soccer, Dance, ...
please select X of these subjects. (Nearly) doesn't matter which one; so in "worst case" he choose all religions.
in that case you need to use a FET custom version:
please read http://lalescu.ro/liviu/fet/forum/index.php?topic=1633.0
Title: Re: How to group students with optional course?
Post by: zt3 on July 17, 2016, 03:20:33 PM
Yes, they choose more like the second way.
I followed the link, downloaded the custom version and read the example fet files.
The main idea of the approach is to create a schedule with activities and teachers first, and then schedule the students to the activitys using FET where a real student = a FET activity and a real activity = a FET room.

I still have some questions:
1) It is a two-step approach, so it requires totally two fet files as input. Does FET generate the second file after the first step, or should I make the file manually? If only manually, I would like to make a little program to generate it. Is there and documents for the usage of all tags in a fet file?

2) For any subject (e.g. French), the related activities and teachers are all scheduled in the same timeslot (e.g. 9:00-10:00 Monday French and 10:00-11:00 Friday French) after the first step. But if they are scheduled to different timeslots (e.g. 9:00-10:00 Monday French Teacher T1, 10:00-11:00 Monday French Teacher T2, etc..), it is likely to reduce conflicts due to lack of classrooms. It is a new and much more complicated problem.  Do you have any idea or plan to this problem?

Thank you for your help.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on July 17, 2016, 03:45:31 PM
About (1): If I remember correctly, the mapr custom version works in a single step. Just assign FET activities (which have FET teachers = real teachers) to FET rooms.

I am not sure if jimmyjim needed real rooms. But I think you can have real rooms = additional FET rooms and use some constraints activities same starting times.

To see all tags of a FET XML file, either see function Rules::read in rules.cpp or open example files.

About (2): I am not sure I understand. You just allocate FET activities to FET rooms. A room can hold multiple activities in this FET custom version (as opposed to the official FET).
Title: Re: How to group students with optional course?
Post by: zt3 on July 18, 2016, 07:35:13 AM
(1) OK. I will try build on another computer so that I can run fet (instead of fet-cl) and figure out what the tags for.
(2) Maybe my understanding is wrong. Anyway, let me make an extreme example, say there is only one classroom and two teachers teaching French. So there are two activities (French-T1 and French-T2, both with a separate group of students) that should be scheduled to THE CLASSROOM at DIFFERENT timeslot. My understanding is the custom version would use just one timeslot for the activities of the same subject, and mark the problem unsolvable.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on July 18, 2016, 10:57:55 AM
(2) If I remember correctly, you can define two FET activities French-T1 and French-T2 (A1 and A2), constrain them to FET rooms S1 and S2 (which are real students). Then two activities A3 and A4 (A3 same starting time with A1 and A4 with A2). A3 and A4 have no teachers or students, and go to room R (real room).
Title: Re: How to group students with optional course?
Post by: zt3 on July 31, 2016, 01:58:19 PM
I think I have got the idea, after I play around the custom version with the example input file, under your help. For question (2), my understanding is wrong. I can have two activities, and set ConstraintActivitiesSameStartingHour to false for them.
I have a new question regarding to fet file:
There is a "Activities_List" part in fet file, where each "Activity" may have a "Activity_Group_Id" tag.
And there is also a "Equivalent_Activities_List" part, where equivalent activites are listed.
I really want to know the difference between activity_group and equivalent_activities, and when to use one over the other.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on July 31, 2016, 04:16:00 PM
Quote from: zt3 on July 31, 2016, 01:58:19 PM
I think I have got the idea, after I play around the custom version with the example input file, under your help. For question (2), my understanding is wrong. I can have two activities, and set ConstraintActivitiesSameStartingHour to false for them.
I have a new question regarding to fet file:
There is a "Activities_List" part in fet file, where each "Activity" may have a "Activity_Group_Id" tag.
And there is also a "Equivalent_Activities_List" part, where equivalent activites are listed.
I really want to know the difference between activity_group and equivalent_activities, and when to use one over the other.

It is hard for me to remember exactly what I did there. I searched the mapr version. Did you read the Help->Help for mapr version from the Menu?

Activity_Group_Id lists activities from the same component. Equivalent_Activities_Item lists which activities are interchangeable, to make the generation faster. If the activities have exactly the same teacher, etc., then you should add them to the Equivalent_Activities_Item.

There is also an Activity_Equivalence_Class in the activities list, but I think this has to do with skipping infeasible activities.

Please let me know.
Title: Re: How to group students with optional course?
Post by: zt3 on August 01, 2016, 03:30:58 AM
I read some of the help, and then I found in fet file there is a "ConstraintActivitiesSameStartingHour" part which I think is the key to my problem.

For one subject (e.g. French), there are two teachers (e.g. T1 and T2), students can join either activity (French-T1 or French-T2), but not both. In this case, I think the two activities have different Activity_Group_Id and I should add the two activities to the Equivalent_Activities_Item. Am I right?
Title: Re: How to group students with optional course?
Post by: zt3 on August 01, 2016, 03:56:26 AM
Also here comes a requirement that I hope to meet. In my initial post, I mentioned that the students might choose which optional subject to join in. So each student has a vector [1, 0, 1, 0, ..., 1], the length is the number of subjects, and 1 means the student choose that subject, 0 otherwise.

What I want to achieve is that assign students with the most similar/closest vector to the same activities. For activities of one subject, I can group the closest students by K-means. I wonder if there is any constraint that I can use to assign students to specific activities.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 01, 2016, 10:58:03 AM
Quote from: zt3 on August 01, 2016, 03:30:58 AM
I read some of the help, and then I found in fet file there is a "ConstraintActivitiesSameStartingHour" part which I think is the key to my problem.

For one subject (e.g. French), there are two teachers (e.g. T1 and T2), students can join either activity (French-T1 or French-T2), but not both. In this case, I think the two activities have different Activity_Group_Id and I should add the two activities to the Equivalent_Activities_Item. Am I right?

Same starting hour was specially for jimmyjim. I don't know if you need it. It does not mean same starting time. Same starting hour means the activities may be in other days.

I think you are right for the second paragraph.

Quote from: zt3 on August 01, 2016, 03:56:26 AM
Also here comes a requirement that I hope to meet. In my initial post, I mentioned that the students might choose which optional subject to join in. So each student has a vector [1, 0, 1, 0, ..., 1], the length is the number of subjects, and 1 means the student choose that subject, 0 otherwise.

What I want to achieve is that assign students with the most similar/closest vector to the same activities. For activities of one subject, I can group the closest students by K-means. I wonder if there is any constraint that I can use to assign students to specific activities.

I do not understand these words.

I am sorry, but this custom version mapr was developed a very long time ago and getting accustomed again with it would mean much time. There are very many "hidden" features which I forgot. I cannot dedicate myself to free support for this.

If I'll find some time, I'll try to have a look again at the mapr custom version.

I am not sure if the constraint activities occupy max time slots from selection was done in mapr already. If yes, it might help to have a similar timetable for some students (read the help of the constraint).
Title: Re: How to group students with optional course?
Post by: zt3 on August 01, 2016, 02:11:19 PM
Yes, I understand, thank you very much for your help and support.

My state of the requirement is really bad for your understanding. I just want to do students course planning by collecting the students who choose the same subjects into the same activities. For example, both students S1 and S2 choose subjects A, B, C, D, and each subject has several activities, say A-T1, A-T2, ..., B-T1, ... , D-Tn. I hope S1 and S2 should join the same four activities, say A-Ti, B-Tj, C-Tk, D-Tm, rather than S1 joins four activities and S2 joins another four activities.

In my last post, I use the vector to cluster the students. So I can get which group of students should join the same activities, but I don't know which constraints for FET to assign one student to specific activities.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 01, 2016, 07:25:43 PM
It is difficult for me to understand without seeing the exact input file. But you might want to use constraint activities use max 1 different rooms. So some activities go into the same FET "room".
Title: Re: How to group students with optional course?
Post by: zt3 on August 02, 2016, 03:23:09 PM
Ok, I will try to play around first.
But you just reminded me

Quote from: Liviu Lalescu on July 17, 2016, 03:45:31 PM
About (1): If I remember correctly, the mapr custom version works in a single step. Just assign FET activities (which have FET teachers = real teachers) to FET rooms.

I am not sure if jimmyjim needed real rooms. But I think you can have real rooms = additional FET rooms and use some constraints activities same starting times.

To see all tags of a FET XML file, either see function Rules::read in rules.cpp or open example files.

About (2): I am not sure I understand. You just allocate FET activities to FET rooms. A room can hold multiple activities in this FET custom version (as opposed to the official FET).


The custom version does not need real rooms. So the result coursetables just show "when" to take "which" activity, but no "where".
I do not know how to "have real rooms = additional FET rooms and use some constraints activities same starting times".
Would you state it with more detail?

Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 02, 2016, 03:28:26 PM
Quote from: zt3 on August 02, 2016, 03:23:09 PM
The custom version does not need real rooms. So the result coursetables just show "when" to take "which" activity, but no "where".
I do not know how to "have real rooms = additional FET rooms and use some constraints activities same starting times".
Would you state it with more detail?

Add some rooms as courses and other rooms as real rooms. In the rooms list, add both, maybe with names to differentiate, like courses start with "C" and real rooms with "R". Then add some activities to be placed in "R" rooms and maybe constrain them to be at the same time as the courses activities.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 02, 2016, 03:30:37 PM
Please see also the topic: http://lalescu.ro/liviu/fet/forum/index.php?topic=1155.msg6555#msg6555 (which might be unsuccessful, though).

Title: Re: How to group students with optional course?
Post by: zt3 on August 03, 2016, 03:14:22 AM
Quote from: Liviu Lalescu on August 02, 2016, 03:28:26 PM

Add some rooms as courses and other rooms as real rooms. In the rooms list, add both, maybe with names to differentiate, like courses start with "C" and real rooms with "R". Then add some activities to be placed in "R" rooms and maybe constrain them to be at the same time as the courses activities.

I am a little confused. The activities are all preferred being placed in "C" rooms now. When "R" rooms are added, a activity should be placed both in a "C" room and "R" room. How to make the constraints? 
To make it clear, I just modified the example fet of the custom version as an example:
1. removed most of the students and just kept two;
2. removed most of the teachers, and make two teachers teach the same subject 151-Biology;
3. removed all the other activities and constraints that are not related to the kept students and teachers.
4. add a real room to the Rooms_List (line 429)

I do not know what to do next. Could you show me how to make it with the example file please? Thanks.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 03, 2016, 10:28:53 AM
OK, it's good that you made a small file (which I needed to correct). I was able to make a real room. See the attached. See the same starting time constraints.

Note: I think you don't need the same starting hour constraints. jimmyjim needed these.
Title: Re: How to group students with optional course?
Post by: zt3 on August 04, 2016, 05:15:52 AM
Thank you for your corrections.
Now I see the trick. :)

You add a ConstraintSubjectPreferredRoom at the end of fet file:
<ConstraintSubjectPreferredRoom>
   <Weight_Percentage>100</Weight_Percentage>
   <Subject>151-Biology-Real Room</Subject>
   <Room>Real Room 1</Room>
   <Active>true</Active>
   <Comments></Comments>
</ConstraintSubjectPreferredRoom>

In reality, there are many real rooms that are suitable for many subjects/activities.
Therefore I should add ConstraintSubjectPreferredRoom like this:
<ConstraintSubjectPreferredRooms>
   <Weight_Percentage>100</Weight_Percentage>
   <Subject>151-Biology-Real Room</Subject>
   <Number_of_Preferred_Rooms>20</Number_of_Preferred_Rooms>
   <Preferred_Room>Real Room 1</Preferred_Room>
   <Preferred_Room>Real Room 2</Preferred_Room>
        ......
   <Active>true</Active>
   <Comments></Comments>
</ConstraintSubjectPreferredRooms>
<ConstraintSubjectPreferredRooms>
   <Weight_Percentage>100</Weight_Percentage>
   <Subject>255-Life Science-Real Room</Subject>
   <Number_of_Preferred_Rooms>20</Number_of_Preferred_Rooms>
   <Preferred_Room>Real Room 1</Preferred_Room>
   <Preferred_Room>Real Room 2</Preferred_Room>
        ......
   <Active>true</Active>
   <Comments></Comments>
</ConstraintSubjectPreferredRooms>

Am I right?

Would some (of 5) 151-Biology-Real Room activities take place in Real Room 1, while some in Real Room 2?
(by the way, this is acceptable. In fact, sometimes this is preferred in my school)
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 04, 2016, 06:43:34 AM
Quote from: zt3 on August 04, 2016, 05:15:52 AM
Am I right?

Would some (of 5) 151-Biology-Real Room activities take place in Real Room 1, while some in Real Room 2?
(by the way, this is acceptable. In fact, sometimes this is preferred in my school)

I think the answer is yes.

If you would like all (5) activities in the same room (which you don't want), you could use constraint activities occupy max 1 different rooms.
Title: Re: How to group students with optional course?
Post by: zt3 on August 04, 2016, 01:26:04 PM
OK, I see.

If I do not use constraint activities occupy max 1 different rooms (I mean no "ConstraintActivitiesOccupyMaxDifferentRooms" tags at all), would they occupy many rooms by default?

Meanwhile, I think I should not use "ConstraintRoomMaxOccupiedSlots" on Real Rooms (see your corrected-file at line 806), since I do not know which activities will take place in which real rooms.

Can I use "ConstraintSubjectPreferredRooms" (with 's' at the end) tag instead of "ConstraintSubjectPreferredRoom" when there is only one preferred room?

I also wonder what is the usage of Activity_Group_Id, since it is not fully used in the example fet file.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 04, 2016, 01:41:05 PM
Quote from: zt3 on August 04, 2016, 01:26:04 PM
OK, I see.
If I do not use constraint activities occupy max 1 different rooms (I mean no "ConstraintActivitiesOccupyMaxDifferentRooms" tags at all), would they occupy many rooms by default?


Yes.

Quote

I also wonder what is the usage of Activity_Group_Id, since it is not fully used in the example fet file.

It has the same role as in the official FET, to group activities when you add activities split into more components per week. You can go without them, but when it is logical to have them, it is better to have them. Add in a file two activities and an activity split into two and see the difference.

Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 04, 2016, 02:06:21 PM
Quote from: zt3 on August 04, 2016, 01:26:04 PM
Meanwhile, I think I should not use "ConstraintRoomMaxOccupiedSlots" on Real Rooms (see your corrected-file at line 806), since I do not know which activities will take place in which real rooms.

Yes, indeed, I forgot.

PS: Sometimes (like this time) it is better to post a new reply instead of modifying the old one, or send me a PM to re-read the post.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 04, 2016, 02:23:39 PM
Quote from: zt3 on August 04, 2016, 01:26:04 PM
Can I use "ConstraintSubjectPreferredRooms" (with 's' at the end) tag instead of "ConstraintSubjectPreferredRoom" when there is only one preferred room?

Unfortunately, this is possible only from FET-5.24.0 upwards, so you cannot in FET-5.22.0-mapr.
Title: Re: How to group students with optional course?
Post by: zt3 on August 05, 2016, 04:09:54 AM
Yes, I should post a new reply.

Quote from: Liviu Lalescu on August 04, 2016, 02:23:39 PM
Quote from: zt3 on August 04, 2016, 01:26:04 PM
Can I use "ConstraintSubjectPreferredRooms" (with 's' at the end) tag instead of "ConstraintSubjectPreferredRoom" when there is only one preferred room?

Unfortunately, this is possible only from FET-5.24.0 upwards, so you cannot in FET-5.22.0-mapr.


Sad to hear that. :(
Do you use any version systems (like git)?
I think it is good for managing all the versions, and maybe I can help you to upgrade mapr version.
I really like FET, and I hope I can make some contribution.   

By the way, what about "ConstraintMinDaysBetweenActivities" or "ConstraintActivitiesOccupyMaxDifferentRooms"? Can I still add such a contraint when the "Number_of_Activities" inside is 1?

Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 05, 2016, 07:29:31 AM
Quote from: zt3 on August 05, 2016, 04:09:54 AM
Do you use any version systems (like git)?
I think it is good for managing all the versions, and maybe I can help you to upgrade mapr version.
I really like FET, and I hope I can make some contribution.   


No, I don't use, I don't know it.

Quote

By the way, what about "ConstraintMinDaysBetweenActivities" or "ConstraintActivitiesOccupyMaxDifferentRooms"? Can I still add such a contraint when the "Number_of_Activities" inside is 1?

You can add min days and max different rooms to any set of activities, but it has to be more than 1 activity.
Title: Re: How to group students with optional course?
Post by: zt3 on August 05, 2016, 11:15:41 AM
Quote from: Liviu Lalescu on August 05, 2016, 07:29:31 AM

No, I don't use, I don't know it.


Well, just a suggestion.

Quote from: Liviu Lalescu on August 05, 2016, 07:29:31 AM

You can add min days and max different rooms to any set of activities, but it has to be more than 1 activity.


Yes, I created a fet file, and the software just reports the "1 actiivity" error. :)
I solved it. But it then reports another error with my fet file (attached):
Quote
Cannot generate timetable, because for activity with id==10446 you have no allowed preferred room (from preferred room(s) constraints). This means that a constraint preferred room(s) has 0 rooms in it. This should not happen. Please report possible bug.
I checked the fet file.
Activity 10446 is related to Subject "Political_2".
So I searched this subject, and find at line 500:
<ConstraintSubjectPreferredRooms>
<Weight_Percentage>100</Weight_Percentage>
<Subject>Political_2</Subject>
<Number_of_Preferred_Rooms>2</Number_of_Preferred_Rooms>
<Preferred_Room>Political_2-T1</Preferred_Room>
<Preferred_Room>Political_2-T2</Preferred_Room>
<Active>true</Active>
</ConstraintSubjectPreferredRooms>

It has the preferred rooms.
I can not figure out how to solve the problem.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 05, 2016, 11:28:51 AM
About the repository thing: I am so sorry. I appreciate your good intentions, but I do not know how to use repository. And I prefer to be in full control. The contributions are to be supervised by me.

To update mapr to the latest FET would be a titanic job.

About your file: the preferred rooms and the next constraints, preferred room (which by the way is duplicated) - they are impossible. The rooms for this subject is the intersection of all the rooms, which is void. You might want to add another subject, like I did in the provided file above (it is a fake subject, check that carefully).
Title: Re: How to group students with optional course?
Post by: zt3 on August 05, 2016, 11:43:16 AM
About the repository thing:
Yes, I really like FET. Without repository commits history, it is a difficult job to update mapr.
You can use github (http://github.com), and you can still supervise all the pull requests (someone who wants to contribute some code).
I think the benefit is huge.
Anyway, it is up to you. :)
And I will try my best to make contribution.

About my fet file:
Once I posted it, I realized maybe I made a mistake.
And yes, you are right. I solved it. Thanks.
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on August 07, 2016, 11:27:24 AM
Thank you for your kind words!

I added a new custom version, with a minor change, which permits to solve zt3's files. Please see the Custom page of the FET homepage ( http://lalescu.ro/liviu/fet/custom.html ).
Title: Re: How to group students with optional course?
Post by: Liviu Lalescu on March 25, 2018, 06:56:09 PM
I added a new version, minor updates.