You are on page 1of 39

TEXT FOR THE WEEK- JEREMIAH 29:11

Under this topic, we’ll consider:


• How an agent can decide on what to do by
systematically considering the outcomes of various
sequence of actions (possibilities) that it might take.
• It is expected that intelligent agents act in a certain
way such that the
that
.
• We will further substantiate the fact that tasks get
somewhat simplified if an agent is able to adopt a
and aims to satisfy it.
5
A PROBLEM-SOLVING AGENT SCENARIO
• Imagine an agent from Vienna on a touring
vacation to the ancient city of Kano in northern
Nigeria.
• The agent has a ticket to fly out of Nigeria through
Lagos the next day (7am flight).
• The ticket fare is non-refundable, the agent’s visa is
about to expire, and after tomorrow, the next
available flight is in five weeks.

6
Figure 1: A partially defined
(customized) roadmap of
some cities in Nigeria 7
SCENARIO CONT’D
• Now, the agent’s performance measure contains many
other factors beside the cost of the ticket and the
undesirability of being arrested and deported.
• For example it wants to improve its spoken English, get
a suntan, capture more sights and so on.
• All these factors might suggest a vast array of possible
actions.
8
SCENARIO CONT’D
• However, given the seriousness of the situation, it
should be able to adopt the goal of driving down to
Lagos instead (
).
• Actions that will result in failure to reach Lagos on time
would be rejected without further consideration.
• Goals such as this help organize behaviour by limiting
the objectives that the agent is trying to achieve.
9
10
• What is goal formulation? This is the
first step towards solving a problem
( ).
• What is problem formulation?

11
• What is search?

.
• A search algorithm takes a as input and
returns a in the form of an
. Once a solution is found, the
recommended action is carried out. This is called
the
12
• We will consider a goal to be one out of a
set of – just those states in
which the goal can be satisfied.
can be viewed as operations
between world states,
so it is expected that the agent discovers
which set of actions will get it to a goal
state.

13
• A problem (
) consist of four
parts:
1. The : this is the state that the agent knows
itself to be in
2. A set of : this denotes the description of an
action in terms of which state will be reached by
carrying out an action while in a particular state.
[NB: 1 and 2 defines the state space or environment of the
problem]

14
Figure 1: A partially defined
(customized) roadmap of
some cities in Nigeria 15
3. A function: this is the action applied by the agent
to a single state description to ascertain if it is a goal state.
For example in chess, the goal is to reach a state called
“checkmate”, where the opponent’s king can be captured
on the next move no matter what the opponent does.
4. A function: in a case where one solution is
preferable to another, this becomes important. This
function assigns a cost to a path.

• A path through the state space from the initial state to a


goal state is called a solution. The output of a search
algorithm is also called a solution.
16
• Having established that a problem is the
collection of information that an agent
needs to decide how to arrive at a goal state,
it is noteworthy that states and actions are
the basic elements of problem definition.
• State space is used to specify the
information needed to define a single-state
problem
17
FORMULATE GOAL

EXECUTE FORMULATE PROBLEM

by searching

RECOGNIZE A SOLUTION

FIGURE 2. THE PROBLEM-SOLVING CYCLE 18


FORMULATING PROBLEMS

• In real life most problems are poorly defined; however


with some analysis, many problems can fit into the
state space model.
• A single general search algorithm can be used to solve
any problem; however, specific variants of the
algorithm embody different strategies as we will see
later.

19
FORMULATING PROBLEMS
• Also note that the actions an agent takes as
well as the state that it is in are both
functions of the amounts of knowledge that
the agent has.
• All of these also depend on the nature of
connection the agent has with its
environment through its percepts and
actuators with which actions are executed.
20
PROBLEM TYPES
There are four basic types of problems:
1. Single-state problems (enhanced sensors)
2. Multiple-state problems (limited sensors)
3. Exploration problems (limited knowledge of
environment)
4. Contingency problems (loss of function)

• Let us consider an
environment somewhat different from the Nigeria
problem described earlier
21
22
1. Let the (vacuum) environment world contain two
locations
2. Each location may or may not contain dirt, and the agent
may be in one location or the other.
3. There are eight possible world states as shown in figure 4
in the next slide.
4. The agent has three possible actions: left, right and suck.
• If we assume that sucking is 100% effective.
• GOAL – clean up all dirt i.e. the goal is equivalent to the
state set {7,8}

23
1 2

3 4 5 6

