1

I am trying to formulate a maximization problem using Google's OR-Tools package. The basis of the optimization is a Fantasy MLB Auction draft.

The problem involves the following constraints:

1) Salary Cap of $260

2) 23 total players

2a) At least 1: Catcher, First Baseman, Second Baseman, Third Baseman, Shortstop

2b) At least 2: Starting Pitchers, Relief Pitchers, Utility Players (any batter)

2c) At least 3: Outfielders, Pitchers (any pitcher)

2d) Exactly 6: Bench players (any pitcher or any batter)

My Fantasy MLB league is composed of 6 batting categories and 6 pitching categories. Ideally, I am looking to maximize a lineup that maximizes each of these statistical categories while respecting the aforementioned constraints. My approach is very similar to this NBA Optimizer.

Similarly to the NBA Optimizer example, I've organized player projections/values for each of the 12 statistical categories for the upcoming season.

Then I pass all of those statistics into Google's OR-Tools package:

solver.Maximize(
    CatcherHomeRuns + FirstBasemanHomeRuns + SecondBasemenHomeRuns...
    StartingPitcherStrikeouts + ReliefPitcherStrikeouts...)

The solver.Maximize function is a huge block containing all the player position types and their associated metrics.

My primary concern right now is that I've formulated this objective function incorrectly (perhaps, based on the constraints of the problem). My intuition is telling me that I ought to be providing coefficients or weights in the solver.Maximize objective function for each of the parts to "balance" the function so that each of the 12 statistical categories is individually maximized.

I'm happy to clarify further on my approach but would be grateful for any feedback on how I am going about formulating my objective function.

T.S.
  • 1,009
  • 2
  • 11
  • 24
  • This problem needs some work to be well specified. As a first cut, like you mention, you need to normalize the variables, home runs and strike outs cannot be added directly. You need to scale them. One possible scaling is home runs/maximum individual home runs, and so on for each variable. Let me know if this helps you progress – skr Mar 04 '19 at 05:03
  • Thank you. I did go ahead and normalize the values and I think that actually helped out a lot in having the objective function maximize each of the variables (statistics) I put in. Do you have other ideas on how I could specify the problem better? – T.S. Mar 04 '19 at 18:49
  • I think the problem right now is 'complete', in that you can feed it into a solver and get results. Your objective is, I guess, to win the fantasy league. I am not sure now the MLB fantasy league is scored. But does the objective as it stands now relate to your winning the fantasy league. Do you get points for only 'CatcherHomeRuns + FirstBasemanHomeRuns + SecondBasemenHomeRuns etc' or are there other factors which determine whether you win the league or not? – skr Mar 04 '19 at 20:01
  • The objective is to select the players w/ the best projections in the stat categories in my league (runs, rbi, hr, obp, slg, sb | qs, whip, era, k9, ip, svhld) w/in salary & position constraints. I map the batters to the batting stats and the pitchers to the pitching stats. I set position constraints & have estimated salaries. In fact, salaries could use some optimization. The cost of a player has large implications on the optimal solution. I cannot estimate these perfectly. Should I set the salaries artificially high or low? How are optimization problems designed when values are unknown? – T.S. Mar 04 '19 at 20:53
  • "How are optimization problems designed when values are unknown" - well ideally people would use stochastic optimization methods where you assume a distribution on the cost parameters. Seems a bit of an overkill for your problem. I think estimated salaries are a fine approach for now. Once you get a solution, you can then recompute the best case/worst case salary expenditure of that solution by trying out different salary numbers. – skr Mar 05 '19 at 04:58
  • Is there an "easy" way to incorporate stochastic optimization into my constraint problem. I understand what you're saying about being overkill, but it actually makes a big difference. If I set the values too high, the constraint algorithm may not select a player because his cost is too high, but if I set it too low, it might suggest a lineup that isn't truly feasible. I do update the salaries as the players are being bid on in real-time to try and account for an individual's cost, but if the other players are not the right value then the overall lineup is not optimal. Any suggestions? – T.S. Mar 05 '19 at 20:48

0 Answers0