The increasing_nvalue Constraint Nicolas Beldiceanu, Fabien - - PowerPoint PPT Presentation

the increasing nvalue constraint
SMART_READER_LITE
LIVE PREVIEW

The increasing_nvalue Constraint Nicolas Beldiceanu, Fabien - - PowerPoint PPT Presentation

The increasing_nvalue Constraint Nicolas Beldiceanu, Fabien Hermennier, Xavier Lorca and Thierry Petit LINA CNRS UMR 6241 CPAIOR 2010 Initial Motivation Def: nvalue( N , X) holds iff variable N is equal to the number of distinct values


slide-1
SLIDE 1

The increasing_nvalue Constraint

Nicolas Beldiceanu, Fabien Hermennier, Xavier Lorca and Thierry Petit LINA CNRS UMR 6241

CPAIOR 2010

slide-2
SLIDE 2

2

Initial Motivation

Def: nvalue(N, X) holds iff variable N is equal to the number of distinct values assigned to the variables in X. Example : (3, <6,8,6,8,1,8>) nvalue is NP-Hard nvalue occurs in many problems (e.g., domination in graphs, assignment), some of them involve variable symmetry (e.g., entropy) Is nvalue still NP-Hard if we impose x0 ≤ x1 ≤ … ≤ xn ?

slide-3
SLIDE 3

3

Outline

Definition GAC Algorithm Time Complexity and Reformulation Experiments Generalization of increasing_nvalue

slide-4
SLIDE 4

4

Outline

Definition GAC Algorithm Time Complexity and Reformulation Experiments Generalization of increasing_nvalue

slide-5
SLIDE 5

5

Definition

Def: increasing_nvalue(N, X) holds iff : Variable N is equal to the number of distinct values assigned to the variables in X x0 ≤ x1 ≤ … xn

Example :

(3, <6,6,8,8,1,8>) violates increasing_nvalue (3, <1,6,6,8,8,8>) satisfies increasing_nvalue

slide-6
SLIDE 6

6

Def [Pesant CP01]: Given X = [x0, x1, … xn] a sequence of variables, a stretch on X is a maximum length subsequence S of X such that any consecutive pair of variables in S are equal.

Example: <6,6,8,8,1,8,8,8 > contains 4 stretches:

<6,6>, <8,8>, <1>, and <8,8,8>

Definition

slide-7
SLIDE 7

7

increasing_nvalue: Since x0 ≤ x1 ≤ … ≤ xn the number of distinct values is equal to the number of stretches: Example: <1,6,6,8,8,9,9,9> contains 4 distinct values: <1>, <6,6>, <8,8>, and <9,9,9>

Definition

slide-8
SLIDE 8

8

increasing_nvalue: Since x0 ≤ x1 ≤ … ≤ xn-1 the number of distinct values is equal to the number of stretches: Example: <1,6,6,8,8,9,9,9> contains 4 distinct values: <1>, <6,6>, <8,8>, and <9,9,9>

GAC algorithm : basically, estimate the minimum (resp. maximum) number of stretches if value v is assigned to xi

Definition

slide-9
SLIDE 9

9

Outline

Definition GAC Algorithm Time Complexity and Reformulation Experiments Generalization of increasing_nvalue

slide-10
SLIDE 10

10

GAC Algorithm

Compute the min. number of stretches of values

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

Value 4 for x2: smin[x2…x7] = 3

slide-11
SLIDE 11

11

GAC Algorithm

Compute the max. number of stretches of values

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

Value 4 for x2: smax[x2…x7] = 4

slide-12
SLIDE 12

12

GAC Algorithm Filtering N from variables in X

  • 1. Remove values violating necessarily constraints

x0 ≤ x1, …, xn-2 ≤ xn-1 : keep only well-ordered values

  • 2. Compute min. and max. number of stretches of x0
  • 3. Compare with D(N)
slide-13
SLIDE 13

13

GAC Algorithm

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

(1) Remove all the values that are not well-ordered

slide-14
SLIDE 14

14

GAC Algorithm

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

(1) Remove all the values that are not well-ordered (2) Variable x0 :

  • value 4:

smin(4)[x0…x7] = 3 smax(4)[x0…x7] = 4

  • value 6:

smin(6)[x0…x7] = 2 smax(6)[x0…x7] = 2

slide-15
SLIDE 15

15

GAC Algorithm

(1) Remove all the values that are not well-ordered ⇒ SMIN = 2, SMAX = 4 ⇒ Compare [SMIN,SMAX] with D(N)

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

(2) Variable x0 :

  • value 4:

smin(4)[x0…x7] = 3 smax(4)[x0…x7] = 4

  • value 6:

smin(6)[x0…x7] = 2 smax(6)[x0…x7] = 2

slide-16
SLIDE 16

16

GAC Algorithm

Compare [SMIN, SMAX] with D(N): Obvious: remove from D(N) values not in [SMIN, SMAX] An issue remains: If D(N) ⊂ [SMIN, SMAX] ?

slide-17
SLIDE 17

17

GAC Algorithm Main theoretical contribution of the paper:

To any k within [SMIN, SMAX] corresponds an assignment of values to variables in X As a consequence,

increasing_nvalue has a solution ⇔ D(N) ∩ [SMIN, SMAX] ≠ ∅

slide-18
SLIDE 18

18

Intuition of the Result

Properties on the max. and min. number of stretches ⇒ Given two values v1 and v2 in D(xi) [smin(v1), smax(v1)] ∪ [smin(v2), smax(v2)] never has holes

slide-19
SLIDE 19

19

Intuition of the Result

⇒ Given two values v1 and v2 in D(xi) [smin(v1), smax(v1)] ∪ [smin(v2), smax(v2)] never has holes ⇒Extreme case :

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

  • value 9:

