Lernzettel: Constraint Satisfaction Problems (CSP)

Methods of AI — SoSe 2026 · 1-page exam sheet

For more depth: Constraint Satisfaction Problems (full reference with all algorithms, visualisations, deep explanations) · quiz_csp_30-04-26 (15 practice questions)

Core Ideas

  • A CSP is defined by variables, domains, and constraints. Goal: find a complete assignment satisfying all constraints.
  • Unlike search: states have internal structure (variable assignments) that the algorithm exploits.
  • Three solution strategies: naive (generate & test), backtracking search, local search.
  • Consistency preprocessing can dramatically shrink the search space before search even begins.

Mini-glossary

TermMeaning
Variable Xᵢa slot to fill
Domain D(Xᵢ)values Xᵢ may take (shrinks during search)
Constraintunary / binary / n-ary relation restricting allowed combinations
Partial assignmentonly some variables have values
Complete assignmentevery variable has a value
Consistent assignmentno constraint currently violated (can be partial)
Solutioncomplete AND consistent
Consistent CSPat least one solution exists
MRVpick next variable with smallest domain (fail-fast)
LCVpick next value that rules out fewest neighbour options (fail-slow)
Forward Checkingafter assigning X=v, remove v from unassigned neighbour domains
AC-3arc-consistency preprocessing — propagate “every value has a supporter”

⚠️ “Consistent” has two meanings: about an assignment (no current violation) vs. about a CSP (a solution exists). Context disambiguates.

Full glossary with examplesGlossary — important CSP vocabulary ⭐

Formulas & Notation

SymbolMeaning
XᵢVariable i
DᵢDomain of variable i
RSet of constraints
AC-3 complexityO(cd³)
MRVMinimum Remaining Values heuristic
LCVLeast Constraining Value heuristic

Common Exam Traps ⚠️

  • AC-3 removes values from domains — it changes the CSP structure, not just tests it.
  • Arc consistency ≠ path consistency: 2-consistent doesn’t mean 3-consistent.
  • LCV is for value ordering (keep options open); MRV is for variable ordering (fail early). Different goals, don’t mix.
  • If local search finds global optimum on CSP objective → CSP is consistent. If local optimum with violations → you can’t tell.
  • Strong k-consistency means j-consistent for all j ≤ k. Regular k-consistency only guarantees at level k.
  • Backtracking is not local search — it uses partial assignments; local search uses complete (possibly invalid) assignments.

Quick Comparison Table

ApproachAssignment typeCompletenessWhen to use
BacktrackingPartialCompleteGeneral CSPs
Local SearchComplete (may violate)IncompleteLarge CSPs, soft constraints OK
AC-3 preprocessingN/ABefore any search (reduce domains)
MRVVariable selection heuristicAlways good to combine with BT

Full pros/cons comparison of all 9 algorithms → Algorithm comparison table — pros & cons

Practice quiz

Targeted exam questions in Questions for Methods of AI

  • Q17–29 (basic CSP, arc consistency, backtracking, heuristics) · Q88–89 (CSP components, Node/Arc consistency) · Q110–113 (deep / exam-trap: AC-3 complexity O(c·d³), MRV vs. Degree as tie-breaker, MRV vs. LCV non-conflict, RCC-8)

Atomic notes

See also

Tags: methods-of-ai lernzettel
Full reference: Constraint Satisfaction Problems
Quiz: quiz_csp_30-04-26
Superlink: Methods of AI Lecture
Questions hub: Questions for Methods of AI

Created: 30/04/26