Constraint processing An efficient alternative for search.

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Heuristic Search techniques
Constraint Based Reasoning over Mutex Relations in Graphplan Algorithm Pavel Surynek Charles University, Prague Czech Republic.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
PROBLEM SOLVING AND SEARCH
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
CSC 423 ARTIFICIAL INTELLIGENCE
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Best-First Search: Agendas
Backtracking COP Backtracking  Backtracking is a technique used to solve problems with a large search space, by systematically trying and eliminating.
Backtracking What is backtracking?
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
1 Optimisation Although Constraint Logic Programming is somehow focussed in constraint satisfaction (closer to a “logical” view), constraint optimisation.
Constraint Satisfaction CSE 473 University of Washington.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 1 Ryan Kinworthy CSCE Advanced Constraint Processing.
Constraint Satisfaction Problems
Foundations of Constraint Processing, Fall 2005 Sep 20, 2005BT: A Theoretical Evaluation1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
Chapter 5 Outline Formal definition of CSP CSP Examples
Constraint Satisfaction Problems
Relaxation and Hybrid constraint processing Different relaxation techniques Some popular hybrid techniques.
HISTORY The problem was originally proposed in 1848 by the chess player Max Bezzel, and over the years, many mathematicians, including Gauss have worked.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Honors Track: Competitive Programming & Problem Solving Optimization Problems Kevin Verbeek.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
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.
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.
Constraint processing An efficient alternative for search.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
Biointelligence Lab School of Computer Sci. & Eng. Seoul National University Artificial Intelligence Chapter 8 Uninformed Search.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
CSG3F3/ Desain dan Analisis Algoritma
Automatic Test Generation
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Computer Science cpsc322, Lecture 13
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Constraint Satisfaction
Constraint Satisfaction
Problem Solving by Searching
Empirical Comparison of Preprocessing and Lookahead Techniques for Binary Constraint Satisfaction Problems Zheying Jane Yang & Berthe Y. Choueiry Constraint.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Satisfaction Problems
Constraints and Search
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Constraint satisfaction problems
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Artificial Intelligence
Graphplan/ SATPlan Chapter
Graphplan/ SATPlan Chapter
CS 8520: Artificial Intelligence
Search.
Search.
Intelligent Backtracking Algorithms: A Theoretical Evaluation
Constraint Satisfaction Problems
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Basic Search Methods How to solve the control problem in production-rule systems? Basic techniques to find paths through state- nets. For the moment: -
Presentation transcript:

Constraint processing An efficient alternative for search

2 Constraint Processing: Overview  Illustrating the idea with examples:  Numerical constraint nets, Spreadsheets  Defining constraint problems  Techniques for solving them:  A variety of backtracking techniques  Consistency and relaxation  Hybrid constraint techniques  Some applications:  Understanding line drawings  Disambiguating natural language

X A B X CD Variable box Multiply box 1.1 Ex.: Numerical constraint nets Given any set of equations: There is an associated constraint net: C = A * B D = C * B B =

X A B X CD Variable box Multiply box 1.1 There is an associated constraint net: Numerical constraint nets (2)

5 Example: Spreadsheets AB 1Ratio X Ratio Y th year 5Income X Income Y Expenses 9000 CD 2 nd year3 rd year 8Total = B1 * B5 = B1 * C5 = B2 * B6= B2 * C6 = B7 = C7 = B5+B6 -B7 = C5+C6 - C7 =D5+D6 -D7

6 Spreadsheets (2) AB 1Ratio X Ratio Y th year 5Income X Income Y Expenses 9000 CD 2 nd year3 rd year 8Total = B1 * B5 = B1 * C5 = B2 * B6= B2 * C6 = B7 = C7 = B5+B6 -B7 = C5+C6 - C7 =D5+D6 -D7 = B1 * B5 = B1 * C = B2 * B6= B2 * C = B7 = C B7 - C7 -D7 = B5+B6= C5+C6=D5+D

X A B X CD Variable box Multiply box 1.1 There is an associated constraint net: Numerical constraint nets (3) 3630 OR OR

Defining Constraint problems Definition File rouge

