Enumerating All Solutions for Constraint Satisfaction Problems - - PowerPoint PPT Presentation

enumerating all solutions for constraint satisfaction
SMART_READER_LITE
LIVE PREVIEW

Enumerating All Solutions for Constraint Satisfaction Problems - - PowerPoint PPT Presentation

Enumerating All Solutions for Constraint Satisfaction Problems Henning Schnoor Ilka Schnoor Institut f ur Theoretische Informatik Leibniz Universit at Hannover Aachen, 24.2.2007 Enumerating All Solutions for Constraint Satisfaction


slide-1
SLIDE 1

Enumerating All Solutions for Constraint Satisfaction Problems

Henning Schnoor Ilka Schnoor

Institut f¨ ur Theoretische Informatik Leibniz Universit¨ at Hannover

Aachen, 24.2.2007

Enumerating All Solutions for Constraint Satisfaction Problems 1

slide-2
SLIDE 2

Constraint Satisfaction Problems

Introduction Algorithms Classification Outlook

Generalization of many well-known problems

◮ 3SAT ◮ Horn-SAT ◮ Graph colorability ◮ . . . all kinds of combinatorial problems

Enumerating All Solutions for Constraint Satisfaction Problems 2

slide-3
SLIDE 3

Satisfiability Problems

Introduction Algorithms Classification Outlook

A few satisfiability problems

◮ General SAT-problem: NP-complete. ◮ Restriction to 3SAT: NP-complete.

(x1 ∨ x2 ∨ x3) ∧ (x2 ∨ x4 ∨ x5)

◮ Restriction to 2SAT: complete for NL.

(x1 ∨ x2) ∧ (x2 ∨ x1)

◮ Restriction to Horn-formulas: complete for P.

((x1 ∧ x2 ∧ x3) → x4) ∧ ((x2 ∧ x3¸ ∧ x5) → x1)

Enumerating All Solutions for Constraint Satisfaction Problems 3

slide-4
SLIDE 4

Constraint Satisfaction Problems: Definitions

Introduction Algorithms Classification Outlook

◮ constraint language Γ: set of relations over domain D ◮ Γ3SAT := {(x ∨ y ∨ z), (x ∨ y ∨ z), (x ∨ y ∨ z), (x ∨ y ∨ z)} ◮ Γ-formula: R1(x1, . . . , xk) ∧ · · · ∧ Rn(y1, . . . , yl) for Ri ∈ Γ

Enumerating All Solutions for Constraint Satisfaction Problems 4

slide-5
SLIDE 5

Constraint Satisfaction Problems: Definitions

Introduction Algorithms Classification Outlook

◮ constraint language Γ: set of relations over domain D ◮ Γ3SAT := {(x ∨ y ∨ z), (x ∨ y ∨ z), (x ∨ y ∨ z), (x ∨ y ∨ z)} ◮ Γ-formula: R1(x1, . . . , xk) ∧ · · · ∧ Rn(y1, . . . , yl) for Ri ∈ Γ ◮ solution: assignment I to the variables with

(I(x1), . . . , I(xk)) ∈ R1, . . . , (I(y1), . . . , I(yl)) ∈ Rn

◮ constraint satisfaction problem CSP (Γ) : Does a given

Γ-formula have a solution?

Enumerating All Solutions for Constraint Satisfaction Problems 4

slide-6
SLIDE 6

Constraint Satisfaction Problems: Example

Introduction Algorithms Classification Outlook

Example: CSP can express colorability

◮ D := {0, 1, 2} , R := {(x, y) | x, y ∈ D, x = y} .

Enumerating All Solutions for Constraint Satisfaction Problems 5

slide-7
SLIDE 7

Constraint Satisfaction Problems: Example

Introduction Algorithms Classification Outlook

Example: CSP can express colorability

◮ D := {0, 1, 2} , R := {(x, y) | x, y ∈ D, x = y} . ◮ G a graph with edges (u1, v1), . . . , (un, vn) ◮ Define ϕ := R(u1, v1) ∧ · · · ∧ R(un, vn).

Enumerating All Solutions for Constraint Satisfaction Problems 5

slide-8
SLIDE 8

Constraint Satisfaction Problems: Example

Introduction Algorithms Classification Outlook

Example: CSP can express colorability

◮ D := {0, 1, 2} , R := {(x, y) | x, y ∈ D, x = y} . ◮ G a graph with edges (u1, v1), . . . , (un, vn) ◮ Define ϕ := R(u1, v1) ∧ · · · ∧ R(un, vn). ◮ ϕ is satisfiable if and only if G is 3-colorable.

