Foundations of AI and ML

Content

Lisam

Course materials

/

Section

Constraint Satisfaction Problems: Naive Backtracking

Naive Backtracking

Lecture slides are available here.

Naive Backtracking

You are given a constraint network that encodes a graph coloring problem. The graph is shown in the picture below.

graph coloring example

The network is formally specified as follows:

${\cal C} = \{V, dom, (R_{uv})\}$ with variables $V = \{v_1, \dots, v_7\}$ and domains $dom(v_3) = dom(v_4) = dom(v_7) = \{b,r\}$, $dom(v_2) = dom(v_5) = \{b, g\}$, $dom(v_1) = \{b,g,r\}$, and $dom(v_6) = \{g,r,y\}$.

The constraints are such that no two neighboring nodes in the graph can be colored in the same color, i.e., there is a constraint $v_i \neq v_j$ for all pairs $v_i, v_j \in V$ if $i \neq j$ and there exists an edge in the graph connecting $v_i$ and $v_j$.

Run (on paper) the naive backtracking algorithm on this constraint network with the following variable and value ordering rules:

Variable ordering: use the combination of “minimum remaining values” and “most constraining variable” specified in the lecture.

Value ordering: prefer the value with the minimum number of conflicts.

For both variable and value ordering rules, there might be cases where the given rules do not result in a unique variable/value to pick next in the algorithm. In this case, break ties using the lexicographic order. For example, if $v_a$ and $v_b$ have an identical number of remaining values and are equally constraining, prefer $v_a$ over $v_b$. Similarly, if assigning a value of $b$ or $g$ to a variable causes the same number of conflicts, prefer $b$ over $g$.

How many states are generated in the search space until the algorithm finds a solution?

Note: include the initial state, i.e. the empty assignment, as well as the goal state that corresponds to the total assignment in the count. Also include inconsistent partial assignments that might have been generated during the algorithm execution. The example search space in the slides has 17 states.

This webpage contains the course materials for the course TDDE56 Foundations of AI and Machine Learning.
The content is licensed under Creative Commons Attribution 4.0 International.
Copyright © 2022 Linköping University