Foundations of Artificial Intelligence
5. State-Space Search: State Spaces
Malte Helmert
University of Basel
March 8, 2021
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 1 / 22
Foundations of Artificial Intelligence
March 8, 2021 — 5. State-Space Search: State Spaces
5.1 State-Space Search Problems 5.2 Formalization
5.3 State-Space Search 5.4 Summary
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 2 / 22
5. State-Space Search: State Spaces State-Space Search Problems
5.1 State-Space Search Problems
5. State-Space Search: State Spaces State-Space Search Problems
Classical State-Space Search Problems Informally
(Classical) state-space search problems are among the “simplest”
and most important classes of AI problems.
objective of the agent:
I from a given initial state I apply a sequence of actions I in order to reach a goal state
performance measure: minimize total action cost
5. State-Space Search: State Spaces State-Space Search Problems
Motivating Example: 15-Puzzle
9 2 12 6
5 7 14 13
3 1 11
15 4 10 8
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 5 / 22
5. State-Space Search: State Spaces State-Space Search Problems
Classical Assumptions
“classical” assumptions:
I no other agents in the environment (single-agent) I always knows state of the world (fully observable) I state only changed by the agent (static)
I finite number of states/actions (in particular discrete) I actions have deterministic effect on the state
can all be generalized (but not in this part of the course) For simplicity, we omit “classical” in the following.
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 6 / 22
5. State-Space Search: State Spaces State-Space Search Problems
Classification
Classification:
State-Space Search environment:
I static vs. dynamic
I deterministic vs. non-deterministic vs. stochastic I fully vs. partially vs. not observable
I discrete vs. continuous I single-agent vs. multi-agent problem solving method:
I problem-specific vs. general vs. learning
5. State-Space Search: State Spaces State-Space Search Problems
Search Problem Examples
I toy problems: combinatorial puzzles
(Rubik’s Cube, 15-puzzle, towers of Hanoi, . . . ) I scheduling of events, flights, manufacturing tasks I query optimization in databases
I behavior of NPCs in computer games I code optimization in compilers I verification of soft- and hardware I sequence alignment in bioinformatics I route planning (e.g., Google Maps) I . . .
thousands of practical examples
5. State-Space Search: State Spaces State-Space Search Problems
State-Space Search: Overview
Chapter overview: state-space search I 5.–7. Foundations
I 5. State Spaces
I 6. Representation of State Spaces I 7. Examples of State Spaces I 8.–12. Basic Algorithms I 13.–19. Heuristic Algorithms
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 9 / 22
5. State-Space Search: State Spaces Formalization
5.2 Formalization
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 10 / 22
5. State-Space Search: State Spaces Formalization
Formalization
preliminary remarks:
I to cleanly study search problems we need a formal model I fundamental concept: state spaces
I state spaces are (labeled, directed) graphs I paths to goal states represent solutions I shortest paths correspond to optimal solutions
5. State-Space Search: State Spaces Formalization
State Spaces: Example
State spaces are often depicted as directed graphs.
I states: graph vertices I transitions: labeled arcs
(here: colors instead of labels) I initial state: incoming arrow I goal states: marked
(here: by the dashed ellipse) I actions: the arc labels
I action costs: described separately (or implicitly = 1)
A B C
D
E F
initial state
goal states
5. State-Space Search: State Spaces Formalization
State Spaces
Definition (state space)
A state space or transition system is a 6-tuple S = hS , A, cost, T , s 0 , S ? i with
I S: finite set of states I A: finite set of actions I cost : A → R + 0 action costs
I T ⊆ S × A × S transition relation; deterministic in hs, ai (see next slide)
I s 0 ∈ S initial state I S ? ⊆ S set of goal states
German: Zustandsraum, Transitionssystem, Zust¨ ande, Aktionen, Aktionskosten, Transitions-/ ¨ Ubergangsrelation, deterministisch, Anfangszustand, Zielzust¨ ande
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 13 / 22
5. State-Space Search: State Spaces Formalization
State Spaces: Transitions, Determinism
Definition (transition, deterministic)
Let S = hS, A, cost, T , s 0 , S ? i be a state space.
The triples hs , a, s 0 i ∈ T are called (state) transitions.
We say S has the transition hs , a, s 0 i if hs, a, s 0 i ∈ T . We write this as s − → a s 0 , or s → s 0 when a does not matter.
Transitions are deterministic in hs , ai: it is forbidden to have both s − → a s 1 and s − → a s 2 with s 1 6= s 2 .
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 14 / 22
5. State-Space Search: State Spaces Formalization
State Spaces: Terminology
We use common terminology from graph theory.
Definition (predecessor, successor, applicable action) Let S = hS, A, cost, T , s 0 , S ? i be a state space.
Let s, s 0 ∈ S be states with s → s 0 . I s is a predecessor of s 0
I s 0 is a successor of s
If s − → a s 0 , then action a is applicable in s.
German: Vorg¨ anger, Nachfolger, anwendbar
5. State-Space Search: State Spaces Formalization
State Spaces: Terminology
We use common terminology from graph theory.
Definition (path)
Let S = hS, A, cost, T , s 0 , S ? i be a state space.
Let s (0) , . . . , s (n) ∈ S be states and π 1 , . . . , π n ∈ A be actions such that s (0) −→ π
1s (1) , . . . , s (n−1) −→ π
ns (n) .
I π = hπ 1 , . . . , π n i is a path from s (0) to s (n) I length of π: |π| = n
I cost of π: cost(π) = P n
i =1 cost(π i ) German: Pfad, L¨ ange, Kosten
I paths may have length 0
I sometimes “path” is used for state sequence hs (0) , . . . , s (n) i
or sequence hs (0) , π , s (1) , . . . , s (n−1) , π , s (n) i
5. State-Space Search: State Spaces Formalization
State Spaces: Terminology
more terminology:
Definition (reachable, solution, optimal) Let S = hS, A, cost, T , s 0 , S ? i be a state space.
I state s is reachable if a path from s 0 to s exists I paths from s ∈ S to some state s ? ∈ S ?
are solutions for/from s
I solutions for s 0 are called solutions for S I optimal solutions (for s ) have minimal costs
among all solutions (for s)
German: erreichbar, L¨ osung von/f¨ ur s , optimale L¨ osung
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 17 / 22
5. State-Space Search: State Spaces State-Space Search
5.3 State-Space Search
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 18 / 22
5. State-Space Search: State Spaces State-Space Search
State-Space Search
State-Space Search
State-space search is the algorithmic problem of finding solutions in state spaces or proving that no solution exists.
In optimal state-space search, only optimal solutions may be returned.
German: Zustandsraumsuche, optimale Zustandsraumsuche
5. State-Space Search: State Spaces State-Space Search
Learning Objectives for State-Space Search
Learning Objectives for the Topic of State-Space Search I understanding state-space search:
What is the problem and how can we formalize it?
I evaluate search algorithms:
completeness, optimality, time/space complexity I get to know search algorithms:
uninformed vs. informed; tree and graph search I evaluate heuristics for search algorithms:
goal-awareness, safety, admissibility, consistency I efficient implementation of search algorithms I experimental evaluation of search algorithms
I design and comparison of heuristics for search algorithms
5. State-Space Search: State Spaces Summary
5.4 Summary
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 21 / 22
5. State-Space Search: State Spaces Summary
Summary
I classical state-space search problems:
find action sequence from initial state to a goal state I performance measure: sum of action costs
I formalization via state spaces:
I states, actions, action costs, transitions, initial state, goal states
I terminology for transitions, paths, solutions I definition of (optimal) state-space search
M. Helmert (University of Basel) Foundations of Artificial Intelligence March 8, 2021 22 / 22