Constraint Networks - PowerPoint PPT Presentation

About This Presentation
Title:

Constraint Networks

Description:

Constraint Networks Overview Search space The effect of variable ordering A coloring problem example Backtracking Search for a Solution Backtracking search for a ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 80
Provided by: icsUciEd92
Learn more at: https://ics.uci.edu
Category:

less

Transcript and Presenter's Notes

Title: Constraint Networks


1
Constraint Networks Overview
2
Suggested reading
Russell and Norvig. Artificial Intelligence
Modern Approach. Chapter 5.
3
Good source of advanced information
Rina Dechter, Constraint Processing, Morgan
Kaufmann
3
4
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

4
5
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

5
6
(No Transcript)
7
(No Transcript)
8
Example The N-queens problem
The network has four variables, all with domains
Di 1, 2, 3, 4. (a) The labeled chess board.
(b) The constraints between variables.
Spring 2009
8
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
Example configuration and design
Spring 2009
14
15
(No Transcript)
16
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

16
17
(No Transcript)
18
Operations with relations
  • Intersection
  • Union
  • Difference
  • Selection
  • Projection
  • Join
  • Composition

18
19
(No Transcript)
20
(No Transcript)
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
(No Transcript)
25
(No Transcript)
26
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

26
27
(No Transcript)
28
Backtracking search
28
29
Search space
30
Backtracking
31
(No Transcript)
32
(No Transcript)
33
(No Transcript)
34
(No Transcript)
35
The search space
  • A tree of all partial solutions
  • A partial solution (a1,,aj) satisfying all
    relevant constraints
  • The size of the underlying search space depends
    on
  • Variable ordering
  • Level of consistency possessed by the problem

36
Search space and the effect of ordering
37
The effect of variable ordering
38
Dependency on consistency level
  • After arc-consistency z5 and l5 are removed
  • After path-consistency
  • R_zx
  • R_zy
  • R_zl
  • R_xy
  • R_xl
  • R_yl

39
Backtrack-free network
40
Backtracking
  • Complexity of extending a partial solution
  • Complexity of consistent O(e log t), t bounds
    tuples, e constraints
  • Complexity of selectvalue O(e k log t)

41
A coloring problem example
42
Backtracking Search for a Solution
43
Backtracking search for a solution
44
Backtracking Search for a Solution
45
Backtracking Search for All Solutions
46
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

46
47
Improving Backtracking O(exp(n))
  • Before search (reducing the search space)
  • Arc-consistency, path-consistency, i-consistency
  • Variable ordering (fixed)
  • During search
  • Look-ahead schemes
  • Value ordering/pruning (choose a least
    restricting value),
  • Variable ordering (Choose the most constraining
    variable)
  • Look-back schemes
  • Backjumping
  • Constraint recording
  • Dependency-directed backtracking

48
Consistency methods
  • Constraint propagation inferring new
    constraints
  • Can get such an explicit network that the search
    will find the solution without dead-ends.
  • Approximation of inference
  • Arc, path and i-consistency
  • Methods that transform the original network into
    a tighter and tighter representations

48
49
Arc-consistency
- infer constraints based on pairs of variables
X
Y
?
3
2,
1,
3
2,
1,
1 ? X, Y, Z, T ? 3 X ? Y Y Z T ? Z X ??T

?
3
2,
1,
3
2,
1,
?
T
Z
Insures that every legal value in the domain of a
single variable has a legal match In the domain
of any other selected variable
49
50
(No Transcript)
51
Arc-consistency algorithm
  • domain of x domain of y

Arc is arc-consistent if for any
value of there exist a matching value of
Algorithm Revise makes an arc
consistent Begin 1. For each a in Di if there
is no value b in Dj that matches a then delete a
from the Dj. End. Revise is , k is the
number of value in each domain.
52
Algorithm AC-3
  • Begin
  • 1. Q lt--- put all arcs in the queue in both
    directions
  • 2. While Q is not empty do,
  • 3. Select and delete an arc from the
    queue Q
  • 4. Revise
  • 5. If Revise cause a change then add to the queue
    all arcs that touch Xi (namely (Xi,Xm) and
    (Xl,Xi)).
  • 6. end-while
  • End
  • Complexity
  • Processing an arc requires O(k2) steps
  • The number of times each arc can be processed is
    2k
  • Total complexity is

53
Sudoku Constraint Satisfaction
  • Variables empty slots
  • Domains 1,2,3,4,5,6,7,8,9
  • Constraints
  • 27 all-different
  • Constraint
  • Propagation
  • Inference

