# Constraint Solving: Problems, Domains and Search Methods - PowerPoint PPT Presentation

Constraint Solving: Problems, Domains and Search Methods

1 / 82
Constraint Solving: Problems, Domains and Search Methods

## Constraint Solving: Problems, Domains and Search Methods

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Outline • What is constraint solving? • Constraint domains • Constraint solving inference services • Practical applications of CSP • Finite domain Constraint Solving Problem (CSP) solving through search • CSP search algorithms

2. What is Constraint Solving? • A versatile paradigm for symbolic, numerical and hybrid symbolico-numerical automated reasoning • Relies on hybrid logical-numerical knowledge representation formalism • Relies on AI search, term rewriting, operation research and mathematical inference algorithms • Allows reasoning with incomplete information • Takes as input intentional and extensional knowledge • When input knowledge is consistent and complete, returns as output extensional knowledge • When input knowledge is consistent but incomplete, returns as outputintentional and extensional knowledge that is more concise and easy to understand than the input • Identifies inconsistent input knowledge • Most other automated reasoning paradigms (monotonic deduction, belief revision, belief update, abduction, planning, optimization) can be reformulated as one form of constraint solving

3. Constraint Solving Problems (CSP) • Input: • Set of variables, each one associated with an associated domain of possible values (constants) • Set of functions defining mapping between these domains • Set of relations (called primitive constraints), including equations and inequations, over these domains • A logical conjunction of such relations (called a compound constraints) • Output: • Composed of same elements as input • If the input is just rightly constrained, the output is one complete consistent variable valuation, i.e., a logical conjunction of equations of the form <variable> = <constant value>. • If the input is underconstrained, the output is a simplification of the input, i.e., a logically equivalent conjunction of primitive constraints containing fewer constraints and/or functions and/or variables. • If the input is overconstrained, the output is “fail” for there exists no variable valuation that simultaneously satisfy all constraints.

4. Intentional generic circuit class model GM:       CSP Example: Analog Circuit Modeling Particular circuit instance data sets: PD1 = ( V = 10  R1 = 10  R2 = 5 ), extensional PD2 = ( V = 10  R2 = 10  I1 = 5 ), extensional PD3 = ( R1 = 10  R2 = 5 ), extensional PD4 = ( V = 10  R1 = 5  I = 1  0  R2 ), intensional Solving particular circuit instance model PM1 = GM  PD1 yields extensional consistent solution: V = 10  V1 = 10  V2 = 10  R1 = 10  R2 = 5  I = 3  I1 = 1  I2 = 2 Solving particular circuit instance model PM2 = GM  PD2yields extensional consistent solution: V = 10  V1 = 10  V2 = 10  R1 = 2  R2 = 10  I = 6  I1 = 5  I2 = 1 Solving particular circuit instance model PM2 = GM  PD2yields intentional consistent solution:V x 3 = I x 10 Solving particular circuit instance model PM4 = GM  PD4 yields fail (inconsistent input)

5. Building a House Stage S Foundations 7 days Generic Building Model GM: Stage A start foundations interior walls exterior walls chimney roof doors tiles windows Interior Walls Chimney Exterior Walls 4 days 3 days 3 days Stage B Stage C Doors Roof Windows 2 days 2 days 3 days Stage D Tiles 3 days Stage E CSP Example: Building Scheduling Particular query Q1: TS = 0  Tm = min(TE) Solution to particular problem GM  Q1: TS = 0  TA = 7  TB = 11  TC = 10  TD = 12  TE = 15  Tm = 15 Particular query Q2: TE  14 Solution to particular problem GM  Q2: fail

