CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro

Size: px
Start display at page:

Download "CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro"

Transcription

1 CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro

2 AI PLANNING APPROACHES SO FAR Goal: Find the (best) sequence of actions that take from a start state to a goal state (under full observability and deterministic assumptions) Atomic state representations: Uninformed/Informed Search algorithms, minimum cost plans, state is indivisible (~black-box) State 1 State 2 State i State n 1 2 i n Doha Tehran Ankara Athens Rome 3564b b b b

3 AI PLANNING APPROACHES SO FAR Goal: Find the (best) sequence of actions that take from a start state to a goal state (under full observability and deterministic assumptions) Factored state representations: Propositional logic, STRIPS language, binary variables, feasibility, Planning Graph, GRAPHPLAN, domain-independent heuristics for informed search algorithms Proposition 1 Proposition 2 vv Proposition i Proposition 1 Proposition 1 Proposition 2 Proposition 2 t=1 vv vv t=2 Proposition i Proposition n t=3 Proposition j Proposition j At(Plane, JFK) In(John, Taxi) Handling(Pen) Having(Cake) Having(Money) 3

4 SO FAR, SOLUTION = PATH TO A GOAL STATE Plan ~ Sequence of actions ~ Path in the state space 4

5 PATH SEARCH VS. SOLUTION STATE SEARCH Factored states (to exploit state structure) State: a set of n variables What if path doesn t matter? (i.e., t disappears ) Goal is not given as an explicit configuration Plan: o Before: Ordered set of actions to reach a givel goal Resulting in a sequence of states, where each state can have a different number of components (e.g., different # of true propositions) o Now: Action set ~ Set of assignment of values to n state variables Simultaneous, in parallel, in any sequence n is fixed, the cardinality of the state set doesn t change State variables ~ Decision variables that need to be set to feasible values o Result of actions/decisions not in conflict with each other Every different assignment of values result into a different state 5

6 PATH SEARCH VS. SOLUTION STATE SEARCH State set = Set of all state variable configurations in terms of values assigned from their domains of definition Each configuration is a potential candidate solution to the problem, but only the feasible ones are the actual solutions to the problem Search in the solution set Feasible state set = Subset of all configurations / assignments that do not violate any constraint A assignment of values to state variable is said consistent if it is feasible Solution / Plan: ~ Consistent assignment to the n state/decision variables 6

7 CHALLENGES IN SOLUTION STATES PROBLEMS Some (most) subsets of assignments can be unfeasible based on a set of given constraints o Challenge: Find even one feasible solution assignment, a goal configuration Feasible solutions are relatively easy to generate, but their number is overwhelming (typically exponential in problem description) and they have different values (cost or objective/reward) o Challenge: Find the best assignment (min cost or max reward) In order to describe the factored problem states, variables of any type can be part of the state description o Challenge: Deal with variables ranging over different, nasty, domains Constraint Satisfaction Problems: Find configurations satisfying (all or the highest number of) constraints Optimization problems: Find optimal configuration (objective/cost) 7

8 CONSTRAINT SATISFACTION PROBLEMS (CSP) Set of decision Variables: V = {V 1,..,V N } Domains: Sets of D i possible values for each variable V i Set of Constraints: C = {C 1,..,C K } restricting the values the variables can simultaneously take (e.g., Not [V 1 =1 V 5 = 3 V 7 = B] ) A constraint consists of: Variable tuple (e.g., (V 1, V 5, V 7 ) ) and: List of (not)feasible values for tuple (e.g., [ (V 2,V 3 ), { (R,B), (R,G) } ]) Or functional relations (e.g., V 2 V 3, V 1 > V 4 + 5) Goal: find an assignment of values to all variables such that no constraint is violated (additional, cost-related goals can be included) Exploiting factored states, a CSP formulation allows useful generalpurpose algorithms with more power than standard search algorithms 8

9 EXAMPLE: N-QUEENS Put n queens on an n n board with no two queens attack each other: not on same row, column, or diagonal State: Position of the n queens, one per column (or row) Variables: Q i position of queen in column i Domains: {1,, 8} Constraints: No queen attack each other Q i = k Q j k, j = 1,, 8, j i Similar constraints for diagonals Q 1 Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Q 8 n = 8 4,426,165,368 state configurations, only 92 feasible 9

10 CSP EXAMPLE: MAP COLORING Given n different colors, color a map so that adjacent areas are different colors 10

11 MAP COLORING Variables WA, NT, Q, NSW, V, T, SA Domain Constraints All region borders have different colors Solutions 11

12 EXAMPLE: SUDOKU Variables: X ij, each open square Domain: {1:9} Constraints: 9-way all diff col 9-way all diff row 9-way all diff box 12

13 JOB SCHEDULING (SPECIFIC CASE) A set of J jobs, J 1,, J n A set of R resources, R 1, R 2,, R m to do the jobs Each job j is a sequence of operations O j 1,..., O j Lj to be scheduled according to process plans: O j 1 O j 2 O j 3. Each operation has a fixed processing time and requires the use of resources R i, a resource can have capacity constraints Each job has a ready time and a due time A resource can only be used by a single operation at a time. All jobs must be completed by a due time. Problem: assign a start time to each job such that all jobs are completed by their due times respecting all constraints 13

14 JOB SCHEDULING 14

15 CLASS SCHEDULING 4 more required classes to graduate A: Algorithms B: Bayesian Learning C: Computer Programming D: Distributed Computing A few restrictions Algorithms must be taken same semester as Distributed computing Computer programming is a prereq for Distributed computing and Bayesian learning, so it must be taken in an earlier semester Advanced algorithms and Bayesian Learning are always offered at the same time, so they cannot be taken the same semester 3 semesters (semester 1,2,3) when can take classes 15

16 DEFINE CSP 4 more required classes to graduate: A, B, C, D A must be taken same semester as D C is a prereq for D and B so must take C earlier than D & B A & B are always offered at the same time, so they cannot be taken the same semester 3 semesters (semester 1,2,3) when can take classes 16

17 DEFINE CSP 4 more required classes to graduate: A, B, C, D A must be taken same semester as D C is a prereq for D and B so must take C earlier than D & B A & B are always offered at the same time, so they cannot be taken the same semester 3 semesters (semester 1,2,3) when can take classes Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, A=D, C < B, C < D 17

18 TYPES OF CSPS Discrete-domain variables (Constraint programming) Finite domains (Map coloring, Sudoku, N-queens, SAT) Our focus! Infinite domains (Integers or strings, deadline-free JSS) Constraint language is needed to understand relations J 1 +d 1 J 2 without enumerating all tuples Integer programming methods deal effectively with (integer, binary) problems with linear constraints Continuous variables (planning, blending, positioning, ) Linear/convex programming for linear/convex constraints 18

19 TYPES OF CONSTRAINTS Unary: involve a single variable Binary: involve two variables n-ary: involve n variables Soft constraints: violation incurs a cost, the problem becomes a constraint optimization one 19

20 CONSTRAINT GRAPH Variables Vertices Constraints Edges A < 2 Unary: Self-edges Binary: regular edges A B n-ary: hyperedges (hypergraphs) nodes with hyperedges are indicated by A > C C B C Q WA NT NS W F T U W R O SA V T C 3 C 2 C 1 20

21 CRYPTARITHMETIC PUZZLES Base-10 arithmetic + TWO TWO = F T U W R O F OU R V = {O,W,T,R,U,F} D = {0,, 9} C 3 C 2 C (O+O) (W+W)+10 2 (T+T) = 10 0 R+10 1 U+10 2 O+10 3 F {O+O = R+10C 1, C 1 +W+W=U+10C 2, C 2 +T+T=O+10C 3, C 3 = F} V = {O,W,T,R,U,F, C 1, C 2, C 3 } Auxiliary vars 21

22 BINARY CONSTRAINT GRAPHS It s always possible to reduce a hypergraph to a binary constraint graph! But this is not always the best thing to do. If you want to know more On the Conversion between Non-Binary and Binary Constraint Satisfaction Problems. Bacchus, F. and van Beek, P. In Proceedings of the 15th AAAI Conference on Artificial Intelligence (AAAI-1998), pages ,

23 SOLVING CSPS: BASIC SEARCH WITH SEARCH ALGORITHMS? States: Partial assignments to the n variables Initial state: Empty state Action: Select an unassigned variable i and assign a feasible value from its domain D i to it (not wrt other vars) Goal test: Assignment consistent (no violations) and complete (all variables assigned) Step cost: Constant Solution is found at depth n, using depth-limited DFS Size of the search tree? 23

24 WHY NOT JUST DO BASIC SEARCH? n = 3 variables each taking d = 3 values??? N 1 = 9 = nd 1?? 2?? 3???1??2??3???1??2??3 11? 12? 13? 1?1 1?2 1?3 21? 22? 23? 2?1 2?2 2?3 31? 32? 33? 3?1 3?2 3?3 11? 21? 31??11?12?13 12? 22? 32??21?22?23 13? 23? 33??31?32?33 1?1 2?1 3?1?11?21?31 1?2 2?2 3?2?12?22?32 1?3 2?3 3?3?13?23?33 N 2 = N 1 n 1 d = nd n 1 d = n n 1 d 2 = = 54 N 3 = N 2 n 2 d = n(n 1)(n 2)d 3 =

25 WHY NOT JUST DO BASIC SEARCH? n = 4 variables each taking d = 4 values Branching factor level 1: b = nd b=(n-1)d nd nodes in level 1 Each of the nd nodes has n 1 d children in level 2 Each of the n 1 d nodes has n 2 d children in level 3 n(n 1)(n 2) (1)d n nodes Generate a search tree of n! d n but only d n assignments are possible! The same states get generated multiple times It doesn t take advantage of the factored state representation! 25

26 COMMUTATIVITY! The order of assigning the variables has no effect on the final outcome CSPs are commutative: Regardless of the assignment order, the same partial solution is reached for a defined set of assignment values Don t care about path! Only a single variable at each node in the search tree needs to be considered!! (can fix the order) d n number of leaves in the search tree! 26

27 COMMUTATIVITY n = 3 variables each taking d = 3 values??? Var 1 N 1 = 3 = d 1?? 2?? 3?? Var 2 11? 12? 13? 21? 22? 23? 31? 32? 33? N 2 = n n = d 2 = 9 Var n N 3 = d 2 = 27 27

28 BACKTRACKING: DFS WITH SINGLE VARIABLE ASSIGNMENTS Only consider a single variable at each point Don t care about path Order of variable assignment doesn t matter, so fix ordering Only consider values which do not conflict with assignments made so far Depth-first search (max depth = n) for CSPs with these two improvements is called backtracking search 28

29 BACKTRACKING Function Backtracking(csp) returns soln or fail o Return Backtrack({}, csp) Function Backtrack(assignment, csp) returns soln or fail o If assignment is complete, return assignment o V i select_unassigned_var(csp) o For each val in order-domain-values(var, csp, assign) If value is consistent with assignment Add [V i = val] to assignment Result Backtrack(assignment, csp) If Result fail, return result Remove [V i = val] from assignments o Return fail 29

30 BACKTRACKING Function Backtracking(csp) returns soln or fail o Return Backtrack({}, csp) Function Backtrack(assignment, csp) returns soln or fail o If assignment is complete, return assignment o V i select_unassigned_var(csp) o For each val in order-domain-values(var, csp, assign) If value is consistent with assignment Add [V i = val] to assignment Result Backtrack(assignment, csp) If Result fail, return result Remove [V i = val] from assignments o Return fail 30

31 BACKTRACKING Does the variable/value order used affect how long backtracking takes to find a solution? Does the variable/value order used affect the solution found by backtracking? 31

32 (A=3) EXAMPLE VARIABLES: A,B,C,D DOMAIN: {1,2,3} CONSTRAINTS: A B, A=D, C < B, C < D VARIABLE ORDER: ALPHABETICAL VALUE ORDER: DESCENDING 32

33 (A=3) EXAMPLE VARIABLES: A,B,C,D DOMAIN: {1,2,3} CONSTRAINTS: A B, A=D, C < B, C < D VARIABLE ORDER: ALPHABETICAL VALUE ORDER: DESCENDING (A=3, B=3) inconsistent with A B (A=3, B=2) (A=3, B=2, C=3) inconsistent with C < B (A=3, B=2, C=2) inconsistent with C < B (A=3, B=2, C=1) (A=3, B=2, C=1,D=3) VALID 33

34 (A=1) EXAMPLE VARIABLES: A,B,C,D DOMAIN: {1,2,3} CONSTRAINTS: A B, A=D, C < B, C < D VARIABLE ORDER: ALPHABETICAL VALUE ORDER: ASCENDING 34

35 (A=1) EXAMPLE VARIABLES: A,B,C,D DOMAIN: {1,2,3} CONSTRAINTS: A B, A=D, C < B, C < D VARIABLE ORDER: ALPHABETICAL VALUE ORDER: ASCENDING (A=1,B=1) inconsistent with A B (A=1,B=2) (A=1,B=2,C=1) (A=1,B=2,C=1,D=1) inconsistent with C < D (A=1,B=2,C=1,D=2) inconsistent with A=D (A=1,B=2,C=1,D=3) inconsistent with A=D 35

36 EXAMPLE VARIABLES: A,B,C,D DOMAIN: {1,2,3} CONSTRAINTS: A B, A=D, C < B, C < D VARIABLE ORDER: ALPHABETICAL VALUE ORDER: ASCENDING (A=1) (A=1,B=1) inconsistent with A B (A=1,B=2) (A=1,B=2,C=1) (A=1,B=2,C=1,D=1) inconsistent with C < D (A=1,B=2,C=1,D=2) inconsistent with A=D (A=1,B=2,C=1,D=3) inconsistent with A=D No valid assignment for D, return result = fail Backtrack to (A=1,B=2,C=) Try (A=1,B=2,C=2) but inconsistent with C < B Try (A=1,B=2,C=3) but inconsistent with C < B No other assignments for C, return result= fail Backtrack to (A=1,B=) (A=1,B=3) (A=1,B=3,C=1) (A=1,B=3,C=1,D=1) inconsistent with C < D (A=1,B=3,C=1,D=2) inconsistent with A = D (A=1,B=3,C=1,D=3) inconsistent with A = D Return result = fail Backtrack to (A=1,B=3,C=) (A=1,B=3,C=2) inconsistent with C < B (A=1,B=3,C=3) inconsistent with C < B No remaining assignments for C, return fail Backtrack to (A=1,B=) No remaining assignments for B, return fail Backtrack to A (A=2) (A=2,B=1) (A=2,B=1,C=1) inconsistent with C < B (A=2,B=1,C=2) inconsistent with C < B (A=2,B=1,C=3) inconsistent with C < B No remaining assignments for C, return fail Backtrack to (A=2,B=?) (A=2,B=2) inconsistent with A B (A=2,B=3) (A=2,B=3,C=1) (A=2,B=3,C=1,D=1) inconsistent with C < D (A=2,B=3,C=1,D=2) ALL VALID 36

37 BACKTRACKING ON MAP COLORING 3-color problem 9 variables, connected as a grid including diagonals Constraint graph has 1-1 correspondence to problem graph 37

38 BACKTRACKING ON MAP COLORING 3-color problem 27 variables, connected as an irregular graph 38

39 ORDERING MATTERS! Function Backtracking(csp) returns soln or fail Return Backtrack({},csp) Function Backtrack(assignment,csp) returns soln or fail If assignment is complete, return assignment V i select_unassigned_var(csp) For each val in order-domain-values(var, csp, assign) If value is consistent with assignment Add [V i = val] to assignment Result Backtrack(assignment,csp) If Result fail, return result Remove [V i = val] from assignments Return fail Any ideas about what might be good orders? 39

40 Next variable? o Random or static ORDERING HEURISTICS o Variable with the fewest legal values: Minimum remaining values (MRV) heuristic (aka the most constrained variable, the fail-first var) o Variable with the largest number of constraints on other unassigned variables, reduces b on future choices (Degree heuristic) Variable s value? o Value that leaves most choices for the neighboring variables in the constraint graph, max flexibility (least-constrainingvalue heuristic), fail-last 40

41 LIMITATIONS OF BACKTRACKING Can an inevitable failure be detected earlier? Can problem structure can be exploited? Can the search space be reduced to speed up computation? CSPs are difficult because what seem like a locally good decision (value assignment to variable) may turn up leading to global inconsistency much later on Pre-process the CSP problem such that local choices are more likely to be globally consistent 41

42 PROPAGATE INFORMATION If we choose a value for one variable, that affects its neighbors And then potentially those neighbors choices propagate We can use this inference to prune the search space. 42

43 Definition: ARC CONSISTENCY An arc (connection between two variables X Y in constraint graph) is consistent if: For every value could assign to X (tail of the arc) There exists some value of Y (head of the arc) that could be assigned without violating the constraint If a variable is not arc consistent with another one, it can be made so by removing some values from its domain. Arc consistency ~ Minimal set of values that can be used for assignments without violating the constraint This can be done recursively Form of constraint propagation that enforces arc consistency, maintains the problem solutions, and prunes the tree! 43

44 ARC CONSISTENCY IN PRACTICE (To-Do-Arcs in the queue) Different arcs, different tails: A B vs. B A 44

45 AC-3 (COMPUTATIONAL COMPLEXITY?) Input: CSP Output: CSP, possible with reduced domains for variables, or inconsistent Local variables: queue, initially queue of all arcs (binary constraints in csp) While queue is not empty (X i, X j ) = Remove-First(queue) [domainx i, anychangetodomainx i ] = Revise(csp, X i, X j ) if anychangetodomainx i == true if size(domainx i ) = 0 else Return csp return inconsistent for each X k in Neighbors(X i ) except X j add (X k, X i ) to queue Function Revise(csp, X i, X j ) returns DomainX i and anychangetodomainx i anychangetodomainx i = false for each x in Domain(X i ) if no value y in Domain(X j ) allows (x, y) to satisfy constraint between (X i, X j ) delete x from Domain(X i ) anychangetodomainx i = true Add arcs (X i, X j ) and (X j, X i ) for i, j constraint D domain values C binary constraints Complexity of revise function? D 2 Number of times can put a constraint in queue? D Total: CD 3 45

46 SUFFICIENT? After we run AC-3 have we always found a solution? (aka only 1 value left for each variable) Yes No 46

47 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) 47

