IAIP Week 9 Constraint Satisfaction IV: LookBack Strategies - PowerPoint PPT Presentation

1 / 51
About This Presentation
Title:

IAIP Week 9 Constraint Satisfaction IV: LookBack Strategies

Description:

Culprit variable: xb such that ab-1 contains no conflict set. 10/1/09. RMJ VeCoS ITU ... Jump back to the conflict set culprit variable ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 52
Provided by: runemlle
Category:

less

Transcript and Presenter's Notes

Title: IAIP Week 9 Constraint Satisfaction IV: LookBack Strategies


1
IAIP Week 9Constraint Satisfaction IV
Look-Back Strategies D6 (except 6.3, 6.5)
2
Last time
3
Look-Ahead search strategies
What consequences does my current assignment have
on the domains of future variables?
x
1,2,3
lt
lt
y
z
1,2,3
1,2,3
X
X
z
1
3
2
y
1
2
3
1
2
3
1
2
3
x
3
2
3
3
3
4
Look-Ahead search strategies
What consequences does my current assignment have
on the domains of future variables?
x
1,2,3
X
lt
lt
y
z
1,2,3
1,2,3
X
X
Forward Checking Remove domain values that are
inconsistent with the current assignment!
z
1
3
2
y
1
2
3
2
1
2
3
1
2
3
x
3
2
3
3
3
5
Look-Ahead search strategies
What consequences does my current assignment have
on the domains of future variables?
x
1,2,3
X
lt
lt
y
z
X
1,2,3
1,2,3
X
X
Arc-consistency look-ahead Make the constraint
network arc-consistent given the current
assignment!
z
1
3
2
y
1
2
3
2
1
2
3
1
2
3
x
3
2
3
3
3
6
This week
7
Look-Back search strategies
x
1,2,3
What previous assignments caused this dead-end?
lt
lt
y
z
1,2,3
X
X
X
1,2,3
X
z
1
3
2
y
1
2
3
1
2
3
1
2
3
x
3
2
3
3
3
8
Today's program
  • Conflict sets
  • Backjumping algorithms
  • Gaschnig's backjumping
  • Graph-based backjumping
  • Conflict-directed backjumping
  • Backjumping learning algorithms
  • Graph-based backjump learning
  • Conflict-directed backjump learning
  • Putting it all together FC-CBJ
  • BDD-based interactive constraint satisfaction
  • 11.10 Visitor Henrik Reif Andersen, ConfigIt
    Software
  • Project Proposals

9
Backjumping
  • Idea
  • Don't backtrack chronologically
  • jump back to the deepest variable that has an
    impact on the dead-end (the culprit variable)
  • Example

Backjumping
x
culprit variable
1,2,3
z
1
3
2
lt
lt
y
1
2
3
1
1
2
3
2
3
z
y
X
X
1,2,3
X
X
1,2,3
x
3
2
3
Chronological backtracking
3
3
10
Leaf and internal dead-ends
  • Leaf dead-end a state ai-1 (a1,a2,...,ai-1)
    with no consistent assignment of xi
  • Internal dead-end xi is an internal dead-end, if
    we retract to xi, but xi has no values left to
    instantiate
  • Example

x is a leaf dead-end y becomes an internal
dead-end when its domain is exhausted
3
z
1
2
y
1
2
3
1
1
2
3
2
3
3
x
2
3
3
3
11
How far can we jump?
  • xi is a dead-end ? xi is in conflict with ai-1
  • If also xi is in conflict with ai-2 then
    backtracking to xi-1 is not enough!
  • Example

x is in conflict with a (z3,y1) But x is also
in conflict witha (z3), so it's not enough to
jump back to y We can jump all the way to z!
1
3
z
2
1
y
2
3
1
1
2
3
2
3
3
x
2
3
3
3
12
Conflict sets
  • Conflict sets of xi a
    (ai1,...aik) i1..ik ? i, ?v ? Di .
    inconsistent(a,v)
  • Minimal conflict set a conflict set that does
    not contain a conflict set

