Advanced Algorithms (X) Shanghai Jiao Tong University Chihao Zhang - - PowerPoint PPT Presentation

advanced algorithms x
SMART_READER_LITE
LIVE PREVIEW

Advanced Algorithms (X) Shanghai Jiao Tong University Chihao Zhang - - PowerPoint PPT Presentation

Advanced Algorithms (X) Shanghai Jiao Tong University Chihao Zhang May 11, 2020 Estimate Estimate One can design a Monte-Carlo algorithm to estimate the value of Estimate One can design a Monte-Carlo algorithm to estimate the value


slide-1
SLIDE 1

Advanced Algorithms (X)

Shanghai Jiao Tong University

Chihao Zhang

May 11, 2020

slide-2
SLIDE 2

Estimate π

slide-3
SLIDE 3

Estimate π

One can design a Monte-Carlo algorithm to estimate the value of π

slide-4
SLIDE 4

Estimate π

One can design a Monte-Carlo algorithm to estimate the value of π

slide-5
SLIDE 5

Estimate π

One can design a Monte-Carlo algorithm to estimate the value of π

  • Xi ∈ [−1,1] × [−1,1]

Zn =

n

i=1

1[∥Xi∥ ≤ 1]

slide-6
SLIDE 6
slide-7
SLIDE 7

Xi ∼ Ber ( π 4 ), E[Zn] = π 4 ⋅ n

slide-8
SLIDE 8

Xi ∼ Ber ( π 4 ), E[Zn] = π 4 ⋅ n

Therefore, by Chernoff bound

slide-9
SLIDE 9

Xi ∼ Ber ( π 4 ), E[Zn] = π 4 ⋅ n

Therefore, by Chernoff bound Pr [ Zn − π 4 ⋅ n ≥ ε ⋅ π 4 ⋅ n] ≤ 2 exp (− ε2πn 12 )

slide-10
SLIDE 10

Xi ∼ Ber ( π 4 ), E[Zn] = π 4 ⋅ n

Therefore, by Chernoff bound Pr [ Zn − π 4 ⋅ n ≥ ε ⋅ π 4 ⋅ n] ≤ 2 exp (− ε2πn 12 ) If , we have an approximation

  • f with probability at least

n ≥ 12 ε2π log 2 δ 1 ± ε π 1 − δ

slide-11
SLIDE 11

Rejection Sampling

slide-12
SLIDE 12

Rejection Sampling

The method is often called rejection sampling

slide-13
SLIDE 13

Rejection Sampling

The method is often called rejection sampling It is useful to estimate the size of some good sets in a large set

slide-14
SLIDE 14

Rejection Sampling

The method is often called rejection sampling It is useful to estimate the size of some good sets in a large set A

B

slide-15
SLIDE 15

Rejection Sampling

The method is often called rejection sampling It is useful to estimate the size of some good sets in a large set The number of samples is proportional to

|A| |B|

A

B

slide-16
SLIDE 16

Counting DNF

slide-17
SLIDE 17

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm

slide-18
SLIDE 18

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm Ci =

ℓi

j=1

xij

slide-19
SLIDE 19

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm Ci =

ℓi

j=1

xij

slide-20
SLIDE 20

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm Ci =

ℓi

j=1

xij

B = satisfying assignments

slide-21
SLIDE 21

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm Ci =

ℓi

j=1

xij

B = satisfying assignments A = all assignments

slide-22
SLIDE 22

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm Ci =

ℓi

j=1

xij may contain only polynomial many solutions

φ

B = satisfying assignments A = all assignments

slide-23
SLIDE 23

Counting DNF

A DNF formula ,

φ = C1 ∨ C2 ∨ ⋯ ∨ Cm Ci =

ℓi

j=1

xij may contain only polynomial many solutions

φ

The Monte Carlo method using rejection sampling is slow!

B = satisfying assignments A = all assignments

slide-24
SLIDE 24
slide-25
SLIDE 25

For each clause , define the set

Ci

slide-26
SLIDE 26

For each clause , define the set

Ci

Si := the set of assignments satisfying Ci

slide-27
SLIDE 27

For each clause , define the set

Ci

Si := the set of assignments satisfying Ci We want to estimate

1≤i≤m

Si

slide-28
SLIDE 28

For each clause , define the set

Ci

Si := the set of assignments satisfying Ci We want to estimate

1≤i≤m

Si

slide-29
SLIDE 29

For each clause , define the set

Ci

Si := the set of assignments satisfying Ci We want to estimate

1≤i≤m

Si

B = ⋃

1≤i≤m

Si

slide-30
SLIDE 30

For each clause , define the set

Ci

Si := the set of assignments satisfying Ci We want to estimate

1≤i≤m

Si

B = ⋃

1≤i≤m

Si A =

1≤i≤m

Si

slide-31
SLIDE 31

For each clause , define the set

Ci

Si := the set of assignments satisfying Ci We want to estimate

1≤i≤m

Si

B = ⋃

1≤i≤m

Si A =

1≤i≤m

Si

(disjoint union)

slide-32
SLIDE 32

How about CNF?

slide-33
SLIDE 33

How about CNF?

We consider a very special case: monotone 2-CNF

slide-34
SLIDE 34

How about CNF?

We consider a very special case: monotone 2-CNF φ = (x ∨ y) ∧ (x ∨ z) ∧ (x ∨ w) ∧ (y ∨ w)

slide-35
SLIDE 35

How about CNF?

