Routing, Geometric and Regulations Constraints Nicolas Beldiceanu - - PowerPoint PPT Presentation

routing geometric and regulations constraints
SMART_READER_LITE
LIVE PREVIEW

Routing, Geometric and Regulations Constraints Nicolas Beldiceanu - - PowerPoint PPT Presentation

Routing, Geometric and Regulations Constraints Nicolas Beldiceanu SICS Lgerhyddsvgen 5 SE-75237 Uppsala, Sweden (nicolas@sics.se) The cycle constraint


slide-1
SLIDE 1

Routing, Geometric and Regulations Constraints

Nicolas Beldiceanu SICS

Lägerhyddsvägen 5 SE-75237 Uppsala, Sweden (nicolas@sics.se)

slide-2
SLIDE 2
slide-3
SLIDE 3

Covering a directed graph with N circuits in such a way that each vertex belongs to one single circuit. cycle(N,Succ)

The cycle constraint

cycle(2, {2,4,1,3,6,5}) S1 S2 S3 S4 S5 S6 DEFINITION CONSTRAINT

Number N of cycles of a permutation (other interpretation) Extensions, constraints sur :

  • Weight of each circuit,
  • Vertices ∉

∉ ∉ ∉ to the same circuit,

  • ....................................................
slide-4
SLIDE 4

S1 :: {2,6} S2 :: {3,4} S3 :: {1} S4 :: {2,3} S5 :: {2,6} S6 :: {2,5} S1 S2 S3 S4 S5 S6

Representation of the graph

slide-5
SLIDE 5

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

  • f G belongs to one single circuit.

Cycle

ORIGIN : [BeldiceanuContejean94] EXAMPLE :

cycle(2, [[index-1, succ-2], [index-2, succ-1], [index-3, succ-5], [index-4, succ-3], [index-5, succ-4]])

slide-6
SLIDE 6

Cycle: description

NODES

INITIAL GRAPH

CLIQUE

ctr_graph(cycle, [NODES], 2, [CLIQUE>>collection(nodes1,nodes2)], [nodes1.succ = nodes2.index], [NTREE = 0 , NCC = NCYCLE]).

1:index succ 2:index succ

nodes1.succ = nodes2.index ARC CONSTRAINT

slide-7
SLIDE 7

cycle(2, [[index-1, succ-2], [index-2, succ-1], [index-3, succ-5], [index-4, succ-3], [index-5, succ-4]])

Cycle: from initial to final graph

FINAL GRAPH

NTREE=0, NCC=2

INITIAL GRAPH

NODES CLIQUE

slide-8
SLIDE 8

Propagation

S1 S2 S3 S4 S5 S6 cycle(N, {S1,S2,S3,S4,S5,S6}) 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)

slide-9
SLIDE 9

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. S1 S2 S3 S4 S5 S6

scc1 scc2

slide-10
SLIDE 10

min(N)≥ ≥ ≥ ≥2 Using strongly connected components for pruning

RULE 1 Adjust the minimum number of circuits to the number of strongly connected components. S1 S2 S3 S4 S5 S6

scc1 scc2

slide-11
SLIDE 11

Using strongly connected components for pruning

RULE 2 Remove all the links between vertices that do not belong to the same strongly connected component. S1 S2 S3 S4 S5 S6

scc1 scc2

slide-12
SLIDE 12

Specific patterns for pruning

S1 S2 S3 S4 S5 S6 DEFINITION A chain is a sequence of vertices v1,v2,...,vn (n>2) such that for all i in 2..n-1: (1) vi has only vi-1 and vi+1 as possible successors, (2) v2 is one possible successor of v1, (3) vn-1 is one possible successor of vn.

slide-13
SLIDE 13

Specific patterns for pruning

S1 S2 S3 S4 S5 S6 RULE Consider a chain v1,v2,...,vn. If n is strictly less than the number of vertices of the smallest circuit then one can not close the previous chain.

slide-14
SLIDE 14

Enumeration

cycle(2, {2,4,1,3,6,5}) S1 S2 S3 S4 S5 S6 cycle(1, {6,4,1,3,2,5}) S1 S2 S3 S4 S5 S6 S1 S2 S3 S4 S5 S6 N ≤ 2 S6 ≠ 2 S2 ≠ 3 S4 ≠ 2 S1 = 6 S1 = 2

slide-15
SLIDE 15

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

  • ne distinct binary tree.

