AI_Lecture_3
AI_Lecture_3
Lecture-3
Solving problems by searching
Content
• Problem Solving Agents
• Example Problems
• Searching for Solutions
• Summary
• Problem-solving agent
– A kind of goal-based agent
– It solves problem by
• finding sequences of actions that lead to desirable states
(goals)
– To solve a problem,
• the first step is the goal formulation, based on the current
situation
• Goals help organize behavior by limiting the objectives
that the agent is trying to achieve and hence the actions it
needs to consider
Goal formulation
• Defined as
– taking a problem
– and returns a solution
• Once a solution is found
– the agent follows the solution
– and carries out the list of actions – execution phase
• Design of an agent
– “Formulate, search, execute”
Well-defined problems and solutions
A problem is defined by 5 components:
• Initial state – that the agent starts in
• Actions
• Transition model or (Successor functions)
description of what each action does
successor to refer to any state reachable from a given state by a
single action
• Goal Test – determines whether a given state is a goal state
• Path Cost – sum of the costs of the individual actions along the path
path – assigns a numeric cost to each path
cost function reflects its own performance measure
In(Arad)
ACTIONS(s){
Go(Sibiu),
Go(Timisoara),
Go(Zerind)}
• Abstraction
– the process to take out the irrelevant information
– leave the most essential parts to the description of the states
( Remove detail from representation)
– Conclusion: Only the most important parts that are
contributing to searching are used
Example problems
• Toy problems
– those intended to illustrate or exercise various problem-
solving methods
– E.g., puzzle, chess, etc.
• Real-world problems
– tend to be more difficult and whose solutions people actually
care about
– E.g., Design, planning, etc.
Toy problems
• Example: vacuum world
Number of states: 8
Initial state: Any
Number of actions: 4
left, right, suck,
noOp
Goal: clean up all dirt
Goal states: {7, 8}
Path Cost:
Each step costs 1
The 8-puzzle
The 8-puzzle
• States:
– a state description specifies the location of each of the
eight tiles and blank in one of the nine squares
• Initial State:
– Any state in state space
• Successor function:
– the blank moves Left, Right, Up, or Down
• Goal test:
– current state matches the goal configuration
• Path cost:
– each step costs 1, so the path cost is just the length of the
path
8-queens problem
Solution
?
branch = action
node
Lecture-4
Search, Games and Problem Solving
The students have already understood some algorithms in 2nd
year Data Structure course.
This lecture is reading assignment for the students.
The students have to do group presentations.
Reference