Skip to content
This repository was archived by the owner on Aug 23, 2026. It is now read-only.

OR‐Tools Integration

Nishanth S edited this page May 8, 2026 · 1 revision

Google OR-Tools CP-SAT Integration

What Is Used

Teambuilder uses Google OR-Tools CP-SAT as the optimization engine for team generation.

Primary code paths:

How It Is Used

Teambuilder uses OR-Tools to solve the student-to-project assignment problem as a constraint optimization task:

  • The TypeScript wrapper serializes student and project data to JSON.
  • The Python solver loads the JSON and builds a CP-SAT model.
  • Decision variables represent student-to-project assignments.
  • Hard constraints enforce feasibility.
  • The objective function rewards preferred choices and other soft goals.
  • The solution is returned to TypeScript and displayed in the UI.

Relevant API action:

  • POST /api/teams/generate

Why It Exists

The solver is used because team generation has many competing constraints:

  • Each student must be assigned to exactly one team.
  • Team sizes must stay within bounds.
  • Meeting day rules must be respected.
  • Preferences, returning students, skill matches, and diversity should all influence the result.

CP-SAT gives the team a practical way to produce high-quality assignments while balancing these constraints.

What Teambuilder Needs From OR-Tools

  • A CP-SAT solver capable of mixed hard and soft constraints
  • Objective maximization over student preference scores
  • Support for team size limits and optional overflow handling
  • Fast enough runtime for a typical semester roster

Pages Involved

Data Dependencies

  • Student choices from the database.
  • Project records and meeting-day availability.
  • Semester selection.
  • Algorithm configuration values from the Generate Teams page.

Notes

  • OR-Tools runs as a Python subprocess invoked from Node.js.
  • The integration is local and does not require a remote service.
  • This is a third-party library integration, not a hosted SaaS integration.

Clone this wiki locally