Corollary

In general, CSP (Γ) is NP-complete.

Enumerating All Solutions for Constraint Satisfaction Problems 5

slide-9
SLIDE 9

Complexity Results for CSP

Introduction Algorithms Classification Outlook

◮ Complexity classifications for 2- and 3-element domains

Schaefer 1978, Bulatov 2003

◮ CSP (Γ) is either in P, or NP-complete for all known cases

We are interested in the complexity of enumerating all solutions for a given constraint formula.

Enumerating All Solutions for Constraint Satisfaction Problems 6

slide-10
SLIDE 10

Research Goal

Introduction Algorithms Classification Outlook

Question

For Γ, decide if efficient enumeration for Γ-formulas is possible.

Enumerating All Solutions for Constraint Satisfaction Problems 7

slide-11
SLIDE 11

Efficient Enumeration

Introduction Algorithms Classification Outlook

Efficient enumeration algorithm

On input ϕ, print all solutions of ϕ such that

◮ Time between two solutions is bounded by a polynomial ◮ Each solution I |

= ϕ is printed exactly once

Enumerating All Solutions for Constraint Satisfaction Problems 8

slide-12
SLIDE 12

A Simple Algorithm

Introduction Algorithms Classification Outlook

An algorithm for the Boolean case

◮ Let ϕ be a formula with variables x1, . . . , xn.

Enumerating All Solutions for Constraint Satisfaction Problems 9

slide-13
SLIDE 13

A Simple Algorithm

Introduction Algorithms Classification Outlook

An algorithm for the Boolean case

◮ Let ϕ be a formula with variables x1, . . . , xn. ◮ If ϕ ∧ x1 ∈ SAT: enumerate all solutions of ϕ ∧ x1 ◮ If ϕ ∧ x1 ∈ SAT: enumerate all solutions of ϕ ∧ x1

Enumerating All Solutions for Constraint Satisfaction Problems 9

slide-14
SLIDE 14

A Simple Algorithm

Introduction Algorithms Classification Outlook

An algorithm for the Boolean case

◮ Let ϕ be a formula with variables x1, . . . , xn. ◮ If ϕ ∧ x1 ∈ SAT: enumerate all solutions of ϕ ∧ x1 ◮ If ϕ ∧ x1 ∈ SAT: enumerate all solutions of ϕ ∧ x1

Theorem (Creignou, H´ ebrard, 1997)

◮ In the Boolean case, there is no other algorithm.

Enumerating All Solutions for Constraint Satisfaction Problems 9

slide-15
SLIDE 15

A Simple Algorithm

Introduction Algorithms Classification Outlook

◮ Algorithm needs decision for“Γ-formulas with literals.” ◮ Works if CSP for Γ plus (x = 0)

x

and (x = 1)

x

is tractable.

Enumerating All Solutions for Constraint Satisfaction Problems 10

slide-16
SLIDE 16

A Simple Algorithm

Introduction Algorithms Classification Outlook

◮ Algorithm needs decision for“Γ-formulas with literals.” ◮ Works if CSP for Γ plus (x = 0)

x

and (x = 1)

x

is tractable. ◮ Generalization to non-Boolean case:

◮ Γ+ is Γ plus clauses (x = α) for α ∈ D. ◮ Γ+ is“Γ with literals.”

Enumerating All Solutions for Constraint Satisfaction Problems 10

slide-17
SLIDE 17

A Simple Algorithm

Introduction Algorithms Classification Outlook

◮ Algorithm needs decision for“Γ-formulas with literals.” ◮ Works if CSP for Γ plus (x = 0)

x

and (x = 1)

x

is tractable. ◮ Generalization to non-Boolean case:

◮ Γ+ is Γ plus clauses (x = α) for α ∈ D. ◮ Γ+ is“Γ with literals.”

CSP (Γ+) is SAT for formulas ϕ ∧ (x1 = 4) ∧ (x2 = 1) . . . Satisfiability problem with literals.

Enumerating All Solutions for Constraint Satisfaction Problems 10

slide-18
SLIDE 18

Non-Boolean Generalization

Introduction Algorithms Classification Outlook

Theorem (Cohen, 2004)

If CSP (Γ+) ∈ P, then Γ has an efficient enumeration algorithm.

Proof

Generalization of previous algorithm.

Enumerating All Solutions for Constraint Satisfaction Problems 11

slide-19
SLIDE 19

Non-Boolean Generalization

Introduction Algorithms Classification Outlook

Theorem (Cohen, 2004)

If CSP (Γ+) ∈ P, then Γ has an efficient enumeration algorithm.

Proof

