Variables, Domains, and Constraints
Introduces the three core components of a constraint satisfaction problem (CSP): decision variables, their domains, and the constraints that restrict allowed assignments. Students learn to identify variables and domains for a problem, check whether an assignment satisfies a set of constraints, and model small problems as complete CSPs.
Tutorial
Decision Variables and Domains
In constraint programming, a decision variable is an unknown quantity whose value we need to determine. Each decision variable is associated with a domain -- the set of values that is allowed to take.
For example, suppose we must choose a starting hour for a meeting on a -hour clock, restricted to working hours between and . The decision variable is the start time , and its domain is
Domains come in several flavors:
- Boolean: or .
- Discrete finite: or .
- Integer interval: , meaning every integer from to .
- Continuous interval: .
A choice of a value from for the variable is called an assignment, written . An assignment of values to every variable in the problem is called a complete assignment.