Problem-solving agent
Four general steps in problem solving:
Goal formulation
What are the successful world states
Problem formulation
What actions and states to consider given the goal
Search
Examine different possible sequences of actions
that lead to states of known value and then choose
the best sequence
Execute
Perform actions on the basis of the solution 4
Example: Romania
5
Example: Romania
On holiday in Romania; currently in Arad
Flight leaves tomorrow from Bucharest
Formulate goal
Be in Bucharest
Formulate problem
States: various cities
Actions: drive between cities
Find solution
Sequence of cities; e.g. Arad, Sibiu, Fagaras, Bucharest,
…
6
Problem type
Given how we have defined the problem:
Environment is fully observable
Environment is deterministic
Environment is sequential
Environment is static
Environment is discrete
Environment is single-agent
7
Problem formulation
A problem is defined by:
An initial state, e.g. In(Arad)
A successor function S(X)= set of action-state pairs
e.g. S(In(Arad))={(Go(Sibiu), In(Sibiu)), (Go(Zerind), In(Zerind)),…}
initial state + successor function = state space
Goal test
Explicit, e.g. x=‘In(Bucharest)’
Implicit, e.g. checkmate(x)
Path cost (assume additive)
e.g. sum of distances, number of actions executed, …
c(x,a,y) is the step cost, assumed to be >= 0
A solution is a sequence of actions from initial to goal state;
the optimal solution has the lowest path cost
8
Example: 8-puzzle
States??
Initial state??
Actions??
Goal test??
Path cost??
9
Example: 8-puzzle
States: location of each tile plus blank
Initial state: Any state can be initial
Actions: Move blank {Left, Right, Up, Down}
Goal test: Check whether goal configuration is reached
Path cost: Number of actions to reach goal
10
Example: 8-queens problem
Incremental formulation vs. complete-state formulation
States??
Initial state??
Actions??
Goal test??
Path cost??
11
Example: 8-queens problem
Incremental formulation
States: Any arrangement of 0 to 8 queens on the board
Initial state: No queens
Actions: Add queen to any empty square
Goal test: 8 queens on board and none attacked
Path cost: N/A
3 x 1014 possible sequences to investigate 12
Example: 8-queens problem
Incremental formulation (alternative)
States?? n (0≤ n≤ 8) queens on the board, one per column in the n
leftmost columns with no queen attacking any other
Actions?? Add queen in leftmost empty column such that is not
attacking any other queen
2057 possible sequences to investigate; solutions are easy to find
But with 100 queens the problem is much harder
13
Real World Examples
Route-finding problems
Touring problems
Travelling Salesman problem
VLSI layout problem
Robot navigation
Automatic assembly sequencing
Internet searching
14