a1
a2
a3
a4
a5
Minimal conflict sets of x8
Culprit variable xb such that ab-1 contains no
conflict set
a6
a7
x8
13
No-goods
  • We may jump further back than the conflict set
    culprit variable
  • No-goods a (ai1,...aik) a does not appear
    in any solution of ?
  • Minimal no-good no-good with no no-good subtuple
  • conflict set ? no-good
  • no-good ? conflict set

X1
X7
X6
X2
no-good (why?), but not a conflict set of any
variable!
X3
X5
X4
14
Safe jumps
xb is safe if ab is a no-good(safe to jump to
xb since any jump to a variable below xb will
re-explore xb) Is it safe to jump to the conflict
set culprit variable?
a1
a2
a3
a4
a5
minimal no-goods of ?
a6
a7
x8
safe variables
15
Safe jumps
xb is safe if ab is a no-good(safe to jump to
xb since any jump to a variable below xb will
re-explore xb) Is it safe to jump to the conflict
set culprit variable?Yes, any conflict set is a
no-good!
a1
a2
a3
a4
a5
minimal no-goods of ?
a6
a7
x8
safe variables
16
Backjumping algorithms
17
Gaschnig's Backjumping
  • Jump back to the conflict set culprit variable
  • latestj keeps track of the first variable
    inconsistent with all assignments of xj (the
    culprit variable of xj)

a1
a2
x3 culprit variablelatest5 3
a3
a4
x5 v1, v2, v3
18
Gaschnig's Backjumping
Procedure GASCHNIG'S-BACKJUMPINGInput A
constraint network ? (X,D,C)Output Either a
solution, or notification that the
network is inconsistent i ? 1 Di ? Di
latesti ? 0 while 1 ? i ? n
instantiate xi ? SELECT-VALUE-GBJ if xi is
null i ? latesti else i
? i 1 D'i ? Di latesti ? 0
if i 0 return "inconsistent" else return
instantiated values of (x1,...,xn)
Procedure SELECT-VALUE-GBJ while D'i is not
empty select an arbitrary element a ?
D'i and remove a from D'i
consistent ? true k ? 1
while k lt i and consistent if k gt
latesti latesti ? k
if not CONSISTENT(ak,xia)
consistent ? false else
k ? k 1 if consistent return
a return null
latesti i-1, if a value is assigned. This
ensures chronological backtracking for internal
dead-ends!
19
Procedure SELECT-VALUE-GBJ while D'i is not
empty select an arbitrary element a ? D'i
and remove a from D'i consistent ?
true k ? 1 while k lt i and
consistent if k gt latesti
latesti ? k if not
CONSISTENT(ak,xia) consistent ?
false else k ? k 1
if consistent return a
return null
X1
X2
X3
X4
X1
X7
X5
X6
X2
X6
X3
X5
X7
X4
20
Procedure SELECT-VALUE-GBJ while D'i is not
empty select an arbitrary element a ? D'i
and remove a from D'i consistent ?
true k ? 1 while k lt i and
consistent if k gt latesti
latesti ? k if not
CONSISTENT(ak,xia) consistent ?
false else k ? k 1
if consistent return a
return null
X1
X2
X3
X4
X1
X7
X5
X6
X2
X6
X3
X5
X7
X4
21
Procedure SELECT-VALUE-GBJ while D'i is not
empty select an arbitrary element a ? D'i
and remove a from D'i consistent ?
true k ? 1 while k lt i and
consistent if k gt latesti
latesti ? k if not
CONSISTENT(ak,xia) consistent ?
false else k ? k 1
if consistent return a
return null
X1
X2
X3
X4
X1
X7
X5
X6
X2
X6
X3
X5
X7
X4
22
Procedure SELECT-VALUE-GBJ while D'i is not
empty select an arbitrary element a ? D'i
and remove a from D'i consistent ?
true k ? 1 while k lt i and
consistent if k gt latesti
latesti ? k if not
CONSISTENT(ak,xia) consistent ?
false else k ? k 1
if consistent return a
return null
X1
X2
etc.
X3
X4
X1
X7
X5
X6
X2
X6
X3
X5
X7
X4
23
Graph-Based Backjumping
  • Limitation of Gaschnig's Backjumping
  • we backtrack chronologically on internal
    dead-ends even though larger jumps may be
    possible
  • Graph-Based Backjumping
  • Approximate the conflict set from the network
    structure
  • Jump to the most recent variable in combined
    conflict sets of relevant dead-ends