48 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) Constraints both ways: A B, B A, C < B, B > C, C < D, D > C 48

49 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) Constraints both ways: A B, B A, C < B, B > C, C < D, D > C Queue: AB, BA, BC, CB, CD, DC 49

50 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) Constraints both ways: A B, B A, C < B, B > C, C < D, D > C Queue: AB, BA, BC, CB, CD, DC Pop AB: for each x in Domain(A) if no value y in Domain(B) that allows (x,y) to satisfy constraint between (A,B) delete x from Domain(A) No change to domain of A 50

51 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) Constraints both ways: A B, B A, C < B, B > C, C < D, D > C Queue: AB, BA, BC, CB, CD, DC Pop AB Queue: BA, BC, CB, CD, DC 51

52 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) Constraints both ways: A B, B A, C < B, B > C, C < D, D > C Queue: AB, BA, BC, CB, CD, DC Pop AB Queue: BA, BC, CB, CD, DC Pop BA for each x in Domain(B) if no value y in Domain(A) that allows (x,y) to satisfy constraint between (B,A) delete x from Domain(B) No change to domain of B 52

53 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D (subset of constraints from before) Constraints both ways: A B, B A, C < B, B > C, C < D, D > C Queue: AB, BA, BC, CB, CD, DC Queue: BA, BC, CB, CD, DC Queue: BC, CB, CD, DC Pop BC for each x in Domain(B) if no value y in Domain(C) that allows (x,y) to satisfy constraint between (B,C) delete x from Domain(B) If B is 1, constraint B >C cannot be satisfied. So delete 1 from B s domain, B={2,3} Also have to add neighbors of B (except C) back to queue: AB Queue: AB, CB, CD, DC 53

