Automated Scheduling
Automated Scheduling
Once the schedulingProfile
, matchUpFormatTiming
and dailyLimits
have been defined, automated assignment of scheduleTimes to matchUps
is straightforward.
engine.scheduleProfileRounds({
scheduleDates, // optional array of dates to be scheduled
});
Pseudocode
The highest level auto-scheduling method is engine.scheduleProfileRounds
.
- Validate and filter
schedulingProfile
dates by specifiedscheduleDates
- Construct
matchUpDependencies
to ensure matchUps are scheduled before their dependents - Get an array of inContext
matchUps
for all relevanttournamentRecords
- Retrieve
matchUpDailyLimits
andpersonRequests
- Sort
scheduleDates
and for each iterate through all venues - Construct hash tables of
matchUpNotBeforeTimes
andmatchUpPotentialParticipantIds
- Ensure
rounds
specified forscheduleDate
are sorted as specified - Generate ordered array of
matchUpIds
derived from specifiedrounds
- Build up a mapping of
matchUpIds
torecoveryMinutes
so thatmatchUps
with equivalentaverageMatchUpMinutes
can be block scheduled while still considering varyingrecoveryMinutes
- Group ordered
matchUpIds
by averageMatchUpMinutes|periodLength - Loop through groups of
matchUpIds
... - Calculate available scheduleTimes, considering court availability, already scheduled matchUps, and
remainingScheduleTimes
from previous iteration - Construct per-participant hash tables of
matchUps
played andtimeAfterRecovery
- Filter out
matchUps
which are not appropriate for scheduling - Filter out
matchUps
which include participants who have reached daily limits - Loop through available
scheduleTimes
and build up mapping ofmatchUpIds
toscheduleTimes
- Defer scheduling of matchUps where
timeAfterRecovery
has not been reached - Defer scheduling of matchUps where
personRequests
include{ requestType: DO_NOT_SCHEDULE }
conflicts
- Defer scheduling of matchUps where
- Group
matchUpIds
by eventId|drawId|structureId and assignscheduleTimes
tomatchUps
- Return array of
remainingScheduleTimes
from current iteration to seed next iteration of virtualCourtBookings