A domain is the set of possible values that may be assigned to a variable in a constraint-satisfaction problem. A CSP pairs variables and domains with constraints that restrict valid combinations. section 3.0
A domain can be represented concretely as an array of values. In a generic Swift CSP, a dictionary maps each variable to its domain, allowing the same search framework to handle different variable and value types. section 3.1
The meaning of a domain depends on the problem being modeled:
- For meeting scheduling, Mary’s domain might contain 2 P.M., 3 P.M., and 4 P.M.—her available hours. section 3.0
- For Australian map coloring, every region has the domain red, green, and blue; adjacency constraints eliminate equal neighboring colors. section 3.2
- For word search, a word’s domain contains possible sequences of grid locations that keep the word within a row, column, or diagonal. section 3.4
Domains during backtracking search
A backtracking solver selects an unassigned variable, reads its domain, and tries each value in turn. It keeps a value when the current assignment is consistent with the relevant constraints, then recursively continues; if every value fails, it returns nil. section 3.1
Use the scheduling diagram to see domains as each participant’s available hours within a complete CSP model. section 3.0

