Test Instance Generation for MAX 2SAT - FJCP 2005

Nov 15, 2005 - For any poly. time exact instance generator, the decision problem over the set of instance generated is generated is NP. NP ∩ co-NP (no more ...
220KB taille 4 téléchargements 272 vues
Test Instance Generation for MAX 2SAT Mitsuo Motoki Japan Advanced Inst. of Sci. and Tech. (JAIST)

Test Instance Generation problem

Empirical study of solvers for combinatorial opt. problem Test Instance Solver

Optimal Solution

Compare

Output Solution 2005/11/15

FJCP 2005

3

Empirical study of solvers for combinatorial opt. problem Test Instance

Benchmark sets / Test Instance Generator

Solver

Optimal Solution

Compare

Output Solution 2005/11/15

FJCP 2005

4

Test instance generator Parameters about instance (Random bits) z

Test Instance Generator

Test Instance Opt. Solution

Ideally…

z Generate

all instances with the opt. solution z Running time is polynomial in the length of output instance.

2005/11/15

FJCP 2005

5

for NP hard optimization problem z z

Unless NP=co-NP, there is no ideal instance generator. Why? z

Consider the decision version (NP hard)

2005/11/15

(I, k)

? Yes

FJCP 2005

No

6

for NP hard optimization problem z z

Unless NP=co-NP, there is no ideal instance generator. Why? z z

z

(I, k)

Consider the decision (I, Opt) version (NP hard) No The random bits used in the Yes instance generator become a witness for each “yes” instance, parameters Instance and also for each “no” random bits Generator instances.

2005/11/15

FJCP 2005

7

What can we do? z

Relax some requirements for instance generator z Can

generate instances from some subset of whole instance set z Outputs a feasible solution instead of the optimal solution (Outputs optimal solution with high prob.) z Running time is “exponential” instead of “polynomial”

2005/11/15

FJCP 2005

8

What can we do? z

Relax some requirements for instance generator z Can

generate instances from some subset of whole instance set z Outputs a feasible solution instead of the optimal solution (Outputs optimal solution with high prob.) z Running time is “exponential” instead of “polynomial”

2005/11/15

FJCP 2005

9

Our approach z

Poly. time exact instance generator z The

set of instance generated is a subset of the whole instance set z The generator always outputs a test instance with the optimal solution z The running time is polynomial in the length of the output instance

2005/11/15

FJCP 2005

10

New requirements The instances generated should be hard. z How to guarantee the hardness? z

z Theoretical z For

way

any poly. time exact instance generator, the decision problem over the set of instance generated is NP ∩ co-NP (no more NP complete) z How hard to distinguish the instances generated?

z (Empirical 2005/11/15

study) FJCP 2005

11

Poly. time exact instance generator for MAX 2SAT

MAX 2SAT z

Input: 2CNF formula z Each

clause consists of exactly 2 literals z Each variable appears at most once in a clause z Any clause can appear more than once

z

Question: find a truth assignment s.t. z maximizes

# of satisfied clauses, z i.e., minimizes # of unsatisfied clauses.

2005/11/15

FJCP 2005

13

How hard? z z z z

MAX SNP complete Decision version (Is there an assignment that satisfies at least k clauses?) is NP complete For satisfiable 2CNF formulas, poly. time solvable (2SAT is in P) Inapproximability upper bound: z z

2005/11/15

21/22 ≈ 0.955 [Håstad STOC‘97] 0.945 (under some unproven conjectures) [Khot, Kindler, Mossel, and O’Donnell FOCS‘04] FJCP 2005

14

Related works

z

Probabilistic generator for MAX kSAT [Dimitriou CP’03] z Unique

z

optimal solution w.h.p., O(nk) clauses

Exact/probabilistic generator for MAX 2SAT [Yamamoto ‘04] z To

characterize opt. solution, requires an expander graph z They use an explicit expander graph construction algorithm / a random graph

z

Probabilistic generator for MAX 3SAT [MM COCOON‘01]

2005/11/15

FJCP 2005

15

Strategy of instance generator i. ii.

iii.

Choose t ∈{0,1}n at random as the optimal solution Combine appropriate number of minimal unsat. 2CNFs that contains exactly 1 clause falsified by t Add several clauses satisfied by t z z

2005/11/15

There is no assignment that falsifies less # of clauses than # of 2CNFs in ii. Thus t is an optimal solution FJCP 2005

16

Implication graph

[Aspvall, Plass, Tarjan ‘79] z

Transform 2CNF F into a digraph GF z z

z

2005/11/15

(x 4 ∨ x2 )(x1 ∨ x2 )

Each vertex corresponds to a literal F contains a clause (a ∨b) ⇔ GF has edge a → b and b → a

x1

x1

x2

x2

F is unsat. ⇔ GF has a cycle

x3

x3

x4

x4

Contradictory bicycle z

(x1 ∨ x2 )(x2 ∨ x3 )(x3 ∨ x 4 )

(and its complement cycle) containing x and x FJCP 2005

17

Minimal unsat. 2CNF F containing exactly 1 clause falsified by t z

W.l.o.g. assume t =1n z z z z z

GF is a (simple) contradictory bicycle F has just 1 clause consisting of only negative literals ⇒ Cont. cycle has just 1 edge from positive literal to negative literal Cont. cycle contains some variables as positive and negative literal ⇒ There is exactly 1 edge from negative literal to positive literal

x jq x jq

xi

1

xi

2

−1

x jh = v

xik = v

xj

xip

2

2005/11/15

FJCP 2005

xj

1

xi p

−1

18

Minimal unsat. 2CNF F containing exactly 1 clause falsified by t z

W.l.o.g. assume t =1n z z z z z

z

GF is a (simple) contradictory bicycle F has just 1 clause consisting of only

negative literals ⇒ Cont. cycle has just 1 edge from positive literal to negative literal Cont. cycle contains some variables as positive and negative literal ⇒ There is exactly 1 edge from negative literal to positive literal

We can divide a cont. cycle into a sequence of positive literals and a sequence of negative literals 2005/11/15

FJCP 2005

x jq x jq

xi

1

xi

2

−1

x jh = v

xik = v

xj

xip

2

xj

1

xi p

−1

19

Instance generator algorithm Input: # n of vars. Let F be an empty formula i. ii. Choose t ∈ {0,1}n at random iii. Choose min. # k (≥0) of unsat. clauses for i =1 to k do iv.

Generate a 2CNF in Bt at random and add to F

v.

Add clauses in Ct to F at random

2005/11/15

FJCP 2005

20

The set I of instances generated z

Bt : the set of minimal unsat. 2CNFs

containing exactly 1 clause falsified by t z Ct : the set of clauses satisfied by t z

I = {F ∈2CNF |F consists of elements of Bt and Ct for some t } zF

∈I ⇔ min. # of unsat. clauses = max. # of cont. bicycles z Both t and a partition into elements of Bt and Ct become a witness of F ∈I

2005/11/15

FJCP 2005

21

Hardness results

Hardness of the instances generated z

To distinguish the set I of instances generated is NP complete z I.e.,

finding an opt. solution is at least as hard as finding a sat. assign. of satisfiable 3CNFs

z

To approximately distinguish the set I of instances generated is also NP hard

2005/11/15

FJCP 2005

23

I is NP complete (1) z z

Reduction from 3SAT For any 3CNF F3CNF =c1∧c2∧…∧cm, transform each clause ci=(li,1∨li,2∨li,3) into

bi = (li ,1 ∨ yi ,1 ) ∧ (yi ,1 ∨ li ,2 ) ∧ (li ,2 ∨ yi ,2 )

∧(yi ,2 ∨ li ,3 ) ∧ (li ,3 ∨ yi ,1 ) ∧ (yi ,1 ∨ yi ,2 ) ∧(yi ,2 ∨ li ,1 ) ∧ (yi ,2 ∨ li ,1 )

z

and let F2CNF=∧i bi . Note that new variables yi,1 and yi,2 appear only in bi

2005/11/15

FJCP 2005

li ,3

li ,1

yi ,2

yi ,1

li ,2

li ,2

yi ,1

yi ,2

li ,1

li ,3 24

I is NP complete (2) li,1 li,2 li,3 yi,1 yi,2 # of unsat.

0 0 0 0 0 0 0 1 1 1 2005/11/15 1

0 0 0 0 0 1 1 0 0 1 1

0 0 0 0 1 0 1 0 1 0 1

0 0 1 1 0 1

∗ ∗ 0 1 1

0 1 0 1 1 1 1 0 0

∗ 1

FJCP 2005

2 2 3 2 1 1 1 1 1 1 1

li ,3

li ,1

yi ,2

yi ,1

li ,2

li ,2

yi ,1

yi ,2

li ,1

li ,3 25

I is NP complete (3) z

If F3CNF =c1∧c2∧…∧cm is satisfiable z F2CNF

has m contradictory bicycle z Min. # of unsat. clauses in F2CNF is m z F2CNF ∈ I

z

If F3CNF is unsatisfiable z F2CNF

has m contradictory bicycle z Min. # of unsat. clauses in F2CNF is at least m +1 z F2CNF ∉ I

2005/11/15

FJCP 2005

26

Hardness for approximation z

If ci ∈ F3CNF is falsified by the opt. solution, 2 clauses in bi are falsified by corresponding assignment z

If min. # of unsat. clauses in F3CNF is k, min. # of unsat. clauses in F2CNF is m +k

2005/11/15

FJCP 2005

li,1 li,2 li,3 yi,1 yi,2 # of unsat. 0

0

0

0

0

2

0

0

0

0

1

2

0

0

0

1

0

3

0

0

0

1

1

2

0

0

1

0

1

1

0

1

0

1

1

1

0

1

1



1

1

1

0

0

0

1

1

0

1

∗ 0

0

1

1

1

0

1

1

1

1

1

1

∗ 1

1 27

Hardness for approximation z

The reduction from 3SAT is a gap reserving reduction

F3CNF is satisfiable, min. # of unsatisfiable clauses in F2CNF is m

z If

z If

1/8 fraction of F3CNF is unsatisfiable, min. # of unsat. clauses in F2CNF is m+m/8 = 9m/8

z

If we can approximate any member of I 8m − 9m / 8 55 within 8m − m = 56 , we can distinguish satisfiable 3CNFs and unsat. 3CNFs

2005/11/15

FJCP 2005

28

Future works z

Improve the hardness for approximation (55/56 ≈ 0.982). z Cf.

z

imapproximability: 21/22≈0.955, 0.945

Estimate appropriate values for parameters z Analyze

the distribution/expectation of # of contradictory bicycles in random 2CNFs

z

Instance generator for other problems

2005/11/15

FJCP 2005

29