1 / 38

Relaxation and Hybrid constraint processing

Explore different relaxation techniques and popular hybrid approaches for constraint processing. Includes examples and explanations of relaxation, node consistency, forward check, lookahead check, AC1, AC3, and path-consistency.

creeser
Download Presentation

Relaxation and Hybrid constraint processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques

  2. Relaxation Node consistency Forward check Lookahead check AC1 AC3 Path-consistency

  3. Running example • The 4-houses puzzle: • 4 families A, B, C and D live next to each other in houses numbered 1, 2, 3 and 4. • Dlives in a house with lower number thanB, • Blives next toAin a house with higher number, • There is at least one house betweenBandC, • Ddoes not live in the house with number2, • Cdoes not live in the house with number4. • Which family lives in which house ?

  4. Representation: • The variables: A, B, C and D • The domains: dA = dB = dC = dD = { 1, 2, 3, 4} • Constraints: • unary: • c(C) =C 4 • c(D) =D 2 • binary: • c(A,B) =B=A + 1 • c(A,C) =A  C • c(B,D) =DB • c(A,D) = A  D • c(B,C) = |B-C|  1 • c(C,D) = C  D

  5. dC = { 1, 2, 3} dD = { 1, 3, 4} Node-consistency: • Or: 1-consistency • (only 1 variable is involved) • Unary constraints are eliminated through domain- reductions: • c(C) =C 4 • c(D) =D 2

  6. { 1, 2, 3, 4} { 1, 2, 3, 4} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} The constraint network:

  7. Weak relaxation Forward Check Lookahead Check

  8. { 1, 2, 3, 4} {2} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} Forward Check: • Assume we fix the value for 1 variable zi: zi = a • Forward Check(zi) = • activate each constraint c(zi, zj) or c(zj, zi) once to remove the inconsistent values for zi = a • Our example: assume A = 2 :

  9. { 1, 2, 3, 4} {2} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} Forward check: weak consistency • Requires that 1 variable already obtained a value • suggests use in combination with backtracking • Does not produce a consistent state • not all relaxation is done

  10. Look ahead check A stronger (weak) relaxation method

  11. { 1, 2, 3, 4} { 1, 2, 3, 4} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} Look ahead Check: • Look Ahead Check = • activate each constraint c(zi, zj) exactly once to remove the inconsistent values from the domains Di and Dj. • Our example:

  12. { 2, 3, 4} { 1, 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} Example continued: • The 3 other constraints:

  13. { 3, 4} { 1, 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2} { 1, 3} Look ahead: final results: • Still does not produce a consistent state • not all relaxation is done • Result may depend on the order in which constraints are dealt with. • Removing some values first may allow to find others inconsistent

  14. Arc consistency techniques Techniques that reduce domains to a state that is consistent for each constraint (or arc). Also called: 2-consistency techniques

  15. AC 1 (Mackworth) AC1: Repeat Deletion_occurred:= false ; Look ahead check; If some value was removed from some domain then Deletion_occurred:= true Until(notDeletion_occurred) • Forces Look ahead to reach a consistent state • by reactivating Look ahead until consistency

  16. { 3, 4} { 1, 2, 3, 4} { 1, 2, 3, 4} { 1, 2, 3} B=A + 1 B=A + 1 A B A B A  D A  D A  C A  C DB DB |B-C|  1 |B-C|  1 C D C D C  D C  D { 1, 2} { 1, 2, 3} { 1, 3} { 1, 3, 4} The example (1): • First pass (== Look ahead check): • Deletion_occurred:= true

  17. { 3, 4} { 3, 4} { 1, 2, 3} { 2, 3} B=A + 1 B=A + 1 A A B B A  D A  D A  C A  C DB DB |B-C|  1 |B-C|  1 C C D D C  D C  D { 1, 2} { 1, 2} { 1, 3} { 1, 3} The example (2): • Second pass: • Deletion_occurred:= true

  18. { 3, 4} { 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2} { 1, 3} The example (3): • Third pass: • Deletion_occurred:= false • Result: A (2 or 3) , B (3 or 4), C (1 or 2), D (1 or 3) • Consistent, but NOT REALLY A SOLUTION !!

  19. Whilenot empty(QUEUE) DO If some value was removed from Dx (or Dy) thenadd all other constraints involving x (or y) to QUEUE; AC-3 (Mackworth)More efficient arc-consistency: AC3: QUEUE:= {all constraints in the problem} Remove c(x,y) from QUEUE; Remove all inconsistent values from domains Dx and Dy with respect to c(x,y); End-While

  20. { 1, 2, 3, 4} { 1, 2, 3, 4} B=A + 1 A B A  D A  C DB |B-C|  1 All already inQUEUE ! C D C  D { 1, 2, 3} { 1, 3, 4} The example (1): • QUEUE = {c(A,B), c(A,C), c(A,D), c(B,C), c(B,D), c(C,D)}: • To be added: c(A,C), c(A,D), c(B,C), c(B,D) • QUEUE = {c(A,C), c(A,D), c(B,C), c(B,D), c(C,D)}

  21. { 2, 3, 4} { 1, 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} The example (2): • QUEUE = {c(A,C), c(A,D), c(B,C), c(B,D), c(C,D)}: • QUEUE = {c(B,C), c(B,D), c(C,D)}

  22. { 2, 3, 4} { 1, 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} The example (3): • QUEUE = {c(B,C), c(B,D), c(C,D)}: • To be added: c(A,B), c(A,C), c(B,D), c(C,D) • QUEUE = {c(B,D), c(C,D), c(A,B), c(A,C)}

  23. { 3, 4} { 1, 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2} { 1, 3, 4} The example (4): • QUEUE = {c(B,D), c(C,D), c(A,B), c(A,C)}: • To be added: c(A,D), c(C,D) • QUEUE = {c(C,D), c(A,B), c(A,C), c(A,D)}

  24. { 3, 4} { 1, 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2} { 1, 3} The example (5): • QUEUE = {c(C,D), c(A,B), c(A,C), c(A,D)}: • To be added: c(A,C), c(A,D) • QUEUE = {c(A,C), c(A,D)}

  25. { 3, 4} { 2, 3} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2} { 1, 3} The example (6): • QUEUE = {c(A,C), c(A,D)}: • QUEUE = empty STOP !

  26. Comparison: • Same result: full arc-consistency: • A = {2,3}, B = {3,4}, C= {1,2}, D = {1,3} • Efficiency: • AC1: • 3 times 6 checks = 18 • AC3: • 9 constraint checks

  27. { 1, 2, 3, 4} Example: { 1, 2, 3, 4} B=A + 1 A B A  D A  C DB |B-C|  1 C D C  D { 1, 2, 3} { 1, 3, 4} K-consistency: • 1-consistency (node-consistency): • unary constraints (on 1 variable) are consistent • 2-consistency (arc-consistency): • binary constraints (on 2 variables) are consistent • 3-consistency: • all constraints involving 3 variables are consistent • A value remains in the domain if there are consistent values in the domains of the 2 other variables (for all connecting constraints)

  28. Practicality of k-consistency: • Checking k-consistency for k  2 is very hard to do efficiently !! • Example: 4-consistency for the 4-houses puzzle is equivalent to finding solutions to the original problem.

  29. Hybrid constraint processing Combine the power of exhaustive (backtrack) search with (relaxation) pruning

  30. Forward checking Backtracking combined with Forward Check

  31. Forward checking: Forward Checking: ExecuteStandard Backtracking BUT After each assignment of a value to a variable ziDO Forward Check(zi)

  32. A 1 3 2 {3} {2} {1} {1,2,3,4} {1,2,3,4} {1,2,3,4} B=A+1 B=A+1 A A A B B B AC AC B=A+1 AD AD AC AD C C C D D D {1,3,4} {1,3,4} {1,3,4} {1,2,3} {1,2,3} {1,2,3} B B B 3 4 2 {2} {3} A B |B-C|1 D B C D {3} {1} {2} {4} {1,3,4} {1,3} A A B B |B-C|1 |B-C|1 C C 1 2 D B D B C C D D 1 {1,4} {3,4} {2,3} {1,2} {3} {3} {4} {4} {4} {3} A B A A B B CD CD CD D C {1} {1} D D C C {2} {1} {1} {1} Forward checking at work fail fail fail success

  33. Lookahead checking Backtracking combined with Look ahead check

  34. After each assignment of a value to some variable DO Lookahead checking: Lookahead Checking: Look Ahead Check ; ExecuteStandard Backtracking BUT Look Ahead Check

  35. {1,2,3,4} {1,2,3,4} B=A+1 A B AC AD D B |B-C|1 {3} {3,4} C CD D B=A+1 {1,2,3} {1,3,4} A B AC AD D B A |B-C|1 1 3 C CD D {1,2} {1,3} {1} {3,4} 2 B=A+1 B A B 4 C D {3} {4} A B |B-C|1 {1,3} {1,2} D B C CD D {2} {1} C {2} {3,4} 2 B=A+1 A B AC {3} {4} AD D B A B |B-C|1 C CD D {1,2} {1,3} C CD D {2} {1} Lookahead checking at work fail fail success

  36. Which is best? • Forward checking: • does less consistency checking • has more branching • closer to backtracking • Lookahead checking: • spends more work on consistency • tries less alternative values • Usually: forward checking is best trade-off • For VERY strongly constrainted problems: • Lookahead checking is needed to prune more

  37. Applications: • All combinatorial search problems • Scheduling problems: • Ex.: reschedule the trains when some railway problem has occurred • Rostering problems: • Ex.: compute work-shifts, given various expertise constraints and personal preferences • Production planning: • Ex.: schedule the optimal workfloor traversal • Loading problems: • Ex.: optimize truck-space given various types of loads

  38. 4*X - 3*Y  Z + 2 YES ! X3 - 3*Y  Z2 + 2 NO ! Alternative techniques • Linear programming • numerical techniques for solving systems of linear equations (and inequalities) + optimization problems • Ex.: simplex algorithm • Works VERY well for ‘linear’ constraints • Works, but not VERY well, for discrete problems • In such cases: Constraint Processing is a better option • Also: for constraint problems on non-numerical data !

More Related