Logical Agents. Santa Clara University

Similar documents
Logical Agents. Chapter 7

Logical Agents. Outline

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

Intelligent Agents. Pınar Yolum Utrecht University

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Class Assignment Strategies

Introduction to Intelligent Systems

Proof Methods for Propositional Logic

Logical Agents. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 7

Logical Agent & Propositional Logic

Introduction to Intelligent Systems

INF5390 Kunstig intelligens. Logical Agents. Roar Fjellheim

Logical Agent & Propositional Logic

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14

Logical Agents (I) Instructor: Tsung-Che Chiang

Logical Agents. Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 7

Artificial Intelligence Chapter 7: Logical Agents

Logical Agents. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 7

Logical Agents. Seung-Hoon Na Chonbuk National University. 1 Department of Computer Science

7 LOGICAL AGENTS. OHJ-2556 Artificial Intelligence, Spring OHJ-2556 Artificial Intelligence, Spring

Introduction to Artificial Intelligence. Logical Agents

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

CS 771 Artificial Intelligence. Propositional Logic

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

CS 4700: Foundations of Artificial Intelligence

Kecerdasan Buatan M. Ali Fauzi

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

Logic. proof and truth syntacs and semantics. Peter Antal

Logical Agents. Chapter 7

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7.

CS 188: Artificial Intelligence Spring 2007

CSC242: Intro to AI. Lecture 11. Tuesday, February 26, 13

Artificial Intelligence

Foundations of Artificial Intelligence

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

Foundations of Artificial Intelligence

Logical agents. Chapter 7. Chapter 7 1

TDT4136 Logic and Reasoning Systems

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

CSCI 5582 Artificial Intelligence. Today 9/28. Knowledge Representation. Lecture 9

Logical Agents: Propositional Logic. Chapter 7

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

Foundations of Artificial Intelligence

Artificial Intelligence

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents

Knowledge-based Agents. CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents. Outline. Knowledge-based Agents

Artificial Intelligence. Propositional logic

Adversarial Search & Logic and Reasoning

COMP3702/7702 Artificial Intelligence Week 5: Search in Continuous Space with an Application in Motion Planning " Hanna Kurniawati"

Propositional Logic: Logical Agents (Part I)

Lecture Overview [ ] Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 6. Motivation. Logical Agents

Revised by Hankui Zhuo, March 21, Logical agents. Chapter 7. Chapter 7 1

Deliberative Agents Knowledge Representation I. Deliberative Agents

Agents that reason logically

Lecture 7: Logic and Planning

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

Outline. Logic. Knowledge bases. Wumpus world characteriza/on. Wumpus World PEAS descrip/on. A simple knowledge- based agent

Last update: March 4, Logical agents. CMSC 421: Chapter 7. CMSC 421: Chapter 7 1

CS 380: ARTIFICIAL INTELLIGENCE

Chương 3 Tri th ức và lập luận

AI Programming CS S-09 Knowledge Representation

Propositional Logic: Methods of Proof. Chapter 7, Part II

Propositional Logic: Logical Agents (Part I)

Lecture 7: Logical Agents and Propositional Logic

Propositional Logic: Methods of Proof (Part II)

Logical Agents. Outline

Propositional Logic: Methods of Proof (Part II)

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Subbarao Kambhampati, Dieter Fox, Henry Kautz )

Lecture 6: Knowledge 1

Logic & Logic Agents Chapter 7 (& background)

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Dieter Fox, Henry Kautz )

CS 7180: Behavioral Modeling and Decision- making in AI

CS 4700: Artificial Intelligence

Inference Methods In Propositional Logic

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5

Introduction to Arti Intelligence

Logic & Logic Agents Chapter 7 (& Some background)

Logical agents. Chapter 7. Chapter 7 1

Inference Methods In Propositional Logic

Artificial Intelligence

20/c/applet/more.html Local Beam Search The best K states are selected.

CS:4420 Artificial Intelligence

