Method used to set team specific exposures. Note, you can set one EXACT and one MAX set of team restrictions per model.

# S4 method for optimizer
set_players_per_team(object, players_per_team, exact = FALSE)

Arguments

object

An optimizer object

players_per_team

A named list, where the names are teams, and the values are the number of players to include for each team

exact

Logical. Whether the number in players_per_team is the maximum number of players to include, or the exact number of players to include. If scalar, the value of EXACT applies to every team in players_per_team. This also accepts a vector with length of players_per_team that can be used to set some teams to EXACT values, and others to MAX values (See examples below).

Value

Updated optimizer object

Examples

if (FALSE) {
# 'opt' is an optimizer model object

# Force the lineup to include a maximum of two players
# from BUF, and prevent any CLE players from being
# included in the lineup
opt <- set_players_per_team(object = opt,
       players_per_team = list(BUF = 2, CLE = 0))

# Set lineup to include exactly three SF players
opt <- set_players_per_team(object = opt, players_per_team = list(SF = 3), exact = TRUE)

# Include up to 3 players from NYG, and exactly two players from TEN
opt <- set_players_per_team(object = opt,
         players_per_team = list(NYG = 3, TEN = 2),
         exact = c(FALSE, TRUE))
}