Generate unique schedules for teams, presumably for a fantasy football league, but it doesn't actually have to be for that. Points are not simulated, just schedules

generate_schedules(
  league_size = .get_league_size(),
  weeks = .get_weeks_cutoff(),
  sims = 10,
  check_dups = TRUE,
  tries = ifelse(check_dups, ceiling(log(sims)), 1),
  ...,
  overwrite = FALSE,
  export = TRUE,
  dir = .get_dir_data(),
  file = .generate_schedules_file(league_size, weeks, sims),
  ext = "parquet",
  path = file.path(dir, sprintf("%s.%s", file, ext)),
  f_import = arrow::read_parquet,
  f_export = arrow::write_parquet
)

Arguments

league_size

Number of teams in the league. Can be set globally in the options. See ffsched.league_size.

weeks

How many weeks are in schedule. Presently, this function requires that (league_size - 1) <= weeks < (2 * (league_size - 2)).

sims

How many unique simulations to generate.

check_dups

Whether to check for duplicates. It's recommended to leave this as TRUE to ensure that you get unique results, but that may not be what you desire.

tries

How many times to re-try.

...

Additional parameters passed to generate_schedule()

overwrite

Whether to overwrite existing file at path, if it exists.

export

Whether to export.

dir

Directory to use to generate path if path is not explicitly provided.

file

Filename (without extension) to generate path if path is not explicitly provided.

ext

File extension to use to generate path if path is not explicitly provided.

path

Path to export to.

f_import

Function to import with if file exists and overwrite = TRUE.

f_export

Function to export with if export = TRUE .

Details

This function basically uses a brute force approach, hence the tries parameter.