Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reading Material Sections 3.3 – 3.5 Sections 4.1 – 4.2 “Optimal Rectangle Packing: New Results” By R. Korf (optional) “Optimal Rectangle Packing: A Meta-CSP.

Similar presentations


Presentation on theme: "Reading Material Sections 3.3 – 3.5 Sections 4.1 – 4.2 “Optimal Rectangle Packing: New Results” By R. Korf (optional) “Optimal Rectangle Packing: A Meta-CSP."— Presentation transcript:

1 Reading Material Sections 3.3 – 3.5 Sections 4.1 – 4.2 “Optimal Rectangle Packing: New Results” By R. Korf (optional) “Optimal Rectangle Packing: A Meta-CSP Approach” (optional)

2 Best-first search Idea: use an evaluation function f(n) for each node –estimate of the desirability - Expand most desirable unexpanded node Implementation: Order the nodes in fringe in decreasing order of desirability Special cases: –greedy best-first search –A * search

3 Romania with step costs in km

4 Greedy best-first search Evaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goal e.g., h SLD (n) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal

5 Greedy best-first search example

6

7

8

9 Properties of greedy best-first search Complete? Yes (with assumptions) Time? O(b m ), but a good heuristic can give dramatic improvement Space? O(b m ) -- keeps all nodes in memory Optimal? No

10 A * search Idea: avoid expanding paths that are already expensive Evaluation function f(n) = g(n) + h(n) g(n) = actual cost so far to reach n h(n) = estimated cost from n to goal f(n) = estimated total cost of path through n to goal

11 Romania with step costs in km

12 A * search example

13

14

15

16

17

18 Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) ≤ h * (n), where h * (n) is the true optimal cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic Example: h SLD (n) (never overestimates the actual road distance) Theorem: If h(n) is admissible, A * using TREE- SEARCH is optimal

19 Optimality of A * (proof) Suppose some suboptimal goal G 2 has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. f(G 2 ) = g(G 2 )since h(G 2 ) = 0 g(G 2 ) > g(G) since G 2 is suboptimal f(G) = g(G)since h(G) = 0 f(G 2 ) > f(G)from above

20 Optimality of A * (proof) Suppose some suboptimal goal G 2 has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. f(G 2 )> f(G) from above h(n)≤ h^*(n)since h is admissible g(n) + h(n)≤ g(n) + h * (n) f(n) ≤ f(G) Hence f(G 2 ) > f(n), and A * will never select G 2 for expansion

21 A* with Graph-Search Is it optimal? Not optimal when the search discards an optimal path to a repeated state A if the optimal path is not the first path that generates A Example?

22 Consistent heuristics A heuristic is consistent if for every node n, every successor n' of n generated by any action a, h(n) ≤ c(n,a,n') + h(n') If h is consistent, we have f(n') = g(n') + h(n') = g(n) + c(n,a,n') + h(n') ≥ g(n) + h(n) = f(n) i.e., f(n) is non-decreasing along any path. A heuristic is admissible if it is consistent Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal

23 Time Complexity of A* Still exponential unless h(n) is very good –Sub-exponential possible when |h(n) – h*(n)| < O(log h*(n)) Helmert & Roger (2008) result: –Still exponential even if |h(n) – h*(n)| < c –Optional reading: “How Good is Almost Perfect?” Malte Helmert, Gabriele Röger, AAAI 2008 (best paper award)

24 A* SearchHeuristic Which way should I go? Go that way Give better adviceGet there faster? A better heuristic is important for A*?

25 General Search Model Search space –infinite b -ary tree –multiple solution nodes For each node v: –g(v) = depth of v –h*(v) = shortest distance from v to a solution b g(v)g(v) h*(v)

26 Heuristic Functions Heuristic h(v) is an estimate of h*(v). h is admissible if h(v) ≤ h*(v) h is  -approximate if (1-  )h*(v) ≤ h(v) ≤ (1+  )h*(v)

27 Nearly Optimal Solutions k (1+  )k N  = number of  -optimal solutions Optimal solutions lie at depth k  -optimal solutions depth < (1+  )k

28 Generic Upper Bounds on Running Time of A* (Dinh et.al 2007) Upper bounds on the number of expanded nodes: Heuristic  -approximate  -approximate and admissible Trivial bounds 2b (1+  )k 2bk2bk Better bounds 2b 2  k +kN 2  2b  k +kN 

29 Admissible heuristics E.g., for the 8-puzzle: h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) h 1 (S) = ? h 2 (S) = ?

30 Admissible heuristics E.g., for the 8-puzzle: h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) h 1 (S) = ? 8 h 2 (S) = ? 3+1+2+2+2+3+3+2 = 18

31 Effect of Heuristic Typical search costs (average number of nodes expanded): d=12IDS = 3,644,035 nodes A * (h 1 ) = 227 nodes A * (h 2 ) = 73 nodes d=24 IDS = too many nodes A * (h 1 ) = 39,135 nodes A * (h 2 ) = 1,641 nodes

