Published

Coaching Headaches

How being the player-coach of coed softball league inspired a linear programming web app.

Sports AnalyticsPythonLinear ProgrammingPuLPOptimization

This blog post belongs to a four-part series: Softball Pulp

  1. Coaching Headaches (this page)
  2. Formalizing the Lineup Problem
  3. Solving the Lineup Problem
  4. Building the Web App

The Problem

The last couple of years, I’ve been playing in a coed recreational softball league in Chicago. There are about 20 people on the team, and each week we have to decide on a batting order and fielding positions. The league has specific rules about how many men and women must be on the field at all times, and we want to make sure our friends get equal playing time.

Figuring this out manually and sharing the details was a headache, so I decided to automate and optimize the creation of our lineup and fielding assignments using linear programming. The constraints are the league rules, along with some equal playing time preferences. The objective function tries to maximize win probability.

Note: This is more of an academic exercise than anything. The optimization output is useful, but you’ll have more fun with your friends if you just show up and play!

The Aspiration

TODO