2
$\begingroup$

This question relates directly to a dataset I've generated for Fantasy Premier League, but I'm also curious how I can apply this to a more general case.

Data

I have a list of premier league players, and for each player p I have calculated a predicted score s for that player over a period of time.

Each player inherently has a type t, ranging from 1-4, and a team m ranging from 1-20. Each player also has an inherent cost c.

Constraints

I can construct a team of consisting of 15 of these players. I am constrained by the number of players I can choose from each type t and team m such that, the team must have:

  • 2 players of type t=1
  • 5 players of type t=2
  • 5 players of type t=3
  • 3 players of type t=4
  • no more than 3 players from any one team m
  • a total cost sum(m) <= some budget value B

Problem

How can I create a team which maximises the sum of predicted scores sum(s) such that all constraints have been met. The brute force approach of generating every allowed team is not viable.

$\endgroup$

1 Answer 1

5
$\begingroup$

What about the following model:

Let $P$ be the set of players. Each player $p$ has a type $t_p$, expected score $s_p$, team $m_p$ and cost $c_p$.

Let $x_p$ be a binary decision variable equal to 1 if $p$ is chosen for the team, $0$ otherwise.

The constraints are:

  • Must choose 15 players - note that in this case this constraint is redundant and can be omitted, as it's implied by the 4 constraints after it: $$\sum_{p \in P} x_p = 15$$
  • 2 players of type $t = 1$: $$\sum_{p \in P: t_p = 1} x_p = 2$$
  • 5 players of type $t = 2$: $$\sum_{p \in P: t_p = 2} x_p = 5$$
  • 5 players of type $t = 3$: $$\sum_{p \in P: t_p = 3} x_p = 5$$
  • 3 players of type $t = 4$: $$\sum_{p \in P: t_p = 4} x_p = 3$$
  • no more than 3 players from any one team $m$: $$ \sum_{p \in P: m_p = i} x_p \leq 3 ; \forall i = 1, \ldots, 20 $$
  • Total cost below budget value $B$: $$\sum_{p \in P} c_p x_p \leq B$$

Finally, the objective function of maximixing sum of predicted scores will be $$\sum_{p \in P} s_p x_p. $$

There are several alternatives to implement and solve this model, such as:

  • An AML such as AMPL or GAMS connected to a mathematical programming solver
  • Via integer programming or constraint programming modules through programming languages like Python.
  • Reading the sets and parameters in a spreadsheet and solve using the tools like Excel's Solver (if model size and complexity allow for it).
$\endgroup$
1
  • $\begingroup$ @RobPratt Thanks for pointing that out, answer edited to reflect this. $\endgroup$
    – dhasson
    Commented Nov 27, 2020 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.