人工知能 ( artificial intelligence ) 状態空間表現と探索 state space representation...

25
人人人人 Artificial Intelligence 人人人人人人人人人 State Space Representation and Search Lecture 2 人人人人人

Upload: bikita

Post on 29-Jan-2016

62 views

Category:

Documents


0 download

DESCRIPTION

人工知能 ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2. 田中美栄子. 状態( state )と演算( operator ). プログラミング. 人工知能 (AI). 作業 の 自動化. 変数・定数・演算を決めてモデル化. 問題設定を行うこと. 解くべき問題の決定      ↓ 解ける形に変形・単純化・離散化、 …. 状態と演算(作用). 状態 (state)  →  次状態 (next state)          ↑ - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

人工知能 ( Artificial Intelligence )

状態空間表現と探索

State Space Representation and Search

Lecture 2

田中美栄子

Page 2: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態( state )と演算( operator )

人工知能(AI)

作業の自動化

プログラミング

変数・定数・演算を決めてモデ

ル化

Page 3: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

問題設定を行うこと

• 解くべき問題の決定     ↓• 解ける形に変形・単純化・離散

化、…

Page 4: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態と演算(作用)

• 状態 (state)  → 次状態 (next state)

         ↑     演算 , 作用 (operator)

• 問題を状態遷移図(グラフ)化することで解く 

Page 5: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

Example 1 積み木A と C の間に B を入

れるA

C B

方法• A を左手で持ち上げ , その間に右手で B を C

の上に置き , その上に A を載せる

• しかし片手しか使えない , 又は1台のクレーンで持ち上げる場合も存在する

Page 6: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

拘束条件

A C B

A

C B

CA

B

• on(A,C) の A,    on(B,table) の B は移動可

状態変化例• on(A,C)→on(A,table)

• on(A,C) の C の場合は移動不可

• on(B,table) →on(B,A)

つまり・・・

Page 7: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間を定義• on(X,Y)=X は Y のすぐ上に乗っていること

を示す

• 状態 : 初期状態• {on(A,C),on(C,table),on(B,table)}

A

C

Table

B

Page 8: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間を定義• on(X,Y)=X は Y のすぐ上に乗っていること

を示す

• 状態 : 初期状態 on(A,C) & on(C,table) & on(B,table)

A

C

Table

B

Page 9: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間を操作• 終了状態 :{on(A,B),on(B,C),on(C,table)}  

 まで操作を行う .

• 状態 :1• {on(A,table),on(C,table),on(B,table)}

A C

Table

B

Page 10: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間を操作• 終了状態 :{on(A,B),on(B,C),on(C,table)}  

 まで操作を行う .

• 状態 :2• {on(A,table),on(C,table),on(B,C)}

A C

Table

B

Page 11: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

終了状態• 終了状態 :{on(A,B),on(B,C),on(C,table)}  

 なので操作終了 .

• 状態 : 終了状態• {on(A,B), on(B,C), on(C,table)}

A

C

Table

B

Page 12: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

Example 2 :ロボットの迷路抜け( Robot maze )

• 入り口から出口への経路を見つける           (ロボットは地図を知らない)

Page 13: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

ロボットの迷路抜け制約条件• 道の真ん中を歩く(両壁から均等の距離を

保つ)

Page 14: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

ロボットの迷路抜け• 格子点上を一歩ずつ歩く:( 1,1 )から

( 4,4 )へ (4,4)

(1,1) (3,1)

(1,4)

(2,2)

注)この場合分岐点に座標を書く場合もある .

A

B

C

I

D

F

H

E

Goal

注)また,分岐点に名前を適時つける場合も.

Start

Page 15: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

ロボットの迷路抜け• ( 1,1 )から

( 4,4 )へG(4,4)

S(1,1)

(2,3)

(1,4) (2,4) (3,4)

(3,3)

(2,2)

(3,1)

(3,2)

S(1,1)

A(2,3)

