• Keine Ergebnisse gefunden

Planning and Optimization X2. Hands-On and Repetition Gabriele R¨oger and Thomas Keller

N/A
N/A
Protected

Academic year: 2022

Aktie "Planning and Optimization X2. Hands-On and Repetition Gabriele R¨oger and Thomas Keller"

Copied!
18
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Planning and Optimization

X2. Hands-On and Repetition

Gabriele R¨ oger and Thomas Keller

Universit¨ at Basel

September 26, 2018

(2)

Hands-On: Overview

Chapter overview: hands-on

1. The Planning Domain Definition Language (PDDL) 2. Getting to Know a Planner

3. Heuristics

4. A search algorithm

(3)

Heuristics A

Search Algorithm Hands-On

Heuristics

(4)

Heuristics

Definition (heuristic)

Let S be a state space with set of 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 ∞).

(5)

Heuristics A

Search Algorithm Hands-On

Heuristics: Intuition

idea: h(s) estimates cost of cheapest path

idea:

from s to closest goal state

heuristics can be arbitrary functions

intuition: the closer h is to true cost to goal,

the more efficient the search using h

(6)

A Search Algorithm

(7)

Heuristics A

Search Algorithm Hands-On

A Search Algorithm

A search algorithm

based on heuristic h, define evaluation function f for node n:

f (n) := g (n) + h(n.state)

trade-off between path cost and estimated proximity to goal

intuition: f (n) estimates costs of cheapest solution from

initial state through n.state to goal

(8)

A Search Algorithm: Pseudo-Code

A search algorithm (with re-opening) open := new priority queue, ordered by hf , hi if h(init-state) < ∞:

open.insert(make root node()) distances := new HashTable while not open.empty():

n = open.pop-min()

if (not distances.contains(n.state)) or (g (n) < distances[n.state]):

distances[n.state] := g (n) if is-goal(n.state):

return extract-solution(n) for each successor ha, s 0 i of n.state:

if h(s 0 ) < ∞:

n 0 := make node(n, a, s 0 ) open.insert(n 0 )

return unsolvable

(9)

Heuristics A

Search Algorithm Hands-On

A Search Algorithm

Most important property

A is optimal if the applied heuristic is admissible.

For more details on best-first search and A , see chapter 15–19 of the AI course last semester.

(https://dmi.unibas.ch/de/studium/

computer-science-informatik/fs18/

lecture-foundations-of-artificial-intelligence/)

(10)

Example: A for Route Planning

Example 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

(11)

Heuristics A

Search Algorithm Hands-On

Example: A for Route Planning

(a) The initial state (b) After expanding Arad

(c) After expanding Sibiu

Arad

Sibiu Timisoara

447=118+329

Zerind 449=75+374 393=140+253

Arad 366=0+366

(d) After expanding Rimnicu Vilcea

(e) After expanding Fagaras

(f) After expanding Pitesti

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea Fagaras Oradea

447=118+329 449=75+374

646=280+366415=239+176 671=291+380413=220+193

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160417=317+100553=300+253

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160417=317+100553=300+253 671=291+380

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Oradea

Craiova Pitesti Sibiu

Bucharest Craiova Rimnicu Vilcea 418=418+0

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160 553=300+253

615=455+160 607=414+193 671=291+380

Rimnicu Vilcea

Fagaras Rimnicu Vilcea Arad Fagaras Oradea 646=280+366 415=239+176 671=291+380

(12)

Example: A for Route Planning

(a) The initial state (b) After expanding Arad

(c) After expanding Sibiu

Arad

Sibiu Timisoara

447=118+329

Zerind 449=75+374 393=140+253

Arad 366=0+366

(d) After expanding Rimnicu Vilcea

(e) After expanding Fagaras

(f) After expanding Pitesti

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea Fagaras Oradea

447=118+329 449=75+374

646=280+366415=239+176 671=291+380413=220+193

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160417=317+100553=300+253

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160417=317+100553=300+253 671=291+380

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Oradea

Craiova Pitesti Sibiu

Bucharest Craiova Rimnicu Vilcea 418=418+0

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160 553=300+253

615=455+160 607=414+193 671=291+380

Rimnicu Vilcea

Fagaras Rimnicu Vilcea Arad Fagaras Oradea 646=280+366 415=239+176 671=291+380

(13)

Heuristics A

Search Algorithm Hands-On

Example: A for Route Planning

(a) The initial state (b) After expanding Arad

(c) After expanding Sibiu

Arad

Sibiu Timisoara

447=118+329

Zerind 449=75+374 393=140+253

Arad 366=0+366

(d) After expanding Rimnicu Vilcea

(e) After expanding Fagaras

(f) After expanding Pitesti

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea Fagaras Oradea

447=118+329 449=75+374