smin(9)[x0…x7] = 1 smax(9)[x0…x7] = 1

  • value 1:

smin(1)[x0…x7] = 2 smax(1)[x0…x7] = 5

slide-20
SLIDE 20

20

GAC Algorithm Filtering variables in X from N

  • 1. Compute for each well-ordered value in D(xi) the

minimum and maximum number of stretches in the prefix [ x0, …, xi ] and in the suffix [ xi, …, xn-1 ] sequences.

  • 2. Aggregate information and compare with the

current domain of N

slide-21
SLIDE 21

21

GAC Algorithm

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

(2) Value 5 for x4 : pmin[x0…x4] = 2 pmax[x0…x4] = 2 smin[x4…x7] = 2 smax[x4…x7] = 3

?

prefix suffix (1) Remove values that are not well-ordered

slide-22
SLIDE 22

22

GAC Algorithm

X0 X1 X2 X3 X4 X5 X6 X7 1 4 5 6 9

(2) Value 5 for x4 : pmin[x0…x4] = 2 pmax[x0…x4] = 2 smin[x4…x7] = 2 smax[x4…x7] = 3 (1) Remove values that are not well-ordered (3) Aggregate prefix and suffix information: smin[x0…x7] = 3 (i.e., 2+2-1) smax[x0…x7] = 4 (i.e., 2+3-1) Compare [smin, smax] with D(N)

?

slide-23
SLIDE 23

23

GAC Algorithm

From properties on min. and max. v in D(xi) is GAC ⇔ D(N) ∩ [smin, smax] ≠ ∅

slide-24
SLIDE 24

24

Outline

Definition GAC Algorithm Time Complexity and Reformulation Experiments Generalization of Increasing NValue

slide-25
SLIDE 25

25

Time Complexity

For each value : compute pmin, pmax, smin, smax Compute values from previous (resp. next) variable i+1 (resp. i-1)

slide-26
SLIDE 26

26

Time Complexity

For each value : compute pmin, pmax, smin, smax Compute values from previous (resp. next) variable i+1 (resp. i-1) Use of sparse matrix:

Iterate by scanning D(xi) in increasing or decreasing order Values not in domain = default value (0 or n) Cumulated min on consecutive pmin, pmax, …= O(1) for each

⇒ Overall time complexity in O(ΣD(xi))

slide-27
SLIDE 27

27

Reformulations of Increasing NValue

Automaton*: O(n(∪D(xi))3) (space O((∪D(xi))3) transitions) N=2 D(xi) = [6..8] * Described in (pdf version): http://www.emn.fr/x-info/sdemasse/gccat/

slide-28
SLIDE 28

28

Outline

Definition GAC Algorithm Time Complexity and Reformulation Experiments Generalization of increasing_nvalue

slide-29
SLIDE 29

29

Experiments: unary tests Unary tests in CHOCO: enforcing GAC

(200 variables, 200 values, 20% holes in domains) With increasing_nvalue: 100% instances OK 0,1s medium time per instance With an automaton (regular constraint) : 10% intances OK (90% memory overflow) 2,8s medium time per solved instance

slide-30
SLIDE 30

30

Experiment: entropy

Entropy : Optimize allocation of VMs into clusters (i.e., minimize the number of physical machines WNi)

Source: VM4 is waiting Final configuration

slide-31
SLIDE 31

31

Experiment: entropy Model overview:

One variable per VM Its domain is the number of available physical machines WN nvalue on VM’s modelizes the number of machines used

Use of increasing_nvalue as an implicit constraint

Many WN’s have the same characteristics increasing_nvalue can be set on equivalence classes

slide-32
SLIDE 32

32

Experiment: entropy

slide-33
SLIDE 33

33

Outline

Definition GAC Algorithm Time Complexity and Reformulation Experiments Generalization of increasing_nvalue

slide-34
SLIDE 34

34

Generalization of Increasing NValue Goal: identify a class of sliding constraint for which GAC can be performed with a time complexity which depends only on the sum

  • f domain sizes

Generalization of the notion of stretch

slide-35
SLIDE 35

35

Generalization of Increasing Nvalue (2)

Def: Given X = [x0, x1, … xn] a sequence of variables and C a binary constraint, a C-stretch on X is a maximum length subsequence S of X such that: Either |S| = 1 (one single variable) and

Either the interpretation C(xi,xi) is true (universal constraint) or false (complementary of the universal constraint) Or C is neither true nor false and C(xi,xi) holds

Or |S| > 1 and C holds on any consecutive pair of variables in S.

Example: <6,6,8,8,1,10,8,8,8,1 > contains 3 ≤-stretches:

<6,6,8,8>, <1,10>, <8,8,8>, <1>

slide-36
SLIDE 36

36

Generalization of Increasing Nvalue (3)

Def: In SeqBin(N,X,C,B), N is a domain variable, X is a sequence of variables [x0,x1,…,xn-1] C is a binary constraint, B is a binary constraint. The constraint SeqBin* holds iff: (1) For all i in [0,n-2]: B(xi ,xi+1) holds, (2) N is the number of C-stretches in X.

* For more details see: Beldiceanu, Lorca, Petit, “A GAC algorithm for a class of counting constraints”, TR10/1/INFO, École des Mines de Nantes, 2010.

slide-37
SLIDE 37

37

Generalization of Increasing Nvalue (4)

Thanks to SeqBin, GAC in O(ΣD(xi)) for constraints such as

change(N,X,binary constraint C) smooth increasing_among …

Conclusion: even if automata (e.g., regular, cost_regular, …) can be used for different purpose (e.g., filtering, reformulation to linear constraints, computing constraint violation, generating implied constraints), in the context of filtering, it is still worth trying to identify classes of global constraints for which a generic algorithm performs better (memory is the key bottleneck for some automata)