optimization - Constraining on a Minimum of Distinct Values with PuLP -


i've been using pulp library side project (daily fantasy sports) optimize projected value of lineup based on series of constraints.

i've implemented of them, 1 constraint players must come @ least 3 separate teams.

this paper has implementation (page 18, 4.2), i've attached image:

enter image description here

it seems somehow derive indicator variable each team that's 1 if given team has @ least 1 player in lineup, , constrains sum of indicators greater or equal 3.

does know how implemented in pulp?

similar examples helpful.

any assistance super appreciated!

in case define binary variable t sets upper limit of x variables. in python don't name variables single letter have nothing else go on here how in pulp.

assume variables lineups, players, players_by_team , teams set somewhere else

x_index = [i,p in lineups p in players] t_index = [i,t in lineups t in teams]  x = lpvariable.dicts("x", x_index, lowbound=0)  t = lpvariable.dicts("t", t_index, cat=lpbinary) l in teams:    prob += t[i,l] <=lpsum([x[i,k] k in players_by_team[l]]) prob += lpsum([t[i,l] l in teams]) >= 3 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -