Intelligent Agents. AI Slides (4e) c Lin

Size: px
Start display at page:

Download "Intelligent Agents. AI Slides (4e) c Lin"

Transcription

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

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

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

4 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

5 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

6 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

7 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

8 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

9 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

10 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

11 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

12 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

13 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

14 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

15 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

16 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

17 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

18 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

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

20 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

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

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

23 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

24 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

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?? Single-agent?? AI Slides (4e) c Lin Zuoquan@PKU

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?? AI Slides (4e) c Lin Zuoquan@PKU

27 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

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

29 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

30 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

31 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

32 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

33 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

34 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

35 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

36 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

37 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

38 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

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

Intelligent agents. As seen from Russell & Norvig perspective. Slides from Russell & Norvig book, revised by Andrea Roli Intelligent agents As seen from Russell & Norvig perspective Slides from Russell & Norvig book, revised by Andrea Roli Outline Agents and environments Rationality PEAS (Performance measure, Environment,

More information

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

Outline. Intelligent agents. Vacuum-cleaner world. Agents and environments Outline Intelligent agents As seen from Russell & Norvig perspective Slides from Russell & Norvig book, revised by Andrea Roli s and environments Rationality PEAS (Performance measure,,, ) types s and

More information

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

9/7/2015. Outline for today s lecture. Problem Solving Agents & Problem Formulation. Task environments Problem Solving Agents & Problem Formulation Defining Task Environments (AIMA 2.3) Environment types Formulating Search Problems Search Fundamentals AIMA 2.3, 3.1-3 2 3 Task environments To design a rational

More information

Introduction to Intelligent Agents

Introduction to Intelligent Agents Introduction to Intelligent Agents Pınar Yolum p.yolum@uu.nl Utrecht University Course Information Jointly taught with Mehdi Dastani Topics Work Schedule Grading Resources Academic Integrity Spring 2018

More information

Potential Midterm Exam Questions

Potential Midterm Exam Questions Potential Midterm Exam Questions 1. What are the four ways in which AI is usually viewed? Which of the four is the preferred view of the authors of our textbook? 2. What does each of the lettered items

More information

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

what is an algorithm? analysis of algorithms classic algorithm example: search event-driven programming algorithms event-driven programming conditional execution robots and agents resources: cc3.12/cis1.0 computing: nature, power and limits robotics applications fall 2007 lecture

More information

CS 151: Intelligent Agents, Problem Formulation and Search

CS 151: Intelligent Agents, Problem Formulation and Search CS 151: Intelligent Agents, Problem Formulation and Search How do we make a computer "smart?" Computer, clean the house! Um OK?? This one's got no chance How do we represent this problem? Hmmm where to

More information

PEAS: Medical diagnosis system

PEAS: Medical diagnosis system PEAS: Medical diagnosis system Performance measure Patient health, cost, reputation Environment Patients, medical staff, insurers, courts Actuators Screen display, email Sensors Keyboard/mouse Environment

More information

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

The following are just some of the many possible definitions that can be written: 2.1 Define in your own words the following terms: agent, agent function, agent program, rationality, autonomy, reflex agent, model-based agent, goal-based agent, utility-based agent, learning agent. The

More information

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

Lambda Calculus and Lambda notation in Lisp II. Based on Prof. Gotshalks notes on Lambda Calculus and Chapter 9 in Wilensky. λ Calculus Basis Lambda Calculus and Lambda notation in Lisp II Based on Prof. Gotshalks notes on Lambda Calculus and Chapter 9 in Wilensky Mathematical theory for anonymous functions» functions that have

More information

Discussion Section. Matthew Tong

Discussion Section. Matthew Tong Discussion Section Matthew Tong HW #1 1) Define Intelligence AI Agent 2) Intractable/unsolvable => no AI Big difference between the two Intractable leads open possibility of better machines or algorithms

More information

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

Partially Observable Markov Decision Processes. Mausam (slides by Dieter Fox) Partially Observable Markov Decision Processes Mausam (slides by Dieter Fox) Stochastic Planning: MDPs Static Environment Fully Observable Perfect What action next? Stochastic Instantaneous Percepts Actions

More information

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

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Common Lisp Fundamentals INF4820: Algorithms for Artificial Intelligence and Natural Language Processing Common Lisp Fundamentals Stephan Oepen & Murhaf Fares Language Technology Group (LTG) August 30, 2017 Last Week: What is

More information

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

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

More information

Artificial Intelligence Lecture 6

Artificial Intelligence Lecture 6 Artificial Intelligence Lecture 6 Lecture plan AI in general (ch. 1) Search based AI (ch. 4) search, games, planning, optimization (ch. 8) applied AI techniques in robots, software agents,... Knowledge

More information

521495A: Artificial Intelligence

521495A: Artificial Intelligence 521495A: Artificial Intelligence Search Lectured by Abdenour Hadid Associate Professor, CMVS, University of Oulu Slides adopted from http://ai.berkeley.edu Agent An agent is an entity that perceives the

More information

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

(defvar *state* nil The current state: a list of conditions.) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; GPS engine for blocks world ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar *dbg-ids* nil "Identifiers used by dbg") (defvar *state* nil "The current state: a list of conditions.")

