An evolutionary computing solution for optimally assigning teaching assistants to course sections while respecting constraints and preferences.
This system assigns 40 TAs across 17 lab sections, minimizing five penalties:
- Overallocation: TAs assigned beyond their maximum workload
- Conflicts: TAs scheduled for overlapping time slots
- Undersupport: Sections with fewer TAs than required
- Unavailable: TAs assigned to sections they marked as unavailable
- Unpreferred: TAs assigned to sections they'd rather not teach
Uses an evolutionary algorithm with four agents that modify solutions:
- Random: Creates completely new random assignments
- Swap: Exchanges two TAs between sections
- Add TA: Adds a TA to an undersupported section
- Remove TA: Removes a TA from a section
The algorithm runs for a set number of iterations (or time limit), periodically removing dominated solutions using Pareto optimality. Solutions that are worse in all objectives than another solution are eliminated.
- TA information: name, max assignments allowed
- Preferences for each section (0-16):
P= PreferredW= WillingU= Unavailable
- Section details: instructor, day/time, location, enrollment, topic
min_ta: Minimum TAs requiredmax_ta: Maximum TAs allowed
python assignta.pyThe algorithm evolves for 100,000 iterations or 5 minutes (whichever comes first), checking for dominated solutions every 100 iterations.
Run the test suite to verify objective functions:
pytest test_assignta.pyTests use three pre-defined solutions (test1.csv, test2.csv, test3.csv) to verify each objective function calculates penalties correctly.
CramptonCheng_summary.csv: CSV of all Pareto-optimal solutions with scores for each objective
Profiler Report: Console output showing function call counts and runtime statistics
Solutions are represented as a list of 17 sets (one per section). Each set contains the TA IDs assigned to that section.
Example:
[{0, 5, 12}, {3, 8}, {1, 4, 9, 15}, ...]This means Section 0 has TAs 0, 5, and 12; Section 1 has TAs 3 and 8, etc.
- pandas
- numpy
- pytest (for testing)
- Custom
evo.pyframework (included) - Custom
profiler.py(included)
The evolutionary framework maintains a population of solutions scored on all five objectives. Pareto dominance determines which solutions to keep: Solution A dominates Solution B if A is better or equal in all objectives and strictly better in at least one. Only non-dominated solutions survive.
Built for DS3500: Advanced Programming with Data