Propositional inference, propositional agents

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

Inference in Propositional Logic

Knowledge- Based Agents. Logical Agents. Knowledge Base. Knowledge- Based Agents 10/7/09

Propositional Logic: Methods of Proof (Part II)

7.5.2 Proof by Resolution

Logic. Stephen G. Ware CSCI 4525 / 5525

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

Propositional and First-Order Logic

Propositional Reasoning

A simple knowledge-based agent. Logical agents. Outline. Wumpus World PEAS description. Wumpus world characterization. Knowledge bases.

Advanced Topics in LP and FP

CS:4420 Artificial Intelligence

Knowledge based Agents

Transcription:

Logical Agents Santa Clara University

Logical Agents Humans know things Humans use knowledge to make plans Humans do not act completely reflexive, but reason AI: Simple problem-solving agents have knowledge encoded in their search spaces CSP: Use a more generic approach by building generic models of the problem and solving them Logical agents: Have knowledge base and use logic in order to make plans

Knowledge Based Agents Knowledge base (KB) Set of sentences Expressed in a knowledge representation language Need to add sentences and query TELL and ASK operations Might involve inference

Knowledge Based Agents Knowledge based agent forever: TELL(MAKE-PERCEPT-SENTENCE(percept)) ASK(MAKE-ACTION-QUERY) TELL(MAKE-ACTION-SEQUENCE)

Wumpus World 4 Stench Breez e PIT Breez e 3 Stench PIT Breez e Gold 2 Stench Breez e 1 Breez e PIT Breez e START 1 2 3 4

The Wumpus World Wumpus world Caves (4x4 grid) consisting of rooms connected by passage ways One wumpus (smells, eats players, can be shot dead) Bottomless pits (cause drafts, player falls into pit) Gold (glitters, can be picked up)

The Wumpus World Performance Measure +1000: getting out alive with gold -1000: falling into a pit or being eaten by wumpus -1: each action taken -10: shooting your only arrow

The Wumpus World Actuators: Move, turn left, turn right Percepts: Stench Breeze Glitter Bump Scream

Logic Syntax Semantics: defines truth depending on model Model: possible world

Logic If a sentence α is satisfied in the model m m satisfies α m is a model for α M( )

Wumpus World 1,4 2,4 3,4 4,4 1,3 2,3 3,3 4,3 1,2 2,2 3,2 4,2 OK 1,1 2,1 3,1 4,1 A OK OK (a) A = Agent B = Breeze G = Glitter, Gold OK = Safe square P = Pit S = Stench V = Visited W = Wumpus 1,4 2,4 3,4 4,4 1,3 2,3 3,3 4,3 1,2 2,2 P? 3,2 4,2 OK 1,1 2,1 A 3,1 P? 4,1 V B OK OK (b)

Wumpus World 2 2 PIT 2 2 PIT 1 Breeze 1 PIT 1 2 3 KB α 1 Breeze 1 2 3 KB 1 Breeze PIT 1 2 3 1 Breeze 1 2 3 α 2 2 PIT 1 Breeze 1 2 3 2 1 Breeze 1 2 3 2 PIT 1 Breeze PIT 1 2 3 2 PIT 1 Breeze 1 2 3 2 1 Breeze 1 2 3 2 PIT 1 Breeze PIT 1 2 3 2 PIT 2 PIT PIT 1 Breeze PIT 1 2 3 2 PIT PIT 1 Breeze PIT 1 2 3 1 Breeze 1 2 3 2 PIT 1 Breeze PIT 1 2 3 2 PIT PIT 2 PIT PIT 1 Breeze 1 2 3 1 Breeze PIT 1 2 3

Logic Logical entailment α entails β, M( ) M( ) The stronger assertion rules out more models

Logic Inference mechanism A method to derive a statement from other statements Inference algorithm: Sound: it derives only entailed sentences Complete: it derives any sentence that is entailed Grounding: How do we know that the knowledge base is true in the world