9 Defining Constraint problems  Definition: A constraint problem (or consistent labeling problem) consists of:  a finite set of variables: z1, z2, …, zn  for each variable: an associated finite domain of possible values di = {ai 1,ai 2, …, ai ni }  for each two variables zi, zj, i  j, a constraint c(zi, zj)  ex.: zi  zj  zi + i  zj - j  we restrict ourselves to binary CPS  Problem: build efficient techniques to assign to each zi a value ai j from its domain di such that all c(zi, zj) are true.

10 Example: q-queens: … is a solution  Given: a q X q chess board  Problem: find (all possible) ways of placing q queens on the board, such that no 2 queens attack each other.  4-queens:

11 Confused q-queens: = identical, BUT each 2 queens MUST attack each other.  C-4-queens:

12 Constraint formulation?  Q-queens and C-q-queens define a set of constraint problems:  depends on choice of domains, constraints  One possibility:  for each queen: a variable zi  for each zi, domain di is all possible board positions:  di = { (1,1), (1,2), …, (1,q), (2,1), (2,2), … }  c(zi, zj) = row(zi)  row(zj)  col(zi)  col(zj)  |row(zi) - row(zj)|  |col(zi) - col(zj)|

13 A ‘better’ formulation:  We agree that each queen is placed on a specific row: z1 z2 z3 z41234  for queen on row i: a variable zi  The representation:  for each zi, domain di = { 1, 2, …, q}  c(zi, zj) = zi  zj  |zi - zj|  |i - j|

14 Notes on C-q-queens:  For C-q-queens, the new second representation defines a slightly different problem: … is no longer a solution  Now C-q-queens always has q+2 solutions !  Advantage for complexity studies.  Exception: q = 3: are extra

Representing the search Or-tree representation Constraint Networks

16 The OR-tree representation: Select an order on the variables: z1, z2, …, zn z a1 1 a1 2 … … … … … … … a1 n1 z a2 1 a2 2 … … a2 n2 c(z1,z2) x v … … v c(z1,z2) x v … … v z a3 1 a3 2 … … … a3 n3 c(z1,z3)... v v … … … x c(z1,z3)... v v … … … x c(z2,z3)... x v … … … c(z2,z3)... x v … … …

17 OR-tree: explicitly  For each layer (i) in the OR-tree:  Create a branch for every possible assignment to zi  Verify all constraints c(zj, zi), j  i  If all constraints are satisfied, proceed to level i+1  NOTE: this is only a representation for the search  search itself consists of building a (small) part of this tree (as in search techniques)

18 Constraint Networks z2z1z3 z4 c(z1,z2) c(z1,z4) c(z1,z3) c(z2,z3) c(z3,z4) c(z2,z4) {a1 1, a1 2, …, a1 n1 } {a4 1, a4 2, …, a4 n4 } {a2 1, a2 2, …, a2 n2 } {a3 1, a3 2, …, a3 n3 } + relaxation = select an arc (constraint) and remove the inconsistent domain values

19 z2 z1 z3 z4 c(z1,z2) c(z1,z4) c(z1,z3) c(z2,z3) c(z3,z4) c(z2,z4) {a1 1, a1 2, …, a1 n1 } {a4 1, a4 2, …, a4 n4 } {a2 1, a2 2, …, a2 n2 } {a3 1, a3 2, …, a3 n3 } Relaxation: c(z1,z4) a4 1 c(a1 i, a4 1 ) is never true!

Backtrack algorithms Chronological Backtracking BackjumpingBackmarking Intelligent Backtracking Dynamic Search Rearrangement

21 Example: 4-queens: Chronological Backtracking Traverse the OR-tree depth-first, left-to-right. z z c(z1,z2).... x c(z1,z2).... x 2 x 3 v z c(z1,z3) x c(z1,z3) x 2 v c(z2,z3) x c(z2,z3) x 3 v x 4 v x 4 v 1 x 2 v v z c(z1,z4) x v v x c(z1,z4) x v v x c(z2,z4) x v c(z2,z4) x v c(z3,z4) x c(z3,z4) x

