Title: Towards robust DACbased solvers for WCSP
1Towards robust DAC-based solvers for WCSP
- Federico Heras Javier Larrosa
- Universitat Politècnica de Catalunya Barcelona,
Spain
2Outline
- Weighted CSP.
- Solving WCSP.
- Systematic Search.
- Local Consistency.
- Variable ordering for DAC-based solvers.
- FDAC alternate FDACalt.
- FDAC 2 passes FDAC2p.
- FDAC K passes FDACK.
- Conclusions and Future Work.
3Outline
- Weighted CSP.
- Solving WCSP.
- Variable ordering for DAC-based solvers.
- Conclusions and Future Work.
4Weighted CSP
- WCSP (X,D,C,Top, C?)
- Xx1,..., xn variables
- DD1,..., Dn finite domains
- Cc1,..., ce cost functions
- var(ci) scope
- t partial assignation
- ci(t) ? ?
- Top ? N Upper Bound
- C? ? N Lower Bound
5Weighted CSP
- Obj. Function F(X) Si1..N ci(X)
- Solution F(t) lt Top
- Goal Find minimal cost solution
- Complexity NP - Complete
6WCSP Example
- Colors
- Red (r)
- Green (g)
- Blue (b)
Maximize the number of blue vertices
7WCSP Example
ci(xi) xi 0 b 1 g
1 r
Top6
c?0
x3
c(xi,xj) xi xj 6 b
b 0 b g 0
b r 0 g b
6 g g 0 g
r 0 r b 0
r g 6 r r
x2
x1
x4
x5
8WCSP Example
Xx y z Div w CCxz Cyz Cx Cy
Cz C?
9WCSP Example
Top4
C? 0
Xx y z Div w CCxz Cyz Cx Cy
Cz C?
x
v
2
2
z
w
0
v
2
1
1
w
1
v
1
0
1
w
0
y
10WCSP Example
Top4
C? 0
Xx y z Div w CCxz Cyz Cx Cy
Cz C?
x
v
2
2
z
w
0
v
2
1
1
w
1
v
1
0
1
w
0
y
Valuation 212100Top Not a solution
11WCSP Example
Top4
C? 0
Xx y z Div w CCxz Cyz Cx Cy
Cz C?
x
v
2
2
z
w
0
v
2
1
1
w
1
v
1
0
1
w
0
y
12WCSP Example
Top4
C? 0
Xx y z Div w CCxz Cyz Cx Cy
Cz C?
x
v
2
2
z
w
0
v
2
1
1
w
1
v
1
0
1
w
0
Valuation 0101002 (optimal) solution
y
13Outline
- Weighted CSP.
- Solving WCSP.
- Variable ordering for DAC-based solvers.
- Conclusions and Future Work.
14Systematic search
Each node is a WCSP subproblem
Partial assignation t
variables
Lower Bound C?
If C? ? Top then prune
Upper Bound Top
15Boosting search with LC
- BT(X,D,C)
- if (X?) then Top c?
- else
- xj selectVar(X)
- forall a?Dj do
- Condition C with (xj , a)
- LocalConsistency()
- if (c?ltTop) then BT(X-xj,D-Dj,C)
-
16Local Consistency
- Incomplete Inference methods
- Local property enforceable in polynomial time
that makes the problem more explicit - Well known in classical CSP
- NC, AC, PC, ...
17WCSP Local consistencies
NC O(nd)
AC O(n 2d 3)
DAC O(ed 2)
FDAC O(end 3)
18Node Consistency (NC)
- For all variable i
- ?a, C? Ci (a)ltT
- ? a, Ci (a) 0
- Complexity
- O(nd)
19Node Consistency (NC)
- For all variable i
- ?a, C? Ci (a)ltT
- ? a, Ci (a) 0
- Complexity
- O(nd)
20Node Consistency (NC)
- For all variable i
- ?a, C? Ci (a)ltT
- ? a, Ci (a) 0
- Complexity
- O(nd)
21Node Consistency (NC)
- For all variable i
- ?a, C? Ci (a)ltT
- ? a, Ci (a) 0
- Complexity
- O(nd)
22Node Consistency (NC)
- For all variable i
- ?a, C? Ci (a)ltT
- ? a, Ci (a) 0
- Complexity
- O(nd)
Top3
C? 1
x
y
v
v
1
0
w
w
0
23Arc Consistency (AC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) 0
-
- b is a support
- complexity
- O(n 2d 3)
Top2
C? 0
x
y
2
v
v
0
0
w
w
0
1
1
24Arc Consistency (AC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) 0
-
- b is a support
- complexity
- O(n 2d 3)
Top2
C? 0
x
y
2
v
v
0
0
w
w
0
1
1
25Arc Consistency (AC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) 0
-
- b is a support
- complexity
- O(n 2d 3)
Top2
C? 0
x
y
1
v
v
0
1
w
w
0
1
26Arc Consistency (AC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) 0
-
- b is a support
- complexity
- O(n 2d 3)
Top2
C? 0
x
y
1
v
v
0
1
w
w
0
1
27Arc Consistency (AC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) 0
-
- b is a support
- complexity
- O(n 2d 3)
Top2
C? 1
x
y
1
v
v
0
0
w
w
0
0
28Arc Consistency (AC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) 0
-
- b is a support
- complexity
- O(n 2d 3)
Top2
C? 1
x
y
1
v
v
0
0
w
w
0
0
29Directional AC (DAC)
- NC
- For all Cij (iltj)
- ?a ? b
- Cij(a,b) Cj(b) 0
-
- b is a full-support
- complexity
- O(ed 2)
Top2
C? 0
X lt y
y
x
1
v
v
0
0
w
w
1
1
30Directional AC (DAC)
- NC
- For all Cij (iltj)
- ?a ? b
- Cij(a,b) Cj(b) 0
-
- b is a full-support
- complexity
- O(ed 2)
Top2
C? 0
X lt y
y
x
1
v
v
0
0
1
1
w
w
0
1
31Directional AC (DAC)
- NC
- For all Cij (iltj)
- ?a ? b
- Cij(a,b) Cj(b) 0
-
- b is a full-support
- complexity
- O(ed 2)
Top2
C? 0
X lt y
y
x
v
v
1
0
1
w
w
0
1
32Directional AC (DAC)
- NC
- For all Cij (iltj)
- ?a ? b
- Cij(a,b) Cj(b) 0
-
- b is a full-support
- complexity
- O(ed 2)
Top2
C? 0
X lt y
y
x
v
v
1
0
1
w
w
0
1
33Directional AC (DAC)
- NC
- For all Cij (iltj)
- ?a ? b
- Cij(a,b) Cj(b) 0
-
- b is a full-support
- complexity
- O(ed 2)
Top2
C? 1
X lt y
y
x
v
v
0
0
1
w
w
0
0
34Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
0
1
z
w
0
v
0
w
1
35Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
0
1
z
w
0
1
v
0
1
w
0
36Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
1
z
w
0
v
0
1
w
0
37Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
1
z
w
0
v
0
1
w
0
38Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
0
1
z
w
0
1
v
0
1
w
0
39Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
0
1
z
w
0
v
0
w
1
40Full AC (FAC)
- NC
- For all Cij
- ?a ? b
- Cij(a,b) Cj(b) 0
- (full support)
Top4
C? 0
x
v
0
1
z
w
0
v
0
w
1
Thats our starting point! No termination!!!
41Full DAC (FDAC)
FDAC AC DAC
Support
Full-Support
iltj
igtj
complexity O(end 3)
42Boosting search with LC
MFDAC
MAC/MDAC
MNC
BT
43Outline
- Weighted CSP.
- Solving WCSP.
- Variable ordering for DAC-based solvers.
- Conclusions and Future Work.
44Variable ordering for DAC based solvers
- Remember DAC and FDAC rely on a variable
ordering. - Observation The performance of the algorithm
will depend greatly of the variable ordering
fixed. - N! possible variable orderings.
- Little is known about good variable ordering for
DAC-based algorithms.
45Variable ordering for DAC based solvers
- Notation
- Lex. ord. 1,2,3,,N.
- Reverse-lex. ord. N,N-1,N-2,,1.
- DAC with lex. ord. DAC.
- DAC with rev.-lex. ord. DACr.
- Similar for FDAC and FDACr.
46Lexicographical VS reverse lexicographical
CPU TIMES PENTIUM III 800 MHZ
47Lexicographical VS reverse lexicographical
- Example
- N10 and j3.
- Which variables get costs from j?
- FDAC i1,2.
- FDACr i10,9,8,7,6,5,4.
- Idea We combine lexicographical and
reverse-lexicographical ordering (or any ordering
and its reverse).
48FDACAlt (FDAC alternate)
- At even level of the search tree apply FDAC.
- At odd level of the search tree apply FDACr.
FDAC
FDACr
FDAC
FDACr
FDAC
49FDAC2p (FDAC 2 passes)
- At each node of the search tree, apply first FDAC
and then FDACr. - DAC property is accomplished only in the reverse
order.
FDAC FDACr
FDAC FDACr
FDAC FDACr
FDAC FDACr
FDAC FDACr
50Experimental results
CPU TIMES PENTIUM III 800 MHZ
51Experimental results
2
1
3
2
4
2
52Experimental results
CPU TIME
VISITED NODES
TIME IMPROVEMENT 25
FDAC2p
NODE IMPROVEMENT 300
53Experimental results
- Experimental results indicate that FDAC2p is the
best option. - Can we improve even further?
- FDAC2p Only execute two passes at each node.
- We can extend FDAC2p to a FDAC algorithm that
executes K passes.
54FDACK (FDAC K passes)
- At each node of the search tree, apply first FDAC
and then FDACr K times. - For K1 we obtain FDAC2p.
- For K ? algorithm must stop when it cannot
- Increment the LB.
- Prune values.
(FDAC FDACr) K times
(FDAC FDACr) K times
(FDAC FDACr) K times
(FDAC FDACr) K times
(FDAC FDACr) K times
55Experimental results FDACK
VISITED NODES 1/1000
56Experimental results FDACK
CPU TIMES PENTIUM III 800 MHZ
57Selecting one strategy
- Empirical results indicate that FDAC2p is the
best option. - Since FDAC2p executes two passes at each node,
the overhead is doubled - So it is necessary to visit less than half of the
nodes in order to improve.
58Outline
- Weighted CSP.
- Solving WCSP.
- Variable ordering for DAC-based solvers.
- Conclusions and Future Work.
59Conclusions
- DAC-Based algorithms performance rely on a
variable ordering. - Alternating variable ordering from any order to
its reverse extracts a lot of useful information. - Empirically, we have shown that FDAC2p is the
best option.
60Future work
- Find heuristics for variable ordering in
DAC-based algorithms. Two types of heuristics - Static Before entering the branch and bound
stablish a variable ordering that will be used
trought all the search tree. - Dynamic At each node of search tree a new
variable ordering is stablished.
61Final remarks
- Experiments performed with Toolbar
- State-of-art solver for WCSP.
- Free software for windows and linux operative
systems. - Obtain it http//carlit.toulouse.inra.fr/cgi-bin
/viewcvs.cgi/WCSP/.