Download presentation

Presentation is loading. Please wait.

Published byLexus Walsh Modified over 3 years ago

1
Artificial Intelligence Problem Solving Eriq Muhammad Adams eriq.adams@ub.ac.id

2
Outline Problem Solving Agents Problem Formulation Example Problems Basic Search Algorithms

3
Problem-Solving Agent environment agent ? sensors actuators

4
Problem-Solving Agent environment agent ? sensors actuators Formulate Goal Formulate Problem States Actions Find Solution

5
14 Jan 2004CS 3243 - Blind Search5 Problem-solving agents

6
Example: Route finding

7
Holiday Planning 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: Arad, Sibiu, Fagaras, Bucharest

8
Problem Formulation GoalStart States Actions Solution

9
Vacuum World

10
Search Problem State space ◦ each state is an abstract representation of the environment ◦ the state space is discrete Initial state Successor function Goal test Path cost

11
Search Problem State space Initial state: ◦ usually the current state ◦ sometimes one or several hypothetical states (“what if …”) Successor function Goal test Path cost

12
Search Problem State space Initial state Successor function: ◦ [state subset of states] ◦ an abstract representation of the possible actions Goal test Path cost

13
Search Problem State space Initial state Successor function Goal test: ◦ usually a condition ◦ sometimes the description of a state Path cost

14
Search Problem State space Initial state Successor function Goal test Path cost: ◦ [path positive number] ◦ usually, path cost = sum of step costs ◦ e.g., number of moves of the empty tile

15
Example: 8-puzzle 1 2 34 56 7 8123 456 78 Initial state Goal state

16
Example: 8-puzzle Size of the state space = 9!/2 = 181,440 15-puzzle .65 x 10 12 24-puzzle .5 x 10 25 10 million states/sec 0.18 sec 6 days 12 billion years

17
Example: Robot navigation What is the state space ?

18
Example: Robot navigation Cost of one horizontal/vertical step = 1 Cost of one diagonal step = 2

19
Example: Robot navigation

20
Assumptions in Basic Search The environment is static The environment is discretizable The environment is observable The actions are deterministic

21
Simple Agent Algorithm Problem-Solving-Agent 1. initial-state sense/read state 2. goal select/read goal 3. successor select/read action models 4. problem (initial-state, goal, successor) 5. solution search(problem) 6. perform(solution)

22
Search of State Space

27
search tree

28
Basic Search Concepts Search tree Search node Node expansion Search strategy: At each stage it determines which node to expand

29
Search Nodes States 1 2 34 56 7 8 1 2 34 56 7 8 1 2 34 56 78 1 3 56 8 1 3 4 56 7 8 2 47 2 1 2 34 56 7 8 The search tree may be infinite even when the state space is finite The search tree may be infinite even when the state space is finite

30
14 Jan 2004CS 3243 - Blind Search30 Implementation: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth The Expand function creates new nodes, filling in the various fields and using the SuccessorFn of the problem to create the corresponding states.

31
Node Data Structure STATE PARENT ACTION COST DEPTH If a state is too large, it may be preferable to only represent the initial state and (re-)generate the other states when needed If a state is too large, it may be preferable to only represent the initial state and (re-)generate the other states when needed

32
Fringe Set of search nodes that have not been expanded yet Implemented as a queue FRINGE ◦ INSERT(node,FRINGE) ◦ REMOVE(FRINGE) The ordering of the nodes in FRINGE defines the search strategy

33
Search Algorithm 1. If GOAL?(initial-state) then return initial-state 2. INSERT(initial-node,FRINGE) 3. Repeat: If FRINGE is empty then return failure n REMOVE(FRINGE) s STATE(n) For every state s’ in SUCCESSORS(s) Create a node n’ If GOAL?(s’) then return path or goal state INSERT(n’,FRINGE)

34
Search Strategies A strategy is defined by picking the order of node expansion Performance Measures: ◦ Completeness – does it always find a solution if one exists? ◦ Time complexity – number of nodes generated/expanded ◦ Space complexity – maximum number of nodes in memory ◦ Optimality – does it always find a least-cost solution Time and space complexity are measured in terms of ◦ b – maximum branching factor of the search tree ◦ d – depth of the least-cost solution ◦ m – maximum depth of the state space (may be ∞)

35
Remark Some problems formulated as search problems are NP-hard (non-deterministic polynomial-time hard) problems. We cannot expect to solve such a problem in less than exponential time in the worst- casenon-deterministic polynomial-time But we can nevertheless strive to solve as many instances of the problem as possible

36
Blind vs. Heuristic Strategies Blind (or uninformed) strategies do not exploit any of the information contained in a state (or use only the information available in the problem definition) Heuristic (or informed) strategies exploits such information to assess that one node is “more promising” than another