Binary_tree

ORIGIN : [Beldiceanu00] 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]])

slide-16
SLIDE 16

Binary_tree: description

CLIQUE NODES

INITIAL GRAPH ctr_graph(binary_tree, [NODES], 2, [CLIQUE>>collection(nodes1,nodes2)], [nodes1.succ = nodes2.index], [MAX_NSCC =< 1, NCC = NTREES, MAX_IN_DEGREE =< 2]).

1:index succ 2:index succ

nodes1.succ = nodes2.index ARC CONSTRAINT

slide-17
SLIDE 17

Binary_tree: final graph

FINAL GRAPH

MAX_NSCC=1, NCC=2 MAX_IN_DEGREE=2 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]])

slide-18
SLIDE 18

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.

ORIGIN : Derived from tree. 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

slide-19
SLIDE 19

Tree_range

INITIAL GRAPH FINAL GRAPH

slide-20
SLIDE 20

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.

Map

ORIGIN : Inspired by [SedgewickFlajolet96] 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]])

slide-21
SLIDE 21

Map

ctr_graph(map, ['NODES'], 2, ['CLIQUE'>>collection(nodes1,nodes2)], [nodes1.succ = nodes2.index], ['NCC' = 'NBCYCLE', 'NTREE' = 'NBTREE' ]).

INITIAL GRAPH

slide-22
SLIDE 22

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

slide-23
SLIDE 23

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.

slide-24
SLIDE 24
slide-25
SLIDE 25

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.

ORIGIN : Used for defining diffn. 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

slide-26
SLIDE 26

Two_quad_do_not_overlap

ctr_graph(two_quad_do_not_overlap, [QUADRANGLE1,QUADRANGLE2], 2, [SYMMETRIC_PRODUCT(=)>> collection(quadrangle1,quadrangle2)], [quadrangle1.end =< quadrangle2.ori #\/ quadrangle1.size = 0], [NARC >= 1]).

1:ori size end 2:ori size end

ARC CONSTRAINT quadrangle1.end ≤ ≤ ≤ ≤ quadrangle2.ori \/ quadrangle1.size = 0 SYMMETRIC_PRODUCT(=) QUADRANGLE1 QUADRANGLE2 INITIAL GRAPH

slide-27
SLIDE 27

Two_quad_do_not_overlap

SYMMETRIC_PRODUCT(=) QUADRANGLE1 QUADRANGLE2 INITIAL GRAPH FINAL GRAPH

NARC=1

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]])

slide-28
SLIDE 28

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.

ORIGIN : [BeldiceanuContejean94] 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

slide-29
SLIDE 29

Diffn

INITIAL GRAPH FINAL GRAPH

slide-30
SLIDE 30

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.

slide-31
SLIDE 31

ARGUMENTS :

ctr_types(place_in_pyramid, [QUADRANGLE-collection(ori-dvar, siz-dvar, end-dvar)]). ctr_arguments(place_in_pyramid, [QUADRANGLES-collection(quad-QUADRANGLE), VERTICAL_DIM-int]).

PURPOSE :

Each quadrangle of the collection QUADRANGLES should be supported by one other object or by the ground.

ORIGIN : N.Beldiceanu EXAMPLE :

place_in_pyramid([[quad-[[ori-1, siz-2, end-3], [ori-1, siz-3, end-4 ]] ], [quad-[[ori-3, siz-3, end-6], [ori-1, siz-2, end-3 ]] ], [quad-[[ori-1, siz-2, end-3], [ori-5, siz-6, end-11]] ], [quad-[[ori-3, siz-2, end-5], [ori-5, siz-2, end-7 ]] ], [quad-[[ori-3, siz-2, end-5], [ori-8, siz-3, end-11]] ], [quad-[[ori-5, siz-2, end-7], [ori-8, siz-2, end-10]] ]],1)

Place_in_pyramid

slide-32
SLIDE 32

Place_in_pyramid

INITIAL GRAPH FINAL GRAPH

slide-33
SLIDE 33

A METHOD FOR DERIVING FILTERING ALGORITHMS FOR CLIQUE OF GEOMETRICAL CONSTRAINTS

slide-34
SLIDE 34

Sweep Algorithms in Computational Geometry

Standard technique in the design of efficient algorithms, described in:

  • Computational geometry, an introduction

