Question

I'm going to try to explain this the best that I can.

Right now I have a spreadsheet with a list of football players, each of which has an assigned salary and projected point total for the week.

My goal is to use Solver or some other method to determine the best combination of players to maximize the projected point total while staying under a salary cap.

In this example I have 4 separate player lists, like this:

QB: Player A, Player B, Player C...Player N RB: Player a, Player b, Player c...Player N WR: Player X, Player Y, Player Z...Player N TE: Player x, Player y, Player z...Player N

I need the best combination that includes 2 QBs, 2 RBs, 2 WRs, 1 TE, and 2 "Flex", which means any of RB/WR/TE.

I have tried using Solver to maximize the projected point total, but the variable fields in this case would be the Player's Names and it seems like the variable field needs to be a number, not a list of strings.

Any ideas?

Was it helpful?

Solution

My favorite kind of question :)

Here is the model setup:

enter image description here

  • Top table shows the decision variables: = 1 if player i = A, B, ..., N of list L = QB, .., TE is selected, =0 otherwise.
  • Entries in column R, (next to the top table) are the sums of each row. These must be constrained with the numbers in column T. Cell R7 is the total sum of players, which should be 9: 2 flexible and 7 as per the individual list requirements.
  • Middle table shows the salaries (randomly generated between 50,000 and 150,000). The Sum of Salaries formula is =SUMPRODUCT(C11:P14,C3:P6). The idea here is that only the salaries of players that are selected are taken into account. This SUMPRODUCT should be constrained with the budget, which is in cell T14. For my experiment, I put it equal to 80% of the total sum of all salaries.
  • Objective: Bottom table shows the projected points for each player. The formula in cell R22 is =SUMPRODUCT(C19:P22,C3:P6) (same logic as with salaries above). This is the value to be maximized.

Solver Model shown below: enter image description here

I suggest selecting Simplex LP and going to Options and setting the Integer Optimality to zero (0).

Result:

Solver manages to find an optimal solution. The problem is really small and it is very quick. Solver works with up to 200 variables and 100 constraints, for large problems you will need the (commercial) extended version:

enter image description here

Of course, you can just order the real player names so that they fit this setting. For example, if you sort the players of each list alphabetically, then (Player A, QB) = first player of team QB, etc.

I hope this helps! Let me know if you would like me to upload the file for you.

Best, Ioannis

OTHER TIPS

Excel's solver is built on numerical methods. Applying to a domain that consists of discrete values, like strings or football players is probably going to fail. You should consider writing a brute force solver in a "real" programming language, like c#, java, python, ruby, or javascript. If there are performance problems, then optimize from there.

Solver won't work here because it's not a numeric solution you're after.

Make a spreadsheet that has every possible combination of position players (that meet your criteria) on each row. Then make an Excel formula that calculates projected point total based on the players in that row. Sort the spreadsheet by your projected point column.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top