授業資料 - 慶應義塾大学 徳田研究室

Download Report

Transcript 授業資料 - 慶應義塾大学 徳田研究室

ADC Systems
~ Distributed Programs and Cooperation Protocol ~
慶應義塾大学環境情報学部
徳田英幸
© H.Tokuda 2009
What is an Autonomous Distributed Cooperative
System (ADC System)?
 No supervisor which can
control/manage the entire system
システム内にシステム全体を制御/統治するスパーバイザは存在しない。
 The system consists of autonomous,
distributed and cooperative subsystems
各サブシステムは、自律、分散した構成要素からなる。
 The system functions are realized by
cooperations among subsystems
全体のシステムの機能は、サブシステム間の協調作業によって遂行される。
© H.Tokuda 2006
自律分散協調システムの目的
 機能拡大
 コスト性能比の改善
 分散処理による効率・サービスの改善
 オンラインリアルタイム処理の実現
 局所化による通信量の低減
 構成要素のmモジュール化
 拡張性の保証
 集団組織の効率化
 信頼性・耐故障性の改善
 状況・環境変化への適応
 生存可能性の増大
情報システムにおける自律分散協調
 情報システムにおける自律分散協調モデル

集中型モデル vs. 自律分散協調型モデル
 自律分散協調コンピューティングのパラダイム




分散コンピューティング
クライアントとサーバモデル
並行オブジェクト指向モデル
分散エージェント/マルチエージェント
 自律分散協調アルゴリズム



分散アルゴリズム
遺伝アルゴリズム
ニューラルコンピューティング
 ネットワークアーキテクチャ


アドホックネットワーク
センサーネットワーク
What is autonomy?
 Social Systems

Governance Model ガバナンスモデル
 電子政府モデル
 地方自治体モデル

Education, ITS, Safety Systems
教育、交通、安全システム
 Roundaout 環状交差点問題
 ADC Model
 Emergence

創発とは?
Waveは、どう起るか? 蟻
 Robot Alignment Problem
ロボット自動整列問題
 ロボットよ、コンパスを持って協調せよ!
 Cleaning Robot Problem
掃除ロボット問題
 どのようなアルゴリズムが良いか?
© H.Tokuda 2006
Cooperation Mechanisms
 Cooperation mechanisms
 Cooperation Protocols
 Cooperation Patterns? どのような協調パターンがあるのか?
 Definition & Description? どのように定義・記述するのか?

Why Cooperation?
なぜ協調するのか?
 Biological Protocols
 Biological Systems
生物システム
 ICT Protocols





Client-Server
Ethernet’s MAC Layer
Auction protocol
Circulation Protocol 回覧板プロトコル
Other protocols
© H.Tokuda 2006
生物系システム: Ants
~ 事例4 ~
Ants Nest
蟻の群行動
 巨大な蟻の巣!
© H.Tokuda 2008
Configuration of ADC System
〜 A Constructive View 〜
Configuration of ADC Systems
 Constructive Approach
構成論的手法
 Top-down, bottom-up手法
 Client-server model
 Self-Autonomous Configuration Approach
織論的手法
 自律的にシステムを構成
 群知能、集団行動
 アリの巣
 都市のかたち
 自律型ロボットシステム
© H.Tokuda 2006
自己組
Constructive Approach構成論的手法
 Creating a system architecture based
on well-defined cooperation protocols
 全体に対して個々のエージェントの役割が位置づ
けられる。
 コミュニケーションプロトコルの設計
 マスタースレーブ的な協調、機能分割的な協調
 位置的、機能的分散処理の重視
 工学的な効率、システム動作解析可能性の重視
© H.Tokuda 2006
Self-autonomous Configuration
自己組織論的手法
 Creating system architecture which can
emerge cooperation among subsystems
協調的
行動を発現するアーキテクチャの構築
 System functions are outcome of
cooperation among autonomous agents
体は、個々のエージェントのインタラクションの結果として創出される。




システムダイナミクスの研究
柔軟性、頑健性の重視
自律性に基づく協調
生物、社会現象の模倣
© H.Tokuda 2006
全
Autonomy 自律性とは?
 Autonomy 自律:
 自分で自分の行為を規制すること
 外部からの制御から脱して、自身の立てた規範に従って行
動すること
 Self-sustained 自立:
 他の援助や支配を受けず自分の力で身を立てること
 How to program autonomy?
とは?
 エージェントを作るとは?
© H.Tokuda 2006
自律性をプログラムする
Robot Alignment ロボット整列問題
 Lineup a group of robots around a
circle一群のロボットを自律的に円に整列される
 Algorithm 1: Big Brother Scheme

各位置を明示
 Algorithm 2:

Teacher Robot + Student Robots
先生ロボットが計算し、支持
 Algorithm 3: Dynamic teacher selection先
生ロボットを選出

先生ロボットを動的に選出
 Algorithm 4: Cooperating Robots
© H.Tokuda 2006
同一ロボット
Distributed Programs
Concurrent Processes and Concurrent Objects
慶應義塾大学環境情報学部
徳田英幸
© H.Tokuda 2006
ADC Models in Information Systems
 System Architecture システムアーキテクチャ的な見方
 Distributed Program 分散プログラム的な見方
 Basic Concepts
 What are system components? 構成要素は何か?
 How to cooperate?それらがどのように協調作業を進めるのか?
 Control Flow 制御の流れ
 Data Flow データの流れ
 Message Flow メッセージの流れ