[Preparata & Shamos, 1985]

  • Computational Geometry, Algorithms and Applications

[Berg, Kreveld, Overmars & Schwarzkopf, 1997]

  • Géométrie algorithmique

[Boissonnat & Yvinec, 1995]

slide-35
SLIDE 35

Main Ideas of Sweep Algorithms

(in the context of line segment intersection) y x

event point sweep line sweep line status (1) (2)

Steps of the sweep algorithm:

(1) Move to the next event point (2) Update the sweep line status:

  • start events:
  • end events:

GOAL: the worst case complexity should also depend of the number of intersections

slide-36
SLIDE 36

Forbidden Regions

Two intervals inf_x..sup_x and inf_y..sup_y such that: For all x in inf_x..sup_x, y in inf_y..sup_y: Ctr with the assignment X=x and Y=y is false. DEFINITION forbidden region according to a constraint Ctr and two variables X,Y of Ctr : EXAMPLE forbidden regions of alldifferent({X,Y,R}) according to X and Y :

X Y 0 1 2 3 4 1 2 3 4

slide-37
SLIDE 37

Examples of Forbidden Regions

(A) (B) (C) (D) (E)

0≤ ≤ ≤ ≤X≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤Y≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤R≤ ≤ ≤ ≤9 X Y 0 1 2 3 4 1 2 3 4 X Y 0 1 2 3 4 1 2 3 4 X Y 0 1 2 3 4 1 2 3 4 0≤ ≤ ≤ ≤X≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤Y≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤X≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤Y≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤T≤ ≤ ≤ ≤2 0≤ ≤ ≤ ≤U≤ ≤ ≤ ≤3 X Y 0 1 2 3 4 1 2 3 4 0≤ ≤ ≤ ≤X≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤Y≤ ≤ ≤ ≤4 alldifferent({X,Y,R}) |X-Y|>2 X Y 0 1 2 3 4 1 2 3 4 0≤ ≤ ≤ ≤X≤ ≤ ≤ ≤4 0≤ ≤ ≤ ≤Y≤ ≤ ≤ ≤4 1≤ ≤ ≤ ≤S≤ ≤ ≤ ≤6 X+2Y≤ ≤ ≤ ≤S X+2≤ ≤ ≤ ≤T ∨ ∨ ∨ ∨ T+3≤ ≤ ≤ ≤X ∨ ∨ ∨ ∨ Y+4≤ ≤ ≤ ≤U ∨ ∨ ∨ ∨ U+2≤ ≤ ≤ ≤Y X+Y≡ ≡ ≡ ≡0 (mod 2)

slide-38
SLIDE 38

get_first_forbidden_regions(X,Y,Ctr) get_next_forbidden_regions(X,Y,Ctr,Previous) get_last_forbidden_regions(X,Y,Ctr) get_prev_forbidden_regions(X,Y,Ctr,Previous) check_if_in_forbidden_regions(x,y,Ctr)

Primitives for Getting Forbidden Regions on Request

X Y

0 1 2 3 4

1 2 3 4 get_first_forbidden_regions X Y 0 1 2 3 4 1 2 3 4 get_next_forbidden_regions X Y 0 1 2 3 4 1 2 3 4 get_next_forbidden_regions max(Y) X Y 0 1 2 3 4 1 2 3 4 min(X) max(X) min(Y) X+Y≡ ≡ ≡ ≡0 (mod 2)

slide-39
SLIDE 39

Basic Idea of Sweep Pruning

Accumulates forbiden regions that come from different constraints involving two given variables X and Y CTR1(X,Y,…) CTR2(X,Y,…) ……………… CTRn(X,Y,…) Y X sweep line

Is min(X) feasible ? No, so move the sweep-line.

event point sweep line status

slide-40
SLIDE 40

Sweep Line Status

Y For each y ∈ ∈ ∈ ∈ dom(Y): number of forbidden regions containing the point (∆ ∆ ∆ ∆,y) Y X

∆ ∆ ∆ ∆

sweep line status

1 2 1 1 1 1

X Remove a value ∆ ∆ ∆ ∆ ∈ ∈ ∈ ∈ dom(X) if : for all y ∈ ∈ ∈ ∈ dom(Y) the number

  • f forbidden regions is > 0
slide-41
SLIDE 41

Possible Utilisations

  • Feasibility check
  • Adjusting bounds
  • Pruning values

X Y X Y X Y

slide-42
SLIDE 42

