Closed chris13337 closed 2 years ago
Hey Chris. Yea this is an interesting one I had not considered before. A few questions:
roster_positions_constraint
? Showdown rules don't typically have position constraints so removing those might speed up the code. Though I assume you just replaced this constraint with your new captains constraint.This is also a bit of hack, but there are probably players you know you don't want for Captain or even Vice Captain (the players with very low projected scores - no matter their salary). So you don't necessarily have to replicate those players 3 times, you could just list them at the "P" position.
Another idea is that we could try changing the optimization function from simply trying to get the max fpts_proj
to something that takes into account the player slot. But I think this will actually make the problem non-linear... so maybe forget that.
I'll try to play around with some solutions here in the code but sorry that I don't have anything off the top of my head right now!
Hi zamorarr,
I am trying to use the functions in the package to build a showdown optimizer for a small DFS site I am playing on. For NBA for example you have a Captain (x2) and a vice-captain(x1.5) for the salary and the projection. I tried implementing it into the code by adding a new function to the nba_dk_model which is very similar to the position constraint. I added a "new" position called PC which can contain the values "P", "VC" or "C" and added the constraints for this problem.
The problem I am having is (again with runtime :D) that now every player is 3 times in the file meaning for every player there is an own constraint ensuring he is only played once (unique_id_constraint), this makes the problem apparently a lot more difficult to solve it takes minutes for 100 of lineups.
Do you have an idea of how to make the problem smaller? Contrary to the problem before that, only some players are twice in the file now every player is two / three times in the file, but we know where they are. I tried to implement the unique_id_constraint like this: (for 50 there is just the variable that is the number of players)
model <- add_constraint(model, sum_expr(x[i] + x[i+50] + x[i +100]), i = 1:50) <= 1)
This didn't work. Do you maybe have an idea of how to implement this as a linear problem, and not increasing the runtime too much? Maybe I am thinking in the wrong direction with my solution. I am looking forward to you answer!
Kind regards,
Chris1337