Intelligent Agents. AI Slides (4e) c Lin

Similar documents
Intelligent agents. As seen from Russell & Norvig perspective. Slides from Russell & Norvig book, revised by Andrea Roli

Outline. Intelligent agents. Vacuum-cleaner world. Agents and environments

9/7/2015. Outline for today s lecture. Problem Solving Agents & Problem Formulation. Task environments

Introduction to Intelligent Agents

Potential Midterm Exam Questions

what is an algorithm? analysis of algorithms classic algorithm example: search

CS 151: Intelligent Agents, Problem Formulation and Search

PEAS: Medical diagnosis system

The following are just some of the many possible definitions that can be written:

Lambda Calculus and Lambda notation in Lisp II. Based on Prof. Gotshalks notes on Lambda Calculus and Chapter 9 in Wilensky.

Discussion Section. Matthew Tong

Partially Observable Markov Decision Processes. Mausam (slides by Dieter Fox)

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Common Lisp Fundamentals

GPS: The general problem solver. developed in 1957 by Alan Newel and Herbert Simon. (H. Simon, 1957)

Artificial Intelligence Lecture 6

521495A: Artificial Intelligence

(defvar *state* nil "The current state: a list of conditions.")

FP Foundations, Scheme

Programming Language Concepts, cs2104 Lecture 01 ( )

Lisp Basic Example Test Questions

Lecture Notes on Lisp A Brief Introduction

Announcement. Overview. LISP: A Quick Overview. Outline of Writing and Running Lisp.

Fifth Generation CS 4100 LISP. What do we need? Example LISP Program 11/13/13. Chapter 9: List Processing: LISP. Central Idea: Function Application

1. Problem Representation

Imperative languages

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018

Fall 2017 Discussion 7: October 25, 2017 Solutions. 1 Introduction. 2 Primitives

CS 520: Introduction to Artificial Intelligence. Review

bindings (review) Topic 18 Environment Model of Evaluation bindings (review) frames (review) frames (review) frames (review) x: 10 y: #f x: 10

Beyond Classical Search

Lambda Calculus. Gunnar Gotshalks LC-1

Common LISP Tutorial 1 (Basic)

John McCarthy IBM 704

Topics in AI (CPSC 532L): Multimodal Learning with Vision, Language and Sound. Lecture 12: Deep Reinforcement Learning

Experiment 4.A. Speed and Position Control. ECEN 2270 Electronics Design Laboratory 1

AGENTS AND ENVIRONMENTS. What is AI in reality?

Last update: May 6, Robotics. CMSC 421: Chapter 25. CMSC 421: Chapter 25 1

Lecture #24: Programming Languages and Programs

Programming Concepts

Solving Problems by Searching. AIMA Sections , 3.6

SOFTWARE ARCHITECTURE 6. LISP

Functional Programming. Big Picture. Design of Programming Languages

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches

Department of Computer and information Science Norwegian University of Science and Technology

Chapter 1. Fundamentals of Higher Order Programming

CSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc.

Markov Decision Processes and Reinforcement Learning

Functional Programming. Pure Functional Languages

Seminar in Programming Languages

Chapter 3 Solving problems by searching

Functional Programming Languages (FPL)

MIDTERM EXAMINATION - CS130 - Spring 2005

Spring 2018 Discussion 7: March 21, Introduction. 2 Primitives

Introduction to Functional Programming and basic Lisp

Homework #2. If (your ID number s last two digits % 6) = 0: 6, 12, 18

CS 320: Concepts of Programming Languages

15 Unification and Embedded Languages in Lisp

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Robotics. CSPP Artificial Intelligence March 10, 2004

Functions, Conditionals & Predicates

Introduction to Fall 2014 Artificial Intelligence Midterm Solutions

Beyond Classical Search

Basics of Using Lisp! Gunnar Gotshalks! BLU-1

ARTIFICIAL INTELLIGENCE (CSC9YE ) LECTURES 2 AND 3: PROBLEM SOLVING

Expressions and Assignment

Lambda Calculus LC-1

Artificial Intelligence Lecture 1

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University

C S C A RTIF I C I A L I N T E L L I G E N C E M I D T E R M E X A M

Permission to copy The CAD Academy

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

Scheme. Functional Programming. Lambda Calculus. CSC 4101: Programming Languages 1. Textbook, Sections , 13.7

Discrete-Event Simulation: A First Course. Steve Park and Larry Leemis College of William and Mary

Scheme: Expressions & Procedures

CSE 40171: Artificial Intelligence. Uninformed Search: Search Spaces

CIT 590 Homework 5 HTML Resumes

Solving Problems by Searching

Agent Design Example Problems State Spaces. Searching: Intro. CPSC 322 Search 1. Textbook Searching: Intro CPSC 322 Search 1, Slide 1

And Parallelism. Parallelism in Prolog. OR Parallelism

11/6/17. Functional programming. FP Foundations, Scheme (2) LISP Data Types. LISP Data Types. LISP Data Types. Scheme. LISP: John McCarthy 1958 MIT

A Genetic Algorithm Implementation

Functional Programming