B(2,4)

D(1,4)E(3,4)

F(3,3)

C(2,2)

H(3,2) I(3,1)

G(4,4)

Page 16: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間移動 ( オペレータ利用 )

オペレータ• 状態遷移=状態空間の位置移動

(迷路問題と共通点)

• 「状態」「オペレータ」「拘束条件」の定義が必要    ( 与えられているとは限らない )

• 「前提条件」「適用後に削除される状態記述」「適用後に追加される状態記述」を定義が必要

Page 17: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間のグラフ表現

• グラフの構成node (節) ,edge (枝)

• 有向グラフと無向グラフ

• t ree (木)閉路 ( ループ ) のないグラ

Page 18: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

状態空間のグラフ表現

• 始節点 (start node) から目標節点 (goal node)へ

グラフの探索・  root から始める ,Bottom up =前向き推論・  goal から始める top down= 後ろ向き推論( :※ 各状態を重要と考えれば区別なし )

Page 19: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

グラフ探索(基本的には前向き推論)

• 目標節点 (goal): 探査を終了する節点

• open list : 今後調べる節点を記載しておく (探査し終わった節点は open から削

除)

• 始節点が goal ならば終了、  そうでなければ探査開始

Page 20: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

探索の基本アルゴリズム(木の場合)

• Search algorithm{• 1.初期節点を open リストに入れる• 2.   if(open==empty)break; (探索失敗)• 3.   n=first(open);• 4.   i f (goal(n))print(n);break; (探索終

了)• 5.   remove(n,open);• 6.  次に調べる節点を open に入れる• 7.  2へもどる}

Page 21: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

Depth-1ST-search (木の場合)Depth-first-search algorithm{• 1.初期節点を open リストへ• 2.   if(open==empty)break; (探索失敗)• 3.   n=first(open);• 4.   i f (goal(n))print(n);break; (探索終了)• 5.   remove(n,open);   • 6.  次探査を行う節点を open へ(n を展開し , 全子節点 ni を open の先頭に入れる )

   ni から n へポインタを付けておく• 7.  2へ

Page 22: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

例題: S→A→B→D→E→G• S ( 1,1 )から G ( 4,4 )へ

G(4,4)

(1,1)

A(2,3)

D(1,4) B(2,4) E(3,4)

(3,3)

(2,2)

(3,1)

(3,2)

S(1,1)

A(2,3)

B(2,4)

D(1,4)E(3,4)

F(3,3)

C(2,2)

H(3,2)I(3,1)

G(4,4)

Page 23: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

Depth-1ST 深さ優先探索( graph )Depth-first-search algorithm{• 1.初期節点を open リストに入れる• 2.   if(open==empty)break; (探索失敗)• 3.   n=first(open);• 4.   i f (goal(n))print(n);break; (探索終

了)• 5.   remove(n,open);   add(n,closed);• 6.  次探査を行う節点を open へ  (n を展開し全子節点 ni を open の先頭へ )

   ni から n へポインタを付けておく• 7.  2へ}

Page 24: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

Breadth-1ST 幅優先探索( graph)Breadth-first-search algorithm{• 1.初期節点を open リストへ• 2.   if(open==empty)break; (探索失敗)• 3.   n=first(open);• 4.   i f (goal(n))print(n);break; (探索終

了)• 5.   remove(n,open);   add(n,closed);• 6.  次探査を行う節点を open へ   (n を展開し , 全子節点 ni を open の最後

へ )

   ni から n へポインタを付けておく• 7.  2へ}

Page 25: 人工知能  ( Artificial Intelligence ) 状態空間表現と探索 State Space Representation and Search Lecture 2

Open list  の変化

• 深さ優先の場合S→A→BC→DEC→EC→GF

• (状態遷移は S→A→B→E→G )• 幅優先の場合 

S→A→BC→CDE→DEHI→EHI→HIGF→

IGF→GF• (状態遷移は S→A→B→E→G )