54 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D Queue: AB, BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BC, CB, CD, DC A-D = {1,2,3} Queue: AB, CB, CD, DC B={2,3}, A/C/D = {1,2,3} Pop AB For every value of A is there a value of B such that A B? Yes, so no change 54

55 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D Queue: AB, BA, BC, CB, CD, DC, A-D = {1,2,3} Queue: BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BC, CB, CD, DC A-D = {1,2,3} Queue: AB, CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CB, CD, DC B={2,3}, A/C/D = {1,2,3} Pop CB o For every value of C is there a value of B such that C < B o If C = 3, no value of B that fits o So delete 3 from C s domain, C = {1,2} o Also have to add neighbors of C (except B) back to queue: no change because already in 55

56 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D Queue: AB, BA, BC, CB, CD, DC, A-D = {1,2,3} Queue: BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BC, CB, CD, DC A-D = {1,2,3} Queue: AB, CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CD, DC B={2,3}, C = {1,2} A,D = {1,2,3} Pop CD o For every value of C, is there a value of D such that C < D? o Yes, so no change 56

57 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D Queue: AB, BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BC, CB, CD, DC A-D = {1,2,3} Queue: AB, CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CD, DC B={2,3}, C = {1,2} A,D = {1,2,3} Queue: DC B={2,3}, C = {1,2} A,D = {1,2,3} For every value of D is there a value of C such that D > C? o Not if D = 1 o So D = {2,3} 57

