• Tidak ada hasil yang ditemukan

U NIVERSITÄTK OBLENZ -L ANDAU

N/A
N/A
Protected

Academic year: 2018

Membagikan "U NIVERSITÄTK OBLENZ -L ANDAU"

Copied!
45
0
0

Teks penuh

(1)

Introduction to Artificial Intelligence

Informed Search

Bernhard Beckert

UNIVERSITÄT KOBLENZ-LANDAU

Winter Term 2004/2005

(2)

Outline

Best-first search

(3)

Review: Tree search

function TREE-SEARCH(problem, fringe) returns a solution or failure

fringe

INSERT(MAKE-NODE(INITIAL-STATE[problem]),fringe)

loop do

if fringe is empty then return failure

node

REMOVE-FIRST(fringe)

if GOAL-TEST[problem] applied to STATE(node) succeeds then

return node else

fringe

INSERT-ALL(EXPAND(node,problem),fringe)

end

Strategy

Defines the order of node expansion

(4)

Best-first search

Idea

Use an evaluation function for each node (estimate of “desirability”) Expand most desirable unexpanded node

Implementation

fringe is a queue sorted in decreasing order of desirability

Special cases

(5)

Romania with step costs in km

Rimnicu Vilcea

Vaslui Iasi

Straight−line distance to Bucharest

0

Sibiu Fagaras

Pitesti

Vaslui Iasi

Rimnicu Vilcea

(6)

Greedy search

Heuristic

Evaluation function

h

(

n

)

=

estimate of cost from

n

to

goal

Greedy search expands the node that appears to be closest to goal

Example

h

SLD

(

n

)

=

straight-line distance from

n

to Bucharest

Note

(7)

Greedy search: Example Romania

Arad 366

(8)

Greedy search: Example Romania

Zerind Arad

Sibiu Timisoara

(9)

Greedy search: Example Romania

Rimnicu Vilcea

Zerind Arad

Sibiu

Arad Fagaras Oradea

Timisoara

329 374

366 176 380 193

(10)

Greedy search: Example Romania

Rimnicu Vilcea

Zerind Arad

Sibiu

Arad Fagaras Oradea

Timisoara

Sibiu Bucharest

329 374

366 380 193

(11)

Greedy search: Properties

Complete

Time

Space

Optimal

(12)

Greedy search: Properties

Complete No

Can get stuck in loops Example: Iasi to Oradea

Iasi

Neamt

Iasi

Neamt

→ · · ·

Complete in finite space with repeated-state checking

Time

Space

(13)

Greedy search: Properties

Complete No

Can get stuck in loops Example: Iasi to Oradea

Iasi

Neamt

Iasi

Neamt

→ · · ·

Complete in finite space with repeated-state checking

Time

O

(

b

m

)

Space

Optimal

(14)

Greedy search: Properties

Complete No

Can get stuck in loops Example: Iasi to Oradea

Iasi

Neamt

Iasi

Neamt

→ · · ·

Complete in finite space with repeated-state checking

Time

O

(

b

m

)

Space

O

(

b

m

)

(15)

Greedy search: Properties

Complete No

Can get stuck in loops Example: Iasi to Oradea

Iasi

Neamt

Iasi

Neamt

→ · · ·

Complete in finite space with repeated-state checking

Time

O

(

b

m

)

Space

O

(

b

m

)

Optimal No

(16)

Greedy search: Properties

Complete No

Can get stuck in loops Example: Iasi to Oradea

Iasi

Neamt

Iasi

Neamt

→ · · ·

Complete in finite space with repeated-state checking

Time

O

(

b

m

)

Space

O

(

b

m

)

Optimal No

Note

Worst-case time same as depth-first search, Worst-case space same as breadth-first

(17)

A

search

Idea

Avoid expanding paths that are already expensive

Evaluation function

f

(

n

)

=

g

(

n

) +

h

(

n

)

where

g

(

n

) =

cost so far to reach

n

h

(

n

) =

estimated cost to goal from

n

f

