James McCool commited on
Commit
499c677
·
1 Parent(s): bc59a2a

general optimization changes

Browse files
Files changed (1) hide show
  1. app.py +1 -11
app.py CHANGED
@@ -143,7 +143,7 @@ with tab1:
143
  team_var1 = init_baselines.Team.values.tolist()
144
  lock_var1 = st.multiselect("Are there any players you want to use in all lineups (Lock Button)?", options = init_baselines['Player'].unique(), key='lock_var1')
145
  avoid_var1 = st.multiselect("Are there any players you want to remove from the pool (Drop Button)?", options = init_baselines['Player'].unique(), key='avoid_var1')
146
- linenum_var1 = st.number_input("How many lineups would you like to produce?", min_value = 1, max_value = 300, value = 20, step = 1, key='linenum_var1')
147
  if site_var1 == 'Draftkings':
148
  min_sal1 = st.number_input('Min Salary', min_value = 35000, max_value = 49900, value = 49000, step = 100, key='min_sal1')
149
  max_sal1 = st.number_input('Max Salary', min_value = 35000, max_value = 50000, value = 50000, step = 100, key='max_sal1')
@@ -221,10 +221,6 @@ with tab1:
221
 
222
  if site_var1 == 'Draftkings':
223
 
224
- for flex in flex_file['Team'].unique():
225
- sub_idx = flex_file[(flex_file['Team'] == flex) & (flex_file['Position'] != 'G')].index
226
- total_score += pulp.lpSum([player_vars[idx] for idx in sub_idx]) <= 4
227
-
228
  for flex in flex_file['lock'].unique():
229
  sub_idx = flex_file[flex_file['lock'] == 1].index
230
  total_score += pulp.lpSum([player_vars[idx] for idx in sub_idx]) == len(lock_var1)
@@ -262,10 +258,6 @@ with tab1:
262
  total_score += pulp.lpSum([player_vars[idx] for idx in sub_idx]) >= 2
263
 
264
  elif site_var1 == 'Fanduel':
265
-
266
- for flex in flex_file['Team'].unique():
267
- sub_idx = flex_file[(flex_file['Team'] == flex) & (flex_file['Position'] != 'G')].index
268
- total_score += pulp.lpSum([player_vars[idx] for idx in sub_idx]) <= 4
269
 
270
  for flex in flex_file['lock'].unique():
271
  sub_idx = flex_file[flex_file['lock'] == 1].index
@@ -310,11 +302,9 @@ with tab1:
310
  if contest_var1 == 'Cash':
311
  obj_points = {idx: (flex_file['Proj DK Own%'][idx]) for idx in flex_file.index}
312
  total_score += sum([player_vars[idx]*obj_points[idx] for idx in flex_file.index])
313
- total_score += pulp.lpSum([player_vars[idx]*obj_points[idx] for idx in flex_file.index]) <= max_own - .001
314
  elif contest_var1 != 'Cash':
315
  obj_points = {idx: (flex_file['Median'][idx]) for idx in flex_file.index}
316
  total_score += sum([player_vars[idx]*obj_points[idx] for idx in flex_file.index])
317
- total_score += pulp.lpSum([player_vars[idx]*obj_points[idx] for idx in flex_file.index]) <= max_proj - .01
318
 
319
 
320
  total_score.solve()
 
143
  team_var1 = init_baselines.Team.values.tolist()
144
  lock_var1 = st.multiselect("Are there any players you want to use in all lineups (Lock Button)?", options = init_baselines['Player'].unique(), key='lock_var1')
145
  avoid_var1 = st.multiselect("Are there any players you want to remove from the pool (Drop Button)?", options = init_baselines['Player'].unique(), key='avoid_var1')
146
+ linenum_var1 = st.number_input("How many lineups would you like to produce?", min_value = 1, max_value = 300, value = 1, step = 1, key='linenum_var1')
147
  if site_var1 == 'Draftkings':
148
  min_sal1 = st.number_input('Min Salary', min_value = 35000, max_value = 49900, value = 49000, step = 100, key='min_sal1')
149
  max_sal1 = st.number_input('Max Salary', min_value = 35000, max_value = 50000, value = 50000, step = 100, key='max_sal1')
 
221
 
222
  if site_var1 == 'Draftkings':
223
 
 
 
 
 
224
  for flex in flex_file['lock'].unique():
225
  sub_idx = flex_file[flex_file['lock'] == 1].index
226
  total_score += pulp.lpSum([player_vars[idx] for idx in sub_idx]) == len(lock_var1)
 
258
  total_score += pulp.lpSum([player_vars[idx] for idx in sub_idx]) >= 2
259
 
260
  elif site_var1 == 'Fanduel':
 
 
 
 
261
 
262
  for flex in flex_file['lock'].unique():
263
  sub_idx = flex_file[flex_file['lock'] == 1].index
 
302
  if contest_var1 == 'Cash':
303
  obj_points = {idx: (flex_file['Proj DK Own%'][idx]) for idx in flex_file.index}
304
  total_score += sum([player_vars[idx]*obj_points[idx] for idx in flex_file.index])
 
305
  elif contest_var1 != 'Cash':
306
  obj_points = {idx: (flex_file['Median'][idx]) for idx in flex_file.index}
307
  total_score += sum([player_vars[idx]*obj_points[idx] for idx in flex_file.index])
 
308
 
309
 
310
  total_score.solve()