32 Dominance If h 2 (n) ≥ h 1 (n) for all n (both admissible) then h 2 dominates h 1 Is h 2 always better than h 1 in terms of –# of node expansions? –computing time? What if there is no clear winner out of many heuristics?

33 Dominance If h 2 (n) ≥ h 1 (n) for all n (both admissible) then h 2 dominates h 1 Is h 2 always better than h 1 in terms of –# of node expansions? yes –computing time? no What if there is no clear winner out of many heuristics? –Maximum(h1,h2, ….)

34 Relaxed problems A problem with fewer restrictions on the actions is called a relaxed problem The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem –Relaxed problems for 8-puzzle A heuristic derived from a relaxed problem is consistent

35 Subproblem Usually reduce the number of involved entities instead of relaxing the actions –E.g. get only 1,2,3,4 to position –get half of the people to the other side Also admissible and consistent

36 Pattern Database Save the optimal solution to some subproblems For example, the solution for all possible configurations of 1,2,3,4

37 Constructing Pattern Database Search backward from the goal state The cost for building the PD is amortized by the time reduction for solving many problem instances Take the maximum of multiple PDs –E.g. 1-2-3-4, 5-6-7-8, 2-4-6-8 –Reduce the cost for 15-puzzle by 1000 times

38 Multiple Pattern Databases Can we do better utilizing multiple PDs?

39 Multiple Pattern Databases Can we do better utilizing multiple PDs? Can we use h(1-2-3-4) + h(5-6-7-8)?

40 Multiple Pattern Databases Can we do better utilizing multiple PDs? Can we use h(1-2-3-4) + h(5-6-7-8)? –No. Because of action sharing. –So what can we do? A solution: disjoint PD –h’(1-2-3-4): Count the moves involving1,2,3,4 only –h’(5-6-7-8): Count the moves involving 5,6,7,8 only –Use h’(1-2-3-4) + h’(5-6-7-8) –millionX speedup for 24-puzzle Not always possible to decompose the problem, e.g. Rubik’s cube

41 Space complexity of A* Space complexity:(all nodes are stored) Optimality: YES –Cannot expand f+1 until f is finished. –A* expands all nodes with f(n)< C* –A* expands some nodes with f(n)=C* –A* expands no nodes with f(n)>C*

42 Memory-efficient variants of A* Some solutions to A* space problems (maintain completeness and optimality) –Iterative-deepening A* (IDA*) Here cutoff information is the f-cost (g+h) instead of depth –Recursive best-first search(RBFS) Recursive algorithm that attempts to mimic standard best-first search with linear space. –(simple) Memory-bounded A* ((S)MA*) Drop the worst-leaf node when memory is full

43 Recursive best-first search function RECURSIVE-BEST-FIRST-SEARCH(problem) return a solution or failure return RFBS(problem,MAKE-NODE(INITIAL-STATE[problem]),∞) function RFBS( problem, node, f_limit) return a solution or failure and a new f-cost limit if GOAL-TEST[problem](STATE[node]) then return node successors  EXPAND(node, problem) if successors is empty then return failure, ∞ for each s in successors do f [s]  max(g(s) + h(s), f [node]) repeat best  the lowest f-value node in successors if f [best] > f_limit then return failure, f [best] alternative  the second lowest f-value among successors result, f [best]  RBFS(problem, best, min(f_limit, alternative)) if result  failure then return result

44 AI 1 Recursive best-first search Keeps track of the f-value of the best- alternative path available. –If current f-values exceeds this alternative f-value than backtrack to alternative path. –Upon backtracking change f-value to best f-value of its children. –Re-expansion of this result is thus still possible.

45 AI 1 Recursive best-first search, ex. Path until Rumnicu Vilcea is already expanded Above node; f-limit for every recursive call is shown on top. Below node: f(n) The path is followed until Pitesti which has a f-value worse than the f- limit.

46 AI 1 Recursive best-first search, ex. Unwind recursion and store best f-value for current best leaf Pitesti result, f [best]  RBFS(problem, best, min(f_limit, alternative)) best is now Fagaras. Call RBFS for new best –best value is now 450

47 Recursive best-first search, ex. Unwind recursion and store best f-value for current best leaf Fagaras result, f [best]  RBFS(problem, best, min(f_limit, alternative)) best is now Rimnicu Viclea (again). Call RBFS for new best –Subtree is again expanded. –Best alternative subtree is now through Timisoara. Solution is found since because 447 > 418.

48 RBFS evaluation RBFS is a bit more efficient than IDA* –Still excessive node generation Like A*, optimal if h(n) is admissible Space complexity is O(bd). Time complexity difficult to characterize –Depends on accuracy of h(n) and how often best path changes. IDA* and RBFS suffer from too little memory.


Download ppt "Reading Material Sections 3.3 – 3.5 Sections 4.1 – 4.2 “Optimal Rectangle Packing: New Results” By R. Korf (optional) “Optimal Rectangle Packing: A Meta-CSP."

Similar presentations


Ads by Google