Quiz: Constraint Satisfaction Problems

Methods of AI — SoSe 2026 · 15 questions

For background: Constraint Satisfaction Problems (full reference) · lernzettel_csp_30-04-26 (1-page exam sheet)


Q2 — CSP

Question: What is the difference between MRV and LCV heuristics? Which is for variable selection, which for value selection?

Max’s answer: MRV is looking at minimizing the values of each variable, while LCV makes sure to leave as many options open as possible.
MRV selects the variable with the least remaining variables, while LCV selects the one that rules out fewest options
Result:


Q3 — CSP

Question: If local search on a CSP finds a globally optimal solution (objective = number of satisfied constraints), what can you conclude?

Max’s answer: the problem is consistent and complete. All contrainst are satisfied
Result:


Q4 — CSP

Question: Explain k-consistency and strong k-consistency. What is the relationship to arc and path consistency?

Max’s answer: so k-consistency checks whether additional variables can be added to the current state. that first implies arc- and path-consistency. so whenever a new variable gets checked it checks for arc and path consistency. but 3-consistency does not imply 2-consistency, since k-constency only checks for new varibales and the existing contraints. but in strong-constistency you can infer that also the new variables matches all contraints
Result:


Q5 — CSP

Question: What is the formal definition of a CSP? Give each component’s meaning.

Max’s answer: a csp is a triple of a set of variables X, a set of Domains D and a set of constraints R.
a solution is a complete assignment that is consistent
Result:


Q6 — CSP

Question: Does arc consistency (or even path consistency) guarantee that a CSP has a solution? Why or why not?

Max’s answer:
Result:


Visual Questions (graphs rendered with Python)

Click each [!example]- toggle to render the graph (Pyodide / Execute Code plugin). Then answer the question before opening the answer callout.


Q10 — MRV after a partial assignment 🟡

What you see. A 5-node CSP after the assignment X1 = R has been made (X1 shown filled red). The remaining four variables have already been forward-checked: their displayed domains are what is still legal given X1 = R. Edges are “must-differ” constraints. You must decide which variable backtracking search picks next under the MRV + degree heuristic.

Question: X1 has been assigned to R and the remaining domains have been forward-checked. Using MRV with the degree tie-breaker, which variable should be chosen next? Show your reasoning.

Max’s answer:
Result:


Q12 — Arc-consistent but unsatisfiable 🔴

What you see. Three variables X, Y, Z arranged as a triangle, each with the two-element domain {R, G}, and every edge carries a pairwise ”≠” constraint (no two adjacent variables may share a colour). The graph looks innocent — every value has supporting partners — but a 2-colouring of a triangle is impossible. This question tests whether you can distinguish local consistency (arc consistency) from global consistency (a solution exists).

Question: Three variables X, Y, Z each with domain {R, G}, pairwise ”≠” constraints (triangle). (a) Is this CSP arc-consistent? (b) Does a solution exist? (c) What does this tell you about the strength of AC-3?

Max’s answer:
Result:


More consistency concepts (Q13–Q15)

The previous quiz covered AC-3 and the k-consistency definitions in text. These three visual questions drill the concepts the slides emphasise: node consistency, path consistency (with the exact slide example that fails), and the hierarchy of consistencies.


Q13 — Node Consistency 🟢

What you see. Three isolated variables — there are no edges drawn because there are no binary constraints. The yellow boxes above each node are unary constraints: rules that involve just one variable. Right now every domain still contains all of {1, 2, 3, 4, 5}, including values that would violate the unary rule.

Question: (a) Define node consistency. (b) Which values must be removed from each domain to make this CSP node-consistent? (c) Why is node consistency the cheapest consistency concept to enforce?

Max’s answer:
Result:


Q14 — Path Consistency (the slide example) 🔴

What you see. Three variables x, y, z forming a triangle, each with domain {red, blue}, every edge a pairwise ”≠” constraint. This is the exact example from the lecture slide on path consistency. The pair (x, y) is arc-consistent on its own — red has support (blue), blue has support (red). The question is whether that assignment can be extended through z while keeping arc-consistency.

Question: (a) Define path consistency of two nodes (i, j) with respect to a third node m. (b) Take the arc-consistent partial assignment x = red, y = blue. Show that nodes x and y are NOT path-consistent with z. (c) Conclude: is arc consistency enough to guarantee a solution?

Max’s answer:
Result:


Q15 — The consistency hierarchy 🟡

What you see. A vertical stack of the five named consistency concepts, top (weakest) to bottom (strongest). Each row shows the standard short name and a one-line definition. The implication chain goes downward: stronger concepts imply all weaker ones (if a CSP is path-consistent it is also arc-consistent, etc., when the cheaper levels are also enforced).

Question: (a) State the precise relationship between the named consistencies and the numeric k-consistency levels. (b) Why does strong n-consistency (n = number of variables) guarantee a backtrack-free solution? (c) Why don’t we always just enforce strong n-consistency?

Max’s answer:
Result:


Beyond the lecture (optional)

These questions go beyond the SoSe 2026 lecture slides (textbook / external additions). Kept for depth, not exam-critical.

Q1 — CSP

Question: What is arc consistency, and what does AC-3 do to achieve it?

Max’s answer: Arc consistency tests whether nodes in a graph are consistent with its neighbours. this consistency is unidirectional, meaning if domain A,B are also in the neighbour node, it is arc consistent in this direction.

Result:


Q7 — CSP

Question: What are the RCC-8 spatial relations? Name and describe at least 4.

Max’s answer:
Result:


Q8 — AC-3 trace 🟡

What you see. A linear 3-node graph A–B–C with two binary “less-than” constraints (A < B on the left edge, B < C on the right). Each node currently has the same domain {1, 2, 3}. AC-3 will propagate the constraints back and forth, shrinking domains, until either every value has support in every neighbour or some domain becomes empty.

Question: Run AC-3 on this CSP step by step. What are the final domains of A, B, C after AC-3 terminates?

Max’s answer:
Result:


Q9 — 2-colorability 🟢

What you see. Three small graphs — a triangle (3-cycle), a square (4-cycle), and a pentagon (5-cycle). Treat each as a CSP where every node is a variable, every edge is a “must-differ” constraint, and the domain of each variable is just two colours. The question is which of these can be properly 2-coloured (a proper 2-colouring assigns one of two colours to each node so no edge connects same-coloured nodes).

Question: Which of the three graphs (A) triangle, (B) 4-cycle, (C) 5-cycle can be 2-coloured such that adjacent nodes have different colours? State the rule that determines the answer.

Max’s answer:
Result:


Q11 — Forward Checking with wipeout 🔴

What you see. A 4-node CSP. A has been assigned R (filled red). The grey edges are “must-differ” constraints. The question walks you through what happens if we now decide to assign B = G — does forward checking flag a problem, or does the assignment survive? Trace the FC pass carefully: B’s unassigned neighbours are C and D, and one of them already had its domain reduced by the earlier assignment of A.

Question: A is already assigned R. We now decide B = G. Apply Forward Checking. What are the resulting domains of C and D? Does any wipeout happen? What does the search do next?

Max’s answer:
Result:


Score

Total: / 15


See also

Tags: methods-of-ai quiz
Full reference: Constraint Satisfaction Problems
Lernzettel: lernzettel_csp_30-04-26
Superlink: Methods of AI Lecture

Created: 30/04/26