https://github.com/ribeaud/project-day-distributor
Allocates students to specified courses based on their preferences
https://github.com/ribeaud/project-day-distributor
Last synced: 10 months ago
JSON representation
Allocates students to specified courses based on their preferences
- Host: GitHub
- URL: https://github.com/ribeaud/project-day-distributor
- Owner: ribeaud
- Created: 2018-01-06T15:38:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-05T01:43:53.000Z (about 8 years ago)
- Last Synced: 2025-08-12T18:57:20.418Z (10 months ago)
- Language: Python
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project Day Distributor
Main program is `linear_sum_assignment.py`. It will distribute/dispatch the students according
to their given prioritized list.
## loader.py
There are two kinds of data loader: `CsvLoader` and `DbLoader`. Customize the latter
one to your specific needs to access your database.
The `CsvLoader` reads in two **CSV** files, `courses.txt` and `students.txt`
which MUST have following format:
#### courses.txt
```
id title max_students
0 Course 0 4
1 Course 1 2
2 Course 2 1
...
```
#### students.txt
```
name prioritized_list
Philomène 3,2,0
Phénicia 1,9,0
Tanja 2,4,1
...
```
## writer.py
There are two kinds of data output writer: `ExcelWriter`, `ConsoleWriter`.
`ConsoleWriter` outputs the following:
```
Total cost = 20002
Student 'Student 11' assigned to course 'Course 10' (9). Cost = 0.
Student 'Student 4' assigned to course 'Course 9' (8). Cost = 1.
Student 'Student 8' assigned to course 'Course 9' (8). Cost = 0.
Student 'Philomène' assigned to course 'Course 4' (3). Cost = 0.
...
```
## Environment
With a program argument, you specify in which mode you want to work:
```python
if len(argv) > 1 and argv[1] == 'PROD':
env = Env.PROD
logger = init_logging(env)
loader = DbLoader(logger)
writer = ExcelWriter(logger)
else:
env = Env.DEV
logger = init_logging(env)
loader = CsvLoader(logger)
writer = ConsoleWriter(logger)
```
## Links
- https://developers.google.com/optimization/assignment/simple_assignment
- https://developers.google.com/optimization/assignment/assignment_mip
## Assumptions
- Nothing happens if we do NOT have enough seats available for all the students.
- Students are deeply shuffled after loading. Because the first student gets
his first specified seat.
- Courses providing more seats have a _lower_ cost.