22 The backtrack algorithm: Backtr( depth ) For k= 1 to n depth do z depth := a depth,k ; z depth := a depth,k ; Check all constraints c(z i, z depth ) Check all constraints c(z i, z depth ) with 1  i  depth until one fails; with 1  i  depth until one fails; If none failed then If none failed then If depth = n then return( z1, z2, …, zn) return( z1, z2, …, zn) End-For End-ForElse depth := depth + 1; depth := depth + 1; Backtr( depth ) ; Backtr( depth ) ; depth := depth - 1; depth := depth - 1; Call : Backtr( 1 ) z depth.... a depth,k c(z1,z depth )... v c(z1,z depth )... v c(z2,z depth )... x c(z2,z depth )... x c(z1,z depth )... v c(z2,z depth )... x c(z1,z depth )... v c(z1,z depth )... v c(z2,z depth )... v c(z2,z depth )... v c(z depth-1,z depth ) v c(z depth-1,z depth ) v z depth+1.. a depth+1,1

Backjumping Avoid trashing

24 Trashing: Example: c-4-queens: z z c(z1,z2).... v c(z1,z2).... v 2 v 3 v z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 4 x z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) x2vv3x4vx1x2vv3x4vx1x2vv3x4vv 1x2vx3x4x 1x2vvv3x4x1x2vx3x4x1x2vx3x4x Only z1 and z2 are tested against the values of z4: z3 is not even considered! Useless to backtrack over z3 ! Redundant computation !

25 Trashing: solution z z c(z1,z2).... v c(z1,z2).... v 2 v 3 v z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 4 x z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) x2vv3x4vx1x2vv3x4vx1x2vv3x4vv 1x2vx3x4x 1x2vvv3x4x1x2vx3x4x1x2vx3x4x Backjump

26 Trashing: Another occurrence z z c(z1,z2).... v c(z1,z2).... v 2 v 3 v z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 4 x z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) x2vv3x4vx1x2vv3x4vx1x2vv3x4vv 1x2vx3x4x 1x2vvv3x4x1x2vx3x4x1x2vx3x4x Backjump

27 Backjumping (Gaschnig’78) If all the assignments to zi fail, If all the assignments to zi fail,  The principle: and c(zk, zi) is the deepest constraint causing the fail Then backjump to change the assignment of zk zi ai 1 ai 2... ai ni c(z1,zi) x v v x c(z1,zi) x v v x c(z2,zi) x v c(z2,zi) x v c(zk,zi) x c(zk,zi) x … … all fail ! deepest fail-level: k

28 The backjump algorithm: BackJ( depth, out: jumpback ) For k= 1 to n depth do z depth := a depth,k ; z depth := a depth,k ; Check all constraints c(z i, z depth ) Check all constraints c(z i, z depth ) with 1  i  depth until one fails; with 1  i  depth until one fails; If none failed then If none failed then If depth = n then return( z1, z2, …, zn) return( z1, z2, …, zn) End-For End-For c(z1,z depth )... v c(z1,z depth )... v c(z2,z depth )... x c(z2,z depth )... x z depth.... a depth,k checkdepth k = 2 z depth.... a depth,l c(z1,z depth )... v c(z1,z depth )... v c(z2,z depth )... v c(z2,z depth )... v c(z m,z depth )... x c(z m,z depth )... x checkdepth l = m checkdepth k := deepest i checked; Else depth := depth + 1; depth := depth + 1; BackJ( depth, jumpback); BackJ( depth, jumpback); depth := depth - 1; depth := depth - 1; If jumpback  depth then return; If jumpback  depth then return; jumpback := max(checkdepth k )

Backmarking Avoiding other redundancies

30 More redundant checks: z z c(z1,z2).... v c(z1,z2).... v 2 v 3 v z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 4 x z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) x2vv3x4vx1x2vv3x4vx1x2vv3x4vv 1x2vx3x4x 1x2vvv3x4x1x2vx3x4x1x2vx3x4x z1 is checked against z3 BUT we only back- track over z2 !

31 Occur very often: z z c(z1,z2).... v c(z1,z2).... v 2 v 3 v z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 4 x z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) x2vv3x4vx1x2vv3x4vx1x2vv3x4vv 1x2vx3x4x 1x2vvv3x4x1x2vx3x4x1x2vx3x4x

32 Trashing compared to Redundant Checks: z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) 1x2vx3x4x Only when a complete BLOCK of checks FAILS. Only when a complete BLOCK of checks FAILS.  Trashing: Also for SUCCESSFUL checks and for the checks performed on 1 ROW only. Also for SUCCESSFUL checks and for the checks performed on 1 ROW only.  Redundant Checks: z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 1x2vv3x4vx1x2vv3x4vx

