Docsity

Introduction to Intelligent Agents: Perception, Action, and Search Algorithms, Lecture notes of Artificial Intelligence

Toggle sidebar
bg1
1
ARTIFICIAL INTELLIGENCE (AI)
1.1 Definition of AI
Artificial Intelligence is a branch of Science which deals with helping machines find solutions to
complex problems in a more human-like fashion. This generally involves borrowing characteristics
from human intelligence, and applying them as algorithms in a computer friendly way. A more or less
flexible or efficient approach can be taken depending on the requirements established, which
influences how artificial the intelligent behaviour appears.
AI is generally associated with Computer Science, but it has many important links with other fields
such as Mathematics, Psychology, Cognition, Biology and Philosophy, among many others. Our
ability to combine knowledge from all these fields will ultimately benefit our
progress in the quest of creating an intelligent artificial being . It is also concerned with the design of
intelligence in an artificial device.
The term was coined by McCarthy in 1956. There are two ideas in the
definition.
1. Intelligence
2. Artificial device
What is intelligence?
- Is it that which characterize humans? Or is there an absolute standard of judgment?
- Accordingly there are two possibilities:
- A system with intelligence is expected to behave as intelligently as a human
- A system with intelligence is expected to behave in the best
possible manner
- Secondly what type of behavior are we talking about?
- Are we looking at the thought process or reasoning ability of the system?
- Or are we only interested in the final manifestations of the system in terms of its actions?
Given this scenario different interpretations have been used by different researchers as defining the
scope and view of Artificial Intelligence.
1. One view is that artificial intelligence is about designing systems that are as intelligent as humans.
This view involves trying to understand human thought and an effort to build machines that emulate
the human thought process. This view is the cognitive science approach to AI.
2. The second approach is best embodied by the concept of the Turing Test. Turing held that in future
computers can be programmed to acquire abilities rivaling human intelligence. As
part of his argument Turing put forward the idea of an 'imitation game', in which a human being and a
computer would be interrogated under conditions where the interrogator would not know which was
which, the communication being entirely by textual messages. Turing argued that if the interrogator
could not distinguish them by questioning, then it would be unreasonable not to call the computer
intelligent. Turing's 'imitation game' is now usually called 'the Turing test' for intelligence.
Figure 1: Turing Test
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b

Partial preview of the text

Download Introduction to Intelligent Agents: Perception, Action, and Search Algorithms and more Lecture notes Artificial Intelligence in PDF only on Docsity!

ARTIFICIAL INTELLIGENCE (AI)

1.1 Definition of AI

Artificial Intelligence is a branch of Science which deals with helping machines find solutions to complex problems in a more human-like fashion. This generally involves borrowing characteristics from human intelligence, and applying them as algorithms in a computer friendly way. A more or less flexible or efficient approach can be taken depending on the requirements established, which influences how artificial the intelligent behaviour appears. AI is generally associated with Computer Science , but it has many important links with other fields such as Mathematics , Psychology , Cognition , Biology and Philosophy , among many others. Our ability to combine knowledge from all these fields will ultimately benefit our progress in the quest of creating an intelligent artificial being. It is also concerned with the design of intelligence in an artificial device. The term was coined by McCarthy in 1956. There are two ideas in the definition.

  1. Intelligence
  2. Artificial device What is intelligence?
  • Is it that which characterize humans? Or is there an absolute standard of judgment?
  • Accordingly there are two possibilities:
  • A system with intelligence is expected to behave as intelligently as a human
  • A system with intelligence is expected to behave in the best possible manner
  • Secondly what type of behavior are we talking about?
  • Are we looking at the thought process or reasoning ability of the system?
  • Or are we only interested in the final manifestations of the system in terms of its actions? Given this scenario different interpretations have been used by different researchers as defining the scope and view of Artificial Intelligence.
  1. One view is that artificial intelligence is about designing systems that are as intelligent as humans. This view involves trying to understand human thought and an effort to build machines that emulate the human thought process. This view is the cognitive science approach to AI.
  2. The second approach is best embodied by the concept of the Turing Test. Turing held that in future computers can be programmed to acquire abilities rivaling human intelligence. As part of his argument Turing put forward the idea of an 'imitation game', in which a human being and a computer would be interrogated under conditions where the interrogator would not know which was which, the communication being entirely by textual messages. Turing argued that if the interrogator could not distinguish them by questioning, then it would be unreasonable not to call the computer intelligent. Turing's 'imitation game' is now usually called 'the Turing test' for intelligence.

