Wa0015.
Wa0015.
Intelligent agents are supposed to maximize their performance measure. Imagine an agent in the city of
Arad, Romania, enjoying a touring holiday. The agent’sperformance measure contains many factors: it
wants to improve its suntan, improve its Romanian,take in the sights, enjoy the nightlife (such as it is),
avoid hangovers, and so on. The decision problem is a complex one involving many tradeoffs and careful
reading. And destination is Bucharest.
In that case, it makes sense for the agent to adopt the goal of getting to Bucharest.Courses of action.
Goal formulation, based on the current situation and the agent’s performance measure, is the first step in
problem solving.
Problem formulation is the process of deciding what actions and states to consider, given a goal.
function SIMPLE-PROBLEM-SOLVING-AGENT( percept) returns an action
persistent: seq, an action sequence, initially empty
state, some description of the current world state
goal , a goal, initially null
problem, a problem formulation
state ← UPDATE-STATE(state, percept )
if seq is empty then
goal ← FORMULATE-GOAL(state)
problem ← FORMULATE-PROBLEM(state, goal )
seq ← SEARCH( problem)
if seq = failure then return a null action
action ← FIRST(seq)
seq ← REST(seq)
return action
Figure 3.1 A simple problem-solving agent. It first formulates a goal and a problem, searches
for a sequence of actions that would solve the problem, and then executes the actions one at
a time. When this is complete, it formulates another goal and starts over.
The problem-solving approach has been applied to a vast array of task environments. We
list some of the best known here, distinguishing between toy and real-world problems. A toy problem is
intended to illustrate or exercise various problem-solving methods.
A real-world problem is one whose solutions people actually care about. Such problems tend not to
have a single agreed-upon description, but we can give the general flavor of their formulations.
3.2.1 Toy problems
⮚ The first example we examine is the vacuum world first introduced in Chapter 2. (See
Figure 2.2.) 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 Figure 3.3.
• 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.
⮚ The 8-puzzle, an instance of which is shown in Figure 3.4, consists of a 3×3 board with
eight numbered tiles and a blank space. A tile adjacent to the blank space can slide into the
space. The object is to reach a specified goal state, such as the one shown on the right of the
figure. The standard formulation is as follows:
• States: A state description specifies the location of each of the eight tiles and the blank
in one of the nine squares.
• Initial state: Any state can be designated as the initial state. Note that any given goal
can be reached from exactly half of the possible initial states (Exercise 3.5).
• Actions: The simplest formulation defines the actions as movements of the blank space
Left, Right, Up, or Down. Different subsets of these are possible depending on where
the blank is.
• Transition model: Given a state and action, this returns the resulting state; for example,
if we apply Left to the start state in Figure 3.4, the resulting state has the 5 and the blank
switched.
• Goal test: This checks whether the state matches the goal configuration shown in Figure
3.4. (Other goal configurations are possible.)
• Path cost: Each step costs 1, so the path cost is the number of steps in the path.
⮚ The goal of the 8-queens problem is to place eight queens on a chessboard such that
no queen attacks any other. (A queen attacks any piece in the same row, column or diagonal.)
Figure 3.5 shows an attempted solution that fails: the queen in the rightmost column is
attacked by the queen at the top left.
1.The route-finding problem is defined in terms of specified locations and transitions along links
between them. Route-finding algorithms are used in a variety of applications. Others, such as routing
video streams in computer networks, military operations planning, and airline travel-planning systems,
involve much more complex specifications.
The airline travel problems that must be solved by a travel-planning Web site:
• States: Each state obviously includes a location (e.g., an airport) and the current time.
Furthermore, because the cost of an action (a flight segment) may depend on previous
segments, their fare bases, and their status as domestic or international, the state must
record extra information about these “historical” aspects.
• Initial state: This is specified by the user’s query.
• Actions: Take any flight from the current location, in any seat class, leaving after the
current time, leaving enough time for within-airport transfer if needed.
• Transition model: The state resulting from taking a flight will have the flight’s destination
as the current location and the flight’s arrival time as the current time.
• Goal test: Are we at the final destination specified by the user?
• Path cost: This depends on monetary cost, waiting time, flight time, customs and immigration
procedures, seat quality, time of day, type of airplane, frequent-flyer mileage awards, and so on.
However, that not all air travel goes according to plan. A really good system should include contingency
plans—such as backup reservations on alternate flights— to the extent that these are justified by the cost
and likelihood of failure of the original plan.
2. Touring problems are closely related to route-finding problems, for example, the problem “Visit every
city in Figure 3.2 at least once, starting and ending in Bucharest.” The state space, however, is quite
different. Each state must include not just the current location but also the set of cities the agent has
visited.
3.The traveling salesperson problem (TSP) is a touring problem in which each city must be visited
exactly once. The aim is to find the shortest tour.
4.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. The aim is to place the cells on the chip so that they do not overlap and so that there
is room for the connecting wires to be placed between the cells. These search problems are extremely
complex, but definitely worth solving.
5.Robot navigation is a generalization of the route-finding problem described earlier.
Rather than following a discrete set of routes, a robot can move in a continuous space with
(in principle) an infinite set of possible actions and states. When the robot has arms and legs or
wheels that must also be controlled, the search space becomes many-dimensional.
6.Automatic assembly sequencing: In assembly
problems, the aim is to find an order in which to assemble the parts of some object. If the
wrong order is chosen, there will be no way to add some part later in the sequence without undoing some
of the work already done. Checking a step in the sequence for feasibility is a
difficult geometrical search problem closely related to robot navigation. Thus, the generation
of legal actions is the expensive part of assembly sequencing.
Uninformedsearch (also called blind search). The term means that the strategies have no additional
information about states beyond that provided in the problem definition.
whereas breadth-first-search uses a FIFO queue, depth-first search uses a LIFO queue.
A LIFO queue means that the most recently generated node is chosen for expansion. This
must be the deepest unexpanded node because it is one deeper than its parent—which, in turn,
was the deepest unexpanded node when it was selected.
3.4.4 Depth-limited search
The embarrassing failure of depth-first search in infinite state spaces can be alleviated by
supplying depth-first search with a predetermined depth limit ℓ. That is, nodes at depth ℓ are
treated as if they have no successors. This approach is called depth-limited search.
The depth limit solves the infinite-path problem. Unfortunately, it also introduces an additional
source of incompleteness if we choose ℓ < d, that is, the shallowest goal is beyond the depth
limit. (This is likely when d is unknown.) Depth-limited search will also be nonoptimal if
we choose ℓ > d. Its time complexity is O(bℓ) and its space complexity is O(bℓ). Depth-first
search can be viewed as a special case of depth-limited search with ℓ=∞.
Iterative deepening search (or iterative deepening depth-first search) is a general strategy,
often used in combination with depth-first tree search, that finds the best depth limit. It does
this by gradually increasing the limit—first 0, then 1, then 2, and so on—until a goal is found.
This will occur when the depth limit reaches d, the depth of the shallowest goal node. The
algorithm is shown in Figure 3.18. Iterative deepening combines the benefits of depth-first
and breadth-first search.
3.4.6 Bidirectional search
The idea behind bidirectional search is to run two simultaneous searches—one forward from
the initial state and the other backward from the goal—hoping that the two searches meet in
the middle (Figure 3.20). The motivation is that bd/2 + bd/2 is much less than bd, or in the
figure, the area of the two small circles is less than the area of one big circle centered on the
start and reaching to the goal.
Bidirectional search requires a method for computing predecessors. When all the actions in the state space
are reversible, the predecessors of x are just its successors. Other cases may require substantial ingenuity.
==============================================================
h(n) = estimated cost of the cheapest path from the state at node n to a goal state.
Greedy best-first search8 tries to expand the node that is closest to the goal, on the grounds
that this is likely to lead to a solution quickly. Thus, it evaluates nodes by using just the heuristic function;
that is, f(n) = h(n).
Let us see how this works for route-finding problems in Romania; we use the straightline
distance heuristic, which we will call hSLD. If the goal is Bucharest, we need to know the straight-line
distances to Bucharest, which are shown in Figure 3.22.
3.5.2 A* search: Minimizing the total estimated solution cost
The most widely known form of best-first search is called A∗ search (pronounced “A-star search”). It
evaluates nodes by combining g(n), the cost to reach the node, and h(n), the cost
to get from the node to the goal:f(n) = g(n) + h(n) .
Since g(n) gives the path cost from the start node to node n, and h(n) is the estimated cost
of the cheapest path from n to the goal, we have
f(n) = estimated cost of the cheapest solution through n .
Thus, if we are trying to find the cheapest solution, a reasonable thing to try first is the
node with the lowest value of g(n) + h(n). It turns out that this strategy is more than just
reasonable: provided that the heuristic function h(n) satisfies certain conditions, A∗ search is
both complete and optimal. The algorithm is identical to UNIFORM-COST-SEARCH except
that A∗ uses g + h instead of g.
A heuristic function, is a function that calculates an approximate cost to a problem (or
ranks alternatives). For example the problem might be finding the shortest driving distance to a
point. A heuristic cost would be the straight line distance to the point.
A* search:
3.5.3 Memory-bounded heuristic search
The simplest way to reduce memory requirements for A∗ is to adapt the idea of iterative
deepening to the heuristic search context, resulting in the iterative-deepening A∗ (IDA∗) algorithm.
Memory-bounded algorithms are RBFS and MA∗.
Recursive best-first search (RBFS) is a simple recursive algorithm that attempts to
mimic the operation of standard best-first search, but us only linear space
Two algorithms that do this are MA∗ (memory-bounded A∗) and SMA∗ (simplified MA∗). SMA∗ MA* is—
well—simpler, so we will describe it. SMA∗ proceeds just like A∗, expanding the best leaf until memory
is full.
At this point, it cannot add a new node to the search tree without dropping an old one. SMA∗
always drops the worst leaf node—the one with the highest f-value. Like RBFS, SMA∗
then backs up the value of the forgotten node to its parent. In this way, the ancestor of a
forgotten subtree knows the quality of the best path in that subtree.
■ 8-puzzle
■ The average solution cost for a randomly generated 8-puzzle instance is about 22 step
■ The branching factor is about 3
■ h1(s)=8
■ h2 = the sum of the distances of the tiles from their goal positions (Manhattan
distance).
h2(s)=3+1+2+2+2+3+3+2=18
Admissible Heuristics:
■ A heuristic h(n) is admissible if for every node n,
h(n) ≤ h*(n),
where h*(n) is the true cost to reach the goal state from n.
■ An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic (or
at least, never pessimistic)
■ Theorem:
Dominance:
THEN h2 dominates h1
-------------------------------------------------------------------------------------------------------------------------------
Local search:
Advantages:
o
.
1. Local Maximum: A local maximum is a peak state in the landscape which is better than
each of its neighboring states, but there is another state also present which is higher than
the local maximum.
2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of the
current state contains the same value, because of this algorithm does not find any best direction to
move. A hill-climbing search might be lost in the plateau area.
3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher than its
surrounding areas, but itself has a slope, and cannot be reached in a single move.
In this algorithm, it holds k number of states at any given time. At the start, these
states are generated randomly. The successors of these k states are computed with the
help of objective function. If any of these successors is the maximum value of the
objective function, then the algorithm stops.
2.“Sexual Reproduction”: (combining) two parent states (selected proportionally to their fitness)
Encoding used for the “genome” of an individual strongly affects the behavior of the search
Each chromosome
•Evaluation of how well a solution with that set of properties solves the problem.
Encoding of a Chromosome
The chromosome encodes characteristics of the solution which it represents, often as a string of
binary digits.
Chromosome 1 1101100100110110
Chromosome 2 1101111000011110
● When the objective function is continuous. Then the graph of the function
creates a continuous subspace (like a surface) of the landscape.
● Gradient search: if the function is a scalar field of 3 variables, f(x, y, z) in R3,
then the gradient of this function:
● gives us the direction where the scalar field grows the most.
1. States
{1,2,…,8}
2. Actions
1. {Left,Right,Suck}
3. Goal
{7} or {8}
4. Non-deterministic:
1. When sucking a dirty square,it
cleans it and sometimes
cleans up
dirt in an adjacent square.
Depth first
Algorithm returns with failure when the current state is identical to one of ancestors
Slippery vacuum world: Left and Right actions sometimes fail (leaving the agent in the same location)
Solution?
--------------------------------------------------------------------------------------------------------------------
Agent is in one of several possible states and thus an action may lead to one of several
possible outcomes
Belief state: agent’s current belief about the possible states, given the sequence of actions
and observations up to that point.