A Streamlit-based application for organizing badminton club night sessions with optimized match generation and skill-based player ratings.
- Smart Match Optimization: Uses Gurobi to solve a multi-objective integer linear program (ILP) that minimizes a weighted combination of:
- Skill spread — difference between the strongest and weakest player on each court (uses tier ratings)
- Team power imbalance — difference in combined ratings between opposing teams (uses real skills)
- Court repetition — penalizes players who frequently share a court to encourage variety
- TrueSkill Through Time Ratings: Player skill tracking with uncertainty-aware ratings that improve over time
- Flexible Game Modes: Support for both singles and doubles matches
- Session Management: Create, pause, resume, and track multiple sessions
- Player Registry: Persistent player database with customizable prior skill estimates
- Organic Gender Balancing: Uses Z-score normalized tier ratings so top females group with top males naturally, without hard-coded penalties
Mathematical Foundations — Detailed write-up of the Bayesian rating model, ILP formulation, and constraint programming backend.
- Frontend: Streamlit
- Optimization: Gurobi
- Database: Supabase
- Rating System: TrueSkill Through Time
-
Install dependencies:
pip install -r requirements.txt
-
Configure Supabase credentials in
.streamlit/secrets.toml:SUPABASE_URL = "your-supabase-url" SUPABASE_KEY = "your-supabase-key"
-
Run the application:
streamlit run 1_Setup.py
- Setup Page: Configure player registry, session parameters, and court count
- Session Page: Run matches, record results, and view standings
├── 1_Setup.py # Main entry point and session setup UI
├── pages/
│ └── 2_Session.py # Active session management UI
├── session_logic.py # Core session and player logic
├── optimizer.py # Match generation optimization
├── rating_service.py # Tier rating and real skill computation
├── database.py # Supabase database operations
├── recalculate_ratings.py # TTT rating recalculation
└── constants.py # Application constants
MIT