Y X = 0

1 2 3 4

An Example

0≤X≤4 0≤Y≤4 1≤S≤6 0≤T≤2 0≤U≤3 alldifferent({X,Y,R}) |X-Y|>2 X+2Y≤S X+2≤T ∨ ∨ ∨ ∨ T+3≤X ∨ ∨ ∨ ∨ Y+4≤U ∨ ∨ ∨ ∨ U+2≤Y X+Y≡0 (mod 2)

PROBLEM:

Adjust minimum of X according to Y and to all following constraints: alldifferent({X,Y,R}) |X-Y|>2 X+2Y≤S X+2≤T ∨ ∨ ∨ ∨ T+3≤X ∨ ∨ ∨ ∨ Y+4≤U ∨ ∨ ∨ ∨ U+2≤Y X+Y≡0 (mod 2)

slide-43
SLIDE 43

Y x=0

1 2 3 4

Y

1 2 3 4

X = 1 alldifferent({X,Y,R}) |X-Y|>2 X+2Y≤S X+2≤T ∨ ∨ ∨ ∨ T+3≤X ∨ ∨ ∨ ∨ Y+4≤U ∨ ∨ ∨ ∨ U+2≤Y X+Y≡0 (mod 2)

An Example

0≤X≤4 0≤Y≤4 1≤S≤6 0≤T≤2 0≤U≤3 alldifferent({X,Y,R}) |X-Y|>2 X+2Y≤S X+2≤T ∨ ∨ ∨ ∨ T+3≤X ∨ ∨ ∨ ∨ Y+4≤U ∨ ∨ ∨ ∨ U+2≤Y X+Y≡0 (mod 2)

PROBLEM:

Adjust minimum of X according to Y and to all following constraints:

slide-44
SLIDE 44

Y X=0

1 2 3 4

Y

1 2 3 4

X=1 Y

1 2 3 4

X=2 Y

1 2 3 4

X=3

Y

1 2 3 4

X = 4

An Example

0≤X≤4 0≤Y≤4 1≤S≤6 0≤T≤2 0≤U≤3 alldifferent({X,Y,R}) |X-Y|>2 X+2Y≤S X+2≤T ∨ ∨ ∨ ∨ T+3≤X ∨ ∨ ∨ ∨ Y+4≤U ∨ ∨ ∨ ∨ U+2≤Y X+Y≡0 (mod 2)

PROBLEM:

Adjust minimum of X according to Y and to all following constraints:

Deduction: X>3

alldifferent({X,Y,R}) |X-Y|>2 X+2Y≤S X+2≤T ∨ ∨ ∨ ∨ T+3≤X ∨ ∨ ∨ ∨ Y+4≤U ∨ ∨ ∨ ∨ U+2≤Y X+Y≡0 (mod 2)

slide-45
SLIDE 45

Typical Constraint Structure for Applying Sweep

  • A R G U M E N T
  • R E S T R I C T I O N (S)
  • V E R T E X

I N P U T

  • V E R T E X

G E N E R A T O R

  • E D G E

I N P U T

  • E D G E

G E N E R A T O R

  • E D G E

A R I T Y

  • E D G E

C O N S T R A I N T

  • G R A P H

P R O P E R T Y : OBJECTS: collection(X-dvar,Y-dvar,...) : required(OBJECTS.X,OBJECTS.Y) : OBJECTS : IDENTITY : OBJECTS : CLIQUE(≠ ≠ ≠ ≠) : 2 : : NEDGE = |OBJECTS|.|OBJECTS| - |OBJECTS|

X1,Y1 X2,Y2 X3,Y3 X4,Y4

Non-overlapping Scheduling with set-up Cyclic scheduling

slide-46
SLIDE 46

Exercise: forbidden regions

Come up with a formula for computing the forbidden region(s) according to the non-overlapping constraint between two rectangles. Each rectangle is characterized by: (1) the coordinates Ox,Oy of its origin (leftmost lower point), (2) its sizes Sx, Sy.

Ox Oy Sx Sy

slide-47
SLIDE 47
slide-48
SLIDE 48

ARGUMENTS :

ctr_arguments(change, [NCHANGE-dvar , VARIABLES-collection(var-dvar), CTR-atom ]).

PURPOSE :

NCHANGE is the number of times that CTR holds on consecutive variables of the collection VARIABLES.

Change

