Schedule Possibilities
Many Prolog schedulers work by scheduling one slot from a list of possible combinations, then reducing the list of possible combinations, and scheduling the next one. That’s the approach we’ll use here. As we work through our potential_matches, we’ll schedule a day’s worth of two games and then remove those two matches from the PotentialMatches list.
One of the trickiest parts of the scheduling problem is finding and representing constraints in code.
Establish the Core Constraints
Our primary constraints are putting a single team on a field, putting two teams in a day, and making sure we don’t schedule the same team twice. Constraining the field and slots will be easy because we’ll ask Prolog for one match for each slot. ...
Get Programmer Passport: Prolog now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.