1 / 30

A Study of 0/1 Encodings

A Study of 0/1 Encodings. Prosser & Selensky. A Study of 0/1 Encodings. Prosser & Selensky. Paper in a nutshell. You can encode a constraint satisfaction problem in a number of different, but logically equivalent ways. That is, each encoding

wenda
Download Presentation

A Study of 0/1 Encodings

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Study of 0/1 Encodings Prosser & Selensky

  2. A Study of 0/1 Encodings Prosser & Selensky

  3. Paper in a nutshell You can encode a constraint satisfaction problem in a number of different, but logically equivalent ways. That is, each encoding explores the same search space, but they take different times. If you encode in a different constraint programming language you again get different relative performance for those encodings This is bad news

  4. Presentation in a nutshell 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!

  5. A Hypergraph Encode CSP as independent set of size n 1 9 2 3 4 5 7 8 6

  6. Independent set of a hypergraph G = (V,E) - a set I of vertices such that no edge in E is totally subsumed by I

  7. An Independent Set Encode CSP as independent set of size n 1 1 9 9 2 2 3 3 4 4 5 5 7 7 8 8 6 6 You could add vertex 3 or vertex 8!

  8. 1 9 2 3 4 5 7 8 6 The Largest Independent Set Just so you know. There is only one for this graph

  9. 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

  10. An Example X + Y + Z = 8 where X, Y and Z are in {2,3} Give me an independent set of size n We have n.m 0/1 vertices A hyper edge for each nogood An m-clique for each variable’s domain

  11. Z3 X2 Z2 X3 Y2 Y3

  12. Encode CSP as independent set of size n 1 9 2 3 4 5 7 8 6 • 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?

  13. A Maximal Independent Set An independent set (as before), but we cannot add an element to the set without loss of the independence property. Note: the largest independent set is maximal … obviously

  14. 1 9 2 3 4 5 7 8 6 A Maximal Independent Set There are 11 maximal independent sets of size 6 Remember, there is one largest independent set, size 7

  15. Encoding Maximality CP encoding 1 9 2 3 4 5 7 8 6 An example, vertex 2 That is, we state when a variable MUST be selected and when it MUST NOT be selected

  16. CP encoding 1 9 2 3 4 5 7 8 6 Example, vertices 1,2, and 3

  17. More Generally

  18. Actual Encoding of Maximality 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 Therefore 6 ways to implement maximality!

  19. How it might go CSP Independent Set of Hypergraph Add redundant maximality constraint So? Solve

  20. So, does maximality help? This IS exciting.

  21. An experiment Does maximality help? • 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?

  22. Choco 1.07 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 Conclusion: Use maximality! About 3 times faster A & B are regular degree hypergraphs

  23. Solver 5.0 Conclusion: Avoid maximality! About 8 times slower

  24. Confused? • 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

  25. So? Why the differences, between Solver and Choco? Read the paper What does this mean? What lesson can I learn? Be paranoid

  26. … and maximality is interesting!

  27. Any questions?

More Related