This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
The new Optimization tool has just come out in the Alteryx 10.6 Predictive Release (see Dr Dan's post on prescriptive analytics). With this single tool, we can solve linear programming, mixed integer linear programming and quadratic programming problems. The tool offers 3 input modes (manual input, file input and matrix input) to give you flexibility in defining your model. If you are a baseball fan and Alteryx fan, I have a great news for you! Today I'll show you how to use the Alteryx Optimization tool to solve a fantasy baseball daily lineup problem.
The fantasy baseball daily lineup problem is very straight-forward: given a fixed budget and 6 types of field positions to fill in, how should you draft players based on their projected points, salary and field positions? In other words, we want to
The decision we need to make is: which players to pick.
The tricky part is how to express the objective, constraints and decisions above mathematically.
Let's denote
where, i can be 1, 2, ... 384 (384 is the total number of MLB players in the data set we are going to use in the attached example.) Based on the notations and assume our budget is $25200, the mathematical formulation for the daily fantasy baseball problem is as follows:
Once we have constrcuted the formulation, it is very straight-forward to use the new Optimization tool in Alteryx, since the inputs for Optimization tool are essentially different parts of the formulation.
We first obtain baseball player data from http://www.rotowire.com/daily/mlb/optimizer.htm and load it into Alteryx. Let's take a look the first couple of rows of data:
It is easy to see that only the columns in red circles are relevant to our problem setup. (Note that Pos stands for "position" and Pts is short for "projected points".) Configuring the Optimization tool is simple. Since we will use the baseball player data as input, instead of an industry standard optimization modelling file (e.g CPLEX_LP, MathProg, or MPS format), we will use "matrix input" mode. Because our decision variables (x_{1}, x_{2 }, ..., x_{384}) can only have values 0 or 1, this is a mixed integer programming problem. We use "Symphony" as the solver, due to its overall better performance on mixed integer linear programming over "GLPK".
For Optimization inputs, please see the comments in the attached workflow for details. Thanks to @ramnath and @cfreeman's hard work, the Optimization tool generates an interactive report of which players you should select, and more.
For more details, see Optimization Tool Help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.