Foundations of Artificial Intelligence
13. State-Space Search: Heuristics
Malte Helmert
University of Basel
March 22, 2021
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 1 / 16
Foundations of Artificial Intelligence
March 22, 2021 — 13. State-Space Search: Heuristics
13.1 Introduction 13.2 Heuristics 13.3 Examples 13.4 Summary
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 2 / 16
State-Space Search: Overview
Chapter overview: state-space search I 5.–7. Foundations
I 8.–12. Basic Algorithms I 13.–19. Heuristic Algorithms
I 13. Heuristics
I 14. Analysis of Heuristics I 15. Best-first Graph Search
I 16. Greedy Best-first Search, A
∗, Weighted A
∗I 17. IDA
∗I 18. Properties of A
∗, Part I I 19. Properties of A
∗, Part II
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 3 / 16
13. State-Space Search: Heuristics Introduction
13.1 Introduction
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 4 / 16
13. State-Space Search: Heuristics Introduction
Informed Search Algorithms
I search algorithms considered so far: blind
because they do not use any aspects of the problem to solve other than its formal definition (state space)
I problem: scalability
prohibitive time and space requirements already for seemingly simple problems I idea: try to find (problem-specific) criteria
to distinguish good and bad states prefer good states
informed (“heuristic”) search algorithms
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 5 / 16
13. State-Space Search: Heuristics Heuristics
13.2 Heuristics
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 6 / 16
13. State-Space Search: Heuristics Heuristics
Heuristics
Definition (heuristic)
Let S be a state space with states S .
A heuristic function or heuristic for S is a function h : S → R + 0 ∪ {∞},
mapping each state to a non-negative number (or ∞).
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 7 / 16
13. State-Space Search: Heuristics Heuristics
Heuristics: Intuition
idea: h(s) estimates distance (= cost of cheapest path)
idea:
from s to closest goal state I heuristics can be arbitrary functions
I intuition: the closer h is to true goal distance, the more efficient the search using h
Heuristics are sometimes defined for search nodes instead of states, but this increased generality is rarely useful. (Why?)
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 8 / 16
13. State-Space Search: Heuristics Heuristics
Why “Heuristic”?
What does “heuristic” mean?
I heuristic: from ancient Greek ἑυρισκω (= I find) compare: ἑυρηκα!
I popularized by George P´ olya: How to Solve It (1945) I in computer science often used for:
rule of thumb, inexact algorithm
I in state-space search technical term for goal distance estimator
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 9 / 16
13. State-Space Search: Heuristics Heuristics
Representation of Heuristics
In our black box model, heuristics are an additional element of the state space interface:
State Spaces as Black Boxes (Extended) I init()
I is goal(s ) I succ(s ) I cost(a)
I h(s): heuristic value for state s result: non-negative integer or ∞
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 10 / 16
13. State-Space Search: Heuristics Examples
13.3 Examples
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 11 / 16
13. State-Space Search: Heuristics Examples
Example: Blocks World
possible heuristic:
count blocks x that currently lie on y and must lie on z 6= y in the goal (including case where y or z is the table) How accurate is this heuristic?
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 12 / 16
13. State-Space Search: Heuristics Examples
Example: Route Planning in Romania
possible heuristic: straight-line distance to Bucharest
Giurgiu Urziceni
Hirsova
Eforie Neamt
Oradea
Zerind Arad
Timisoara Lugoj
Mehadia
Dobreta
Craiova Sibiu Fagaras
Pitesti
Vaslui Iasi
Rimnicu Vilcea
Bucharest 71
75
118
111 70
75 120 151
140
99 80
97
101 211
138
146 85
90
98 142 92 87
86
Arad 366
Bucharest 0
Craiova 160
Drobeta 242
Eforie 161
Fagaras 176
Giurgiu 77
Hirsova 151
Iasi 226
Lugoj 244
Mehadia 241
Neamt 234
Oradea 380
Pitesti 100
Rimnicu Vilcea 193
Sibiu 253
Timisoara 329
Urziceni 80
Vaslui 199
Zerind 374
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 13 / 16
13. State-Space Search: Heuristics Examples
Example: Missionaries and Cannibals
Setting: Missionaries and Cannibals I Six people must cross a river.
I Their rowing boat can carry one or two people across the river at a time (it is too small for three).
I Three people are missionaries, three are cannibals.
I Missionaries may never stay with a majority of cannibals.
possible heuristic: number of people on the wrong river bank with our formulation of states as triples hm, c , bi:
h(hm, c, bi) = m + c
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 14 / 16
13. State-Space Search: Heuristics Summary
13.4 Summary
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 15 / 16
13. State-Space Search: Heuristics Summary
Summary
I heuristics estimate distance of a state to the goal I can be used to focus search on promising states
soon: search algorithms that use heuristics
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 22, 2021 16 / 16