33 Avoiding redundant checks:  2 approaches: 1. TABULATION:  lemma generation (store results of checks in a table) + lemma application (table look-up for new checks)  improves speed to some extent  but does not really avoid the redundant checks  increases the storage requirements 2. BACKMARKING:  ~ TOTALLY speed saving (no redundant checks)  only limited space-overhead (2 arrays)

34 Backmarking (Gaschnig ‘77):  The 2 arrays: zk.... c(z2,zk).... c(z2,zk).... c(z1,zk).. c(z1,zk).. ak 1 x ak 2 v x … v v … v ak nk v x ak 1 … ak nk c(z k-1,zk) c(z k-1,zk) = checkdepth zk, l. = checkdepth zk, l.  Checkdepth(k,l): checkdepth zk,1 = 1 checkdepth zk,2 = 2 checkdepth zk,… = k-1 checkdepth zk,nk = 2 ak 2

35 Backmarking (Gaschnig ‘77):  The 2nd array: zk.... c(z2,zk).... c(z2,zk).... c(z1,zk).. c(z1,zk).. ak 1 x ak 2 v v … v v … v ak nk v x ak 1 … ak nk c(z k-1,zk) c(z k-1,zk) ak 2 = to which (lowest) level did we backup between visiting these 2 blocks for zk. = to which (lowest) level did we backup between visiting these 2 blocks for zk.  Backup(k): zk-1 zk-2

36 A property of Checkdepth k,l The last check needs to be a FAIL. Otherwise, checking would have continued ! The last check can be either fail or succeed.  If Checkdepth k,l  k-1:  If Checkdepth k,l = k-1: zk.... ak,l zk.... ak,l c(z1,zk).. v c(z2,zk).. v … c(zk-1,zk). x/v zk.... ak,l zk.... ak,l c(z1,zk).. v c(z2,zk).. v … c(zi,zk)... x

37 Properties of Checkdepth versus Backup (1):  If checkdepth (k,l)  backup(k) : checkdepth(k,l) checkdepth(k,l)  k-1 The assignment ak,l to zk caused fail the previous time, and it will cause fail again this time (at the same depth) zk ak,l zk ak,l c(z1,zk)..... v c(z2,zk)..... v … c(zi,zk)......x … c(zk-1,zk) checkdepth(k,l) backup(k)

38 Properties of Checkdepth versus Backup (2):  If checkdepth (k,l)  backup(k) : zk ak,l zk ak,l c(z1,zk)..... v c(z2,zk)..... v … c(zi,zk)......v … c(zj,zk).... v/x c(zj,zk).... v/x checkdepth(k,l) backup(k) All checks for variables zm, with m lower than backup(k) succeeded before and will succeed again.

39 The Backmark algorithm: BackM( depth, out: checkdepth, backup ) For k= 1 to n depth do z depth := a depth,k ; z depth := a depth,k ; Check all constraints c(z i, z depth ) with 1  i  depth until one fails; Check all constraints c(z i, z depth ) with 1  i  depth until one fails; If none failed then If none failed then … … … End-For If checkdepth( depth, k )  backup( depth ) Then1 backup( depth ) *property 1 applied* *property 2 applied*

40 z Backmarking at work: z c(z1,z2).... v c(z1,z2).... v z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. 1x2vv z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... 1x2vx3x4x 3x4vx v 2 v 1x2v 1x2v3x4x vv c(z3,z4) c(z3,z4) x4vx

41 At a much later stage: 3 v 1x2vv3x4vv 1x2vx3x4x1x2vx3x4x z z c(z1,z2).... c(z1,z2).... z3.... c(z2,z3).... c(z2,z3).... c(z1,z3).. c(z1,z3).. z4... c(z1,z4).. c(z1,z4).. c(z2,z4)... c(z2,z4)... c(z3,z4) c(z3,z4) x 3

42 Discussion and results: Note: initial values for checkdepth(k,l) and backup(k) are all 1  Experimental results:  For c-4-queens problem BTBJBMNodes Checks  Overall:  BackMarking = best algorithm (not absolute)  Combining BJ and BM? YES !  But does not produce the combined optimisation.

