Presentation is loading. Please wait.

Presentation is loading. Please wait.

N Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language.

Similar presentations


Presentation on theme: "N Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language."— Presentation transcript:

1 n Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language n Solve model ä define search space / choose algorithm –incremental assignment / backtracking search –complete assignments / stochastic search ä design/choose heuristics n Verify and analyze solution Constraint-based problem solving

2 Example: n-queens Place n-queens on an n  n board so that no pair of queens attacks each other

3 Example: 4-queens 4 3 2 1 x1 x1 x2x2 x3 x3 x4 x4 Variables: x 1, x 2, x 3, x 4 Domains: {1, 2, 3, 4} Constraints: x i  x j and | x i - x j |  | i - j |

4 Example: 4-queens One solution: x 1  2 x 2  4 x 3  1 x 4  3 4 3 2 1 x1 x1 x2x2 x3 x3 x4 x4 Q Q Q Q

5 Search tree for 4-queens x1 x1 x2x2 x3 x3 x4 x4 1234 (1,1,1,1)(4,4,4,4)(2,4,1,3)(3,1,4,2)

6 Specification of backtracking Invariant:1  i, j  c, ( x i, x j ) is consistent x1 x1 x c-1 xc xc x c+1 xn xn currentpastfuture

7 Backtracking (BT) {2}{5} {1,...,6} x1 x1 x5 x5 x6x6 x4 x4 x2x2 Q Q 1 1 2 2 4 3 2 1 5 6 x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 x3 x3

8 Enforcing arc-consistency {a, b, c} < xi xi xj xj

9 Specification of forward checking Invariant:1  i  c, c  j  n, ( x i, x j ) is arc-consistent x1 x1 x c-1 xc xc x c+1 xn xn currentpastfuture

10 Forward checking (FC) Q Q 111 1 1 11 1 2 2 2 22 4 3 2 1 5 6 x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 1 1 2 2 {2}{5} x1 x1 x5 x5 x6x6 x4 x4 x2x2 {1,2,3,4,5,6} x3 x3

11 Forward checking (FC) Q Q 111 1 1 11 1 2 2 2 22 4 3 2 1 5 6 x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 1 1 2 2 {2}{5} x1 x1 x5 x5 x6x6 x4 x4 x2x2 {1, 3} x3 x3 {1, 4, 6} {1, 3, 4} {3, 4, 6}

12 Forward checking {2}{5} Q Q Q 1 1 11 1 1 1 1 1 2 2 2 22 2 3 33 33 {3} {1,4,6} {1,3,4} {3,4,6} x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 432156 x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 1

13 Specification of maintaining arc consistency Invariant:1  i  c, c  j, k  n, ( x j, x k ) is arc-consistent x1 x1 x c-1 xc xc x c+1 xn xn currentpastfuture ( x i, x j ) is arc-consistent,

14 Maintaining arc consistency (MAC) Q Q 11 1 1 11 1 2 2 2 2 4 3 2 1 5 6 1 1 2 2 {2}{5} x1 x1 x5 x5 x6x6 x4 x4 x2x2 {1,2,3,4,5,6} x3 x3 {1,2,3,4,5,6}{1,2,3,4,5,6} 1 2a x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 1a

15 Maintaining arc consistency (MAC) Q Q 11 1 1 11 1 2 2 2 22 4 3 2 1 5 6 1 1 2 2 {2}{5} x1 x1 x5 x5 x6x6 x4 x4 x2x2 {1} x3 x3 { } {4} {6} 1 2a x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2

16 Enforcing path-consistency < {a, b, c} xi xi xj xj xk xk < <

17 Some history n Informal statement ä Golomb & Baumert (1965), Mackworth (1977), Lauriere (1978) n Algorithms ä Gaschnig (1978) backtracking algorithm with arc consistency ä McGregor (1979) backtracking algorithm with arc consistency, backtracking algorithm with forward checking ä Haralick & Elliott (1980) forward checking ä Nadel (1989) backtracking with partial arc consistency n Experiments ä McGregor (1979), Haralick & Elliott (1980), Gaschnig (1978), Nadel (1989), Sabin & Freuder (1994)


Download ppt "N Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language."

Similar presentations


Ads by Google