58 AC-3 EXAMPLE Variables: A,B,C,D Domain: {1,2,3} Constraints: A B, C < B, C < D Queue: AB, BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BA, BC, CB, CD, DC A-D = {1,2,3} Queue: BC, CB, CD, DC A-D = {1,2,3} Queue: AB, CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CB, CD, DC B={2,3}, A/C/D = {1,2,3} Queue: CD, DC B={2,3}, C = {1,2} A,D = {1,2,3} Queue: DC B={2,3}, C = {1,2} A,D = {1,2,3} A = {1,2,3} B={2,3}, C = {1,2} D = {2,3} 58

59 REMARKS ON AC Enforcing consistency involves (is equivalent to) adding new constraints: contracting a variable domain by removing one of its values is the same as saying that the variable can t take that value: D(v) = {1,2,3} After AC D(v) = {1,3} is equivalent to add the constraint v 2 Enforcing consistency involves explicitly adding unary constraints that are implicit given the existing binary constraints Unearthing implicit constraints can be also interpreted as inferring new constraints that hold (are entailed ) given existing ones Consistency is a form of inference / entailment computation process Arc consistency as message passing: AC is a propagation algorithm, it s like sending messages to neighbors on the graph. Every time a domain changes, this schedule sending new messages, and repeat until convergence (no changes in domains) 59

60 FORWARD CHECKING: RUNT-TIME INFERENCE AC-3 can ran before the search begins to prune search tree; it operates on the entire search tree (expensive!) It s a form of inference (inferring reductions) It can also be seen as the application of a filter that recursively removes inconsistent values What if, instead, we make (local) inference at run-time? Forward checking: When assign a variable, make all of its neighbors arcconsistent (purely local) Information locally propagates from assigned to unassigned variables Question: Can we do FC on non binary arcs? Yes, but it needs some adjustments Christian Bessière, Pedro Meseguer, Eugene Freuder, Javier Larrosa, On Forward Checking for Non-binary Constraint Satisfaction, In CP 99: 5th Int. Conference on Principles and Practice of Constraint Programming, 60

61 BACKTRACKING + FORWARD CHECKING Function Backtrack(assignment, csp) returns soln or fail o If assignment is complete, return assignment o V i select_unassigned_var(csp) o For each val in order-domain-values(var, csp, assign) If value is consistent with assignment Add [V i = val] to assignment Make domains of all neighbors of V i arc-consistent with [V i = val] Result Backtrack(assignment, csp) If Result fail, return result Remove [V i = val] from assignments o Return fail Note: When backtracking, domains must be restored! 61

62 BACKTRACKING + FORWARD CHECKING ON COLORING 3-color problem 27 variables, connected as an irregular graph 62

63 BACKTRACKING + FORWARD CHECKING ON COLORING 3-color problem 49 variables, connected as an irregular graph but with only local connections 63

64 MAINTAINING ARC CONSISTENCY (MAC) Forward checking doesn t ensure all arcs are consistent, only the local ones, no look-ahead AC-3 can detect failure faster than forward checking The MAC algorithm includes AC-3 in the search, executing it from the arcs of the locally unassigned variables What s the downside? Computation! 64

65 MAINTAINING ARC CONSISTENCY (MAC) Function Backtrack(assignment, csp) returns soln or fail o If assignment is complete, return assignment o V i select_unassigned_var(csp) o For each val in order-domain-values(var, csp, assign) If value is consistent with assignment Add [V i = val] to assignment Run AC-3 to make all variables arc-consistent with [V i = val]. Initial queue is arcs (X j, X i ) of neighbors of X i that are unassigned, but add other arcs if these vars change domains. Result Backtrack(assignment, csp) If Result fail, return result Remove [V i = val] from assignments o Return fail Note: When backtracking, domains must be restored! 65

66 MAC ON COLORING 3-color problem 27 variables, connected as an irregular graph 66

67 MAC ON COLORING 3-color problem 49 variables, connected as an irregular graph but with only local connections 67

68 SUFFICIENT TO AVOID BACKTRACKING? If we do maintain arc consistency (MAC), we will never have to backtrack while solving a CSP True False 68

69 AC LIMITATIONS After running AC-3 o Can have one solution left o Can have multiple solutions left o Can have no solutions left (and not know it) Arc-consistent but no feasible assignment What went wrong here? 69

