PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search...
Transcript of PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search...
![Page 1: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/1.jpg)
Artificial Intelligence, Computational Logic
PROBLEM SOLVING AND SEARCHIN ARTIFICIAL INTELLIGENCE
Lecture 5 Answer-Set Programming Motivation andIntroduction∗
slides adapted from Torsten Schaub [Gebser et al.(2012)]
Sarah Gaggl
Dresden, 6th May 2016
![Page 2: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/2.jpg)
Agenda1 Introduction2 Uninformed Search versus Informed Search (Best First Search, A*
Search, Heuristics)3 Local Search, Stochastic Hill Climbing, Simulated Annealing4 Tabu Search5 Answer-set Programming (ASP)6 Constraint Satisfaction (CSP)7 Structural Decomposition Techniques (Tree/Hypertree Decompositions)8 Evolutionary Algorithms/ Genetic Algorithms
TU Dresden, 6th May 2016 PSSAI slide 2 of 141
![Page 3: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/3.jpg)
Outline1 Motivation
– Declarative Problem Solving– ASP in a Nutshell– ASP Paradigm
2 Introduction– Syntax– Semantics– Examples– Language Constructs– Modeling
TU Dresden, 6th May 2016 PSSAI slide 3 of 141
![Page 4: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/4.jpg)
Informatics
“What is the problem?” versus “How to solve the problem?”
Problem
Computer
Solution
Output?
-
6
TU Dresden, 6th May 2016 PSSAI slide 4 of 141
![Page 5: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/5.jpg)
Informatics
“What is the problem?” versus “How to solve the problem?”
Problem
Computer
Solution
Output?
-
6
TU Dresden, 6th May 2016 PSSAI slide 5 of 141
![Page 6: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/6.jpg)
Traditional programming
“What is the problem?” versus “How to solve the problem?”
Problem
Computer
Solution
Output?
-
6
TU Dresden, 6th May 2016 PSSAI slide 6 of 141
![Page 7: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/7.jpg)
Traditional programming
“What is the problem?” versus “How to solve the problem?”
Problem
Program
Solution
Output?
-
6
Programming Interpreting
Executing
TU Dresden, 6th May 2016 PSSAI slide 7 of 141
![Page 8: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/8.jpg)
Declarative problem solving
“What is the problem?” versus “How to solve the problem?”
Problem
Computer
Solution
Output?
-
6
Interpreting
TU Dresden, 6th May 2016 PSSAI slide 8 of 141
![Page 9: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/9.jpg)
Declarative problem solving
“What is the problem?” versus “How to solve the problem?”
Problem
Representation
Solution
Output?
-
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 9 of 141
![Page 10: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/10.jpg)
Declarative problem solving
“What is the problem?” versus “How to solve the problem?”
Problem
Representation
Solution
Output?
-
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 10 of 141
![Page 11: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/11.jpg)
Answer Set Programmingin a Nutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
• ASP has its roots in– (deductive) databases– logic programming (with negation)– (logic-based) knowledge representation and (nonmonotonic)
reasoning– constraint solving (in particular, SATisfiability testing)
• ASP allows for solving all search problems in NP (and NPNP)in a uniform way
• ASP is versatile as reflected by the ASP solver clasp, winningfirst places at ASP, CASC, MISC, PB, and SAT competitions
• ASP embraces many emerging application areas
TU Dresden, 6th May 2016 PSSAI slide 11 of 141
![Page 12: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/12.jpg)
Answer Set Programmingin a Nutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
• ASP has its roots in– (deductive) databases– logic programming (with negation)– (logic-based) knowledge representation and (nonmonotonic)
reasoning– constraint solving (in particular, SATisfiability testing)
• ASP allows for solving all search problems in NP (and NPNP)in a uniform way
• ASP is versatile as reflected by the ASP solver clasp, winningfirst places at ASP, CASC, MISC, PB, and SAT competitions
• ASP embraces many emerging application areas
TU Dresden, 6th May 2016 PSSAI slide 12 of 141
![Page 13: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/13.jpg)
Answer Set Programmingin a Nutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
• ASP has its roots in– (deductive) databases– logic programming (with negation)– (logic-based) knowledge representation and (nonmonotonic)
reasoning– constraint solving (in particular, SATisfiability testing)
• ASP allows for solving all search problems in NP (and NPNP)in a uniform way
• ASP is versatile as reflected by the ASP solver clasp, winningfirst places at ASP, CASC, MISC, PB, and SAT competitions
• ASP embraces many emerging application areas
TU Dresden, 6th May 2016 PSSAI slide 13 of 141
![Page 14: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/14.jpg)
Answer Set Programmingin a Nutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
• ASP has its roots in– (deductive) databases– logic programming (with negation)– (logic-based) knowledge representation and (nonmonotonic)
reasoning– constraint solving (in particular, SATisfiability testing)
• ASP allows for solving all search problems in NP (and NPNP)in a uniform way
• ASP is versatile as reflected by the ASP solver clasp, winningfirst places at ASP, CASC, MISC, PB, and SAT competitions
• ASP embraces many emerging application areas
TU Dresden, 6th May 2016 PSSAI slide 14 of 141
![Page 15: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/15.jpg)
Answer Set Programmingin a Nutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
• ASP has its roots in– (deductive) databases– logic programming (with negation)– (logic-based) knowledge representation and (nonmonotonic)
reasoning– constraint solving (in particular, SATisfiability testing)
• ASP allows for solving all search problems in NP (and NPNP)in a uniform way
• ASP is versatile as reflected by the ASP solver clasp, winningfirst places at ASP, CASC, MISC, PB, and SAT competitions
• ASP embraces many emerging application areas
TU Dresden, 6th May 2016 PSSAI slide 15 of 141
![Page 16: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/16.jpg)
Answer Set Programmingin a Hazelnutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
tailored to Knowledge Representation and Reasoning
TU Dresden, 6th May 2016 PSSAI slide 16 of 141
![Page 17: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/17.jpg)
Answer Set Programmingin a Hazelnutshell
• ASP is an approach to declarative problem solving, combining– a rich yet simple modeling language– with high-performance solving capacities
tailored to Knowledge Representation and Reasoning
ASP = DB+LP+KR+SAT
TU Dresden, 6th May 2016 PSSAI slide 17 of 141
![Page 18: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/18.jpg)
KR’s shift of paradigm
Theorem Proving based approach (eg. Prolog)1 Provide a representation of the problem2 A solution is given by a derivation of a query
Model Generation based approach (eg. SATisfiability testing)1 Provide a representation of the problem2 A solution is given by a model of the representation
TU Dresden, 6th May 2016 PSSAI slide 18 of 141
![Page 19: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/19.jpg)
KR’s shift of paradigm
Theorem Proving based approach (eg. Prolog)1 Provide a representation of the problem2 A solution is given by a derivation of a query
Model Generation based approach (eg. SATisfiability testing)1 Provide a representation of the problem2 A solution is given by a model of the representation
TU Dresden, 6th May 2016 PSSAI slide 19 of 141
![Page 20: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/20.jpg)
Model Generation based Problem Solving
Representation Solutionconstraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories models
SAT
propositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported modelspropositional programs stable modelsfirst-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 20 of 141
![Page 21: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/21.jpg)
Model Generation based Problem Solving
Representation Solutionconstraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories models
SAT
propositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported modelspropositional programs stable modelsfirst-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 21 of 141
![Page 22: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/22.jpg)
Model Generation based Problem Solving
Representation Solutionconstraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories models SATpropositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported modelspropositional programs stable modelsfirst-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 22 of 141
![Page 23: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/23.jpg)
LP-style playing with blocks
Prolog programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Prolog queries?- above(a,c).true.
?- above(c,a).no.
TU Dresden, 6th May 2016 PSSAI slide 23 of 141
![Page 24: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/24.jpg)
LP-style playing with blocks
Prolog programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Prolog queries?- above(a,c).true.
?- above(c,a).no.
TU Dresden, 6th May 2016 PSSAI slide 24 of 141
![Page 25: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/25.jpg)
LP-style playing with blocks
Prolog programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Prolog queries?- above(a,c).true.
?- above(c,a).no.
TU Dresden, 6th May 2016 PSSAI slide 25 of 141
![Page 26: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/26.jpg)
LP-style playing with blocks
Prolog programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Prolog queries (testing entailment)?- above(a,c).true.
?- above(c,a).no.
TU Dresden, 6th May 2016 PSSAI slide 26 of 141
![Page 27: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/27.jpg)
LP-style playing with blocks
Shuffled Prolog programon(a,b).on(b,c).
above(X,Y) :- above(X,Z), on(Z,Y).above(X,Y) :- on(X,Y).
Prolog queries?- above(a,c).
Fatal Error: local stack overflow.
TU Dresden, 6th May 2016 PSSAI slide 27 of 141
![Page 28: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/28.jpg)
LP-style playing with blocks
Shuffled Prolog programon(a,b).on(b,c).
above(X,Y) :- above(X,Z), on(Z,Y).above(X,Y) :- on(X,Y).
Prolog queries?- above(a,c).
Fatal Error: local stack overflow.
TU Dresden, 6th May 2016 PSSAI slide 28 of 141
![Page 29: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/29.jpg)
LP-style playing with blocks
Shuffled Prolog programon(a,b).on(b,c).
above(X,Y) :- above(X,Z), on(Z,Y).above(X,Y) :- on(X,Y).
Prolog queries (answered via fixed execution)?- above(a,c).
Fatal Error: local stack overflow.
TU Dresden, 6th May 2016 PSSAI slide 29 of 141
![Page 30: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/30.jpg)
SAT-style playing with blocks
Formula
on(a, b)∧ on(b, c)∧ (on(X, Y)→ above(X, Y))∧ (on(X, Z) ∧ above(Z, Y)→ above(X, Y))
Herbrand model{
on(a, b), on(b, c), on(a, c), on(b, b),above(a, b), above(b, c), above(a, c), above(b, b), above(c, b)
}
TU Dresden, 6th May 2016 PSSAI slide 30 of 141
![Page 31: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/31.jpg)
SAT-style playing with blocks
Formula
on(a, b)∧ on(b, c)∧ (on(X, Y)→ above(X, Y))∧ (on(X, Z) ∧ above(Z, Y)→ above(X, Y))
Herbrand model{
on(a, b), on(b, c), on(a, c), on(b, b),above(a, b), above(b, c), above(a, c), above(b, b), above(c, b)
}
TU Dresden, 6th May 2016 PSSAI slide 31 of 141
![Page 32: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/32.jpg)
SAT-style playing with blocks
Formula
on(a, b)∧ on(b, c)∧ (on(X, Y)→ above(X, Y))∧ (on(X, Z) ∧ above(Z, Y)→ above(X, Y))
Herbrand model (among 426!){
on(a, b), on(b, c), on(a, c), on(b, b),above(a, b), above(b, c), above(a, c), above(b, b), above(c, b)
}
TU Dresden, 6th May 2016 PSSAI slide 32 of 141
![Page 33: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/33.jpg)
SAT-style playing with blocks
Formula
on(a, b)∧ on(b, c)∧ (on(X, Y)→ above(X, Y))∧ (on(X, Z) ∧ above(Z, Y)→ above(X, Y))
Herbrand model (among 426!){
on(a, b), on(b, c), on(a, c), on(b, b),above(a, b), above(b, c), above(a, c), above(b, b), above(c, b)
}
TU Dresden, 6th May 2016 PSSAI slide 33 of 141
![Page 34: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/34.jpg)
SAT-style playing with blocks
Formula
on(a, b)∧ on(b, c)∧ (on(X, Y)→ above(X, Y))∧ (on(X, Z) ∧ above(Z, Y)→ above(X, Y))
Herbrand model (among 426!){
on(a, b), on(b, c), on(a, c), on(b, b),above(a, b), above(b, c), above(a, c), above(b, b), above(c, b)
}
TU Dresden, 6th May 2016 PSSAI slide 34 of 141
![Page 35: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/35.jpg)
KR’s shift of paradigm
Theorem Proving based approach (eg. Prolog)1 Provide a representation of the problem2 A solution is given by a derivation of a query
Model Generation based approach (eg. SATisfiability testing)1 Provide a representation of the problem2 A solution is given by a model of the representation
TU Dresden, 6th May 2016 PSSAI slide 35 of 141
![Page 36: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/36.jpg)
KR’s shift of paradigm
Theorem Proving based approach (eg. Prolog)1 Provide a representation of the problem2 A solution is given by a derivation of a query
Model Generation based approach (eg. SATisfiability testing)1 Provide a representation of the problem2 A solution is given by a model of the representation
å Answer Set Programming (ASP)
TU Dresden, 6th May 2016 PSSAI slide 36 of 141
![Page 37: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/37.jpg)
Model Generation based Problem Solving
Representation Solutionconstraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories modelspropositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported modelspropositional programs stable modelsfirst-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 37 of 141
![Page 38: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/38.jpg)
Answer Set Programming at large
Representation Solution
constraint satisfaction problem assignment
propositional horn theories smallest modelpropositional theories modelspropositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported modelspropositional programs stable modelsfirst-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 38 of 141
![Page 39: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/39.jpg)
Answer Set Programming commonly
Representation Solution
constraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories modelspropositional theories minimal models
propositional theories stable models
propositional programs minimal modelspropositional programs supported models
propositional programs stable models
first-order theories modelsfirst-order theories minimal models
first-order theories stable models
first-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 39 of 141
![Page 40: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/40.jpg)
Answer Set Programming in practice
Representation Solution
constraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories modelspropositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported models
propositional programs stable models
first-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
......
TU Dresden, 6th May 2016 PSSAI slide 40 of 141
![Page 41: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/41.jpg)
Answer Set Programming in practice
Representation Solution
constraint satisfaction problem assignmentpropositional horn theories smallest modelpropositional theories modelspropositional theories minimal modelspropositional theories stable modelspropositional programs minimal modelspropositional programs supported models
propositional programs stable models
first-order theories modelsfirst-order theories minimal modelsfirst-order theories stable modelsfirst-order theories Herbrand modelsauto-epistemic theories expansionsdefault theories extensions
first-order programs stable Herbrand models
TU Dresden, 6th May 2016 PSSAI slide 41 of 141
![Page 42: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/42.jpg)
ASP-style playing with blocks
Logic programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Stable Herbrand model
{ on(a,b), on(b,c), above(b,c), above(a,b), above(a,c) }
TU Dresden, 6th May 2016 PSSAI slide 42 of 141
![Page 43: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/43.jpg)
ASP-style playing with blocks
Logic programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Stable Herbrand model
{ on(a,b), on(b,c), above(b,c), above(a,b), above(a,c) }
TU Dresden, 6th May 2016 PSSAI slide 43 of 141
![Page 44: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/44.jpg)
ASP-style playing with blocks
Logic programon(a,b).on(b,c).
above(X,Y) :- on(X,Y).above(X,Y) :- on(X,Z), above(Z,Y).
Stable Herbrand model (and no others)
{ on(a,b), on(b,c), above(b,c), above(a,b), above(a,c) }
TU Dresden, 6th May 2016 PSSAI slide 44 of 141
![Page 45: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/45.jpg)
ASP-style playing with blocks
Logic programon(a,b).on(b,c).
above(X,Y) :- above(Z,Y), on(X,Z).above(X,Y) :- on(X,Y).
Stable Herbrand model (and no others)
{ on(a,b), on(b,c), above(b,c), above(a,b), above(a,c) }
TU Dresden, 6th May 2016 PSSAI slide 45 of 141
![Page 46: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/46.jpg)
ASP versus LP
ASP Prolog
Model generation Query orientationBottom-up Top-downModeling language Programming language
Rule-based formatInstantiation UnificationFlat terms Nested terms
(Turing +) NP(NP) Turing
TU Dresden, 6th May 2016 PSSAI slide 46 of 141
![Page 47: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/47.jpg)
ASP versus SAT
ASP SAT
Model generationBottom-up
Constructive Logic Classical LogicClosed (and open) Open world reasoning
world reasoningModeling language —Complex reasoning modes Satisfiability testing
Satisfiability SatisfiabilityEnumeration/Projection —Optimization —Intersection/Union —
(Turing +) NP(NP) NP
TU Dresden, 6th May 2016 PSSAI slide 47 of 141
![Page 48: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/48.jpg)
ASP solving
Problem
LogicProgram Grounder Solver Stable
Models
Solution
- - -
?
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 48 of 141
![Page 49: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/49.jpg)
SAT solving
Problem
Formula(CNF) Solver Classical
Models
Solution
- -
?
6
Programming Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 49 of 141
![Page 50: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/50.jpg)
Rooting ASP solving
Problem
LogicProgram Grounder Solver Stable
Models
Solution
- - -
?
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 50 of 141
![Page 51: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/51.jpg)
Rooting ASP solving
Problem
LogicProgram
LP
Grounder
DB
Solver
SAT
StableModels
DB+KR+LP
Solution
- - -
?
6
Modeling KR Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 51 of 141
![Page 52: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/52.jpg)
Two sides of a coin
• ASP as High-level Language– Express problem instance(s) as sets of facts– Encode problem (class) as a set of rules– Read off solutions from stable models of facts and rules
• ASP as Low-level Language– Compile a problem into a logic program– Solve the original problem by solving its compilation
TU Dresden, 6th May 2016 PSSAI slide 52 of 141
![Page 53: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/53.jpg)
What is ASP good for?• Combinatorial search problems in the realm of P, NP, and NPNP
(some with substantial amount of data), like
– Automated Planning– Code Optimization– Composition of Renaissance Music– Database Integration– Decision Support for NASA shuttle controllers– Model Checking– Product Configuration– Robotics– System Biology– System Synthesis– (industrial) Team-building– and many many more
TU Dresden, 6th May 2016 PSSAI slide 53 of 141
![Page 54: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/54.jpg)
What is ASP good for?• Combinatorial search problems in the realm of P, NP, and NPNP
(some with substantial amount of data), like– Automated Planning– Code Optimization– Composition of Renaissance Music– Database Integration– Decision Support for NASA shuttle controllers– Model Checking– Product Configuration– Robotics– System Biology– System Synthesis– (industrial) Team-building– and many many more
TU Dresden, 6th May 2016 PSSAI slide 54 of 141
![Page 55: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/55.jpg)
What does ASP offer?
• Integration of DB, KR, and SAT techniques
• Succinct, elaboration-tolerant problem representations– Rapid application development tool
• Easy handling of dynamic, knowledge intensive applications– including: data, frame axioms, exceptions, defaults, closures, etc
ASP = DB+LP+KR+SAT
TU Dresden, 6th May 2016 PSSAI slide 55 of 141
![Page 56: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/56.jpg)
What does ASP offer?
• Integration of DB, KR, and SAT techniques
• Succinct, elaboration-tolerant problem representations– Rapid application development tool
• Easy handling of dynamic, knowledge intensive applications– including: data, frame axioms, exceptions, defaults, closures, etc
ASP = DB+LP+KR+SAT
TU Dresden, 6th May 2016 PSSAI slide 56 of 141
![Page 57: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/57.jpg)
Agenda1 Motivation
– Declarative Problem Solving– ASP in a Nutshell– ASP Paradigm
2 Introduction– Syntax– Semantics– Examples– Language Constructs– Modeling
TU Dresden, 6th May 2016 PSSAI slide 57 of 141
![Page 58: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/58.jpg)
Problem solving in ASP: Syntax
Problem
Logic Program
Solution
Stable Models
?-
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 58 of 141
![Page 59: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/59.jpg)
Normal logic programs• A (normal) logic program over a set A of atoms is a finite set of rules• A (normal) rule, r, is of the form
a0 ← a1, . . . , am, not am+1, . . . , not an
where 0 ≤ m ≤ n and each ai ∈ A is an atom for 0 ≤ i ≤ n
• Notation
head(r) = a0
body(r) = {a1, . . . , am, not am+1, . . . , not an}body(r)+ = {a1, . . . , am}body(r)− = {am+1, . . . , an}
• A program is called positive if body(r)− = ∅ for all its rules
TU Dresden, 6th May 2016 PSSAI slide 59 of 141
![Page 60: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/60.jpg)
Normal logic programs• A (normal) logic program over a set A of atoms is a finite set of rules• A (normal) rule, r, is of the form
a0 ← a1, . . . , am, not am+1, . . . , not an
where 0 ≤ m ≤ n and each ai ∈ A is an atom for 0 ≤ i ≤ n
• Notation
head(r) = a0
body(r) = {a1, . . . , am, not am+1, . . . , not an}body(r)+ = {a1, . . . , am}body(r)− = {am+1, . . . , an}
• A program is called positive if body(r)− = ∅ for all its rules
TU Dresden, 6th May 2016 PSSAI slide 60 of 141
![Page 61: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/61.jpg)
Normal logic programs• A (normal) logic program over a set A of atoms is a finite set of rules• A (normal) rule, r, is of the form
a0 ← a1, . . . , am, not am+1, . . . , not an
where 0 ≤ m ≤ n and each ai ∈ A is an atom for 0 ≤ i ≤ n
• Notation
head(r) = a0
body(r) = {a1, . . . , am, not am+1, . . . , not an}body(r)+ = {a1, . . . , am}body(r)− = {am+1, . . . , an}
• A program is called positive if body(r)− = ∅ for all its rules
TU Dresden, 6th May 2016 PSSAI slide 61 of 141
![Page 62: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/62.jpg)
Rough notational convention
We sometimes use the following notation interchangeablyin order to stress the respective view:
default classicaltrue, false if and or iff negation negation
source code :- , | not -logic program ← , ; not ¬formula ⊥,> → ∧ ∨ ↔ ∼ ¬
TU Dresden, 6th May 2016 PSSAI slide 62 of 141
![Page 63: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/63.jpg)
Problem solving in ASP: Semantics
Problem
Logic Program
Solution
Stable Models
?-
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 63 of 141
![Page 64: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/64.jpg)
Formal DefinitionStable models of positive programs
• A set of atoms X is closed under a positive program P ifffor any r ∈ P, head(r) ∈ X whenever body(r)+ ⊆ X
– X corresponds to a model of P (seen as a formula)
• The smallest set of atoms which is closed under a positive program P isdenoted by Cn(P)
– Cn(P) corresponds to the ⊆-smallest model of P (ditto)
• The set Cn(P) of atoms is the stable model of a positive program P
TU Dresden, 6th May 2016 PSSAI slide 64 of 141
![Page 65: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/65.jpg)
Formal DefinitionStable models of positive programs
• A set of atoms X is closed under a positive program P ifffor any r ∈ P, head(r) ∈ X whenever body(r)+ ⊆ X
– X corresponds to a model of P (seen as a formula)
• The smallest set of atoms which is closed under a positive program P isdenoted by Cn(P)
– Cn(P) corresponds to the ⊆-smallest model of P (ditto)
• The set Cn(P) of atoms is the stable model of a positive program P
TU Dresden, 6th May 2016 PSSAI slide 65 of 141
![Page 66: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/66.jpg)
Formal DefinitionStable models of positive programs
• A set of atoms X is closed under a positive program P ifffor any r ∈ P, head(r) ∈ X whenever body(r)+ ⊆ X
– X corresponds to a model of P (seen as a formula)
• The smallest set of atoms which is closed under a positive program P isdenoted by Cn(P)
– Cn(P) corresponds to the ⊆-smallest model of P (ditto)
• The set Cn(P) of atoms is the stable model of a positive program P
TU Dresden, 6th May 2016 PSSAI slide 66 of 141
![Page 67: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/67.jpg)
Some “logical” remarks• Positive rules are also referred to as definite clauses
– Definite clauses are disjunctions with exactly one positive atom:
a0 ∨ ¬a1 ∨ · · · ∨ ¬am
– A set of definite clauses has a (unique) smallest model
• Horn clauses are clauses with at most one positive atom– Every definite clause is a Horn clause but not vice versa– Non-definite Horn clauses can be regarded as integrity constraints
– A set of Horn clauses has a smallest model or none
• This smallest model is the intended semantics of such sets of clauses– Given a positive program P, Cn(P) corresponds to the smallest
model of the set of definite clauses corresponding to P
TU Dresden, 6th May 2016 PSSAI slide 67 of 141
![Page 68: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/68.jpg)
Some “logical” remarks• Positive rules are also referred to as definite clauses
– Definite clauses are disjunctions with exactly one positive atom:
a0 ∨ ¬a1 ∨ · · · ∨ ¬am
– A set of definite clauses has a (unique) smallest model
• Horn clauses are clauses with at most one positive atom– Every definite clause is a Horn clause but not vice versa– Non-definite Horn clauses can be regarded as integrity constraints
– A set of Horn clauses has a smallest model or none
• This smallest model is the intended semantics of such sets of clauses– Given a positive program P, Cn(P) corresponds to the smallest
model of the set of definite clauses corresponding to P
TU Dresden, 6th May 2016 PSSAI slide 68 of 141
![Page 69: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/69.jpg)
Some “logical” remarks• Positive rules are also referred to as definite clauses
– Definite clauses are disjunctions with exactly one positive atom:
a0 ∨ ¬a1 ∨ · · · ∨ ¬am
– A set of definite clauses has a (unique) smallest model
• Horn clauses are clauses with at most one positive atom– Every definite clause is a Horn clause but not vice versa– Non-definite Horn clauses can be regarded as integrity constraints
– A set of Horn clauses has a smallest model or none
• This smallest model is the intended semantics of such sets of clauses– Given a positive program P, Cn(P) corresponds to the smallest
model of the set of definite clauses corresponding to P
TU Dresden, 6th May 2016 PSSAI slide 69 of 141
![Page 70: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/70.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 70 of 141
![Page 71: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/71.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 71 of 141
![Page 72: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/72.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 72 of 141
![Page 73: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/73.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 73 of 141
![Page 74: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/74.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 74 of 141
![Page 75: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/75.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 75 of 141
![Page 76: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/76.jpg)
Basic ideaConsider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 76 of 141
![Page 77: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/77.jpg)
Basic idea
Consider the logical formula Φ and its three(classical) models:
HHHHH
HHjp 7→ 1q 7→ 1r 7→ 0
{p, q}, {q, r}, and {p, q, r}
Φ q ∧ (q ∧ ¬r→ p)
Formula Φ has one stable model,often called answer set:
{p, q}
PΦ q ←p ← q, not r
Informally, a set X of atoms is a stable model of a logic program P
• if X is a (classical) model of P and• if all atoms in X are justified by some rule in P
(rooted in intuitionistic logics HT (Heyting, 1930) and G3 (Gödel, 1932))
TU Dresden, 6th May 2016 PSSAI slide 77 of 141
![Page 78: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/78.jpg)
Formal DefinitionStable model of normal programs
• The Gelfond-Lifschitz Reduct[Gelfond and Lifschitz(1991)], PX , of aprogram P relative to a set X of atoms is defined by
PX = {head(r)← body(r)+ | r ∈ P and body(r)− ∩ X = ∅}
• A set X of atoms is a stable model of a program P, if Cn(PX) = X
• Note: Cn(PX) is the ⊆–smallest (classical) model of PX
• Note: Every atom in X is justified by an “applying rule from P”
TU Dresden, 6th May 2016 PSSAI slide 78 of 141
![Page 79: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/79.jpg)
Formal DefinitionStable model of normal programs
• The Gelfond-Lifschitz Reduct[Gelfond and Lifschitz(1991)], PX , of aprogram P relative to a set X of atoms is defined by
PX = {head(r)← body(r)+ | r ∈ P and body(r)− ∩ X = ∅}
• A set X of atoms is a stable model of a program P, if Cn(PX) = X
• Note: Cn(PX) is the ⊆–smallest (classical) model of PX
• Note: Every atom in X is justified by an “applying rule from P”
TU Dresden, 6th May 2016 PSSAI slide 79 of 141
![Page 80: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/80.jpg)
Formal DefinitionStable model of normal programs
• The Gelfond-Lifschitz Reduct[Gelfond and Lifschitz(1991)], PX , of aprogram P relative to a set X of atoms is defined by
PX = {head(r)← body(r)+ | r ∈ P and body(r)− ∩ X = ∅}
• A set X of atoms is a stable model of a program P, if Cn(PX) = X
• Note: Cn(PX) is the ⊆–smallest (classical) model of PX
• Note: Every atom in X is justified by an “applying rule from P”
TU Dresden, 6th May 2016 PSSAI slide 80 of 141
![Page 81: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/81.jpg)
A closer look at PX
• In other words, given a set X of atoms from P,
PX is obtained from P by deleting1 each rule having not a in its body with a ∈ X
and then2 all negative atoms of the form not a
in the bodies of the remaining rules
• Note: Only negative body literals are evaluated w.r.t. X
TU Dresden, 6th May 2016 PSSAI slide 81 of 141
![Page 82: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/82.jpg)
A closer look at PX
• In other words, given a set X of atoms from P,
PX is obtained from P by deleting1 each rule having not a in its body with a ∈ X
and then2 all negative atoms of the form not a
in the bodies of the remaining rules
• Note: Only negative body literals are evaluated w.r.t. X
TU Dresden, 6th May 2016 PSSAI slide 82 of 141
![Page 83: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/83.jpg)
A first example
P = {p← p, q← not p}
X
PX
Cn(PX)∅
p ← pq ←
{q} 8
{p}
p ← p ∅ 8
{q}
p ← pq ←
{q} 4
{p, q}
p ← p ∅ 8
TU Dresden, 6th May 2016 PSSAI slide 83 of 141
![Page 84: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/84.jpg)
A first example
P = {p← p, q← not p}
X
PX
Cn(PX)∅
p ← pq ←
{q} 8
{p}
p ← p ∅ 8
{q}
p ← pq ←
{q} 4
{p, q}
p ← p ∅ 8
TU Dresden, 6th May 2016 PSSAI slide 84 of 141
![Page 85: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/85.jpg)
A first example
P = {p← p, q← not p}
X PX Cn(PX)∅ p ← p
q ←{q}
8
{p} p ← p ∅
8
{q} p ← pq ←
{q}
4
{p, q} p ← p ∅
8
TU Dresden, 6th May 2016 PSSAI slide 85 of 141
![Page 86: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/86.jpg)
A first example
P = {p← p, q← not p}
X PX Cn(PX)∅ p ← p
q ←{q} 8
{p} p ← p ∅
8
{q} p ← pq ←
{q}
4
{p, q} p ← p ∅
8
TU Dresden, 6th May 2016 PSSAI slide 86 of 141
![Page 87: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/87.jpg)
A first example
P = {p← p, q← not p}
X PX Cn(PX)∅ p ← p
q ←{q} 8
{p} p ← p ∅ 8
{q} p ← pq ←
{q}
4
{p, q} p ← p ∅
8
TU Dresden, 6th May 2016 PSSAI slide 87 of 141
![Page 88: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/88.jpg)
A first example
P = {p← p, q← not p}
X PX Cn(PX)∅ p ← p
q ←{q} 8
{p} p ← p ∅ 8
{q} p ← pq ←
{q} 4
{p, q} p ← p ∅
8
TU Dresden, 6th May 2016 PSSAI slide 88 of 141
![Page 89: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/89.jpg)
A first example
P = {p← p, q← not p}
X PX Cn(PX)∅ p ← p
q ←{q} 8
{p} p ← p ∅ 8
{q} p ← pq ←
{q} 4
{p, q} p ← p ∅ 8
TU Dresden, 6th May 2016 PSSAI slide 89 of 141
![Page 90: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/90.jpg)
A second example
P = {p← not q, q← not p}
X PX Cn(PX)∅ p ←
q ←{p, q}
8
{p} p ← {p}
4
{q}q ←
{q}
4
{p, q} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 90 of 141
![Page 91: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/91.jpg)
A second example
P = {p← not q, q← not p}
X PX Cn(PX)∅ p ←
q ←{p, q}
8
{p} p ← {p}
4
{q}q ←
{q}
4
{p, q} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 91 of 141
![Page 92: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/92.jpg)
A second example
P = {p← not q, q← not p}
X PX Cn(PX)∅ p ←
q ←{p, q} 8
{p} p ← {p}
4
{q}q ←
{q}
4
{p, q} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 92 of 141
![Page 93: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/93.jpg)
A second example
P = {p← not q, q← not p}
X PX Cn(PX)∅ p ←
q ←{p, q} 8
{p} p ← {p} 4
{q}q ←
{q}
4
{p, q} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 93 of 141
![Page 94: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/94.jpg)
A second example
P = {p← not q, q← not p}
X PX Cn(PX)∅ p ←
q ←{p, q} 8
{p} p ← {p} 4
{q}q ←
{q} 4
{p, q} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 94 of 141
![Page 95: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/95.jpg)
A second example
P = {p← not q, q← not p}
X PX Cn(PX)∅ p ←
q ←{p, q} 8
{p} p ← {p} 4
{q}q ←
{q} 4
{p, q} ∅ 8
TU Dresden, 6th May 2016 PSSAI slide 95 of 141
![Page 96: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/96.jpg)
A third example
P = {p← not p}
X PX Cn(PX)∅ p ← {p}
8
{p} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 96 of 141
![Page 97: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/97.jpg)
A third example
P = {p← not p}
X PX Cn(PX)∅ p ← {p}
8
{p} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 97 of 141
![Page 98: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/98.jpg)
A third example
P = {p← not p}
X PX Cn(PX)∅ p ← {p} 8
{p} ∅
8
TU Dresden, 6th May 2016 PSSAI slide 98 of 141
![Page 99: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/99.jpg)
A third example
P = {p← not p}
X PX Cn(PX)∅ p ← {p} 8
{p} ∅ 8
TU Dresden, 6th May 2016 PSSAI slide 99 of 141
![Page 100: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/100.jpg)
Some properties
• A logic program may have zero, one, or multiple stable models!
• If X is an stable model of a logic program P,then X is a model of P (seen as a formula)
• If X and Y are stable models of a normal program P,then X 6⊂ Y
TU Dresden, 6th May 2016 PSSAI slide 100 of 141
![Page 101: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/101.jpg)
Some properties
• A logic program may have zero, one, or multiple stable models!• If X is an stable model of a logic program P,
then X is a model of P (seen as a formula)• If X and Y are stable models of a normal program P,
then X 6⊂ Y
TU Dresden, 6th May 2016 PSSAI slide 101 of 141
![Page 102: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/102.jpg)
Programs with Variables
Let P be a logic program• Let T be a set of (variable-free) terms
(also called Herbrand universe)
• Let A be a set of (variable-free) atoms constructable from T
(also called alphabet or Herbrand base)• Ground Instances of r ∈ P: Set of variable-free rules obtained by
replacing all variables in r by elements from T :
ground(r) = {rθ | θ : var(r)→ T , var(rθ) = ∅}
where var(r) stands for the set of all variables occurring in r;θ is a (ground) substitution
• Ground Instantiation of P: ground(P) =⋃
r∈Pground(r)
TU Dresden, 6th May 2016 PSSAI slide 102 of 141
![Page 103: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/103.jpg)
Programs with Variables
Let P be a logic program• Let T be a set of
(
variable-free
)
terms (also called Herbrand universe)• Let A be a set of (variable-free) atoms constructable from T
(also called alphabet or Herbrand base)
• Ground Instances of r ∈ P: Set of variable-free rules obtained byreplacing all variables in r by elements from T :
ground(r) = {rθ | θ : var(r)→ T , var(rθ) = ∅}
where var(r) stands for the set of all variables occurring in r;θ is a (ground) substitution
• Ground Instantiation of P: ground(P) =⋃
r∈Pground(r)
TU Dresden, 6th May 2016 PSSAI slide 103 of 141
![Page 104: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/104.jpg)
Programs with Variables
Let P be a logic program• Let T be a set of (variable-free) terms
(also called Herbrand universe)
• Let A be a set of (variable-free) atoms constructable from T
(also called alphabet or Herbrand base)
• Ground Instances of r ∈ P: Set of variable-free rules obtained byreplacing all variables in r by elements from T :
ground(r) = {rθ | θ : var(r)→ T , var(rθ) = ∅}
where var(r) stands for the set of all variables occurring in r;θ is a (ground) substitution
• Ground Instantiation of P: ground(P) =⋃
r∈Pground(r)
TU Dresden, 6th May 2016 PSSAI slide 104 of 141
![Page 105: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/105.jpg)
Programs with Variables
Let P be a logic program• Let T be a set of (variable-free) terms
(also called Herbrand universe)
• Let A be a set of (variable-free) atoms constructable from T
(also called alphabet or Herbrand base)
• Ground Instances of r ∈ P: Set of variable-free rules obtained byreplacing all variables in r by elements from T :
ground(r) = {rθ | θ : var(r)→ T , var(rθ) = ∅}
where var(r) stands for the set of all variables occurring in r;θ is a (ground) substitution
• Ground Instantiation of P: ground(P) =⋃
r∈Pground(r)
TU Dresden, 6th May 2016 PSSAI slide 105 of 141
![Page 106: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/106.jpg)
An example
P = { r(a, b)←, r(b, c)←, t(X, Y)← r(X, Y) }
T = {a, b, c}
A=
{r(a, a), r(a, b), r(a, c), r(b, a), r(b, b), r(b, c), r(c, a), r(c, b), r(c, c),t(a, a), t(a, b), t(a, c), t(b, a), t(b, b), t(b, c), t(c, a), t(c, b), t(c, c)
}
ground(P) =
r(a, b) ← ,r(b, c) ← ,t(a, a) ← r(a, a), t(b, a) ← r(b, a), t(c, a) ← r(c, a),t(a, b) ← r(a, b), t(b, b) ← r(b, b), t(c, b) ← r(c, b),t(a, c) ← r(a, c), t(b, c) ← r(b, c), t(c, c) ← r(c, c)
• Intelligent Grounding aims at reducing the ground instantiation
TU Dresden, 6th May 2016 PSSAI slide 106 of 141
![Page 107: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/107.jpg)
An example
P = { r(a, b)←, r(b, c)←, t(X, Y)← r(X, Y) }
T = {a, b, c}
A=
{r(a, a), r(a, b), r(a, c), r(b, a), r(b, b), r(b, c), r(c, a), r(c, b), r(c, c),t(a, a), t(a, b), t(a, c), t(b, a), t(b, b), t(b, c), t(c, a), t(c, b), t(c, c)
}
ground(P) =
r(a, b) ← ,r(b, c) ← ,t(a, a) ← r(a, a), t(b, a) ← r(b, a), t(c, a) ← r(c, a),t(a, b) ← r(a, b), t(b, b) ← r(b, b), t(c, b) ← r(c, b),t(a, c) ← r(a, c), t(b, c) ← r(b, c), t(c, c) ← r(c, c)
• Intelligent Grounding aims at reducing the ground instantiation
TU Dresden, 6th May 2016 PSSAI slide 107 of 141
![Page 108: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/108.jpg)
An example
P = { r(a, b)←, r(b, c)←, t(X, Y)← r(X, Y) }
T = {a, b, c}
A=
{r(a, a), r(a, b), r(a, c), r(b, a), r(b, b), r(b, c), r(c, a), r(c, b), r(c, c),t(a, a), t(a, b), t(a, c), t(b, a), t(b, b), t(b, c), t(c, a), t(c, b), t(c, c)
}
ground(P) =
r(a, b) ← ,r(b, c) ← ,
t(a, a) ← r(a, a), t(b, a) ← r(b, a), t(c, a) ← r(c, a),
t(a, b) ←
r(a, b)
,
t(b, b) ← r(b, b), t(c, b) ← r(c, b),t(a, c) ← r(a, c),
t(b, c) ←
r(b, c), t(c, c) ← r(c, c)
• Intelligent Grounding aims at reducing the ground instantiation
TU Dresden, 6th May 2016 PSSAI slide 108 of 141
![Page 109: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/109.jpg)
Stable models of programs with Variables
Let P be a normal logic program with variables
• A set X of (ground) atoms is a stable model of P,
if Cn(ground(P)X) = X
TU Dresden, 6th May 2016 PSSAI slide 109 of 141
![Page 110: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/110.jpg)
Stable models of programs with Variables
Let P be a normal logic program with variables
• A set X of (ground) atoms is a stable model of P,
if Cn(ground(P)X) = X
TU Dresden, 6th May 2016 PSSAI slide 110 of 141
![Page 111: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/111.jpg)
Problem solving in ASP: Extended Syntax
Problem
Logic Program
Solution
Stable Models
?-
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 111 of 141
![Page 112: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/112.jpg)
Language Constructs
• Variables (over the Herbrand Universe)– p(X) :- q(X) over constants {a,b,c} stands for
p(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 112 of 141
![Page 113: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/113.jpg)
Language Constructs• Variables (over the Herbrand Universe)
– p(X) :- q(X) over constants {a,b,c} stands forp(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 113 of 141
![Page 114: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/114.jpg)
Language Constructs
• Variables (over the Herbrand Universe)– p(X) :- q(X) over constants {a,b,c} stands for
p(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 114 of 141
![Page 115: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/115.jpg)
Language Constructs
• Variables (over the Herbrand Universe)– p(X) :- q(X) over constants {a,b,c} stands for
p(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 115 of 141
![Page 116: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/116.jpg)
Language Constructs
• Variables (over the Herbrand Universe)– p(X) :- q(X) over constants {a,b,c} stands for
p(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 116 of 141
![Page 117: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/117.jpg)
Language Constructs
• Variables (over the Herbrand Universe)– p(X) :- q(X) over constants {a,b,c} stands for
p(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 117 of 141
![Page 118: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/118.jpg)
Language Constructs
• Variables (over the Herbrand Universe)– p(X) :- q(X) over constants {a,b,c} stands for
p(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 118 of 141
![Page 119: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/119.jpg)
Language Constructs• Variables (over the Herbrand Universe)
– p(X) :- q(X) over constants {a,b,c} stands forp(a) :- q(a), p(b) :- q(b), p(c) :- q(c)
• Conditional Literals– p :- q(X) : r(X) given r(a), r(b), r(c) stands for
p :- q(a), q(b), q(c)
• Disjunction– p(X) | q(X) :- r(X)
• Integrity Constraints– :- q(X), p(X)
• Choice– 2 { p(X,Y) : q(X) } 7 :- r(Y)
• Aggregates– s(Y) :- r(Y), 2 #count { p(X,Y) : q(X) } 7– also: #sum, #avg, #min, #max, #even, #odd
TU Dresden, 6th May 2016 PSSAI slide 119 of 141
![Page 120: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/120.jpg)
Modeling• For solving a problem class C for a problem instance I,
encode1 the problem instance I as a set PI of facts and2 the problem class C as a set PC of rules
such that the solutions to C for I can be (polynomially) extractedfrom the stable models of PI ∪ PC
• PI is (still) called problem instance• PC is often called the problem encoding
• An encoding PC is uniform, if it can be used to solve all itsproblem instancesThat is, PC encodes the solutions to C for any set PI of facts
TU Dresden, 6th May 2016 PSSAI slide 120 of 141
![Page 121: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/121.jpg)
Modeling• For solving a problem class C for a problem instance I,
encode1 the problem instance I as a set PI of facts and2 the problem class C as a set PC of rules
such that the solutions to C for I can be (polynomially) extractedfrom the stable models of PI ∪ PC
• PI is (still) called problem instance• PC is often called the problem encoding
• An encoding PC is uniform, if it can be used to solve all itsproblem instancesThat is, PC encodes the solutions to C for any set PI of facts
TU Dresden, 6th May 2016 PSSAI slide 121 of 141
![Page 122: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/122.jpg)
Modeling• For solving a problem class C for a problem instance I,
encode1 the problem instance I as a set PI of facts and2 the problem class C as a set PC of rules
such that the solutions to C for I can be (polynomially) extractedfrom the stable models of PI ∪ PC
• PI is (still) called problem instance• PC is often called the problem encoding
• An encoding PC is uniform, if it can be used to solve all itsproblem instancesThat is, PC encodes the solutions to C for any set PI of facts
TU Dresden, 6th May 2016 PSSAI slide 122 of 141
![Page 123: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/123.jpg)
Example 3-Colorability
• Vertices are represented with predicates node(X);• Edges are represented with predicates edge(X, Y).
Question: Is there a valid assignment of three colors for an input graph G suchthat no two adjacent vertices have the same color?
TU Dresden, 6th May 2016 PSSAI slide 123 of 141
![Page 124: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/124.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 124 of 141
![Page 125: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/125.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 125 of 141
![Page 126: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/126.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 126 of 141
![Page 127: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/127.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 127 of 141
![Page 128: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/128.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 128 of 141
![Page 129: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/129.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 129 of 141
![Page 130: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/130.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 130 of 141
![Page 131: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/131.jpg)
Graph coloring
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 131 of 141
![Page 132: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/132.jpg)
color.lp
node(1..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).
Probleminstance
1 { color(X,C) : col(C) } 1 :- node(X).
:- edge(X,Y), color(X,C), color(Y,C).
}Problemencoding
TU Dresden, 6th May 2016 PSSAI slide 132 of 141
![Page 133: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/133.jpg)
ASP solving process
Problem
LogicProgram Grounder Solver Stable
Models
Solution
- - -
?
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 133 of 141
![Page 134: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/134.jpg)
Graph coloring: Grounding
$ gringo --text color.lp
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).
TU Dresden, 6th May 2016 PSSAI slide 134 of 141
![Page 135: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/135.jpg)
Graph coloring: Grounding
$ gringo --text color.lp
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).
TU Dresden, 6th May 2016 PSSAI slide 135 of 141
![Page 136: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/136.jpg)
ASP solving process
Problem
LogicProgram Grounder Solver Stable
Models
Solution
- - -
?
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 136 of 141
![Page 137: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/137.jpg)
Graph coloring: Solving
$ gringo color.lp | clasp 0
clasp version 2.1.0Reading from stdinSolving...Answer: 1edge(1,2) ... col(r) ... node(1) ... color(6,b) color(5,g) color(4,b) color(3,r) color(2,r) color(1,g)Answer: 2edge(1,2) ... col(r) ... node(1) ... color(6,r) color(5,g) color(4,r) color(3,b) color(2,b) color(1,g)Answer: 3edge(1,2) ... col(r) ... node(1) ... color(6,g) color(5,b) color(4,g) color(3,r) color(2,r) color(1,b)Answer: 4edge(1,2) ... col(r) ... node(1) ... color(6,r) color(5,b) color(4,r) color(3,g) color(2,g) color(1,b)Answer: 5edge(1,2) ... col(r) ... node(1) ... color(6,g) color(5,r) color(4,g) color(3,b) color(2,b) color(1,r)Answer: 6edge(1,2) ... col(r) ... node(1) ... color(6,b) color(5,r) color(4,b) color(3,g) color(2,g) color(1,r)SATISFIABLE
Models : 6Time : 0.002s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)CPU Time : 0.000s
TU Dresden, 6th May 2016 PSSAI slide 137 of 141
![Page 138: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/138.jpg)
Graph coloring: Solving
$ gringo color.lp | clasp 0
clasp version 2.1.0Reading from stdinSolving...Answer: 1edge(1,2) ... col(r) ... node(1) ... color(6,b) color(5,g) color(4,b) color(3,r) color(2,r) color(1,g)Answer: 2edge(1,2) ... col(r) ... node(1) ... color(6,r) color(5,g) color(4,r) color(3,b) color(2,b) color(1,g)Answer: 3edge(1,2) ... col(r) ... node(1) ... color(6,g) color(5,b) color(4,g) color(3,r) color(2,r) color(1,b)Answer: 4edge(1,2) ... col(r) ... node(1) ... color(6,r) color(5,b) color(4,r) color(3,g) color(2,g) color(1,b)Answer: 5edge(1,2) ... col(r) ... node(1) ... color(6,g) color(5,r) color(4,g) color(3,b) color(2,b) color(1,r)Answer: 6edge(1,2) ... col(r) ... node(1) ... color(6,b) color(5,r) color(4,b) color(3,g) color(2,g) color(1,r)SATISFIABLE
Models : 6Time : 0.002s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)CPU Time : 0.000s
TU Dresden, 6th May 2016 PSSAI slide 138 of 141
![Page 139: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/139.jpg)
Problem solving in ASP: Reasoning Modes
Problem
Logic Program
Solution
Stable Models
?-
6
Modeling Interpreting
Solving
TU Dresden, 6th May 2016 PSSAI slide 139 of 141
![Page 140: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/140.jpg)
Reasoning Modes
• Satisfiability• Enumeration†
• Projection†
• Intersection‡
• Union‡
• Optimization
• and combinations of them
† without solution recording‡ without solution enumeration
TU Dresden, 6th May 2016 PSSAI slide 140 of 141
![Page 141: PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE · Agenda 1 Introduction 2 Uninformed Search versus Informed Search (Best First Search, A* Search, Heuristics) 3 Local Search,](https://reader033.fdocuments.us/reader033/viewer/2022042811/5fa6138511aa6d749d2886e7/html5/thumbnails/141.jpg)
References
Martin Gebser, Benjamin Kaufmann Roland Kaminski, and TorstenSchaub.Answer Set Solving in Practice.Synthesis Lectures on Artificial Intelligence and Machine Learning.Morgan and Claypool Publishers, 2012.doi=10.2200/S00457ED1V01Y201211AIM019.
Michael Gelfond and Vladimir Lifschitz.Classical negation in logic programs and disjunctive databases.New Generation Comput., 9(3–4):365–386, 1991.
• See also: http://potassco.sourceforge.net
TU Dresden, 6th May 2016 PSSAI slide 141 of 141