Tennis match scheduling

Preface In Prolog, CLP(FD) constraints are the right choice for solving such scheduling tasks. See clpfd for more information. In this case, I suggest using the powerful global_cardinality/2 constraint to restrict the number of occurrences of each round, depending on the number of available courts. We can use iterative deepening to find the minimal number of admissible … Read more

Solving “Who owns the Zebra” programmatically?

Here’s a solution in Python based on constraint-programming: from constraint import AllDifferentConstraint, InSetConstraint, Problem # variables colors = “blue red green white yellow”.split() nationalities = “Norwegian German Dane Swede English”.split() pets = “birds dog cats horse zebra”.split() drinks = “tea coffee milk beer water”.split() cigarettes = “Blend, Prince, Blue Master, Dunhill, Pall Mall”.split(“, “) # … Read more