6. CSP Example: Map Coloring Generic Australia map coloring model AMCM: WT  SO  WT  NT NT  SO  NT  Q  Q  SO  Q  NSW  NSW  SO  NSW  V  V  SO Color set instance BGR: WT  {blue, green, red}  SO  {blue, green, red}  NT  {blue, green, red}  Q  {blue, green, red}  NSW  {blue, green, red}  V  {blue, green, red}  T  {blue, green, red} Solving specific Australian map coloring problemAMCM  BGR yields complete consistent solution:SO = blue  WA = red  NT = green  Q =red NSW = green  V = red  T = green Solving specific Australian map coloring problem with any set instance with two-color domains for all variables yields fail

7. args <<enum> FOL Quantifier   0 ..* 1 ..* FOL Atom FOL Term 0 .. * args { disjoint, complete } { disjoint, complete } functor Predicate Symbol 0 .. * Quantifier Prefix Functional Term Non-Functional Term Ground Term Non-Ground Term 0 ..* connective FOL Formula functor Function Symbol Constant Symbol Variable And Formula 1 ..* 1 ..* 1 ..* Primitive Constraint Constraint Symbol Constraint Domain Compound Constraint 1 ..* Variable Assignment Valuation 1 ..* The Language of CSP: MOF Metamodel <<enum>> FOL Connective     

8. Mixed CD 2 .. * {non-overlapping, complete} {non-overlapping, complete} Symbolic CD Numeric CD Finite CD Infinite CD ,  +, -, *, /, ^, logn, sin, cos, ... Real Equations Inequalities Symbolic FD ,  Integer FD Equations Inequalities N Real Polynomial Equations Inequalities Ordinal FD +, -, *, ^ R Nominal FD concat Rational Trees CD Real Linear Equations Inequalities Function Symbol name: String +, -, * String CD {0,1} Boolean CD 1 .. * Integer Linear Equations Inequalities , , , ~, ,  N Infinite Symbolic CD CSP Domains: MOF Metamodel Constraint Domain (CD) =, , true, false , 

9. CSP Solving Services • Substitution • Satisfaction • Absolute Implication • Absolute Equivalence • Normalization • Absolute Simplification • Projection • Relative Implication • Relative Equivalence • Relative Simplification • Local Propagation • Optimization • Labeling

10. CSP Solving Services: Substitution • Substitute(:Valuation, C:CompoundConstraint):CompoundConstraint • returns result of substituting in C the variables in  by their value in . • Examples: • C: B = P + I x P  B2 = B + I x B • 1: B = 1200 P = 1000  I = 0.2  B2 = 1440 • 1(C): 1200 = 1000 + 0.2 x 1000  1440 = 1200 + 0.2 x 1200 • 2: B = 1 I = 1 • 2(C): 1 = P + 1 x P  B2 = 1 + 1 x 1 • 3: B = 1 P = 0  I = 1 B2 = 1 • 3(C): 1 = 0 + 1 x 0  1 = 1 + 1 x 1

11. CSP Solving Services: Satisfaction • Satisfiable(C:CompoundConstraint):Boolean • result = true iff :Valuation | Substitute(, C) holds • if result = true, also returns . • Examples: • C1: B = P + I x P  B2 = B + I x B • Satisfiable(C1) = true, • since: 1 = (B = 1200 P = 1000  I = 0.2  B2 = 1440) • 1(C1) = (1200 = 1000 + 0.2 x 1000  1440 = 1200 + 0.2 x 1200) (1200 = 1000 + 20000/100 1440 = 1200 + 24000/100) (1200 = 1000 + 200 1440 = 1200 + 240) (1200 = 1200 1440 = 1440)  (true  true) true • C2: X = Y + 1  Y = X + 1 • Satisfiable(C2) = false, since • C2  (X = X + 1 + 1  Y = X + 1)  (X = X + 2  Y = X + 1)  (0 = 2  Y = X + 1)  (false  Y = X + 1)  false

