Scheduling classes can be difficult given limited room availability and various schedule conflicts and constraints. I made a tool for our department to schedule classes for the upcoming semester; others may use it, too. Our hope is that this helps achieve the overall names of balancing room use and student preferences while making sure that instructors have schedules that work for them.

Its input is an Excel file (.xlsx format) with columns for instructor names, various times, and more (preferences for each instructor are in a row). This is most easily created with a Google form, then exported. This is then parsed by a program (written in R) to compute multiple possible schedules. These schedules are ranked and the best ones saved to an Excel file again, with one sheet per potential schedule.

“Best” is complex. This first pass tries to minimize the number of schedule changes from last spring while still hitting the university’s criteria for prime time courses. However, there are other measures built in that can be used. EEB did a survey of students to assess their preferences for times outside the “prime” class times of 9 am - 2 pm. Students were asked: “I would want to enroll in a class offered at this time” for each time; possible answers were Strongly disagree, Disagree, Neutral, Agree, or Strongly agree. Average scores for each time could range from -2 to 2. The form for instructors has time options of Not possible, Unwelcome but feasible, Feasible, Preferred, and Ideal. Possible schedules are scored by the percentage of classes that had positive student responses in that schedule as well as by the percentage of classes that had instructors with a “Preferred” or “Ideal” time option. There are other criteria, too: is there a schedule that has fewer class time conflicts, can instructors avoid unwelcome assignments, are classes well distributed between MWF and TR, etc. The output spreadsheet has the raw scores for many measures, and schedulers should use these and human judgements: the “best” schedule from this program might be terrible albeit feasible.

Getting started: Google Forms approach

The interactive scheduler is here. The source code for it is here.

The easiest way to use this program is to copy our Google form. Go to this link:

https://docs.google.com/forms/d/1UU4TIdmgG4GtcIsk2JUITbsDhutyUkZS_MXbXsQy4PA/copy

and it will ask you to copy it to your Google account. In the form edit window, click the Responses tab and click the green spreadsheet icon to create a spreadsheet. You can download the spreadsheet as a .xlsx file as people fill it in and run it in the interactive scheduler tool. Do not change any of the time fields – the exact wording must be correct for the scheduling software to work. It’d be possible to make this more flexible, but this was all written on Sept. 24-25 to get it working quickly, and so it doesn’t have all the features one might want.

Getting started: Excel file approach

Alternatively, you can download this Excel file and fill it in yourself. There are example data you can delete. Do not change any of the time headings. The only valid entries in the cells are exactly Not possible, Unwelcome but feasible, Feasible, Preferred, and Ideal.

Running: online

There is an R shiny app here that runs the scheduling program. It’s a bit slow, but it’s easy to use. It will ask you to upload the XLSX file downloaded from Google Forms or created in Excel. When you first load the schedule, it will pause for perhaps a minute while it starts creating schedules – this is normal. There are then parameters you can adjust. When done, click the ‘Download sample schedules’ button to download a spreadsheet with the best schedules. Each time you change a parameter, it will re-run the program and update the spreadsheets.

Running: R

Download or fork the repo. You will need to change the sheet_code in line 9 of _targets.R to point to your data (a Google Sheets URL from Google Forms). Or, you can use an Excel file (downloaded or written) and pull that into the workflow: uncomment line 10 of _targets.R, comment out line 9, and make sure line 10 points to your input file location.

You will need the packages in _packages.R installed to run the program.

Once configured, from within the top level directory, open R, and then source("run.R"). It will create a spreadsheet with the best schedules. You can change where this goes by editing line 15 of _targets.R.

Getting help

This was made part time over two days to handle an unexpected need to reschedule classes in EEB. It’s being shared with others in the hope it helps, but it could have many bugs or other problems. We’re not really offering a lot of tech support with this, but if you have any questions, please contact Brian O’Meara.