(

n

) =

estimated total cost of path through

n

to goal

(18)

A

search: Admissibility

Admissibility of heuristic

h

(

n

)

is admissible if

h

(

n

)

h

(

n

)

for all

n

(19)

A

search: Admissibility

Admissibility of heuristic

h

(

n

)

is admissible if

h

(

n

)

h

(

n

)

for all

n

where

h

(

n

)

is the true cost from

n

to goal

Also required

h

(

n

)

0

for all

n

In particular:

h

(

G

) =

0

for goal

G

(20)

A

search: Admissibility

Admissibility of heuristic

h

(

n

)

is admissible if

h

(

n

)

h

(

n

)

for all

n

where

h

(

n

)

is the true cost from

n

to goal

Also required

h

(

n

)

0

for all

n

In particular:

h

(

G

) =

0

for goal

G

Example

(21)

A

search: Admissibility

Theorem

Asearch with admissible heuristic is optimal

(22)

A

search example

(23)

A

search example

Zerind Arad

Sibiu Timisoara

447=118+329 449=75+374 393=140+253

(24)

A

search example

Zerind Arad

Sibiu

Arad

Timisoara

Rimnicu Vilcea

Fagaras Oradea

447=118+329 449=75+374

(25)

A

search example

Zerind Arad

Sibiu

Arad

Timisoara

Fagaras Oradea

447=118+329 449=75+374

646=280+366 415=239+176

Rimnicu Vilcea

Craiova Pitesti Sibiu 526=366+160 417=317+100 553=300+253 671=291+380

(26)

A

search example

Zerind Arad

Sibiu

Arad

Timisoara

Sibiu Bucharest

Rimnicu Vilcea

Fagaras Oradea

Craiova Pitesti Sibiu

447=118+329 449=75+374

646=280+366

(27)

A

search example

Sibiu Bucharest

Rimnicu Vilcea

Fagaras 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

(28)

A

search:

f

-contours

Agradually adds “

f

-contours” of nodes

(29)

Optimality of A

search: Proof

Suppose a suboptimal goal

G

2 has been generated

Let

n

be an unexpanded node on a shortest path to an optimal goal

G

f

(

G

2

) =

g

(

G

2

)

since

h

(

G

2

) =

0

>

g

(

G

)

since

G

2 suboptimal

=

g

(

n

) +

h

(

n

)

g

(

n

) +

h

(

n

)

since

h

is admissible

=

f

(

n

)

Thus, Anever selects

G

2 for expansion

(30)

A

search: Properties

Complete

Time

Space

(31)

A

search: Properties

Complete Yes

(unless there are infinitely many nodes

n

with

f

(

n

)

f

(

G

)

)

Time

Space

Optimal

(32)

A

search: Properties

Complete Yes

(unless there are infinitely many nodes

n

with

f

(

n

)

f

(

G

)

)

Time Exponential in

[relative error in

h

×

length of solution]

Space

(33)

A

search: Properties

Complete Yes

(unless there are infinitely many nodes

n

with

f

(

n

)

f

(

G

)

)

Time Exponential in

[relative error in

h

×

length of solution]

Space Same as time

Optimal

(34)

A

search: Properties

Complete Yes

(unless there are infinitely many nodes

n

with

f

(

n

)

f

(

G

)

)

Time Exponential in

[relative error in

h

×

length of solution]

Space Same as time

(35)

A

search: Properties

Complete Yes

(unless there are infinitely many nodes

n

with

f

(

n

)

f

(

G

)

)

Time Exponential in

[relative error in

h

×

length of solution]

Space Same as time

Optimal Yes

Note

Aexpands all nodes with

f

(

n

)

<

C

Aexpands some nodes with

f

(

n

) =

C

Aexpands no nodes with

f

(

n

)

>

C

(36)

Admissible heuristics: Example 8-puzzle

2

Start State Goal State

5

Addmissible heuristics

h

1

(

n

)

= number of misplaced tiles

h

2

(

n

)

= total ˘Manhattan distance

