Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Praktikum KI Teil V: Logik. Praktikum KI SoSe 2005 Überblick Organisation des Praktikums Einführung in die Künstliche Intelligenz Suche nach einer intelligenten.

Ähnliche Präsentationen


Präsentation zum Thema: "Praktikum KI Teil V: Logik. Praktikum KI SoSe 2005 Überblick Organisation des Praktikums Einführung in die Künstliche Intelligenz Suche nach einer intelligenten."—  Präsentation transkript:

1 Praktikum KI Teil V: Logik

2 Praktikum KI SoSe 2005 Überblick Organisation des Praktikums Einführung in die Künstliche Intelligenz Suche nach einer intelligenten Lösung Problemlösung mit Heuristiken Logik Planung & Robotik Expertensysteme Lernen

3 Praktikum KI SoSe 2005 Wumpus World PEAS description Performance measure gold +1000, death -1000 -1 per step, -10 for using the arrow Environment Squares adjacent to wumpus are smelly Squares adjacent to pit are breezy Glitter iff gold is in the same square Shooting kills wumpus if you are facing it Shooting uses up the only arrow Grabbing picks up gold if in same square Releasing drops the gold in same square Sensors: Stench, Breeze, Glitter, Bump, Scream Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot

4 Praktikum KI SoSe 2005 Wumpus World characterization Fully Observable No – only local perception Deterministic Yes – outcomes exactly specified Episodic No – sequential at the level of actions Static Yes – Wumpus and Pits do not move Discrete Yes Single-agent? Yes – Wumpus is essentially a natural feature

5 Praktikum KI SoSe 2005 Exploring a wumpus world

6 Praktikum KI SoSe 2005 Exploring a wumpus world

7 Praktikum KI SoSe 2005 Exploring a wumpus world

8 Praktikum KI SoSe 2005 Exploring a wumpus world

9 Praktikum KI SoSe 2005 Exploring a wumpus world

10 Praktikum KI SoSe 2005 Exploring a wumpus world

11 Praktikum KI SoSe 2005 Exploring a wumpus world

12 Praktikum KI SoSe 2005 Exploring a wumpus world

13 Praktikum KI SoSe 2005 Logik – Grundlagen Aussagenlogik Aussagenlogik kennt nur Fakten (und die Verknüpfungen,, v,, ) B21 (breeze in Feld (2,1)) B41 B42 P31 B43 B34 P33 v P44 Implikationen ( ) lassen sich umschreiben: (A B) ist äqivalent zu ( A v B) Beweis: Wahrheitstabelle: AB A B A v B True False True False True

14 Praktikum KI SoSe 2005 Logik – Knowledge Base Fakten werden in Knowledge Base (KB) gespeichert Einträge der KB sind mit UND verknüpft Aus bestehenden Einträgen können neue generiert werden KB: {A, A B} Daraus generiert (geschlussfolgert) B Neue KB: {A, A B, B} Oder: KB: {A, A B C } Daraus generiert (geschlussfolgert) C Neue KB: {A, A B C, C}

15 Praktikum KI SoSe 2005 Logik - Interferenz An die Knowledge Base können Anfragen gestellt werden KB: {A, A B C } Mögliche Anfragen (α): A, C, C, D, … Eine Anfrage ist true, wenn gilt (KB α) Zur positiven Beantwortung einer Anfrage zeige also, dass für jede Belegung der Symbole mit true / false (=Modell), die für KB true ergibt, auch α true ist Alternativ zeige, dass (KB α) false ist Die Suche nach einem solchen Modell wird als Interferenz bezeichnet

16 Praktikum KI SoSe 2005 Logik - Inference by enumeration One sentence entails another (A B) if B is true in all worlds where A is true An Inference Method is sound if it derives only sentences which are entailed in the KB complete if it derives all sentences which are entailed in the KB Depth-first enumeration of all models is sound and complete For n symbols, time complexity is O(2 n ), space complexity is O(n)

17 Praktikum KI SoSe 2005 Logik – Kojunktive Normalform Konjunktive Normalform (CNF): Konjunktion ( ) von Disjunktionen (v) von Literalen, z.B. (A B) (B C D) Jede Aussage kann in CNF gebracht werden A B ist äquivalent () zu (A B) (B A) (A B) ( A v B) de Morgan ( (AvB) A B, …) Distributivität von und v Zur Interferenz werden stets zwei Disjunktionen herangezogen, die das gleiche Literal einmal mit und einmal ohne Negation ( ) enthalten (A B) (B C D)

18 Praktikum KI SoSe 2005 Resolution Resolution inference rule (for CNF): Let l i and m j be complementary literals (i.e. l i m j ). Then it holds l 1 … l k, m 1 … m n l 1 … l i-1 l i+1 … l k m 1 … m j-1 m j+1... m n E.g., P 1,3 P 2,2, P 2,2 P 1,3 Resolution is sound and complete for propositional logic

19 Praktikum KI SoSe 2005 Logik – Beweis durch Resolution Führt die Interferenz durch Resolution auf die leere Aussage {}, so ist die ursprüngliche CNF falsch {} entsteht ausschließlich durch A, A {} Wenn A und A in Konjunktion ( ) auftreten, so ist die Aussage stets False Um KB α zu zeigen, versuche daher (KB α) via Resolution zum Widerspruch, d.h. zu {}, zu bringen.

