In the most recent simulation results, the total runs scored by all teams added up to 17572. At the time, I wondered if this might be an issue because the actual total in any mlb season is about 20000. I reasoned that the simulation total might not be a concern because: a) it’s a simulation, not a duplication, and b) the only pitchers involved are starters and so fewer runs might be expected given that relievers (presumably inferior to starters, otherwise they’d be starting) were not being used … although 2500 runs did seem like a lot.
However, in trying to move on from simulating a season to asking questions about batting order optimization, I realized that there might be a flaw in the original programming. I reviewed the functions that perform the nine-inning simulations and realized that there was a problem with the logic used to set the leadoff batter and subsequent batters of any next inning. The functions have been changed and I believe they are now performing as they should.
I’ve rerun the season simulation and now the runs total 18695; still short of 20000, but less of a worry … at least for now.
|AL East||NL East|
|AL Central||NL Central|
|AL West||NL West|
Now it’s back to asking questions about actual batting order … which is a slow process because of the 362,880 possible combinations for nine batters. It takes my desktop about 37 hours to analyze all possible combinations for a team. Part of the problem is that there are so many possible combinations, but another issue is that each order must be simulated at least 10,000 times to generate a result that reduces error to a meaningful level. So even at about 25,000 innings per second, it takes a while. I need more power!
I’ve completed a trial run at simulating the optimal batting order for the Tigers. Their current order is projected to be: Kinsler, Davis, Cabrera, VMart, Cespedes, JMart, Castellanos, Avila, Iglesias … but simulation says it should be: Kinsler, Cabrera, Castellanos, VMart, Cespedes, JMart, Davis, Avila, Iglesias. In other words, Davis moves from 2 to 7, Castellanos from 7 to 3, and Cabrera from 3 to 2. Plugging these two lineups into the nine-inning simulation suggests that the new order is about 20 runs better … or about 2 wins.