Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
1e41a61
1
Parent(s):
42541ad
Enhance lineup optimization in app.py: Added constraint to ensure exactly 9 players are selected in the lineup, improving the accuracy of the optimization function.
Browse files
app.py
CHANGED
|
@@ -141,6 +141,9 @@ def optimize_lineup(player_data):
|
|
| 141 |
|
| 142 |
# Constraint: Salary cap
|
| 143 |
prob += pulp.lpSum([players[row['Player']] * row['Salary'] for idx, row in player_data.iterrows()]) <= 50000
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
# Position constraints
|
| 146 |
qbs = player_data[player_data['Position'] == 'QB']['Player'].tolist()
|
|
|
|
| 141 |
|
| 142 |
# Constraint: Salary cap
|
| 143 |
prob += pulp.lpSum([players[row['Player']] * row['Salary'] for idx, row in player_data.iterrows()]) <= 50000
|
| 144 |
+
|
| 145 |
+
# Constraint: 9 players
|
| 146 |
+
prob += pulp.lpSum([players[row['Player']] for idx, row in player_data.iterrows()]) == 9
|
| 147 |
|
| 148 |
# Position constraints
|
| 149 |
qbs = player_data[player_data['Position'] == 'QB']['Player'].tolist()
|