24
Approximating the conflict set
X1
X7
X7
X6
X2
X6
Parent of x7 p(x7)
X3
X5
X5
X4
We haveconflict set of x ? anc(x)Thusalways
safe to jump back to p(x) in a leaf dead-end
xWhat about internal dead-ends?
X4
X3
Ancestor set of x7 anc(x7)
X2
X1
25
Example invisit of x
x
26
Example invisit of x
x
27
Example invisit of x
x
28
Example invisit of x
x
29
Example invisit of x
x
30
Example invisit of x
x
31
Example invisit of x
x
32
Example invisit of x
x
33
Example invisit of x
Relevant dead-ends of x r(x) (definition
in book incorrect!) Induced ancestors of x
( ? y ? r(x) anc(y)) ? x1,...,xi-1 For
an internal dead-end, it is safe to jump back to
the most recent induced ancestor!!
graph-based culprit variableof x
x
34
Graph-Based backjumping
Procedure GRAPH-BASED-BACKJUMPINGInput A
constraint network ? (X,D,C)Output Either a
solution, or notification that the
network is inconsistent i ? 1 Di ? Di
li ? anc(xi) while 1 ? i ? n
instantiate xi ? SELECT-VALUE if xi is
null iprev ? i i ? latest index
in li li ? li ? liprev - xi
else i ? i 1 D'i ? Di
li ? anc(xi) if i 0 return "inconsistent"
else return instantiated values of
(x1,...,xn)
What is li?
li maintains the induced ancestor set of
xi! When jumping back from i to j, we have lj
lj ? li - xj since there are no variables
between i and j, we get lj ? x1,...,xj-1 The
fact that li is initialized to anc(xi) shows that
internal dead-ends are included in the relevant
dead-end set(error in definition 6.11)
35
Conflict-Directed backjumping
  • Idea combine the advantages of Gashnig's and
    graph-based backjumping
  • Jump back relative to current assignment
  • Jump more than one level back also on internal
    dead-ends
  • Approach keep track of a jumpback set
    variables of constraints causing backtrack on
    relevant dead-ends

36
Constraint ordering
  • DefinitionR lt Q iff max-index(scope(R)-scope(Q)
    ) lt max-index(scope(Q)-scope(R))
  • We haveR lt Q ? max-index(R) ? max-index(Q)

If the constraints are tested in order and the
first conflict happens at constraint R then no
conflicts exist for constraints onx1,...,xi-1,
where i max-index(R)
37
Earliest minimal conflict set
Scope of the first constraint in the ordering
inconsistent with ( (a1,...,a6), x7 v3 )
a1
a2
a3
emc(x7) a1,a3,a4,a5 var-emc(x7)
x1,x3,x4,x5
a4
a5
conflict-directed culprit variable of x7(if x7
is a leaf dead-end)
a6
x7 v1, v2, v3
Isn't the conflict-directed culprit variable
always at the same level as Gaschnig's culprit
variable?
38
Earliest minimal conflict set
Scope of the first constraint in the ordering
inconsistent with ( (a1,...,a6), x7 v3 )
a1
a2
a3
emc(x7) a1,a3,a4,a5 var-emc(x7)
x1,x3,x4,x5
a4
a5
conflict-directed culprit variable of x7(if x7
is a leaf dead-end)
a6
x7 v1, v2, v3
Isn't the conflict-directed culprit variable
always at the same level as Gaschnig's culprit
variable? Yes, the advantage is that we propagate
jumping sets to internal dead-ends!
39
Conflict-Directed Backjumping
Procedure CONFLICT-DIRECTED-BJInput A
constraint network ? (X,D,C)Output Either a
solution, or notification that the
network is inconsistent i ? 1 Di ? Di
Ji ?? while 1 ? i ? n instantiate xi ?
SELECT-VALUE-CBJ if xi is null
iprev ? i i ? index of last varaible in
Ji Ji ? Ji ? Jiprev - xi else
i ? i 1 D'i ? Di Ji ??
if i 0 return "inconsistent" else return
instantiated values of (x1,...,xn)
Procedure SELECT-VALUE-CBJ while D'i is not
empty select an arbitrary element a ? D'i
and remove a from D'i consistent ?
true k ? 1 while k lt i and
consistent if CONSISTENT(ak,xia)
k ? k 1 else
RS ? the earliest constraint
causing the conflict, add the
variables in RS's scope S excluding
xi to Ji consistent ? false
if consistent return a
return null
40
Example
X1
X2
X1
X7
7
X3
var-emc(x3) x1
1
10
X6
X2
8
X4
5
2
3
6
9
X5
X3
X5
4
X4
X6
var-emc(x7) x1,x3
X7
41
Backjumping learning algorithms
42
Constraint recording or learning
  • Idea add new constraints at a dead-end ai, to
    avoid re-encountering the conflicts causing the
    dead-end
  • Doesn't help much just to add ai, ordinary
    backtracking ensures that ai never will be seen
    again
  • Instead add a "minimal" conflict set of ai

