I'm using R's lpsolve library to optimise my fantasy football team. I must pick 15 players and I am optimising for the number of points I predict each player to get in each week. The problem is that I only earn points for the first 11 players. The remaining players don't earn points unless one of my first 11 players doesn't play in which case one of my reserve players will earn points instead.
So, what I'd like to do is tell lpsolve to optimise for the best 11 players but still pick a team that includes 15 players. I currently have an R program that optimises for 15:
How could I adjust this program to optimise for the first 11 and still include the other constraints? I imagine I may need to tweak the program to use a particular team formation such as 4-4-2, 3-5-2 etc.