CSC384: Intro to Artificial Intelligence Search II

CSC384: Intro to Artificial Intelligence Search II

CSC384: Intro to Artificial Intelligence Search II ●Announcements: 2 Tutorials on Fri Sep 22, 10-11am & 4-5pm Locations will be posted on the website {Arad}, {Zerind, Timisoara, Sibiu}, {Zerind, Timisoara, Arad, Oradea, Fagaras, RimnicuVilcea} {Zerind, Timisoara, Arad, Oradea, Sibiu, Bucharest, RimnicuVilcea} Solution: Arad -> Sibiu -> Fagaras -> Bucharest Cost: 140 + 99 + 211 = 450 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 1 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 2 {Arad} {Arad}, {Zerind, Timisoara, Sibiu}, {Zerind<Arad>, Timisoara<Arad>, Sibiu<Arad>}, {Zerind, Timisoara, Arad, Oradea, Fagaras, RimnicuVilcea} {Zerind<Arad>, Timisoara<Arad>, Oradea<Sibiu;Arad>, {Zerind, Timisoara, Arad, Oradea, Fagaras, Sibiu, Pitesti, Craiova<via Fagaras<Sibiu;Arad>, Arad<Sibiu;Arad>, RimnicuVilcea<Sibiu;Arad>} RimnicuVilcea>} {Zerind, Timisoara, Arad, Oradea, Fagaras, Sibiu, RimnicuVilcea, {Zerind<Arad>, Timisoara<Arad>, Oradea<Sibiu;Arad>, Craiova<via RimnicuVilcea>,Craiova<via Pitesti>, Bucharest} Fagaras<Sibiu;Arad>, RimnicuVilcea<Sibiu;Arad>, Zerind<Arad,Sibiu,Arad>, Timisoara<Arad,Sibiu,Arad>, Sibiu<Arad,Sibiu,Arad>} Solution: Arad -> Sibiu -> Rimnicu Vilcea -> Pitesti ->Bucharest Cost: 140 + 80 + 97 + 101 = 418 No solution found, search does not terminates because of cycles!. Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 3 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 4 Selection Rule. Critical Properties of Search. ●The example shows that order states are ●Completeness: will the search always find a selected from the frontier has a critical effect solution if a solution exists? on the operation of the search: ●Optimality: will the search always find the least ■ Whether or not a solution is found cost solution? (when actions have costs) ■ The cost of the solution found. ●Time complexity: what is the maximum ■ The time and space required by the search. number of nodes than can be expanded or generated? ●Space complexity: what is the maximum number of nodes that have to be stored in memory? Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 5 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 6 Uninformed Search Strategies Selecting vs. Sorting ●A simple equivalence we will exploit ●These are strategies that adopt a fixed rule for ■ Order the elements on the frontier. selecting the next state to be expanded. ■ Always select the first element. ●The rule does not change irrespective of the ●Any selection rule can be achieved by search problem being solved. employing an appropriate ordering of the ●These strategies do not take into account any frontier set. domain specific information about the particular search problem. ●Popular uninformed search techniques: ■ Breadth-First, Uniform-Cost, Depth-First, Depth-Limited, and Iterative-Deepening search Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 7 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 8 Breadth First. Breadth First Example. {0} ●Place the successors of the current state at the {1,2} end of the frontier. {2,2,3} {2,3,3,4} ●Example: {3,3,4,3,4} ■ let the states be the positive integers {0,1,2,…} ■ let each state n have as successors n+1 and n+2 {3,4,3,4,4,5} ● E.g. S(1) = {2, 3}; S(10) = {11, 12} … ■ Start state 0 ■ Goal state 5 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 9 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 10 Breadth First Properties Breadth First Properties ● Measuring time and space complexity. ●Completeness? ■let b be the maximum number of successors ■ The length of the path from the initial state to the of any state. expanded state must increase monotonically. ● we replace each expanded state with states on ■ let d be the number of actions in the longer paths. shortest solution. ● All shorter paths are expanded prior before any longer path. ■ Hence, eventually we must examine all paths of length d, and thus find the shortest solution. Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 11 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 12 Breadth First Properties Breadth First Properties ●Time Complexity? ●Space Complexity? ■ O(bd+1): If goal node is last node at level d, all of the successors of the other nodes will be on the frontier when the goal node is expanded b(bd –1) ● Optimality? ■ Will find shortest length solution ●least cost solution? No! ■ 1 + b + b2 + b3 + … + bd-1 + bd + b(bd –1) = O(bd+1) Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 13 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 14 Breadth First Properties Uniform Cost Search. ●Space complexity is a real problem. ●Keep the frontier sorted in increasing cost of ■ E.g., let b = 10, and say 1000 nodes can be the path to a node. expanded per second and each node requires 100 ●Always expand the least cost node. bytes of storage: ●Identical to Breadth first if each transition has Depth Nodes Time Memory the same cost. 1 1 1 millisec. 100 bytes 6 106 18 mins. 111 MB ●Example: 8 108 31 hrs. 11 GB ■ let the states be the positive integers {0,1,2,…} ■ let each state n have as successors n+1 and n+2 ●Run out of space long before we run out of ■ Say that the n+1 action has cost 2, while the n+2 time in most applications. action has cost 3. Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 15 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 16 Uniform-Cost Search Example Uniform-Cost Search (cost are shown in [ ], frontier sorted in increasing cost ) {0} ●Completeness? ■ If each transition has costs ≥ ε > 0. {1[2],2[3]} ■ The previous argument used for breadth first search {2[3],2[4],3[5]} holds: the cost of the expanded state must increase monotonically. {2[4],3[5],3[5],4[6]} {3[5],3[5],4[6],3[6],4[7]} … Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 17 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 18 Uniform-Cost Search Uniform-Cost Search ● Time and Space Complexity? ●Optimality? C*/ε ■O(b ) where C* is the cost of the optimal solution. ■ Finds optimal solution if each transition has cost ≥ ε ●Difficulty is that there may be many long paths > 0. with cost ≤ C*; Uniform-cost search must ● Explores paths in the search space in increasing explore them all. order of cost. So must find minimum cost path to a goal before finding any higher costs paths. Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 19 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 20 Uniform-Cost Search. Proof of Uniform-Cost Search. Proof of Optimality. Optimality. ● Claim: Let c(n) be the cost of the path to node n. If 2. Claim: When n is expanded every path with cost strictly less than c(n) has already been expanded (i.e., every node on it has n2 is expanded after n1 then been expanded). c(n1) ≤ c(n2). Proof: ● Let <Start, n0, n1, …, nk> be a path with cost less than c(n). Let ni be the last node on this path that has been expanded: Proof: there are 2 cases: <Start, n0, n1, ni-1, ni,ni+1, …, nk> a. n2 was on the frontier when n1 was expanded, in which case c(n2) ≥ c(n1) else n1 would not have been ● So, ni+1 must still be on the frontier. Also c(ni+1) < c(n) since selected for expansion. the cost of the entire path to nk is < c(n). ● But then uniform-cost would have expanded ni+1 not n. b. n2 was added to the frontier when n1 was expanded, in which case c(n2) ≥ c(n1) since the path ● So every node on this path must already be expanded, i.e., this to n2 extends the path to n1. path has already been expanded. QED Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 21 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 22 Uniform-Cost Search. Proof of Depth First Search Optimality. 3. Claim: The first time uniform-cost expands a state, it ●Place the successors of the current state at has found the minimal cost path to it (it might later find other paths to the same state). the front of the frontier. Proof: ● No cheaper path exists, else that path would have been expanded before. ● No cheaper path will be discovered later, as all those paths must be at least as expensive. ● So, when a goal state is expanded the path to it must be optimal. Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 23 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 24 Depth First Search Example Depth First Properties (applied to the example of Breadth First Search) {0} ●Completeness? No! ■ Infinite paths? Cause incompleteness! {1,2} {2,3,2} {3,4,3,2} ■ Prune paths with duplicate states? We get {4,5,4,3,2} completeness if state space is finite {5,6 4,5,4,3,2} … ●Optimality? No! Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 25 Hojjat Ghaderi [Courtesy of Fahiem Bacchus], University of Toronto, Fall 2006 26 Depth First Properties Depth First Backtrack Points ●Time Complexity? ●At each step, all nodes in the frontier (except ■ O(bm) where m is the length of the longest path in the head) are backtrack points (see example on the state space.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us