12. CSP Solving Services: Absolute Implication and Equivalence • Implies(C1:CompoundConstraint, C2:CompoundConstraint):Boolean • result = true iff :Valuation, (C1) satisfiable  (C2) satisfiable • Examples: • C1 = (TS 0  TA TS + 7  TB TA + 4  TC TA + 3  TD TC + 2  TE TB + 2  TE TC + 3  TE TD + 3) • C2 = TB  TC • Implies(C1,C2) = false • Since  = (TS = 0  TA = 7  TB = 11  TC = 12  TD= 14  TE = 17) satisfies C1 but not C2 • C3 = C1 TE = 15 • Implies(C3,C2) = true • Since C3  12  TD  10  TC  TA 7  TB 11 • Equivalent(C1:CompoundConstraint, C2:CompoundConstraint): Boolean • result = true iff :Valuation, (C1) satisfiable  (C2) satisfiable • C1  C2 iff (C1  C2) and (C2  C1)

13. CSP Solving Services: Normalization • Solved form compound constraint: • X1 = e1 ...  XN = eN such that • none of the variables X1 ... XN occur in any of the expressions e1 ... eN. • Normalize(C:CompoundConstraint):CompoundConstraint • result = S is in solved form and verifies S  C  C • Examples: • C = (X = 2 + Y 2*Y + X – T = Z X + Y = 4 Z + T = 5) • S = Normalize(C) = (X = 3 Y = 1Z = 5 – T) • C  (X = 2 + Y 2*Y + 2 + Y – T = Z  2 + Y + Y = 4 Z = 5 - T)  (X = 2 + Y  3*Y + 2 – T = 5 - T 2*Y = 4 - 2Z = 5 - T)  (X = 2 + Y 3*Y + 2 = 5 Y = 1Z = 5 - T)  (X = 2 + 1 3*1+ 2 = 5Y = 1Z = 5 - T)  (X = 3 5 = 5Y = 1Z = 5 - T)  (X = 3 trueY = 1Z = 5 - T)  (X = 3Y = 1Z = 5 - T) = S

14. CSP Solving Services:Absolute Simplification • Simplify(C:CompoundConstraint):CompoundConstraint • result = S is equivalent, simpler constraint, i.e., • S  C and • S has fewer primitive constraints than C and/or • S has more constraints in solved form than C and/or • S has fewer function symbols than C and/or • S has fewer variables than C • Examples: • C = (X  Y + Z  U + V  X + V  U = Z + Y  V + V = 0  {U,V,X,Y,Z}  N) • S = (X = Y + Z  U = Z + Y  V = 0  {U,V,X,Y,Z}  N) • Since • C  (X  Y + Z U + V  X + V  U = Z + Y  V = 0  {U,V,X,Y,Z}  N)  (X  Y + Z 0 + U  X + 0 U = Z + Y {U,V,X,Y,Z}  N V = 0)  (X  Y + Z U  X U = Z + Y {U,V,X,Y,Z}  N V = 0)  (X  Y + Z Z + Y X  U = Z + Y  V = 0 {U,X,Y,Z}  N)  S

15. CSP Solving Services: Projection • Valuation extension: • Given a valuation B of the form (X1 = v1... XB = vB) • Any valuation E of the form (X1 = v1... XB = vB XB+1 = vB+1... XE = vE )is an extension of B. • Partial solution: • A valuation P is a partial solution of a constraint C iffF :Valuation, F extends P and P is a solution of C • Notation: vars(C) = set of variables occurring in constraint C • Project(C:CompoundConstraint,Vs:VariableSet):CompoundConstraint • precondition: Vs  vars(C) • result P verifies: • vars(P) Vs • C  P • P :Valuation over Vs, P solution of P  P partial solution of C

16. Y 1 - X X - X X - 1 1 - 1 1 - 1 - Y Projection Examples • C1 = (X  Y Y  Z Z  T T  0) • Project(C1,{X}) = X  0 • C2 = (f(Y,Y) = f(X,Z) s(Z) = s(T)  f bijection) • Project(C2,{X,Z}) = (X = Z) • C3 = (X + Y  1  X - Y  1  - X + Y  1  - X - Y  1) • Project(C3,{X}) = (- 1  X  X  1) • Counter-example: C4 = (X = f(Y,Z)) • Project(C4,{X}) = fail • there is no primitive constraint in C1that either do not contain X or can be simplified

