Lecture 14: Constraint Propagation © J. Christopher Beck 2008 1

advertisement
Lecture 14:
Constraint Propagation
© J. Christopher Beck 2008
1
Outline

Constraint Propagation


Arc Consistency
Propagation in Scheduling



Temporal Propagation
Constraint Based Analysis
Edge Finding
© J. Christopher Beck 2008
2
Readings

P Ch 5.5, D.2, D.3
© J. Christopher Beck 2008
3
Generic CP Algorithm
Start
Solution?
Propagators
Success
Dead-end?
Backtrack
Technique
Nothing to
retract?
Failure
© J. Christopher Beck 2008
Make
Heuristic
Decision
Assert
Commitment
4
The Core of CP

Modeling


Heuristic search



How to branch
How much effort to find a good branch
Inference/propagation


How to represent the problem
How much effort
Backtracking
© J. Christopher Beck 2008
5
Propagation


Propagation is a form of inference
Most common in CSP: domain pruning

remove values from the domains of
variables when you know they cannot be in
any solution
© J. Christopher Beck 2008
6
Heuristic Search or
Propagation?
There must be a 1 or 8
here. Why?
?
© J. Christopher Beck 2008
?
?
1?
8?
?
?
?
{1, 2, 3, 4, 5, 6, 7, 8}
7
Arc Consistency


Fundamental notion in CP!
Given: c1(v1,v2)



a binary constraint
e.g., v1 < v2
Given: D1 = D2 = {0, 1, …, 5}
© J. Christopher Beck 2008
8
Arc Consistency

c1 is arc consistent iff


for all values d1 є D1 there exists a value
d2 є D2 such that c1(v1=d1,v2=d2)  T
And similarly for all values d2 є D2
V1
<
{0,1,2,3,4,5}
© J. Christopher Beck 2008
V2
{0,1,2,3,4,5}
9
Example

Enforce arc consistency on the following
constraint problem
{0,1,2,3,4,5}
V3
V1
<
{0,1,2,3,4,5}
© J. Christopher Beck 2008
V2
{0,1,2,3,4,5}
10
Propagators for Scheduling

3 examples



Temporal propagation (easy)
Constraint-based analysis (medium)
Edge-finding (tricky)
© J. Christopher Beck 2008
11
Temporal Propagation
(Arc Consistency - AC)
The same as CPM!
[0 40]
20
[20 60]
15
[35 75]
10
[45 85]
15
0
20
100
[20 40]
20
0
© J. Christopher Beck 2008
[40 60]
15
[55 75]
10
[65 85]
15
100
12
Constraint-Based
Analysis (CBA)

What can you infer here?
15
20
35
50
80
90
Operations on the same unary capacity resource
© J. Christopher Beck 2008
13
CBA Rules
On the same
unary-capacity resource
For all pairs of activities, Ai and Aj:
Case 1: If lfti – estj < pi + pj  lftj – esti then
Ai must be before Aj.
Case 2: If pi + pj > lftj – esti and
pi + pj > lfti – estj then dead-end.
Case 3: If pi + pj  lftj – esti and
pi + pj  lfti – estj then either OK.
© J. Christopher Beck 2008
14
CBA

Find all CBA inferences
A1 10
20
50
A2 5
30
A3 20
50
0
A4 5
10
© J. Christopher Beck 2008
50
40
15
Edge-Finding Exclusion
25
20
10
15
0
15
10
est(S)
© J. Christopher Beck 2008
80
S
100
lft(S)
16
Edge-Finding Exclusion
70
100
25
20
10
15
0
15
75
10
est(S)
© J. Christopher Beck 2008
S
100
lft(S)
17
Exclusion Rules
On the same, unary
capacity resource
For all non-empty subsets, S, and
activities AS:
(lft(S) - est(S) < durA + dur(S))
 (lft(S) - estA < durA + dur(S))
estA  est(S) + dur(S)
(lft(S) - est(S) < durA + dur(S))
 (lftA - est(S) < durA + dur(S))
lftA  lft(S) - dur(S)
© J. Christopher Beck 2008
18
Edge Finding Exclusion

Run CBA & Edge Finding Exclusion on
the following activities
A1 6
0
17
A2 5
1
11
A3 4
1
© J. Christopher Beck 2008
12
19
Propagators Summary



Analyze the current state in order to
infer new constraints that are implied
Make commitments (e.g., remove
values) that would otherwise have to be
searched over
Do it in every node in the search tree
© J. Christopher Beck 2008
20
Download