70 COMPLEXITY CSPs in general are NP-complete Valued, optimization version of CSPs are usually NP-hard Some structured domains, like those with a constraint tree, are easier and can be solved in polynomial time Constraint tree o Any 2 variables in constraint graph connected by <= 1 path Can be solved in time linear in # of variables 70

71 SUMMARY (SO FAR) Be able to define real world CSPs Understand basic algorithm (backtracking) Complexity relative to basic search algorithms Enumerative approach Doesn t require problem specific heuristics Ideas shaping search (ordering heuristics) Pruning space through propagating information Arc consistency Constraint inference: global vs. local Tradeoffs: + reduces search space - computation costs Computational complexity Relevant reading: R&N Chapter 6 71

Lecture 6: Constraint Satisfaction Problems (CSPs)

Lecture 6: Constraint Satisfaction Problems (CSPs) Lecture 6: Constraint Satisfaction Problems (CSPs) CS 580 (001) - Spring 2018 Amarda Shehu Department of Computer Science George Mason University, Fairfax, VA, USA February 28, 2018 Amarda Shehu (580)

More information

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018 DIT411/TIN175, Artificial Intelligence Chapter 7: Constraint satisfaction problems CHAPTER 7: CONSTRAINT SATISFACTION PROBLEMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 30 January, 2018 1 TABLE

More information

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems What is Search For? Assumptions about the world: a single agent, deterministic actions, fully observed state, discrete state space Planning:

More information

CS 343: Artificial Intelligence

CS 343: Artificial Intelligence CS 343: Artificial Intelligence Constraint Satisfaction Problems Prof. Scott Niekum The University of Texas at Austin [These slides are based on those of Dan Klein and Pieter Abbeel for CS188 Intro to

More information

Constraint Satisfaction

Constraint Satisfaction Constraint Satisfaction Philipp Koehn 1 October 2015 Outline 1 Constraint satisfaction problems (CSP) examples Backtracking search for CSPs Problem structure and problem decomposition Local search for

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2013 Soleymani Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition,

More information

CS 188: Artificial Intelligence Fall 2011

CS 188: Artificial Intelligence Fall 2011 Announcements Project 1: Search is due next week Written 1: Search and CSPs out soon Piazza: check it out if you haven t CS 188: Artificial Intelligence Fall 2011 Lecture 4: Constraint Satisfaction 9/6/2011

More information

Constraint Satisfaction. AI Slides (5e) c Lin

Constraint Satisfaction. AI Slides (5e) c Lin Constraint Satisfaction 4 AI Slides (5e) c Lin Zuoquan@PKU 2003-2018 4 1 4 Constraint Satisfaction 4.1 Constraint satisfaction problems 4.2 Backtracking search 4.3 Constraint propagation 4.4 Local search

More information

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides)

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides) Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides) Constraint satisfaction problems What is a CSP? Finite set of variables V, V 2,, V n Nonempty domain of possible values for

More information

Artificial Intelligence Constraint Satisfaction Problems

Artificial Intelligence Constraint Satisfaction Problems Artificial Intelligence Constraint Satisfaction Problems Recall Search problems: Find the sequence of actions that leads to the goal. Sequence of actions means a path in the search space. Paths come with

More information

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm Announcements Homework 4 Due tonight at 11:59pm Project 3 Due 3/8 at 4:00pm CS 188: Artificial Intelligence Constraint Satisfaction Problems Instructor: Stuart Russell & Sergey Levine, University of California,

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. S. Russell and P. Norvig. Artificial Intelligence:

More information

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. Chapter 6 Constraint Satisfaction Problems Chapter 6 Office hours Office hours for Assignment 1 (ASB9810 in CSIL): Sep 29th(Fri) 12:00 to 13:30 Oct 3rd(Tue) 11:30 to 13:00 Late homework policy You get four late

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 5. Constraint Satisfaction Problems CSPs as Search Problems, Solving CSPs, Problem Structure Wolfram Burgard, Bernhard Nebel, and Martin Riedmiller Albert-Ludwigs-Universität

More information

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria Constraint Satisfaction Problems Chapter 5 Example: Map-Coloring Western Northern Territory South Queensland New South Wales Tasmania Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints:

More information

Announcements. CS 188: Artificial Intelligence Fall 2010

Announcements. CS 188: Artificial Intelligence Fall 2010 Announcements Project 1: Search is due Monday Looking for partners? After class or newsgroup Written 1: Search and CSPs out soon Newsgroup: check it out CS 188: Artificial Intelligence Fall 2010 Lecture

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Last update: February 25, 2010 Constraint Satisfaction Problems CMSC 421, Chapter 5 CMSC 421, Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs Chapter 5 2 Constraint satisfaction

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs Chapter 5 2 Constraint satisfaction

More information

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set: Announcements Homework 1: Search Has been released! Due Monday, 2/1, at 11:59pm. On edx online, instant grading, submit as often as you like. Project 1: Search Has been released! Due Friday 2/5 at 5pm.