17. CSP Solving Services: Local Propagation • Determined solved form of compound constraint: • X1 = v1 ...  XN = vN where X1 ... XN are variables and v1 ... vN are constants • Propagate(Cd:CompoundConstraint, C:CompoundConstraint):CompoundConstraint • preconditions: • Cd sub-conjunction of C • Cd in determined solved form • result = Propagate(Cd(C),choose(Cd’,determines(Cd,C))), i.e., • apply Cd as valuation substitution on C • find which other sub-conjunctions of C become determined by this substitution -- determines(Cd,C) • choose one of them Cd’ • recursively propagate Cd’ on Cd(C) • stop when propagation fails to determine new member of C

18. Local Propagation Example • C = (V = V1  V = V2  V1 = I1 x R1  V2 = I2 x R2  I = I1 + I2) • Cd = (V = 10  R1 = 5  R2 = 10) • Propagate(Cd,C) = (V = 10  V1 = 10  V2 = 10  I1 = 2  I2 = 1  I = 3) • Since: • Cd(C) = (10 = V1 10 = V2  V1 = I1 x 5 V2 = I2 x 10 I = I1 + I2) • Cd’ = (V1 = 10  V2 = 10) • Cd’(Cd(C)) = (10 = 1010 = 1010 = I1 x 5 10 = I2 x 10  I = I1 + I2) • Cd’’ = (I1 = 2  I2 = 1) • Cd’’(Cd’(Cd(C))) = (10 = V1 10 = V2  10 = 2 x 5  10 = 1 x 10  I = 2 + 1)

19. CSP Solving Services: Optimization • Optimize(C:CompoundConstraint, F:CostFunction):Valuation • if C overconstrained result = fail • if C just rightly constrained result = unique u such that u(C) satisfiable • if C underconstrained result = one of the lowest-cost solutions, i.e., o such that o(C) satisfiable and  such that (C) satisfiable, F(o)  F() • if there is no such lower-cost solution, result = none • Examples: • C1 = (X + Y  4) • F(X,Y) = X^2 + Y^2 • Optimize(C1,F) = (X = 2  Y = 3) • G(X,Y) = X + Y • Optimize(C1,G) = any solution to C2 = (X + Y = 5) • C3 = X  0 • H(X) = X • Optimize(C3,H) = none

20. CSP Solving Services: Labeling • Label(C:CompoundConstraint):ValuationSet • precondition: C over finite domain • result = {:Valuation | (C) satisfiable} • Example: • C1 = (WT  SO  WT  NT  NT  SO  NT  Q  Q  SO  Q  NSW  NSW  SO  NSW  V  V  SO) • C2 = (WT  {blue, green, red}  SO  {blue, green, red}  NT  {blue, green, red}  Q  {blue, green, red} NSW  {blue, green, red}  V  {blue, green, red} T  {blue, green, red}) • Label(C1  C2) = (SO = blue  WA = red  NT = green  Q =red  NSW = green  V = red  T = green)

21. Constraint Solvers • Constraint solver: software providing one CSP service • Many CSP services can be implemented through judicious assembly and reuse of other CSP services • Properties: • Correct • Complete • Normalizing • Set-based • Variable name independent • Monotonic (falsity preserving) • Projecting • Weakly projecting

