0% found this document useful (0 votes)
34 views3 pages

Use Arch 6

1. Problem solving by searching involves formulating the problem as a state space with states, operators to change states, a goal test, and a path cost function. 2. A general search algorithm finds a sequence of actions to reach a goal state by initializing a search tree, expanding nodes according to a strategy, and repeating until a goal is found. 3. Uninformed search strategies like breadth-first, uniform cost, depth-first, and depth-limited searches do not use heuristics or costs and distinguish goals by testing states.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views3 pages

Use Arch 6

1. Problem solving by searching involves formulating the problem as a state space with states, operators to change states, a goal test, and a path cost function. 2. A general search algorithm finds a sequence of actions to reach a goal state by initializing a search tree, expanding nodes according to a strategy, and repeating until a goal is found. 3. Uninformed search strategies like breadth-first, uniform cost, depth-first, and depth-limited searches do not use heuristics or costs and distinguish goals by testing states.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Problem - solving by searching

Problem-solving agents (a type of goal-based agents)


Solving problems by Searching
• Problem solving steps:
Chapter 3 1. Goal formulation: What do we want to achieve?
Instructor: Kalle Prorok Preferences for certain ways to achieve the goal?
2. Problem formulation: Define the ”world” in terms of
states and the operators causing a changes of state. Most
important to get the description adequate for the goal.
The state(s) corresponding to the goal are the ”goal state(s)”.
3. Search: Find a sequence of actions leading to a goal state.
4. Execute the solution.

1 2

Problem - solving by searching Problem - solving by searching

Formulating Problems • Formal definition of a single state problem:


• Types of problems depending on vagueness: 1. State space description. Should describe the relevant
properties of the agent and the world.
1. Single state problems:
State is always known with certainty.
2. Multiple state problems:
1 2. Operators (actions). Causes a move to another state.
Use abstraction in 1. and 2 to remove details that are irrelevant!
Not full knowledge of which state the agent is in.
3. Goal test operating on states. The goal may be defined as a
3. Contingency problems:
(“contingency”=“tänkbar möjlighet”) specific state or by a property of the states.
Not full knowledge of the new state caused by an action. 4. Path cost function. Necessary for evaluation of the solution.
4. Exploration problems: Agent must learn the effect of Normally the sum of the costs for all actions along the
actions and what sorts of states exist. solution path.
5. Initial state.
3 4

Problem - solving by searching Problem - solving by searching

A General Search algorithm The search tree


• Find a sequence of actions leading from the initial state to • Consists of nodes with the following components
a goal state: 1. Corresponding state in state space.
1. Initialise the search tree with the initial state. (the search tree may therefor be viewed as superimposed
2. Report failure if search tree is empty over the state space).
3. Move to a leaf node according to a strategy 2. The parent node (to enable backtracking)
4. Ready if a goal state. 3. The operator that was applied to the parent node
5. Expand the current state by generating successors to the 4. The depth of the node (number of nodes in the path from
current state. Add them to the search tree as leaves. the root to this node).
6. Repeat from 2. 5. The path cost of the path from the root to this node.

5 6

1
Problem - solving by searching Problem - solving by searching

Expanding the nodes in search tree • Measuring performance for a search algorithm:
1. Completeness : Does it find a solution if there is one?
• The leaf nodes are normally collected in a queue for 2. Time complexity: How long does it take to find the solution?
reasons of efficiency. 3. Space complexity: How much memory is required?
• The way new nodes are added to the queue distinguishes 4. Optimality: Is it the best possible solution?
the different search methods. Note that an Optimal algorithm only is guaranteed to find the
• Branching factor b :The number of new states generated best solution. The time and space requirements may still be a
when expanding a state. disadvantage.
The maximum number of states in a search tree of depth d
is:
b d? 1 ? 1
1? b ? b 2 ? ? ? b d ?
?? b?1
7 8

Problem - solving by searching Problem - solving by search

Uninformed Search strategies Breadth first search.


Have no information about the distance or cost to the goal • 1. Set N to be a list of initial nodes.
state. Can only distinguish a goal state from a non goal state. • 2. If N is empty, then exit and signal failure.

• Breadth first.
2 • 3. Set n to be the first node in N, and remove n from N.
• 4. If n is a goal node, then exit and signal success.
• Uniform cost. • 5. Otherwise, add the children of n to the end of N and
• Depth first. return to step 2.
• Depth limited. Complete. I.e: Finds a goal node if such node exists even if
• Iterative Deepening. the tree has infinite depth.
Uses space proportional to bd which may be a lot!

9 10

Problem - solving by search Problem - solving by search

Uniform cost search.


Depth first search.
Breadth first search finds the shallowest goal state, but this
may not always be the least-cost goal state.
Uniform cost search modifies the breadth first strategy by • 1. Set N to be a list of initial nodes.
always expanding the lowest-cost leaf (as measured by the • 2. If N is empty, then exit and signal failure.
path cost g(n)). • 3. Set n to be the first node in N, and remove n from N.
Breadth first search is a special case of uniform cost search • 4. If n is a goal node, then exit and signal success.
with g(n)=DEPTH(n) • 5. Otherwise, add the children of n to the front of N and
return to step 2.
Uniform cost search is complete and optimal iff g never
decreases along any path (fullfilled if g(n) is accumulated
distance from the start node to node n).
11 12

2
Problem - solving by search Problem - solving by search

Depth first search (cont.) Depth limited search.


• Depth first search is space efficient. d(b-1)+1
• May not terminate. • It is the Depth first search down to some cut-off.
• If the tree is the same depth as the goal, in the worst case, • Is complete if the cut-off is correct
it examines every nodes. The total time is • Is not optimal

b d? 1 ? 1
1? b ? b 2 ? ? ? b d ?
?? b?1

13 14

Problem - solving by search Problem - solving by search

Iterative deepening search. Repeated states.


It is a strategy that side-steps the issue of choosing the best Unavoidable for many problems
depth limit by trying all possible depth limits. (refer to fig 3.19 page 82)
• 1. Set N to be a list of initial nodes.
• 2. If N is empty, then exit and signal failure.
3 Three ways to deal with the problem:
• 3. Set n to be the first node in N, and remove n from N. • Avoid to return to the state you just came from.
• 4. If n is a goal node, then exit and signal success. • Check if new nodes contain a state already in the path
• 5. If the depth of n is equal to max, then go to step 2. • Check if new nodes have been generated before (in any
• 6. Otherwise, add the children of n to the front of N and path)
return to step 2

15 16

You might also like