Heap storage. Dynamic allocation and stacks are generally incompatible.

CS 188: Artificial Intelligence. Recap Search I

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents

Fall 2018 Updates. Materials and Energy Balances. Fundamental Programming Concepts. Data Structure Essentials (Available now) Circuits (Algebra)

CPSC 3740 Programming Languages University of Lethbridge. Control Structures

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits.

Putting the fun in functional programming

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. More Common Lisp

Problem Solving and Searching

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Programming Languages 2nd edition Tucker and Noonan"

Midterm Examination (Sample Solutions), Cmput 325

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

CS 480. Lisp J. Kosecka George Mason University. Lisp Slides

Symbolic Programming. Dr. Zoran Duric () Symbolic Programming 1/ 89 August 28, / 89

Constraint Satisfaction Problems (CSPs)

Artificial Intelligence Lecture 1

Transcription:

Intelligent Agents 2 AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 1

2 Intelligence Agents Agents Rationality PEAS (Performance measure, Environment, Actuators, Sensors) Environments Agent structures The agent projects AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 2

Agents include an animal agent a human agent a robotic agent (robot) a software agent (softbot) internet agent crawler webbot email agent search agent, etc. Agents AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 3

Agents and environments sensors environment percepts actions? agent actuators An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 4

Agent functions An agent is completely specified by the agent function : maps from percept histories to actions f : P A Find a way to implement the rational agent function concisely AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 5

Agent programs The agent program runs on the physical architecture to produce the agent function agent = architecture + program The agent program takes a single percept as input, keeps internal state function Skeleton-Agent( percept) returns action persistent: memory, the agent s memory of the world memory Update-Memory(memory, percept) action Choose-Best-Action(memory) memory Update-Memory(memory, action) return action The algorithm is described by the pseudocode AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 6

Another form of algorithm A procedure for the skeleton-agent that takes a single percept as input, keeps internal state Procedure of Skeleton-Agent Input: percept Output: action memory the agent s memory of the world 1. memory Update-Memory(memory, percept) 2. action Choose-Best-Action(memory) 3. memory Update-Memory(memory, action) The algorithm is also described by the pseudocode AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 7

The pseudocode The pseudocode is a simple language to describe algorithms similar to programming language like Java, C, Python or Lisp informal to use mathematical formulas or ordinary English to describe parts Persistent variables (global variables): a variable is given an initial value the first time a function is called and retains that value on all subsequent calls to the function. The agent programs use persistent variables for memory. Variables have lowercase italic names. Function as values: The value of a variable is allowed to be a function. Functions and procedures have capitalized names Indentation is significant: the scope of a loop or conditional AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 8

The pseudocode Assignment: x value means that the right-hand side evaluate to the left-hand side variable Destructuring assignment: x, y pair means that the right-hand side evaluate to a two-element tuple, and the first element is assigned to x and the second to y. Or for each x,y in pair do if-then (-else): if c then else means that if the condition c is hold then doing something; otherwise doing something else for each: for each x in c do means that the loop is executed with the variable x bound to successive elements of the collection c. Or while c do or even loop Generators and yield: generator G(x) yields number defines G as a generator function AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 9

Lists: [x,y,z], [first rest] Sets: {x,y,z} The pseudocode Arrays start at 1: as in usual mathematical notation, not 0 as in Java and C AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 10

The code The algorithms in the pseudocode can be implemented in Java, C/C++, Python, Lisp and Prolog etc. The (Lisp) code for each topic is divided into four directories: agents: code defining agent types and programs algorithms: code for the methods used by the agent programs environments: code defining environment types, simulations domains: problem types and instances for input to algorithms (Often run algorithms on domains rather than agents in environments) AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 11

