Understanding Artificial Intelligence Basics
Understanding Artificial Intelligence Basics
Module 1
2|Page
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
3|Page
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
includes a video signal so that the interrogator can test the subject’s
perceptual abilities, as well as the opportunity for the interrogator to pass
physical objects “through the hatch.”
• If we are going to say that a given program thinks like a human, we must
have some way of determining how humans think.
• We need to get inside the actual workings of human minds. There are three
ways to do this: through introspection—trying to catch our own thoughts
as they go by; through psychological experiments—observing a person
in action; and through brain imaging—observing the brain in action.
• Once we have a sufficiently precise theory of the mind, it becomes
possible to express the theory as a computer program.
• If the program’s input–output behavior matches corresponding human
behavior, that is evidence that some of the program’s mechanisms could
also be operating in humans.
For example, Allen Newell and Herbert Simon, who developed GPS, the
“General Problem Solver” (Newell and Simon, 1961), were not content
merely to have their program solve problems correctly.
• They were more concerned with comparing the trace of its reasoning
steps to traces of human subjects solving the same problems.
4|Page
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• The interdisciplinary field of cognitive science brings together computer
models from AI and experimental techniques from psychology to
construct precise and testable theories of the human mind.
• The two fields continue to fertilize each other, most notably in computer
vision, which incorporates neurophysiological evidence into
computational models.
• The Greek philosopher Aristotle was one of the first to attempt to codify
“right thinking,” that is, irrefutable reasoning processes.
• His syllogisms provided patterns for argument structures that always
yielded correct conclusions when given correct premises—for example,
“Socrates is a man; all men are mortal; therefore, Socrates is mortal.”
These laws of thought were supposed to govern the operation of the mind;
their study initiated the field called logic.
• Logicians in the 19th century developed a precise notation for statements
about all kinds of objects in the world and the relations among them.
(Contrast this with ordinary arithmetic notation, which provides only for
statements about numbers.)
• The so-called logicist tradition within artificial intelligence hopes to build
on such programs to create intelligent systems.
• There are two main obstacles to this approach:
First, it is not easy to take informal knowledge and state it in the formal
terms required by logical notation, particularly when the knowledge is
less than 100% certain.
5|Page
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
Second, there is a big difference between solving a problem “in
principle” and solving it in practice.
1.1.4 Acting rationally: The rational agent approach
• Human behavior, on the other hand, is well adapted for one specific
environment and is defined by, well, the sum total of all the things that
humans do.
1.4 THE STATE OF THE ART
7|Page
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
management system.
• Autonomous planning and scheduling:
• A hundred million miles from Earth, NASA’s Remote Agent program
became the first on-board autonomous planning program to control the
scheduling of operations for a spacecraft (Jonsson et al., 2000).
REMOTE AGENT gen erated plans from high-level goals specified from
the ground and monitored the execution of those plans—detecting
• , diagnosing, and recovering from problems as they occurred.
• Successor program MAPGEN (Al-Chang et al., 2004) plans the daily
operations for NASA’s Mars Exploration Rovers, and MEXAR2 (Cesta et al.,
2007) did mission planning—both logistics and science planning—for the
European Space Agency’s Mars Express mission in 2008.
• Game playing:
• IBM’s DEEP BLUE became the first computer program to defeat the world
champion in a chess match when it bested Garry Kasparov by a score of
3.5 to 2.5 in an exhibition match (Goodman and Keene, 1997).
• Kasparov said that he felt a “new kind of intelligence” across the board
from him. Newsweek magazine described the match as “The brain’s last
stand.”
• The value of IBM’s stock increased by $18 billion. Human champions
studied Kasparov’s loss and were able to draw a few matches in
subsequent years, but the most recent human-computer matches have
been won convincingly by the computer.
8|Page
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
Spam fighting:
• Each day, learning algorithms classify over a billion messages as spam,
saving the recipient from having to waste time deleting what, for many
users, could comprise 80%
10 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
2. Intelligent Agents
11 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• agent.
• Mathematically speaking, we say that an agent’s behavior is described
by the agent function that maps any given percept sequence to an action.
12 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
13 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
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, and Suck.
• The agent correctly perceives its location and whether that location
contains dirt.
• An omniscient agent knows the actual outcome of its actions and can act
accordingly; but omniscience is impossible in reality.
• Rationality maximizes expected performance, while perfection maximizes
actual performance.
• Doing actions in order to modify future percepts—sometimes called
information gathering—is an important part of rationality.
• A second example of information gathering is provided by the exploration
that must be undertaken by a vacuum-cleaning agent in an initially
unknown environment.
• To the extent that an agent relies on the prior knowledge of its designer
rather than on its own percepts, we say that the agent lacks autonomy. A
rational agent should be autonomous—it should learn what it can to
compensate for partial or incorrect prior knowledge. For example, a
16 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
vacuum-cleaning agent that learns to foresee where and when additional
dirt will appear will do better than one that does not.
17 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• Next, what is the driving environment that the taxi will face?
✓ Any taxi driver must deal with a variety of roads, ranging from rural lanes
and urban alleys to 12-lane freeways.
✓ The roads contain other traffic, pedestrians, stray animals, road works,
police cars, puddles and potholes.
✓ The taxi must also interact with potential and actual passengers. There
are also some optional choices.
✓ The taxi might need to operate in Southern California, where snow is
seldom a problem, or in Alaska, where it seldom is not.
✓ It could always be driving on the right, or we might want it to be flexible
enough to drive on the left when in Britain or Japan.
✓ Obviously, the more restricted the environment, the easier the design
problem.
18 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• The basic sensors for the taxi will include one or more controllable video
cameras so that it can see the road; it might augment these with infrared
or sonar sensors to detect distances to other cars and obstacles.
✓ To avoid speeding tickets, the taxi should have a speedometer, and to
control the vehicle properly, especially on curves, it should have an
accelerometer.
✓ To determine the mechanical state of the vehicle, it will need the usual
array of engine, fuel, and electrical system sensors.
✓ Like many human drivers, it might want a global positioning system
(GPS) so that it doesn’t get lost.
✓ Finally, it will need a keyboard or microphone for the passenger to
request a destination.
In Figure 2.5, we have sketched the basic PEAS elements for a number.
19 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
20 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
Fully observable vs. partially observable:
✓ If an agent’s sensors give it access to the complete state of the environment
at each point in time, then we say that the task environment is fully
observable.
✓ A task environment is effectively fully observable if the sensors detect all
aspects that are relevant to the choice of action; relevance, in turn,
depends on the performance measure.
✓ 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—for example, a vacuum agent with only a local dirt sensor
cannot tell whether there is dirt in other squares, and an automated taxi
cannot see what other drivers are thinking.
✓ If the agent has no sensors at all then the environment is unobservable.
Single agent vs. multiagent:
✓ The distinction between single-agent and multiagent en vironments
may seem simple enough.
✓ There are, however, some subtle issues. First, we have described how an
entity may be viewed as an agent, but we have not explained which
entities must be viewed as agents. Does an agent A (the taxi driver for
example) have to treat an object B (another vehicle) as an agent, or can it
21 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
be treated merely as an object behaving according to the laws of physics,
analogous to waves at the beach or leaves blowing in the wind?
✓ The key distinction is whether B’s behavior is best described as
maximizing a performance measure whose value depends on agent A’s
behavior.
✓ For example, in chess, the opponent entity B is trying to maximize its
performance measure, which, by the rules of chess, minimizes agent A’s
per formance measure. Thus, chess is a competitive multiagent
environment.
✓ In the taxi-driving environment, on the other hand, avoiding collisions
maximizes the performance measure of all agents, so it is a partially
cooperative multiagent environment.
✓ It is also partially competitive because, for example, only one car can
occupy a parking space.
✓ The agent-design problems in multiagent environments are often quite
different from those in single-agent environments; for example,
communication often emerges as a rational behavior in multiagent
environments; in some competitive environments, randomized behavior
is rational because it avoids the pitfalls of predictability.
Deterministic vs. stochastic:
✓ If the next state of the environment is completely determined by the
current state and the action executed by the agent, then we say the
environment is deterministic; otherwise, it is stochastic.
✓ In principle, an agent need not worry about uncertainty in a fully
observable, deterministic environment.
22 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
✓ If the environment is partially observable, however, then it could appear
to be stochastic. Most real situations are so complex that it is impossible to
keep track of all the unobserved aspects; for practical purposes, they must
be treated as stochastic.
✓ Taxi driving is clearly stochastic in this sense, because one can never
predict the behavior of traffic exactly; moreover, one’s tires blow out and
one’s engine seizes up without warning.
✓ The vacuum world as we described it is deterministic, but variations can
include stochastic elements
✓ One final note: our use of the word “stochastic” generally implies that
uncertainty about outcomes is quantified in terms of probabilities; a
nondeterministic environment is one in which actions are characterized by
their possible outcomes, but no probabilities are attached to them.
Nondeterministic environment descriptions are usually associated with
performance measures that require the agent to succeed for all possible
outcomes of its actions.
23 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• In sequential environments, on the other hand, the current decision
could affect all future decisions.
✓ Chess and taxi driving are sequential: in both cases, short-term actions
can have long- term consequences.
✓ Episodic environments are much simpler than sequential environments
because the agent does not need to think ahead.
• Static vs. dynamic:
✓ If the environment can change while an agent is deliberating, then
we say the environment is dynamic for that agent; otherwise, it is static.
✓ Static environments are easy to deal with because the agent need not
keep looking at the world while it is deciding on an action, nor need it
worry about the passage of time.
✓ Dynamic environments, on the other hand, are continuously asking the
agent what it wants to do; if it hasn’t decided yet, that counts as deciding
to do nothing.
✓ If the environment itself does not change with the passage of time but
the agent’s performance score does, then we say the environment is
semidynamic.
Taxi driving is clearly dynamic: the other cars and the taxi itself keep
moving while the driving algorithm dithers about what to do next. Chess,
when played with a clock, is semi dynamic. Crossword puzzles are static.
24 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
of the agent.
✓ For example, the chess environment has a finite number of distinct states.
✓ Chess also has a discrete set of percepts and actions.
Taxi driving is a continuous-state and continuous-time problem:
✓ the speed and location of the taxi and of the other vehicles sweep through
a range of continuous values and do so smoothly over time.
✓ Taxi-driving actions are also continuous (steering angles, etc.). Input from
digital cameras is discrete, strictly speaking, but is typically treated as
representing continuously varying intensities and locations.
• Known vs. unknown:
✓ In a known environment, the outcomes (or outcome probabilities if the
environment is stochastic) for all actions are given. Obviously, if the
environment is unknown, the agent will have to learn how it works in order
to make good decisions. Note that the distinction between known and
unknown environments is not the same as the one between fully and
partially observable environments.
✓ It is quite possible for a known environment to be partially observable—
for example, in solitaire card games, I know the rules but am still unable
to see the cards that have not yet been turned over. Conversely, an
unknown environment can be fully observable—in a new video game, the
screen may show the entire game state but I still don’t know what the
buttons do until I try them.
25 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
Agent programs
• The difference between the agent program, which takes the current
26 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
percept as input, and the agent function, which takes the entire percept
history.
• The agent program takes just the current percept as input because nothing
more is available from the environment; if the agent’s actions need to
depend on the entire percept sequence, the agent will have to remember
the percepts.
• For example, Figure 2.7 shows a rather trivial agent program that keeps
track of the percept sequence and then uses it to index into a table of
actions to decide what to do.
• To build a rational agent in this way, we as designers must construct a table
that contains the appropriate action for every possible percept sequence.
27 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
28 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
1. Simple reflex agents
29 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
✓ The agent program, which is also very simple, is shown in Figure 2.10.
✓ The INTERPRET-INPUT function generates an abstracted description of the
current state from the percept, and the RULE-MATCH function returns the
first rule in the set of rules that matches the given state description.
✓ Simple reflex agents have the admirable property of being simple, but
they turn out to be of limited intelligence.
✓ The agent in Figure 2.10 will work only if the correct decision can be made
30 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
on the basis of only the current percept—that is, only if the environment is
fully observable.
✓ Even a little bit of unobservability can cause serious trouble.
✓ Suppose that a simple reflex vacuum agent is deprived of its location
sensor and has only a dirt sensor. Such an agent has just two possible
percepts: [Dirty] and [Clean].
✓ It can Suck in response to [Dirty]; what should it do in response to [Clean]?
MovingLeft fails (forever) if it happens to start in square A, and moving
Right fails (forever) if it happens to start in square B.
✓ Infinite loops are often unavoidable for simple reflex agents operating in
partially observable environments.
Figure 2.11 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 agent program is shown in Figure 2.12. The interesting part is the
function UPDATE-STATE, which is responsible for creating the new
internal state description.
32 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
33 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
3. Goal-based agents
• Knowing something about the current state of the environment is not
always enough to decide what to do.
• For example, 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 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 2.13 shows the goal-based agent’s structure.
34 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
Learning agents
• A learning agent can be divided into four conceptual components, as
shown in Figure 2.15.
• The most important distinction is between the learning element, which is
re sponsible for making improvements, and the performance element,
which is responsible for selecting external actions.
37 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• The critic tells the learning element how well the agent is doing with
respect to a fixed performance standard. The critic is necessary because
the percepts themselves provide no indication of the agent’s success.
• The last component of the learning agent is the problem generator. It is
responsible for suggesting actions that will lead to new and informative
experiences.
• The point is that if the performance element had its way, it would keep
doing the actions that are best, given what it knows.
38 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• The various ways that the components can represent the environment
that the agent inhabits.
• We can place the representations along an axis of increasing complexity
and expressive power—atomic, factored, and structured.
• To illustrate these ideas, it helps to consider a particular agent component,
such as the one that deals with “What my actions do.” This component
describes the changes that might occur in the environment as the result of
taking an action, and Figure 2.16 provides schematic depictions of how
39 | P a g e
Artificial Intelligence-BCS515B Akash Karna(CSE,AIT)
• For the purposes of solving this problem, it may suffice to reduce the state
of world to just the name of the city we are in—a single atom of knowledge;
a “black box” whose only discernible property is that of being identical
to or different from another black box. The algorithms underlying search
and game-playing , Hidden Markov models, and Markov decision
processes all work with atomic representations—or, at least, they treat
representations as if they were atomic.
2. Factored representation
42 | P a g e