Answer Set Programming, the Solving Paradigm for Knowledge Representation and Reasoning
Martin Gebser Torsten Schaub
University of Potsdam
Martin Gebser (University of Potsdam) Answer Set Programming 1 / 33
Answer Set Programming, the Solving Paradigm for Knowledge - - PowerPoint PPT Presentation
Answer Set Programming, the Solving Paradigm for Knowledge Representation and Reasoning Martin Gebser Torsten Schaub University of Potsdam Martin Gebser (University of Potsdam) Answer Set Programming 1 / 33 Outline 1 Motivation 2
University of Potsdam
Martin Gebser (University of Potsdam) Answer Set Programming 1 / 33
Martin Gebser (University of Potsdam) Answer Set Programming 2 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 3 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 4 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 4 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 4 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 5 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 5 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 5 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 5 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 5 / 33
Motivation
Martin Gebser (University of Potsdam) Answer Set Programming 5 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 6 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 7 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 7 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 7 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 7 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 7 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 8 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
Martin Gebser (University of Potsdam) Answer Set Programming 9 / 33
Introduction
† without solution recording ‡ without solution enumeration Martin Gebser (University of Potsdam) Answer Set Programming 10 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 11 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 12 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 12 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 12 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 12 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 12 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 12 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 13 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 13 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 13 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 13 / 33
Modeling by Example
node(1). node(2). node(3). node(4). node(5). node(6). edge(1,2). edge(1,3). edge(1,4). edge(2,4). edge(2,5). edge(2,6). edge(3,1). edge(3,4). edge(3,5). edge(4,1). edge(4,2). edge(5,3). edge(5,4). edge(5,6). edge(6,2). edge(6,3). edge(6,5). col(r). col(b). col(g). 1 { color(1,r), color(1,b), color(1,g) } 1. 1 { color(2,r), color(2,b), color(2,g) } 1. 1 { color(3,r), color(3,b), color(3,g) } 1. 1 { color(4,r), color(4,b), color(4,g) } 1. 1 { color(5,r), color(5,b), color(5,g) } 1. 1 { color(6,r), color(6,b), color(6,g) } 1. :- color(1,r), color(2,r). :- color(2,g), color(5,g). ... :- color(6,r), color(2,r). :- color(1,b), color(2,b). :- color(2,r), color(6,r). :- color(6,b), color(2,b). :- color(1,g), color(2,g). :- color(2,b), color(6,b). :- color(6,g), color(2,g). :- color(1,r), color(3,r). :- color(2,g), color(6,g). :- color(6,r), color(3,r). :- color(1,b), color(3,b). :- color(3,r), color(1,r). :- color(6,b), color(3,b). :- color(1,g), color(3,g). :- color(3,b), color(1,b). :- color(6,g), color(3,g). :- color(1,r), color(4,r). :- color(3,g), color(1,g). :- color(6,r), color(5,r). :- color(1,b), color(4,b). :- color(3,r), color(4,r). :- color(6,b), color(5,b). :- color(1,g), color(4,g). :- color(3,b), color(4,b). :- color(6,g), color(5,g). :- color(2,r), color(4,r). :- color(3,g), color(4,g). :- color(2,b), color(4,b). :- color(3,r), color(5,r). :- color(2,g), color(4,g). :- color(3,b), color(5,b). :- color(2,r), color(5,r). :- color(3,g), color(5,g). :- color(2,b), color(5,b). :- color(4,r), color(1,r). Martin Gebser (University of Potsdam) Answer Set Programming 14 / 33
Modeling by Example
node(1). node(2). node(3). node(4). node(5). node(6). edge(1,2). edge(1,3). edge(1,4). edge(2,4). edge(2,5). edge(2,6). edge(3,1). edge(3,4). edge(3,5). edge(4,1). edge(4,2). edge(5,3). edge(5,4). edge(5,6). edge(6,2). edge(6,3). edge(6,5). col(r). col(b). col(g). 1 { color(1,r), color(1,b), color(1,g) } 1. 1 { color(2,r), color(2,b), color(2,g) } 1. 1 { color(3,r), color(3,b), color(3,g) } 1. 1 { color(4,r), color(4,b), color(4,g) } 1. 1 { color(5,r), color(5,b), color(5,g) } 1. 1 { color(6,r), color(6,b), color(6,g) } 1. :- color(1,r), color(2,r). :- color(2,g), color(5,g). ... :- color(6,r), color(2,r). :- color(1,b), color(2,b). :- color(2,r), color(6,r). :- color(6,b), color(2,b). :- color(1,g), color(2,g). :- color(2,b), color(6,b). :- color(6,g), color(2,g). :- color(1,r), color(3,r). :- color(2,g), color(6,g). :- color(6,r), color(3,r). :- color(1,b), color(3,b). :- color(3,r), color(1,r). :- color(6,b), color(3,b). :- color(1,g), color(3,g). :- color(3,b), color(1,b). :- color(6,g), color(3,g). :- color(1,r), color(4,r). :- color(3,g), color(1,g). :- color(6,r), color(5,r). :- color(1,b), color(4,b). :- color(3,r), color(4,r). :- color(6,b), color(5,b). :- color(1,g), color(4,g). :- color(3,b), color(4,b). :- color(6,g), color(5,g). :- color(2,r), color(4,r). :- color(3,g), color(4,g). :- color(2,b), color(4,b). :- color(3,r), color(5,r). :- color(2,g), color(4,g). :- color(3,b), color(5,b). :- color(2,r), color(5,r). :- color(3,g), color(5,g). :- color(2,b), color(5,b). :- color(4,r), color(1,r). Martin Gebser (University of Potsdam) Answer Set Programming 14 / 33
Modeling by Example
clasp version 1.2.1 Reading from stdin Reading : Done(0.000s) Preprocessing: Done(0.000s) Solving... Answer: 1 color(1,b) color(2,r) color(3,r) color(4,g) color(5,b) color(6,g) node(1) ... edge(1,2) ... col(r) ... Answer: 2 color(1,g) color(2,r) color(3,r) color(4,b) color(5,g) color(6,b) node(1) ... edge(1,2) ... col(r) ... Answer: 3 color(1,b) color(2,g) color(3,g) color(4,r) color(5,b) color(6,r) node(1) ... edge(1,2) ... col(r) ... Answer: 4 color(1,g) color(2,b) color(3,b) color(4,r) color(5,g) color(6,r) node(1) ... edge(1,2) ... col(r) ... Answer: 5 color(1,r) color(2,b) color(3,b) color(4,g) color(5,r) color(6,g) node(1) ... edge(1,2) ... col(r) ... Answer: 6 color(1,r) color(2,g) color(3,g) color(4,b) color(5,r) color(6,b) node(1) ... edge(1,2) ... col(r) ... Models : 6 Time : 0.000 (Solving: 0.000) Martin Gebser (University of Potsdam) Answer Set Programming 15 / 33
Modeling by Example
clasp version 1.2.1 Reading from stdin Reading : Done(0.000s) Preprocessing: Done(0.000s) Solving... Answer: 1 color(1,b) color(2,r) color(3,r) color(4,g) color(5,b) color(6,g) node(1) ... edge(1,2) ... col(r) ... Answer: 2 color(1,g) color(2,r) color(3,r) color(4,b) color(5,g) color(6,b) node(1) ... edge(1,2) ... col(r) ... Answer: 3 color(1,b) color(2,g) color(3,g) color(4,r) color(5,b) color(6,r) node(1) ... edge(1,2) ... col(r) ... Answer: 4 color(1,g) color(2,b) color(3,b) color(4,r) color(5,g) color(6,r) node(1) ... edge(1,2) ... col(r) ... Answer: 5 color(1,r) color(2,b) color(3,b) color(4,g) color(5,r) color(6,g) node(1) ... edge(1,2) ... col(r) ... Answer: 6 color(1,r) color(2,g) color(3,g) color(4,b) color(5,r) color(6,b) node(1) ... edge(1,2) ... col(r) ... Models : 6 Time : 0.000 (Solving: 0.000) Martin Gebser (University of Potsdam) Answer Set Programming 15 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 16 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 16 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 16 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 17 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 17 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 17 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 17 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 18 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 18 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 18 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 18 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 18 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 19 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 19 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 19 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 20 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 20 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 20 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 20 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 21 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 22 / 33
Modeling by Example
Martin Gebser (University of Potsdam) Answer Set Programming 22 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 23 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 24 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 24 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 24 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 24 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 24 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 25 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 25 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 25 / 33
Conflict-Driven Answer Set Solving
Martin Gebser (University of Potsdam) Answer Set Programming 26 / 33
Conflict-Driven Answer Set Solving
1 U ← ∅
2 loop 3
4
5
6
7
8
9
10
11
12
13
14
15
16
Martin Gebser (University of Potsdam) Answer Set Programming 27 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 28 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 29 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 30 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 30 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 30 / 33
Potassco
Martin Gebser (University of Potsdam) Answer Set Programming 30 / 33
Potassco
Benchmark # clasp clasp+ cmodels[m] smodels 15Puzzle 16 (16/0) 33.01 (0) 20.18 (0) 31.36 (0) 600.00 (48) BlockedNQueens 29 (15/14) 5.09 (0) 4.91 (0) 9.04 (0) 29.37 (0) ChannelRouting 10 (6/4) 120.13 (6) 120.14 (6) 120.58 (6) 120.90 (6) EdgeMatching 29 (29/0) 0.23 (0) 0.41 (0) 59.32 (0) 60.32 (0) Fastfood 29 (10/19) 1.17 (0) 0.90 (0) 29.22 (0) 83.93 (3) GraphColouring 29 (9/20) 421.55 (60) 357.88 (39) 422.66 (57) 453.77 (63) Hanoi 15 (15/0) 11.76 (0) 3.97 (0) 2.92 (0) 523.77 (39) HierarchicalClustering 12 (8/4) 0.16 (0) 0.17 (0) 0.76 (0) 1.56 (0) SchurNumbers 29 (13/16) 17.44 (0) 49.60 (0) 75.70 (0) 504.17 (72) Solitaire 27 (22/5) 204.78 (27) 162.82 (21) 175.69 (21) 316.96 (36) Sudoku 10 (10/0) 0.15 (0) 0.16 (0) 2.55 (0) 0.25 (0) WeightBoundedDomSet 29 (29/0) 123.13 (15) 102.18 (12) 300.26 (36) 400.84 (51) ∅(∅) (tight) 264 (182/82) 78.22 (9) 68.61(6.50) 102.50 (10) 257.99(26.50) ConnectedDomSet 21 (10/11) 40.42 (3) 36.11 (3) 7.46 (0) 183.76 (15) GeneralizedSlitherlink 29 (29/0) 0.10 (0) 0.22 (0) 1.92 (0) 0.16 (0) GraphPartitioning 13 (6/7) 9.27 (0) 7.98 (0) 20.19 (0) 92.10 (3) HamiltonianPath 29 (29/0) 0.07 (0) 0.06 (0) 0.21 (0) 2.22 (0) KnightTour 10 (10/0) 124.29 (6) 91.80 (3) 242.48 (12) 150.55 (3) Labyrinth 29 (29/0) 123.82 (12) 82.92 (6) 142.24 (6) 594.10 (81) MazeGeneration 29 (10/19) 91.17 (12) 89.89 (12) 90.41 (12) 293.62 (42) Sokoban 29 (9/20) 0.73 (0) 0.80 (0) 3.39 (0) 176.01 (15) TravellingSalesperson 29 (29/0) 0.05 (0) 0.06 (0) 317.82 (7) 0.22 (0) WireRouting 23 (12/11) 42.81 (3) 36.36 (3) 175.73 (12) 448.32 (45) ∅(∅) (nontight) 241 (173/68) 43.27(3.60) 34.62(2.70) 100.19(4.90) 194.11(20.40) ∅(∅) 505 (355/150) 62.33(6.55) 53.16(4.77) 101.45(7.68) 228.95(23.73) clasp (version 1.3.1) cmodels[m] (version 3.79 with minisat 2.0) clasp+ = clasp –sat-prepro –trans-ext=dynamic smodels (version 2.34 with option -restart) Martin Gebser (University of Potsdam) Answer Set Programming 31 / 33
Potassco
Benchmark # clasp clasp+ cmodels[m] smodels 15Puzzle 16 (16/0) 33.01 (0) 20.18 (0) 31.36 (0) 600.00 (48) BlockedNQueens 29 (15/14) 5.09 (0) 4.91 (0) 9.04 (0) 29.37 (0) ChannelRouting 10 (6/4) 120.13 (6) 120.14 (6) 120.58 (6) 120.90 (6) EdgeMatching 29 (29/0) 0.23 (0) 0.41 (0) 59.32 (0) 60.32 (0) Fastfood 29 (10/19) 1.17 (0) 0.90 (0) 29.22 (0) 83.93 (3) GraphColouring 29 (9/20) 421.55 (60) 357.88 (39) 422.66 (57) 453.77 (63) Hanoi 15 (15/0) 11.76 (0) 3.97 (0) 2.92 (0) 523.77 (39) HierarchicalClustering 12 (8/4) 0.16 (0) 0.17 (0) 0.76 (0) 1.56 (0) SchurNumbers 29 (13/16) 17.44 (0) 49.60 (0) 75.70 (0) 504.17 (72) Solitaire 27 (22/5) 204.78 (27) 162.82 (21) 175.69 (21) 316.96 (36) Sudoku 10 (10/0) 0.15 (0) 0.16 (0) 2.55 (0) 0.25 (0) WeightBoundedDomSet 29 (29/0) 123.13 (15) 102.18 (12) 300.26 (36) 400.84 (51) ∅(∅) (tight) 264 (182/82) 78.22 (9) 68.61(6.50) 102.50 (10) 257.99(26.50) ConnectedDomSet 21 (10/11) 40.42 (3) 36.11 (3) 7.46 (0) 183.76 (15) GeneralizedSlitherlink 29 (29/0) 0.10 (0) 0.22 (0) 1.92 (0) 0.16 (0) GraphPartitioning 13 (6/7) 9.27 (0) 7.98 (0) 20.19 (0) 92.10 (3) HamiltonianPath 29 (29/0) 0.07 (0) 0.06 (0) 0.21 (0) 2.22 (0) KnightTour 10 (10/0) 124.29 (6) 91.80 (3) 242.48 (12) 150.55 (3) Labyrinth 29 (29/0) 123.82 (12) 82.92 (6) 142.24 (6) 594.10 (81) MazeGeneration 29 (10/19) 91.17 (12) 89.89 (12) 90.41 (12) 293.62 (42) Sokoban 29 (9/20) 0.73 (0) 0.80 (0) 3.39 (0) 176.01 (15) TravellingSalesperson 29 (29/0) 0.05 (0) 0.06 (0) 317.82 (7) 0.22 (0) WireRouting 23 (12/11) 42.81 (3) 36.36 (3) 175.73 (12) 448.32 (45) ∅(∅) (nontight) 241 (173/68) 43.27(3.60) 34.62(2.70) 100.19(4.90) 194.11(20.40) ∅(∅) 505 (355/150) 62.33(6.55) 53.16(4.77) 101.45(7.68) 228.95(23.73) clasp (version 1.3.1) cmodels[m] (version 3.79 with minisat 2.0) clasp+ = clasp –sat-prepro –trans-ext=dynamic smodels (version 2.34 with option -restart) Martin Gebser (University of Potsdam) Answer Set Programming 31 / 33
Summary
Martin Gebser (University of Potsdam) Answer Set Programming 32 / 33
Summary
Martin Gebser (University of Potsdam) Answer Set Programming 33 / 33
Summary
Martin Gebser (University of Potsdam) Answer Set Programming 33 / 33
Summary
Martin Gebser (University of Potsdam) Answer Set Programming 33 / 33