• No results found

Generating Random Logic Programs Using Constraint Programming

N/A
N/A
Protected

Academic year: 2021

Share "Generating Random Logic Programs Using Constraint Programming"

Copied!
70
0
0

Loading.... (view fulltext now)

Full text

(1)

Generating Random Logic Programs Using Constraint Programming

Paulius Dilkas

1

Vaishak Belle

1,2

1University of Edinburgh, Edinburgh, UK

2Alan Turing Institute, London, UK

FATA Seminar

(2)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4 3 1

1

1

2

(3)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4

3 1

1

1

2

(4)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4 3

1

1

1

2

(5)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4 3 1

1

1

2

(6)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4 3 1

1

1

2

(7)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4 3 1

1 1

2

(8)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Many Programs Are Used to Test Algorithms?

4 3 1

1

1

2

(9)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Outline

Probabilistic Logic Programming

The Constraint Model

Example Programs

Experimental Results

Summary

(10)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Logic Programs (ProbLog)

“Smokers” (Domingos et al. 2008; Fierens et al. 2015)

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert ).

friend(albert , mary ).

(11)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Applications

Moldovan et al. 2012 Dries et al. 2017

Cˆ orte-Real, Dutra, and Rocha 2017 De Maeyer et al. 2013

(12)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Reasoning by Hand

Let a ⊕ b := a + b − ab. Then

Pr[cancer(mary )] = Pr[cancer spont(mary )]

⊕ Pr[smokes(mary)]

× Pr[cancer smoke(mary)]

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

(13)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Reasoning by Hand

Let a ⊕ b := a + b − ab. Then

Pr[cancer(mary )] = 0.1 ⊕ 0.3 × Pr[smokes(mary )]

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

(14)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Reasoning by Hand

Let a ⊕ b := a + b − ab. Then

Pr[cancer(mary )] = 0.1 ⊕ 0.3 × Pr[smokes(mary )]

Pr[smokes(mary )] = Pr[stress(mary)]

⊕ Pr[smokes(albert)]

× Pr[influences(albert , mary)]

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

(15)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Reasoning by Hand

Let a ⊕ b := a + b − ab. Then

Pr[cancer(mary )] = 0.1 ⊕ 0.3 × Pr[smokes(mary )]

Pr[smokes(mary )] = 0.2 ⊕ 0.3 × Pr[ smokes(albert )]

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

(16)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Reasoning by Hand

Let a ⊕ b := a + b − ab. Then

Pr[cancer(mary )] = 0.1 ⊕ 0.3 × Pr[smokes(mary )]

Pr[smokes(mary )] = 0.2 ⊕ 0.3 × Pr[ smokes(albert )]

Pr[smokes(albert )] = Pr[stress(albert )] = 0.2

0.2 : :stress(P) : - person(P).

smokes(X) : - stress(X).

(17)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Probabilities of Worlds

cancer(mary) = > Pr(world ) =

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert ).

friend(albert , mary ).

(18)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Probabilities of Worlds

cancer(mary) = >

Pr(world ) = 0.2 × (1 − 0.3) × 0.1 × 0.3 0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert ).

friend(albert , mary ).

(19)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Probabilities of Worlds

cancer(mary) = >

Pr(world ) = 0.2 × 0.3 × 0.1 × (1 − 0.3) 0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert ).

friend(albert , mary ).

(20)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Probabilities of Worlds

cancer(mary) = >

Pr(world ) = (1 − 0.2) × (1 − 0.3) × 0.1 × 0.3 0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert ).

friend(albert , mary ).

(21)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Probabilistic Inference: Probabilities of Worlds

cancer(mary) = ⊥

Pr(world ) = (1 − 0.2) × (1 − 0.3) × (1 − 0.1) × (1 − 0.3) 0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert ).

friend(albert , mary ).

(22)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Inference Algorithms and Knowledge Compilation Maps

NNF negation normal form BDD binary decision diagrams

SDD sentential decision diagrams

k-Best only use the k most probable proofs

d-DNNF deterministic decomposable negation normal form

• for every pair α ∨ β, we have α ∧ β = ⊥

• for every pair α ∧ β, no atoms are shared between α and β

• examples:

77 (A ∨ C ) ∧ (A ∨ ¬B) 73 C ∧ (A ∨ ¬B)

37 B ∧ C ∧ [(B ∧ A) ∨ ¬B]

33 C ∧ [(B ∧ A) ∨ ¬B]

