Assigns students to internship companies based on preferences using Answer Set Programming (ASP) with Clingo.
Input:
- Students
- Student preferences (optional)
- Companies with capacities
Goal: Assign every student while maximizing preference satisfaction and respecting constraints.
project/
├── main.py
├── rules.json
├── utils/
├── data/
├── model.lp
└── README.md
- Load data from
/data - Clean & normalize names, generate IDs (
vorname_nachname) - Merge students with preferences
- Generate ASP files (
data.lp,config.lp) - Run Clingo to compute optimal assignment
- Parse results and map back to names
- Export
assignments.csv
Configure assignment behavior without changing code:
{
"min_per_company": 7,
"max_prio": { "Caritas": 2 },
"fill_first": { "Gesobau": 20, "ABB": 10 }
}pip install pandas
Install Clingo: https://potassco.org/clingo/
python main.py
python main.py --timeout 120 --debug
--timeout→ solver time limit (seconds)--debug→ verbose logging
assignments.csv
Vorname,Nachname,company
Florian,Abraham,ABB
...
- All students are assigned (even without preferences)
- Missing preferences =
0 - Rules use fuzzy company name matching
- Python + Pandas
- Clingo (ASP solver)
✔ Modular structure
✔ Configurable rules
✔ Logging & CLI support
✔ Optimal assignment generation