In Search of a Phase TransitionIn Search of a Phase Transitionin the AC-Matching Problemin the AC-Matching Problem
Phokion G. Kolaitis Thomas RaffillPhokion G. Kolaitis Thomas Raffill
Computer Science DepartmentComputer Science Department
UC Santa CruzUC Santa Cruz
Phase TransitionsPhase Transitions
A phase transition is an abrupt change in the A phase transition is an abrupt change in the behavior of a property of a “system”.behavior of a property of a “system”.
Extensive study of phase transitions in Extensive study of phase transitions in physics (statistical mechanics).physics (statistical mechanics).
Extensive study of phase transitions in NP-Extensive study of phase transitions in NP-complete problems during the past decade.complete problems during the past decade.
Motivation and GoalsMotivation and Goals
Understand the “structure” of NP-complete Understand the “structure” of NP-complete problems.problems.
Relate phase transitions to the average-case Relate phase transitions to the average-case performance of particular algorithms for performance of particular algorithms for NP-complete problems.NP-complete problems.
NP-Complete ProblemsNP-Complete Problems
Introduce a “constrainedness” parameter to partition Introduce a “constrainedness” parameter to partition the space of instances.the space of instances.
Generate random instances at fixed parameter values.Generate random instances at fixed parameter values. For some problems, probability of a “yes” instance For some problems, probability of a “yes” instance
abruptly changes from 1 to 0 at some critical value.abruptly changes from 1 to 0 at some critical value. For some problems and some solvers, averageFor some problems and some solvers, average difficulty peaks sharply at the same critical value.difficulty peaks sharply at the same critical value.
Main Example: 3-SATMain Example: 3-SAT
Parameter:Parameter: Ratio of number of clauses to Ratio of number of clauses to number of variables.number of variables.
Intuition:Intuition: Low ratios are underconstrained, Low ratios are underconstrained, high ratios are overconstrained.high ratios are overconstrained.
Critical Value:Critical Value: Experimental results suggest Experimental results suggest that it is about 4.3 clauses to variables.that it is about 4.3 clauses to variables.
Average Performance:Average Performance: DPLL procedure DPLL procedure peaks around 4.3peaks around 4.3
AC-MatchingAC-Matching
Term matching under an operation that is Term matching under an operation that is associative & commutative (no unit).associative & commutative (no unit).
aa11XX11+ … + a+ … + annXXn n = = ACAC b b11CC11+ …+ b+ …+ bmmCCmm
Example: Example: 2X2X11+X+X2 2 = = AC AC 4C 4C11+ 5C+ 5C22
– Solution 1:Solution 1: X X1 1 2C 2C1 1 , X, X2 2 5C 5C22
– Solution 2:Solution 2: X X1 1 C C1 1 , X, X2 2 2 C 2 C11+ 5C+ 5C22
– Solution 3: Solution 3: XX1 1 2C 2C11+C+C2 2 , X, X2 2 3C 3C22
– Solution 4:Solution 4: … …
AC-MatchingAC-Matching
AC-matching plays an important role in AC-matching plays an important role in automated deduction.automated deduction.
AC-matching solvers are key components of AC-matching solvers are key components of many theorem-provers (eg., EQP).many theorem-provers (eg., EQP).
AC-matching is AC-matching is strongstrong NP-complete NP-complete
(it is NP-complete even if the coefficients (it is NP-complete even if the coefficients are given in unary).are given in unary).
Parametrization of AC-MatchingParametrization of AC-Matching
Several different parameters come into play: Several different parameters come into play: number of variables, number of constants, number of variables, number of constants, maximum coefficients, …maximum coefficients, …
aa11XX11+ … + a+ … + annXXn n = = ACAC b b11CC11+ …+ b+ …+ bmmCCmm
Our chosen parameter:Our chosen parameter:
r = ( r = ( a ai i ) / ( ) / ( b bjj)) Some intuition:Some intuition:
– more variables more variables more constrained instance more constrained instance– more constants more constants less constrained instance less constrained instance– reflects both # of symbols and multiplicities.reflects both # of symbols and multiplicities.
NP-Completeness for Fixed RatiosNP-Completeness for Fixed Ratios
Definition: Definition: AC(r)-Matching is the restriction of AC- AC(r)-Matching is the restriction of AC-Matching to instances of ratio r.Matching to instances of ratio r.
Fact:Fact: If r > 1, then every instance of If r > 1, then every instance of
AC(r)-Matching is negative.AC(r)-Matching is negative. Theorem:Theorem: If r is such that 0 < r If r is such that 0 < r 1, then 1, then AC(r)-Matching is NP-complete.AC(r)-Matching is NP-complete.
-- -- r = 1: 3-Partition is reducible to r = 1: 3-Partition is reducible to AC(1)-Matching (Eker – 1993).AC(1)-Matching (Eker – 1993). -- -- 0 < r < 1: By careful padding, can reduce 0 < r < 1: By careful padding, can reduce AC(1)-Matching to AC(r)-Matching. AC(1)-Matching to AC(r)-Matching.
Phase Transition ConjecturePhase Transition Conjecture
Pr(r,s) = probability that a random instance Pr(r,s) = probability that a random instance of AC(r)-Matching of size s is positive, of AC(r)-Matching of size s is positive, where s = where s = a ai i + + b bjj . .
Conjecture: Conjecture: There is critical ratio r* s.t. There is critical ratio r* s.t.– If r < r*, then Pr(r,s) If r < r*, then Pr(r,s) 1 , as s 1 , as s ; ;
– If r > r*, then Pr(r,s) If r > r*, then Pr(r,s) 0 , as s 0 , as s ..
Generating Random InstancesGenerating Random Instances
Fix size s.Fix size s. Step through ratios u/v Step through ratios u/v 1, where u+v = s. 1, where u+v = s. Generate random partitions of u and v.Generate random partitions of u and v. Use the partition of u for LHS coefficients;Use the partition of u for LHS coefficients; Use the partition of v for RHS coefficients.Use the partition of v for RHS coefficients. 1200 samples give < 4% margin of error 1200 samples give < 4% margin of error with 95% confidence.with 95% confidence. 30000 samples give < 1% margin of error.30000 samples give < 1% margin of error.
Solvers Used in ExperimentsSolvers Used in Experiments
Direct AC-Matching SolverDirect AC-Matching Solver developed by S. Eker at SRI as developed by S. Eker at SRI as part of part of MaudeMaude, a high-performance system for equational , a high-performance system for equational logic and rewriting.logic and rewriting.
Reduction to Integer Linear Programming (ILP) and CPLEXReduction to Integer Linear Programming (ILP) and CPLEX, a , a commercial optimization package with a powerful ILP solver.commercial optimization package with a powerful ILP solver.
Reduction to SAT and GraspReduction to SAT and Grasp, one of the main SAT solvers , one of the main SAT solvers developed by J. Silva.developed by J. Silva.
Reductions to ILP and SATReductions to ILP and SAT
Given an instance of AC-MatchingGiven an instance of AC-Matching
aa11XX11+ … + a+ … + annXXn n = = ACAC b b11CC11+ …+ b+ …+ bmmCCm m
express each Xexpress each Xii as as a non-empty linear a non-empty linear combination of the Ccombination of the Cjjs: s:
XXi i ijijCCjj
Resulting instance of ILP is:Resulting instance of ILP is:
iiaaiiijij = b = bjj , 1 , 1 j j m m
jjijij 1 , 1 1 , 1 i i n. n. Standard reduction of ILP to SAT.Standard reduction of ILP to SAT.
Prob. of solvability as function of Prob. of solvability as function of r based on 1200 samplesr based on 1200 samples
Large-Scale ExperimentsLarge-Scale Experiments
Initial experiments based on instances of Initial experiments based on instances of size up to 400 and on samples of size 1200 size up to 400 and on samples of size 1200 suggest a possible crossover near ratio 42:58suggest a possible crossover near ratio 42:58
Large-scale experiments were carried out on Large-scale experiments were carried out on the interval of ratios [30:70, 50:50]the interval of ratios [30:70, 50:50]– Instance sizes: 100, 200, 400, 800, 1600Instance sizes: 100, 200, 400, 800, 1600
– Sample size: 30000 random instances for each Sample size: 30000 random instances for each data point.data point.
Large-Scale Experiments: Large-Scale Experiments: Close-up on Critical RegionClose-up on Critical Region
Finite-Size ScalingFinite-Size Scaling
Given a family of curves f(r,s) for various instance Given a family of curves f(r,s) for various instance sizes s, rescale x-axis according to a sizes s, rescale x-axis according to a power lawpower law
rr = [(r – r*)/r*] = [(r – r*)/r*] s s
Superimpose curves f(r,s) by replacing each data point Superimpose curves f(r,s) by replacing each data point (r,p) by the point ( [(r – r*)/r*] (r,p) by the point ( [(r – r*)/r*] s s , p). , p).
Check whether the curves f(r,s) collapse to a universal Check whether the curves f(r,s) collapse to a universal function f(rfunction f(r) which is monotone and takes values ) which is monotone and takes values between 1 and 0 as rbetween 1 and 0 as r varies from - varies from - to to ..
The existence of a universal function supports phase The existence of a universal function supports phase transition conjecture: in the vicinity of r*, the values transition conjecture: in the vicinity of r*, the values of f(r,s) jump from 1 to 0 as s of f(r,s) jump from 1 to 0 as s ..
Results of Finite-Size Scaling:Results of Finite-Size Scaling:Probability Curves CollapseProbability Curves Collapse
Slowly Emerging Phase Slowly Emerging Phase Transition?Transition?
Curve-fitting gives the power lawCurve-fitting gives the power law
r' = [(r r' = [(r 0.73)/0.73] 0.73)/0.73] s s 0.1710.171
critical ratiocritical ratio r* = 0.73 r* = 0.73 42:58 42:58
scaling exponentscaling exponent = 0.171 = 0.171 Scaling exponent is rather small (scaling Scaling exponent is rather small (scaling
exponent for 3-SAT is exponent for 3-SAT is in [0.625, 0.714]) . in [0.625, 0.714]) . This suggests that any phase transition for This suggests that any phase transition for
AC-matching emerges very slowly. AC-matching emerges very slowly.
Comparison of SolversComparison of Solvers
The three solvers were run on the instance sets and The three solvers were run on the instance sets and CPU time was recorded.CPU time was recorded.
MaudeMaude and and Reduction to ILP + CPLEXReduction to ILP + CPLEX are fast on are fast on almost all instances.almost all instances.
Reduction to SAT + GraspReduction to SAT + Grasp is much slower than is much slower than either either Maude Maude or or Reduction to ILP + CPLEXReduction to ILP + CPLEX..
Reduction to SAT + GraspReduction to SAT + Grasp has sharp peak in has sharp peak in solving time near the critical ratio 0.73solving time near the critical ratio 0.73
Concluding RemarksConcluding Remarks
There is some evidence for a phase transition in There is some evidence for a phase transition in AC-Matching based on experimental results and AC-Matching based on experimental results and finite-size scaling.finite-size scaling.
However, in contrast to 3-SAT and several other However, in contrast to 3-SAT and several other NP-complete problems, the phase-transition in NP-complete problems, the phase-transition in AC-Matching emerges very slowly.AC-Matching emerges very slowly.
Limitation of experimental methods: Limitation of experimental methods:
analytical results are needed to provide more analytical results are needed to provide more convincing evidence or demonstrate its existence.convincing evidence or demonstrate its existence.
Concluding RemarksConcluding Remarks
Maude and CPLEX-based solver show no Maude and CPLEX-based solver show no change in performance near the critical ratio. change in performance near the critical ratio. Will this change with larger-size instances?Will this change with larger-size instances?
Grasp-based solver peaks near the critical Grasp-based solver peaks near the critical ratio.ratio.
Will this change with a better reduction of Will this change with a better reduction of AC-matching to SAT and/or a different SAT AC-matching to SAT and/or a different SAT solver?solver?