SPA-Code
This is the code used in the paper ‘A Simulated Annealing approach to the student-project allocation problem’ by Abigail H. Chown, Christopher J. Cook and Nigel B. Wilding
The C program available at https://github.com/abichown/SPA-Code performs simulated annealing for the student-project allocation problem as described in the main text of the paper ‘A Simulated Annealing approach to the student-project allocation problem’. It takes as input spreadsheet data in the form of two comma separated values (CSV) files. This is because often it is useful for the course manager to collect preferences using one of the multitude of online survey tools which can output data in CSV form. One of these two input files contains the information on the student preferences for projects (see Student Example file), and the other provides information regarding the constraints on supervisor workload (see Supervisor Example file). In the preferences file, each student (or student pair) is represented by a column and each project by a row. For each student the projects that they have chosen are given an entry of 1 to 4 corresponding to their preferences. Other cells in the row are left blank. In the supervisor constraints file, each row represents a project, but this time each column represents a supervisor. If supervisor i submitted project j, the cell will contain a finite value between 0 and 1, representing how much “workload” the project will take (this can vary depending eg. on the nature of the project or whether there are co-supervisors). A feasible solution allows a supervisor to take up to unit workload. For example, a supervisor could supervise two projects with workload 0.5 or one project of 0.5 and one of 0.25. However, they could not supervise three projects of workload 0.5.
The program produces a running report on the value of the objective function, allowing one to monitor how the quality of the allocation improves as the `temperature' is reduced. At the end of the annealing schedule, the final allocation is output to a CSV file in the form of (project index, allocated student, their rank choice).
Our code uses pseudo random numbers generated by a separate subroutine (see ranvec.c file). This takes a random seed based on the system time. For efficiency we generate a large number of pseudo-random numbers and store them in an array from which we draw them as required. Once all are used up we replenish the array.
Usage
The main variables are entered at compile time. In the Program.c
file set the following variables:
char fileName1[]
: The csv file for the students listchar fileName2[]
: The csv file for the supervisors listint rows
: The number of rows infileName1
int cols
: The number of columns infileName1
#define cols
: Same as above.int numLec
: The number of columns infileName2
From the root directory run the make file:
make
And run
./spa.out
Results appear in finalConfig.txt
.