AMC ENGINEERING COLLEGE, BENGALURU – 560083
Department of Computer Science and Engineering
5 th
Semester “C” Section– ARTIFICIAL INTELLIGENCE (BCS515B)
Question Bank Solutions
Module I (Introduction & Intelligent Agents)
Chapter I - Introduction
Q1. Define AI. Recall its characteristics and applications or domains.
Ans:
Definition:
Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a
software think intelligently, in the similar manner the intelligent humans think.
OR
The ability of a system to calculate, reason, perceive relationships and analogies, learn
from experience, store and retrieve information from memory, solve problems,
comprehend complex ideas, use natural language fluently, classify, generalize, and adapt
new situations.
Characteristics:
➢ Its volume is huge, next to unimaginable/it is voluminous.
➢ It is not well-organized or well-formatted.
➢ It is hard to characterize accurately.
➢ It keeps changing constantly.
➢ It differs from data being organized in a way that corresponds to the way it
will be used.
Applications/Domains:
➢ Gaming − AI plays crucial role in strategic games such as chess, poker, tic-tac-
toe, etc., where machine can think of large number of possible positions based
on heuristic knowledge.
➢ Natural Language Processing − It is possible to interact with the computer that
understands natural language spoken by humans.
➢ Expert Systems − There are some applications which integrate machine,
software, and special information to impart reasoning and advising. They
provide explanation and advice to the users.
➢ Vision Systems − These systems understand, interpret, and comprehend visual
input on the computer
➢ Speech Recognition − Some intelligent systems are capable of hearing and
comprehending the language in terms of sentences and their meanings while a
human talks to it. It can handle different accents, slang words, noise in the
background, change in human’s noise due to cold, etc.
➢ Handwriting Recognition − The handwriting recognition software reads the
text written on paper by a pen or on screen by a stylus. It can recognize the
shapes of the letters and convert it into editable text.
➢ Intelligent Robots − Robots are able to perform the tasks given by a human.
They have sensors to detect physical data from the real world such as light, heat,
temperature, movement, sound, bump, and pressure
OR
➢ Natural language processing to communicate in a human language.
➢ Knowledge representation to store what it knows;
➢ Automated reasoning to answer questions and draw new conclusion.
➢ Machine learning to adapt to new circumstances and to detect patterns.
➢ Computer vision & speech recognition to perceive the world.
➢ Robotics to move around in the world and to manipulate objects
Q2. Outline the history of AI.
Ans:
1943 McCulloh & Pitts: model of artificial neurons
1950 Turing’s “Computing Machinery and Intelligence
1956 McCarthy, Minsky, Newell, Simon, Shannon, Nash et al.
Dartmouth workshop: birth of “Artificial Intelligence”
1952-69 Early enthusiasm, great expectations, optimism fueled by early success on
some problems thought to be hard
1966-73 Collapse in AI research: Progress was slower than expected.
Unrealistic predictions, Herbert Simon (1957)
AI discovers computational complexity.
1969-86 Expert systems
1980 AI becomes an industry: expert systems booms, then
busts (1988-93): AI Winter”
1986 Neural networks regain popularity
1987 Probabilistic reasoning and machine learning
1995 Emergence of intelligent agents
➢ AI technologies continue to find applications in
❖ information retrieval
❖ data mining and knowledge discovery
❖ customizable software systems
❖ smart devices (e.g., home, automobiles
❖ agile manufacturing systems
❖ autonomous vehicles
❖ Bioinformatics
❖ internet tools: search engines, recommender systems
2001- Big data
2011- Deep learning
➢ Successful large-scale real-world applications in
❖ image recognition
❖ natural language processing
❖ speech recognition
❖ machine translation etc.….
2021's Top Stories About AI - IEEE Spectrum
OR
1. The gestation of artificial intelligence (1943–1955)
2. The birth of artificial intelligence (1956)
3. Early enthusiasm, great expectations (1952–1969)
4. A dose of reality (1966–1973)
5. Knowledge-based systems: The key to power? (1969–1979)
6. AI becomes an industry (1980–present)
7. The return of neural networks (1986–present)
8. AI adopts the scientific method (1987–present)
9. The emergence of intelligent agents (1995–present)
10. The availability of very large data sets (2001–present)
Chapter II - Intelligent Agents
Q1. Illustrate the relationship between agent and environment with an example.
Ans:
Diagram:
➢ An agent is anything that can perceive its environment through sensors and acts upon
that environment through effectors.
➢ A human agent has sensory organs such as eyes, ears, nose, tongue and skin parallel
to the sensors, and other organs such as hands, legs, mouth, for effectors.
➢ A robotic agent replaces cameras and infrared range finders for the sensors, and
various motors and actuators for effectors.
➢ A software agent has encoded bit strings as its programs and actions.
Agent Terminology:
➢ Performance Measure of Agent − It is the criteria, which determines how successful
an agent is.
➢ Behavior of Agent − It is the action that agent performs after any given sequence of
percepts.
➢ Percept − It is agent’s perceptual inputs at a given instance.
➢ Percept Sequence − It is the history of all that an agent has perceived till date.
➢ Agent Function − It is a map from the precept sequence to an action.
Example: Application – Driver
Agent Type Percepts Actions Goals Environment
Safe, fast,
Cameras, Steer,
legal, Roads, other
speedometer, accelerate,
Taxi driver comfortable traffic, pedestrians,
GPS,sonar, brake, talk to
trip, maximize customers
microphone passenger
profits
Q2. Discuss the concept of rationality with respect to good behaviour.
Ans:
Definition:
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.
An ideal rational agent is the one, which is capable of doing expected actions to maximize
its performance measure, on the basis of −
➢ Its percept sequences
➢ Its built-in knowledge bases
Rationality of an agent depends on the following four factors −
➢ The performance measures, which determine the degree of success.
➢ Agent’s Percept Sequence till now.
➢ The agent’s prior knowledge about the environment.
➢ The actions that the agent can carry out.
Example: Vacuum Cleaner
Diagram:
function Vacuum Agent ([1ocation, status returns an action
if status = Dirty
then return Suck
else if location = A
then return Right
else if location = B
then return Left
Simple vacuum-cleaner agent that cleans a square if it is dirty and moves to the other
square if not; this is the agent function.
❖ The performance measure awards one point for each clean square at each time
step, over a "lifetime" of 1000-time steps.
❖ The "geography" of the environment is known a priori shown in figure below
but the dirt distribution and the initial location of the agent are not. Clean squares
stay clean and sucking cleans the current square. The Left and Right actions
move the agent left and right except when this would take the agent outside the
environment, in which case the agent remains where it is.
❖ The only available actions are Left, Right, Suck, and NoOp (do nothing/No
Operation).
❖ The agent correctly perceives its location and whether that location contains dirt.
Q3. Explain the nature of environment with an example and their PEAS
descriptions.
Ans:
Explanation
Q4. Construct and explain the problem-solving agent for Toy Problem.
Ans:
Diagram:
This can be formulated as a problem as follows:
➢ States: The state is determined by both the agent location and the dirt locations.
The agent is in one of two locations, each of which might or might not contain dirt.
Thus, there are 2 × 22 = 8 possible world states. A larger environment with n
locations has n ・ 2n states.
➢ Initial state: Any state can be designated as the initial state.
➢ Actions: In this simple environment, each state has just three actions: Left, Right,
and Suck. Larger environments might also include Up and Down.
➢ Transition model: The actions have their expected effects, except that moving Left
in the leftmost square, moving Right in the rightmost square, and Sucking in a clean
square have no effect. The complete state space is shown in fig. below
➢ Goal test: This checks whether all the squares are clean.
➢ Path cost: Each step costs 1, so the path cost is the number of steps in the path.
Q5. Interpret the structure of agent for TABLE-DRIVEN-AGENT program.
Ans:
Agent Program
➢ The table-driven approach to agent construction is doomed to failure.
➢ Let P be the set of possible precepts and let T be the lifetime of the agent (the
total number of precepts it will receive).
➢ The lookup table will contain c: = ('Pit entries. Consider the automated taxi: the
visual input from a single camera comes in at the rate of roughly 27 megabytes
per second (30 frames per second, 640 x 480 pixels with 24 bits of colour
information).
➢ This gives a lookup table with over 10250,000,000, entries for an hour's driving.
➢ Even the lookup table for chess-a tiny, well-behaved fragment of the real world-
would have at least1010 entries.
➢ The daunting size of these tables (the number of atoms in the observable
universe is less than 1080) means that
❖ no physical agent in this universe will have the space to store the table,
❖ the designer would not have time to create the table,
❖ no agent could ever learn all the right table entries from its experience
and even if the environment is simple enough to yield a feasible table
size, the designer still has no guidance about how to fill in the table
entries.
Despite all this TABLE-DRIVEN-AGENT does do what we want: it implements
the desired agent function.
Q7. Discuss the four basic kinds of agent programs that embody the principles of
Intelligent systems. (Structure of agents)
Ans:
⮚ Simple reflex agents;
⮚ Model-based reflex agents;
⮚ Goal-based agents; and
⮚ Utility-based agents
1. Simple reflex agent
Diagram:
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
⮚ The simplest kind of agent is the SIMPLE REFLEX AGENT. These agents
select actions on the basis AGENT of the current percept, ignoring the rest of the
percept history.
⮚ For example, the vacuum agent, is a simple reflex agent, because its decision is
based only on the current location and on whether that location contains dirt.
⮚ The vacuum agent program is very small indeed compared to the corresponding
table. The most obvious reduction comes from ignoring the percept history, which
cuts
⮚ down the number of possibilities from 4T to just 4.
⮚ A further, small reduction comes from the fact that when the current square is dirty,
the action does not depend on the location.
⮚ Simple reflex behaviours occur even in more complex environments. Imagine
yourself as the driver of the automated taxi. If the car in front brakes and its brake
lights come on, then you should notice this and initiate braking. In other words,
some processing is done on the visual input to establish the condition we call “The
car in front is braking.” Then, this triggers some established connection in the agent
program to the action “initiate braking.”
⮚ We call CONDITION–ACTION such a connection a condition–action rule,5
written as
RULE
if car-in-front-is-braking then initiate-braking.
⮚ Humans also have many such connections, some of which are learned responses (as
for driving) and some of which are innate reflexes (such as blinking when
something approaches the eye).
2. Model-based reflex agents;
Diagram:
⮚ This knowledge about “how the world works” whether implemented in Simple
Boolean Circuits or in complete scientific theories is called a model of the world.
⮚ An agent that uses such a MODEL-BASED model is called a model-based agent.
AGENT
⮚ Figure above gives the structure of the model-based reflex agent with internal state,
showing how the current percept is combined with the old internal state to generate
the updated description of the current state, based on the agent’s model of how the
world works.
⮚ The interesting part is the function UPDATE-STATE, which example, the taxi may
be driving back home, and it may have a rule telling it to fill up with gas on the way
home unless it has at least half a tank. Although “driving back home” may seem to an
aspect of the world state, the fact of the taxi’s destination is actually an aspect of the
agent’s internal state.
3. Goal-based agents
Knowing something about the current state of the environment is not always enough to
decide what to do.
For example,
1. At a road junction, the taxi can turn left, turn right, or go straight on. The correct
decision depends on where the taxi is trying to get to. In other words, as well GOAL
as a current state description, the agent needs some sort of goal information that
describes situations that are desirable, For example: being at the passenger’s
destination. The agent program can combine this with the model (the same information
as was used in the model based reflex agent) to choose actions that achieve the goal.
Figure above shows the goal-based agent’s structure. Sometimes goal-based action
selection is straightforward, For example, when goal satisfaction results immediately
from a single action. Sometimes it will be trickier For example: when the agent has
to consider long sequences of twists and turns in order to find a way to achieve the
goal.
2. A goal-based agent, in principle, could reason that if the car in front has its brake lights
on, it will slow down. Given the way the world usually evolves, the only action that
will achieve the goal of not hitting other cars is to brake. Although the goal-based
agent appears less efficient, it is more flexible because the knowledge that supports its
decisions is represented explicitly and can be modified.
3. If it starts to rain, the agent can update its knowledge of how effectively its brakes will
operate; this will automatically cause all of the relevant behaviour’s to be altered to
suit the new conditions.
4. For the reflex agent, on the other hand, we would have to rewrite many condition action
rules. The goal-based agent’s behaviour can easily be changed to go to a different
destination, simply by specifying that destination as the goal.
5. The reflex agent’s rules for when to turn and when to go straight will work only for a
single destination; they must all be replaced to go somewhere new
4. Utility-based agents
Diagram:
⮚ An agent’s utility function is essentially an internalization of the performance
measure. If the internal utility function and the external performance measure
are in agreement, then an agent that chooses actions to maximize its utility will
be rational according to the external performance measure.
⮚ Even if goals are inadequate but a utility-based agent can still make rational
decisions.
⮚ First, when there are conflicting goals, only some of which can be achieved (for
example: speed and safety), the utility function specifies the appropriate trade-
off.
⮚ Second, when there are several goals that the agent can aim for, none of which
can be achieved with certainty, utility provides a way in which the likelihood of
success can be weighed against the importance of the goals.
⮚ Partial observability and stochasticity are ubiquitous in the real world, and so,
therefore, is decision making under uncertainty.
⮚ Technically speaking, a rational utility-based agent EXPECTED UTILITY
chooses the action that maximizes the expected utility of the action outcomes
that is, the utility the agent expects to derive, on average, given the probabilities
and utilities of each outcome.
⮚ The utility-based agent structure is as shown in the figure above
⮚ Utility-based agent programs appear in Part IV, where we design decision-making
agents that must handle the uncertainty inherent in stochastic or partially
observable environments. At this point, the reader may be wondering, “Is it that
simple? We just build agents that maximize expected utility, and we’re done?”
It’s true that such agents would be intelligent, but it’s not simple
⮚ A utility-based agent has to model and keep track of its environment, tasks that
have involved a great deal of research on perception, representation, reasoning,
and learning.