Module 2 1
Module 2 1
Module 2 1
SHIVANANDA
When the correct action to take is not immediately obvious, an agent may need to to plan ahead: to consider
a sequence of actions that form a path to a goal state. Such an agent is called a problem-solving agent, and
the computational process it undertakes is called search.
Problem-solving agents use atomic representations, that is, states of the world are considered as wholes,
with no internal structure visible to the problem-solving algorithms. Agents that use factored or structured
representations of states are called planning agents.
If the agent has no additional information—that is, if the environment is unknown—then the agent can do
no better than to execute one of the actions at random. In this chapter, we will assume our agents always
have access to information about the world, such as the map in Figure 3.1. With that information, the agent
can follow the following four-phase problem-solving process:
Page - 1
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
• Goal formulation: The agent adopts the goal of reaching Bucharest. Goals organize behavior by limiting
the objectives and hence the actions to be considered.
• Problem formulation: The agent devises a description of the states and actions necessary to reach the
goal—an abstract model of the relevant part of the world. For our agent, one good model is to consider the
actions of traveling from one city to an adjacent city, and therefore the only fact about the state of the world
that will change due to an action is the current city.
• Search: Before taking any action in the real world, the agent simulates sequences of actions in its model,
searching until it finds a sequence of actions that reaches the goal. Such a sequence is called a solution.
The agent might have to simulate multiple sequences that do not reach the goal, but eventually it will find
a solution (such as going from Arad to Sibiu to Fagaras to Bucharest), or it will find that no solution is
possible.
• Execution: The agent can now execute the actions in the solution, one at a time.
It is an important property that in a fully observable, deterministic, known environment, the solution to any
problem is a fixed sequence of actions: drive to Sibiu, then Fagaras, then Bucharest. If the model is correct,
then once the agent has found a solution, it can ignore its percepts while it is executing the actions—closing
its eyes, so to speak—because the solution is guaranteed to lead to the goal. Control theorists call this an
open-loop system: ignoring the percepts breaks the loop between agent and environment. If there is a
chance that the model is incorrect, or the environment is nondeterministic, then the agent would be safer
using a closed-loop approach that monitors the percepts.
• A set of possible states that the environment can be in. We call this the state space.
• The initial state that the agent starts in. For example: Arad.
• A set of one or more goal states. Sometimes there is one goal state (e.g., Bucharest), sometimes there is
a small set of alternative goal states, and sometimes the goal is defined by a property that applies to many
states (potentially an infinite number). For example, in a vacuum-cleaner world, the goal might be to have
no dirt in any location, regardless of any other facts about the state. We can account for all three of these
possibilities by specifying an IS-GOAL method for a problem. In this chapter we will sometimes say “the
goal” for simplicity, but what we say also applies to “any one of the possible goal states.”
Page - 2
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
• The actions available to the agent. Given a state s, ACTIONS(s) returns a finite set of actions that can be
executed in s. We say that each of these actions is applicable in s.
An example:
ACTIONS(Arad) = {ToSibiu,ToTimisoara,ToZerind}
• A transition model, which describes what each action does. RESULT(s, a) returns the state that results
from doing action a in state s. For example,
RESULT(Arad, ToZerind) = Zerind .
• An action cost function, denoted by ACTION-COST(s,a, s′) when we are programming or c(s,a, s′) when
we are doing math, that gives the numeric cost of applying action a in state s to reach state s′. A problem-
solving agent should use a cost function that reflects its own performance measure; for example, for route-
finding agents, the cost of an action might be the length in miles (as seen in Figure 3.1), or it might be the
time it takes to complete the action.
A sequence of actions forms a path, and a solution is a path from the initial state to a goal state. We assume
that action costs are additive; that is, the total cost of a path is the sum of the individual action costs. An
optimal solution has the lowest path cost among all solutions. In this chapter, we assume that all action
costs will be positive, to avoid certain complications.
The state space can be represented as a graph in which the vertices are states and the directed edges between
them are actions. The map of Romania shown in Figure 3.1 is such a graph, where each road indicates two
actions, one in each direction.
The process of removing detail from a representation is called abstraction. A good problem formulation
has the right level of detail. If the actions were at the level of “move the right foot forward a centimeter” or
“turn the steering wheel one degree left,” the agent would probably never find its way out of the parking
lot, let alone to Bucharest.
Can we be more precise about the appropriate level of abstraction? Think of the abstract states and actions
we have chosen as corresponding to large sets of detailed world states and detailed action sequences. Now
consider a solution to the abstract problem: for example, the path from Arad to Sibiu to Rimnicu Vilcea to
Pitesti to Bucharest. This abstract solution corresponds to a large number of more detailed paths. For
example, we could drive with the radio on between Sibiu and Rimnicu Vilcea, and then switch it off for the
rest of the trip.
The abstraction is valid if we can elaborate any abstract solution into a solution in the more detailed world;
a sufficient condition is that for every detailed state that is “in Arad,” there is a detailed path to some state
that is “in Sibiu,” and so on. The abstraction is useful if carrying out each of the actions in the solution is
Page - 3
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
easier than the original problem; in our case, the action “drive from Arad to Sibiu” can be carried out
without further search or planning by a driver with average skill. The choice of a good abstraction thus
involves removing as much detail as possible while retaining validity and ensuring that the abstract actions
are easy to carry out.
Page - 4
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Page - 5
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Page - 6
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Touring problems describe a set of locations that must be visited, rather than a single goal destination.
The traveling salesperson problem (TSP) is a touring problem in which every city on a map must be visited.
The aim is to find a tour with cost. An enormous amount of effort has been expended to improve the
capabilities of TSP algorithms.
A VLSI layout problem requires positioning millions of components and connections on a chip to
minimize area, minimize circuit delays, minimize stray capacitances, and maximize manufacturing yield.
The layout problem comes after the logical design phase and is usually split into two parts: cell layout and
channel routing.
Robot navigation is a generalization of the route-finding problem described earlier. Rather than following
distinct paths (such as the roads in Romania), a robot can roam around, in effect making its own paths. For
a circular robot moving on a flat surface, the space is essentially two-dimensional.
Automatic assembly sequencing of complex objects (such as electric motors) by a robot has been standard
industry practice since the 1970s. Algorithms first find a feasible assembly sequence and then work to
optimize the process. Minimizing the amount of manual human labor on the assembly line can produce
significant savings in time and cost.
Page - 7
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Page - 8
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
(Fig 3.1)
Page - 9
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Page - 10
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Page - 11
Introduction to AI and ML (21CS752) Prof. SHIVANANDA
Page - 12