Routing, Geometric and Regulations Constraints Nicolas Beldiceanu SICS Lägerhyddsvägen 5 SE-75237 Uppsala, Sweden (nicolas@sics.se)
��������������� �����������
The cycle constraint DEFINITION Covering a directed graph with N circuits in such a way that each vertex belongs to one single circuit. Number N of cycles of a permutation (other interpretation) CONSTRAINT S6 S1 S3 cycle(N,Succ) Extensions, constraints sur : • Weight of each circuit, • • • S5 S2 S4 • Vertices ∉ ∉ to the same circuit, • • • ∉ ∉ • .................................................... • • • cycle( 2 , { 2,4,1,3,6,5 } )
Representation of the graph S1 :: {2,6} S2 :: {3,4} S6 S1 S3 S3 :: {1} S4 :: {2,3} S5 S2 S4 S5 :: {2,6} S6 :: {2,5}
Cycle ORIGIN : [BeldiceanuContejean94] ARGUMENTS : ctr_arguments(cycle,[NCYCLE-dvar, NODES-collection(index-int, succ-dvar)]). PURPOSE : Consider a directed graph G. Number of circuits for covering G in such a way that each vertex of G belongs to one single circuit. EXAMPLE : cycle(2, [[index-1, succ-2], [index-2, succ-1], [index-3, succ-5], [index-4, succ-3], [index-5, succ-4]])
Cycle: description ctr_graph( cycle , NODES [NODES], 2, [ CLIQUE >>collection(nodes1,nodes2)], [nodes1.succ = nodes2.index], [ NTREE = 0 , NCC = NCYCLE]). CLIQUE 1:index 2:index succ succ INITIAL GRAPH nodes1.succ = nodes2.index ARC CONSTRAINT
Cycle: from initial to final graph NODES CLIQUE INITIAL GRAPH cycle(2, [[index-1, succ-2], NTREE=0, NCC=2 [index-2, succ-1], [index-3, succ-5], FINAL GRAPH [index-4, succ-3], [index-5, succ-4]])
Propagation S6 S1 S3 S6 S1 S3 S5 S2 S4 S5 S2 S4 cycle(N, {S1,S2,S3,S4,S5,S6}) N ≤ ≤ 2 ≤ ≤ S6 ≠ ≠ 2 S2 ≠ ≠ 3 S4 ≠ ≠ 2 ≠ ≠ ≠ ≠ ≠ ≠ • strongly connected components • matching (since alldifferent ) • deduction rules ( matching and minimum weight )
Using strongly connected components for pruning DEFINITION Two vertices v1 and v2 of a directed graph G belong to the same strongly connected component iff: (1) There is a path from v1 to v2, (2) There is also a path from v2 to v1. scc1 scc2 S6 S1 S3 S5 S2 S4
Using strongly connected components for pruning RULE 1 Adjust the minimum number of circuits to the number of strongly connected components. scc1 scc2 S6 S1 S3 S5 S2 S4 min(N) ≥ ≥ 2 ≥ ≥
Using strongly connected components for pruning RULE 2 Remove all the links between vertices that do not belong to the same strongly connected component. scc1 scc2 S6 S1 S3 S5 S2 S4
Specific patterns for pruning DEFINITION A chain is a sequence of vertices v 1 ,v 2 ,...,v n (n>2) such that for all i in 2..n-1: (1) v i has only v i-1 and v i+1 as possible successors, (2) v 2 is one possible successor of v 1 , (3) v n-1 is one possible successor of v n . S6 S1 S3 S5 S2 S4
Specific patterns for pruning RULE Consider a chain v 1 ,v 2 ,...,v n . If n is strictly less than the number of vertices of the smallest circuit then one can not close the previous chain. S6 S1 S3 S5 S2 S4
Enumeration S6 S1 S3 S1 = 2 S5 S2 S4 S6 S1 S3 cycle( 2 , { 2,4,1,3,6,5 } ) S5 S2 S4 S1 = 6 S6 S1 S3 N ≤ 2 S6 ≠ 2 S2 ≠ 3 S4 ≠ 2 S5 S2 S4 cycle( 1 , { 6,4,1,3,2,5 } )
Binary_tree ORIGIN : [Beldiceanu00] ARGUMENTS : ctr_arguments(binary_tree,[NTREES-dvar , NODES-collection(index-int, succ-dvar)]). PURPOSE : Cover the directed graph G described by the NODES collection with NTREES binary trees in such a way that each vertex of G belongs to one distinct binary tree. EXAMPLE : binary_tree(2, [[index-1, succ-1], [index-2, succ-3], [index-3, succ-5], [index-4, succ-7], [index-5, succ-1], [index-6, succ-1], [index-7, succ-7], [index-8, succ-5]])
Binary_tree: description ctr_graph( binary_tree , [NODES], NODES 2, [ CLIQUE >>collection(nodes1,nodes2)], [nodes1.succ = nodes2.index], [ MAX_NSCC =< 1, NCC = NTREES, MAX_IN_DEGREE =< 2]). 1:index 2:index CLIQUE succ succ INITIAL GRAPH nodes1.succ = nodes2.index ARC CONSTRAINT
Binary_tree: final graph CC#1 CC#2 binary_tree(2, [[index-1, succ-1], [index-2, succ-3], [index-3, succ-5], [index-4, succ-7], [index-5, succ-1], [index-6, succ-1], [index-7, succ-7], [index-8, succ-5]]) MAX_NSCC=1, NCC=2 MAX_IN_DEGREE=2 FINAL GRAPH
Tree_range ORIGIN : Derived from tree. ARGUMENTS : ctr_arguments(tree_range,[NTREES-dvar, RANGE-dvar, NODES-collection(index-int, succ-dvar)]). PURPOSE : Cover the directed graph G described by the NODES collection with NTREES trees in such a way that each vertex of G belongs to one distinct tree. RANGE is the difference between the longest and the shortest paths of the final graph. EXAMPLE : tree_range(2,1,[[index-1, succ-1], [index-2, succ-5], [index-3, succ-5], [index-4, succ-7], [index-5, succ-1], [index-6, succ-1], [index-7, succ-7], [index-8, succ-5]])
Tree_range INITIAL GRAPH FINAL GRAPH
Map ORIGIN : Inspired by [SedgewickFlajolet96] ARGUMENTS : ctr_arguments(map, [NBCYCLE-dvar, NBTREE-dvar, NODES-collection(index-int, succ-dvar)]). PURPOSE : Number of trees and cycles of a map. Every map decomposes into a set of connected components, also called connected maps. Each component consists of the set of all points that wind up on the same cycle, with each point on the cycle attached to a tree of all points that enter the cycle at that point. EXAMPLE : map(2,3, [[index-1, succ-5],[index-2, succ-9],[index-3, succ-8], [index-4, succ-2],[index-5, succ-9],[index-6, succ-2], [index-7, succ-9],[index-8, succ-8],[index-9, succ-1]])
Map ctr_graph( map , ['NODES'], 2, ['CLIQUE'>>collection(nodes1,nodes2)], [nodes1.succ = nodes2.index], ['NCC' = 'NBCYCLE', 'NTREE' = 'NBTREE' ]). INITIAL GRAPH
Map map (2,3, [[index-1, succ-5], [index-2, succ-9], [index-3, succ-8], [index-4, succ-2], [index-5, succ-9], [index-6, succ-2], [index-7, succ-9], [index-8, succ-8], [index-9, succ-1]]) FINAL GRAPH
Exercise: using the properties of depth-first search for pruning when has to build one circuit Depth-first search on a directed graph find some information about the structure of the graph (see chapter 23 of Introduction to Algorithms from Cormen, Leiserson, Rivest). Assume we have to cover a directed graph with one single circuit. Assume we make a depth-first search on that graph. Find some typical patterns on the depth-first forest which lead to some pruning.
������������ �����������
Two_quad_do_not_overlap ORIGIN : Used for defining diffn. ARGUMENTS : ctr_types(two_quad_do_not_overlap, [QUADRANGLE-collection(ori-dvar, size-dvar, end-dvar)]). ctr_arguments(two_quad_do_not_overlap, [QUADRANGLE1-QUADRANGLE, QUADRANGLE2-QUADRANGLE]). PURPOSE : Enforce two quadrangles to not overlap. Two quadrangles do not overlap if there exists at least one dimension where they do not overlap. EXAMPLE : two_quad_do_not_overlap([[ori-2,siz-2,end-4], [ori-1,siz-3,end-4]], [[ori-4,siz-4,end-8], [ori-3,siz-3,end-6]])
Two_quad_do_not_overlap ctr_graph( two_quad_do_not_overlap , [QUADRANGLE1,QUADRANGLE2], 2, QUADRANGLE1 [ SYMMETRIC_PRODUCT(=) >> collection(quadrangle1,quadrangle2)], [quadrangle1.end =< quadrangle2.ori #\/ quadrangle1.size = 0], [ NARC >= 1]). 1:ori 2:ori size size QUADRANGLE2 end end SYMMETRIC_PRODUCT(=) quadrangle1.end ≤ ≤ quadrangle2.ori ≤ ≤ INITIAL GRAPH \/ quadrangle1.size = 0 ARC CONSTRAINT
Two_quad_do_not_overlap QUADRANGLE1 QUADRANGLE2 SYMMETRIC_PRODUCT(=) NARC=1 INITIAL GRAPH FINAL GRAPH two_quad_do_not_overlap([[ori-2,siz-2,end-4], [ori-1,siz-3,end-4]], [[ori-4,siz-4,end-8], [ori-3,siz-3,end-6]])
Diffn ORIGIN : [BeldiceanuContejean94] ARGUMENTS : ctr_types(two_quad_do_not_overlap, [QUADRANGLE-collection(ori-dvar, size-dvar, end-dvar)]). ctr_arguments(diffn, [QUADRANGLES-collection(quad-QUADRANGLE)]). PURPOSE : Holds if for each pair of quadrangles the two quadrangles do not overlap. Two quadrangles do not overlap if there exists at least one dimension where they do not overlap. EXAMPLE : diffn([[quad-[[ori-2, siz-2, end-4 ], [ori-1, siz-3, end-4]] ], [quad-[[ori-4, siz-4, end-8 ], [ori-3, siz-3, end-3]] ], [quad-[[ori-9, siz-2, end-11], [ori-4, siz-3, end-7]] ]])
Diffn INITIAL GRAPH FINAL GRAPH
Exercise: pruning for non-overlapping rectangles 1) Is it possible to place 5 squares of size 2x2 in a square of size 5x5 in such a waht that: • the five squares do not overlap, • the borders of the small squares are // to the borders of the big square. 2) Find a general method for exploiting the previous fact.
Recommend
More recommend