ilpalloc is a Python-based tool designed to automate the allocation of students to final-year projects. By treating the assignment process as an Integer Linear Programming (ILP) problem, it finds the globally optimal distribution of projects based on student preferences while strictly respecting supervisor workload limits.
- Optimal Assignments: Uses the
pulplibrary to maximize overall preference satisfaction. - Supervisor Limits: Ensures no supervisor is assigned more projects than their set capacity.
- Self-Proposed Projects: Automatically detects self-proposed projects (denoted by lowercase letters in the project code).
- Tie-breaking: Adds a slight randomization to the scoring matrix to gracefully handle identical preferences.
Ensure you have Python 3 installed along with the required dependencies. You can install the required packages using pip:
pip install pandas numpy pulp openpyxl(Note: openpyxl is required by pandas to read and write Excel files)
Run the script via the command line, passing the path to your input Excel file:
python ilpalloc.py path_to_excel_file.xlsxIf no file is provided, it defaults to looking for sample_input.xlsx in the current directory.
The input Excel file must contain the following three sheets:
choices: Contains the students and their project choices.- Column 1:
Student No(or similar identifier) - Columns 2+:
Topic ID Choice 1,Topic ID Choice 2, etc.
- Column 1:
limits: Defines the maximum number of students a supervisor can take.- Column
Supervisor: The supervisor's code (leading uppercase letters of a project code, e.g., 'ABC' for project 'ABC01'). Use*to define the default limit. - Column
Max: Integer representing the maximum allocation limit.
- Column
scores: Defines the weight/score given to each preference level (used to optimize the assignments).- Column
Choice: Integer (1, 2, 3...) - Column
Score: Numeric value representing the priority (higher score = better choice).
- Column
- Supervisor Codes: The script assumes the leading uppercase letters of a project code correspond to the supervisor (e.g., project
FN01belongs to supervisorFN). - Self-Proposed Topics: Any project code containing a lowercase letter is flagged as a self-proposed project.
The script will generate a new Excel file named [original_filename]_results.xlsx containing two sheets:
allocations: A list of all students, their assigned project (or "unallocated"), and the preference rank of that assignment.unallocated: A list of projects that were not assigned to any student.
The script will also print useful statistics directly to the terminal, including assignment percentages, the number of self-proposed projects allocated, and per-supervisor loads.