Logical Agents




CS156

Chris Pollett

Oct 11, 2017

Outline

Introduction

Knowledge-based agents

KB-Agent Pseudo-code

Below is pseudo-code for a knowledge-based agent. As with all of our agents, it receives percepts about its environment, and returns actions. It maintains a KB, which initially may contain some background knowledge.

function KB-Agent(percept) returns an action
    persistent KB, a knowledge base
    t, a counter, initially 0, indicating time

    // store the percept into the KB
    Tell(KB, Make-Percept-Sentence(percept, t))
    
    // choose an action
    action := Ask(KB, Make-Action-Query(t))
    
    // tell the KB, we did that action at time t
    Tell(KB, Make-Action-Sentence(action, t))

    t++
    return action

Remarks on KB Agent

Wumpus World

A 4x4 wumpus world

PEAS Description of Wumpus World

Notes about Wumpus World

Wumpus World at Stages of Reasoning

A KB agent in Wumpus World

In-Class Exercise

You are tasked with trying to implement the Wumpus World in code.

  1. Suggest in one or two sentences how KB could be implemented as a data structure or in a database.
  2. Describe in one or two sentences how you could implement Tell.
  3. Describe in one or two sentences how you could implement Ask.

Post your solutions to the Oct 11 In-Class Exercise Thread.

Logic

Entailment