400 likes | 427 Views
Refining the Basic Constraint Propagation Algorithm. Christian Bessi è re and Jean-Charles R é gin. Presented by Sricharan Modali. Outline. AC3 Two refinements AC2000 AC2001 Experiments Analytical comparison of AC2001 & AC6 Conclusion. Introduction. Importance of constraint propagation
E N D
Refining the Basic Constraint Propagation Algorithm Christian Bessière and Jean-Charles Régin Presented by Sricharan Modali
Outline • AC3 • Two refinements • AC2000 • AC2001 • Experiments • Analytical comparison of AC2001 & AC6 • Conclusion
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
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
Contribution Modify AC3 into AC2000 & AC2001 • More efficient with heavy propagation • Light weight data structures • Variable-oriented • Dominate AC3 (# CC & CPU time)
AC2000 vs. AC3 • 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
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))
Constraint network P = (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
Arc consistent value vi 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 Xj Xi vj vi
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.
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
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!
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
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)
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
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
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)
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.
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).
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).
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)
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.
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
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)
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
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)
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)
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
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
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
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