A coding (Lisp) (setq joe (make-agent :name joe :body (make-agent-body) :program (make-dumb-agent-program))) (defun make-dumb-agent-program () (let ((memory nil)) # (lambda (percept) (push percept memory) no-op))) AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 12

Rationality A rational agent is one that does right thing Without loss of generality, goals specifiable by performance measure defining a numerical value for any environment history Rational action: whichever action maximizes the expected value of the performance measure given the percept sequence to date Rational omniscient percepts may not supply all relevant information Rational clairvoyant action outcomes may not be as expected rational successful AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 13

Vacuum-cleaner world A B Percepts: location and contents, e.g., [A, Dirty] Actions: Left, Right, Suck, NoOp AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 14

A vacuum-cleaner agent Percept sequence Action [A, Clean] Right [A, Dirty] Suck [B, Clean] Lef t [B, Dirty] Suck [A, Clean], [A, Clean] Right [A, Clean], [A, Dirty]. Suck. function Reflex-Vacuum-Agent([location,status]) returns an action if status = Dirty then return Suck else if location = A then return Right else if location = B then return Left What is the right function? Can it be implemented in a program? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 15

Vacuum-cleaner rational agent Fixed performance measure evaluates the environment sequence one point per square cleaned up in time T? one point per clean square per time step, minus one per move? penalize for > k dirty squares? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 16

PEAS To design a rational agent, we must specify the task environment E.g., an automated taxi (intelligent vehicle): Performance measure?? Environment?? Actuators?? Sensors?? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 17

Automated taxi agent To design a rational agent, we must specify the task environment E.g., an automated taxi: Performance measure?? safety, destination, profits, legality,... Environment?? streets, traffic, pedestrians, weather,... Actuators?? steering, accelerator, brake, horn, speaker/display,... Sensors?? video, accelerometers, gauges, engine sensors, GPS,... AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 18

Performance measure?? Environment?? Actuators?? Sensors?? Internet shopping agent AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 19

Internet shopping agent Performance measure?? price, quality, appropriateness, efficiency,... Environment?? web sites, vendors, shippers,... Actuators?? display to user, follow URL, fill in form,... Sensors?? pages (text, graphics, scripts),... AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 20

Environments Observable?? Deterministic?? Episodic?? Static?? Discrete?? Single-agent?? Solitaire Backgammon Internet shopping Taxi AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 21

Environments Solitaire Backgammon Internet shopping Taxi Observable?? Yes Yes No No Deterministic?? Episodic?? Static?? Discrete?? Single-agent?? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 22

Environments Solitaire Backgammon Internet shopping Taxi Observable?? Yes Yes No No Deterministic?? Yes No Partly No Episodic?? Static?? Discrete?? Single-agent?? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 23

Environments Solitaire Backgammon Internet shopping Taxi Observable?? Yes Yes No No Deterministic?? Yes No Partly No Episodic?? No No No No Static?? Discrete?? Single-agent?? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 24

Environments Solitaire Backgammon Internet shopping Taxi Observable?? Yes Yes No No Deterministic?? Yes No Partly No Episodic?? No No No No Static?? Yes Semi Semi No Discrete?? Single-agent?? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 25

Environments Solitaire Backgammon Internet shopping Taxi Observable?? Yes Yes No No Deterministic?? Yes No Partly No Episodic?? No No No No Static?? Yes Semi Semi No Discrete?? Yes Yes Yes No Single-agent?? AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 26

Environments Solitaire Backgammon Internet shopping Taxi Observable?? Yes Yes No No Deterministic?? Yes No Partly No Episodic?? No No No No Static?? Yes Semi Semi No Discrete?? Yes Yes Yes No Single-agent?? Yes No Yes (except auctions) No The environment type largely determines the agent design The real world is (of course) partially observable, stochastic, sequential, dynamic, continuous, multi-agent AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 27

Agent structures Agents interact with environments through sensors and actuators Agent Sensors Percepts? Environment Actuators Actions AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 28

Agent structures Four basic types in order of increasing generality: simple reflex agents reflex agents with state goal-based agents utility-based agents All these can be turned into learning agents AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 29

Simple reflex agents Agent Sensors What the world is like now Condition-action rules What action I should do now Environment Actuators AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 30

Simple reflex agents function Simple-Reflex-Agent( percept) returns an action persistent: rules, a set of condition-action rules state Interpret-Input(percept) rule Rule-Match(state, rules) action rule.action return action AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 31

Example function Reflex-Vacuum-Agent([location,status]) returns an action if status = Dirty then return Suck else if location = A then return Right else if location = B then return Left (setq joe (make-agent :name joe :body (make-agent-body) :program (make-reflex-vacuum-agent-program))) (defun make-reflex-vacuum-agent-program () # (lambda (percept) (let ((location (first percept)) (status (second percept))) (cond ((eq status dirty) Suck) ((eq location A) Right) ((eq location B) Left))))) AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 32

Model-based reflex agents State How the world evolves What my actions do Condition-action rules Sensors What the world is like now What action I should do now Environment Agent Actuators AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 33

Example function Reflex-Vacuum-Agent([location,status]) returns an action persistent: last A, last B, numbers, initially if status = Dirty then... (defun make-reflex-vacuum-agent-with-state-program () (let ((last-a infinity) (last-b infinity)) # (lambda (percept) (let ((location (first percept)) (status (second percept))) (incf last-a) (incf last-b) (cond ((eq status dirty) (if (eq location A) (setq last-a 0) (setq last-b 0)) Suck) ((eq location A) (if (> last-b 3) Right NoOp)) ((eq location B) (if (> last-a 3) Left NoOp))))))) AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 34

Goal-based agents Sensors State How the world evolves What the world is like now What my actions do Goals What it will be like if I do action A What action I should do now Environment Agent Actuators AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 35

Utility-based agents Sensors State How the world evolves What the world is like now What my actions do Utility What it will be like if I do action A How happy I will be in such a state Environment Agent What action I should do now Actuators AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 36

Performance standard Learning agents Critic Sensors feedback learning goals Learning element changes knowledge Performance element Environment Problem generator Agent Actuators AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 37

The agent projects Design and implement a simple but useful agent Justrightnowontheprogresswiththenewknowledgecharpterby-charpter selectively by a programming language which you are familiar with in a software environment or platform single agent or multi-agents (group) Options: Internet agent Intelligent robot intelligent motor intelligent drone AI Slides (4e) c Lin Zuoquan@PKU 2003-2017 2 38