22. Constraint Solvers Properties • Correct: guaranteed to return only correct solutions • Complete: guaranteed to return all existing solutions • Possible only for small instances of CSP over specific domains • Most CSP are NP-Hard, some are semi-decidable or even undecidable • Satisfiable service returns “unknown” when it can neither conclude that the input constraint is satisfiable nor that it is unsatisfiable • Normalizing: return results in solved form • Directly legible, usable result • No need for simplification or projection post-processing • Set-based: returns same solution for two equivalent compound constraints differing only in primitive constraint order and/or repetitions • Variable-name independent: returns same solution for two equivalent compound constraints different only in terms of variable names • Monotonic: C1,C2 satisfies(C1) = false  satisfies(C1  C2) = false

23. Soft Constraints • Define preference order over valuations consistent with hard constraints • Hard constraint example: a professor cannot teach two courses with overlapping time slots • Soft constraint example: a professor prefers its undergraduate and graduate course to be scheduled on the same day • Most satisfiability problems with hard and soft constraints can be transformed into optimization problems: • The preference defined by the soft constraints is captured by the cost function to optimize

24. Primitive Constraint Arity • Arity: primitive constraint argument number • Zero-ary: true, false • Unary: boolean negation, =, , , , ,  with one variable and one constant • Binary: =, , , , ,  with two variables • Primitive high-order FD constraints: • Alldiff(V1 D, ... , VnD), no pair of variables from {V1, ... , Vn} can share the same value in finite domain D • Atmost(TD,V1D, ... , VnD), T V1 +, ... , + Vn • Element(I {1, ... ,n}, [V1, ... , Vn], X), if I = i, then X = Vi • Any primitive high-order FD constraints can be converted to an equivalent conjunction of binary primitive FD constraints by the introduction of additional, auxiliary variables • But, special-purpose propagation techniques handle primitive high-order FD constraints far more efficiently than general purpose propagation techniques can handle their conversion as a conjunction of binary constraints

25. CSP Domainsand Algorithms • Chronological Backtracking (CBT) • Simple, w/ Forward Checking • Conflict-Directed Backjunping (CDBJ) • Simple, w/ Forward Checking • k-Consistency Propagation • CBT w/ k-Consistency Propagation • CDBJ w/ k-Consistency Propagation • Min-Conflict Local Propagation Constraint Domain (CD) Symbolic CD Numeric CD Finite CD Infinite CD Real Equations Inequalities Integer FD Linear Equations Inequalities Symbolic FD • Bounds Consistency Propagation (BCP) • CBT w/ BCP • CDBJ w/ BCP Real Polynomial Equations Inequalities Simplex Optimization Gauss-Jordan Elimination Interval FD Real Linear Equations Ordinal FD Real Linear Equations Inequalities String CD Rational Trees CD Real Linear Inequalities Nominal FD Fourier Elimination Integer Linear Equations Inequalities Infinite Symbolic CD Boolean CD Unification

26. FD Constraint Satisfaction as Search • FD CSP: D = {v1, ... , vm}  X1  D  ...  Xn  D  Cswhere Cs = c1(Xi1,Xj1)  ...  cp(Xip,Xjp) • Finite domain allows solving by enumeration of possible valuations (search) • Formulation as incremental search: • Initial state: no variable assigned, i.e., X1  D  ...  Xn  D  Cs • Successor function: add Xi = vj to current valuation Xk = vl ...  Xq = vr such that Xk = vl ...  Xq = vr Xi = vj Cs satisfiable • Goal test: X1 = vi1 ...  Xn = vin Cs satisfiable • Path cost: 1 per step • Formulation as complete-state search: • Initial state: all variables randomly assigned, i.e., X1 = vi1 ...  Xk = vik  ...  Xn = vin • Successor function: change assignment of one variable in current valuation resulting in X1 = vi1 ...  Xk = vil  X1 = vi1 ...  Xn = vinwhere vil  vik. • Goal test: same as incremental search