646=280+366415=239+176 671=291+380413=220+193

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160417=317+100553=300+253

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160417=317+100553=300+253 671=291+380

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Oradea

Craiova Pitesti Sibiu

Bucharest Craiova Rimnicu Vilcea 418=418+0

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160 553=300+253

615=455+160 607=414+193 671=291+380

Rimnicu Vilcea

Fagaras Rimnicu Vilcea Arad Fagaras Oradea 646=280+366 415=239+176 671=291+380

(14)

Example: A for Route Planning

(a) The initial state (b) After expanding Arad

(c) After expanding Sibiu

Arad

Sibiu Timisoara

447=118+329

Zerind 449=75+374 393=140+253

Arad 366=0+366

(d) After expanding Rimnicu Vilcea

(e) After expanding Fagaras

(f) After expanding Pitesti

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea Fagaras Oradea

447=118+329 449=75+374

646=280+366415=239+176 671=291+380413=220+193

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160417=317+100553=300+253

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160417=317+100553=300+253 671=291+380

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Oradea

Craiova Pitesti Sibiu

Bucharest Craiova Rimnicu Vilcea 418=418+0

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160 553=300+253

615=455+160 607=414+193 671=291+380

Rimnicu Vilcea

Fagaras Rimnicu Vilcea Arad Fagaras Oradea 646=280+366 415=239+176 671=291+380

(15)

Heuristics A

Search Algorithm Hands-On

Example: A for Route Planning

(a) The initial state (b) After expanding Arad

(c) After expanding Sibiu

Arad

Sibiu Timisoara

447=118+329

Zerind 449=75+374 393=140+253

Arad 366=0+366

(d) After expanding Rimnicu Vilcea

(e) After expanding Fagaras

(f) After expanding Pitesti

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea Fagaras Oradea

447=118+329 449=75+374

646=280+366415=239+176 671=291+380413=220+193

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160417=317+100553=300+253

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160417=317+100553=300+253 671=291+380

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Oradea

Craiova Pitesti Sibiu

Bucharest Craiova Rimnicu Vilcea 418=418+0

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160 553=300+253

615=455+160 607=414+193 671=291+380

Rimnicu Vilcea

Fagaras Rimnicu Vilcea Arad Fagaras Oradea 646=280+366 415=239+176 671=291+380

(16)

Heuristics A

Search Algorithm Hands-On

Example: A for Route Planning

(b) After expanding Arad

(c) After expanding Sibiu

Arad

Sibiu Timisoara

447=118+329

Zerind 449=75+374 393=140+253

366=0+366

(d) After expanding Rimnicu Vilcea

(e) After expanding Fagaras

(f) After expanding Pitesti

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea Fagaras Oradea

447=118+329 449=75+374

646=280+366415=239+176 671=291+380413=220+193

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160417=317+100553=300+253

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160417=317+100553=300+253 671=291+380

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest Oradea

Craiova Pitesti Sibiu

Bucharest Craiova Rimnicu Vilcea 418=418+0

447=118+329 449=75+374

646=280+366

591=338+253 450=450+0 526=366+160 553=300+253

615=455+160 607=414+193 671=291+380

Rimnicu Vilcea

Fagaras Rimnicu Vilcea Arad Fagaras Oradea 646=280+366 415=239+176 671=291+380

(17)

Heuristics A

Search Algorithm Hands-On

Hands-On

(18)

Hands-On

cloned course repository

https://bitbucket.org/aibasel/planopt-hs18

update the course repository cd planopt-hs18

hg pull -u

compile the planner

cd classical/hands-on-2/fast-downward ./build.py

work on the hands-on exercises implement A search

compare to built-in implementation

Referenzen

ÄHNLICHE DOKUMENTE

PDDL: Planning Domain Definition Language PDDL is the standard language used in practice to describe planning tasks. descriptions in (restricted) predicate logic instead

When applying regression in practice, we need to consider emptiness testing to prune dead-end search states subsumption testing to prune dominated search states logical

Abstractions α induce abstraction heuristics h α : h α (s ) is the goal distance of α(s ) in the abstract transition system. Abstraction heuristics are safe, goal-aware, admissible

The merge steps combine two abstract transition systems by replacing them with their synchronized product. The shrink steps make an abstract system smaller by abstracting

The objective value of an integer program that minimizes this cost subject to the flow constraints is a lower bound on the plan cost (i.e., an admissible heuristic estimate)..

Performs Bellman backup in each encountered state Uses admissible heuristic for states not updated before.. Motivation Asynchronous VI RTDP

Each decision of MCTS tree policy can be viewed as multi-armed

Initialization: expand decision node and all its chance node successors, then initialize all ˆ V k with admissible heuristic Backup function: Bellman backups &amp; solved