40
1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean- Charles Régin Presented by Sricharan Modali

1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

  • View
    218

  • Download
    1

Embed Size (px)

Citation preview

Page 1: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

1

Refining the Basic Constraint Propagation Algorithm

Christian Bessière and Jean-Charles Régin

Presented by Sricharan Modali

Page 2: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

2

Outline AC3 Two refinements

AC2000 AC2001

Experiments Analytical comparison of AC2001 &

AC6 Conclusion

Page 3: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

3

Introduction Importance of constraint

propagation Propagation scheme of most of

existing constraint solving engines Constraint oriented, or Variable oriented

AC3 is a generic algorithm AC4, AC6 & AC7: value oriented

propagation

Page 4: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

4

Importance of AC3 When you know constraint semantics, use

special propagation algorithms (e.g., all-diff, functional)

When nothing is known about constraints, use a generic AC algorithm (e.g., AC1, 2, 3, 4, 6 or 7)

AC3 does not require maintaining a specific data structures during search, in contrast to AC4, AC6 & AC7

Authors focus on AC3: generic and light weight

Page 5: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

5

Contribution

Modify AC3 into AC2000 & AC2001 More efficient with heavy

propagation Light weight data structures

Variable-oriented Dominate AC3 (# CC & CPU time)

Page 6: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

6

AC2000, like AC3, is free of any data structure to be maintained during search(not really: authors use (Xi) per variable)

Regarding human cost of implementation AC2000 needs 5 more lines than AC3

AC2000 vs. AC3

Page 7: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

7

AC2001 vs. AC3 AC2001 needs an extra data

structure, an integer for each value-constraint pair: Last(Xi,vi,Xj)

Achieves optimal worst-case time complexity

Human cost (implementation): AC2001 needs management of additional data structure ((Xi), Last(Xi,vi,Xj))

Page 8: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

8

Constraint networkP = (X, D, C) X is a set of n variables {X1, …, Xn} D is a set of domains {D(X1), …, D(Xn)} C is a set of e binary constraints

between pairs of variables. Constraint check: verifying whether or

not a given pair of values (vi,vj) is allowed by Cij

Page 9: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

9

Arc consistent valuevi is an arc-consistent value on Cij:

vi D(Xi) vj D(Xj) | (vi,vj) Cij

vj is called support for (Xi,vi) on Cij

XiXj

vivj

Page 10: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

10

Viable value Viable value: vi D(Xi) is viable it

has support in all neighboring D(Xj)

Arc consistent CSP: if all the values in all the domains are viable.

Page 11: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

11

AC3 A variable-oriented propagation

scheme Difference with [Mackworth 77]

Instead of handling a queue for the constraints to be propagated,

it has a queue of the variables whose domain has been modified.

This AC3 terminates whenever any domain is empty

Page 12: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

12

Page 13: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

13

A (bad) example for AC3

Page 14: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

14

AC3 overdoes it Revise3(Xj,Xi) removes vj from D(Xj) AC puts Xj in Q Propagate3 calls Revise3(Xi,Xj) for

every constraint Cij involving Xj

Revise3(Xi,Xj) will look for a support for every value in D(Xi) even when vj was not a support!

Page 15: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

15

Enhancement in AC2000 Instead of blindly looking for a

support for a value viD(Xi) each time D(Xj) is modified, it is done only when needed

Page 16: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

16

AC2000

In addition to Q, (Xj) is used (Xj) contains the values removed

from D(Xj) since the last propagation of Xj

When calling Revise2000(Xi,Xj,t) a check is made to see if vi has a support in (Xj)

Page 17: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

17

Example

Page 18: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

18

How AC2000 operates The larger (Xj),

the closer it gets in size to D(Xj) the more expensive the process is the more likely for vi to have a support in (Xj)

Hence lazymode is used only when |(Xj)| is sufficiently smaller than |D(Xj)|

Use of lazymode is controlled with Ratio |(Xj) |/ |D(Xj)| < Ratio, use lazymode |(Xj) |/ |D(Xj)| Ratio, use lazymode

Page 19: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

19

Page 20: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

20

Analysis of AC2000

Assumption: AC3 is correct Prove: Lazymode of AC2000 does not lead

to arc-inconsistent values in the domain The only way the search for support for a value

vi in D(Xi) is skipped is when vi is not supported by values in (Xj)

(Xj) contains all values last deleted from D(Xj) vi has exactly the same set of supports as before on Cij

Looking again for a support for vi is useless as it remains consistent with Cij

Page 21: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

21

Space complexity of AC2000 It is bounded by the sizes of Q and

Q is O(n), is O(nd) d is the size of the largest domain

Overall complexity O(nd)

Page 22: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

22

Time Complexity of AC2000 The main change is in Revise2000,

where both (Xj) and D(Xj) are examined instead of only D(Xj)

This leads to a worst case where d2 checks are performed in Revise2000

Hence the overall time complexity is O(ed3) since Revise2000 can be called d times per constraint.

Page 23: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

23

AC2000 too overdoes it.. In AC2000 we have to look again for a

support for vi on Cij

If we can remember the support found for vi in D(Xj) the last time Cij is revised

Next time we need to check whether or not this last support belongs to (Xj).

Page 24: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

24

AC2001 saves more.. A new data structure Last(Xi,vi,Xj) is used

to store the value that supports vi

The function Revise2001 always runs in lazymode, except during the initialization phase.

Further, when supports are checked in a given ordering “<d” (i.e., sorted) we know that there isn’t any support for vi before Last(Xi,vi,Xj) in D(Xj).

Page 25: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

25

Example

Page 26: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

26

Page 27: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

27

Space complexity of AC2001 Is bounded above by the size of Q,

and Last Q is in O(n) is in O(nd) But Last is in O(ed)

Since each value vi has a Last pointer for each constraint involving Xi.

This gives the overall complexity of O(ed)

Page 28: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

28

Time Complexity of AC2001 As in AC3 & AC2000, Revise2001 can be

called d times per constraint. But at each call to Revise2001(Xi,Xj,t)for

each value vi D(Xi) There will be a test on the Last(Xi,vi,Xj) And a search for support on D(Xj) greater than

Last(Xi,vi,Xj)

The overall time complexity is then bounded above by d(d+d)2e, which is in O(ed2)

O(ed2) is optimal AC2001 is the first optimal arc-consistency algorithm

proposed in the literature that is free of any lists of supported values.

Page 29: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

29

Experiments To see if AC2000 and AC2001 are

effective vs. AC3, compare #CC & CPU Context: pre-processing & search

(MAC) The goal is not to compete with

AC6/AC7 An improvement (even small) w.r.t

AC3 is significant

Page 30: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

30

AC as a preprocessing The chance of having some propagations

are very small on real instances Hence only one real – world instance is

considered Other instances are randomly generated

to fall in the phase transition region Ratio of 0.2 is taken (no justification given)

Page 31: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

31

Parameters <N, D, C/p1, T/p2> N number of variables D size of the domain C number of constraints P1 density of constraints 2C/N.(N-1) T number of forbidden tuples P2 tightness of the forbidden tuples T/D2

Page 32: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

32

Results

Low density (p1=0.045) Instance 1: under-constrained (p2=0.5) Instance 2: over-constrained (p2 =0.94)

High tightness (p2=0.918, 0.875) Instance 3: sparse (p1=0.045) Instance 4: dense (p1=1.0)

Page 33: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

33

Observation

Page 34: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

34

Maintaining Arc consistency during search

MAC-3, MAC-2000, MAC-2001 Experiments carried over all the

instances contained in FullRLFAP archive for which more than 2 secs is necessary to find a solution or to prove that none exists

Ratio is again 0.2 (no justification given)

Page 35: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

35

Results

Page 36: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

36

Observations There is a slight gain of MAC2000

over MAC3 Except for SCEN#11 On SCEN#11 it is seen that MAC2000

outperforms MAC3 for ratio 0.1 MAC2001 outperforms MAC3 with 9

times less CC and 2 times less cpu time

Page 37: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

37

Restrictions Comparison is between algorithms

with simple data structures Note that to solve SCEN#11

MAC-6 (MAC + AC6): 14.69 sec MAC3 needs 39.50 sec MAC2000 needs 38.22 sec MAC2001 needs 22.69 sec

Page 38: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

38

AC2001 vs. AC6 Time complexity and space

complexity of AC2001 is equal to that of AC6

What are the differences between AC6 and AC2001? Property1: #CC same! Property2: Difference is in the effort of

maintaining specific data structures Authors give condition who wins when

Page 39: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

39

Conclusion Two refinements to AC3: AC2000 &

AC2001 AC2000 improves slightly over AC3,

w/o maintenance of any new data structure

AC2001 needs an additional data structure Last

AC2001 achieves optimal worst-case time complexity

Page 40: 1 Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali

40

Thanks