(37)

Admissible heuristics: Example 8-puzzle

2

Start State Goal State

5

Addmissible heuristics

h

1

(

n

)

= number of misplaced tiles

h

2

(

n

)

= total ˘Manhattan distance

(i.e., no. of squares from desired location of each tile)

In the example

h

1

(

S

)

=

h

2

(

S

)

=

(38)

Admissible heuristics: Example 8-puzzle

2

Start State Goal State

5

Addmissible heuristics

h

1

(

n

)

= number of misplaced tiles

h

2

(

n

)

= total ˘Manhattan distance

(i.e., no. of squares from desired location of each tile)

In the example

h

1

(

S

)

= 6

(39)

Admissible heuristics: Example 8-puzzle

2

Start State Goal State

5

Addmissible heuristics

h

1

(

n

)

= number of misplaced tiles

h

2

(

n

)

= total ˘Manhattan distance

(i.e., no. of squares from desired location of each tile)

In the example

h

1

(

S

)

= 6

h

2

(

S

)

= 2 + 0 + 3 + 1 + 0 + 1 + 3 + 4 = 14

(40)

Dominance

Definition

h

1

,

h

2 two admissible heuristics

h

2 dominates

h

1 if

(41)

Dominance

Definition

h

1

,

h

2 two admissible heuristics

h

2 dominates

h

1 if

h

2

(

n

)

h

1

(

n

)

for all

n

Theorem

If

h

2 dominates

h

1, then

h

2 is better for search than

h

1.

(42)

Dominance: Example 8-puzzle

Typical search costs

d

=

14

IDS 3,473,941 nodes

A

(

h

1

)

539 nodes

A

(

h

2

)

113 nodes

d

=

24

IDS too many nodes

A

(

h

1

)

39,135 nodes

A

(

h

2

)

1,641 nodes

d

: depth of first solution

(43)

Relaxed problems

Finding good admissible heuristics is an art!

Deriving admissible heuristics

Admissible heuristics can be derived from the exact

solution cost of a relaxed version of the problem

(44)

Relaxed problems

Finding good admissible heuristics is an art!

Deriving admissible heuristics

Admissible heuristics can be derived from the exact

solution cost of a relaxed version of the problem

Example

If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then we get heuristic

h

1

(45)

Relaxed problems

Finding good admissible heuristics is an art!

Deriving admissible heuristics

Admissible heuristics can be derived from the exact

solution cost of a relaxed version of the problem

Example

If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then we get heuristic

h

1

If the rules are relaxed so that a tile can move to any adjacent square, then we get heuristic

h

2

Key point

The optimal solution cost of a relaxed problem is not greater than the optimal solution cost of the real problem

Referensi

Dokumen terkait

dingin pada 25 kg/cm 2 selama 10 menit. Metode penelitian ini menggunakan dua tahap proses pengerasan papan semen. Tahap pertama proses pengerasan papan kering udara selama 4-5

Demikian Pengumuman Pemenang Pelelangan ini dibuat dan ditandatangani pada hari, tanggal dan bulan sebagaimana tersebut di atas untuk dipergunakan sebagaimana

[r]

sanggahan berkait an dengan Pelelangan pengadaan makan dan ekst ra f ooding sisw a Dikt uk.. Brigadir

Sehubungan dengan hasil evaluasi Paket Pekerjaan Penyusunan Informasi Status Kerusakan Lahan dan/atau Tanah untuk Produksi Biomassa Kegiatan Pelayanan Informasi

Disamping itu, mudahnya penggunaan dan mendapatkan media realia untuk alat ukur menjadikan media ini sangat tepat untuk digunakan oleh guru sebagai

Republik Indonesia Tahun 1977 Nomor 11, Tambahanf. Lembaran Negara Republik Indonesia

Prediksi Potensi Debit Berdasartkan Data Hujan Maksimum Bulanan dengan Metode Jaringan Syaraf Tiruan Backpropagation di DAS Alang.. Pengelolaan Sumber Daya Air