Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking1 Foundations of Constraint Processing CSCE421/821, Fall 2005: www.cse.unl.edu/~choueiry/F05-421-821/

Slides:



Advertisements
Similar presentations
I am Patrick Prosser I am a senior lecturer at Glasgow I teach AF2 & CP4 I am a member of the algorithms group the apes (distributed, not disbanded) I.
Advertisements

Backward Checking Search BT, BM, BJ, CBJ. An example problem Colour each of the 5 nodes, such that if they are adjacent, they take different colours 12.
Foundations of Constraint Processing Lookahead Schemas 1 Foundations of Constraint Processing CSCE421/821, Spring
Backward Checking Search BT, BM, BJ, CBJ. An example problem Colour each of the 5 nodes, such that if they are adjacent, they take different colours.
Constraint processing An efficient alternative for search.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Foundations of Constraint Processing More on Constraint Consistency 1 Foundations of Constraint Processing CSCE421/821, Spring
1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali.
Foundations of Constraint Processing, Spring 2008 Evaluation to BT SearchApril 16, Foundations of Constraint Processing CSCE421/821, Spring 2008:
An Empirical Study of the Performance of Preprocessing and Look-ahead Techniques for Solving Finite Constraint Satisfaction Problems Zheying Jane Yang.
Foundations of Constraint Processing, Fall September 2004Backtracking1 Foundations of Constraint Processing CSCE421/821, Fall 2004:
Foundations of Constraint Processing, Fall 2004 November 8, 2004Ordering heuristics1 Foundations of Constraint Processing CSCE421/821, Fall 2004:
An Approximation of Generalized Arc-Consistency for Temporal CSPs Lin Xu and Berthe Y. Choueiry Constraint Systems Laboratory Department of Computer Science.
A Constraint Satisfaction Problem (CSP) is a combinatorial decision problem defined by a set of variables, a set of domain values for these variables,
Foundations of Constraint Processing, Fall 2005 November 16, 2005nFCi1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
Foundations of Constraint Processing Evaluation to BT Search 1 Foundations of Constraint Processing CSCE421/821, Spring
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 1 Ryan Kinworthy CSCE Advanced Constraint Processing.
Solvable problem Deviation from best known solution [%] Percentage of test runs ERA RDGR RGR LS Over-constrained.
Constraint Satisfaction Problems
Foundations of Constraint Processing, Fall 2005 October 20, 2005Ordering heuristics1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
Constraint Satisfaction Problems
Foundations of Constraint Processing, Fall 2005 Sep 20, 2005BT: A Theoretical Evaluation1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
A Constraint Satisfaction Problem (CSP) is a combinatorial decision problem defined by a set of variables, a set of domain values for these variables,
M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2.
General search strategies: Look-ahead Chapter 5 Chapter 5.
Chapter 5 Outline Formal definition of CSP CSP Examples
MAC and Combined Heuristics: Two Reasons to Forsake FC (and CBJ?) on Hard Problems Christian Bessière and Jean-Charles Régin Presented by Suddhindra Shukla.
4/18/2005EE5621 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 7, 4/25/2005 University of Washington, Department of Electrical Engineering Spring.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 2 Ryan Kinworthy CSCE Advanced Constraint Processing.
Foundations of Constraint Processing, Fall 2004 November 18, 2004More on BT search1 Foundations of Constraint Processing CSCE421/821, Fall 2004:
Constraint Satisfaction Read Chapter 5. Model Finite set of variables: X1,…Xn Variable Xi has values in domain Di. Constraints C1…Cm. A constraint specifies.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Problem Solving with Constraints Lookahead Schemas 1 Foundations of Constraint Processing CSCE496/896, Fall
Chapter 5 Constraint Satisfaction Problems
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Foundations of Constraint Processing, Fall 2004 October 3, 2004Interchangeability in CSPs1 Foundations of Constraint Processing CSCE421/821, Fall 2004:
Problem Solving with Constraints Intelligent Backtracking Algorithms 1 Problem Solving with Constraints CSCE496/896, Fall2011:
Foundations of Constraint Processing, Spring 2009 Structure-Based Methods: An Introduction 1 Foundations of Constraint Processing CSCE421/821, Spring 2009.
Contents 1 Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem Hyoung rae Kim Debasis Mitra Ph.D Florida Institute.
Foundations of Constraint Processing, Spring 2008 Intelligent Backtracking AlgorithmsApril 16, Foundations of Constraint Processing CSCE421/821,
Shortcomings of Traditional Backtrack Search on Large, Tight CSPs: A Real-world Example Venkata Praveen Guddeti and Berthe Y. Choueiry The combination.
Cbj. What’s a csp? a set of variables each with a domain of values a collection of constraints (I’m going to assume binary for the present) assign each.
I am a senior lecturer at Glasgow
543 cbj fans can’t be wrong.
An Empirical Study of the Performance
Empirical Comparison of Preprocessing and Lookahead Techniques for Binary Constraint Satisfaction Problems Zheying Jane Yang & Berthe Y. Choueiry Constraint.
I am a senior lecturer at Glasgow
Foundations of Constraint Processing
CSP Search Techniques Backtracking Forward checking
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Foundations of Constraint Processing All questions to Piazza
Evaluation of (Deterministic) BT Search Algorithms
Lookahead Schemas Foundations of Constraint Processing
Intelligent Backtracking Algorithms
Constraints and Search
Chapter 5: General search strategies: Look-ahead
Evaluation of (Deterministic) BT Search Algorithms
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Problem Solving With Constraints
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Artificial Intelligence
Foundations of Constraint Processing All questions to Piazza
Evaluation of (Deterministic) BT Search Algorithms
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Presentation transcript:

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking1 Foundations of Constraint Processing CSCE421/821, Fall 2005: Berthe Y. Choueiry (Shu-we-ri) Avery Hall, Room 123B Tel: +1(402) Intelligent Backtracking Algorithms

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking2 Reading Required reading Hybrid Algorithms for the Constraint Satisfaction Problem [Prosser, CI 93] Recommended reading –Chapters 5 and 6 of Dechter’s book –Tsang, Chapter 5 Notes available upon demand –Notes of Fahiem Bacchus: Chapter 2, Section 2.4 –Handout 4 and 5 of Pandu Nayak (Stanford)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking3 Outline Review of terminology of search Hybrid backtracking algorithms Looking ahead Evaluation of (deterministic) BT search algorithms

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking4 Backtrack search (BT) Variable/value ordering Variable instantiation (Current) path Current variable Past variables Future variables Shallow/deep levels /nodes Search space / search tree Back-checking Backtracking

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking5 Outline Review of terminology of search Hybrid backtracking algorithms –Vanilla: BT –Improving back steps: {BJ, CBJ} –Improving forward step: {BM, FC} Looking ahead Evaluation of (deterministic) BT search algorithms

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking6 Two main mechanisms in BT 1.Backtracking: To recover from dead-ends To go back 2.Consistency checking: To expand consistent paths To move forward

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking7 To recover from dead-ends 1.Chronological (BT) 2.Intelligent Backjumping (BJ) Conflict directed backjumping (CBJ) With learning algorithms (Dechter Chapt 6.4) Etc.

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking8 Consistency checking To expand consistent paths 1.Back-checking: against past variables Backmarking (BM) 2.Look-ahead: against future variables Forward checking (FC) (partial look-ahead) Directional Arc-Consistency (DAC) (partial look-ahead) Maintaining Arc-Consistency (MAC) (full look-ahead)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking9 Hybrid algorithms Backtracking + checking = new hybrids BTBJCBJ BMBMJBM-CBJ FCFC-BJFC-CBJ Evaluation: Empirical: Prosser instances of Zebra Theoretical: Kondrak & Van Beek 95

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking10 Notations (in Prosser’s paper) Variables: V i, i in [1, n] Domain: D i = {v i1, v i2, …,v iMi } Constraint between V i and V j : C i,j Constraint graph: G Arcs of G: Arc(G) Instantiation order (static or dynamic) Language primitives: list, push, pushnew, remove, set-difference, union, max-list

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking11 Main data structures v: a (1xn) array to store assignments –v[i] gives the value assigned to i th variable –v[0]: pseudo variable (root of tree), backtracking to v[0] indicates insolvability domain[i]: a (1xn) array to store the original domains of variables current-domain[i]: a (1xn) array to store the current domains of variables –Upon backtracking, current-domain[i] of future variables must be refreshed check(i,j): a function that checks whether the values assigned to v[i] and v[j] are consistent

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking12 Generic search: bcssp 1.Procedure bcssp (n, status) 2.Begin 3.consistent  true 4.status  unknown 5.i  1 6.While status = unknown 7.Do Begin 8.If consistent 9.Then i  label (i, consistent) 10.Else i  unlabel (i, consistent) 11.If i > n 12.Then status  “solution” 13.Else If i=0 then status  “impossible” 14.End 15.End Forward move: x-label Backward move: x-unlabel Parameters: current variable, Boolean Return: new current variable

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking13 Chronological backtracking (BT) Uses bt-label and bt-unlabel When v[i] is assigned a value from current-domain[i], we perform back-checking against past variables (check(i,k)) If back-checking succeeds, bt-label returns i+1 If back-checking fails, we remove the assigned value from current-domain[i], assign the next value in current- domain[i], etc. If no other value exists, v[i-1] is un-instantiated and we seek a new value for it… (notation: in general v[h]) For all future variables j: current-domain[j] = domain[j] For all past variables g: current-domain[g]  domain[g]

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking14 BT-label 1.Function bt-label(i,consistent): INTEGER 2.BEGIN 3.consistent  false 4.For v[i]  each element of current-domain[i] while not consistent 5.Do Begin 6.consistent  true 7.For h  1 to (i-1) While consistent 8.Do consistent  check(i,h) 9.If not consistent 10.Then current-domain[i]  remove(v[i], current-domain[i]) 11.End 12.If consistent then return(i+1) ELSE return(i) 13.END Terminates: consistent=true, return i+1 consistent=false, current- domain[i]=nil, returns i

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking15 BT-unlabel 1.FUNCTION bt-unlabel(i,consistent):INTEGER 2.BEGIN 3.h  i -1 4.current-domain[i]  domain[i] 5.current-domain[h]  remove(v[h],current-domain[h]) 6.consistent  current-domain[h]  nil 7.return(h) 8.END Is called when consistent=false and current-domain[i]=nil Selects v h to backtrack to Uninstantiates all variables between v h and v i Removes v[h] from current-domain [h] Sets consistent to true if current-domain[h]  0 Returns h

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking16 Example: BT (the dumbest example ever) {1,2,3,4,5} V2 V1 V3 V4 V5 C V3,V4 ={(V3=1,V4=3)} C V2,V5 ={(V2=5,V5=1),(V2=5,V5=4)} - v[1] v[2] v[3] v[4] v[5] v[0] etc…

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking17 Outline Review of terminology of search Hybrid backtracking algorithms –Vanilla: BT –Improving back steps: BJ, CBJ –Improving forward step: BM, FC Looking ahead Evaluation of (deterministic) BT search algorithms

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking18 Danger of BT: thrashing BT assumes that the instantiation of v[i] was prevented by a bad choice at (i-1). It tries to change the assignment of v[i-1] When this assumption is wrong, we suffer from thrashing (exploring ‘barren’ parts of solution space) Backjumping (BT) tries to avoid that –Jumps to the reason of failure –Then proceeds as BT

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking19 Backjumping (BJ) Tries to reduce thrashing by saving some backtracking effort When v[i] is instantiated, BJ remembers v[h], the deepest node of past variables that v[i] has checked against. Uses: max-check[i], global, initialized to 0 At level i, when check(i,h) succeeds max-check[i]  max(max-check[i], h) If current-domain[h] is getting empty, simple chronological backtracking is performed from h –BJ jumps then steps! i h-1 h h h Current variable Past variable

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking20 BJ: label/unlabel bj-label: same as bt-label, but updates max-check[i] bj-unlabel, same as bt-unlabel but –Backtracks to h = max-check[i] –Resets max-check[j]  0 for j in [h+1,i]  Important: max-check is the deepest level we checked against, could have been success or could have been failure i h-1 h h h

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking21 Example: BJ 2 {1,2,3,4,5} V2 V1 V3 V4 V5 C V2,V4 ={(V2=1,V4=3)} C V1,V5 ={(V1=1,V5=2)} C V2,V5 ={(V2=5,V5=1)} - v[1] v[2] v[3] v[4] v[5] v[0] = Max-check[1] = 0 Max-check[2] = 1 max-check[4] = 3 max-check[5] = 2 V4=1, fails for V2, mc=2 V4=2, fails for V2, mc=2 V4=3, succeeds V5=1, fails for V1, mc=1 V5=2, fails for V2, mc=2 V5=3, fails for V1 V5=4, fails for V1 V5=5, fails for V1

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking22 Conflict-directed backjumping (CBJ) Backjumping –jumps from v[i] to v[h], –but then, it steps back from v[h] to v[h-1]  CBJ improves on BJ –Jumps from v[i] to v[h] –And jumps back again, across conflicts involving both v[i] and v[h] –To maintain completeness, we jump back to the level of deepest conflict

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking23 CBJ: data structure Maintains a conflict set: conf-set conf-set[i] are first initialized to {0} At any point, conf-set[i] is a subset of past variables that are in conflict with i {0} conf-set[g] conf-set[h] conf-set[i] g h-1 h i conf-set

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking24 CBJ: conflict-set {x} {3} {1, g, h} {0} conf-set[g] conf-set[h] conf-set[i] g h-1 h Current variable i Past variables {3,1, g} {x, 3,1} When a check(i,h) fails conf-set[i]  conf-set[i]  {h} When current-domain[i] empty 1.Jumps to deepest past variable h in conf-set[i] 2.Updates conf-set[h]  conf-set[h]  (conf-set[i] \{h}) Primitive form of learning (while searching)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking25 Example CBJ {1,2,3,4,5} V2 V1 V3 V4 V5 {(V1=1, V6=3)} - v[1] v[2] v[3] v[4] v[6] v[0] = conf-set[1] = {0} conf-set[2] = {0} conf-set[3] = {0} {(V4=5, V6=3)} {(V2=1, V4=3), (V2=4, V4=5)} conf-set[6] = {1} {1,2,3,4,5} V6 {(V1=1, V5=3)} conf-set[4] = {2} v[5] 213 conf-set[6] = {1} conf-set[6] = {1,4} conf-set[4] = {1, 2} conf-set[5] = {1}

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking26 Backtracking: summary Chronological backtracking –Steps back to previous level –No extra data structures required Backjumping –Jumps to deepest checked-against variable, then steps back –Uses array of integers: max-check[i] Conflict-directed backjumping –Jumps across deepest conflicting variables –Uses array of sets: conf-set[i]

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking27 Outline Review of terminology of search Hybrid backtracking algorithms –Vanilla: BT –Improving back steps: BJ, CBJ –Improving forward step: BM, FC Looking ahead Evaluation of (deterministic) BT search algorithms

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking28 Backmarking: goal Tries to reduce amount of consistency checking Situation: –v[i] about to be re-assigned k –v[i]  k was checked against v[h]  g –v[h] has not been modified v[h] = g v[i] k k

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking29 BM: motivation Two situations 1.Either (v[i]=k,v[h]=g) has failed  it will fail again 2.Or, (v[i]=k,v[h]=g) was founded consistent  it will remain consistent v[h] = g v[i] k k  v[h] = g v[i] k k In either case, back-checking effort against v[h] can be saved!

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking30 Data structures for BM: 2 arrays Number of variables n max domain size m Number of variables n maximum checking level: mcl (n x m) Minimum backup level: mbl (n x 1)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking31 Maximum checking level Number of variables n max domain size m mcl[i,k] stores the deepest variable that v[i]  k checked against mcl[i,k] is a finer version of max-check[i]

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking32 Minimum backup level Number of variables n mbl[i] gives the shallowest past variable whose value has changed since v[i] was the current variable BM (and all its hybrid) do not allow dynamic variable ordering

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking33 When mcl[i,k]=mbl[i]=j v[i] k k v[j] mbl[i] = j BM is aware that The deepest variable that (v[i]  k) checked against is v[j] Values of variables in the past of v[j] (h<j) have not changed So We do need to check (v[i]  k) against the values of the variables between v[j] and v[i] We do not need to check (v[i]  k) against the values of the variables in the past of v[j]

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking34 Type a savings v[h] v[i] k k v[j] mcl[i,k]=h mcl[i,k] < mbl[i]=j When mcl[i,k] < mbl[i], do not check v[i]  k because it will fail

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking35 Type b savings h v[i] k k v[j] v[g] mcl[i,k]=g mbl[i] = j mcl[i,k]  mbl[i] When mcl[i,k]  mbl[i], do not check (i,h<j) because they will succeed

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking36 Hybrids of BM mcl can be used to allow backjumping in BJ Mixing BJ & BM yields BMJ –avoids redundant consistency checking (types a+b savings) and –reduces the number of nodes visited during search (by jumping) Mixing BM & CBJ yields BM-CBJ

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking37 Problem of BM and its hybrids: warning v[m] v[g] v[h] v[i] v[g] v[h] v[i] v[m] v[g] v[h] v[i] v[h] v[f] Backjumping from v[i]: –v[i] backjumps up to v[g] Backmarking of v[h]: –When reconsidering v[h], v[h] will be checked against all f in [m,g( –effort could be saved  Phenomenon will worsen with CBJ Problem fixed by Kondrak & van Beek 95 BMJ enjoys only some of the advantages of BM Assume: mbl[h] = m and max-check[i]=max(mcl[i,x])=g

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking38 Forward checking (FC) Looking ahead: from current variable, consider all future variables and clear from their domains the values that are not consistent with current partial solution FC makes more work at every instantiation, but will expand fewer nodes When FC moves forward, the values in current-domain of future variables are all compatible with past assignment, thus saving backchecking FC may “wipe out” the domain of a future variable (aka, domain annihilation) and thus discover conflicts early on. FC then backtracks chronologically Goal of FC is to fail early (avoid expanding fruitless subtrees)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking39 FC: data structures v[i] v[k] v[l] v[n] v[m] v[j] When v[i] is instantiated, current-domain[j] are filtered for all j connected to i and i<j<n reduction[j] store sets of values remove from current-domain[j] by some variable before v[j] reductions[j] = {{a, b}, {c, d, e}, {f, g, h}} future-fc[i]: subset of the future variables that v[i] checks against (redundant) future-fc[i] = {k, j, n} past-fc[i]: past variables that checked against v[j] All these sets are treated like stacks

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking40 Forward Checking: functions check-forward undo-reductions update-current-domain fc-label fc-unlabel

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking41 FC: functions check-forward(i,j) is called when instantiating v[i] –It performs REVISE(j,i) –Returns false if current-domain[j] is empty, true otherwise –Values removed from current-domain[j] are pushed, as a set, into reductions[j] These values will be popped back if we have to backtrack over v[i] (undo-reductions)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking42 FC: functions update-current-domain –current-domain[i]  domain[i] \ reductions[i] –actually, we have to iterate over reductions=set of sets fc-label –Attempts to instantiate current-variable –Then filters domains of all future variables (push into reductions) –Whenever current-domain of a future variable is wiped-out: v[i] is un-instantiated and domain filtering is undone (pop reductions)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking43 Hybrids of FC FC suffers from thrashing: it is based on BT FC-BJ: –max-check is integrated in fc-bj-label and fc-bj-unlabel –Enjoys advantages of FC and BJ… but suffers malady of BJ (jump the step) FC-CBJ: –Best algorithm for far (assuming static variable ordering) –fc-cbj-label and fc-cbj-unlabel

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking44 Consistency checking: summary Chronological backtracking –Uses back-checking –No extra data structures Backmarking –Uses mcl and mbl –Two types of consistency-checking savings Forward-checking –Works more at every instantiation, but expands fewer subtrees –Uses: reductions[i], future-fc[i], past-fc[i]

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking45 Experiments Empirical evaluations on Zebra –Representative of design/scheduling problems –25 variables, 122 binary constraints –Permutation of variable ordering yields new search spaces –Variable ordering: different bandwidth/induced width of graph 450 problem instances were generated Each algorithm was applied to each instance Experiments were carried out under static variable ordering

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking46 Analysis of experiments Algorithms compared with respect to: 1.Number of consistency checks (average) FC-CBJ < FC-BJ < BM-CBJ < FC < CBJ < BMJ < BM < BJ < BT 2.Number of nodes visited (average) FC-CBJ < FC-BJ < FC < BM-CBJ < BMJ =BJ < BM = BT 3.CPU time (average) FC-CBJ < FC-BJ < FC < BM-CBJ < CBJ < BMJ < BJ < BT < BM FC-CBJ apparently the champion

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking47 Additional developments Other backtracking algorithms exist: –Graph-based backjumping (GBJ), etc. [Dechter] –Pseudo-trees [Freuder 85] Other look-ahead techniques exist: –DAC, MAC, etc. More empirical evaluations: –over randomly generated problems Theoretical evaluations: –Based on approach of Kondrak & Van Beek IJCAI’95

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking48 Outline Review of terminology of search Hybrid backtracking algorithms Looking ahead –Forward checking (FC) –Directional Arc Consistency (DAC) –Maintaining Arc Consistency (a.k.a. full arc- consistency) Evaluation of (deterministic) BT search algorithms

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking49 Looking ahead Rationale: –As decisions are made (conditioning), Revise the domain of future variables to propagate the effects of decisions I.e., eliminate inconsistent choices in future sub-problem –Domain annihilation of a future variable avoids expansion of useless portions of the tree Techniques –Partial: forward-checking (FC), directional arc- consistency (DAC) –Full: Maintaining arc-consistency (MAC) –Use: Revise (V f, V c ), V f future variable, V c current variable

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking50 Revising the domain of Vi Revising the domain of V i given a constraint C on V i (i.e., V i  Scope (C)) General notation: Revise (V i,C) In a binary CSP: Revise (V i,C)= Revise (V i,C Vi,Vj )= Revise (V i, V j )

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking51 Revise (V i, V j ) 1.  x  D Vi 2.  y  D Vj 3. If  y  D Vj with (x,y)  C return() 4. ElseIf D Vi  D Vi \ {x} NOTE: only D Vi may be updated

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking52 Domain filtering in lookahead V c current variable V f future variable {V f } all future variables Revise (V f, V c ) FC (V c ): 1.  V f  {V f } connected to V c 2. Revise (V f,V c ) 3. If D Vf ={} then return(failure)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking53 FC: DAC: –assumes a fixed variable ordering d MAC: –does more pruning at the cost of more consistency checks Look-ahead techniques: FC, DAC, MAC FC (V c );  V f  {V f }, FC (V f ) in the ordering d FC (V c ); AC ({V f }) FC (V c ) FC (V c ); Repeat until quiescence or failure  V f1,V f2  {V f }, Revise (V f1,V f2 )

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking54 Terminology overload alert: FC FC is used to denote any of the following: –a partial look-ahead schema –a specific chronological backtrack search algorithm that uses the partial look-ahead schema Meaning is inferred from context Not a healthy situation, but a reality Advice: state upfront the meaning of your terms and stick to them throughout your paper

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking55 Outline Review of terminology of search Hybrid backtracking algorithms Looking ahead Evaluation of (deterministic) BT search algorithms [Dechter, 6.6.2] –CSP parameters –Comparison criteria –Theoretical evaluations –Empirical evaluations

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking56 CSP parameters Number of variables: n Domain size: a, d Constraint tightness: t = |forbidden tuples| / | all tuples | Proportion of constraints (a.k.a., constraint density, constraint probability): p 1 = e / e max, e is nbr of constraints

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking57 Comparison criteria 1.Number of nodes visited (NV) Every time you call label 2.Number of constraint check (CC) Every time you call check(i,j) 3.CPU time Be as honest and consistent as possible 4.Some specific criterion for assessing the quality of the improvement proposed Presentation of values: Average or median of criterion (qualified) run-time distribution Solution-quality distribution

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking58 Theoretical evaluations Comparing NV and/or CC Common assumptions: –for finding all solutions –static orderings

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking59 Empirical evaluation: data sets Use real-data sets (anecdotal evidence) Use benchmarks (csp library) Use randomly generated problems

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking60 Empirical evaluations: random problems Various models exist (use Model B) –Models A, B, C, E, F, etc. Vary parameters: –Number of variables: n –Domain size: a, d –Constraint tightness: t = |forbidden tuples| / | all tuples | –Proportion of constraints (a.k.a., constraint density, constraint probability): p 1 = e / e max Issues: –Uniformity –Difficulty (phase transition) –Solvability of instances (for incomplete search techniques)

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking61 Model B 1.Input: n, a, t, p1 2.Generate n nodes 3.Generate a list of n 2 tuples of all combinations of 2 nodes 4.Choose e elements from above list as constraints to between the n nodes 5.If the graph is not connected, throw away, go back to step 4, else proceed 6.Generate a list of a 2 tuples of all combinations of 2 values 7.For each constraint, choose randomly a number of tuples from the list to guarantee tightness t for the constraint

Foundations of Constraint Processing, Fall 2005 September 11, 2005Backtracking62 Example: MAC vs. FC Reference: [Sabin & Freuder, ECAI94], [Bessière & Régin, CP97], [Sabin & Freuder, CP97], [Gent & Prosser, APES ], [Experiments by Lin XU, 2001], [Yang, MS thesis 2003] Results: (sketchy) Low tightnessHigh tightness Low density (sparse) FCMAC High density (dense) FC Note: results depend on Variable ordering (static vs. dynamic) Problem difficulty (positive relative to crossover point)