ORIGIN : CHIP EXAMPLE :

change(3,[[var-4],[var-4],[var-3],[var-4],[var-1]],≠)

slide-49
SLIDE 49

Change: description

PATH VARIABLES INITIAL GRAPH ctr_graph(change, [VARIABLES], 2, [PATH>>collection(variables1,variables2)], [CTR(variables1.var,variables2.var)], [NARC = NCHANGE]).

1:var 2:var

CTR(variables1.var,variables2.var) ARC CONSTRAINT

slide-50
SLIDE 50

Change: from initial to final graph

PATH VARIABLES INITIAL GRAPH

≠ ≠ ≠ ≠

NARC=3

FINAL GRAPH change(3,[[var-4],[var-4],[var-3],[var-4],[var-1]],≠)

≠ ≠ ≠ ≠ ≠ ≠ ≠ ≠ ≠ ≠ ≠ ≠ =

slide-51
SLIDE 51

smooth(C, T, {V1,..,Vn }) smooth(1,2,{1,3,4,5, 2}) change(C, {V1,..,Vn }, ≠) change(3,{4,4, 3, 4, 1}, ≠) C : 0..n− − − −1 Vi ≠Vi +1 2 Arity Bounds for C and constraint CTR Member and example of solution cyclic_change(C, L, {V1,..,Vn }) cyclic_change(2,5,{2,3,4,0, 2,3, 1}) C : 0..n− − − −1 (Vi +1)mod L≠Vi +1 2 C : 0..n− − − −1 |Vi − − − −Vi +1 | >T 2 number_of_rest(C, {V1,..,Vn }) number_of_rest(2,{2,0, 0,1,1,0,2,0, 0,1,2 }) C : 0..n− − − −2 Vi =0 ∧ ∧ ∧ ∧Vi +1=0 ∧ ∧ ∧ ∧Vi +2 ≠0 3 relaxed_sliding_sum(a,b,low,up,k,{V1,..,Vn }) relaxed_sliding_sum(3,4,3,7,4,{2,4, 2, 0, 0,3,4}) C : a..b low ≤ ≤ ≤ ≤ Σ

Σ Σ ΣVi ≤

≤ ≤ ≤ up k

j=i i+k − − − − 1

Extensions of the change constraint

slide-52
SLIDE 52

FILTERING ALGORITHM FOR THE CHANGE CONSTRAINT AND ITS EXTENSIONS

slide-53
SLIDE 53

Organisation of the Algorithms cardinality_path( C, {V1 ,..,Vn }, CTR )

FILTERING ALGORITHMS find BOUNDS for C

PROPAGATE

from C to {V1 ,..,Vn }

slide-54
SLIDE 54

Lower Bound of the Number of Constraints that Hold

cyclic_change(C, 5, {V1,V2,V3,V4,V5,V6,V7,V8,V9})

V1: 0,3 V2: 2,3,4 V3: 0,4 V4: 0,1,2,3,4 V5: 0,1,2,3 V6: 0,2,4 V7: 0,1,2 V8: 0,1,2 V9: 0,4 V1: 0,3 V1: 3 V1: 3 V1: 3 V1: 3 contradiction V2: 4 V2: 4 V2: 4 V2: 4 V3: 0 V3: 0 V3: 0 V4: 1 V4: 1 V5: 2 (V1+1)mod 5=V2 (V2+1)mod 5=V3 (V3+1)mod 5=V4 (V4+1)mod 5=V5 (V5+1)mod 5=V6 V6: 0,2,4 V6: 0,4 V6: 0,4 contradiction V7: 0,1 V7: 0,1 V8: 1,2 (V6+1)mod 5=V7 (V7+1)mod 5=V8 (V8+1)mod 5=V9 V9: 0,4 CTR: (Vi+1) mod 5 ≠ Vi+1

min(C) ≥ ≥ ≥ ≥ 2

slide-55
SLIDE 55

Propagation from C to {V1 ,..,Vn }

Set min_break to 0. Set choice to 1. Create_choice_point. for i =1 to n -k +1 do Set before[i ] to min_break. if choice=0 then Set choice to 1. Create_choice_point. if enforce ¬CTR(Vi,..,Vi+k-1) fails then

  • Backtrack. Set choice to 0.

Set min_break to min_break +1. Set vbefore[i+k-1] to dom(Vi+k-1).

