Evaluation function Cost function g g Evaluation function Cost - - PDF document

evaluation function
SMART_READER_LITE
LIVE PREVIEW

Evaluation function Cost function g g Evaluation function Cost - - PDF document

Evaluation function Cost function g g Evaluation function Cost function expand vertex minimizing expand vertex minimizing actual cost from actual cost from s s to to v v along the cheapest path along the cheapest path found


slide-1
SLIDE 1

1

Evaluation function Evaluation function

  • expand vertex minimizing

expand vertex minimizing f f( (v v) = ) = g g( (s s ~>

~> v

v) + ) + h h( (v v ~>

~> r

r) )

  • g

g( (s s ~>

~> v

v) estimates the minimum cost from the ) estimates the minimum cost from the start vertex to start vertex to v v

  • h

h( (v v ~>

~> r

r) estimates (heuristically) the cost from ) estimates (heuristically) the cost from v v to the goal vertex to the goal vertex

  • if we had exact evaluation function

if we had exact evaluation function f f *

*, we could

, we could solve the problem without expanding any solve the problem without expanding any unnecessary vertices unnecessary vertices

Cost function Cost function g g

  • actual cost from

actual cost from s s to to v v along the cheapest path along the cheapest path found so far found so far

  • exact cost if

exact cost if G G is a tree is a tree

  • can never underestimate the cost if

can never underestimate the cost if G G is a general is a general graph graph

  • f

f( (v v) = ) = g g( (s s ~>

~> v

v) and unit cost ) and unit cost → breadth → breadth-

  • first search

first search

  • f

f( (v v) = ) = – –g g( (s s ~>

~> v

v) and unit cost ) and unit cost → depth → depth-

  • first search

first search

Heuristic function Heuristic function h h

  • carries information from outside the graph

carries information from outside the graph

  • defined for the problem domain

defined for the problem domain

  • the closer to the actual cost, the less superfluous

the closer to the actual cost, the less superfluous vertices are expanded vertices are expanded

  • f

f( (v v) = ) = g g( (s s ~>

~> v

v) → cheapest ) → cheapest-

  • first search

first search

  • f

f( (v v) = ) = h h( (v v ~>

~> r

r) → best ) → best-

  • first search

first search

Admissibility Admissibility

  • let Algorithm A be a best

let Algorithm A be a best-

  • first search using the

first search using the evaluation function evaluation function f f

  • search algorithm is

search algorithm is admissible admissible if it finds the if it finds the minimal path (if it exists) minimal path (if it exists)

  • if

if f f = = f f *

*, Algorithm A is admissible

, Algorithm A is admissible

  • Algorithm A* = Algorithm A using an estimate

Algorithm A* = Algorithm A using an estimate function function h h

  • A* is admissible, if

A* is admissible, if h h does not overestimate the does not overestimate the actual cost actual cost

Monotonicity Monotonicity

  • h

h is locally admissible → is locally admissible → h h is monotonic is monotonic

  • monotonic heuristic is also admissible

monotonic heuristic is also admissible

  • actual cost is never less than the heuristic cost

actual cost is never less than the heuristic cost → → f f will never decrease will never decrease

  • monotonicity → A* finds the shortest path to

monotonicity → A* finds the shortest path to any vertex the first time it is expanded any vertex the first time it is expanded

  • if a vertex is rediscovered, path will not be shorter

if a vertex is rediscovered, path will not be shorter

  • simplifies implementation

simplifies implementation

Optimality Optimality

  • Optimality theorem: The first path from

Optimality theorem: The first path from s s to to r r found by A* is optimal. found by A* is optimal.

  • Proof: lecture notes pp. 94

Proof: lecture notes pp. 94-

  • 95

95

slide-2
SLIDE 2

2

Informedness Informedness

  • the more closely

the more closely h h approximates approximates h h*

*, the better

, the better A* performs A* performs

  • if A

if A1

1 using

using h h1

1 will never expand a vertex that is

will never expand a vertex that is not also expanded by A not also expanded by A2

2 using

using h h2

2, A

, A1

1 is more

is more informed that A informed that A2

2

  • informedness → no other search strategy with

informedness → no other search strategy with the same amount of outside knowledge the same amount of outside knowledge can do less can do less work than A* and be sure of finding the optimal work than A* and be sure of finding the optimal solution solution

Algorithm A* Algorithm A*

  • because of monotonicity

because of monotonicity

  • all weights must be positive

all weights must be positive

  • closed list can be omitted

closed list can be omitted

  • the path is constructed from the mapping

the path is constructed from the mapping π π starting from the goal vertex starting from the goal vertex

  • s

s → … → → … → π π( (π π( (π π( (r r))) → ))) → π π( (π π( (r r)) → )) → π π( (r r) → ) → r r

Practical considerations Practical considerations

  • computing

computing h h

  • despite the extra vertices expanded, less informed

despite the extra vertices expanded, less informed h h may yield computationally less intensive may yield computationally less intensive implementation implementation

  • suboptimal solutions

suboptimal solutions

  • by allowing overestimation A* becomes

by allowing overestimation A* becomes inadmissible, but the results may be good enough for inadmissible, but the results may be good enough for practical purposes practical purposes

Search algorithms Search algorithms

depth depth-

  • first

first best best-

  • first

first A* A* breadth breadth-

  • first

first

Realizing the movement Realizing the movement

  • movement through the waypoints

movement through the waypoints

  • unrealistic: does not follow the game world geometry

unrealistic: does not follow the game world geometry

  • aesthetically displeasing: straight lines and sharp

aesthetically displeasing: straight lines and sharp turns turns

  • improvements

improvements

  • line

line-

  • of
  • f-
  • sight testing

sight testing

  • bstacle avoidance
  • bstacle avoidance
  • combining path finding to user

combining path finding to user-

  • interface

interface

  • real

real-

  • time response

time response

Recapitulation Recapitulation

1. 1.

discretization of the game world discretization of the game world

  • grid, navigation mesh

grid, navigation mesh

  • waypoints, connections, costs

waypoints, connections, costs

2. 2.

path finding in a graph path finding in a graph

  • Algorithm A*

Algorithm A*

3. 3.

realizing the movement realizing the movement

  • geometric corrections

geometric corrections

  • aesthetic improvements

aesthetic improvements

slide-3
SLIDE 3

3

Alternatives? Alternatives?

  • Although this is the

Although this is the de facto de facto approach in approach in (commercial) computer games, are there (commercial) computer games, are there alternatives? alternatives?

  • possible answers

possible answers

  • AI processors (unrealistic?)

AI processors (unrealistic?)

  • robotics: reactive agents (unintelligent?)

robotics: reactive agents (unintelligent?)

  • analytical approaches (inaccessible?)

analytical approaches (inaccessible?)