Lecture03 Uninformed Search (Part 1)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

TAI2151 – Artificial Intelligence

Fundamentals
Lecture 3 – Solving Problems
by Searching (Uninformed
Searches)
Part 1

Solving Problems By Searching – Uninformed Searches


Problem-Solving Agents

Problem-Solving agent is one that “has the ability to find


sequences of actions leading to desirable states.”
[Russell & Norvig]

Goal formulation (final state)


Problem formulation (actions & set of
states)
Search (solution)
Execution (follows states in solution)

Solving Problems By Searching – Uninformed Searches


A simple problem-solving agent

Solving Problems By Searching – Uninformed Searches


Well-defined problems and solutions
• A problem can be defined by four components:
• The initial state
• The set of possible actions available to the
agent. Most common is successor function.
Successor-Fn(x) returns a set of <action,
successor> ordered pairs.
• The goal test
• The path cost function (the path cost function is
often denoted by g.)

Solving Problems By Searching – Uninformed Searches


What’s a solution?
• Solution (path) – a sequence of actions leading from the
initial state to a goal state.

Solving Problems By Searching – Uninformed Searches


Problem formulation: Arad to Bucharest

Solving Problems By Searching – Uninformed Searches


Problem formulation: Arad to
Bucharest

Solving Problems By Searching – Uninformed Searches


Example:A simplified road map of Romania

Solving Problems By Searching – Uninformed Searches


Uninformed Search Strategies
Uninformed (blind) strategies use only the information
available in the problem definition vs. informed search
techniques which might have additional information
(e.g. a compass).
• Search
• Breadth-first search
• Uniform-cost search
• Depth-first search
• Depth-limited search
• Iterative deepening search
• Bidirectional search
• Constraint Satisfaction Search (Not covered!)
Solving Problems By Searching – Uninformed Searches
Example Problems
• Toy problems
• The 8-puzzle
• The 8-queen/n-queens
• Cryptarithmetic
• The vacuum world
• Missionaries and cannibals
• Real-world problems
• Route finding
• Touring and travelling salesperson (NP-hard)
• VLSI layout
• Robot navigation
• Assembly sequencing

Solving Problems By Searching – Uninformed Searches


The 8-puzzle problem: 3x3 board with 8 tiles & 1 blank

"move the blank up, down, left or right" than specifying actions that move
the individual tiles or the tiles in a particular location because the
branching factor of the search will be much less.”
Solving Problems By Searching – Uninformed Searches
The 8-puzzle problem Continued ...
• States: a state description specifies the location of
each of the eight tiles in one of the nine squares.
• Operators: blank moves left, right, up, or down.
• Goal test: state matches the goal configuration
shown in the right.
• Path: each step costs 1, so that the path cost is just
the length of the path.

Solving Problems By Searching – Uninformed Searches


The 8-queens problem

• The objective is to place eight queens on a chessboard such that


no queen threatens (attacks) another.
• A queen threatens (attacks) another queen in the same row,
column or in diagonal

In this example,
the two queens
on the corners
are the only
queens threatening
each other.

Goal test: 8 queens on board, none attacked.


Path cost: zero (why???)
Solving Problems By Searching – Uninformed Searches
The 8-queens problem continued ...

• The states and operators for this problem could be:


• States: any arrangement of 0 to 8 queens on the board.
• Operators: add a queen to any square.
This is a bad choice because there are
64x63x62x61x60x59x58x57 ≈ 1.8x1014 possible sequences
to investigate.
• A better formulation would be to choose a smarter
operator that
• States: any arrangement of 0 to 8 queens on the board.
• Operators: place a queen in the left-most empty column
such that it is not attacked by any other queen.
Now there are only 2057 possible sequences to investigate.

Solving Problems By Searching – Uninformed Searches


The vacuum world: Problem formulation

Solving Problems By Searching – Uninformed Searches


Solving Problems By Searching – Uninformed Searches
Real-World Problems
• Route finding
• routing in computer networks,
• automated travel advisory systems,
• airline travel planning systems
• Touring and travelling salesperson problems
• TSP - “ Visit every city exactly once, starting and ending in the same city.”
• VLSI layout
• Robot navigation
• Assembly sequencing

Solving Problems By Searching – Uninformed Searches


A Toy Example: A Romanian Holiday
The route-finding problem from Arad to Bucharest

• State space: Cities in Romania


• Initial state: Arad.
• Goal : Bucharest
• Operators: Drive between cities
• Solution: Sequence of cities
• Path cost: number of cities, distance, time, fuel

Solving Problems By Searching – Uninformed Searches


The state space

Solving Problems By Searching – Uninformed Searches


Search Algorithms
• Basic Idea: Offline exploration of state space by generating
successors of already-explored states (also known as
expanding states).

Solving Problems By Searching – Uninformed Searches


Search Algorithms - Implementation

Solving Problems By Searching – Uninformed Searches


Tree Search Example

Solving Problems By Searching – Uninformed Searches


Tree search example (cont.)

Solving Problems By Searching – Uninformed Searches


Tree search example (cont.)

Solving Problems By Searching – Uninformed Searches


The solution

Solving Problems By Searching – Uninformed Searches


States vs. nodes
* A state isa (representation of a) physical configuration.
*A node is a data structure constituting part of a search tree includes
parent, children, depth, path cost g(n).
* States do not have parents, children, depth, or path cost!

• A Node is a data structure with five components:


• the state in the state space to which the node corresponds;
• the node in search tree that generated this node (this is called the parent
node);
• the operator that was applied to generate the node;
• the number of nodes on the path from the root to this node (the depth of
the node);
• the path cost of the path from the initial state to the node.

Datatype node
components: STATE, PARENT-NODE, OPERATOR, DEPTH, PATH-COST
Solving Problems By Searching – Uninformed Searches
Nodes and States continued ...
• Node is a data structure to represent search tree for a particular
problem
• State represents a configuration of the world
• Fringe or frontier
• A collection of nodes that are waiting to be expanded
• A set of nodes can be represented as a queue with following operations
• MAKE-QUEUE(element,…) creates a queue with the given elements
• EMPTY?(queue) returns true if there are no more elements in the queue.
• FIRST(queue) returns the first element of the queue.
• REMOVE-FIRST(queue) returns FIRST(queue) and removes it.
• INSERT(element, queue) inserts an element into the queue and returns the
queue.
• INSERT-ALL(elements, queue) inserts a set of elements into the queue and returns
the queue.

Front Back

Solving Problems By Searching – Uninformed Searches


Nodes vs. States

Solving Problems By Searching – Uninformed Searches

You might also like