Figure 1: Turing Test

Turing Test Consider the following setting. There are two rooms, A and B. One of the rooms contains a computer. The other contains a human. The interrogator is outside and does not know which one is a computer. He can ask questions through a teletype and receives answers from both A and B. The interrogator needs to identify whether A or B are humans. To pass the Turing test, the machine has to fool the interrogator into believing that it is human. For more details on the Turing test visit the site http://cogsci.ucsd.edu/~asaygin/tt/ttest.html

  1. Logic and laws of thought deals with studies of ideal or rational thought process and inference. The emphasis in this case is on the inferencing mechanism, and its properties. That is how the system arrives at a conclusion, or the reasoning behind its selection of actions is very important in this point of view. The soundness and completeness of the inference mechanisms are important here.
  2. The fourth view of AI is that it is the study of rational agents. This view deals with building machines that act rationally. The focus is on how the system acts and performs, and not so much on the reasoning process. A rational agent is one that acts rationally, that is, is in the best possible manner. 1.1.2 Typical AI problems While studying the typical range of tasks that we might expect an ―intelligent entity‖ to perform, we need to consider both ―commonplace‖ tasks as well as expert tasks. Examples of common-place tasks include
  • Recognizing people, objects.
  • Communicating (through natural language ).
  • Navigating around obstacles on the streets These tasks are done matter of firstly and routinely by people and some other animals. Expert tasks include:
  • Medical diagnosis.
  • Mathematical problem solving
  • Playing games like chess These tasks cannot be done by all people, and can only be performed by skilled specialists. Now, which of these tasks are easy and which ones are hard? Clearly tasks of the first type are easy for humans to perform, and almost all are able to master them. The second range of tasks requires skill development and/or intelligence and only some specialists can perform them well. However, when we look at what computer systems have been able to achieve to date, we see that their achievements include performing sophisticated tasks like medical diagnosis, performing symbolic integration, proving theorems and playing chess. On the other hand it has proved to be very hard to make computer systems perform many routine tasks that all humans and a lot of animals can do. Examples of such tasks include navigating our way Without running into things, catching prey and avoiding predators. Humans and animals are also capable of interpreting complex sensory information. We are able to recognize objects and people from the visual image that we receive. We are also able to perform complex social functions. Intelligent behaviour. This discussion brings us back to the question of what constitutes intelligent behaviour. Some of these tasks and applications are:

Perception involving image recognition and computer vision Reasoning Learning Understanding language involving natural language processing, speech processing

Solving problems Robotics

1.1.3 Practical Impact of AI AI components are embedded in numerous devices e.g. in copy machines for automatic correction of operation for copy quality improvement. AI systems are in everyday use for identifying credit card

In Natural language processing, we have systems that are capable of simple machine translation Today’s Expert systems can carry out medical diagnosis in a narrow domain Speech understanding systems are capable of recognizing several thousand words continuous speech Planning and scheduling systems had been employed in scheduling experiments with the Hubble Telescope The Learning systems are capable of doing text categorization into about a 1000 topics In Games, AI systems can play at the Grand Master level in chess (world champion), checkers, etc. What can AI systems NOT do yet? Understand natural language robustly (e.g., read and understand articles in a newspaper) Surf the web Interpret an arbitrary visual scene Learn a natural language Construct plans in dynamic real-time domains Exhibit true autonomy and intelligence