43
Learning strategies
  • Deep learning add only minimal conflict sets
  • more efficient pruning, but harder analysis
  • Shallow learning allow non-minimal conflict sets
    to be added
  • less efficient pruning, but easier analysis
  • Bounded learning bound the scope size of added
    conflict sets
  • fewer variables normally means stronger pruning
    power

44
Minimal conflict set approximations
  • Graph-based backjumping Induced ancestor set
  • Conflict-directed backjumping Jumping back set

Procedure GRAPH-BASED-BACKJUMP-LEARNING
... instantiate xi ? SELECT-VALUE
if xi is null record constraint
prohibiting ai-1li iprev ? i
...
Procedure CONFLICT-DIRECTED-BACKJUMP-LEARNING
... instantiate xi ? SELECT-VALUE
if xi is null record constraint
prohibiting ai-1Ji iprev ? i
...
45
Putting it all together
46
Combining look-ahead and look-back
  • The FC-CBJ algorithm integrates
  • forward checking
  • conflict directed backjumping
  • learning
  • dynamic variable ordering

47
FC-CBJ
Procedure FC-CBJInput A constraint network ?
(X,D,C)Output Either a solution, or
notification that the network is
inconsistent i ? 1 call SELECT-VARIABLE
Di ? Di for 1 ? i ? n Ji ?? while 1 ? i
? n instantiate xi ? SELECT-VALUE-CBJ
if xi is null iprev ? i i ?
index of last varaible in Ji Ji ? Ji ?
Jiprev - xi reset each D'k, kgti, to its
value before xi was last instantiated
else i ? i 1 call
SELECT-VARIABLE D'i ? Di Ji ??
if i 0 return "inconsistent" else return
instantiated values of (x1,...,xn)
Procedure SELECT-VALUE-FC-CBJ while D'i is not
empty select an arbitrary element a ? D'i
and remove a from D'i empty-domain ?
false for all k, i lt k ? n for
all values b in D'k if not
CONSISTENT(ak,xia,xkb) let RS ?
the earliest constraint causing
the conflict, -add the variables
in RS's scope S
excluding xk to Jk -remove b from
D'k if D'k is empty
empty-domain ? true if
empty-domain reset each D'k and Jk, i lt
k ? n, to
status before a was selected else return
a return null
48
Observations
  • The more we look ahead, the less we need to look
    back
  • Gaschnig's backjumping always explores every node
    explored by forward-checking
  • Why?

a1
a2
x3 Gaschnig's culprit variablelatest5 3
a3
a4
x5 v1, v2, v3
49
Observations
  • The more we look ahead, the less we need to look
    back
  • Gaschnig's backjumping always explores every node
    explored by forward-checking
  • Gaschnig's backjumping jumps back to leaf
    dead-ends of forward-checking

50
Dominance Relation
  • A? B, if search-space(A) ? search-space(B)

Backtracking
Gaschnig'sbackjumping
Forward-checking
Graph-basedbackjumping
Conflict-directedbackjumping
GB backjumping learning
Backtracking arc-consistency
FC-CBJ
Most efficient algorithms are at the bottom of
the hierarchy!
CBJ learning
51
Decision Tree Learning Project Bundle
  • Example Learn from data whether a
    mushroom is edible
  • Learn credit-card fraud from transaction DBs
Write a Comment
User Comments (0)
About PowerShow.com