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
schedulingProfiledates by specifiedscheduleDates - Construct
matchUpDependenciesto ensure matchUps are scheduled before their dependents - Get an array of inContext
matchUpsfor all relevanttournamentRecords - Retrieve
matchUpDailyLimitsandpersonRequests - Sort
scheduleDatesand for each iterate through all venues - Construct hash tables of
matchUpNotBeforeTimesandmatchUpPotentialParticipantIds - Ensure
roundsspecified forscheduleDateare sorted as specified - Generate ordered array of
matchUpIdsderived from specifiedrounds - Build up a mapping of
matchUpIdstorecoveryMinutesso thatmatchUpswith equivalentaverageMatchUpMinutescan be block scheduled while still considering varyingrecoveryMinutes - Group ordered
matchUpIdsby averageMatchUpMinutes|periodLength - Loop through groups of
matchUpIds... - Calculate available scheduleTimes, considering court availability, already scheduled matchUps, and
remainingScheduleTimesfrom previous iteration - Construct per-participant hash tables of
matchUpsplayed andtimeAfterRecovery - Filter out
matchUpswhich are not appropriate for scheduling - Filter out
matchUpswhich include participants who have reached daily limits - Loop through available
scheduleTimesand build up mapping ofmatchUpIdstoscheduleTimes- Defer scheduling of matchUps where
timeAfterRecoveryhas not been reached - Defer scheduling of matchUps where
personRequestsinclude{ requestType: DO_NOT_SCHEDULE }conflicts
- Defer scheduling of matchUps where
- Group
matchUpIdsby eventId|drawId|structureId and assignscheduleTimestomatchUps - Return array of
remainingScheduleTimesfrom current iteration to seed next iteration of virtualCourtBookings