1 / 35

Arc-consistency for alldiff(x,y,...,z)

Arc-consistency for alldiff(x,y,...,z). Example: P=(X,D,C) Variables: { w,x,y,z }  X Domains: w  { b,c,d,e } x  { b,c } y  { a,b,c,d } z  { b,c } Constraints: alldiff(w,x,y,z) C value d for w is supported: alldiff(wd, xb, y a, zc) = true

lixue
Download Presentation

Arc-consistency for alldiff(x,y,...,z)

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. Arc-consistency for alldiff(x,y,...,z) • Example: P=(X,D,C) Variables: {w,x,y,z}X Domains: w{b,c,d,e} x{b,c} y{a,b,c,d} z{b,c} Constraints: alldiff(w,x,y,z)C • value d for w is supported: • alldiff(wd, xb, y a, zc) = true • value b for w is not supported!

  2. alldiff: value graph Variables {w,x,y,z}X Domains D(w)={b,c,d,e}, D(x)={b,c}, D(y)={a,b,c,d}, D(z)={b,c} Constraint alldiff(w,x,y,z)C a w b x c y d z e

  3. alldiff: value graph Variables {w,x,y,z}X Domains D(w)={b,c,d,e}, D(x)={b,c}, D(y)={a,b,c,d}, D(z)={b,c} Constraint alldiff(w,x,y,z)C a w b Given a graph G=(V,E), a matching is ME such that no two edges of M share a vertex x c y d z e

  4. alldiff: value graph Variables {w,x,y,z}X Domains D(w)={b,c,d,e}, D(x)={b,c}, D(y)={a,b,c,d}, D(z)={b,c} Constraint alldiff(w,x,y,z)C a w b Consistent assignment = maximal cardinality matching covering all the variables We want to remove edges that do not belong to any max-card matching x c y d z e

  5. AC characterization • Theorem: Let G be a graph and M a maximum-cardinality matching. An edge e belongs to some max-card matching iff • e is in M, or • e is on an even-length M-alternating circuit • e is on an even-length M-alternating path starting at a M-free vertex

  6. AC Algorithm • Compute a maximum-cardinality matching. • Compute all even-length M-alternating circuits • Compute all even-length M-alternating paths starting at a M-free vertex • Remove all edges not identified in the previous 3 steps

  7. Step 1. Find Max-card matching • A matching M covers a vertex v if v belongs to some edge in M • A matching M covers a set SV if it covers all the vertices of S • A vertex v is M-free is M does not cover v a b f c e d

  8. Paths • A path is M-alternating if its edges are are alternatingly out of and in M • A M-alternating path is M-augmenting if • has odd length, • Its ends are not covered by M a b f c e d

  9. Step 1 • Finding M-augmenting paths a w b x c y d z e

  10. Step 1 • Finding M-augmenting paths a Direct the graph w b x c y d z e

  11. Step 1 • Finding M-augmenting paths is easy for bipartite graphs a Find a path from an M-free vertex on the left to an M-free vertex on the right w b x c y d z e

  12. Step 1 • Finding M-augmenting paths is easy for bipartite graphs a Find a path from an M-free vertex on the left to an M-free vertex on the right w b x c y d z e

  13. Step 1 • Finding M-augmenting paths is easy for bipartite graphs a Find a path from an M-free vertex on the left to an M-free vertex on the right w b x c y d z e

  14. Step 1 a Find a path from an M-free vertex on the left to an M-free vertex on the right n breadth-first traversals O(n e) Can be improved to O(n0.5 e) w b x c y d z e

  15. Step 2: • Compute all even-length M-alternating circuit a w b x c y d z e

  16. Step 2: • Compute all even-length M-alternating circuit a Direct the graph w b x c y d z e

  17. Step 2: • Compute all even-length M-alternating circuit a Compute all strongly Connected components [Tarjan 72] O(e) w b x c y d z e

  18. Tarjan (Kosaraju’s) • Do a DFS • Reverse the direction of edges • Do a DFS starting with the vertex visited last in the original DFS • Each tree in the forest returned is a SCC • O(|V|+|A|)

  19. Step 3: • Compute all even-length M-alternating paths starting at a M-free vertex a w b x c y d z e

  20. Step 3: • Compute all even-length M-alternating paths starting at a M-free vertex a Direct the graph w b x c y d z e

  21. Step 3: • Compute all even-length M-alternating paths starting at a M-free vertex a Compute alternating Paths starting from free Vertices Breadth-first O(e) w b x c y d z e

  22. Step 4 • Remove Edges not identified in previous steps a w b x c y d z e

  23. Step 4 • Remove Edges not identified in previous steps a w b x c y d z e

  24. Step 4 • Remove Edges not identified in previous steps a w b x c y d z e

  25. Step 4 • Remove Edges not identified in previous steps a w b x c y d z e

  26. Step 4 • Remove Edges not identified in previous steps a w b x c y d z e

  27. knapsack constraint • Notation: L≤ax+by+...+cz≤U L, U, a, b, ..., c positive integer constants x, y,..., z integer variables (posit. domains) • Example: • Variables: x,y,v,z • Domains: {0, 1} • 10 ≤ 2x + 3y + 4v + 5z ≤ 12 • Applications: everywhere

  28. knapsack constraint • Example: • Variables: x,y,v,z • Domains: {0, 1} • 10 ≤ 2x + 3y + 4v + 5z ≤ 12 • Value 0 of x is supported (0+3+4+5=12) • Value 1 of x is supported (2+0+4+5=11) • Value 0 of z is not supported!!

  29. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 x y v z

  30. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 x y v z

  31. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 x y v z

  32. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 x y v z

  33. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 • Reduced graph • Value 0 of z can be removed x y v z

  34. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 • Reduced graph • Value 0 of z can be removed x y v z

  35. knapsack: propagation 12 11 10 9 8 7 6 5 4 3 2 1 0 • Knapsack graph 10 ≤ 2x + 3y + 4v + 5z ≤ 12 • Reduced graph • Value 0 of z can be removed • Complexity: O(nU2) • n is the number of variables • Pseudo-polynomial x y v z

More Related