3 problem-solving-
-
Upload
mhd-sb -
Category
Engineering
-
view
333 -
download
0
Transcript of 3 problem-solving-
![Page 1: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/1.jpg)
AI I: problem-solving and search
Lecturer: Tom LenaertsInstitut de Recherches Interdisciplinaires et de Développements en Intelligence Artificielle (IRIDIA)Université Libre de Bruxelles
![Page 2: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/2.jpg)
TLo (IRIDIA) 2May 1, 2023
Outline Problem-solving agents
A kind of goal-based agent Problem types
Single state (fully observable) Search with partial information
Problem formulation Example problems
Basic search algorithms Uninformed
![Page 3: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/3.jpg)
TLo (IRIDIA) 3May 1, 2023
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 give the goal
Search Determine the possible sequence of actions that lead to the states of
known values and then choosing the best sequence. Execute
Give the solution perform the actions.
![Page 4: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/4.jpg)
TLo (IRIDIA) 4May 1, 2023
Problem-solving agentfunction SIMPLE-PROBLEM-SOLVING-AGENT(percept) return an action
static: seq, an action sequencestate, some description of the current world stategoal, a goalproblem, a problem formulation
state UPDATE-STATE(state, percept)if seq is empty then
goal FORMULATE-GOAL(state)problem FORMULATE-PROBLEM(state,goal)seq SEARCH(problem)
action FIRST(seq)seq REST(seq)return action
![Page 5: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/5.jpg)
TLo (IRIDIA) 5May 1, 2023
Example: Romania
![Page 6: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/6.jpg)
TLo (IRIDIA) 6May 1, 2023
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, …
![Page 7: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/7.jpg)
TLo (IRIDIA) 7May 1, 2023
Problem types Deterministic, fully observable single state problem
Agent knows exactly which state it will be in; solution is a sequence.
Partial knowledge of states and actions: Non-observable sensorless or conformant problem
Agent may have no idea where it is; solution (if any) is a sequence. Nondeterministic and/or partially observable contingency
problem Percepts provide new information about current state; solution is a
tree or policy; often interleave search and execution. Unknown state space exploration problem (“online”)
When states and actions of the environment are unknown.
![Page 8: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/8.jpg)
TLo (IRIDIA) 8May 1, 2023
Example: vacuum world Single state, start in #5.
Solution??
![Page 9: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/9.jpg)
TLo (IRIDIA) 9May 1, 2023
Example: vacuum world Single state, start in #5.
Solution?? [Right, Suck]
![Page 10: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/10.jpg)
TLo (IRIDIA) 10May 1, 2023
Example: vacuum world Single state, start in #5.
Solution?? [Right, Suck]
Sensorless: start in {1,2,3,4,5,6,7,8} e.g Right goes to {2,4,6,8}. Solution??
Contingency: start in {1,3}. (assume Murphy’s law, Suck can dirty a clean carpet and local sensing: [location,dirt] only. Solution??
![Page 11: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/11.jpg)
TLo (IRIDIA) 11May 1, 2023
Problem formulation A problem is defined by:
An initial state, e.g. Arad Successor function S(X)= set of action-state pairs
e.g. S(Arad)={<Arad Zerind, Zerind>,…}intial state + successor function = state space Goal test, can be
Explicit, e.g. x=‘at bucharest’ Implicit, e.g. checkmate(x)
Path cost (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.Optimal solution has the lowest path cost.
![Page 12: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/12.jpg)
TLo (IRIDIA) 12May 1, 2023
Selecting a state space Real world is absurdly complex.
State space must be abstracted for problem solving. (Abstract) state = set of real states. (Abstract) action = complex combination of real actions.
e.g. Arad Zerind represents a complex set of possible routes, detours, rest stops, etc.
The abstraction is valid if the path between two states is reflected in the real world.
(Abstract) solution = set of real paths that are solutions in the real world.
Each abstract action should be “easier” than the real problem.
![Page 13: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/13.jpg)
TLo (IRIDIA) 13May 1, 2023
Example: vacuum world
States?? Initial state?? Actions?? Goal test?? Path cost??
![Page 14: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/14.jpg)
TLo (IRIDIA) 14May 1, 2023
Example: vacuum world
States?? two locations with or without dirt: 2 x 22=8 states. Initial state?? Any state can be initial Actions?? {Left, Right, Suck} Goal test?? Check whether squares are clean. Path cost?? Number of actions to reach goal.
![Page 15: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/15.jpg)
TLo (IRIDIA) 15May 1, 2023
Example: 8-puzzle
States?? Initial state?? Actions?? Goal test?? Path cost??
![Page 16: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/16.jpg)
TLo (IRIDIA) 16May 1, 2023
Example: 8-puzzle
States?? Integer location of each tile Initial state?? Any state can be initial Actions?? {Left, Right, Up, Down} Goal test?? Check whether goal configuration is reached Path cost?? Number of actions to reach goal
![Page 17: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/17.jpg)
TLo (IRIDIA) 17May 1, 2023
Example: 8-queens problem
States?? Initial state?? Actions?? Goal test?? Path cost??
![Page 18: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/18.jpg)
TLo (IRIDIA) 18May 1, 2023
Example: 8-queens problem
Incremental formulation vs. complete-state formulation States?? Initial state?? Actions?? Goal test?? Path cost??
![Page 19: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/19.jpg)
TLo (IRIDIA) 19May 1, 2023
Example: 8-queens problem
Incremental formulation States?? Any arrangement of 0 to 8 queens on the board Initial state?? No queens Actions?? Add queen in empty square Goal test?? 8 queens on board and none attacked Path cost?? None
3 x 1014 possible sequences to investigate
![Page 20: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/20.jpg)
TLo (IRIDIA) 20May 1, 2023
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 another. Actions?? Add queen in leftmost empty column such that is not attacking other
queens2057 possible sequences to investigate; Yet makes no difference when n=100
![Page 21: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/21.jpg)
TLo (IRIDIA) 21May 1, 2023
Example: robot assembly
States?? Initial state?? Actions?? Goal test?? Path cost??
![Page 22: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/22.jpg)
TLo (IRIDIA) 22May 1, 2023
Example: robot assembly
States?? Real-valued coordinates of robot joint angles; parts of the object to be assembled.
Initial state?? Any arm position and object configuration. Actions?? Continuous motion of robot joints Goal test?? Complete assembly (without robot) Path cost?? Time to execute
![Page 23: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/23.jpg)
TLo (IRIDIA) 23May 1, 2023
Basic search algorithms How do we find the solutions of previous problems?
Search the state space (remember complexity of space depends on state representation)
Here: search through explicit tree generation ROOT= initial state. Nodes and leafs generated through successor function.
In general search generates a graph (same state through multiple paths)
![Page 24: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/24.jpg)
TLo (IRIDIA) 24May 1, 2023
Simple tree search example
function TREE-SEARCH(problem, strategy) return a solution or failureInitialize search tree to the initial state of the problemdo if no candidates for expansion then return failurechoose leaf node for expansion according to strategyif node contains goal state then return solutionelse expand the node and add resulting nodes to the search treeenddo
![Page 25: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/25.jpg)
TLo (IRIDIA) 25May 1, 2023
Simple tree search example
function TREE-SEARCH(problem, strategy) return a solution or failureInitialize search tree to the initial state of the problemdo if no candidates for expansion then return failurechoose leaf node for expansion according to strategyif node contains goal state then return solutionelse expand the node and add resulting nodes to the search treeenddo
![Page 26: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/26.jpg)
TLo (IRIDIA) 26May 1, 2023
Simple tree search example
function TREE-SEARCH(problem, strategy) return a solution or failureInitialize search tree to the initial state of the problemdo if no candidates for expansion then return failurechoose leaf node for expansion according to strategyif node contains goal state then return solutionelse expand the node and add resulting nodes to the search treeenddo
Determines search process!!
![Page 27: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/27.jpg)
TLo (IRIDIA) 27May 1, 2023
State space vs. search tree
A state is a (representation of) a physical configuration A node is a data structure belong to a search tree
A node has a parent, children, … and ncludes path cost, depth, … Here node= <state, parent-node, action, path-cost, depth> FRINGE= contains generated nodes which are not yet expanded.
White nodes with black outline
![Page 28: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/28.jpg)
TLo (IRIDIA) 28May 1, 2023
Tree search algorithmfunction TREE-SEARCH(problem,fringe) return a solution or failure
fringe INSERT(MAKE-NODE(INITIAL-STATE[problem]), fringe)loop do
if EMPTY?(fringe) then return failurenode REMOVE-FIRST(fringe)if GOAL-TEST[problem] applied to STATE[node] succeeds
then return SOLUTION(node)fringe INSERT-ALL(EXPAND(node, problem), fringe)
![Page 29: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/29.jpg)
TLo (IRIDIA) 29May 1, 2023
Tree search algorithm (2)function EXPAND(node,problem) return a set of nodes
successors the empty setfor each <action, result> in SUCCESSOR-FN[problem](STATE[node]) do
s a new NODESTATE[s] resultPARENT-NODE[s] nodeACTION[s] actionPATH-COST[s] PATH-COST[node] + STEP-COST(node, action,s)DEPTH[s] DEPTH[node]+1add s to successors
return successors
![Page 30: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/30.jpg)
TLo (IRIDIA) 30May 1, 2023
Search strategies A strategy is defined by picking the order of node expansion. Problem-solving performance is measured in four ways:
Completeness; Does it always find a solution if one exists? Optimality; Does it always find the least-cost solution? Time Complexity; Number of nodes generated/expanded? Space Complexity; Number of nodes stored in memory during search?
Time and space complexity are measured in terms of problem difficulty defined by: b - maximum branching factor of the search tree d - depth of the least-cost solution m - maximum depth of the state space (may be )
![Page 31: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/31.jpg)
TLo (IRIDIA) 31May 1, 2023
Uninformed search strategies (a.k.a. blind search) = use only information available in
problem definition. When strategies can determine whether one non-goal state is
better than another informed search. Categories defined by expansion algorithm:
Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search. Bidirectional search
![Page 32: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/32.jpg)
TLo (IRIDIA) 32May 1, 2023
BF-search, an example Expand shallowest unexpanded node Implementation: fringe is a FIFO queue
A
![Page 33: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/33.jpg)
TLo (IRIDIA) 33May 1, 2023
BF-search, an example Expand shallowest unexpanded node Implementation: fringe is a FIFO queue
A
B C
![Page 34: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/34.jpg)
TLo (IRIDIA) 34May 1, 2023
BF-search, an example Expand shallowest unexpanded node Implementation: fringe is a FIFO queue
A
B C
D E
![Page 35: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/35.jpg)
TLo (IRIDIA) 35May 1, 2023
BF-search, an example Expand shallowest unexpanded node Implementation: fringe is a FIFO queue
A
B C
D E F G
![Page 36: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/36.jpg)
TLo (IRIDIA) 36May 1, 2023
BF-search; evaluation Completeness:
Does it always find a solution if one exists? YES
If shallowest goal node is at some finite depth d Condition: If b is finite
(maximum num. Of succ. nodes is finite)
![Page 37: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/37.jpg)
TLo (IRIDIA) 37May 1, 2023
BF-search; evaluation Completeness:
YES (if b is finite) Time complexity:
Assume a state space where every state has b successors. root has b successors, each node at the next level has again b successors
(total b2), … Assume solution is at depth d Worst case; expand all but the last node at depth d Total numb. of nodes generated:
b b2 b3 ... bd (bd 1 b) O(bd 1)
![Page 38: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/38.jpg)
TLo (IRIDIA) 38May 1, 2023
BF-search; evaluation Completeness:
YES (if b is finite) Time complexity:
Total numb. of nodes generated:
Space complexity: Idem if each node is retained in memory
b b2 b3 ... bd (bd 1 b) O(bd 1)
![Page 39: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/39.jpg)
TLo (IRIDIA) 39May 1, 2023
BF-search; evaluation Completeness:
YES (if b is finite) Time complexity:
Total numb. of nodes generated:
Space complexity: Idem if each node is retained in memory
Optimality: Does it always find the least-cost solution? In general YES
unless actions have different cost.
b b2 b3 ... bd (bd 1 b) O(bd 1)
![Page 40: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/40.jpg)
TLo (IRIDIA) 40May 1, 2023
BF-search; evaluation Two lessons:
Memory requirements are a bigger problem than its execution time. Exponential complexity search problems cannot be solved by
uninformed search methods for any but the smallest instances.
DEPTH2 NODES TIME MEMORY
2 1100 0.11 seconds 1 megabyte
4 111100 11 seconds 106 megabytes
6 107 19 minutes 10 gigabytes
8 109 31 hours 1 terabyte
10 1011 129 days 101 terabytes
12 1013 35 years 10 petabytes
14 1015 3523 years 1 exabyte
![Page 41: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/41.jpg)
TLo (IRIDIA) 41May 1, 2023
Uniform-cost search Extension of BF-search:
Expand node with lowest path cost Implementation: fringe = queue ordered by path
cost.
UC-search is the same as BF-search when all step-costs are equal.
![Page 42: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/42.jpg)
TLo (IRIDIA) 42May 1, 2023
Uniform-cost search Completeness:
YES, if step-cost > (smal positive constant) Time complexity:
Assume C* the cost of the optimal solution. Assume that every action costs at least Worst-case:
Space complexity: Idem to time complexity
Optimality: nodes expanded in order of increasing path cost. YES, if complete.
O(bC*/ )
![Page 43: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/43.jpg)
TLo (IRIDIA) 43May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
![Page 44: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/44.jpg)
TLo (IRIDIA) 44May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
![Page 45: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/45.jpg)
TLo (IRIDIA) 45May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
![Page 46: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/46.jpg)
TLo (IRIDIA) 46May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
AB C
D E
H I
![Page 47: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/47.jpg)
TLo (IRIDIA) 47May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I
![Page 48: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/48.jpg)
TLo (IRIDIA) 48May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
AB C
D E
H I
![Page 49: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/49.jpg)
TLo (IRIDIA) 49May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I J K
![Page 50: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/50.jpg)
TLo (IRIDIA) 50May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I J K
![Page 51: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/51.jpg)
TLo (IRIDIA) 51May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I J K
![Page 52: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/52.jpg)
TLo (IRIDIA) 52May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I J K
F H
![Page 53: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/53.jpg)
TLo (IRIDIA) 53May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I J K
F H
L M
![Page 54: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/54.jpg)
TLo (IRIDIA) 54May 1, 2023
DF-search, an example Expand deepest unexpanded node Implementation: fringe is a LIFO queue (=stack)
A
B C
D E
H I J K
F H
L M
![Page 55: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/55.jpg)
TLo (IRIDIA) 55May 1, 2023
DF-search; evaluation Completeness;
Does it always find a solution if one exists? NO
unless search space is finite and no loops are possible.
![Page 56: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/56.jpg)
TLo (IRIDIA) 56May 1, 2023
DF-search; evaluation Completeness;
NO unless search space is finite. Time complexity;
Terrible if m is much larger than d (depth of optimal solution)
But if many solutions, then faster than BF-search
O(bm )
![Page 57: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/57.jpg)
TLo (IRIDIA) 57May 1, 2023
DF-search; evaluation Completeness;
NO unless search space is finite. Time complexity; Space complexity;
Backtracking search uses even less memory One successor instead of all b.
O(bm 1)
O(bm )
![Page 58: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/58.jpg)
TLo (IRIDIA) 58May 1, 2023
DF-search; evaluation Completeness;
NO unless search space is finite. Time complexity; Space complexity; Optimallity; No
Same issues as completeness Assume node J and C contain goal states
O(bm 1)
O(bm )
![Page 59: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/59.jpg)
TLo (IRIDIA) 59May 1, 2023
Depth-limited search Is DF-search with depth limit l.
i.e. nodes at depth l have no successors. Problem knowledge can be used
Solves the infinite-path problem. If l < d then incompleteness results. If l > d then not optimal. Time complexity: Space complexity:
O(bl )
O(bl)
![Page 60: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/60.jpg)
TLo (IRIDIA) 60May 1, 2023
Depth-limited algorithmfunction DEPTH-LIMITED-SEARCH(problem,limit) return a solution or failure/cutoff
return RECURSIVE-DLS(MAKE-NODE(INITIAL-STATE[problem]),problem,limit)
function RECURSIVE-DLS(node, problem, limit) return a solution or failure/cutoffcutoff_occurred? falseif GOAL-TEST[problem](STATE[node]) then return SOLUTION(node)else if DEPTH[node] == limit then return cutoffelse for each successor in EXPAND(node, problem) do
result RECURSIVE-DLS(successor, problem, limit)if result == cutoff then cutoff_occurred? trueelse if result failure then return result
if cutoff_occurred? then return cutoff else return failure
![Page 61: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/61.jpg)
TLo (IRIDIA) 61May 1, 2023
Iterative deepening search What?
A general strategy to find best depth limit l. Goals is found at depth d, the depth of the shallowest
goal-node. Often used in combination with DF-search
Combines benefits of DF- en BF-search
![Page 62: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/62.jpg)
TLo (IRIDIA) 62May 1, 2023
Iterative deepening searchfunction ITERATIVE_DEEPENING_SEARCH(problem) return a solution or failure
inputs: problem
for depth 0 to ∞ doresult DEPTH-LIMITED_SEARCH(problem, depth)if result cuttoff then return result
![Page 63: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/63.jpg)
TLo (IRIDIA) 63May 1, 2023
ID-search, example Limit=0
![Page 64: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/64.jpg)
TLo (IRIDIA) 64May 1, 2023
ID-search, example Limit=1
![Page 65: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/65.jpg)
TLo (IRIDIA) 65May 1, 2023
ID-search, example Limit=2
![Page 66: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/66.jpg)
TLo (IRIDIA) 66May 1, 2023
ID-search, example Limit=3
![Page 67: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/67.jpg)
TLo (IRIDIA) 67May 1, 2023
ID search, evaluation Completeness:
YES (no infinite paths)
![Page 68: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/68.jpg)
TLo (IRIDIA) 68May 1, 2023
ID search, evaluation Completeness:
YES (no infinite paths) Time complexity:
Algorithm seems costly due to repeated generation of certain states. Node generation:
level d: once level d-1: 2 level d-2: 3 … level 2: d-1 level 1: d
N(IDS) (d)b (d 1)b2 ... (1)bd
N(BFS) b b2 ... bd (bd 1 b)
O(bd )
N(IDS) 50 400 3000 20000100000 123450N(BFS) 10 100 1000 10000100000 999990 1111100
Num. Comparison for b=10 and d=5 solution at far right
![Page 69: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/69.jpg)
TLo (IRIDIA) 69May 1, 2023
ID search, evaluation Completeness:
YES (no infinite paths) Time complexity: Space complexity:
Cfr. depth-first search
O(bd )
O(bd)
![Page 70: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/70.jpg)
TLo (IRIDIA) 70May 1, 2023
ID search, evaluation Completeness:
YES (no infinite paths) Time complexity: Space complexity: Optimality:
YES if step cost is 1. Can be extended to iterative lengthening search
Same idea as uniform-cost search Increases overhead.
O(bd )
O(bd)
![Page 71: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/71.jpg)
TLo (IRIDIA) 71May 1, 2023
Bidirectional search
Two simultaneous searches from start an goal. Motivation:
Check whether the node belongs to the other fringe before expansion. Space complexity is the most significant weakness. Complete and optimal if both searches are BF.
bd / 2 bd / 2 bd
![Page 72: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/72.jpg)
TLo (IRIDIA) 72May 1, 2023
How to search backwards?
The predecessor of each node should be efficiently computable. When actions are easily reversible.
![Page 73: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/73.jpg)
TLo (IRIDIA) 73May 1, 2023
Summary of algorithms
Criterion Breadth-First
Uniform-cost
Depth-First Depth-limited
Iterative deepening
Bidirectional search
Complete? YES* YES* NO YES, if l d
YES YES*
Time bd+1 bC*/e bm bl bd bd/2
Space bd+1 bC*/e bm bl bd bd/2
Optimal? YES* YES* NO NO YES YES
![Page 74: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/74.jpg)
TLo (IRIDIA) 74May 1, 2023
Repeated states Failure to detect repeated states can turn a solvable
problems into unsolvable ones.
![Page 75: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/75.jpg)
TLo (IRIDIA) 75May 1, 2023
Graph search algorithm Closed list stores all expanded nodes
function GRAPH-SEARCH(problem,fringe) return a solution or failureclosed an empty setfringe INSERT(MAKE-NODE(INITIAL-STATE[problem]), fringe)loop do
if EMPTY?(fringe) then return failurenode REMOVE-FIRST(fringe)if GOAL-TEST[problem] applied to STATE[node] succeeds
then return SOLUTION(node)if STATE[node] is not in closed then
add STATE[node] to closedfringe INSERT-ALL(EXPAND(node, problem), fringe)
![Page 76: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/76.jpg)
TLo (IRIDIA) 76May 1, 2023
Graph search, evaluation Optimality:
GRAPH-SEARCH discard newly discovered paths. This may result in a sub-optimal solution YET: when uniform-cost search or BF-search with constant step
cost Time and space complexity,
proportional to the size of the state space (may be much smaller than O(bd)).
DF- and ID-search with closed list no longer has linear space requirements since all nodes are stored in closed list!!
![Page 77: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/77.jpg)
TLo (IRIDIA) 77May 1, 2023
Search with partial information Previous assumption:
Environment is fully observable Environment is deterministic Agent knows the effects of its actions
What if knowledge of states or actions is incomplete?
![Page 78: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/78.jpg)
TLo (IRIDIA) 78May 1, 2023
Search with partial information (SLIDE 7) Partial knowledge of states and actions:
sensorless or conformant problem Agent may have no idea where it is; solution (if any) is a sequence.
contingency problem Percepts provide new information about current state; solution is a
tree or policy; often interleave search and execution. If uncertainty is caused by actions of another agent: adversarial
problem exploration problem
When states and actions of the environment are unknown.
![Page 79: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/79.jpg)
TLo (IRIDIA) 79May 1, 2023
Conformant problems start in {1,2,3,4,5,6,7,8}
e.g Right goes to {2,4,6,8}. Solution?? [Right, Suck, Left,Suck]
When the world is not fully observable: reason about a set of states that migth be reached=belief state
![Page 80: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/80.jpg)
TLo (IRIDIA) 80May 1, 2023
Conformant problems Search space of belief
states Solution = belief state
with all members goal states.
If S states then 2S belief states.
Murphy’s law: Suck can dirty a clear
square.
![Page 81: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/81.jpg)
TLo (IRIDIA) 81May 1, 2023
Belief state of vacuum-world
![Page 82: 3 problem-solving-](https://reader035.fdocuments.in/reader035/viewer/2022070509/58a3f9de1a28ab64528b5137/html5/thumbnails/82.jpg)
TLo (IRIDIA) 82May 1, 2023
Contingency problems Contingency, start in {1,3}. Murphy’s law, Suck can dirty a clean
carpet. Local sensing: dirt, location only.
Percept = [L,Dirty] ={1,3} [Suck] = {5,7} [Right] ={6,8} [Suck] in {6}={8} (Success) BUT [Suck] in {8} = failure
Solution?? Belief-state: no fixed action sequence
guarantees solution Relax requirement:
[Suck, Right, if [R,dirty] then Suck] Select actions based on contingencies
arising during execution.