2 34 6
2
Each row, column and major block must be
alldifferent Well posed if it has unique
solution 27 constraints
53
54
(No Transcript)
55
Path-consistency
55
56
Example before and after path-consistency
  • PC-1 requires 2 processings of each arc while
    PC-2 may not
  • Can we do path-consistency distributedly?

56
57
(No Transcript)
58
The Effect of Consistency Level
  • After arc-consistency z5 and l5 are removed
  • After path-consistency
  • R_zx
  • R_zy
  • R_zl
  • R_xy
  • R_xl
  • R_yl

Tighter networks yield smaller search spaces
59
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

59
60
(No Transcript)
61
(No Transcript)
62
(No Transcript)
63
(No Transcript)
64
(No Transcript)
65
(No Transcript)
66
(No Transcript)
67
(No Transcript)
68
(No Transcript)
69
(No Transcript)
70
(No Transcript)
71
(No Transcript)
72
(No Transcript)
73
(No Transcript)
74
Forward-checking on Graph-coloring
FW overhead MAC overhead
75
Propositional Satisfiability
Example party problem
  • If Alex goes, then Becky goes
  • If Chris goes, then Alex goes
  • Query
  • Is it possible that Chris goes to the party
    but Becky does not?

76
Unit Propagation
  • Arc-consistency for cnfs.
  • Involve a single clause and a single literal
  • Example (A, not B, C) (B)
    (A,C)

77
Look-ahead for SAT(Davis-Putnam, Logeman and
Laveland, 1962)
78
Look-ahead for SAT DPLLexample
(AVB)(CVA)(AVBVD)(C)
(Davis-Putnam, Logeman and Laveland, 1962)
Backtracking look-ahead with Unit propagation
Generalized arc-consistency
Only enclosed area will be explored with
unit-propagation
79
Outline
  • CSP Definition, and simple modeling examples
  • Representing constraints
  • Basic search strategy
  • Improving search
  • Consistency algorithms
  • Look-ahead methods
  • Look-back methods

79
80
Look-back Backjumping / Learning
  • Backjumping
  • In deadends, go back to the most recent culprit.
  • Learning
  • constraint-recording, no-good recording.
  • good-recording

81
Backjumping
  • (X1r,x2b,x3b,x4b,x5g,x6r,x7r,b)
  • (r,b,b,b,g,r) conflict set of x7
  • (r,-,b,b,g,-) c.s. of x7
  • (r,-,b,-,-,-,-) minimal conflict-set
  • Leaf deadend (r,b,b,b,g,r)
  • Every conflict-set is a no-good

82
A coloring problem
83
Example of Gaschnigs backjump
84
(No Transcript)
85
(No Transcript)
86
(No Transcript)
87
(No Transcript)
88
(No Transcript)
89
The cycle-cutset method
  • An instantiation can be viewed as blocking cycles
    in the graph
  • Given an instantiation to a set of variables that
    cut all cycles (a cycle-cutset) the rest of the
    problem can be solved in linear time by a tree
    algorithm.
  • Complexity (n number of variables, k the domain
    size and C the cycle-cutset size)

90
Tree Decomposition
91
(No Transcript)
92
(No Transcript)
93
(No Transcript)
94
GSAT local search for SAT(Selman, Levesque and
Mitchell, 1992)
  • For i1 to MaxTries
  • Select a random assignment A
  • For j1 to MaxFlips
  • if A satisfies all constraint,
    return A
  • else flip a variable to maximize the
    score
  • (number of satisfied constraints
    if no variable
  • assignment increases the score,
    flip at random)
  • end
  • end

Greatly improves hill-climbing by adding
restarts and sideway moves
95
WalkSAT (Selman, Kautz and Cohen, 1994)
Adds random walk to GSAT
  • With probability p
  • random walk flip a variable in some
    unsatisfied constraint
  • With probability 1-p
  • perform a hill-climbing step

Randomized hill-climbing often solves large and
hard satisfiable problems
96
More Stochastic Search Simulated Annealing,
reweighting
  • Simulated annealing
  • A method for overcoming local minimas
  • Allows bad moves with some probability
  • With some probability related to a temperature
    parameter T the next move is picked randomly.
  • Theoretically, with a slow enough cooling
    schedule, this algorithm will find the optimal
    solution. But so will searching randomly.
  • Breakout method (Morris, 1990) adjust the
    weights of the violated constraints

97
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com