About the project

Lineup Optimization

A research platform from the Sports Analytics Research Group at Johns Hopkins. It scores a batting order by how hitters work in groups of four, then searches every legal order for the best one.

362,880orders scored

The idea

Hitters work in groups

Most baseball stats evaluate players in isolation.
But baseball isn't played in isolation.

A hitter's value depends on who bats ahead of him. A double with runners on is worth more than the same double with the bases empty. BRP measures a hitter inside the four-batter window that ends with him, so moving a player changes the numbers around him.

The engine

How the search works

Every legal order is scored. Nothing is sampled or guessed.

  1. Step 1

    Blend stats to 600 PA

    Each hitter's line is pulled toward league average, then scaled to 600 plate appearances. Small samples do not dominate.

  2. Step 2

    Score every order with BRP

    All 362,880 orders are scored. Each batting spot gets the BRP of the four-batter window that ends with its hitter.

  3. Step 3

    Weight the top of the order

    Early spots bat more often, so their windows count more. A first-inning term covers the game's first two plate appearances.

  4. Step 4

    Return the top 25

    Rotations of one cycle are grouped into 40,320 distinct cycles. The 25 best are ranked for you.

See the full walkthrough

The site

What you can do here

The builder is the core. The rest of the site uses the same model.

  • Pick up to nine hitters and let the engine search for you.

    • Choose players by season, career or date range.
    • Add constraints, such as fixed spots or lefty runs.
    • Split by pitcher handedness, then review and submit.
  • MLB games, filtered by date and team.

    • A game page shows each team's actual lineup with BRP.
    • Optimize runs the full search on the same nine and shows "Already optimal" or a gain card with the Exp Runs/Cycle delta and extra runs over 162 games.
    • Injury Swap scores bench hitters in a slot.
    • Edit in Lineup Builder opens the real lineup in the builder.
  • Stats

    Sign in

    Season trends built on the same model.

    • Runs per game trends per team, cumulative or rolling 10.
    • Daily Expected Runs scores the lineup each team fielded each game, with LHP/RHP and without-player filters and an expected versus actual trend.
    • Optimizer Snapshot is a leaderboard of all 30 teams.
  • Trade Lab

    Sign in

    Offense only. No defense, contracts or pitching.

    • Find Trades offers Maximum Impact, Mutual Gain and Fair Exchange, with up to 10 suggestions and before and after orders. It uses a fast local search, not the full search.
    • Build a Trade takes any N-for-M and rescores it.
  • Lineup Hub

    Sign in

    Public lineups from other users.

    • Browse by Newest, Popular or Most Viewed.
    • The Leaderboard lists the top 5 MLB-only public lineups by expected runs per cycle.
    • React, comment, and Recommend Changes. Owners accept or reject requests.
  • Saved

    Sign in

    Your saved lineups.

    • Load one back into the builder, or delete it.
  • Games

    No account needed

    Three daily puzzles. Progress is saved on this device.

    • Order Up. Put nine hitters in the optimizer's order in 6 tries. Hints say exact, bats earlier, or bats later.
    • Who's Up. Guess a hidden 2026 hitter in 8 tries, with tiles for Team, Pos, Bats, Slot, AVG, HR and SB.
    • Over/Under. Make 10 calls on whether the next lineup projects over or under the line.
    • A new puzzle every day, and everyone gets the same one.

The team

Credits

Authors
Neil Patel, Shayan Haque, Kiran Shay, Ben Buman, Andy Nguyen, Chenzhuo Li
Mentor
Dr. Dahbura
Affiliation
Sports Analytics Research Group, Johns Hopkins University

Try it on your own lineup

Pick nine hitters and see how much the order matters.