Go home

Constraint Satisfaction Problems

Overview

Constraint satisfaction problems are a subset of search problems. The goal is to find values for some set of variables, but in accordance to some constraint. This can either be discrete variables or continuous variables.

There are three components:

Constraints

A constraint CiC{C_i\in C} has a scope X{\subseteq X} and permitted values.

Assignments and Solutions

An assignment is a mapping of values to variables. These can be complete (if every variable is included) or partial (if some variables are not included).

If the assignment satisfies all the constraints, it is a consistent/legal assignment (this does not need to be complete).

A solution is a consistent and complete assignment.

Constraints

A unary constraint concerns one variable. For instance, x5{x\leq 5}.

A binary constraint involves two variables, like x<y{x<y} or x+y<10{x+y<10}.

Example: Sudoku

Each row, column, and sub-grid needs the numbers 1-9.

As a CSP:

Example: n{n}-Queens

As a CSP:

Example: Map Coloring

Color a planar graph with 4 colors (this is always possible). By brute force, there would be 448{4^{48}} possible coloring options.

Using DFS/BFS, start with one node and pick the first available color. Continue to the next node and pick the next available color. Keep going until the entire graph is colored.

Better options include visiting the minimum remaining values, the least constraining value, look ahead, etc.15`