Test Instance Generation Test Instance Generation for MAX 2SAT for - - PowerPoint PPT Presentation
Test Instance Generation Test Instance Generation for MAX 2SAT for - - PowerPoint PPT Presentation
Test Instance Generation Test Instance Generation for MAX 2SAT for MAX 2SAT Mitsuo Motoki Mitsuo Motoki Japan Advanced Inst. of Sci Sci. . Japan Advanced Inst. of and Tech. (JAIST) and Tech. (JAIST) Test Instance Generation Test
Test Instance Generation Test Instance Generation problem problem
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 3 3
Empirical study of solvers for Empirical study of solvers for combinatorial opt. problem combinatorial opt. problem
Output Solution Output Solution Output Solution Solver Solver Solver Test Instance Test Instance Test Instance Optimal Solution Optimal Solution Optimal Solution Compare Compare Compare
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 4 4
Benchmark sets / Test Instance Generator Benchmark sets / Benchmark sets / Test Instance Generator Test Instance Generator
Empirical study of solvers for Empirical study of solvers for combinatorial opt. problem combinatorial opt. problem
Output Solution Output Solution Output Solution Solver Solver Solver Test Instance Test Instance Test Instance Optimal Solution Optimal Solution Optimal Solution Compare Compare Compare
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 5 5
Test instance generator Test instance generator
- Ideally
Ideally… …
- Generate
Generate all all instances with the opt. solution instances with the opt. solution
- Running time is
Running time is polynomial polynomial in the length of in the length of
- utput instance
- utput instance.
. Test Instance Generator Test Instance Test Instance Generator Generator Parameters Parameters about instance about instance (Random bits) (Random bits) Test Instance Test Instance
- Opt. Solution
- Opt. Solution
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 6 6
for NP hard optimization problem for NP hard optimization problem
- Unless NP=co
Unless NP=co-
- NP
NP, there is , there is no ideal instance generator. no ideal instance generator.
- Why?
Why?
- Consider the decision
Consider the decision version (NP hard) version (NP hard)
(I, k) (I, k)
Yes Yes No No
? ?
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 7 7
for NP hard optimization problem for NP hard optimization problem
- Unless NP=co
Unless NP=co-
- NP
NP, there is , there is no ideal instance generator. no ideal instance generator.
- Why?
Why?
- Consider the decision
Consider the decision version (NP hard) version (NP hard)
- The
The random bits random bits used in the used in the instance generator become a instance generator become a witness for each witness for each “ “yes yes” ” instance, instance,
- and also for each
and also for each “ “no no” ” instances. instances.
(I, k) (I, k)
Yes Yes No No
Instance Instance Generator Generator
(I, Opt) (I, Opt)
parameters parameters random bits random bits
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 8 8
What can we do? What can we do?
- Relax some requirements for instance
Relax some requirements for instance generator generator
- Can generate instances from
Can generate instances from some some subset subset
- f whole instance set
- f whole instance set
- Outputs a
Outputs a feasible solution feasible solution instead of the instead of the
- ptimal solution
- ptimal solution
(Outputs optimal solution with high prob.) (Outputs optimal solution with high prob.)
- Running time is
Running time is “ “exponential exponential” ” instead of instead of “ “polynomial polynomial” ”
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 9 9
What can we do? What can we do?
- Relax some requirements for instance
Relax some requirements for instance generator generator
- Can generate instances from
Can generate instances from some some subset subset
- f whole instance set
- f whole instance set
- Outputs a feasible solution instead of the
Outputs a feasible solution instead of the
- ptimal solution
- ptimal solution
(Outputs optimal solution with high prob.) (Outputs optimal solution with high prob.)
- Running time is
Running time is “ “exponential exponential” ” instead of instead of “ “polynomial polynomial” ”
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 10 10
Our approach Our approach
- Poly. time exact instance generator
- Poly. time exact instance generator
- The set of instance generated is a
The set of instance generated is a subset subset
- f the whole instance set
- f the whole instance set
- The generator
The generator always always outputs a test
- utputs a test
instance with the instance with the optimal
- ptimal solution
solution
- The running time is
The running time is polynomial polynomial in the length in the length
- f the output instance
- f the output instance
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 11 11
New requirements New requirements
- The instances generated should be
The instances generated should be hard hard. .
- How to guarantee the hardness?
How to guarantee the hardness?
- Theoretical way
Theoretical way
- For any poly. time exact instance generator, the
For any poly. time exact instance generator, the decision problem over the set of instance decision problem over the set of instance generated is generated is NP NP ∩ ∩ co co-
- NP
NP (no more NP complete) (no more NP complete)
- How hard to distinguish the instances generated?
How hard to distinguish the instances generated?
- (Empirical study)
(Empirical study)
- Poly. time exact instance
- Poly. time exact instance
generator for MAX 2SAT generator for MAX 2SAT
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 13 13
MAX 2SAT MAX 2SAT
- Input: 2CNF formula
Input: 2CNF formula
- Each clause consists of exactly 2 literals
Each clause consists of exactly 2 literals
- Each variable appears at most once in a
Each variable appears at most once in a clause clause
- Any clause can appear more than once
Any clause can appear more than once
- Question: find a truth assignment
Question: find a truth assignment s.t s.t. .
- maximizes
maximizes # of # of satisfied satisfied clauses, clauses,
- i.e
i.e., ., minimizes minimizes # of # of unsatisfied unsatisfied clauses. clauses.
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 14 14
How hard? How hard?
- MAX SNP complete
MAX SNP complete
- Decision version (Is there an assignment that
Decision version (Is there an assignment that satisfies at least satisfies at least k k clauses?) is clauses?) is NP complete NP complete
- For satisfiable 2CNF formulas, poly. time
For satisfiable 2CNF formulas, poly. time solvable (2SAT is in solvable (2SAT is in P P) )
- Inapproximability upper bound:
Inapproximability upper bound:
- 21/22
21/22 ≈ ≈ 0.955 0.955 [H [Hå åstad STOC stad STOC‘ ‘97] 97]
- 0.945
0.945 (under some unproven conjectures) (under some unproven conjectures) [Khot, Kindler, Mossel, and O [Khot, Kindler, Mossel, and O’ ’Donnell FOCS Donnell FOCS‘ ‘04] 04]
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 15 15
Related works Related works
- Probabilistic generator for MAX
Probabilistic generator for MAX k kSAT SAT [ [Dimitriou Dimitriou CP CP’ ’03] 03]
- Unique optimal solution
Unique optimal solution w.h.p w.h.p., ., O( O(n nk
k) clauses
) clauses
- Exact/probabilistic generator for MAX
Exact/probabilistic generator for MAX 2SAT [Yamamoto 2SAT [Yamamoto ‘ ‘04] 04]
- To characterize opt. solution, requires an
To characterize opt. solution, requires an expander graph expander graph
- They use an explicit expander graph
They use an explicit expander graph construction algorithm / a random graph construction algorithm / a random graph
- Probabilistic generator for MAX 3SAT
Probabilistic generator for MAX 3SAT [MM COCOON [MM COCOON‘ ‘01] 01]
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 16 16
Strategy of instance generator Strategy of instance generator
i. i.
Choose Choose t t ∈ ∈{0,1} {0,1}n
n at random as the
at random as the
- ptimal solution
- ptimal solution
ii. ii.
Combine appropriate number of Combine appropriate number of minimal minimal unsat unsat. . 2CNFs that contains 2CNFs that contains exactly 1 exactly 1 clause falsified by clause falsified by t t
iii. iii.
Add several clauses satisfied by Add several clauses satisfied by t t
- There is no assignment that falsifies less #
There is no assignment that falsifies less #
- f clauses than # of 2CNFs in ii.
- f clauses than # of 2CNFs in ii.
- Thus
Thus t t is an optimal solution is an optimal solution
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 17 17
Implication graph Implication graph
[ [Aspvall Aspvall, , Plass Plass, , Tarjan Tarjan ‘ ‘79] 79]
- Transform 2CNF
Transform 2CNF F F into a into a digraph digraph G GF
F
- Each vertex corresponds to a
Each vertex corresponds to a literal literal
- F
F contains a clause ( contains a clause (a a ∨ ∨b b) ) ⇔ ⇔ G GF
F has edge and
has edge and
- Contradictory bicycle
Contradictory bicycle
- F
F is is unsat unsat. . ⇔ ⇔ G GF
F has a cycle
has a cycle (and its complement cycle) (and its complement cycle) containing x and containing x and a b → a b → b a → b a →
1 2 2 4 2 3 1 3 4 2 (
) ) ) ( ( ) ( ( ) x x x x x x x x x x ∨ ∨ ∨ ∨ ∨
1
x1 x
1
x1 x
2
x2 x
2
x2 x
3
x3 x
3
x3 x
4
x4 x
4
x4 x
x x
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 18 18
Minimal Minimal unsat
- unsat. 2CNF
. 2CNF F F containing containing exactly 1 clause falsified by exactly 1 clause falsified by t t
2
j
x
2
j
x
1 q
j
x
−1 q
j
x
−
- W.l.o.g
W.l.o.g. assume . assume t t =1 =1n
n
- G
GF
F is a (simple) contradictory bicycle
is a (simple) contradictory bicycle
- F
F has just 1 clause consisting of only has just 1 clause consisting of only negative literals negative literals
- ⇒
⇒ Cont. cycle
- Cont. cycle has just 1 edge from
has just 1 edge from positive literal to negative literal positive literal to negative literal
- Cont. cycle contains some variables
- Cont. cycle contains some variables
as positive and negative literal as positive and negative literal
- ⇒
⇒ There is exactly 1 edge from There is exactly 1 edge from negative literal to positive literal negative literal to positive literal
1
i
x
1
i
x
2
i
x
2
i
x
k
i
x v =
k
i
x v =
1 p
i
x
−1 p
i
x
− p
i
x
p
i
x
q
j
x
q
j
x
h
j
x v =
h
j
x v =
1
j
x
1
j
x
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 19 19
Minimal Minimal unsat
- unsat. 2CNF
. 2CNF F F containing containing exactly 1 clause falsified by exactly 1 clause falsified by t t
2
j
x
2
j
x
1 q
j
x
−1 q
j
x
−
- W.l.o.g
W.l.o.g. assume . assume t t =1 =1n
n
- G
GF
F is a (simple) contradictory bicycle
is a (simple) contradictory bicycle
- F
F has just 1 clause consisting of only has just 1 clause consisting of only negative literals negative literals
- ⇒
⇒ Cont. cycle
- Cont. cycle has just 1 edge from
has just 1 edge from positive literal to negative literal positive literal to negative literal
- Cont. cycle contains some variables
- Cont. cycle contains some variables
as positive and negative literal as positive and negative literal
- ⇒
⇒ There is exactly 1 edge from There is exactly 1 edge from negative literal to positive literal negative literal to positive literal
- We can divide a cont. cycle into a
We can divide a cont. cycle into a sequence of positive literals and a sequence of positive literals and a sequence of negative literals sequence of negative literals
1
i
x
1
i
x
2
i
x
2
i
x
k
i
x v =
k
i
x v =
1 p
i
x
−1 p
i
x
− p
i
x
p
i
x
q
j
x
q
j
x
h
j
x v =
h
j
x v =
1
j
x
1
j
x
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 20 20
Instance generator algorithm Instance generator algorithm
Input: # Input: # n n of vars.
- f vars.
i. i.
Let Let F F be an empty formula be an empty formula
ii. ii.
Choose Choose t t ∈ ∈ {0,1} {0,1}n
n at random
at random
iii. iii.
Choose min. # Choose min. # k k ( (≥ ≥0) of 0) of unsat
- unsat. clauses
. clauses
iv. iv.
for for i i =1 =1 to to k k do do
Generate a 2CNF in Generate a 2CNF in B Bt
t at random and add
at random and add to to F F
v. v.
Add clauses in Add clauses in C Ct
t to
to F F at random at random
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 21 21
The set The set I I of instances generated
- f instances generated
- B
Bt
t : the set of minimal
: the set of minimal unsat
- unsat. 2CNFs
. 2CNFs containing exactly 1 clause falsified by containing exactly 1 clause falsified by t t
- C
Ct
t : the set of clauses satisfied by
: the set of clauses satisfied by t t
- I
I = { = {F F ∈ ∈2CNF | 2CNF |F F consists of elements consists of elements
- f
- f B
Bt
t and
and C Ct
t for some
for some t t } }
- F
F ∈ ∈I I ⇔ ⇔ min. # of
- min. # of unsat
- unsat. clauses = max. # of
. clauses = max. # of
- cont. bicycles
- cont. bicycles
- Both
Both t t and a partition into elements of and a partition into elements of B Bt
t and
and C Ct
t become a witness of
become a witness of F F ∈ ∈I I
Hardness results Hardness results
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 23 23
Hardness of Hardness of the instances generated the instances generated
- To distinguish the set
To distinguish the set I I of instances
- f instances
generated is NP complete generated is NP complete
- I.e., finding an opt. solution is at least as hard
I.e., finding an opt. solution is at least as hard as finding a sat. assign. of satisfiable 3CNFs as finding a sat. assign. of satisfiable 3CNFs
- To approximately distinguish the set
To approximately distinguish the set I I of
- f
instances generated is also NP hard instances generated is also NP hard
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 24 24
I I is NP complete (1) is NP complete (1)
- Reduction from 3SAT
Reduction from 3SAT
- For any 3CNF
For any 3CNF F F3CNF
3CNF =
=c c1
1∧
∧c c2
2∧
∧… …∧ ∧c cm
m,
, transform each clause transform each clause c ci
i=(
=(l li
i,1 ,1∨
∨l li
i,2 ,2∨
∨l li
i,3 ,3) into
) into and let and let F F2CNF
2CNF=
=∧
∧i
i b
bi
i .
.
- Note that new variables
Note that new variables y yi
i,1 ,1 and
and y yi
i,2 ,2 appear
appear only
- nly in
in b bi
i
,1 i
l
,2 i
l
,3 i
l
,1 i
y
,2 i
y
,3 i
l
,2 i
l
,1 i
l
,2 i
y
,1 i
y
, ,3 ,1 ,1 ,2 ,1 ,2 , ,2 1 ,2 ,3 ,1 ,1 1 ,2 ,2 ,2
( ) ( ) ( ) ( ( ) ( ) ( ( ) ) )
i i i i i i i i i i i i i i i i i
y b y l y y l y l y l y l l y l y = ∨ ∧ ∧ ∧ ∧ ∧ ∧ ∨ ∨ ∨ ∨ ∧ ∨ ∨ ∨
, ,3 ,1 ,1 ,2 ,1 ,2 , ,2 1 ,2 ,3 ,1 ,1 1 ,2 ,2 ,2
( ) ( ) ( ) ( ( ) ( ) ( ( ) ) )
i i i i i i i i i i i i i i i i i
y b y l y y l y l y l y l l y l y = ∨ ∧ ∧ ∧ ∧ ∧ ∧ ∨ ∨ ∨ ∨ ∧ ∨ ∨ ∨
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 25 25
I I is NP complete (2) is NP complete (2)
l li,
i,1 1
l li,
i,2 2
l li,
i,3 3
y yi,1
i,1
y yi,2
i,2 # of
# of unsat unsat. . 2 2 1 1 2 2 1 1 3 3 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ∗ ∗ 1 1 1 1 1 1 ∗ ∗ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ∗ ∗ 1 1 1 1 1 1 1 1 1 1 1 1 1 1
,1 i
l
,2 i
l
,3 i
l
,1 i
y
,2 i
y
,3 i
l
,2 i
l
,1 i
l
,2 i
y
,1 i
y
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 26 26
I I is NP complete (3) is NP complete (3)
- If
If F F3CNF
3CNF =
=c c1
1∧
∧c c2
2∧
∧… …∧ ∧c cm
m is satisfiable
is satisfiable
- F
F2CNF
2CNF has
has m m contradictory bicycle contradictory bicycle
- Min. # of
- Min. # of unsat
- unsat. clauses in
. clauses in F F2CNF
2CNF is
is m m
- F
F2CNF
2CNF ∈
∈ I I
- If
If F F3CNF
3CNF is unsatisfiable
is unsatisfiable
- F
F2CNF
2CNF has
has m m contradictory bicycle contradictory bicycle
- Min. # of
- Min. # of unsat
- unsat. clauses in
. clauses in F F2CNF
2CNF is at least
is at least m m +1 +1
- F
F2CNF
2CNF ∉
∉ I I
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 27 27
Hardness for approximation Hardness for approximation
- If
If c ci
i ∈
∈ F F3CNF
3CNF is falsified
is falsified by the opt. solution, by the opt. solution, 2 clauses in 2 clauses in b bi
i are
are falsified by corresponding falsified by corresponding assignment assignment
- If min. # of
If min. # of unsat
- unsat. clauses
. clauses in in F F3CNF
3CNF is
is k k, min. # of , min. # of unsat unsat. . clauses in clauses in F F2CNF
2CNF is
is m m + +k k
l li,
i,1 1 l
li,
i,2 2 l
li,
i,3 3 y
yi,1
i,1 y
yi,2
i,2 # of
# of unsat unsat. . 2 2 1 1 2 2 1 1 3 3 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ∗ ∗ 1 1 1 1 1 1 ∗ ∗ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ∗ ∗ 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 28 28
Hardness for approximation Hardness for approximation
- The reduction from 3SAT is a gap
The reduction from 3SAT is a gap reserving reduction reserving reduction
- If
If F F3CNF
3CNF is satisfiable, min. # of unsatisfiable
is satisfiable, min. # of unsatisfiable clauses in clauses in F F2CNF
2CNF is
is m m
- If 1/8 fraction of F
If 1/8 fraction of F3CNF
3CNF is unsatisfiable, min.
is unsatisfiable, min. # of # of unsat
- unsat. clauses in
. clauses in F F2CNF
2CNF is m+m/8 = 9m/8
is m+m/8 = 9m/8
- If we can approximate any member of
If we can approximate any member of I I within , we can distinguish within , we can distinguish satisfiable 3CNFs and satisfiable 3CNFs and unsat
- unsat. 3CNFs
. 3CNFs
8 9 / 55 6 8 8 5 m m m m − = − 8 9 / 55 6 8 8 5 m m m m − = −
2005/11/15 2005/11/15 FJCP 2005 FJCP 2005 29 29
Future works Future works
- Improve the hardness for
Improve the hardness for approximation (55/56 approximation (55/56 ≈ ≈ 0.982). 0.982).
- Cf.
- Cf. imapproximability
imapproximability: : 21/22 21/22≈ ≈0.955 0.955, , 0.945 0.945
- Estimate appropriate values for
Estimate appropriate values for parameters parameters
- Analyze the distribution/expectation of #
Analyze the distribution/expectation of #
- f contradictory bicycles in random 2CNFs
- f contradictory bicycles in random 2CNFs
- Instance generator for other problems