Skip to main content

A team allocation tool using OR-Tools and parameterized with fire.

Project description

Teamformer

Teamformer builds student teams for you. The primary objective is to form as few teams as needed while ensuring constraints are met and encouraging WAM (weighted average mark/GPA) balance across teams. The system is a wrapper around a CP-SAT solver using Google OR-Tools.

Constraint handling includes:

✅ Each student is assigned to exactly one team

✅ Each team has between min and max students

✅ No team has only one student of a given gender (currently only M/F; other self-reported categories are ignored for balancing, but won't break anything)

✅ The number of teams used is minimized

✅ Students are only assigned to teams in the same lab as them

✅ Deviation from average WAM across the class is penalised

Student preferences are favoured (positive and negative preferences now supported!)

The output is an Excel sheet with students and teams. Team numbers may not be sequential (drawn from 1:max_teams).


Data structure

Teamformer expects data in a spreadsheet like this (fake example):

Student_ID first_name last_name email gender wam lab Prefer_With Prefer_Not_With
0 S1 Mark Johnson ... M 51.1 3 S2, S3 S4
1 S2 Donald Walker ... M 60.0 1
2 S3 Sarah Rhodes ... F 76.6 1 S1 S3
3 S4 Steven Miller ... M 54.2 2
4 S5 Javier Johnson ... M 75.3 4

Columns required/optional:

  • Student_ID
  • gender
  • wam (optional)
  • lab (optional)
  • Prefer_With (optional): comma-separated list of Student_IDs the student wants to work with
  • Prefer_Not_With (optional): comma-separated list of Student_IDs the student prefers not to work with

Install

pip install -e .

Run

team_former --input_file=students.xlsx --sheet_name=0 --output_file=teams.xlsx --wam_weight=0.05 --pos_pref_weight=0.8 --neg_pref_weight=0.8 --min_team_size=3 --max_team_size=5 --max_solve_time=30

How to get a good solution

Depending on your class sizes, demographics, and lab distribution, you may struggle to find a feasible solution. Options to address this include:

  • Increase the max solve time — it may just be a matter of waiting longer
  • Reduce or remove the WAM weight penalty
  • Adjust the minimum team size — sometimes team balance is infeasible
  • Adjust positive or negative preference weights (e.g., set pos_pref_weight=0.5 if you want preferences to have less influence)

Preference handling

When using preference columns, Teamformer will attempt to:

  • Keep students together if listed in Prefer_With, unless it conflicts with other constraints.
  • Avoid assigning students together if listed in Prefer_Not_With.

Preferences are not strictly enforced (they are "soft" constraints), but they strongly influence the solution when weights are set high.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

team_former-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

team_former-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file team_former-1.0.0.tar.gz.

File metadata

  • Download URL: team_former-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for team_former-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d6494b1ba3c735b4a8122250d5f1717e1e7a05ca54ea5f6736f51cf51b9a6764
MD5 13de7cd4de4f2f0a61c0ad65c2929713
BLAKE2b-256 06c8e1c53ba6a29d26883e611d5e3ac92bb495ae26eec440967bc667014e0ee8

See more details on using hashes here.

File details

Details for the file team_former-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: team_former-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for team_former-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28528a2a75e177c9ed82f431b9fbf16585f14eaa8d4196c25338cf1743d4dc0b
MD5 ccc8b8db1fcee94838f000b67bc9a6c7
BLAKE2b-256 76d25118445fe7afcc9cdd8d29fd02d6bbdb2309624b343048e507069417473f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page