(23)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Inference Algorithms and Knowledge Compilation Maps

NNF negation normal form BDD binary decision diagrams

SDD sentential decision diagrams

k-Best only use the k most probable proofs

d-DNNF deterministic decomposable negation normal form

• for every pair α ∨ β, we have α ∧ β = ⊥

• for every pair α ∧ β, no atoms are shared between α and β

• examples:

77 (A ∨ C ) ∧ (A ∨ ¬B) 73 C ∧ (A ∨ ¬B)

37 B ∧ C ∧ [(B ∧ A) ∨ ¬B]

33 C ∧ [(B ∧ A) ∨ ¬B]

(24)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Inference Algorithms and Knowledge Compilation Maps

NNF negation normal form BDD binary decision diagrams

SDD sentential decision diagrams

k-Best only use the k most probable proofs

d-DNNF deterministic decomposable negation normal form

• for every pair α ∨ β, we have α ∧ β = ⊥

• for every pair α ∧ β, no atoms are shared between α and β

• examples:

77 (A ∨ C ) ∧ (A ∨ ¬B)

73 C ∧ (A ∨ ¬B)

37 B ∧ C ∧ [(B ∧ A) ∨ ¬B]

33 C ∧ [(B ∧ A) ∨ ¬B]

(25)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Inference Algorithms and Knowledge Compilation Maps

NNF negation normal form BDD binary decision diagrams

SDD sentential decision diagrams

k-Best only use the k most probable proofs

d-DNNF deterministic decomposable negation normal form

• for every pair α ∨ β, we have α ∧ β = ⊥

• for every pair α ∧ β, no atoms are shared between α and β

• examples:

77 (A ∨ C ) ∧ (A ∨ ¬B) 73 C ∧ (A ∨ ¬B)

37 B ∧ C ∧ [(B ∧ A) ∨ ¬B]

33 C ∧ [(B ∧ A) ∨ ¬B]

(26)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Inference Algorithms and Knowledge Compilation Maps

NNF negation normal form BDD binary decision diagrams

SDD sentential decision diagrams

k-Best only use the k most probable proofs

d-DNNF deterministic decomposable negation normal form

• for every pair α ∨ β, we have α ∧ β = ⊥

• for every pair α ∧ β, no atoms are shared between α and β

• examples:

77 (A ∨ C ) ∧ (A ∨ ¬B) 73 C ∧ (A ∨ ¬B)

37 B ∧ C ∧ [(B ∧ A) ∨ ¬B]

33 C ∧ [(B ∧ A) ∨ ¬B]

(27)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Inference Algorithms and Knowledge Compilation Maps

NNF negation normal form BDD binary decision diagrams

SDD sentential decision diagrams

k-Best only use the k most probable proofs

d-DNNF deterministic decomposable negation normal form

• for every pair α ∨ β, we have α ∧ β = ⊥

• for every pair α ∧ β, no atoms are shared between α and β

• examples:

77 (A ∨ C ) ∧ (A ∨ ¬B) 73 C ∧ (A ∨ ¬B)

37 B ∧ C ∧ [(B ∧ A) ∨ ¬B]

33 C ∧ [(B ∧ A) ∨ ¬B]

(28)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Example Diagrams for C ∧ (A ∨ ¬B)

C ∨

A ¬B

Figure: NNF

A B C

1 0

Figure: BDD

∧ B

A ¬A

¬B C

Figure: d-DNNF

1

¬A 3

¬B C B ⊥

A C

Figure: SDD

1 0 A

3 2 B

4

C

Figure: vtree

(29)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert).

friend(albert, mary ).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(30)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert).

friend(albert, mary ).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(31)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary ).

person(albert).

friend(albert, mary ).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(32)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary).

person(albert ).

friend(albert , mary).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(33)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary).

person(albert ).

friend(albert , mary).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(34)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary).

person(albert ).

friend(albert , mary).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(35)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Characterises a (Probabilistic) Logic Program?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.2 : :stress(P) : - person(P).

0.3 : :influences(P

1

, P

2

) : - friend(P

1

, P

2

).

0.1 : :cancer spont(P) : - person(P).

0.3 : :cancer smoke(P) : - person(P).

smokes(X) : - stress(X).

smokes(X) : - smokes(Y), influences(Y, X).

cancer(P) : - cancer spont(P).

cancer(P) : - smokes(P), cancer smoke(P).

person(mary).

person(albert ).

friend(albert , mary).

• predicates, arities

• variables

• constants

• probabilities

• length

