0% found this document useful (0 votes)
2 views40 pages

2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
2 views40 pages

2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 40

Problem solving by searching

AI
Problem Solving Agents
• When the correct action to take is not immediately obvious, an agent may
need to plan ahead to consider a sequence of actions that form a path to
a goal state.
• Such agents is called a problem-solving agent, and the computational
process it undertakes is called search.

• Problem Solving Phases (four-phase problem-solving process):


– Goal formulation: Goals organize behaviour 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.
– 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.
– Execution: The agent can now execute the actions in the solution, one at a
time.
• Credits: AIMA by Peter N.
Example: Romania

• Credits: AIMA by Peter N.


Search problems and solutions
• A search problem can be defined formally as follows:

– 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.

– The actions available to the agent.


» ACTIONS (Arad) = {ToSibiu, ToTimisoara, ToZerind }

– A transition model, which describes what each action does.

– An action cost function, denoted by ACTION-COST(s,a,s").


Search problems and solutions
• A sequence of actions forms a path, and a solution is
a path from the initial state to a goal state.

• An optimal solution has the lowest path cost among


all solutions.

• The state space can be represented as a graph in


which the vertices are states and the directed edges
between them are actions.
Formulating problems
• Our formulation of the problem of getting to goal is a
model—an abstract mathematical description.

• The process of removing detail from a representation is called


abstraction.

• A good problem formulation has the right level of detail.

“The choice of a good abstraction involves removing as


much detail as possible while retaining validity and
ensuring that the abstract actions are easy to carry
out.”
Example: Vacuum world state-space graph
Search Algorithms

• A search algorithm takes a search problem as input and returns a


solution, or an indication of failure.

• A search tree over the statespace graph, forms various paths from
the initial state, trying to find a path that reaches a goal state.

• Each node in the search tree corresponds to a state in the state


space and the edges in the search tree correspond to actions.

• The state space describes the (possibly infinite) set of states in the
world, and the actions that allow transitions from one state to
another. The search tree describes paths between these states,
reaching towards the goal.
Search Tree
• We can expand the node, by considering the available ACTIONS for
that state, using the RESULT function to see where those actions
lead to, and generating a new node (called a child node or
successor node) for each of the resulting states.

• Essence of search—following up one option now and putting the


others aside for later.. We call this the frontier of the search tree.

• Note that the frontier separates two regions of the state-space


graph: an interior region where every state has been expanded,
and an exterior region of states that have not yet been reached.
• As a typical real-world example, consider a problem with branching factor
b = 10, processing speed 1 million nodes/second, and memory
requirements of 1 Kbyte/node.

• A search to depth d = 10 would take less than 3 hours, but would require
10 terabytes of memory. The memory requirements are a bigger problem
for breadth-first search than the execution time. But time is still an
important factor.

You might also like