37
Blind Strategies Breadth-first ◦ Bidirectional Depth-first ◦ Depth-limited ◦ Iterative deepening Uniform-Cost Step cost = 1 Step cost = c(action) > 0

38
Breadth-First Strategy New nodes are inserted at the end of FRINGE 23 45 1 67 FRINGE = (1)

39
Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (2, 3) 23 45 1 67

40
Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (3, 4, 5) 23 45 1 67

41
Breadth-First Strategy New nodes are inserted at the end of FRINGE FRINGE = (4, 5, 6, 7) 23 45 1 67

42
Evaluation b: branching factor d: depth of shallowest goal node Complete Optimal if step cost is 1 Number of nodes generated: 1 + b + b 2 + … + b d + b(b d -1) = O(b d+1 ) Time and space complexity is O(b d+1 )

43
Time and Memory Requirements d#NodesTimeMemory 2111.01 msec11 Kbytes 411,1111 msec1 Mbyte 6~10 6 1 sec100 Mb 8~10 8 100 sec10 Gbytes 10~10 10 2.8 hours1 Tbyte 12~10 12 11.6 days100 Tbytes 14~10 14 3.2 years10,000 Tb Assumptions: b = 10; 1,000,000 nodes/sec; 100bytes/node

44
Bidirectional Strategy 2 fringe queues: FRINGE1 and FRINGE2 Time and space complexity = O(b d/2 ) << O(b d )

45
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45 FRINGE = (1)

46
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45 FRINGE = (2, 3)

47
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45 FRINGE = (4, 5, 3)

48
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

49
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

50
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

51
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

52
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

53
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

54
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

55
Depth-First Strategy New nodes are inserted at the front of FRINGE 1 23 45

56
Evaluation b: branching factor d: depth of shallowest goal node m: maximal depth of a leaf node Complete only for finite search tree Not optimal Number of nodes generated: 1 + b + b 2 + … + b m = O(b m ) Time complexity is O(b m ) Space complexity is O(bm)

57
Depth-Limited Strategy Depth-first with depth cutoff k (maximal depth below which nodes are not expanded) Three possible outcomes: ◦ Solution ◦ Failure (no solution) ◦ Cutoff (no solution within cutoff)

58
Iterative Deepening Strategy Repeat for k = 0, 1, 2, …: Perform depth-first with depth cutoff k Complete Optimal if step cost =1 Time complexity is: (d+1)(1) + db + (d-1)b 2 + … + (1) b d = O(b d ) Space complexity is: O(bd)

59
14 Jan 2004CS 3243 - Blind Search59 Iterative deepening search

60
14 Jan 2004CS 3243 - Blind Search60 Iterative deepening search l =0

61
14 Jan 2004CS 3243 - Blind Search61 Iterative deepening search l =1

62
14 Jan 2004CS 3243 - Blind Search62 Iterative deepening search l =2

63
14 Jan 2004CS 3243 - Blind Search63 Iterative deepening search l =3

64
Comparison of Strategies Breadth-first is complete and optimal, but has high space complexity Depth-first is space efficient, but neither complete nor optimal Iterative deepening is asymptotically optimal

65
Repeated States 8-queens No assembly planning Few 123 45 678 8-puzzle and robot navigation Many search tree is finitesearch tree is infinite

66
Avoiding Repeated States Requires comparing state descriptions Breadth-first strategy: ◦ Keep track of all generated states ◦ If the state of a new node already exists, then discard the node

67
Avoiding Repeated States Depth-first strategy: ◦ Solution 1: Keep track of all states associated with nodes in current tree If the state of a new node already exists, then discard the node Avoids loops ◦ Solution 2: Keep track of all states generated so far If the state of a new node has already been generated, then discard the node Space complexity of breadth-first

68
Detecting Identical States Use explicit representation of state space Use hash-code or similar representation

69
Uniform-Cost Strategy Each step has some cost > 0. The cost of the path to each fringe node N is g(N) = costs of all steps. The goal is to generate a solution path of minimal cost. The queue FRINGE is sorted in increasing cost. S 0 1 A 5 B 15 C SG A B C 5 1 10 5 5 G 11 G 10

70
Uniform-Cost Strategy

71
Summary Search tree state space Search strategies: breadth-first, depth-first, and variants Evaluation of strategies: completeness, optimality, time and space complexity Avoiding repeated states Optimal search with variable step costs

Similar presentations

Presentation is loading. Please wait....

OK

Search Strategies Reading: Russell’s Chapter 3 1.

Search Strategies Reading: Russell’s Chapter 3 1.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on types of agriculture in india Ppt on pre ignition curves Ppt on wild animals and their homes Convert word file to ppt online free Convert doc to ppt online Ppt on file system in unix command Ppt on object-oriented programming c++ Ppt on business environment nature concept and significance definition Download ppt on school management system Ppt on the rise of nationalism in europe class 10