• complexity

(36)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(37)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(38)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(39)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(40)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(41)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(42)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(43)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Formulas As Trees

¬ p(X) ∨ (q(X) ∧ r(X))

¬

p(X)

q(X) r(X)

• s is sorted

• s

i

6= i =⇒ v

i

6= >

s : 0 0 0 1 2 2 6

v: ∨ ¬ ∧ p(X) q(X) r(X) >

c : 2 1 2 0 0 0 0

• s is a forest with T = 2 trees

• length L = 7

• number of nodes N := L − T + 1 = 6

• for i = 1, . . . , L − 1,

• if i < N, then s

i

< i

• else s

i

= i and v

i

= >

• c

i

= 0 ⇐⇒ v

i

= > or an atom

• c

i

= 1 ⇐⇒ v

i

= ¬

• c

i

> 1 ⇐⇒ v

i

∈ {∧, ∨}

(44)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Variable Symmetry Breaking

Let {W, X, Y} be the set of variables. Then

smokes(X) : - smokes(Y), influences(Y, X)

is equivalent to

smokes(Y) : - smokes(X), influences(X, Y) and to

smokes(W) : - smokes(X), influences(X, W)

(45)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Variable Symmetry Breaking

X Y Y X

Occurrences (channeling)

W 7→ ∅ X 7→ {0, 3}

Y 7→ {1, 2}

Introductions 1 + min occurrences(v ) or 0

W 7→ 0 X 7→ 1 Y 7→ 2

sorted!

(46)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Variable Symmetry Breaking

Y X X Y

Occurrences (channeling)

W 7→ ∅ X 7→ {1, 2}

Y 7→ {0, 3}

Introductions 1 + min occurrences(v ) or 0

W 7→ 0 X 7→ 2 Y 7→ 1

not sorted!

(47)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Variable Symmetry Breaking

W X X W

Occurrences (channeling)

W 7→ {0, 3}

X 7→ {1, 2}

Y 7→ ∅

Introductions 1 + min occurrences(v ) or 0

W 7→ 1 X 7→ 2 Y 7→ 0

not sorted!

(48)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Dependency Graph

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(49)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Stratification and Negative Cycles

0.1 : : friend(X, Y) : - \+ smokes(Y).

• Stratum 1: predicates with no negation

• Stratum 2: new predicates s.t. negative literals refer to predicates in Stratum 1

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(50)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Stratification and Negative Cycles

0.1 : : friend(X, Y) : - \+ smokes(Y).

• Stratum 1: predicates with no negation

• Stratum 2: new predicates s.t. negative literals refer to predicates in Stratum 1

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(51)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Stratification and Negative Cycles

0.1 : : friend(X, Y) : - \+ smokes(Y).

• Stratum 1: predicates with no negation

• Stratum 2: new predicates s.t. negative literals refer to predicates in Stratum 1

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(52)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Independence: friend ⊥ ⊥ stress

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(53)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Independence: friend ⊥ ⊥ stress

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(54)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Independence: friend ⊥ ⊥ stress

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(55)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Independence: friend ⊥ ⊥ stress

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(56)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Independence: friend ⊥ ⊥ stress

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(57)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Predicate Independence: friend ⊥ ⊥ stress

friend influences

stress

cancer spont

cancer smoke

person cancer

smokes

(58)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

One-Liners

Setup

• predicate p/1

• variable X

• no constants

• 1 clause

• 4 nodes

• no negative cycles

(All) Programs

• p(X).

• 0.7 : : p(X) : - p(X).

• 0.8 : : p(X) : - p(X); p(X).

• 0.7 : : p(X) : - p(X), p(X).

• 0.1 : : p(X) : - p(X); p(X); p(X).

• 0.8 : : p(X) : - p(X), p(X), p(X).

(59)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Symmetry Breaking in Action

Setup

• predicate p/3

• variables: X, Y, Z

• no constants

• 1 clause

• 1 node

• no cycles at all

(All) Programs

• 0.8 : : p(Z, Z, Z).

• p(Y, Y, Z).

• p(Y, Z, Y).

• p(Y, Z, Z).

• 0.1 : : p(X, Y, Z).

(60)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

A Larger Example

Setup

• predicates: p/1, q/2, r/3

• variables: X, Y, Z

• constants: a, b, c

• 5 clauses

• 5 nodes

• no negative cycles

A Random Program

p(b) : - \+(q(a, b), q(X, Y), q(Z, X)).

0.4 : :q(X, X) : - \+ r(Y, Z, a).