We consider a very special case: monotone 2-CNF φ = (x ∨ y) ∧ (x ∨ z) ∧ (x ∨ w) ∧ (y ∨ w)

x z y w

slide-36
SLIDE 36

How about CNF?

We consider a very special case: monotone 2-CNF φ = (x ∨ y) ∧ (x ∨ z) ∧ (x ∨ w) ∧ (y ∨ w)

x z y w

x = 𝚞𝚜𝚟𝚏, y = 𝚐𝚋𝚖𝚝𝚏 z = 𝚐𝚋𝚖𝚝𝚏, w = 𝚞𝚜𝚟𝚏

slide-37
SLIDE 37

How about CNF?

We consider a very special case: monotone 2-CNF φ = (x ∨ y) ∧ (x ∨ z) ∧ (x ∨ w) ∧ (y ∨ w)

x z y w

x = 𝚞𝚜𝚟𝚏, y = 𝚐𝚋𝚖𝚝𝚏 z = 𝚐𝚋𝚖𝚝𝚏, w = 𝚞𝚜𝚟𝚏

x z y w

slide-38
SLIDE 38

How about CNF?

We consider a very special case: monotone 2-CNF φ = (x ∨ y) ∧ (x ∨ z) ∧ (x ∨ w) ∧ (y ∨ w)

x z y w

x = 𝚞𝚜𝚟𝚏, y = 𝚐𝚋𝚖𝚝𝚏 z = 𝚐𝚋𝚖𝚝𝚏, w = 𝚞𝚜𝚟𝚏

x z y w

#φ = # of independent sets

slide-39
SLIDE 39
slide-40
SLIDE 40

Sampling seems to be harder than DNF case…

slide-41
SLIDE 41

Sampling seems to be harder than DNF case… Rejection sampling is correct but inefficient

slide-42
SLIDE 42

Sampling seems to be harder than DNF case… Rejection sampling is correct but inefficient A natural idea is to resample those violated edges…

slide-43
SLIDE 43

Sampling seems to be harder than DNF case… Rejection sampling is correct but inefficient A natural idea is to resample those violated edges… Unfortunately, this is not correct.

slide-44
SLIDE 44

Sampling seems to be harder than DNF case… Rejection sampling is correct but inefficient A natural idea is to resample those violated edges… Unfortunately, this is not correct. Think about

slide-45
SLIDE 45

Sampling seems to be harder than DNF case… Rejection sampling is correct but inefficient A natural idea is to resample those violated edges… Unfortunately, this is not correct.

x z y

Think about

slide-46
SLIDE 46

Partial Rejection Sampling

slide-47
SLIDE 47

Partial Rejection Sampling

Guo, Jerrum and Liu (JACM, 2019) proposed the following fix:

slide-48
SLIDE 48

Partial Rejection Sampling

Guo, Jerrum and Liu (JACM, 2019) proposed the following fix: “Resample violated vertices and their neighbors”

slide-49
SLIDE 49

Partial Rejection Sampling

Guo, Jerrum and Liu (JACM, 2019) proposed the following fix: “Resample violated vertices and their neighbors” We will prove the correctness and analyze its efficiency next week

slide-50
SLIDE 50

From Sampling to Counting

slide-51
SLIDE 51
slide-52
SLIDE 52

We will show that, in many cases, if one can sample from a space, then he can also estimate the size of the space

slide-53
SLIDE 53

We will show that, in many cases, if one can sample from a space, then he can also estimate the size of the space Consider independent sets again

slide-54
SLIDE 54

We will show that, in many cases, if one can sample from a space, then he can also estimate the size of the space Consider independent sets again ,

G = (V, E) E = {e1, e2, …, em}

slide-55
SLIDE 55

We will show that, in many cases, if one can sample from a space, then he can also estimate the size of the space Consider independent sets again ,

G = (V, E) E = {e1, e2, …, em}

We want to estimate , the number of i.s. in

I(G) G

slide-56
SLIDE 56
slide-57
SLIDE 57

Define

G0 = G, Gi = Gi−1 − ei

slide-58
SLIDE 58

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)|

slide-59
SLIDE 59

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)|

slide-60
SLIDE 60

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| ||

slide-61
SLIDE 61

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| 2n ||

slide-62
SLIDE 62

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| 2n ||

slide-63
SLIDE 63

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| 2n || A = I(Gi)

slide-64
SLIDE 64

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| 2n || A = I(Gi) B = I(Gi+1)

slide-65
SLIDE 65

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| 2n || A = I(Gi) B = I(Gi+1) can’t be too large!

|A| |B|

slide-66
SLIDE 66

Define

G0 = G, Gi = Gi−1 − ei

|I(G)| = |I(G0)| = |I(G0)| |I(G1)| ⋅ |I(G1)| |I(G2)| … |I(Gm−1)| |I(Gm)| ⋅ |I(Gm)| 2n || A = I(Gi) B = I(Gi+1) can’t be too large!

|A| |B|

I(Gi) I(Gi+1) ≤ 2

slide-67
SLIDE 67

From Counting to Sampling

slide-68
SLIDE 68
slide-69
SLIDE 69

On the other hand, one can consecutively sample each vertex as long as is known

Pr[v ∈ I]

slide-70
SLIDE 70

On the other hand, one can consecutively sample each vertex as long as is known

Pr[v ∈ I]

The value can be obtained via a counting oracle

slide-71
SLIDE 71

On the other hand, one can consecutively sample each vertex as long as is known

Pr[v ∈ I]

The value can be obtained via a counting oracle The above two reductions require the system to satisfy “self-reducible” property