1.6: CONCLUSION Artificial intelligence (AI) is the intelligence of machines and the branch of computer science that aims to create it. AI textbooks define the field as "the study and design of intelligent agents" where an intelligent agent is a system that perceives its environment and takes actions that maximize its chances of success. John McCarthy, who coined the term in 1956, defines it as "the science and engineering of making intelligent machines." The field was founded on the claim that a central property of humans, intelligence—the sapience of Homo sapiens —can be so precisely described that it can be simulated by a machine. This raises philosophical issues about the nature of the mind and the ethics of creating artificial beings, issues which have been addressed by myth, fiction and philosophy since antiquity. Artificial intelligence has been the subject of optimism, but has also suffered setbacks and, today, has become an essential part of the technology industry, providing the heavy lifting for many of the most difficult problems in computer science.

2.0: Intelligent Agents

  • An agent is anything that can be viewed as
  • perceiving its environment through sensors and
  • acting upon that environment through actuators
  • Assumption: Every agent can perceive its own actions (but not always the effects)

Human agent:

  • eyes, ears, and other organs for sensors;
  • hands,legs, mouth, and other body parts for actuators
  • Robotic agent:
  • cameras and infrared range finders for sensors;
  • various motors for actuators
  • A software agent:
  • Keystrokes, file contents, received network packages as sensors
  • Displays on the screen, files, sent network packets as actuators

Agents and environments

  • Percept: agent’s perceptual input at any given instant
  • Percept sequence: complete history of everything the agent has ever perceived
  • An agent’s choice of action at any given instant can depend on the entire percept sequence observed to date
  • An agent’s behavior is described by the agent function which maps from percept histories to actions: [ f : P* A ]
  • We can imagine tabulating the agent function that describes any given agent (External characterization)
  • Internally, the agent function will be implemented by an agent program which runs on the physical architecture to produce f
  • agent = architecture + program

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.

Autonomous Agent:

  • An agent is autonomous if its behavior is determined by its own experience (with

ability to learn and adapt)

Specifying the task environment (PEAS)

• PEAS:

  • P erformance measure,
  • E nvironment,
  • A ctuators,
  • S ensors
  • In designing an agent, the first step must always be to specify the task environment (PEAS) as fully as possible.

PEAS for 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 PEAS for a 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)

PEAS for a satellite image analysis system

  • Performance measure: correct image categorization
  • Environment: downlink from orbiting satellite
  • Actuators: display categorization of scene
  • Sensors: color pixel arrays

PEAS for a 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

PEAS for a refinery controller

  • Performance measure: maximize purity, yield, safety
  • Environment: refinery, operators
  • Actuators: valves, pumps, heaters, displays
  • Sensors: temperature, pressure, chemical sensors

PEAS for Interactive English tutor

  • Performance measure: Maximize student's score on test
  • Environment: Set of students
  • Actuators: Screen display (exercises, suggestions, corrections)
  • Sensors: Keyboard

Environment types

  • Fully observable vs. partially observable
  • Deterministic vs. stochastic
  • Episodic vs. sequential
  • Static vs. dynamic
  • Discrete vs. continuous
  • Single agent vs. Multiagent

Fully observable vs. partially observable:

  • An environment is fully observable if an agent's sensors give it access to the

complete state of the environment at each point in time.

  • Fully observable environments are convenient, because the agent need not maintain any internal state to keep track of the world
  • An environment might be partially observable because of noisy and inaccurate sensors or because parts of the state are simply missing from the sensor data
  • Examples: vacuum cleaner with local dirt sensor, taxi driver

Deterministic vs. stochastic:

  • The environment is deterministic if the next state of the environment is completely determined by the current state and the action executed by the agent.
  • In principle, an agent need not worry about uncertainty in a fully observable,

deterministic environment

  • If the environment is partially observable then it could appear to be stochastic
  • Examples: Vacuum world is deterministic while taxi driver is not
  • If the environment is deterministic except for the actions of other agents, then