20 Praktikum KI SoSe 2005 Resolution algorithm Proof by contradiction, i.e., show KB α unsatisfiable

21 Praktikum KI SoSe 2005 Resolution example KB = (B 1,1 (P 1,2 P 2,1 )) B 1,1 α = P 1,2

22 Praktikum KI SoSe 2005 Logik – Horn Clauses Horn Clauses sind spezielle Form der CNF Jede Disjunktion enthält genau ein positives Literal Bsp: (A B) (B C D) Es gilt: (A B C … N ) (B C … N A) Damit kann die Modus Ponens-Regel angewandt werden: A B C, A B C D D Bei einer KB aus Horn Clauses können Forward- und Backward-Chaining angewandt werden

23 Praktikum KI SoSe 2005 Forward chaining Idea: fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found

24 Praktikum KI SoSe 2005 Forward chaining example

25 Praktikum KI SoSe 2005 Forward chaining example

26 Praktikum KI SoSe 2005 Forward chaining example

27 Praktikum KI SoSe 2005 Forward chaining example

28 Praktikum KI SoSe 2005 Forward chaining example

29 Praktikum KI SoSe 2005 Forward chaining example

30 Praktikum KI SoSe 2005 Forward chaining example

31 Praktikum KI SoSe 2005 Backward chaining Idea: work backwards from the query q: to prove q by BC, check if q is known already, or prove by BC all premises of some rule concluding q Avoid loops: check if new subgoal is already on the goal stack Avoid repeated work: check if new subgoal 1. has already been proved true, or 2. has already failed

32 Praktikum KI SoSe 2005 Backward chaining example

33 Praktikum KI SoSe 2005 Backward chaining example

34 Praktikum KI SoSe 2005 Backward chaining example

35 Praktikum KI SoSe 2005 Backward chaining example

36 Praktikum KI SoSe 2005 Backward chaining example

37 Praktikum KI SoSe 2005 Backward chaining example

38 Praktikum KI SoSe 2005 Backward chaining example

39 Praktikum KI SoSe 2005 Backward chaining example

40 Praktikum KI SoSe 2005 Backward chaining example

41 Praktikum KI SoSe 2005 Backward chaining example

42 Praktikum KI SoSe 2005 Forward vs. backward chaining FC is data-driven, automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal BC is goal-driven, appropriate for problem-solving, e.g., Where are my keys? How do I get into a PhD program? Complexity of BC can be much less than linear in size of KB

43 Praktikum KI SoSe 2005 Efficient propositional inference Two families of efficient algorithms for propositional inference: Complete backtracking search algorithms DPLL algorithm (Davis, Putnam, Logemann, Loveland) Incomplete local search algorithms WalkSAT algorithm

44 Praktikum KI SoSe 2005 The DPLL algorithm Determine if an input propositional logic sentence (in CNF) is satisfiable. Improvements over truth table enumeration: 1. Early termination A clause is true if any literal is true. A sentence is false if any clause is false. 2. Pure symbol heuristic Pure symbol: always appears with the same "sign" in all clauses. e.g., In the three clauses (A B), ( B C), (C A), A and B are pure, C is impure. Make a pure symbol literal true. 3. Unit clause heuristic Unit clause: only one literal in the clause The only literal in a unit clause must be true.

45 Praktikum KI SoSe 2005 The DPLL algorithm

46 Praktikum KI SoSe 2005 The WalkSAT algorithm Incomplete, local search algorithm Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses Balance between greediness and randomness

47 Praktikum KI SoSe 2005 The WalkSAT algorithm

48 Praktikum KI SoSe 2005 Inference-based agents in the wumpus world A wumpus-world agent using propositional logic: P 1,1 W 1,1 B x,y (P x,y+1 P x,y-1 P x+1,y P x-1,y ) S x,y (W x,y+1 W x,y-1 W x+1,y W x-1,y ) W 1,1 W 1,2 … W 4,4 W 1,1 W 1,2 W 1,1 W 1,3 … 64 distinct proposition symbols, 155 sentences

49 Praktikum KI SoSe 2005 Inference-based agents in the wumpus world

50 Praktikum KI SoSe 2005 KB contains "physics" sentences for every single square For every time t and every location [x,y], L x,y FacingRight t Forward t L x+1,y Rapid proliferation of clauses Expressiveness limitation of propositional logic t+1t

51 Praktikum KI SoSe 2005 Summary Logical agents apply inference to a knowledge base to derive new information and make decisions Basic concepts of logic: syntax: formal structure of sentences semantics: truth of sentences wrt models entailment: necessary truth of one sentence given another inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences Wumpus world requires the ability to represent partial and negated information, reason by cases, etc. Resolution is complete for propositional logic Forward, backward chaining are linear-time, complete for Horn clauses Propositional logic lacks expressive power


Herunterladen ppt "Praktikum KI Teil V: Logik. Praktikum KI SoSe 2005 Überblick Organisation des Praktikums Einführung in die Künstliche Intelligenz Suche nach einer intelligenten."

Ähnliche Präsentationen


Google-Anzeigen