27. General problem-solving search: State representation: Problem-specific Black-box data structure Successor function: Problem-specific Arbitrary black-box Goal test function: Problem-specific Arbitrary black-box Heuristic functions: All domain-specific FD CSP search: State representation: Standard for all CSP Compositional logical knowledge representation language Successor function: Standard for all CSP Instantiation of one piece of intentional knowledge into extensional knowledge Goal test function: Standard for all CSP Satisfaction of all instantiated primitive constraints Heuristic functions: Standard for all CSP Some domain-independent! General Problem-Solving Searchvs. FD CSP Search

28. FD CSP Graphs • Summarize dependencies between variables through constraints • Node: variable, or constraint • Arc: constraint, or constraint argument • Useful for: • Computing FD CSP search heuristic functions • Complexity analysis of FD CSP search algorithm

29. Backtracking Search for FD CSP • General algorithm: • At each step, choose one variable to assign one value to it and choose that value from the variable’s associated domain • If the resulting partial valuation satisfies all the primitive constraints, recur to choose next variable-value assignment pair • Otherwise, backtrack to a earlier assignment pair choice, choose an alternative pair and resume forward search from that point • Notes: • Path to solution state irrelevant • Base, uninformed version: • Chooses variable to assign randomly among remaining options • Chooses value to assign randomly among remaining options • Always backtracks to last choice point (chronological backtracking) • Does not perform any pruning of future options based on the propagation of the consequences of its last assignment Xi = vi to the domains of variables adjacent to Xi in the constraint graph

30. X1 X7 X2 X6 r b g X3 X4 X5 r g t b b g g r r r b b b Chronological Backtracking Example • (X1=r  X1=b  X1=g) (X2=b  X2=g) (X3=r X3=b) (X4=r X4=b) (X5=b X5=g) (X6=r X6=g  X6=t) (X7=r X7=b)(X1=X2) (X1=X3) (X1=X4) (X1=X7) (X2=X6)(X3=X7) (X4=X5) (X4=X7) (X5=X6) (X5=X7)

31. X1 X7 X2 X6 r r b b g g X3 X4 X5 r r g g t t b b b b g g g g r r r r r r b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5

32. X1 X7 X2 X6 X1 X7 X3 X4 X5 X2 X6 r r r b b b g g g X3 X4 X5 r r r g g g t t t b b b b b b g g g g g g r r r r r r r r r b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5

33. X1 X7 X1 X7 X2 X6 X2 X6 X1 X7 X3 X4 X5 X3 X4 X5 X2 X6 r r r r b b b b g g g g X3 X4 X5 r r r r g g g g t t t t b b b b b b b b g g g g g g g g r r r r r r r r r r r r b b b b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5

34. X1 X7 X1 X7 X2 X6 X2 X6 X1 X7 X3 X4 X5 X3 X4 X5 X2 X6 r r r r r b b b b b g g g g g X3 X4 X5 X1 X7 r r r r r g g g g g t t t t t X2 X6 X3 X4 X5 b b b b b b b b b b g g g g g g g g g g r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5

35. X1 X7 X1 X7 X2 X6 X2 X6 X1 X7 X3 X4 X5 X3 X4 X5 X2 X6 r r r r r r b b b b b b g g g g g g X3 X4 X5 X1 X7 X1 X7 r r r r r r g g g g g g t t t t t t X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 b b b b b b b b b b b b g g g g g g g g g g g g r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5

36. X1 X7 X1 X7 X2 X6 X2 X6 X1 X7 X3 X4 X5 X3 X4 X5 X2 X6 r r r r r r r b b b b b b b g g g g g g g X3 X4 X5 X1 X7 X1 X7 r r r r r r r g g g g g g g t t t t t t t X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 b b b b b b b b b b b b b b g g g g g g g g g g g g g g r r r r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5 X1 X7 X2 X6 X3 X4 X5