the environment is strategic Episodic vs. sequential:

  • In episodic environments, 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.

  • Examples: classification tasks
  • In sequential environments, the current decision could affect all future decisions
  • Examples: chess and taxi driver

Static vs. dynamic:

  • The environment is unchanged while an agent is deliberating.
  • Static environments are easy to deal with because the agent need not keep

looking at the world while it is deciding on the action or need it worry about the passage of time

  • Dynamic environments continuously ask the agent what it wants to do
  • The environment is semi-dynamic if the environment itself does not change with

the passage of time but the agent's performance score does

  • Examples: taxi driving is dynamic, chess when played with a clock is semi- dynamic, crossword puzzles are static

Discrete vs. continuous:

  • A limited number of distinct, clearly defined states, percepts and actions.

Agent functions and programs

  • An agent is completely specified by the agent function mapping percept sequences to actions
  • One agent function (or a small equivalence class) is rational
  • Aim: find a way to implement the rational agent function concisely -> design an agent program Agent = agent program + architecture
  • Architecture: some sort of computing device with physical sensors and actuators (PC, robotic car)
  • should be appropriate: walk action requires legs

• Agent program:

  • Takes the current percept as input from the sensors
  • Return an action to the actuators
  • While agent function takes the whole percept history, agent program takes just the current percept as input which the only available input from the environment
  • The agent need to remember the whole percept sequence, if it needs it

Table-lookup agent

  • A trivial agent program: keeps track of the percept sequence and then uses it to index into a table of actions to decide what to do
  • The designers must construct the table that contains the appropriate action for

every possible percept sequence

function TABLE-DRIVEN-AGENT( percept ) returns an action

static : percepts , a sequence, initially empty

table , a table of actions, indexed by percept sequences, initially fully specified

append percept to the end of percepts

action <--LOOKUP( percepts, table )

return action

  • Drawbacks:
  • Huge table (P^T , P: set of possible percepts, T: lifetime) •Space to store the table

•Take a long time to build the table •No autonomy •Even with learning, need a long time to learn the table entries

Rather than a table how we can produce rational behavior from a small amount of code

Four basic types in order of increasing generality:

  • Simple reflex agents
  • Model-based reflex agents
  • Goal-based agents
  • Utility-based agents

Simple reflex agents 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

  • Select actions on the basis of the current percept ignoring the rest of the percept history
  • Example: simple reflex vacuum cleaner agent
  • Condition-action-rule
  • Example: if car-in-front-is-breaking then initiatebreaking

function SIMPLE-REFLEX-AGENT(percept) returns an action static: rules, a set if condition-action rules state <-- INTERPRET_INPUT(percept) rule <-- RULE_MATCH(state, rules) action <-- RULE_ACTION[rule] return action

Simple-reflex agents are simple, but they turn out to be of very limited intelligence

  • The agent will work only if the correct decision can be made on the basis of the current percept – that is only if the environment is fully observable
  • Infinite loops are often unavoidable – escape could be possible by randomizing

Goal-based agents

  • Knowing about the current state of the environment is not always enough to

decide what to do (e.g. decision at a road junction)

  • The agent needs some sort of goal information that describes situations that are desirable
  • The agent program can combine this with information about the results of

possible actions in order to choose actions that achieve the goal

  • Usually requires search and planning

Goal-based agents vs reflex-based agents

  • Although goal-based agents appears less efficient, it is more flexible because the knowledge that supports its decision is represented explicitly and can be modified
  • On the other hand, for the reflex-agent, we would have to rewrite many condition-action rules
  • The goal based agent's behavior can easily be changed
  • The reflex agent's rules must be changed for a new situation

Utility-based agents

  • Goals alone are not really enough to generate high quality behavior in most

environments – they just provide a binary distinction between happy and unhappy states

  • A more general performance measure should allow a comparison of different world states according to exactly how happy they would make the agent if they could be