before[i ] (1≤ ≤ ≤ ≤i ≤ ≤ ≤ ≤n-k+1):

min.number of constraints that hold in

{CTR(V1,..,Vk),..,CTR(Vi-1,..,Vi+k-2} vbefore[i ] (k≤ ≤ ≤ ≤i ≤ ≤ ≤ ≤n):

state of dom(Vi) after stating constraint CTR(Vi-k+1,..,Vi)

slide-56
SLIDE 56

Set min_break to 0. Set choice to 1. Create_choice_point. for i = n -k +1 to 1 (step -1) do Set after[i ] to min_break. if choice=0 then Set choice to 1. Create_choice_point. if enforce ¬CTR(Vi,..,Vi+k-1) fails then

  • Backtrack. Set choice to 0.

Set min_break to min_break +1. Set vafter[i ] to dom(Vi).

after[i ] (n-k+1≥ ≥ ≥ ≥i ≥ ≥ ≥ ≥1):

min.number of constraints that hold in

{CTR(Vi+1,..,Vi+k),..,CTR(Vn-k+1,..,Vn} vafter[i ] (n-k+1≥ ≥ ≥ ≥i ≥ ≥ ≥ ≥1):

state of dom(Vi) after stating constraint CTR(Vi,..,Vi+k-1)

Propagation from C to {V1 ,..,Vn }

slide-57
SLIDE 57

First Rule

for i =1 to n -k +1 do if before[i ]+after[i ]+1>max(C) then enforce ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1).

¬ ¬ ¬ ¬CTR(V1,..,Vk) ¬ ¬ ¬ ¬CTR(Vi-1,..,Vi+k-2)

¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1)

¬ ¬ ¬ ¬CTR(Vi+1,..,Vi+k) ¬ ¬ ¬ ¬CTR(Vn-k+1,..,Vn)

... ...

before[i ] after[i ]

slide-58
SLIDE 58

k ≤ i ≤ n -k +1: if before[i –k+2]+after[i -1]+2 > max(C) then Vi ⊆ ⊆ ⊆ ⊆ vbefore[i ]∪ ∪ ∪ ∪vafter[i ].

If Vi ∉ ∉ ∉ ∉ vbefore[i ]∪ ∪ ∪ ∪vafter[i ] then at least before[i –k+2]+after[i -1]+2 constraints CTR hold We prove that :

Second Rule

slide-59
SLIDE 59

k ≤ i ≤ n -k +1: if before[i –k+2]+after[i -1]+2>max(C) then Vi ⊆ ⊆ ⊆ ⊆vbefore[i ]∪ ∪ ∪ ∪vafter[i ].

¬ ¬ ¬ ¬CTR(V1,..,Vk) ¬ ¬ ¬ ¬CTR(Vi-k+1,..,Vi) ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1) ¬ ¬ ¬ ¬CTR(Vn-k+1,..,Vn)

... ... ... ...

...

The k constraints which mention variable Vi

Second Rule

slide-60
SLIDE 60

¬ ¬ ¬ ¬CTR(V1,..,Vk) ¬ ¬ ¬ ¬CTR(Vi-k+1,..,Vi) ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1) ¬ ¬ ¬ ¬CTR(Vn-k+1,..,Vn)

... ...

¬ ¬ ¬ ¬CTR(Vf-1,..,Vf+k-2)

¬ ¬ ¬ ¬CTR(Vf,..,Vf+k-1) ... ...

...

f: smallest value ≤ i-k+1 such that:

  • no failure on ¬

¬ ¬ ¬CTR(Vf,..,Vf+k-1),.., ¬

¬ ¬ ¬CTR(Vi-k+1,..,Vi) during first iteration

  • f = 1 or

a failure occurs after stating ¬ ¬ ¬ ¬CTR(Vf-1,..,Vf+k-2)

Second Rule

slide-61
SLIDE 61

¬ ¬ ¬ ¬CTR(V1,..,Vk) ¬ ¬ ¬ ¬CTR(Vi-k+1,..,Vi) ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1) ¬ ¬ ¬ ¬CTR(Vn-k+1,..,Vn)

... ...

¬ ¬ ¬ ¬CTR(Vf-1,..,Vf+k-2) ¬ ¬ ¬ ¬CTR(Vf,..,Vf+k-1)

... ... ¬ ¬ ¬ ¬CTR(Vl,..,Vl+k-1)