More information

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems Constraint Satisfaction Problems N variables domain D constraints x 1 x 2 Instructor: Marco Alvarez University of Rhode Island (These slides

More information

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. Chapter 6 Constraint Satisfaction Problems Chapter 6 Constraint Satisfaction Problems A constraint satisfaction problem consists of three components, X, D, and C: X is a set of variables, {X 1,..., X n }. D is a

More information

Constraint Satisfaction Problems Part 2

Constraint Satisfaction Problems Part 2 Constraint Satisfaction Problems Part 2 Deepak Kumar October 2017 CSP Formulation (as a special case of search) State is defined by n variables x 1, x 2,, x n Variables can take on values from a domain

More information

CS 4100 // artificial intelligence

CS 4100 // artificial intelligence CS 4100 // artificial intelligence instructor: byron wallace Constraint Satisfaction Problems Attribution: many of these slides are modified versions of those distributed with the UC Berkeley CS188 materials

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Revised by Hankui Zhuo, March 14, 2018 Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search

More information

CSE 473: Artificial Intelligence

CSE 473: Artificial Intelligence CSE 473: Artificial Intelligence Constraint Satisfaction Luke Zettlemoyer Multiple slides adapted from Dan Klein, Stuart Russell or Andrew Moore What is Search For? Models of the world: single agent, deterministic

More information

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable //7 Review: Constraint Satisfaction Problems Constraint Satisfaction Problems II AIMA: Chapter 6 A CSP consists of: Finite set of X, X,, X n Nonempty domain of possible values for each variable D, D, D

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Section 1 3 Constraint Satisfaction 1 Outline Constraint Satisfaction Problems (CSP) Backtracking search for CSPs Local search for CSPs Constraint Satisfaction

More information

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1 Lecture 18 Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1 Outline Chapter 6 - Constraint Satisfaction Problems Path Consistency & Global Constraints Sudoku Example Backtracking

More information

Chapter 6 Constraint Satisfaction Problems

Chapter 6 Constraint Satisfaction Problems Chapter 6 Constraint Satisfaction Problems CS5811 - Artificial Intelligence Nilufer Onder Department of Computer Science Michigan Technological University Outline CSP problem definition Backtracking search

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Robert Platt Northeastern University Some images and slides are used from: 1. AIMA What is a CSP? The space of all search problems states and actions are atomic goals are

More information

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph Example: Map-Coloring Constraint Satisfaction Problems Western Northern erritory ueensland Chapter 5 South New South Wales asmania Variables, N,,, V, SA, Domains D i = {red,green,blue} Constraints: adjacent

More information

Solving Problems by Searching: Constraint Satisfaction Problems

Solving Problems by Searching: Constraint Satisfaction Problems Course 16 :198 :520 : Introduction To Artificial Intelligence Lecture 6 Solving Problems by Searching: Constraint Satisfaction Problems Abdeslam Boularias Wednesday, October 19, 2016 1 / 1 Outline We consider

More information

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

CS 771 Artificial Intelligence. Constraint Satisfaction Problem CS 771 Artificial Intelligence Constraint Satisfaction Problem Constraint Satisfaction Problems So far we have seen a problem can be solved by searching in space of states These states can be evaluated

More information

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17 CSE 473: Artificial Intelligence Constraint Satisfaction Dieter Fox What is Search For? Models of the world: single agent, deterministic actions, fully observed state, discrete state space Planning: sequences

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems In which we see how treating states as more than just little black boxes leads to the invention of a range of powerful new search methods and a deeper understanding of

More information

Constraint satisfaction problems. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop

Constraint satisfaction problems. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop Constraint satisfaction problems CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop Constraint Satisfaction Problems What is a CSP? Finite set of variables, X 1, X 2,, X n

More information

CS W4701 Artificial Intelligence

CS W4701 Artificial Intelligence CS W4701 Artificial Intelligence Fall 2013 Chapter 6: Constraint Satisfaction Problems Jonathan Voris (based on slides by Sal Stolfo) Assignment 3 Go Encircling Game Ancient Chinese game Dates back At

More information

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe Constraint Satisfaction Problems slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe Standard search problems: State is a black box : arbitrary data structure Goal test

More information

CONSTRAINT SATISFACTION

CONSTRAINT SATISFACTION 9// CONSRAI ISFACION oday Reading AIMA Chapter 6 Goals Constraint satisfaction problems (CSPs) ypes of CSPs Inference Search + Inference 9// 8-queens problem How would you go about deciding where to put

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Constraint Satisfaction Problems Marc Toussaint University of Stuttgart Winter 2015/16 (slides based on Stuart Russell s AI course) Inference The core topic of the following lectures

More information

Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Thursday: Chapter 8

Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Thursday: Chapter 8 Constraint t Satisfaction Problems Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Tuesday: Chapter 7 Thursday: Chapter 8 Outline What is a CSP Backtracking for CSP Local search for

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at http://ai.berkeley.edu.] What is Search

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing search Genetic algorithms Constraint Satisfaction Problems

More information

CS 4100/5100: Foundations of AI

CS 4100/5100: Foundations of AI CS 4100/5100: Foundations of AI Constraint satisfaction problems 1 Instructor: Rob Platt r.platt@neu.edu College of Computer and information Science Northeastern University September 5, 2013 1 These notes

More information

ARTIFICIAL INTELLIGENCE (CS 370D)

ARTIFICIAL INTELLIGENCE (CS 370D) Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) (CHAPTER-6) CONSTRAINT SATISFACTION PROBLEMS Outline What is a CSP CSP applications Backtracking search

More information

Spezielle Themen der Künstlichen Intelligenz

Spezielle Themen der Künstlichen Intelligenz Spezielle Themen der Künstlichen Intelligenz 2. Termin: Constraint Satisfaction Dr. Stefan Kopp Center of Excellence Cognitive Interaction Technology AG A Recall: Best-first search Best-first search =

More information

Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems (CSPs) 1 Hal Daumé III (me@hal3.name) Constraint Satisfaction Problems (CSPs) Hal Daumé III Computer Science University of Maryland me@hal3.name CS 421: Introduction to Artificial Intelligence 7 Feb 2012 Many

More information

CS 188: Artificial Intelligence. Recap: Search