achieved

  • Happy – Utility (the quality of being useful)
  • A utility function maps a state onto a real number which describes the associated degree of happiness

Learning agents

  • Turing – instead of actually programming intelligent machines by hand, which is

too much work, build learning machines and then teach them

  • Learning also allows the agent to operate in initially unknown environments and to become more competent than its initial knowledge alone might allow

 Learning element – responsible for making

improvements

We have earlier discussed about an intelligent agent. In this unit we will study a type of intelligent agent which we will call a goal directed agent. A goal directed agent needs to achieve certain goals. Such an agent selects its actions based on the goal it has. Many problems can be represented as a set of states and a set of rules of how one state is transformed to another. Each state is an abstract representation of the agent's environment. It is an abstraction that denotes a configuration of the agent.

Let us look at a few examples of goal directed agents.

1. 15-puzzle : The goal of an agent working on a 15-puzzle problem may be to reach a configuration which satisfies the condition that the top row has the tiles 1, 2 and 3. The details of this problem will be described later.

  1. The goal of an agent may be to navigate a maze and reach the HOME position. The agent must choose a sequence of actions to achieve the desired goal.

3.1.2 State Space Search Notations Now let us look at the concept of a search problem. Problem formulation means choosing a relevant set of states to consider, and a feasible set of operators for moving from one state to another. Search is the process of considering various possible sequences of operators applied to the initial state, and finding out a sequence which culminates in a goal state.

1.2 Problem Space What is problem space? A problem space is a set of states and a set of operators. The operators map from one state to another state. There will be one or more states that can be called initial states, one or more states which we need to reach what are known as goal states and there will be states in between initial states and goal states known as intermediate states. So what is the solution? The solution to the given problem is nothing but a sequence of operators that map an initial state to a goal state. This sequence forms a solution path. What is the best solution? Obviously the shortest path from the initial state to the goal state is the best one. Shortest path has only a few operations compared to all other possible solution paths. Solution path forms a tree structure where each node is a state. So searching is nothing but exploring the tree from the root node. 3.2.1 Search Problem A search problem consists of the following:  S: the full set of states  S 0 : the initial state  A:S→S is a set of operators  G is the set of final states. Note that G ⊆S These are schematically depicted in Figure 2.

Data Structures for Search

  • Defining a search node:
  • Each node contains a state
  • Node also contains additional information, e.g.:  The parent state and the operator used to generate it  Cost of the path so far  Depth of the node
  • Expanding a node:
  • Applying all legal operators to the state contained in the node
  • Generating nodes for all the corresponding successor states.

Generic Search Algorithm

  1. Initialize the search tree using the initial state of the problem
  2. Repeat a) If no candidate nodes can be expanded, return failure b) Choose a leaf node for expansion, according to some search strategy c) If the node contains a goal state, return the corresponding path d) Otherwise expand the node by: - Applying each operator - Generating the successor state - Adding the resulting nodes to the tree

Implementation Details

  • We need to keep track only of the nodes that need to be expanded - frontier or open list
  • This can be implemented using a (prioritized) queue:
  1. Initialize the queue by inserting the node for the initial state
  2. Repeat (a) If the queue is empty, return failure (b) Dequeue a node (c) If the node contains a goal state, return the path (d) Otherwise expand the node, inserting the resulting nodes into queue
  • Search algorithms differ in their queuing function!

3.2: Uninformed (blind) search methods

  • If a state is not a goal, we cannot tell how close to the goal it might be
  • Hence, all we can do is move systematically between states until we stumble on a goal
  • In contrast, informed (heuristic) search uses a guess on how close to the goal a state might be

Examples of Uninformed Search Algorithms are:

  • Breadth-First Search
  • Depth-First Search
  • Iterative Deepening
  • Heuristics

A. Breadth-First Search (BFS)

  • Enqueues nodes at the end of the queue
  • All nodes at level i get expanded before all nodes at level i+