1 / 24

Handbook of Constraint Programming 10.5.1, 10.5.2

Handbook of Constraint Programming 10.5.1, 10.5.2. Presented by: Shant Karakashian Symmetries in CP, Sprint 2010. Outline. Symmetry Breaking During Search (SBDS) Example: 8-Queens Adding Constraints Correctness Implementations Problems Symmetry Breaking via Dominance Detection (SBDD)

mae
Télécharger la présentation

Handbook of Constraint Programming 10.5.1, 10.5.2

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. Handbook of Constraint Programming 10.5.1, 10.5.2 Presented by: Shant Karakashian Symmetries in CP, Sprint 2010

  2. Outline • Symmetry Breaking During Search (SBDS) • Example: 8-Queens • Adding Constraints • Correctness • Implementations • Problems • Symmetry Breaking via Dominance Detection (SBDD) • Main Idea • Example: Add Different • Technique: No-goods & Dominance • Implementation of Dominance Checks • Propagation • Scheduling Checks • Comparing SBDS & SBDD

  3. Symmetry Breaking During Search • Symmetry-excluding search trees introduced by [Backofen and Will '99] • Gent and Smith '00 described in more detail the implementation of the technique using the name “Symmetry Breaking During Search” (SBDS) • Basic idea: add constraints to a problem so that after backtracking from a search decision no symmetric equivalent of that decision is ever allowed • Dynamic technique: cannot add the constraints until search decision is made

  4. SBDS Example: 8-Queens • 8 Queens positioned on 8x8 board • No two queens on the same row, column, or diagonal • Each queen (Q[i], i=1,..8) belongs to a row • Each queen can be on a column j=1,..,8 (Q[i]=j) • Symmetries of the problem: • r90, r180, r270, x, y, d1, d2

  5. Adding Constraints at the 1st Level • Q[1]=2: no constraints added • After backtracking from Q[1]=2: • Assert Q[1]≠2 • Never try any state containing a symmetric equivalent to Q[1]=2 • Add constraints (Q[1]≠2)g Q[1]=2 Q[1]≠2 (var≠ val)g (Q[1] ≠2)r90 ≡ Q[2] ≠8 (Q[1] ≠2)r180 ≡ Q[8] ≠7 (Q[1] ≠2)r270 ≡ Q[7] ≠1 (Q[1] ≠2)x ≡ Q[1] ≠7 (Q[1] ≠2)y ≡ Q[8] ≠2 (Q[1] ≠2)d1 ≡ Q[2] ≠1 (Q[1] ≠2)d2 ≡ Q[7] ≠8

  6. Adding Constraints at the 2nd Level • Q[2]=4: no constraints added • Q[2] ≠4: add constraint if the corresponding symmetry is not broken • For symmetry r90, add (Q[2]=4)r90 • only if r90 is not already broken • i.e. if (Q[2]=8) ≡ (Q[1]=2)r90 • Add constraints of the form: • (A → var≠val) → (A → var≠val)g • e.g. (Q[1]=2 → Q[2]≠4) → (Q[1]=2 → Q[2]≠4)r90 • (Q[1]=2 → Q[2]≠4)r90 ≡ (Q[2]=8 → Q[4]≠7) Q[1]=2 Q[1]≠2 Q[2]=4 Q[2]≠4

  7. Constraints skipped at the 2nd Level • Some symmetries are already broken: • e.g. (Q[1]=2 → Q[2]≠4)x → (Q[1]=2 → Q[2]≠4)x • (Q[1]=2 → Q[2]≠4)x ≡ (Q[1]=7 → Q[2]≠5) • No solution containing Q[1]=2 can have the symmetries: x, y, d1 or d2 • Problem constraints break these symmetries Q[1]=2 Q[1]≠2 Q[2]=4 Q[2]≠4

  8. Constraints Added to the Example (var≠val)g (Q[1]≠2)r90 ≡ Q[2]≠8 (Q[1]≠2)r180 ≡ Q[8]≠7 (Q[1]≠2)r270 ≡ Q[7]≠1 (Q[1]≠2)x ≡ Q[1]≠7 (Q[1]≠2)y ≡ Q[8]≠2 (Q[1]≠2)d1 ≡ Q[2]≠1 (Q[1]≠2)d2 ≡ Q[7]≠8 Q[1]=2 Q[1]≠2 Q[2]=4 Q[2]≠4 (A → var≠val)→ (A→ var≠val)g (Q[1]=2 → Q[2]≠4) → (Q[1]=2 → Q[2]≠4)r90 ≡ (Q[2]=8 → Q[4]≠7) (Q[1]=2 → Q[2]≠4) → (Q[1]=2 → Q[2]≠4)r180 ≡ (Q[8]=7 → Q[7]≠5) (Q[1]=2 → Q[2]≠4) → (Q[1]=2 → Q[2]≠4)r270 ≡ (Q[7]=1 → Q[5]≠2)

  9. Example Contradicting the Notation in Figure 10.10 (page 352) Q[1]=1 Q[1]≠1 Q[2]=5 Q[2]≠5 Consider 5-queens problem. <q1,q2,q3,q4,q5> = <1,3,5,2,4> is a solution. Applying the notation usein in Figure 10.10 for the assignment Q[1]=1 we get: (Q[1]=1 → (Q[2]≠5)r90 ≡ (Q[5]≠4) Notice that this constraint eliminates the solution <1,3,5,2,4>, before any solution symmetric to it is encountered. This constraint must be specified as follows according to the expression (10.2): (Q[1]=1 → Q[2]≠5) → (Q[1]=1 → Q[2]≠5)r90 ≡ (Q[1]=5 → Q[5]≠4)

  10. Constraints Added by SBDS • When constraints are added at the point of backtracking from a choice (var ≠ val): (A → var≠val) → (A → var≠val)g • A is true and (var ≠ val) is true • Can simplify the constraint to: Ag → (var≠val)g • Ag ensures that only unbroken symmetries are considered • Practical implementations do not add all the constraints

  11. Correctness of SBDS • Backofen and Will '99 proved that this method: • Explores full non-symmetric search space • No solutions can be completely missed • No returned two solutions can be equivalent

  12. Implementations of SBDS • Number of implementations of SBDS have been provided • ECLiPSe is publicly available implementation [Petrie ’05] • Demands the implementation of a function for each symmetry • User has to identify and implement each symmetry • Used successfully despite the difficulties

  13. Problems with SBDS If the number of symmetries in a problem is large: • Large number of symmetry functions has to be specified • In the worst case, too many functions to be successfully compiled • Feasible to use the method in its entirety only with problems with small symmetry groups • Choose only a subset of the symmetry groups for problems with large symmetry groups

  14. Symmetry Breaking via Dominance Detection • SBDD break symmetries during search • Checks every node being explored if it is symmetrically equivalent to one already explored • If equivalent, prunes the branch • Developed independently by Focacci & Milano ‘01 and Schamberger & Sellmann ‘01

  15. SBDD Main Idea • Need to store the whole explored tree? • Explored tree is exponentially sized • Only need to store the roots of fully explored subtrees • Search backtracked from an equivalent node: • Either visited the equivalent node • Deduced no need to visit

  16. SBDD Example: All Different • Variables: v1, v2, v3 • All different constraints • Domains: {1,2,3,4} • 24 solutions • Any variable permutation is a symmetric solution • Nodes 7 & 3 are symmetric solutions 0:root 1:v1=1 2:v2=2 5:v2≠2 3:v3=3 4:v3≠3 6:v2=3 7:v3=2 8:v3≠2

  17. No-Good Nodes • Based on the notion of no-goods: prune if equivalent to a no-good • No-goods are the roots of completely traversed maximal subtrees by depth first search • Node v is a no-good w.r.t. n if there exists an ancestor na of ns.t. v is the left child of na and v is not an ancestor of n • All solutions search: • Fully explored trees may contain solutions • Avoid searching symmetric equivalent subtrees r n a v

  18. Dominance • P(v): the path from the root of the search tree to a no-good node v • S(n): When search at node n, set of variables whose domains are reduced to a singleton • Node n is dominated if there exists a no-good vw.r.t. n and a symmetry gs.t. (P(v))g (\subseteq) S(n) • v dominates n

  19. SBDD Technique • Never generate the children of dominated nodes • Example: • P(2)={v1=1, v2=2} • (P(2))g={v1=1, v3=2} • S(7)={v1=1, v3=2, v2=3} • Node 7 dominated by no-good 2 0:root 1:v1=1 2:v2=2 5:v2≠2 3:v3=3 4:v3≠3 6:v2=3 7:v3=2 8:v3≠2

  20. Implementation of Dominance Checks • SBDD requires a problem specific function: f(v,n) → {true, false} • For each pair v& n, the search for g amounts to solving a sub graph isomorphism problem • NP-complete problems at each node but good results obtained using the technique

  21. Implementation of Dominance Checks 2 Three broad techniques for implementation: • Implement a dominance checker specific for a particular problem • Construct a constraint encoding of the dominance problem (problem specific) • Use computational group theory

  22. SBDD and Propagation • Failed dominance checks can result in propagation: • Dominance check reports the missing variable-value pair (v,x) to make the node dominated • Can remove x from the domain of v and propagate the result

  23. Scheduling Dominance Checks Dominance check: • Does not need to be done at every node of the search tree • Sufficient if only the leaf nodes are checked • Tradeoff between cost of checks and savings in search time

  24. Comparing SBDS & SBDD • Both do not require symmetries to be variable symmetries as in lex-leader method • The representative solution in each equivalent class of solutions is always the leftmost one in the traversed search tree for both • Both Respect variable and value ordering heuristics • SBDS places constraints to stop search before reaching symmetrically equivalent nodes • SBDD prunes search nodes that are symmetrically equivalent to visited nodes • Set of acceptable solutions is the same for both • SBDD can outperform SBDS in many problems since it does not have to post large number of constraints

More Related