Generalization of previous algorithm.

Converse?

◮ For the Boolean case, the converse holds as well. Creignou, H´ ebrard, 1997 ◮ What about arbitrary domains?

Enumerating All Solutions for Constraint Satisfaction Problems 11

slide-20
SLIDE 20

Lexicographic Orderings

Introduction Algorithms Classification Outlook

◮ A weaker version of the converse does hold.

Theorem

Equivalent:

  • 1. CSP (Γ+) ∈ P.
  • 2. Solutions for Γ-formuls can be enumerated in lexicographical
  • rdering, with different order for each variable.

◮ For x1, we demand 0 < 2 < 4 < . . . ◮ For x2, we demand 4 < 3 < 1 < . . .

Enumerating All Solutions for Constraint Satisfaction Problems 12

slide-21
SLIDE 21

Summery

Introduction Algorithms Classification Outlook

Proposition

◮ If CSP (Γ+) ∈ P, there is an efficient enumeration algorithm. ◮ If CSP (Γ) /

∈ P, there is no efficient enumeration algorithm.

Enumerating All Solutions for Constraint Satisfaction Problems 13

slide-22
SLIDE 22

Summery

Introduction Algorithms Classification Outlook

Proposition

◮ If CSP (Γ+) ∈ P, there is an efficient enumeration algorithm. ◮ If CSP (Γ) /

∈ P, there is no efficient enumeration algorithm. We are interested in the remaining cases: CSP (Γ) ∈ P, and CSP (Γ+) / ∈ P. ◮ In this case, we can add some, but not all literals to Γ and remain tractable.

Enumerating All Solutions for Constraint Satisfaction Problems 13

slide-23
SLIDE 23

Typical Enumeration Strategy

Introduction Algorithms Classification Outlook

Situation

◮ D = {0, 1, 2} ◮ CSP for Γ plus (x = 0), (x = 1) tractable, ◮ CSP for Γ plus (x = 0), (x = 1), (x = 2) not tractable.

Enumerating All Solutions for Constraint Satisfaction Problems 14

slide-24
SLIDE 24

Typical Enumeration Strategy

Introduction Algorithms Classification Outlook

Situation

◮ D = {0, 1, 2} ◮ CSP for Γ plus (x = 0), (x = 1) tractable, ◮ CSP for Γ plus (x = 0), (x = 1), (x = 2) not tractable. ◮ For every solution, exchanging 2 with a 1 again gives solution. ◮ If I = (2, 1, 1, 0, 0, 1, 2, 1) is solution, so is

I ′ = (1, 1, 1, 0, 0, 1, 1, 1). This is a typical situation.

Enumerating All Solutions for Constraint Satisfaction Problems 14

slide-25
SLIDE 25

Approach

Introduction Algorithms Classification Outlook

◮ CSP for Γ plus“literal clauses”(x = 0) and (x = 1) is tractable

Enumerating All Solutions for Constraint Satisfaction Problems 15

slide-26
SLIDE 26

Approach

Introduction Algorithms Classification Outlook

◮ CSP for Γ plus“literal clauses”(x = 0) and (x = 1) is tractable

Enumeration Approach

◮ Previous algorithm: get solutions in which only 0 and 1 appear

Enumerating All Solutions for Constraint Satisfaction Problems 15

slide-27
SLIDE 27

Approach

Introduction Algorithms Classification Outlook

◮ CSP for Γ plus“literal clauses”(x = 0) and (x = 1) is tractable

Enumeration Approach

◮ Previous algorithm: get solutions in which only 0 and 1 appear

(1, 0, 1, 2, 0) (2, 0, 1, 1, 0) (1, 0, 2, 2, 0)

Enumerating All Solutions for Constraint Satisfaction Problems 15

slide-28
SLIDE 28

Approach

Introduction Algorithms Classification Outlook

◮ CSP for Γ plus“literal clauses”(x = 0) and (x = 1) is tractable

Enumeration Approach

◮ Previous algorithm: get solutions in which only 0 and 1 appear

(1, 0, 1, 2, 0) (2, 0, 1, 1, 0) (1, 0, 2, 2, 0) (1, 0, 1, 1, 0)

◮ Others obtained by changing some of the 1s into 2s.

Enumerating All Solutions for Constraint Satisfaction Problems 15

slide-29
SLIDE 29

Typical Enumeration Strategy

Introduction Algorithms Classification Outlook

◮ The 1 is a“placeholder”for either 1 or 2.

Enumerating All Solutions for Constraint Satisfaction Problems 16

slide-30
SLIDE 30

Typical Enumeration Strategy

Introduction Algorithms Classification Outlook