Intelligent Backtracking A generic framework for improved backward behavior

44 Intelligent Backtracking (Bruynooghe - Pereira ‘80)  =~ Dependency-directed Backtracking (Doyle)   one specific algorithm more: a generic strategy which gives rise to many different algorithms. more: a generic strategy which gives rise to many different algorithms.  Key idea: During the construction of the tree, infer and store “no-goods”, Use the “no-goods” to improve the backward behavior. A set of assignments of values to variables that cannot occur simultaniously in any solution.  A no-good is:

45 Example: 8-queens: z1 z2 z3 z4 z5 z6 z7 z Some simple no-goods, because they violate 1 single constraint: {z1 = 1, z6 = 1} {z3 = 5, z6 = 2} {z2 = 3, z6 = 3} {z4 = 2, z6 = 4} {z3 = 5, z6 = 5} {z1 = 1, z6 = 6} {z2 = 3, z6 = 7} {z3 = 5, z6 = 8} Deduced no-good: { z1 = 1, z2 = 3, z3 = 5, z4 = 2 }

46 Reason: z1 z2 z3 z4 z5 z6 z7 z Deduced no-good: { z1 = 1, z2 = 3, z3 = 5, z4 = 2 } Because with these 4 assignments there is no possibility left for placing z6 !

47 A form of Backjumping: z1 z2 z3 z4 z5 z6 z7 z BUT: Which (basic) no-goods to store? Which other no-goods to infer? Controlproblem! No point in back- tracking over the value of z5, because the reason for failure (the no-good) does not involve z5 ! Backtrack on the deepest variable invol- ved in the failure (z4) instead.

48 Another example: z1 z2 z3 z4 z5 z6 z7 z Some simple no-goods: {z3 = 4, z6 = 1} {z5 = 3, z6 = 2} {z5 = 3, z6 = 3} {z5 = 3, z6 = 4} {z2 = 1, z6 = 5} {z4 = 6, z6 = 6} {z3 = 4, z6 = 7} {z4 = 6, z6 = 8} Deduced no-good: { z2 = 1, z3 = 4, z4 = 6, z5 = 3 }

49 Deals with Backmarking- type of redundancy: z1 z2 z3 z4 z5 z6 z7 z Deduced no-good: { z2=1, z3=4, z4=6, z5=3} Each time this combin- ation occurs again (for other values of z1): don’t check, backtrack !

Dynamic Search rearrangement

51 Dynamic search rearrangement  = any backtrack algorithm +  select the order of the variables in the tree dynamically  Purpose: Decrease the size of the tree due to the “first-fail principle” If assigning a value to zi is more likely to fail than assigning to zj: Then: assing to zi first.  The first-fail principle:

52 Effect?  1. Suppose our guess was right… zi... c(z1,zi).. c(z1,zi).. c(z2,zi).. x c(z2,zi).. x ai1vx…aik x zj... c(z1,zj).. c(z1,zj).. c(z2,zj).. c(z2,zj).. aj1 v vaj2 xajl v v ai1vx…aik xai1vx…aik x zi... c(z1,zi).. c(z1,zi).. c(z2,zi). c(z2,zi). Done Smaller search tree !  … then we gain in any case

53 Effect (2)?  2. Suppose our guess was only partly right … ai1vv…aik xai1vv…aik x zi... c(z1,zi).. c(z1,zi).. c(z2,zi). c(z2,zi). Less checks are redone !  … we still gain: Assingment to zi does not fail, but has less successes ! zj... c(z1,zj).. c(z1,zj).. c(z2,zj).. c(z2,zj).. aj1 v vaj2 xajl v v zi... c(z1,zi).. c(z1,zi).. c(z2,zi).. x c(z2,zi).. x ai1vv…aik x zj... c(z1,zj).. c(z1,zj).. c(z2,zj).. c(z2,zj).. aj1 v vaj2 xajl v v

54 Some general first-fail heuristics:  Select the variable with the smallest domain first decreases the branching factor (less possibilities -> probably less successes)  Select the variable with the highest number of non- trivial constraints first: z2z1z3 z4 c(z1,z2) c(z1,z4) = “true” c(z1,z3) “true” = c(z2,z3) c(z3,z4) = “true” c(z2,z4)  + Heuristics based on problem at hand.