q(X, a) : - r(Y, Y, Z).

q(X, a) : - r(Y, b, Z).

r(Y, b, Z).

(61)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Examples of Predicate Independence

Setup

• predicates: p/1, q/1, r/1

• no variables

• constant a

• 3 clauses

• 3 nodes

• no negative cycles

• p ⊥ ⊥ q

A Few Random Programs

• 0.5 : :p(a) : - p(a); p(a).

0.2 : :q(a) : - q(a), q(a).

0.4 : :r(a) : - \+ q(a).

• p(a) : - p(a).

0.5 : :q(a) : - r(a); q(a).

r(a) : - r(a); r(a).

• p(a) : - p(a); p(a).

0.6 : :q(a) : - q(a).

0.7 : :r(a) : - \+ q(a).

(62)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Scalability

0 2000 4000

1 2 4 8

Value

Sea rch No des

Variable

The number of predicates Maximum arity

The number of variables

The number of constants

The number of additional clauses

The maximum number of nodes

(63)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

What Programs Should We Generate?

• each program is divided into:

• rules

• e.g., 0.2 : : stress(P) : - person(P).

• facts

• e.g., friend(albert, mary ).

• predicates, variables, nodes: 2, 4, 8

• maximum arity: 1, 2, 3

• all possible numbers of pairs of independent predicates

• 10 programs per configuration

• fully restarting the constraint solver

• probabilities sampled from {0.1, 0.2, . . . , 0.9}

• query: random unlisted fact

(64)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Rules

0.2 : : stress(P) : - person(P).

• no constants, no empty bodies

• one rule per predicate

• all rules are probabilistic

(65)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Facts

friend(albert , mary).

• proportion probabilistic: 25%, 50%, 75%

• constants: 100, 200, 400

• number of facts: 10

3

, 10

4

, 10

5

• but only up to 75% of all possible facts

(66)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Properties of Programs vs. Inference Algorithms

Facts (×10

3

) Prop. independent

0 25 50 75 100 0 0.25 0.5 0.75 1 0

10 20 30

Mean inference time (s) Algorithm

BDD

d-DNNF

K-Best

NNF

SDD

SDDX

(67)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Properties of Programs vs. Inference Algorithms

Maximum arity Probabilistic

2 3 0.25 0.5 0.75 20

40 60

Inference time (s)

(68)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

How Encodings Compare Across Instances

2

-6

2

-4

2

-2

2

0

2

2

2

4

2

6

2

-6

2

-4

2

-2

2

0

2

2

2

4

2

6

SDD inference time (s)

SDD X in fere n ce time (s)

0 25 50 75 100

Independent (%)

(69)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

The Ratio of Listed Facts to Possible Facts

0 5 10 15

0.0 0.2 0.4 0.6

Proportion of listed facts

Inference time (s)

Algorithm

BDD

d-DNNF

K-Best

NNF

SDD

SDDX

(70)

Probabilistic Logic Programming The Constraint Model Example Programs Experimental Results Summary

Summary

• The model can generate (approximately) realistic instances of reasonable size

• The main performance bottleneck can be addressed by generating programs with a simpler structure

• Open questions and future work

• Can we ensure uniform sampling?

• Why do all of the algorithms behave so similarly?

• Why does independence have no effect on inference time?

References

Related documents

this aspect, I don’t feel like I’m alone, and I think this is why a good number of people. never

11.1.1.1.2. Cadets may choose to reduce the height of their ribbon bar by removing all cadet achievement ribbons but their highest Cadet Program achievement ribbon. All other

With all other variables set at their means, when capital intensity is low (one standard devia- tion below the sample mean), the model estimates that each

Therefore, to ensure that bank customers are satisfied and that banking service operators are equipped to provide good services, there is need to research into

6 CORR, ICC, MSE yes 5 Abbreviations: Landmark Localization (Land. Local.) – AAM: Active Apparance Model, ASM: Active Shape Model, CLM: Constrained Local Model, PFFL: Particle

Flood warning lead-times of 3–10 days are achieved through the incorporation of medium-range weather forecasts from the German Weather Service (DWD) and the European

[The new welfare state – abdication of party politics?] In Ann-Helén Bay, Axel West Pedersen and Jo Saglie (eds.), “Når velferd blir politikk.. Partier, organisasjoner og

Deep Learning Approach for Network Intrusion Detection in Software Defined Networking. In Proceedings of the 2016 International Conference on Wireless Networks and Mobile