Propositional Logic Syntax Sentences are atomic or compound To create compound statements, use logical operations and, or, implies, equivalent (if and only if) Semantics Give truth values to atomic sentences Calculate truth values for compound statements

Propositional Logic Logical equivalence Two sentences are logically equivalent if they are true in the same set of models if and only if and

Propositional Logic Deduction Theorem if and only if ( ) ) is valid Can prove the latter by checking that it is true in every model by proving that it is equivalent to true

Propositional Logic Syntax Atomic sentences Denoted by capital letters Literals Atomic sentences or their negation Compound statements Using operators ) _ ^ ()

Propositional Logic Semantics Semantics of operations are defined by truth tables

Wumpus world logic P(i,j) a pit in location i, j W(i,j) a wumpus in positions i, j (dead or alive) B(i,j) a breeze in i, j S(i,j) a stench in i, j

Wumpus world logic P 1,1 P i,j ) B i 1,j ^ B i+1,j ^ B i,j+1 ^ B i,j 1 W i,j ) S i 1,j ^ S i+1,j ^ S i,j+1 ^ S i,j 1 B i,j ) P i 1,j _ P i+1,j _ P i,j 1 _ P i,j+1 S i,j ) W i 1,j _ W i+1,j _ W i,j 1 _ W i,j+1

Wumpus world logic Logical agent needs to decide whether this knowledge base entails propositions Good algorithm is sound if it only labels true propositions as true complete if it labels every true proposition as true it eventually decides

Propositional Theorem Proving Can do model checking Generate the set of all allowable models Check a proposition on whether it is valid in all models Can do mathematical proofs Use inference rules

Propositional Logic Modus ponens A ) B,A And elimination A ^ B B A

Wumpus World Logic Can you inference rules in order to obtain statements P 1,2 ) B 1,1 ^ B 1,3 ^ B 2,2 P 1,2 ) B 1,1 P 1,2 ) B 1,1, B 1,1 P 1,2

Wumpus Logic Can use search algorithms in order to find true propositions using the knowledge base States are true propositions Actions are applications of an inference rule

Wumpus Logic Can restrict to a single inference rule: Resolution l 1,l 2,...l n literals, m literal that is the negative of literal l i,then l 1 _ l 2 _..._ l n,m l 1 _ l 2 _...l i 1 _ l i+1 _...l n

Wumpus Logic Example: P 1,1 _ P 3,1, P 1,1 _ P 2,2 P 3,1 _ P 2,2

Wumpus Logic Transform knowledge base into CNF Use algebraic manipulations to move individual propositions to CNF

Propositional Logic To prove a statement A Add A to the KB See whether you can obtain the empty clause with resolution Ground resolution theorem: If a set of clauses is unsatisfiable, then the resolution closure outhouse clauses contains the empty clause. Can use fact that entailed statements only grow with the addition of information

Wumpus World Logic P 2,1 B 1,1 B 1,1 P 1,2 P 2,1 P 1,2 B 1,1 B 1,1 P 1,2 ^ ^ ^ ^ B 1,1 P 1,2 B 1,1 ^ ^ P 1,2 P 2,1 P 2,1 B 1,1 P 2,1 B 1,1 P 1,2 P 2,1 P 1,2 ^ ^ ^ ^ ^ ^ P 2,1 P 1,2

Propositional Logic Resolution works, but is involved Often, KB can be written in a more restricted form Horn Clause Single, positive literals (the facts) Implications of the form body implies head B 1 ^ B 2 ^...^ B n ) H In conjunctive normal form: disjunction of literals where at most one is positive

Propositional Logic Deciding entailment with Horn clauses can be done in time linear with the knowledge base Forward chaining: Prove single literal Start with all known literals Try out Horn clauses to generate new known literals

Propositional Logic P ) Q L ^ M ) P B ^ L ) M A ^ P ) L A ^ B ) L A B L Q P A M B

Propositional Logic Backward chaining Sometimes uses much less inference Start with goal Look for all inferences with head goal Include the body of these inferences in the goal