¬ ¬ ¬ ¬CTR(Vl+1,..,Vl+k)

...

l: largest value ≥ i such that:

  • no failure on ¬

¬ ¬ ¬CTR(Vl,..,Vl+k-1),.., ¬

¬ ¬ ¬CTR(Vi,..,Vi+k-1) during first iteration

  • l = n-k+1 or

a failure occurs after stating ¬ ¬ ¬ ¬CTR(Vl+1,..,Vl+k)

Second Rule

slide-62
SLIDE 62

¬ ¬ ¬ ¬CTR(V1,..,Vk)

¬ ¬ ¬ ¬CTR(Vi-k+1,..,Vi) ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1)

¬ ¬ ¬ ¬CTR(Vn-k+1,..,Vn)

... ...

¬ ¬ ¬ ¬CTR(Vf-1,..,Vf+k-2) ¬ ¬ ¬ ¬CTR(Vf,..,Vf+k-1)

... ...

¬ ¬ ¬ ¬CTR(Vl,..,Vl+k-1) ¬ ¬ ¬ ¬CTR(Vl+1,..,Vl+k)

...

If fail after posting ¬ ¬ ¬ ¬CTR(Vi-k+1,..,Vi) then: vbefore[i ]=dom(Vi) (since we backtrack and restore domain of Vi) So dom(Vi) − − − − vbefore[i ]∪ ∪ ∪ ∪vafter[i ] is empty, and we prune nothing. If fail after posting ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1) then: vafter[i ]=dom(Vi) (since we backtrack and restore domain of Vi) So dom(Vi) − − − − vbefore[i ]∪ ∪ ∪ ∪vafter[i ] is empty, and we prune nothing.

Second Rule

slide-63
SLIDE 63

¬ ¬ ¬ ¬CTR(V1,..,Vk) ¬ ¬ ¬ ¬CTR(Vi-k+1,..,Vi) ¬ ¬ ¬ ¬CTR(Vi,..,Vi+k-1) ¬ ¬ ¬ ¬CTR(Vn-k+1,..,Vn)

... ...

¬ ¬ ¬ ¬CTR(Vf-1,..,Vf+k-2) ¬ ¬ ¬ ¬CTR(Vf,..,Vf+k-1)

... ...

¬ ¬ ¬ ¬CTR(Vl,..,Vl+k-1) ¬ ¬ ¬ ¬CTR(Vl+1,..,Vl+k)

...

Now let’s assume that:

  • no fail after posting ¬

¬ ¬ ¬CTR(Vi-k+1,..,Vi) ,

  • Vi ∉

∉ ∉ ∉ vbefore[i] ,

  • no fail after posting ¬

¬ ¬ ¬CTR(Vi,..,Vi+k-1) ,

  • Vi ∉

∉ ∉ ∉ vafter[i] .

And evaluate the minimum number

  • f constraints CTR that hold:

≥ before[f] = before[i-k+2] (from definition of f) ≥ 1 (since Vi ∉ ∉ ∉ ∉ vbefore[i] ) ≥ after[l] = after[i-1] (from definition of l) ≥ 1 (since Vi ∉ ∉ ∉ ∉ vafter[i] ) CONCLUSION: the minimum is

before[i-k+2]+after[i-1]+2

Second Rule

slide-64
SLIDE 64

Pruning According to the Maximum Number of Constraints that Hold

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V1+1)mod 5 = V2

4 3 2

slide-65
SLIDE 65

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V2+1)mod 5 = V3

4 3 2 4

slide-66
SLIDE 66

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V3+1)mod 5 = V4

4 3 2 4 4 3 2 1

slide-67
SLIDE 67

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V4+1)mod 5 = V5

4 3 2 4 4 3 2 1 3 2 1

slide-68
SLIDE 68

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V5+1)mod 5 = V6

4 3 2 4 4 3 2 1 3 2 1

fails

4 2

slide-69
SLIDE 69

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V6+1)mod 5 = V7

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1

slide-70
SLIDE 70

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V7+1)mod 5 = V8

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1

slide-71
SLIDE 71

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

(V8+1)mod 5 = V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1

fails

1 4

slide-72
SLIDE 72

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4 2 1

(V8+1)mod 5 = V9

fails

slide-73
SLIDE 73

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4 2 1

(V7+1)mod 5 = V8

1 2 1

slide-74
SLIDE 74

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4 2 1

