software development developing a max-csp solver karl lieberherr
TRANSCRIPT
Software DevelopmentDeveloping a MAX-CSP Solver
Karl Lieberherr
General solver
• Based on transition system
• Correctness of solver– Does it find maximum?
– Does it find a assignment satisfying tG?
General Theme
• The average over a set of assignments is f.
• We want to derive an algorithm that finds an assignment ≥ f.
• Two choices:– randomized algorithm (very simple but has
failure probability)– derandomized algorithm (more complex)
Derandomized algorithm
• Need a correctness proof
• For each variable x in H
if averageH(k=1) > averageH(k=0)
• Need: averageH ≥
max(averageH(k=1) , averageH(k=0) )
Polynomials based on Averages
• meanH(n,k)= average fraction of satisfied constraints in H among all assignments to the n variables of H that set k variables to true.
• appmeanH(x) = average fraction of satisfied constraints in H among all assignments that are generated with a bent coin of probability x.– The averaging includes all assignments but they have
different weights based on the Binomial Distribution.– We generate the assignments following the binomial
distribution and appmean gives the expected value of a random variable: the fraction of satisfied constraints.
– expected value = mean
Look-ahead polynomial
• lapF,N (x) = appmean n-map(F,N) (x)
Binomial Distribution
• X ~ B(n,p)
• The probability of getting exactly k successes: C(n,k)*pk*(1-p)n-k
• E(X) = np
• The most likely value: largest integer ≤ (n+1)*p
Start with a simple case
• meanallH= average fraction of satisfied constraints in H among all assignments to the variables of H.
• meanallH=
1/2 (meanallH(k=1) + meanallH(k=0))
• meanallH= Sum all relations R in H tR(H) mR 2–r(R)
– mR is the number of satisfying rows in truth table of R.
– check: relation 22: 3/8
– max 0 ≤ k ≤ n meanH(n,k) = 4/9 + h(n)
Start with a simple case
• meanallH=
1/2 (meanallH(k=1) + meanallH(k=0))
• Proof: Consider all 2^n assignments. Half set k=1 and half set k=0. We compute the average for the two halves separately and then average the two averages to get the overall average.
Start with a simple case
• Algorithm MEANALL
• Input: H = CSP(G)-formula
• Output: An assignment which satisfies meanallH
• if meanallH(k=1) > meanallH(k=0)
Next more complicated case
• meanH(n,k)
• Want an algorithm for finding an assignment at least as good as meanH(n,k)
mean polynomials
• meanH(n,k)=
k/n * meanH(k=1)(n-1,k-1) +
(n-k)/n * meanH(k=0)(n-1,k)
• C(n,k) = C(n-1,k-1)+C(n,k)
Example
• C(5,2) = C(4,1) + C(4,2)• 10 = 4 + 6• mean(5,2) = C(4,1)/C(5,2) * mean(4,1) + C(4,2)/C(5,2) * mean(4,2) • mean(n,k) = C(n-1,k-1)/C(n,k) * mean(n-1,k-1) + C(n-1,k)/C(n,k) * mean(n-1,k)
Ahmed’s and Christine’s conjecture
For all assignments M:
max 0 ≤ x ≤ 1 appmeann-map(H,M)(x) ≥ fsat(H,M)
An assignment M is maximal if
max 0 ≤ x ≤ 1 appmeann-map(H,M)(x) = fsat(H,M)
Intuition: an assignment is maximal if the polynomials don’t help.
Question
• Does it matter in the definition of maximal whether we use appmean or mean?
Proofs or Counterexamples
• Using Daniel’s programs, we can easily find counterexamples.
• If we cannot find counterexamples, we should find proofs.
Which ones are correct?
• meanH(n,k)=
k/n meanH(k=1)(n-1,k-1) +
(n-k)/n meanH(k=0)(n-1,k)• meanH(n,k) ≤ max(
meanH(k=1)(n-1,k-1),
meanH(k=0)(n-1,k))• appmeanH(x) ≤ max(
appmeanH(k=1)(x), appmeanH(k=0)(x))
Which ones are correct?
• Def: maxappmeanH(x) =
max 0 ≤ x ≤ 1 appmeanH(x)
• maxappmeanH(x) ≤ max(
maxappmeanH(k=1)(x),
maxappmeanH(k=0)(x))
By Analogy
• meanH(n,k)=k/n meanH(k=1)(n-1,k-1) +(n-k)/n meanH(k=0)(n-1,k)
• For 1 ≤ k ≤ n: appmeanH(k/n)=k/n appmeanH(k=1)((k-1)/(n-1)) +(n-k)/n appmeanH(k=0)(k/(n-1))
Example
• Relation = 22
• appmean(x) = 3 x (1-x)2
• mean(n,k) = (3 / C(3,1)) * k * C(n-k,2) / C(n,3) = k * C(n-k,2) / C(n,3)
• rough approximation: – k/n * ((n-k)/n)2 * 1/2 * 6 = 3 x (1-x)2