◮ The 1 is a“placeholder”for either 1 or 2. x1, . . . , xn {0} {1, 2} I I

Enumerating All Solutions for Constraint Satisfaction Problems 16

slide-31
SLIDE 31

Typical Enumeration Strategy

Introduction Algorithms Classification Outlook

◮ The 1 is a“placeholder”for either 1 or 2. x1, . . . , xn {0} {1, 2} I I 1 2 J J J

Enumerating All Solutions for Constraint Satisfaction Problems 16

slide-32
SLIDE 32

Typical Enumeration Strategy

Introduction Algorithms Classification Outlook

◮ The 1 is a“placeholder”for either 1 or 2. x1, . . . , xn {0} {1, 2} I I 1 2 J J J

Real solutions are refinements of“partial solutions.”

Enumerating All Solutions for Constraint Satisfaction Problems 16

slide-33
SLIDE 33

Looking for the right combinations

Introduction Algorithms Classification Outlook

x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 Set to 0 Set to 1

◮ 0/1-solution

Enumerating All Solutions for Constraint Satisfaction Problems 17

slide-34
SLIDE 34

Looking for the right combinations

Introduction Algorithms Classification Outlook

x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 Set to 0 Set to 1 or 2

◮ 0/1-solution ◮ 1 can be 1 or 2

Enumerating All Solutions for Constraint Satisfaction Problems 17

slide-35
SLIDE 35

Looking for the right combinations

Introduction Algorithms Classification Outlook

x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 Set to 0 Set to 1 Set to 2

◮ 0/1-solution ◮ 1 can be 1 or 2 ◮ Which

combinations are solutions?

Enumerating All Solutions for Constraint Satisfaction Problems 17

slide-36
SLIDE 36

Looking for the right combinations

Introduction Algorithms Classification Outlook

x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 Set to 0 Set to 1 Set to 2

◮ 0/1-solution ◮ 1 can be 1 or 2 ◮ Which

combinations are solutions?

Enumerating All Solutions for Constraint Satisfaction Problems 17

slide-37
SLIDE 37

From Partial to Real Solutions I

Introduction Algorithms Classification Outlook

Problem

Given a 0, 1-solution, generate all“fitting”refinements.

Approach

◮ Looking for possibilities to change 1 into 2 and get a solution. ◮ This is a problem involving only the values 1 and 2

Enumerating All Solutions for Constraint Satisfaction Problems 18

slide-38
SLIDE 38

From Partial to Real Solutions I

Introduction Algorithms Classification Outlook

Problem

Given a 0, 1-solution, generate all“fitting”refinements.

Approach

◮ Looking for possibilities to change 1 into 2 and get a solution. ◮ This is a problem involving only the values 1 and 2 ◮ A Boolean Constraint Satisfaction Problem.

Enumerating All Solutions for Constraint Satisfaction Problems 18

slide-39
SLIDE 39

From Partial to Real Solutions II

Introduction Algorithms Classification Outlook

Approach

◮ Split up the problem into two Boolean problems:

◮ Enumerate the 0-1-solutions ◮ For each of these, enumerate the“fitting”solutions

Using knowledge about the Boolean case, we can prove exactly when this works.

Enumerating All Solutions for Constraint Satisfaction Problems 19

slide-40
SLIDE 40

Generalizations

Introduction Algorithms Classification Outlook

Generalizations of approach

◮ Larger domains than {0, 1, 2} ◮ Equivalence classes of solutions

There are restrictions on the possible orders.

Enumerating All Solutions for Constraint Satisfaction Problems 20

slide-41
SLIDE 41

Towards a dichotomy

Introduction Algorithms Classification Outlook

Theorem

For constraint languages with certain algebraic properties on the three-element domain, our algorithms cover all cases.

Proof Idea

◮ Usual implementation techniques for CSP do not work ◮ Main idea: Reduction from Boolean cases with stricter implementation

Enumerating All Solutions for Constraint Satisfaction Problems 21

slide-42
SLIDE 42

Conclusion & Future Research

Introduction Algorithms Classification Outlook

Summary

◮ New enumeration algorithms ◮ Cases when CSP with literals NP-complete, but efficient enumeration possible ◮ Restrictions on possible enumeration orders ◮ Known algebraic proof techniques are only of limited use

Future Research

◮ Achieve full classification ◮ Apply new algebraic methods

Enumerating All Solutions for Constraint Satisfaction Problems 22

slide-43
SLIDE 43

The End

Introduction Algorithms Classification Outlook

Thank You!

Enumerating All Solutions for Constraint Satisfaction Problems 23