Generate random assignments of workers to tasks and balance each worker's load
Project description
Equitable random assignment
Suppose you are a member of a committee charged with reviewing many applications. How do you randomly assign committee members to applications as equitably as possible?
In this talk, we define what equitable random assignment means, explain why it's desirable, and propose an algorithm to solve the problem. More generally, the problem is to randomly assign a combination of workers to tasks such that each worker has the same load, and each task is equally likely to have any combination of workers. We have incorporated equitable random assignment in our department's hiring process to improve equity, which was the original motivation for this work. We conclude with a demonstration of our freely available open source software implementation, which is ready for public use.
keywords: equity, diversity, algorithm, software, randomization, workload
Installation
TODO: Upload to Pypi, figure out how to install on a fresh machine.
Usage
Options:
tasksnumber of tasks (required)workersnumber of workers, default to 2pertasknumber of workers per task, default to 1viewtypewhether you want worker view (0), task view (1), or directory (2), defualt to worker view (0)seedinteger to seed the random number generator, ensuring the same outputallworkerscsv file where ouput will be printeddirnamethis will make a directory and the csv files of the directory will be the tasks that each individual worker needs to complete
Viewtype:
This provides the user with the option of storing their output in either worker view or taskview.
Worker view has the first entry of each line as which worker, from 1 to the value of workers, and is followed by the tasks that that worker needs to do.
Task view has the first entry of each line as which task, from 1 to the value of tasks, and is followed by the workers that correspond to that task.
Directory creates a directory with csv files for each worker that contain the tasks that the worker needs to complete.
The simplest way is to use it is from the command line. Here we assign 11 tasks to 5 workers, with 3 workers per task, which means that some workers will have more tasks than others since there is not a perfectly equitable assignment. We use 2022 as the random seed, but it can be any integer.
Task view:
once we have it on pi py
python3 -m equiassign.equiassign --tasks 11 --workers 5 --pertask 3 --viewtype 1 --seed 2022 --allworkers assignments.csv
this is if you run it locally
python3 equiassign.py --tasks 11 --workers 5 --pertask 3 --viewtype 1 --seed 2022 --allworkers assignments.csv
The result saves a random assignment of workers to tasks to assignments.csv
task,worker1,worker2,worker3
1,2,3,4
2,1,3,5
3,2,4,5
4,1,4,5
5,1,3,5
6,1,2,3
7,1,2,4
8,2,3,5
9,1,2,4
10,2,3,4
11,1,4,5
This output means that the first task is assigned to workers 1,2, and 3, the second task is assigned to workers 1,3, and 5, and the last (11th) task is assigned to workers 1,4, and 5.
Worker view:
once we have it on pi py
python3 -m equiassign --tasks 11 --workers 5 --pertask 3 --viewtype 0 --seed 2022 --allworkers assignments.csv
this is if you run it locally
python3 equiassign.py --tasks 11 --workers 5 --pertask 3 --viewtype 0 --seed 2022 --allworkers assignments.csv
The result saves a random assignment of workers to tasks to assignments.csv
worker,task1,task2,task3,task4,task5,task6,task7
1,2,4,5,6,7,9,11
2,1,3,6,7,8,9,10
3,1,2,5,6,8,10,
4,1,3,4,7,9,10,11
5,2,3,4,5,8,11,
This output means that the first worker is assigned to tasks 2,4,5,6,7,9,and 11, the second worker is assigned to tasks 1,3,6,7,8,9, and 10 , and the last worker (5th) is assigned to tasks 2,3,4,5,8, and 11. Note that it was not possible to give every worker an equal number of tasks thus some have more than others.
Directory:
once we have it on pi py
python3 -m equiassign --tasks 11 --workers 5 --pertask 3 --viewtype 2 --seed 2022 --dirname assignments
this is if you run it locally
python3 equiassign.py --tasks 11 --workers 5 --pertask 3 --viewtype 2 --seed 2022 --dirname assignments
The directory assignments with 5 files corresponding to each worker. Every file contains the tasks that the worker would need to do.
Below is an example of what one of the files would appear as.
assignments/worker1
2
4
5
6
7
9
11
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file equitable_assign-22.8.0.tar.gz.
File metadata
- Download URL: equitable_assign-22.8.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b4a383e09f54c3d4b8aa5df969bc519e28f51571cf9003c4518f2e10e6f6d4c
|
|
| MD5 |
5a02e149250361536165808a185720ec
|
|
| BLAKE2b-256 |
dd155ff2da902a62085c656eda16e2275f182913d9487ebb0343b33ed47d262d
|
File details
Details for the file equitable_assign-22.8.0-py3-none-any.whl.
File metadata
- Download URL: equitable_assign-22.8.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9dde6bfeaeef5fa07e8bec242281ce6eb5fff00538562127c50f0b7390151be
|
|
| MD5 |
70954645ac3c38f9da029bd8b7d7dcaa
|
|
| BLAKE2b-256 |
538bea2812461a34c9128ac07141ed427ff93dd8f6d60fde360d2093bbd42c0c
|