(V6+1)mod 5 = V7

1 2 1 4 2 1

slide-75
SLIDE 75

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4 2 1

(V5+1)mod 5 = V6

1 2 1 4 2 1 3 2 1 1

slide-76
SLIDE 76

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4

(V4+1)mod 5 = V5

1 1 3 2 1 4 2 2 1 2 1 1 1 4 3 2 1

slide-77
SLIDE 77

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4

(V3+1)mod 5 = V4

1 1 3 2 1 4 2 2 1 2 1 1 1 4 3 2 1

fails

1 4

slide-78
SLIDE 78

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4

(V2+1)mod 5 = V3

1 1 3 2 1 4 2 2 1 2 1 1 1 4 3 2 1 1 4 2 4 3 2

slide-79
SLIDE 79

V1

3 4 3 2 4 4 3 2 1 3 2 1 4 2 2 1 2 1 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8] V2 V3 V4 V5 V6 V7 V8 V9

4 3 2 4 4 3 2 1 3 2 1 4 2 1 2 1 1 2 1 1 4

(V1+1)mod 5 = V2

1 1 3 2 1 4 2 2 1 2 1 1 1 4 3 2 1 1 4 2 4 3 2 2 3

slide-80
SLIDE 80

Rule 1 IF before[i]+after[i]+1>max(C) THEN enforces not ctr(Vi,..Vi+k-1)

V1

3 4 3 2

vbefore before after vafter [2..9] [1..8] [1..8] [1..8]

V2

4 3 2 2 4 3 2

2

3

Let’s assume max(C)=2 Since before[1]+after[1]+1>max(C) enforces (V1+1)mod 5=V2:

  • V1=3
  • V2=4
slide-81
SLIDE 81

Rule 2 IF before[i-k+2]+after[i-1]+2>max(C) THEN Vi in vbefore[i] ∪ ∪ ∪ ∪ vafter[i]

Let’s assume max(C)=3 Since before[2]+after[1]+2>max(C):

  • removes 2 from V2

V1

3 4 3 2 4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8]

V2 V3 4

3 2 4 1 4 2

4 3

2

2

3

slide-82
SLIDE 82

Let’s assume max(C)=3 Since before[2]+after[1]+2>max(C):

  • removes 2 from V2

V1

3

2

4

vbefore before after vafter [2..9] [1..8] [1..8] [1..8]

V2 V3 4

3 2 4 1 4 2

4 3

2

2

3

Two more constraints will fail if V2=2

slide-83
SLIDE 83

ARGUMENTS :

ctr_arguments(group, [NGroup-dvar, MinSize-dvar, MaxSize-dvar, MinDist-dvar, MaxDist-dvar, NVal-dvar, VARIABLES-collection(var-dvar), VALUES-collection(val-int)]).

PURPOSE :

  • There are exactly NGroup groups of variables,
  • MinSize is the number of variables of the smallest group,
  • MaxSize is the number of variables of the largest group,
  • MinDist is the minimum number of variables between two

consecutives groups or between one border and one group,

  • MaxDist is the maximum number of variables between two

consecutives groups or between one border and one group,

  • NVal is the number of variables that take their value

in the set of values VALUES.

Group

ORIGIN : CHIP EXAMPLE :

group(2,1,2,2,4,3, [[var-2],[var-8],[var-1],[var-7],[var-4],[var-5],[var-1],[var-1],[var-1]], [[val-0],[val-2],[val-4],[val-6],[val-8]])

slide-84
SLIDE 84

Group

INITIAL GRAPH FINAL GRAPH

slide-85
SLIDE 85

ARGUMENTS :

ctr_arguments(stretch_circuit, [VARIABLES-collection(var-dvar), VALUES-collection(val-int, lmin-int, lmax-int)]).

PURPOSE :

An item (val-v, lmin-min, lmax-max) gives the minimum value min as well as the maximum value max for the span of a stretch of value v.

ORIGIN : [Pesant01] EXAMPLE :

stretch_circuit([[var-6],[var-6],[var-3],[var-1], [var-1],[var-1],[var-6],[var-6]], [[val-1, lmin-2, lmax-4],[val-2, lmin-2, lmax-3], [val-3, lmin-1, lmax-6],[val-6, lmin-2, lmax-4]])

Stretch_circuit

slide-86
SLIDE 86

Stretch_circuit

INITIAL GRAPH FINAL GRAPH