CS 188: Artificial Intelligence. Recap: Search CS 188: Artificial Intelligence Lecture 4 and 5: Constraint Satisfaction Problems (CSPs) Pieter Abbeel UC Berkeley Many slides from Dan Klein Recap: Search Search problem: States (configurations of the

More information

CS 188: Artificial Intelligence Fall 2008

CS 188: Artificial Intelligence Fall 2008 CS 188: Artificial Intelligence Fall 2008 Lecture 4: CSPs 9/9/2008 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore 1 1 Announcements Grading questions:

More information

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens CS 188: Artificial Intelligence Fall 2008 Announcements Grading questions: don t panic, talk to us Newsgroup: check it out Lecture 4: CSPs 9/9/2008 Dan Klein UC Berkeley Many slides over the course adapted

More information

CS 188: Artificial Intelligence Fall 2011

CS 188: Artificial Intelligence Fall 2011 CS 188: Artificial Intelligence Fall 2011 Lecture 5: CSPs II 9/8/2011 Dan Klein UC Berkeley Multiple slides over the course adapted from either Stuart Russell or Andrew Moore 1 Today Efficient Solution

More information

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012 /0/0 CSE 57: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer Space of Search Strategies Blind Search DFS, BFS,

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing search Genetic algorithms Constraint Satisfaction Problems

More information

Constraints. CSC 411: AI Fall NC State University 1 / 53. Constraints

Constraints. CSC 411: AI Fall NC State University 1 / 53. Constraints CSC 411: AI Fall 2013 NC State University 1 / 53 Constraint satisfaction problems (CSPs) Standard search: state is a black box that supports goal testing, application of an evaluation function, production

More information

General Methods and Search Algorithms

General Methods and Search Algorithms DM811 HEURISTICS AND LOCAL SEARCH ALGORITHMS FOR COMBINATORIAL OPTIMZATION Lecture 3 General Methods and Search Algorithms Marco Chiarandini 2 Methods and Algorithms A Method is a general framework for

More information

What is Search For? CS 188: Artificial Intelligence. Example: Map Coloring. Example: N-Queens. Example: N-Queens. Constraint Satisfaction Problems

What is Search For? CS 188: Artificial Intelligence. Example: Map Coloring. Example: N-Queens. Example: N-Queens. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems What is Search For? Assumptions about the world: a single agent, deterministic actions, fully observed state, discrete state space Planning:

More information

Week 8: Constraint Satisfaction Problems

Week 8: Constraint Satisfaction Problems COMP3411/ 9414/ 9814: Artificial Intelligence Week 8: Constraint Satisfaction Problems [Russell & Norvig: 6.1,6.2,6.3,6.4,4.1] COMP3411/9414/9814 18s1 Constraint Satisfaction Problems 1 Outline Constraint

More information

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic.

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic. CS 188: Artificial Intelligence Spring 2010 Lecture 5: CSPs II 2/2/2010 Pieter Abbeel UC Berkeley Many slides from Dan Klein Announcements Project 1 due Thursday Lecture videos reminder: don t count on

More information

Constraint Satisfaction. CS 486/686: Introduction to Artificial Intelligence

Constraint Satisfaction. CS 486/686: Introduction to Artificial Intelligence Constraint Satisfaction CS 486/686: Introduction to Artificial Intelligence 1 Outline What are Constraint Satisfaction Problems (CSPs)? Standard Search and CSPs Improvements Backtracking Backtracking +

More information

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search This lecture topic (two lectures) Chapter 6.1 6.4, except 6.3.3 Next lecture topic (two lectures) Chapter 7.1 7.5 (Please read

More information

Constraint Satisfaction Problems. Some material from: D Lin, J You, JC Latombe

Constraint Satisfaction Problems. Some material from: D Lin, J You, JC Latombe RN, Chapter 5 Constraint Satisfaction Problems Some material from: D Lin, J You, JC Latombe 1 Search Overview Introduction to Search Blind Search Techniques Heuristic Search Techniques Constraint Satisfaction

More information

CMU 15-7/381 CSPs. Teachers: Ariel Procaccia Emma Brunskill (THIS TIME) With thanks to Ariel Procaccia and other prior instructions for slides

CMU 15-7/381 CSPs. Teachers: Ariel Procaccia Emma Brunskill (THIS TIME) With thanks to Ariel Procaccia and other prior instructions for slides CMU 15-7/381 CSPs Teachers: Ariel Prcaccia Emma Brunskill (THIS TIME) With thanks t Ariel Prcaccia and ther prir instructins fr slides Class Scheduling Wes 4 mre required classes t graduate A: Algrithms

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Constraint satisfaction problems Backtracking algorithms for CSP Heuristics Local search for CSP Problem structure and difficulty of solving Search Problems The formalism

More information

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence,

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence, Course on Artificial Intelligence, winter term 2012/2013 0/35 Artificial Intelligence Artificial Intelligence 3. Constraint Satisfaction Problems Lars Schmidt-Thieme Information Systems and Machine Learning

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Chapter 6 of Russell & Norvig] Constraint satisfaction problems (CSPs) Standard search problem:

More information

Constraint (Logic) Programming

Constraint (Logic) Programming Constraint (Logic) Programming Roman Barták Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic bartak@ktiml.mff.cuni.cz Sudoku Combinatorial puzzle, whose goal is to enter

More information

CONSTRAINT SATISFACTION

CONSTRAINT SATISFACTION CONSRAI ISFACION oday Reading AIMA Read Chapter 6.1-6.3, Skim 6.4-6.5 Goals Constraint satisfaction problems (CSPs) ypes of CSPs Inference (Search + Inference) 1 8-queens problem How would you go about

More information

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition Today COMP 3501 / COMP 4704-4 Lecture 5 Finish up 2-player games Discuss homework Constraint Satisfaction Problems Prof. JGH 318 Constraint Satisfaction Problems (CSP) CSP s are our first work on factored

More information

Announcements. Reminder: CSPs. Today. Example: N-Queens. Example: Map-Coloring. Introduction to Artificial Intelligence

Announcements. Reminder: CSPs. Today. Example: N-Queens. Example: Map-Coloring. Introduction to Artificial Intelligence Introduction to Artificial Intelligence 22.0472-001 Fall 2009 Lecture 5: Constraint Satisfaction Problems II Announcements Assignment due on Monday 11.59pm Email search.py and searchagent.py to me Next

More information

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 6 February, 2018

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 6 February, 2018 DIT411/TIN175, Artificial Intelligence Chapters 5, 7: Search part IV, and CSP, part II CHAPTERS 5, 7: SEARCH PART IV, AND CSP, PART II DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 6 February,

More information

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability.

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability. CS 188: Artificial Intelligence Fall 2008 Lecture 5: CSPs II 9/11/2008 Announcements Assignments: DUE W1: NOW P1: Due 9/12 at 11:59pm Assignments: UP W2: Up now P2: Up by weekend Dan Klein UC Berkeley

More information

CS 188: Artificial Intelligence Fall 2008

CS 188: Artificial Intelligence Fall 2008 CS 188: Artificial Intelligence Fall 2008 Lecture 5: CSPs II 9/11/2008 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore 1 1 Assignments: DUE Announcements

More information

Constraint satisfaction search. Combinatorial optimization search.

Constraint satisfaction search. Combinatorial optimization search. CS 1571 Introduction to AI Lecture 8 Constraint satisfaction search. Combinatorial optimization search. Milos Hauskrecht milos@cs.pitt.edu 539 Sennott Square Constraint satisfaction problem (CSP) Objective:

More information

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.) Some slides adapted from Richard Lathrop, USC/ISI, CS 7 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always replies

More information

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015 CS 188: Ar)ficial Intelligence Constraint Sa)sfac)on Problems Sep 14, 2015 What is Search For? Assump)ons about the world: a single agent, determinis)c ac)ons, fully observed state, discrete state space

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Soup Must be Hot&Sour Appetizer Pork Dish Total Cost < $30 Chicken Dish Vegetable No Peanuts No Peanuts Not Both Spicy Seafood Rice Constraint Network Not Chow Mein 1 Formal

More information

Artificial Intelligence

