Artificial Intelligence Heuristic (Informed) Search

Artificial Intelligence Heuristic (Informed) Search

Artificial Intelligence Heuristic (Informed) Search Prof. Dr. habil. Jana Koehler Dr. Sophia Saller, M. Sc. Annika Engel Deep thanks goes to Summer 2020 Prof. Jörg Hoffmann for sharing his course material © JK Agenda . Using Knowledge during Search – evaluation of search states – admissible and consistent (monotone) heuristics . Algorithms 1) Greedy (Best-First) Search 2) A* and IDA* 3) Bidirectional Search . Finding good heuristics 2 Artificial Intelligence: Heuristic Search © JK Recommended Reading . AIMA Chapter 3: Solving Problems by Searching – 3.4 Uninformed Search Strategies, the following subchapters: • 3.4.6 Bidirectional search – 3.5 Informed (Heuristic) Search Strategies • 3.5.1 Greedy best-first search • 3.5.2 A* search: Minimizing the total estimated solution cost – 3.6 Heuristic Functions • 3.6.1 The effect of heuristic accuracy on performance • 3.6.2 Generating admissible heuristics from relaxed problems • 3.6.3 Generating admissible heuristics from subproblems: Pattern databases . Optional reading: – R. C. Holte, A. Felner, G. Sharon, N. R. Sturtevant: Bidirectional Search That Is Guaranteed to Meet in the Middle, AAAI-2016 3 Artificial Intelligence: Heuristic Search © JK How to Determine the next Node for Expansion? . Uninformed Search – rigid procedure, no knowledge of the cost from a node to the goal – e.g. FIFO, LIFO queues . Informed Search – "value" of expanding a node (state) used as guidance that steers the search algorithm through the search space – evaluation function f(s) assigns a number to each state 4 Artificial Intelligence: Heuristic Search © JK The Evaluation Function ( ) = ( ) + ( ) C(3) s 4 s1 A(2) g=5 g=2 푔 s2 h*=7 G(0) G(0) C(3) I C(3) s5 G(0) g=7 푔 B(4) s 3 E(0) h*=0 G(0) g=4 F(1) H(2) E(0) 푔 s6 s7 ( ) corresponds to the costs ( ) corresponds to the from the initial state to the + estimated costs from the current current state ℎstate to the goal state a precise value an estimated value 5 Artificial Intelligence: Heuristic Search © JK Heuristic Functions and ∗ Let be a problem with state space . A heuristic function, short heuristic, for is a function so that, for every goal state , we have ( )Π= 0. + Θ Θ ℎ ∶ ↦ ℝ0 ∪ ∞ ℎThe perfect heuristic is the function assigning every the cost of a cheapest path from to∗ a goal state, or if no such path exists. ℎ ∈ ∞ 0, if is a goal state . = > 0, otherwise . ℎ =� for dead-end states, from which the goal is unreachable . ∗ is also called the goal distance of ℎ ∞ . The∗ value of depends only on the state , not on the path that we ℎ followed so far to construct the partial solution (and the costs of this path) ℎ 6 © JK Artificial Intelligence: Heuristic Search Desirable Properties of Heuristic Function ( ) 1) Efficient to compute ( = 0 as extreme case) 2) Informative ( ( ) = ( ) as extreme case) ℎ ∗ 0,ℎ ℎif is a goal state = 3) > 0, otherwise 4) ℎ is admissible� = 5) ℎ for dead-end states 6) is consistent ℎ GOOD heuristics∞ should satisfy a balanced compromise of properties (1) to ℎ(4) at least, better of all 6 Properties (5) ensures effective dead-end recognition and (6) is a prerequisite for algorithms to guarantee minimal-cost (optimal) solutions 7 Artificial Intelligence: Heuristic Search © JK Admissiblity of ( ) Let be a problem with state space and let be a heuristic function for . We say that is admissible if, for all , we haveΠ ( ). Θ ℎ Θ ∗ ℎ ∈ The functionℎ ≤ ℎ corresponds to the real cost of the optimal path from node∗ to a goal state. ℎ The function is an optimistic estimation of the costs that actually occur. It underestimates the real costs and provides the search algorithmℎ with a lower bound on the goal distance. 8 Artificial Intelligence: Heuristic Search © JK Consistency (Monotonicity) of h(s) Let be a problem with state space , and let be a heuristic function for . We say that is consistent if, for all transitions s in , we have Π Θ ℎ , . ′ Θ ′ ℎ → Θ Theℎ value− ℎ ≤, is the action cost of getting from to with action . We reformulate the inequality from above to: , + ( ). 푠 ℎ ≤ ℎ 푠 ( , ) Triangle inequality: The sum of the lengths of any two sides of a triangle must be greater or equal than the length of the remaining side. ( ) ( )푠 ℎ Applying an action to the state , the heuristic value cannot decrease by more ℎ 푠 than the cost , of . goal state 9 Artificial Intelligence: Heuristic Search © JK Consistency Admissibility Let be a problem⟹ with state space and let be a heuristic function for . If is consistent, then is admissible. Π Θ ℎ Θ ℎ ℎ To show: , , ( ) ( ), . This means that we need′ to show that a′ consistent heuristic∗ never overestimatesℎ the− ℎ costs ≤ to the goal.∀ → ⟹ ℎ ≤ ℎ ∀ ∈ Observation: The value of can at most decrease by the action costs. ( ) ( ) ℎ ℎ 0 ( ) , ( , 1) ( ) ℎ 1 , + ( ) 0 (ℎ , 2) ℎ − ℎ 푠 ≤ ( 2) 푔 . ⇔ ℎ ≤ ℎ 푠 ℎ . 10 1 2 3 © JK Artificial Intelligence: Heuristic Search 0 푔 푔 푔 → ⋯ → Proof: We need to show that for all . For states (dead ends) where ( ) = ∗ , this is trivial as any number is . Now let be the set of non dead ∗-end≤ states with a shortest cheapest path to a goal state of length . ℎ ∞ ≤ ∞ We will prove for all that for all by induction over . ∗ Base case: is a goal state,ℎ so≤ ℎ ( = 0). ∈By the definition of heuristic functions then ( ) = 0 and so ( ) ( ) = 0 as required. 0 ∗ ∈ Inductiveℎ Hypothesis:ℎ For≤ allℎ we have that . ∗ Inductive step: Let . Then ∈ the cheapest pathℎ from≤ ℎ to a goal state has length + 1. Let be the successor state of in this cheapest path, so . We thus know ∈ +푔 that and therefore 1) By푠 the consistency of we have: → 푠 ( , ) 푠2)∈By the Inductive Hypothesis: ′ 3) Since the cheapest pathℎ has the cheapest costs: ℎ ′ −=ℎ ∗ ≤+ ( , ) ℎ∗ ≤ ℎ∗ 푠′ Combining these three statements, we get ℎ ℎ + , + , = ( ) ′ ∗ ∗ QED 11 ≤ ℎ1) ≤ ℎ 2)푠 3) © JK (1) Greedy Best-First Search . Uses only the heuristic part of the evaluation function ( ) = ( ) ℎ . Expands the node first that is estimated as being closest to the goal . Does not consider the current path costs – "counterpart" to uniform-cost search, which uses ( ) = ( ) 12 Artificial Intelligence: Heuristic Search © JK GBFS Algorithm . Frontier ordered by ascending . Duplicates checked at successor generation, against both the frontier and the explored setℎ 13 Artificial Intelligence: Heuristic Search © JK GBFS on the Romania Travel Example h: Aerial Distances to Bucharest 14 Artificial Intelligence: Heuristic Search © JK 15 Artificial Intelligence: Heuristic Search © JK Properties of GBFS . Complete – for finite state spaces and with duplicate elimination . Not optimal . Time complexity is ( ) . Space complexity is where is the maximum depth of the search space 16 Artificial Intelligence: Heuristic Search © JK (2) A* (Hart, Nilsson, Raphael 1968) . Greedy search only uses ( ) ℎ . Uniform-Cost search uses ( ) – finds an optimal solution if path costs grow monotonically: () ( ) ≤ 푠 . A* uses ( ) = ( ) + ( ) ℎ . A* combines both using preferably admissible and consistent heuristics . http://theory.stanford.edu/~amitp/GameProgramming/AStarComparison.html gives a good introduction 17 Artificial Intelligence: Heuristic Search © JK A* Algorithm Frontier ordered by ascending + , duplicates handled as in UCS (nodes replaced by duplicates with cheaper costs) 18 Artificial Intelligence: Heuristicℎ Search © JK Properties of A* . A* is complete – if a solution exists, A* will find it provided that 1) every node has a finite number of successor nodes, and 2) each action has positive and finite costs . A* is optimal – first solution found has minimum path cost if is admissible (on trees) or if is consistent (on graphs) • under an admissible heuristics on graphs, A* needsℎ to expand all nodes with ( ) (the costℎ of an optimal solution), called “re-opening” ∗ • For any path, re-opening≤ checks if it is the cheapest to a state and puts explored states back into the frontier if a cheaper path was found 19 Artificial Intelligence: Heuristic Search © JK Properties of A* . Time Complexity is ( ) . Space Complexity is ( ), where is the maximum depth of the search space – subexponential growth requires that the error in the heuristic function grows no faster than the logarithm of the actual path cost ( ) log ( ) ∗ ∗ ℎ − ℎ ≤ ℎ 20 Artificial Intelligence: Heuristic Search © JK A* on the Romania Travel Example h: Aerial Distances to Bucharest 21 Artificial Intelligence: Heuristic Search © JK Computed f-Values in the Example Frontier: A S,T,Z R,F,T,Z,O F,P,T,Z,C,O P,T,Z,B,C´,O Bucharest is inserted after Pitesti in the frontier! B´,T,Z,C´,O 22 Artificial Intelligence: Heuristic Search © JK f-based Contours in the Search Space . A* fans out from the start node, adding nodes in concentric bands of increasing f-costs – with good heuristics the bands stretch towards the goal state and are more narrowly focused around the optimal path 23 Artificial Intelligence: Heuristic Search © JK Proof of Optimality of A* under Consistent Heuristics . The general idea for the proof is to encode the consistent heuristic function as action costs and establish a correspondence to uniform cost search – UCS is optimal for non-negative action costs (Dijkstra´s algorithm) . We then show that the original and the transformed problem have the same optimal solutions and isomorphic search spaces . Finally, we can prove that every optimal solution found by A* on the transformed problem, is also an optimal solution for the original problem 24 Artificial Intelligence: Heuristic Search © JK Step 1: Encoding Heuristic Values as Action Costs Definition: Let be a problem with state space = , , , , , , and let be a consistent heuristic function for . We define the -weighted state space as Π = , , , , , where: Θ • ℎ , ℎ| , ℎ, ℎ ℎ, , , Π , ℎ • ℎ: ′Θis defined by ′ , ′ , , • ℎ ≔=ℎ , + , , ∈ | , , ∈ℎ .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    51 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