0

I'm working on a small fantasy football data science project which involves calculating "expected points" of players. I was interested in writing an optimization algorithm to take these values and create the optimal fantasy team. This ends up being a knapsack problem however it has certain constraints which I am not quite sure how to implement. The constraints are that each team must have 2 keepers, 5 defenders, 5 midfielders, and 3 forwards. In addition to this the collection of players must have a price under 100M pounds.

In more general terms, I have a knapsack problem where there are 4 groups of items, where I need exactly 2, 5, 5, and 3 items from each group respectively. How can I write an optimization algorithm to fulfill these constraints?

0 Answers0