talhavawda / student-lab-sectioning

Student Lab Sectioning with Minimal Perturbation
0 stars 0 forks source link

Timeslots #10

Closed talhavawda closed 2 years ago

talhavawda commented 3 years ago

I've realised (by setting Xml.ShowNames to true in the Config file - this adds the actual times of the sections in the solution.xml file) that the first timeslot is 0 [according to https://www.unitime.org/uct_dataformat_v21.php] (I started with 1 in the Courses.xlsx input file).

The SS Data Format Template lets you specify a slotsPerDay attribute (default is 288 -> 5 mins per slot). I currently have it set to 2 for the 2020-Sem1-CAES-Wvl problem instance but upon looking at the solution.xml file, the lab session allocation time is 5 mins with the first timeslot (allocatedTimeslot=1) being 00:05-00:10 and allocatedTimeslot=2 making the session time be 00:10-00:15. This means that my slotsPerDay isn't being used and that the default is being used.

Maybe its switching to default cos the timeslot values I gave are out of range (as the first timeslot is 0 instead of 1 so range is [0, slotsPerDay-1] but I specified a timeslot value of 2 for many sessions)?

Try changing the timeslots in the input (-1 all) to see if it fixes the issue.

Otherwise will have to specify the timeslots according to the default.

See the following class: org.cpsolver.coursett.Constants.java I arrived at this class in this order:

If we want exact times of the session then in the Courses input file, will have to specify the start time of the session and the length (both in hh:mm format) instead of allocatedTimeslot attribute, and then convert to timeslot value using the Constants class (use time2slot() method)

talhavawda commented 2 years ago

[I created a new problem instance folder (2020-Sem1-CAES-Wvl-fixing-timeslots) based on the current one to test out my fixes]

I changed the timeslots in the Courses.xlsx input file (by -1 to all, such that the first timeslot is 0) but this did not fix the issue. All the session times just went back by 1 timeslot session (5 minutes).

From the org.cpsolver.coursett.Constants class, I've discovered that the SLOTS_PER_DAY and SLOT_LENGTH_MIN are set as constants (i.e. they are fixed) to 288 and 5 respectively. So that is why using my own slotsPerDay attribute in the Input data XML file wasn't working - The slotsPerDay attribute in the Input data XML file isn't being used by the solver as the solver code specifies the SLOTS_PER_DAY and SLOT_LENGTH_MIN as constants. Thus the default values for the number of slots per day (288) and thus the length of each slot (5 minutes) will be used regardless if I specify my own slots per day.

So I need to modify the timeslots according to the default values.


I changed the Courses.xlsx input file of this 2020-Sem1-CAES-Wvl-fixing-timeslots problem instance so that the proper timeslots are reflected in the solution/xml file:

I changed the allocatedTimeslot field to startTime but kept the sessionLength field as is (I also changed allocatedDay to sessionDay, and moved the venueCapacity column to after the sessionLength). Both these fields are now strings instead of integers and both represent 24-hr time values in the following format - hh:mm The sessionLength values are all now 03:00 and the startTime values are either 09:35 or 14:10

I've created a function generateTimeslot() in the InputProcessing.py file and updated the code when Processing the course offerings to call this function on the startTime and sessionLength values and use these new values when setting the attributes in the input data XML file.

It now works - the correct session times are shown in the solution file.

So I've now gone and modified the CoursesInputTemplate.xlsx and the corresponding Courses input file for the current 2020-Sem1-CAES-Wvl problem instance, as well as the 2020-Sem1-CAES-Wvl-OLD problem instance, and generated their new/updated input data XML files.

talhavawda commented 2 years ago

In the documentation / user manual, specify that all times (startTime and sessionLength times) must/should be a multiple of 5 minutes