More information

FP Foundations, Scheme

FP Foundations, Scheme FP Foundations, Scheme In Text: Chapter 15 1 Functional Programming -- Prelude We have been discussing imperative languages C/C++, Java, Fortran, Pascal etc. are imperative languages Imperative languages

More information

Programming Language Concepts, cs2104 Lecture 01 ( )

Programming Language Concepts, cs2104 Lecture 01 ( ) Programming Language Concepts, cs2104 Lecture 01 (2003-08-15) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2002-08-15 S. Haridi, CS2104, L01 (slides: C. Schulte, S. Haridi) 1

More information

Lisp Basic Example Test Questions

Lisp Basic Example Test Questions 2009 November 30 Lisp Basic Example Test Questions 1. Assume the following forms have been typed into the interpreter and evaluated in the given sequence. ( defun a ( y ) ( reverse y ) ) ( setq a (1 2

More information

Lecture Notes on Lisp A Brief Introduction

Lecture Notes on Lisp A Brief Introduction Why Lisp? Lecture Notes on Lisp A Brief Introduction Because it s the most widely used AI programming language Because Prof Peng likes using it Because it s good for writing production software (Graham

More information

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

Announcement. Overview. LISP: A Quick Overview. Outline of Writing and Running Lisp. Overview Announcement Announcement Lisp Basics CMUCL to be available on sun.cs. You may use GNU Common List (GCL http://www.gnu.org/software/gcl/ which is available on most Linux platforms. There is also

More information

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

Fifth Generation CS 4100 LISP. What do we need? Example LISP Program 11/13/13. Chapter 9: List Processing: LISP. Central Idea: Function Application Fifth Generation CS 4100 LISP From Principles of Programming Languages: Design, Evaluation, and Implementation (Third Edition, by Bruce J. MacLennan, Chapters 9, 10, 11, and based on slides by Istvan Jonyer

More information

1. Problem Representation

1. Problem Representation Answer Key CSci 5511 Artificial Intelligence 1 October 7, 2008 Exam 1 1. Problem Representation 20 points [graded by baylor] Consider the following problem: you are given a path of N white and black squares.

More information

Imperative languages

Imperative languages Imperative languages Von Neumann model: store with addressable locations machine code: effect achieved by changing contents of store locations instructions executed in sequence, flow of control altered

More information

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

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018 DIT411/TIN175, Artificial Intelligence Chapter 3: Classical search algorithms CHAPTER 3: CLASSICAL SEARCH ALGORITHMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 19 January, 2018 1 DEADLINE FOR

More information

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

Fall 2017 Discussion 7: October 25, 2017 Solutions. 1 Introduction. 2 Primitives CS 6A Scheme Fall 207 Discussion 7: October 25, 207 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write

More information

CS 520: Introduction to Artificial Intelligence. Review

CS 520: Introduction to Artificial Intelligence. Review CS 520: Introduction to Artificial Intelligence Prof. Louis Steinberg Lecture 2: state spaces uninformed search 1 What is AI? A set of goals Review build an artificial intelligence useful subgoals A class

More information

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

bindings (review) Topic 18 Environment Model of Evaluation bindings (review) frames (review) frames (review) frames (review) x: 10 y: #f x: 10 Topic 18 Environment Model of Evaluation Section 3.2 bindings (review) a binding is an association between a name and a Scheme value names: variable names, procedure names formal parameters of procedures

More information

Beyond Classical Search

Beyond Classical Search Beyond Classical Search Chapter 3 covered problems that considered the whole search space and produced a sequence of actions leading to a goal. Chapter 4 covers techniques (some developed outside of AI)

More information

Lambda Calculus. Gunnar Gotshalks LC-1

Lambda Calculus. Gunnar Gotshalks LC-1 Lambda Calculus LC-1 l- Calculus History Developed by Alonzo Church during 1930 s-40 s One fundamental goal was to describe what can be computed. Full definition of l-calculus is equivalent in power to

More information

Common LISP Tutorial 1 (Basic)

Common LISP Tutorial 1 (Basic) Common LISP Tutorial 1 (Basic) CLISP Download https://sourceforge.net/projects/clisp/ IPPL Course Materials (UST sir only) Download https://silp.iiita.ac.in/wordpress/?page_id=494 Introduction Lisp (1958)

More information

John McCarthy IBM 704

John McCarthy IBM 704 How this course works SI 334: Principles of Programming Languages Lecture 2: Lisp Instructor: an arowy Lots of new languages Not enough class time to cover all features (e.g., Java over the course of 34-36:

More information

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

Topics in AI (CPSC 532L): Multimodal Learning with Vision, Language and Sound. Lecture 12: Deep Reinforcement Learning Topics in AI (CPSC 532L): Multimodal Learning with Vision, Language and Sound Lecture 12: Deep Reinforcement Learning Types of Learning Supervised training Learning from the teacher Training data includes

More information

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

Experiment 4.A. Speed and Position Control. ECEN 2270 Electronics Design Laboratory 1 .A Speed and Position Control Electronics Design Laboratory 1 Procedures 4.A.0 4.A.1 4.A.2 4.A.3 4.A.4 Turn in your Pre-Lab before doing anything else Speed controller for second wheel Test Arduino Connect

More information

AGENTS AND ENVIRONMENTS. What is AI in reality?

AGENTS AND ENVIRONMENTS. What is AI in reality? AGENTS AND ENVIRONMENTS What is AI in reality? AI is our attempt to create a machine that thinks (or acts) humanly (or rationally) Think like a human Cognitive Modeling Think rationally Logic-based Systems

More information

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

Last update: May 6, Robotics. CMSC 421: Chapter 25. CMSC 421: Chapter 25 1 Last update: May 6, 2010 Robotics CMSC 421: Chapter 25 CMSC 421: Chapter 25 1 A machine to perform tasks What is a robot? Some level of autonomy and flexibility, in some type of environment Sensory-motor

More information

Lecture #24: Programming Languages and Programs

Lecture #24: Programming Languages and Programs Lecture #24: Programming Languages and Programs A programming language is a notation for describing computations or processes. These range from low-level notations, such as machine language or simple hardware

More information

Programming Concepts

Programming Concepts CNM STEMulus Center Web Development with PHP November 11, 2015 1/8 Outline 1 2 How Do We Use It? How Do We Write Better Code? How Should I Act? 2/8 What are we training to be? Software Engineer: one who

More information

Solving Problems by Searching. AIMA Sections , 3.6

Solving Problems by Searching. AIMA Sections , 3.6 AIMA Sections 3.1 3.3, 3.6 Outline Problem-solving agents Problem types Problem formulation Example problems General search algorithm Problem-solving agents function Simple-Problem--Agent( percept) returns

More information

SOFTWARE ARCHITECTURE 6. LISP

SOFTWARE ARCHITECTURE 6. LISP 1 SOFTWARE ARCHITECTURE 6. LISP Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/ 2 Compiler vs Interpreter Compiler Translate programs into machine languages Compilers are

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches ITCS 6150 Intelligent Systems Lecture 3 Uninformed Searches Outline Problem Solving Agents Restricted form of general agent Problem Types Fully vs. partially observable, deterministic vs. stochastic Problem

More information

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

Department of Computer and information Science Norwegian University of Science and Technology Department of Computer and information Science Norwegian University of Science and Technology http://www.idi.ntnu.no/ A Crash Course in LISP MNFIT272 2002 Anders Kofod-Petersen anderpe@idi.ntnu.no Introduction

More information

Chapter 1. Fundamentals of Higher Order Programming

Chapter 1. Fundamentals of Higher Order Programming Chapter 1 Fundamentals of Higher Order Programming 1 The Elements of Programming Any powerful language features: so does Scheme primitive data procedures combinations abstraction We will see that Scheme

More information

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

CSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc. CSC312 Principles of Programming Languages : Functional Programming Language Overview of Functional Languages They emerged in the 1960 s with Lisp Functional programming mirrors mathematical functions:

More information

Markov Decision Processes and Reinforcement Learning

Markov Decision Processes and Reinforcement Learning Lecture 14 and Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Slides by Stuart Russell and Peter Norvig Course Overview Introduction Artificial Intelligence

More information

Functional Programming. Pure Functional Languages

Functional Programming. Pure Functional Languages Functional Programming Pure functional PLs S-expressions cons, car, cdr Defining functions read-eval-print loop of Lisp interpreter Examples of recursive functions Shallow, deep Equality testing 1 Pure

More information

Seminar in Programming Languages

Seminar in Programming Languages Seminar in Programming Languages Shuly Wintner Fall 2010-11 Course web site: http://cs.haifa.ac.il/~shuly/teaching/10/plseminar/ Course Goals Programming Language Concepts A language is a conceptual universe

More information

Chapter 3 Solving problems by searching

Chapter 3 Solving problems by searching 1 Chapter 3 Solving problems by searching CS 461 Artificial Intelligence Pinar Duygulu Bilkent University, Slides are mostly adapted from AIMA and MIT Open Courseware 2 Introduction Simple-reflex agents

More information

Functional Programming Languages (FPL)

Functional Programming Languages (FPL) Functional Programming Languages (FPL) 1. Definitions... 2 2. Applications... 2 3. Examples... 3 4. FPL Characteristics:... 3 5. Lambda calculus (LC)... 4 6. Functions in FPLs... 7 7. Modern functional

More information

MIDTERM EXAMINATION - CS130 - Spring 2005

MIDTERM EXAMINATION - CS130 - Spring 2005 MIDTERM EAMINATION - CS130 - Spring 2005 Your full name: Your UCSD ID number: This exam is closed book and closed notes Total number of points in this exam: 231 + 25 extra credit This exam counts for 25%

More information

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

Spring 2018 Discussion 7: March 21, Introduction. 2 Primitives CS 61A Scheme Spring 2018 Discussion 7: March 21, 2018 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme

More information

Introduction to Functional Programming and basic Lisp

Introduction to Functional Programming and basic Lisp Introduction to Functional Programming and basic Lisp Based on Slides by Yves Lespérance & Peter Roosen-Runge 1 Functional vs Declarative Programming declarative programming uses logical statements to

More information

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

Homework #2. If (your ID number s last two digits % 6) = 0: 6, 12, 18 2005/Sep/19 1 Homework #2 Chapter 1: Exercises 7, 9 with modifications: for Exercise 7.a: 20 and 32 are changed as your ID number s last two digits and 60. for Exercise 9: 47x25 are change as 47x(your

More information

CS 320: Concepts of Programming Languages

CS 320: Concepts of Programming Languages CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 04: Basic Haskell Continued o Polymorphic Types o Type Inference with Polymorphism o Standard

More information

15 Unification and Embedded Languages in Lisp

15 Unification and Embedded Languages in Lisp 15 Unification and Embedded Languages in Lisp Chapter Objectives Chapter Contents Pattern matching in Lisp: Database examples Full unification as required for Predicate Calculus problem solving Needed

More information

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Modern Programming Languages. Lecture LISP Programming Language An Introduction Modern Programming Languages Lecture 18-21 LISP Programming Language An Introduction 72 Functional Programming Paradigm and LISP Functional programming is a style of programming that emphasizes the evaluation

More information

Robotics. CSPP Artificial Intelligence March 10, 2004

Robotics. CSPP Artificial Intelligence March 10, 2004 Robotics CSPP 56553 Artificial Intelligence March 10, 2004 Roadmap Robotics is AI-complete Integration of many AI techniques Classic AI Search in configuration space (Ultra) Modern AI Subsumption architecture

More information

Functions, Conditionals & Predicates

Functions, Conditionals & Predicates Functions, Conditionals & Predicates York University Department of Computer Science and Engineering 1 Overview Functions as lambda terms Defining functions Variables (bound vs. free, local vs. global)

More information

Introduction to Fall 2014 Artificial Intelligence Midterm Solutions

Introduction to Fall 2014 Artificial Intelligence Midterm Solutions CS Introduction to Fall Artificial Intelligence Midterm Solutions INSTRUCTIONS You have minutes. The exam is closed book, closed notes except a one-page crib sheet. Please use non-programmable calculators

More information

Beyond Classical Search

Beyond Classical Search Beyond Classical Search Chapter 3 covered problems that considered the whole search space and produced a sequence of actions leading to a goal. Chapter 4 covers techniques (some developed outside of AI)

More information

Basics of Using Lisp! Gunnar Gotshalks! BLU-1

Basics of Using Lisp! Gunnar Gotshalks! BLU-1 Basics of Using Lisp BLU-1 Entering Do Lisp work Exiting Getting into and out of Clisp % clisp (bye)» A function with no arguments» CTRL d can also be used Documentation files are in the directory» /cse/local/doc/clisp

More information

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

ARTIFICIAL INTELLIGENCE (CSC9YE ) LECTURES 2 AND 3: PROBLEM SOLVING ARTIFICIAL INTELLIGENCE (CSC9YE ) LECTURES 2 AND 3: PROBLEM SOLVING BY SEARCH Gabriela Ochoa http://www.cs.stir.ac.uk/~goc/ OUTLINE Problem solving by searching Problem formulation Example problems Search

More information

Expressions and Assignment

Expressions and Assignment Expressions and Assignment COS 301: Programming Languages Outline Other assignment mechanisms Introduction Expressions: fundamental means of specifying computations Imperative languages: usually RHS of

More information

Lambda Calculus LC-1

Lambda Calculus LC-1 Lambda Calculus LC-1 λ- Calculus History-1 Developed by Alonzo Church during 1930 s-40 s One fundamental goal was to describe what can be computed. Full definition of λ-calculus is equivalent in power

More information

Artificial Intelligence Lecture 1

Artificial Intelligence Lecture 1 Artificial Intelligence Lecture 1 istrative Matters Webpage: www.aass.oru.se/~mbl/ai Examiner: Mathias Broxvall Assistant: Lia Susana d.c. Silva Lopez Schedule 20 hours/week on this course. 4 hours lectures,

More information

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

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017 Homework 1 Due 14 February Handout 3 CSCI 334: Spring, 2017 Notes This homework has three types of problems: Self Check: You are strongly encouraged to think about and work through these questions, but

More information

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

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University Functional Languages CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Historical Origins 2 The imperative and functional models grew out of work

More information

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

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 C S C 0 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 SECTION 1 PRO F. FRANZ J. KURFESS CAL POL Y, COMPUTER SCIENCE DE PARTMENT This is the midterm exam for the CSC 0 Artificial Intelligence

More information

Permission to copy The CAD Academy

Permission to copy The CAD Academy Use LISP to Program in A+CAD Permission to copy The CAD Academy We are going to create a small program in LISP, a language used in artificial intelligent programs, to interact with our CAD program A+CAD.

More information

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

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

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

Scheme. Functional Programming. Lambda Calculus. CSC 4101: Programming Languages 1. Textbook, Sections , 13.7 Scheme Textbook, Sections 13.1 13.3, 13.7 1 Functional Programming Based on mathematical functions Take argument, return value Only function call, no assignment Functions are first-class values E.g., functions

More information

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

Discrete-Event Simulation: A First Course. Steve Park and Larry Leemis College of William and Mary Discrete-Event Simulation: A First Course Steve Park and Larry Leemis College of William and Mary Technical Attractions of Simulation * Ability to compress time, expand time Ability to control sources

More information

Scheme: Expressions & Procedures

Scheme: Expressions & Procedures Scheme: Expressions & Procedures CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Friday, March 31, 2017 Glenn G. Chappell Department of Computer Science University

More information

CSE 40171: Artificial Intelligence. Uninformed Search: Search Spaces

CSE 40171: Artificial Intelligence. Uninformed Search: Search Spaces CSE 40171: Artificial Intelligence Uninformed Search: Search Spaces 1 Homework #1 has been released. It is due at 11:59PM on 9/10. 2 Course Roadmap Introduction Problem Solving Machine Learning (week 1)

More information

CIT 590 Homework 5 HTML Resumes

CIT 590 Homework 5 HTML Resumes CIT 590 Homework 5 HTML Resumes Purposes of this assignment Reading from and writing to files Scraping information from a text file Basic HTML usage General problem specification A website is made up of

More information

Solving Problems by Searching

Solving Problems by Searching Solving Problems by Searching Berlin Chen 2004 Reference: 1. S. Russell and P. Norvig. Artificial Intelligence: A Modern Approach. Chapter 3 1 Introduction Problem-Solving Agents vs. Reflex Agents Problem-solving

More information

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

Agent Design Example Problems State Spaces. Searching: Intro. CPSC 322 Search 1. Textbook Searching: Intro CPSC 322 Search 1, Slide 1 Searching: Intro CPSC 322 Search 1 Textbook 3.0 3.3 Searching: Intro CPSC 322 Search 1, Slide 1 Lecture Overview 1 Agent Design 2 Example Problems 3 State Spaces Searching: Intro CPSC 322 Search 1, Slide

More information

And Parallelism. Parallelism in Prolog. OR Parallelism

And Parallelism. Parallelism in Prolog. OR Parallelism Parallelism in Prolog And Parallelism One reason that Prolog is of interest to computer scientists is that its search mechanism lends itself to parallel evaluation. In fact, it supports two different kinds

More information

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

11/6/17. Functional programming. FP Foundations, Scheme (2) LISP Data Types. LISP Data Types. LISP Data Types. Scheme. LISP: John McCarthy 1958 MIT Functional programming FP Foundations, Scheme (2 In Text: Chapter 15 LISP: John McCarthy 1958 MIT List Processing => Symbolic Manipulation First functional programming language Every version after the

More information

A Genetic Algorithm Implementation

A Genetic Algorithm Implementation A Genetic Algorithm Implementation Roy M. Turner (rturner@maine.edu) Spring 2017 Contents 1 Introduction 3 2 Header information 3 3 Class definitions 3 3.1 Individual..........................................

More information

Functional Programming

Functional Programming Functional Programming CS331 Chapter 14 Functional Programming Original functional language is LISP LISt Processing The list is the fundamental data structure Developed by John McCarthy in the 60 s Used

More information

Heap storage. Dynamic allocation and stacks are generally incompatible.

Heap storage. Dynamic allocation and stacks are generally incompatible. Heap storage Dynamic allocation and stacks are generally incompatible. 1 Stack and heap location Pointer X points to stack storage in procedure Q's activation record that no longer is live (exists) when

More information

CS 188: Artificial Intelligence. Recap Search I

CS 188: Artificial Intelligence. Recap Search I CS 188: Artificial Intelligence Review of Search, CSPs, Games DISCLAIMER: It is insufficient to simply study these slides, they are merely meant as a quick refresher of the high-level ideas covered. You

More information

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

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents Class Overview COMP 3501 / COMP 4704-4 Lecture 2: Search Prof. 1 2 Problem Solving Agents Problem Solving Agents: Assumptions Requires a goal Assume world is: Requires actions Observable What actions?

More information

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

Fall 2018 Updates. Materials and Energy Balances. Fundamental Programming Concepts. Data Structure Essentials (Available now) Circuits (Algebra) Fall 2018 Updates Materials and Energy Balances New Sections Solver and least squares fits Error and statistics Interpolation 9.9 Integration and numerical integration 9.10 Math functions 9.11 Logical

More information

CPSC 3740 Programming Languages University of Lethbridge. Control Structures

CPSC 3740 Programming Languages University of Lethbridge. Control Structures Control Structures A control structure is a control statement and the collection of statements whose execution it controls. Common controls: selection iteration branching Control Structures 1 15 Howard

More information

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

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits. LISP Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits. From one perspective, sequences of bits can be interpreted as a code for ordinary decimal digits,

More information

Putting the fun in functional programming

Putting the fun in functional programming CM20167 Topic 4: Map, Lambda, Filter Guy McCusker 1W2.1 Outline 1 Introduction to higher-order functions 2 Map 3 Lambda 4 Filter Guy McCusker (1W2.1 CM20167 Topic 4 2 / 42 Putting the fun in functional

More information

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

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. More Common Lisp INF4820: Algorithms for Artificial Intelligence and Natural Language Processing More Common Lisp Stephan Oepen & Murhaf Fares Language Technology Group (LTG) September 6, 2017 Agenda 2 Previously Common

More information

Problem Solving and Searching

Problem Solving and Searching Problem Solving and Searching CS 171/ 271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig s published material 1 Problem Solving Agent Function 2 Problem Solving Agent

More information

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

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur Module 6 Knowledge Representation and Logic (First Order Logic) 6.1 Instructional Objective Students should understand the advantages of first order logic as a knowledge representation language Students

More information

Programming Languages 2nd edition Tucker and Noonan"

Programming Languages 2nd edition Tucker and Noonan Programming Languages 2nd edition Tucker and Noonan" " Chapter 1" Overview" " A good programming language is a conceptual universe for thinking about programming. " " " " " " " " " " " " "A. Perlis" "

More information

Midterm Examination (Sample Solutions), Cmput 325

Midterm Examination (Sample Solutions), Cmput 325 Midterm Examination (Sample Solutions, Cmput 325 [15 marks] Consider the Lisp definitions below (defun test (L S (if (null L S (let ((New (add (cdar L S (test (cdr L New (defun add (A S (if (null S (cons

More information

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

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G. Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

More information

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

CS 480. Lisp J. Kosecka George Mason University. Lisp Slides CS 480 Lisp J. Kosecka George Mason University Lisp Slides Symbolic Programming Symbols: +, -, 1, 2 etc. Symbolic expressions: (+ 1 2), (+ (* 3 4) 2) Symbolic programs are programs that manipulate symbolic

More information

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

Symbolic Programming. Dr. Zoran Duric () Symbolic Programming 1/ 89 August 28, / 89 Symbolic Programming Symbols: +, -, 1, 2 etc. Symbolic expressions: (+ 1 2), (+ (* 3 4) 2) Symbolic programs are programs that manipulate symbolic expressions. Symbolic manipulation: you do it all the

More information

Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems (CSPs) Constraint Satisfaction Problems (CSPs) CPSC 322 CSP 1 Poole & Mackworth textbook: Sections 4.0-4.2 Lecturer: Alan Mackworth September 28, 2012 Problem Type Static Sequential Constraint Satisfaction Logic

More information

Artificial Intelligence Lecture 1

Artificial Intelligence Lecture 1 Artificial Intelligence Lecture 1 istrative Matters Webpage: www.aass.oru.se/~ali/ai2008 Teacher: Amy Loutfi Hours: Fridays 10 12 Lab Assistant: Marcello Cirillo 2 istrative Matters Course book: Alison

More information