Unit-1 INTRODUCTION
Dec 27, 2015
Unit-1
INTRODUCTION
Foundations of Artificial Intelligence 2
Intelligent Agents – Agents and environments Good behavior – The nature of environments Structure of agents Problem solving agents Example problems Searching for solutions Uninformed search strategies Avoiding repeated states – searching with partial
information.
Introduction to AI andIntelligent Agents
Foundations of Artificial Intelligence 4
Some Definitions of AI
Building systems that think like humans “The exciting new effort to make computers think … machines with minds, in
the full and literal sense” -- Haugeland, 1985 “The automation of activities that we associate with human thinking, … such
as decision-making, problem solving, learning, …” -- Bellman, 1978
Building systems that act like humans “The art of creating machines that perform functions that require intelligence
when performed by people” -- Kurzweil, 1990 “The study of how to make computers do things at which, at the moment,
people are better” -- Rich and Knight, 1991
Foundations of Artificial Intelligence 5
Some Definitions of AI
Building systems that think rationally “The study of mental faculties through the use of computational models”
-- Charniak and McDermott, 1985 “The study of the computations that make it possible to perceive, reason, and
act” -- Winston, 1992
Building systems that act rationally “A filed of study that seeks to explain and emulate intelligent behavior in terms
of computational processes” -- Schalkoff, 1990 “The branch of computer science that is concerned with the automation of
intelligent behavior” -- Luger and Stubblefield, 1993
Foundations of Artificial Intelligence 6
Rationality
Acting humanly: The Turing test approach requirement for Turing test.
Two persons and one machine.
1. Interrogator (questioner)
2. B (a person)
3. A (a machine)
Turing’s “Imitation Game”
Interrogator B (a person) A (a machine)
Foundations of Artificial Intelligence 8
Capabilities of computer
Natural language processing
To enable it to communicate successfully in english Knowledge representation
To store what it knows or receives Automated reasoning
To use the stored information to answer questions and to draw new conclusions.
Machine learning
To adapt to new circumstances.
Foundations of Artificial Intelligence 9
Total Turing test
It avoid physical interaction between questioner and computer because physical stimulation is unnecessary for intelligence.
To pass total turing test the computer will need:
a. Computer vision : To perceive objects.
b. Robotics : To manipulate and move them.
Foundations of Artificial Intelligence 10
Thinking humanly: cognitive modeling
Develop a precise theory of mind, through experimentation and introspection, then write a computer program that implements it
Example: GPS - General Problem Solver (Newell and Simon, 1961) trying to model the human process of problem solving in general
Foundations of Artificial Intelligence 11
Thinking and Acting Rationally Thinking Rationally
Capture ``correct'' reasoning processes” A loose definition of rational thinking: Irrefutable reasoning process How do we do this
Develop a formal model of reasoning (formal logic) that “always” leads to the “right” answer Implement this model
How do we know when we've got it right? when we can prove that the results of the programmed reasoning are correct soundness and completeness of first-order logic
Acting Rationally Act so that desired goals are achieved The rational agent approach (this is what we’ll focus on in this course) Figure out how to make correct decisions, which sometimes means thinking rationally
and other times means having rational reflexes correct inference versus rationality reasoning versus acting; limited rationality
Foundations of Artificial Intelligence 12
AI in Everyday Life? AI techniques are used in many common applications
Intelligent user interfaces Search Engines Spell/grammar checkers Context sensitive help systems Medical diagnosis systems Regulating/Controlling hardware devices and processes (e.g, in automobiles) Voice/image recognition (more generally, pattern recognition) Scheduling systems (airlines, hotels, manufacturing) Error detection/correction in electronic communication Program verification / compiler and programming language design Web search engines / Web spiders Web personalization and Recommender systems (collaborative/content filtering) Personal agents Customer relationship management Credit card verification in e-commerce / fraud detection Data mining and knowledge discovery in databases Computer games
Foundations of Artificial Intelligence 13
AI Spin-Offs Many technologies widely used today were the direct or indirect
results of research in AI: The mouse Time-sharing Graphical user interfaces Object-oriented programming Computer games Hypertext Information Retrieval The World Wide Web Symbolic mathematical systems (e.g., Mathematica, Maple, etc.) Very high-level programming languages Web agents Data Mining
Foundations of Artificial Intelligence 14
What is an Intelligent Agent An agent is anything that can
perceive its environment through sensors, and act upon that environment through actuators (or effectors)
Goal: Design rational agents that do a “good job” of acting in their environments success determined based on some objective performance measure
actuators
Foundations of Artificial Intelligence 15
Example: Vacuum Cleaner Agent
Percepts: location and contents, e.g., [A, Dirty] Actions: Left, Right, Suck, NoOp
Foundations of Artificial Intelligence 16
What is an Intelligent Agent Rational Agents
An agent should strive to "do the right thing", based on what it can perceive and the actions it can perform. The right action is the one that will cause the agent to be most successful.
Performance measure: An objective criterion for success of an agent's behavior. E.g., performance measure of a vacuum-cleaner agent could be amount of dirt cleaned up,
amount of time taken, amount of electricity consumed, amount of noise generated, etc.
Definition of Rational Agent: For each possible percept sequence, a rational agent should select an action that is
expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in knowledge the agent has.
Omniscience, learning, autonomy Rationality is distinct from omniscience (all-knowing with infinite knowledge)
Choose action that maximizes expected value of perf. measure given percept to date
Agents can perform actions in order to modify future percepts so as to obtain useful information (information gathering, exploration)
An agent is autonomous if its behavior is determined by its own experience (with ability to learn and adapt)
Foundations of Artificial Intelligence 17
What is an Intelligent Agent Rationality depends on
the performance measure that defines degree of success the percept sequence - everything the agent has perceived so far what the agent know about its environment the actions that the agent can perform
Agent Function (percepts ==> actions) Maps from percept histories to actions f: P* A The agent program runs on the physical architecture to produce the function f agent = architecture + program
Action := Function(Percept Sequence)
If (Percept Sequence) then do Action
Example: A Simple Agent Function for Vacuum World
If (current square is dirty) then suck
Else move to adjacent square
Foundations of Artificial Intelligence 18
What is an Intelligent Agent Limited Rationality
Optimal (i.e. best possible) rationality is NOT perfect success: limited sensors, actuators, and computing power may make this impossible
Theory of NP-completeness: some problems are likely impossible to solve quickly on ANY computer
Both natural and artificial intelligence are always limited Degree of Rationality: the degree to which the agent’s internal "thinking"
maximizes its performance measure, given the available sensors the available actuators the available computing power the available built-in knowledge
Foundations of Artificial Intelligence 19
PEAS Analysis To design a rational agent, we must specify the task environment
PEAS Analysis: Specify Performance Measure, Environment, Actuators, Sensors
Example: Consider the task of designing an automated taxi driver Performance measure: Safe, fast, legal, comfortable trip, maximize profits Environment: Roads, other traffic, pedestrians, customers Actuators: Steering wheel, accelerator, brake, signal, horn Sensors: Cameras, sonar, speedometer, GPS, odometer, engine sensors, keyboard
Foundations of Artificial Intelligence 20
PEAS Analysis – More Examples Agent: Medical diagnosis system
Performance measure: Healthy patient, minimize costs, lawsuits Environment: Patient, hospital, staff Actuators: Screen display (questions, tests, diagnoses, treatments, referrals) Sensors: Keyboard (entry of symptoms, findings, patient's answers)
Agent: Part-picking robot Performance measure: Percentage of parts in correct bins Environment: Conveyor belt with parts, bins Actuators: Jointed arm and hand Sensors: Camera, joint angle sensors
Foundations of Artificial Intelligence 21
PEAS Analysis – More Examples
Agent: Internet Shopping Agent
Performance measure?? Environment?? Actuators?? Sensors??
Foundations of Artificial Intelligence 22
Environment Types
Fully observable (vs. partially observable): An agent's sensors give it access to the complete state of the environment at
each point in time.
Deterministic (vs. stochastic): The next state of the environment is completely determined by the current state
and the action executed by the agent. (If the environment is deterministic except for the actions of other agents, then the environment is strategic).
Episodic (vs. sequential): The agent's experience is divided into atomic "episodes" (each episode consists
of the agent perceiving and then performing a single action), and the choice of action in each episode depends only on the episode itself.
Foundations of Artificial Intelligence 23
Environment Types (cont.)
Static (vs. dynamic): The environment is unchanged while an agent is deliberating (the environment
is semi-dynamic if the environment itself does not change with the passage of time but the agent's performance score does).
Discrete (vs. continuous): A limited number of distinct, clearly defined percepts and actions.
Single agent (vs. multi-agent): An agent operating by itself in an environment.
Foundations of Artificial Intelligence 24
Environment Types (cont.)
The environment type largely determines the agent design.
The real world is (of course) partially observable, stochastic, sequential, dynamic, continuous, multi-agent
Foundations of Artificial Intelligence 25
Structure of an Intelligent Agent All agents have the same basic structure:
accept percepts from environment generate actions
A Skeleton Agent:
Observations: agent may or may not build percept sequence in memory (depends on domain) performance measure is not part of the agent; it is applied externally to judge
the success of the agent
function Skeleton-Agent(percept) returns action static: 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
function Skeleton-Agent(percept) returns action static: 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
Foundations of Artificial Intelligence 26
Looking Up the Answer? A Template for a Table-Driven Agent:
Why can't we just look up the answers? The disadvantages of this architecture
infeasibility (excessive size) lack of adaptiveness
How big would the table have to be? Could the agent ever learn from its mistakes? Where should the table come from in the first place?
function Table-Driven-Agent(percept) returns action static: percepts, a sequence, initially empty table, a table indexed by percept sequences, initially fully specified
append percept to the end of percepts action LookUp(percepts, table)return action
function Table-Driven-Agent(percept) returns action static: percepts, a sequence, initially empty table, a table indexed by percept sequences, initially fully specified
append percept to the end of percepts action LookUp(percepts, table)return action
Foundations of Artificial Intelligence 27
Agent Types Simple reflex agents
are based on condition-action rules and implemented with an appropriate production system. They are stateless devices which do not have memory of past world states.
Reflex Agents with memory (Model-Based) have internal state which is used to keep track of past states of the world.
Agents with goals are agents which in addition to state information have a kind of goal
information which describes desirable situations. Agents of this kind take future events into consideration.
Utility-based agents base their decision on classic axiomatic utility-theory in order to act rationally.
Note: All of these can be turned into “learning” agentsNote: All of these can be turned into “learning” agents
Foundations of Artificial Intelligence 28
A Simple Reflex Agent
function Simple-Reflex-Agent(percept) returns action static: rules, a set of condition-action rules
state Interpret-Input(percept) rule Rule-Match(state, rules) action Rule-Action[rule] return action
function Simple-Reflex-Agent(percept) returns action static: rules, a set of condition-action rules
state Interpret-Input(percept) rule Rule-Match(state, rules) action Rule-Action[rule] return action
We can summarize part of the table by formulating commonly occurring patterns as condition-action rules:
Example:
if car-in-front-brakes
then initiate braking Agent works by finding a
rule whose condition matches the current situation rule-based systems
But, this only works if the current percept is sufficient for making the correct decision
Foundations of Artificial Intelligence 29
Example: Simple Reflex Vacuum Agent
Foundations of Artificial Intelligence 30
Agents that Keep Track of the World
function Reflex-Agent-With-State(percept) returns action static: rules, a set of condition-action rules state, a description of the current world
state Update-State(state, percept) rule Rule-Match(state, rules) action Rule-Action[rule] state Update-State(state, action) return action
function Reflex-Agent-With-State(percept) returns action static: rules, a set of condition-action rules state, a description of the current world
state Update-State(state, percept) rule Rule-Match(state, rules) action Rule-Action[rule] state Update-State(state, action) return action
Updating internal state requires two kinds of encoded knowledge knowledge about how the world
changes (independent of the agents’ actions)
knowledge about how the agents’ actions affect the world
But, knowledge of the internal state is not always enough how to choose among
alternative decision paths (e.g., where should the car go at an intersection)?
Requires knowledge of the goal to be achieved
Foundations of Artificial Intelligence 31
Agents with Explicit Goals
Reasoning about actions reflex agents only act based on pre-computed knowledge (rules) goal-based (planning) act by reasoning about which actions achieve the
goal less efficient, but more adaptive and flexible
Foundations of Artificial Intelligence 32
Agents with Explicit Goals Knowing current state is not always enough.
State allows an agent to keep track of unseen parts of the world, but the agent must update state based on knowledge of changes in the world and of effects of own actions.
Goal = description of desired situation
Examples: Decision to change lanes depends on a goal to go somewhere (and other factors); Decision to put an item in shopping basket depends on a shopping list, map of
store, knowledge of menu
Notes: Search (Russell Chapters 3-5) and Planning (Chapters 11-13) are concerned with
finding sequences of actions to satisfy a goal. Reflexive agent concerned with one action at a time. Classical Planning: finding a sequence of actions that achieves a goal. Contrast with condition-action rules: involves consideration of future "what will
happen if I do ..." (fundamental difference).
Foundations of Artificial Intelligence 33
A Complete Utility-Based Agent
Utility Function a mapping of states onto real numbers allows rational decisions in two kinds of situations
evaluation of the tradeoffs among conflicting goals evaluation of competing goals
Foundations of Artificial Intelligence 34
Utility-Based Agents (Cont.) Preferred world state has higher utility for agent = quality of
being useful
Examples quicker, safer, more reliable ways to get where going; price comparison shopping bidding on items in an auction evaluating bids in an auction
Utility function: state ==> U(state) = measure of happiness
Search (goal-based) vs. games (utilities).
Foundations of Artificial Intelligence 35
Shopping Agent Example Navigating: Move around store; avoid obstacles
Reflex agent: store map precompiled. Goal-based agent: create an internal map, reason explicitly about it, use signs
and adapt to changes (e.g., specials at the ends of aisles).
Gathering: Find and put into cart groceries it wants, need to induce objects from percepts. Reflex agent: wander and grab items that look good. Goal-based agent: shopping list.
Menu-planning: Generate shopping list, modify list if store is out of some item. Goal-based agent: required; what happens when a needed item is not there?
Achieve the goal some other way. e.g., no milk cartons: get canned milk or powdered milk.
Choosing among alternative brands utility-based agent: trade off quality for price.
Foundations of Artificial Intelligence 36
General Architecture for Goal-Based Agents
Simple agents do not have access to their own performance measure In this case the designer will "hard wire" a goal for the agent, i.e. the designer will choose
the goal and build it into the agent
Similarly, unintelligent agents cannot formulate their own problem this formulation must be built-in also
The while loop above is the "execution phase" of this agent's behavior Note that this architecture assumes that the execution phase does not require
monitoring of the environment
Input perceptstate Update-State(state, percept)goal Formulate-Goal(state, perf-measure)search-space Formulate-Problem (state, goal)plan Search(search-space , goal)while (plan not empty) do action Recommendation(plan, state) plan Remainder(plan, state) output actionend
Input perceptstate Update-State(state, percept)goal Formulate-Goal(state, perf-measure)search-space Formulate-Problem (state, goal)plan Search(search-space , goal)while (plan not empty) do action Recommendation(plan, state) plan Remainder(plan, state) output actionend
Foundations of Artificial Intelligence 37
Learning Agents
Four main components: Performance element: the agent function Learning element: responsible for making improvements by observing performance Critic: gives feedback to learning element by measuring agent’s performance Problem generator: suggest other possible courses of actions (exploration)
Foundations of Artificial Intelligence 38
Search and Knowledge Representation
Goal-based and utility-based agents require representation of: states within the environment actions and effects (effect of an action is transition from the current state to
another state) goals utilities
Problems can often be formulated as a search problem to satisfy a goal, agent must find a sequence of actions (a path in the state-
space graph) from the starting state to a goal state.
To do this efficiently, agents must have the ability to reason with their knowledge about the world and the problem domain which path to follow (which action to choose from) next how to determine if a goal state is reached OR how decide if a satisfactory
state has been reached.
Foundations of Artificial Intelligence 39
Intelligent Agent Summary An agent perceives and acts in an environment. It has an
architecture and is implemented by a program. An ideal agent always chooses the action which maximizes its
expected performance, given the percept sequence received so far.
An autonomous agent uses its own experience rather than built-in knowledge of the environment by the designer.
An agent program maps from a percept to an action and updates its internal state.
Reflex agents respond immediately to percepts. Goal-based agents act in order to achieve their goal(s). Utility-based agents maximize their own utility function.
Foundations of Artificial Intelligence 40
Exercise
Do Exercise 1.3, on Page 30 You can find out about the Loebner Prize at:
http://www.loebner.net/Prizef/loebner-prize.html
Also (for discussion) look at exercise 1.2 and read the material on the Turing Test at:
http://plato.stanford.edu/entries/turing-test/
Read the article by Jennings and Wooldridge (“Applications of Intelligent Agents”). Compare and contrast the definitions of agents and intelligent agents as given by Russell and Norvig (in the text book) and and in the article.
Foundations of Artificial Intelligence 41
Exercise
News Filtering Internet Agent uses a static user profile (e.g., a set of keywords specified by the user) on a regular basis, searches a specified news site (e.g., Reuters or AP) for news
stories that match the user profile can search through the site by following links from page to page presents a set of links to the matching stories that have not been read before
(matching based on the number of words from the profile occurring in the news story)
(1) Give a detailed PEAS description for the news filtering agent (2) Characterize the environment type (as being observable,
deterministic, episodic, static, etc).