Raj
Home/Projects/CoverDrive XI Selector

CoverDrive XI Selector

live

Prescriptive analytics engine for optimal IPL playing XI selection

ETLResearchEngineeringModelingLaunch
Python 3.11+PuLP (CBC solver)FastAPISQLAlchemy 2.0statsmodelsSciPyNumPypandas
Overview

What It Is

The XI Selector is a prescriptive analytics engine that recommends the optimal playing XI for any IPL match. It is prescriptive, not predictive: it models what the optimal selection should be given available information, not what the coach will select. Divergence from actual selections is expected and classified through a formal taxonomy rather than treated as model failure.

This is a standalone subsystem that augments the CoverDrive Cricket platform, deployed independently on Railway with its own FastAPI server.


Architecture

The system executes as a four-layer sequential pipeline:

  1. Impact Vector Assembly: Pulls metrics from the shared Supabase database and assembles role-conditional impact scores for each player in the squad. Incorporates batting and bowling performance metrics, form signals, matchup adjustments, and context multipliers (dew, pitch, rest, availability confidence).

  2. ILP Selection Engine: A binary integer linear programme (PuLP with CBC solver) that selects the optimal 11 from the squad. Hard constraints enforce squad size, overseas caps, bowling coverage, and role minimums. Soft constraints penalize insufficient batting depth or spin coverage at spin-friendly venues.

  3. Synergy and Context Adjustment: Post-ILP refinement via one-swap hill-climbing guided by estimated synergy terms (handedness alternation, partnership familiarity, bowling variety). Context multipliers for dew, pitch conditions, and toss outcome are applied here.

  4. Batting Order MDP: A tabular Q-learning policy over discretized game states recommends batter type at each batting position. The state space covers match phase, wickets down, run-rate gap, and bowling configuration.

Key Features

Data Sources

Shares the CoverDrive Cricket Supabase database: ball-by-ball deliveries, player profiles, match metadata, venue statistics, weather data, roster entries, and impact player events. Additional tables for cross-league data, synergy estimates, and recommendation history are maintained by this subsystem.


Interfaces

  • FastAPI Server: REST endpoints for XI selection, synergy analysis, full pipeline recommendations, and post-toss refresh.
  • CLI: Command-line interface for selection, synergy estimation, and validation runs.
  • Python API: Importable sync and async entry points for integration with the parent CoverDrive Cricket backend.

Current State

Phases 1 through 3 are complete and deployed on Railway. The ILP engine, synergy layer, cross-league ingestion, batting order MDP, validation framework, and FastAPI server are all operational. The system runs on match-frequency scheduling (1-2 times per day during IPL season) with pre-match, post-toss, and refresh workflows.