7 8
Measuring Problem-solving Performance
The effectiveness of a search can be measured
in at least three ways:
1. Does it find a solution?
2. Is it a good solution (one with low path
cost)?
3. What is the search cost associated with the
time and memory required to find a
solution?
25
Measuring Problem-solving Performance

• In theoretical computer science and in robotics, the


search cost (the part you do before interacting with
the environment) is called the OFFLINE COST and the
path cost is called the ONLINE COST
26
Choosing States and actions
• Now, let’s look at the problem from the scenario
introduced earlier: Drive from Kano to Lagos using the
roads in the map in Figure 1b.
• An appropriate state space has 22 states, where each
state is defined solely by location, specified as a city.
• Thus, the initial state is "in Kano" and the goal test is
“in Lagos”. The operators correspond to driving along
the roads between cities.
27
Figure 1b: A partially defined (customized) roadmap of Nigeria 28
Choosing States and actions cont’d
• One solution is the path Kano to Zaria to Kaduna to Minna
to Lokoja to Benin-City to Lagos.
• There are lots of other paths that are also solutions, for
example, via Gusau to Kontagora to Minna etc or via
Bauchi to Jos to Lafia etc.
• To decide which of these solutions is the best, we need to
know what the path cost function is measuring: it could be
the total mileage, or the expected travel time. Because our
map doesn’t specify either of these, we’ll use the number
of steps as the cost function. 29
Choosing States and actions cont’d
• That means that the path through Kano to Zaria to Kaduna
to Minna to Abuja to Lokoja to Benin-City to Ijebu-Ode to
Sagamu to Lagos, has a path cost of 9; question is: is this
the best possible solution?
• The real art of problem solving is in deciding what goes into
the and what is left
out. Compare the simple state description we have chosen,
"in Kano," to an actual cross-country trip, where the state
of the world includes so many things: the travelling
companions, what is being aired on the radio,… 30
Choosing States and actions cont’d
…what there is to look at out of the window, the vehicle
being used for the trip, how fast it is moving, whether there
are law enforcement officers nearby, what time it is, whether
the driver is hungry or tired or running out of gas, how far it
is to the next rest stop, the condition of the road, the
weather, and so on.
• All these considerations are left out of state descriptions
because they are irrelevant to the problem of finding a
route to Lagos. The process of removing
(unwanted/unnecessary) detail from a representation is
called . 31
EXAMPLE PROBLEMS
TOY PROBLEMS
1.The 8-puzzle problem
2.The 8-queens problem: here the goal is to
place 8 queens on a chess board such that
no queen attacks any other. A queen attacks
any piece in the same row, column or
diagonal
3.Missionaries and Cannibals 32
The 8-Puzzle Problem

2 5 1 2 3
1 4 8 4 5 6
7 3 6 7 8
33
The 8-Queens Problem

34
Missionaries and Cannibals

35
EXAMPLE PROBLEMS
REAL WORLD PROBLEMS
1. – as can be seen in a variety of applications
such as routing in computer networks, automated travel
advisory systems and this
application is somewhat more complicated, because airline
travel has a very complex path cost, in terms of money, time
of day, type of airplane, frequent-flyer – also, certain actions
do not have known outcomes e.g. flights can be late or
overbooked, connections can be missed and fog or
emergency maintenance can cause delays . 36
EXAMPLE PROBLEMS
REAL WORLD PROBLEMS
2. – Consider the
problem, "Visit all the 22 cities traversable in Figure 1 at least once,
starting and ending in Lagos." This seems very similar to route
finding, because the operators still correspond to trips between
adjacent cities. But for this problem, the must record
more information. In addition to the agent's location, each state
must keep track of the set of cities the agent has visited. So the initial
state would be "In Lagos; visited {Lagos}," a typical intermediate
state would be "In Benin-City; visited {Lagos, Sagamu, Ijebu-Ode,
Benin-City}," and the goal test would check if the agent is in Lagos
and that all 22 cities have been visited.
37
EXAMPLE PROBLEMS
REAL WORLD PROBLEMS
3. - A typical VLSI chip can have as
many as a million gates, and the positioning and
connections of every gate are crucial to the
successful operation of the chip. Computer-aided
design tools are used in every phase of the
process. Two of the most difficult tasks are cell
layout and channel routing.
38
EXAMPLE PROBLEMS
REAL WORLD PROBLEMS
4. Assembly sequencing – In assembly problems, the problem
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.
. Thus,
the generation of legal successors is the expensive part of
assembly sequencing, and the use of informed algorithms (as
against the uninformed) to reduce search is essential.
39

You might also like