Artificial Intelligence Contents Artificial Intelligence 5. Constraint Satisfaction Problems CSPs as Search Problems, Solving CSPs, Problem Structure Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller What

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence 5. Constraint Satisfaction Problems CSPs as Search Problems, Solving CSPs, Problem Structure Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller SA-1 Contents

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2010 Lecture 4: A* wrap-up + Constraint Satisfaction 1/28/2010 Pieter Abbeel UC Berkeley Many slides from Dan Klein Announcements Project 0 (Python tutorial) is due

More information

Comments about assign 1. Quick search recap. Constraint Satisfaction Problems (CSPs) Search uninformed BFS, DFS, IDS. Adversarial search

Comments about assign 1. Quick search recap. Constraint Satisfaction Problems (CSPs) Search uninformed BFS, DFS, IDS. Adversarial search Constraint Satisfaction Problems (CSPs) CS5 David Kauchak Fall 00 http://www.xkcd.com/78/ Some material borrowed from: Sara Owsley Sood and others Comments about assign Grading actually out of 60 check

More information

Mathematical Programming Formulations, Constraint Programming

Mathematical Programming Formulations, Constraint Programming Outline DM87 SCHEDULING, TIMETABLING AND ROUTING Lecture 3 Mathematical Programming Formulations, Constraint Programming 1. Special Purpose Algorithms 2. Constraint Programming Marco Chiarandini DM87 Scheduling,

More information

Lecture 9 Arc Consistency

Lecture 9 Arc Consistency Computer Science CPSC 322 Lecture 9 Arc Consistency (4.5, 4.6) Slide 1 Lecture Overview Recap of Lecture 8 Arc Consistency for CSP Domain Splitting 2 Problem Type Static Sequential Constraint Satisfaction

More information

Example: Map coloring

Example: Map coloring Today s s lecture Local Search Lecture 7: Search - 6 Heuristic Repair CSP and 3-SAT Solving CSPs using Systematic Search. Victor Lesser CMPSCI 683 Fall 2004 The relationship between problem structure and

More information

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong CS 88: Artificial Intelligence Spring 2009 Lecture 4: Constraint Satisfaction /29/2009 John DeNero UC Berkeley Slides adapted from Dan Klein, Stuart Russell or Andrew Moore Announcements The Python tutorial

More information

Set 5: Constraint Satisfaction Problems Chapter 6 R&N

Set 5: Constraint Satisfaction Problems Chapter 6 R&N Set 5: Constraint Satisfaction Problems Chapter 6 R&N ICS 271 Fall 2017 Kalev Kask ICS-271:Notes 5: 1 The constraint network model Outline Variables, domains, constraints, constraint graph, solutions Examples:

More information

Recap: Search Problem. CSE 473: Artificial Intelligence. Space of Search Strategies. Constraint Satisfaction. Example: N-Queens 4/9/2012

Recap: Search Problem. CSE 473: Artificial Intelligence. Space of Search Strategies. Constraint Satisfaction. Example: N-Queens 4/9/2012 CSE 473: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer Recap: Search Problem States configurations of the world

More information

6.034 Quiz 1, Spring 2004 Solutions

6.034 Quiz 1, Spring 2004 Solutions 6.034 Quiz 1, Spring 2004 Solutions Open Book, Open Notes 1 Tree Search (12 points) Consider the tree shown below. The numbers on the arcs are the arc lengths. Assume that the nodes are expanded in alphabetical

More information

1 Tree Search (12 points)

1 Tree Search (12 points) 1 Tree Search (12 points) Consider the tree shown below. The numbers on the arcs are the arc lengths. Assume that the nodes are expanded in alphabetical order when no other order is specified by the search,

More information

Set 5: Constraint Satisfaction Problems

Set 5: Constraint Satisfaction Problems Set 5: Constraint Satisfaction Problems ICS 271 Fall 2014 Kalev Kask ICS-271:Notes 5: 1 The constraint network model Outline Variables, domains, constraints, constraint graph, solutions Examples: graph-coloring,

More information

Moving to a different formalism... SEND + MORE MONEY

Moving to a different formalism... SEND + MORE MONEY Moving to a different formalism... SEND + MORE -------- MONEY Consider search space for cryptarithmetic. DFS (depth-first search) Is this (DFS) how humans tackle the problem? Human problem solving appears

More information

Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems (CSPs) Constraint Satisfaction Problems (CSPs) CPSC 322 CSP 1 Poole & Mackworth textbook: Sections 4.0-4.2 Lecturer: Alan Mackworth September 28, 2012 Problem Type Static Sequential Constraint Satisfaction Logic

More information

Constraint Satisfaction Problems (Backtracking Search)

Constraint Satisfaction Problems (Backtracking Search) CSC8:"Introducon"to"Arficial"Intelligence" Constraint Satisfaction Problems (Backtracking Search) Chapter 6 6.: Formalism 6.: Constraint Propagation 6.: Backtracking Search for CSP 6. is about local search

More information

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence CS 188: Artificial Intelligence CSPs II + Local Search Prof. Scott Niekum The University of Texas at Austin [These slides based on those of Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley.

More information

Material. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Material. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 6, 4/20/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Material Read all of chapter

More information

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence CS 188: Artificial Intelligence Constraint Satisfaction Problems II Instructors: Dan Klein and Pieter Abbeel University of California, Berkeley [These slides were created by Dan Klein and Pieter Abbeel

More information

4 Search Problem formulation (23 points)

4 Search Problem formulation (23 points) 4 Search Problem formulation (23 points) Consider a Mars rover that has to drive around the surface, collect rock samples, and return to the lander. We want to construct a plan for its exploration. It

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2006 Lecture 4: CSPs 9/7/2006 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore Announcements Reminder: Project

More information

Today. CS 188: Artificial Intelligence Fall Example: Boolean Satisfiability. Reminder: CSPs. Example: 3-SAT. CSPs: Queries.

Today. CS 188: Artificial Intelligence Fall Example: Boolean Satisfiability. Reminder: CSPs. Example: 3-SAT. CSPs: Queries. CS 188: Artificial Intelligence Fall 2007 Lecture 5: CSPs II 9/11/2007 More CSPs Applications Tree Algorithms Cutset Conditioning Today Dan Klein UC Berkeley Many slides over the course adapted from either

More information

Discussion Section Week 1

Discussion Section Week 1 Discussion Section Week 1 Intro Course Project Information Constraint Satisfaction Problems Sudoku Backtracking Search Example Heuristics for guiding Search Example Intro Teaching Assistant Junkyu Lee

More information