© H.Tokuda 2006
Distributed Program Model
分散プログラムのモデル
 Concurrent Process Model
並行プロセスモデル
 Program = a set of cooperating (sequential)
processes
 Concurrent Object Model
並行オブジェクトモデル
 Program = a set of cooperating objects
 対象としているシステムのモデル化に適している。
 いくつかの分散・並行プログラミング言語も開発され
ている。
© H.Tokuda 2006
Concurrent Process:
Interprocess Comm. (1)
• Unicast
Proces s C1
Proces s S1
Send(S1, msg)
Receive(C1, buf)
© H.Tokuda 2006
Concurrent Process: Interprocess Comm.
(2)
Process Group G1
• Multicast
• Group Communication
GroupSend(G1, msg)
Process C1
© H.Tokuda 2006
Concurrent Process:
Interprocess Comm.
(3)
• Broadcast
All Processes
SendAll(*, msg)
Process C1
© H.Tokuda 2006
Concurrent Objects
並行オブジェクト
Obj ect
methods
Object
methods
.
.
.
© H.Tokuda 2006
Concurrent processes and their
description
並行プロセスの挙動とその記述
慶應義塾大学環境情報学部
徳田英幸
© H.Tokuda 2006
プロセス間通信: Direct IPC

The communication is done between two processes
without using any communication entity.
Bsend(process_id, message, size)
Nsend(process_id, message, size)
Brec(process_id, buffer, size)
Nrec(process_id, buffer, size)
process_id = Brecany(buffer, size)
process_id = Nrecany(buffer, size)
Request(process_id, message, sizeof(message),
buffer, sizeof(buf)
Reply(process_id, message, size)
© H.Tokuda 2006
Client/Server Model
• Client/Server Model is a well-known model.
• A client (i.e., a user process) sends the
request message to a server process, which
then does he work and sends back the
results.
Client
1. Request
4. Reply
Server
2. Accept
3. do_service
© H.Tokuda 2006
Web Server’s Architecture
© H.Tokuda 2006
Client/Server in Web
Web Server
Clients
(httpd)
Get(/foo.html http/1.0)
Response
(header +
contents(foo.html)
foo.html
© H.Tokuda 2006
Actions in Web Server
Process web_server() {
while(1) {
Brecany()
do_service()
reply()
}
}
© H.Tokuda 2006
並行プロセスの挙動
Deadlock (1)
Process P1
{
…
brec(p2, …);
…
}
Process P2
{
…
brec(p1, …);
…
}
Brec(p2,...)
p1
Brec(p1,...)
p2
© H.Tokuda 2006
並行プロセスの挙動
What is deadlock?
 システムを構成しているすべてのプロセスが
起きるはずのない事象を待ち続ける状態
p1
Brec(p2,...)
Brec(p3,...)
Brec(p1,...)
p3
p2
© H.Tokuda 2006
並行プロセスの挙動
Deadlock (2)
Process P1
{
…
request(printer,…)
request(tape, …)
…
}
p1
Process P2
{
…
request(tape, …)
request(printer,…)
…
}
p2
© H.Tokuda 2006
並行プロセスの挙動
Pipeline(1)
Process P1
{
…
bsend(p2, …);
…
}
p1
p2
Process P2
{
…
brec(p1, …);
do_my_part();
bsend(p3, …);
…
}
P3
© H.Tokuda 2006
…
pk
並行プロセスの挙動
Pipeline(2)
Process P1
{
…
Nsend(p2, …);
…
}
p1
p2
Process P2
{
…
Nsend(p3, …);
…
}
P3
© H.Tokuda 2006
…
pk
並行プロセスの挙動
Worker Model
Server S1
{
…
Brecany(msg,…)
do_service(...)
reply(msg, …)
…
}
s1
c1
© H.Tokuda 2006
並行プロセスの挙動
Dynamic Worker Model
Server S1
{
…
ci=Brecany(msg,…)
create_worker(ci,...)
…
}
Process w1
{
…
do_service(msg,…)
reply(ci,…)
}
w1
c1
s1
.
.
.
wk
© H.Tokuda 2006
並行プロセスの挙動
Static Worker Model
Server S1
{
…
ci=Brecany(msg,…)
if(ci is worker)
assign_task(ci, …)
else
enque(ci, task)
…
}
c1
Process w1
{
…
request(s1, ...)
do_service(msg,…)
reply(ci,…)
}
s1
w1
.
.
.
wk
© H.Tokuda 2006
HW1 Direct IPC Model
1)Direct IPCモデルのNsend, Nrecを使わず
にパイプライン型の協調モデルを記述せよ。
2)Direct IPCモデルを使って静的Workerモデ
ルを完成せよ。
Hint: 余分なプロセスとQueueを使う。
© H.Tokuda 2006
プロトコルとは?
~協調動作の記述~
プロトコルとは?
 外交上の儀礼
 通信の送信側と受信側で取り決めた約束事
 通信手段
pro・to・col
1 U(外交上の)儀礼,典礼.
2 C 条約原案; 議定書,プロトコル.
3 C (国家間の)協定.→#
4 C 《米》 (実験・治療の)実施要綱[計画].
5 C 【電算】 プロトコル 《データ通信の手順》.
[株式会社研究社 新英和・和英中辞典]
© H.Tokuda 2006