SAT To check whether KB entails a proposition KB ) A () KB _ A Hence: KB ) A () KB ^ A not satisfiable Since the KB can be in CNF, this question is an instance of SAT (not 3-SAT yet)

SAT Every SAT can be changed to 3-SAT Use a 3-SAT solver A cottage industry with annual competition With huge theoretical importance With many practical problems

Davis Putnam Logemann Loveland Algorithm Input is a sentence in conjunctive normal form Recursive, depth-first enumeration of possible models With improvements Early termination of evaluation If a literal is true in all clauses, the sentence is true A;((A _ B) ^ (A _ C)) Independent of other assignments

Davis Putnam Logemann Loveland Algorithm Improvements Early termination One literal true in all clauses entails sentence is true One clause is false then sentence is false A ^ B ^ C;(( A _ B _ C) ^...)

Davis Putnam Logemann Improvements Loveland Algorithm Pure symbols Literal appears always either positive or negative in all clauses Pure symbols lead to simple truth assignment Unit clause A clause with just one literal A clause where only one literal has not yet been assigned Unit clauses also force assignment

DPLL algoritmo

SAT Not all SAT problems are equally hard Convert to 3-SAT It turns out that there needs to be a ratio between number of clauses and number of variables for SAT to be hard

SAT 1 0.8 P(satisfiable) 0.6 0.4 0.2 0 0 1 2 3 4 5 6 7 8 Clause/symbol ratio m/n

SAT Runtime 2000 1800 1600 1400 1200 1000 800 600 400 200 0 DPLL WalkSAT 0 1 2 3 4 5 6 7 8 Clause/symbol ratio m/n

Agents Based on Propositional Logic Collect many rules about breezes, stenches, wumpus Agent percepts: Need to depend on the time Connected to rules via location variables L t x,y ) (Breeze t, B x,y )

Agents Based on Propositional Logic Percepts only say something about the current time Example of fluents: Aspect of the world that changes Symbols associated with permanent aspects of the world are atemporal variables

Agents Based on Propositional Logic Transition model Propositions for the occurrences of actions Forward t Effect axioms L 1 0,0 ^ FacingEast 0 ^ Forward 0 ) (L 1 2,1 ^ L 1 1,1)

Agents Based on Propositional Logic Frame problem Many states are unchanged by the action The frame of reference Can add frame axioms But these proliferate Representational frame problem How to represent the frame Inferential frame problem Calculating the results of an action takes longer

Agents Based on Propositional Logic Frame problem Solution is to not write axioms about actions but about fluents HaveArrow t+1 ) (HaveArrow t ^ Shoot t )

Agents Based on Propositional Logic Hybrid agent for the wumpus world Maintain and update knowledge base Construct plan If glitter, grab gold, walk out If not: Explore the world, avoiding Wumpus and pits Use A* for route planning

Agents Based on Propositional Logic Logical state estimation Recalculating inferences becomes unsustainable as the KB increases Need to cache results Past history of percepts can be accumulated in a belief state Process of updating belief state is called state estimation Example: WumpusAlive 3 ^ L 3 2,1 ^ B 2,1 ^ (P 3,1 _ P 2,2 )

Agents Based on Propositional Logic Logical State Estimation Exact belief state is large n fluents: 2**n physical states 2**2**n belief states Alternative: Use approximate belief state Only use 1-CNF (conservatively) State estimation: See whether literals about fluents can be ascertained Example: Wumpus world Belief state B 2,1 ^ P 1,1 ^ S 1,2 ^ P 1,2 ^ B 1,1

Agents Based on Propositional Logic Making plans by propositional inference Construct a sentence that includes: Assertions about initial state Successor-state axioms for all possible actions up to some maximum time t Goal assertion for time t Present the sentence to the SAT solver If the solver finds a satisfying model, then the goal is achievable If not, then planning is impossible If there is a model, extract the action variables that are true as the plan