A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.
-
Upload
caleb-ross -
Category
Documents
-
view
222 -
download
3
Transcript of A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.
![Page 1: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/1.jpg)
![Page 2: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/2.jpg)
A Study of 0/1 Encodings
Prosser & Selensky
![Page 3: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/3.jpg)
A Study of 0/1 Encodings
Prosser & Selensky
![Page 4: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/4.jpg)
You can encode a constraint satisfaction problem in a number ofdifferent, but logically equivalent ways. That is, each encodingexplores the same search space, but they take different times.
If you encode in a different constraint programming languageyou again get different relative performance for those encodings
This is bad news
Paper in a nutshell
![Page 5: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/5.jpg)
You can encode a constraint satisfaction problem (with n variables)as a problem of finding an independent set of size n
That independent set is also maximal.
Will the maximality constraint improve performance?
Conclusion: maybe, maybe not. It depends on your toolkit!
Presentation in a nutshell
![Page 6: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/6.jpg)
1
2 3
4 5 7
9
8
6
)}9,8,7,3(),6,4(),5,4,2(),3,2,1{(
}9,8,7,6,5,4,3,2,1{
E
V
A Hypergraph
Encode CSP as independent set of size n
![Page 7: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/7.jpg)
Independent set of a hypergraph G = (V,E)
- a set I of vertices such that no edge in E is totally subsumed by I
![Page 8: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/8.jpg)
1
2 3
4 5 7
9
8
6
1
2 3
4 5 7
9
8
6}9,7,5,4,1{S
An Independent Set
You could add vertex 3 or vertex 8!
Encode CSP as independent set of size n
![Page 9: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/9.jpg)
1
2 3
4 5 7
9
8
6
}9,8,7,6,5,2,1{S
The Largest Independent Set
Just so you know. There is only one for this graph
![Page 10: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/10.jpg)
Represent a CSP with n variables as an independent set as follows
• each vertex of the graph corresponds to an assignment of a value to a variable• if n variables each of domain size m, we have n.m vertices
• there is an m-clique for each variable• therefore a variable can only take one value
• constraints are explicitly represented as nogoods• a nogood is a hyper edge
• select n vertices of the graph• corresponds to instantiation of all n variables
![Page 11: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/11.jpg)
X + Y + Z = 8 where X, Y and Z are in {2,3}
An Example
20
...
30
31
20
21
2
3
3
2
2
ZZ
XX
XX
XX
XX
We have n.m 0/1 vertices
)},,(),,,(),,,(),,,(),,,{( 333223232322222 ZYXZYXZYXZYXZYXnogoods
A hyper edge for each nogood
)},(),,(),,{( 323232 ZZYYXXcliques
An m-clique for each variable’s domain
Give me an independent set of size n
9333
8233
8323
7223
8332
7232
7322
6222ZYX
![Page 12: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/12.jpg)
X2
X3
Y2Y3
Z2
Z3
![Page 13: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/13.jpg)
1
2 3
4 5 7
9
8
6
Vv
ev
k size ofset t independen 4.
e hyperedge ofarity isr ce,independen v 3.
selectednot ex vert0 2.
selectedex vert1 1.
kv
r
iV
iVth
i
thi
Encode CSP as independent set of size n
Constraints 3 and 4 can be implemented in two ways• sum of variables equals some value (r or k) • the number of occurrences of 1 equals some value (r or k)
Could this make a difference?
![Page 14: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/14.jpg)
A Maximal Independent Set
An independent set (as before), but we cannot add anelement to the set without loss of the independence property.
Note: the largest independent set is maximal … obviously
![Page 15: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/15.jpg)
1
2 3
4 5 7
9
8
6
}8,7,6,5,3,2{S
A Maximal Independent Set
There are 11 maximal independent sets of size 6
Remember, there is one largest independent set, size 7
![Page 16: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/16.jpg)
CP encoding
1
2 3
4 5 7
9
8
6
Encoding Maximality
)2()2(1
)2()2(0
54312
54312
VVVVV
VVVVV
That is, we state when a variable MUST be selected and when it MUST NOT be selected
An example, vertex 2
![Page 17: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/17.jpg)
CP encoding
1
2 3
4 5 7
9
8
6
on so and ...
)3()2(1
)3()2(0
)2()2(1
)2()2(0
21
20
987213
987213
54312
54312
321
321
VVVVVV
VVVVVV
VVVVV
VVVVV
VVV
VVV Example, vertices 1,2, and 3
![Page 18: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/18.jpg)
More Generally
]1)([0
]1)([1
maximality ensure :Vertices
)()(
)()(
iji
iji
VeverticesVj
Vedgesei
VeverticesVj
Vedgesei
VearityV
VearityV
))((
ceindependen ensure :Edges
)(
earityVEeeverticesV
VV
i
i
kV
set of size :Graph
![Page 19: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/19.jpg)
Actual Encoding of Maximality
)3()2(1 987213 VVVVVV
Example, vertice 3
We have a sum• implement using sumVars or• implement using occurs
We have the biconditional. This can be implemented in (at least) 3 ways
)()( (3)
)()( (2)
(1)
pqqp
qpqp
qp
Therefore 6 ways to implement maximality!
![Page 20: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/20.jpg)
CSP Independent Set of Hypergraph
Add redundant maximality constraint
Solve
How it might go
So?
![Page 21: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/21.jpg)
So, does maximality
help?This IS exciting.
![Page 22: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/22.jpg)
An experiment
• Encode independence using sumVars (rather than occurs)• Encode biconditional using ifOnlyIf• Given a hypergraph find an independent set of size k
• using just independence constraint• using redundant maximality constraint
• Carry out experiments using• Choco 1.07• ILOG Solver 5.0
• Is run time reduced when we use maximality?
Does maximality help?
![Page 23: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/23.jpg)
Choco 1.07
2590705018
44801696017
140803628016
102015
1840722018
55301642017
132103519016
184507035015
4029014
B
A
misisk
Conclusion: Use maximality!
Run time in milliseconds
Note: A’s largest indSet is size 14 B’s largest indSet is size 15 both encodings look for same thing
About 3 times faster
A & B are regular degree hypergraphs
![Page 24: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/24.jpg)
Solver 5.0
60912518
148421817
345342216
626215
64112518
151621817
346940616
678178115
7812514
B
A
misisk
Conclusion:Avoid maximality!
About 8 times slower
![Page 25: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/25.jpg)
The paper has other confounding results such as
• summation is faster than occurrence in Solver• occurrence is faster than summation in Choco• ((p & q) or (¬p & ¬q)) is fastest implementation of in Solver• ifOnlyIf is the fastest implementation of in Choco• maximality helps in Choco, and does not help in Solver
Confused?
![Page 26: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/26.jpg)
So?
Why the differences, between Solver and Choco?
Read the paper
What does this mean? What lesson can I learn?
Be paranoid
![Page 27: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/27.jpg)
… and maximality is interesting!
![Page 28: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/28.jpg)
Any questions?
![Page 29: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/29.jpg)
![Page 30: A Study of 0/1 Encodings Prosser & Selensky A Study of 0/1 Encodings Prosser & Selensky.](https://reader036.fdocuments.in/reader036/viewer/2022062511/5515cae1550346a3758b4af6/html5/thumbnails/30.jpg)