37. X1 X7 X1 X7 X2 X6 X2 X6 X1 X7 X3 X4 X5 X3 X4 X5 X2 X6 r r r r r r r r b b b b b b b b g g g g g g g g X3 X4 X5 X1 X7 X1 X7 r r r r r r r r g g g g g g g g t t t t t t t t X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 b b b b b b b b b b b b b b b b g g g g g g g g g g g g g g g g r r r r r r r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5 X1 X7 X1 X7 bt X2 X6 X2 X6 X3 X4 X5 X3 X4 X5

38. X1 X7 X1 X7 X2 X6 X2 X6 X1 X7 X3 X4 X5 X3 X4 X5 X2 X6 r r r r r r r r r b b b b b b b b b g g g g g g g g g X3 X4 X5 X1 X7 X1 X7 r r r r r r r r r g g g g g g g g g t t t t t t t t t X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 b b b b b b b b b b b b b b b b b b g g g g g g g g g g g g g g g g g g r r r r r r r r r r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b b b b b b b b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5 X1 X7 X1 X7 X1 X7 bt x X2 X6 X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 X3 X4 X5

39. r r b b g g r r g g t t b b b b g g g g X1 X7 r r r r r r b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 bt x X2 X6 bt X3 X4 X5

40. r r r b b b g g g r r r g g g t t t b b b b b b g g g g g g X1 X7 r r r r r r r r r b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt x X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt x

41. r r r r b b b b g g g g r r r r g g g g t t t t b b b b b b b b g g g g g g g g X1 X7 r r r r r r r r r r r r b b b b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt X1 X7 X2 X6 X3 X4 X5 x bt

42. r r r r r b b b b b g g g g g r r r r r g g g g g t t t t t b b b b b b b b b b g g g g g g g g g g X1 X7 r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 x bt

43. r r r r r r b b b b b b g g g g g g r r r r r r g g g g g g t t t t t t b b b b b b b b b b b b g g g g g g g g g g g g X1 X7 r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X1 X7 x X2 X6 X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 X3 X4 X5 bt

44. r r r r r r r b b b b b b b g g g g g g g r r r r r r r g g g g g g g t t t t t t t b b b b b b b b b b b b b b g g g g g g g g g g g g g g X1 X7 r r r r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X1 X7 x X2 X6 X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 X3 X4 X5 bt X1 X7 X2 X6 X3 X4 X5

45. r r r r r r r r b b b b b b b b g g g g g g g g r r r r r r r r g g g g g g g g t t t t t t t t b b b b b b b b b b b b b b b b g g g g g g g g g g g g g g g g X1 X7 r r r r r r r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X1 X7 x X2 X6 X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X2 X6 X2 X6 X3 X4 X5 X3 X4 X5

46. r r r r r r r r r b b b b b b b b b g g g g g g g g g r r r r r r r r r g g g g g g g g g t t t t t t t t t b b b b b b b b b b b b b b b b b b g g g g g g g g g g g g g g g g g g X1 X7 r r r r r r r r r r r r r r r r r r r r r r r r r r r b b b b b b b b b b b b b b b b b b b b b b b b b b b X2 X6 X3 X4 X5 Chronological Backtracking Example X1 X7 X1 X7 bt X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X1 X7 x X2 X6 X2 X6 X2 X6 bt X3 X4 X5 X3 X4 X5 X3 X4 X5 bt X1 X7 X1 X7 X1 X7 X2 X6 X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 X3 X4 X5

47. r b g r g t b b g g r r r b b b Chronological Backtracking Example X1 X7 X2 X6 X3 X4 X5

48. r r b b g g r r g g t t b b b b g g g g r r r r r r b b b b b b Chronological Backtracking Example X1 X7 X1 X7 bt x X2 X6 X2 X6 X3 X4 X5 X3 X4 X5

49. r r r b b b g g g r r r g g g t t t b b b b b b g g g g g g r r r r r r r r r b b b b b b b b b Chronological Backtracking Example X1 X7 X1 X7 ... bt x X2 X6 X2 X6 X3 X4 X5 X3 X4 X5 x X1 X7 X2 X6 X3 X4 X5