Next revision
|
Previous revision
|
brica_platform [2022/04/27 16:51] n.arakawa created |
brica_platform [2023/01/22 14:18] (current) n.arakawa [Use Case] |
===== BriCA Platform ===== | ===== BriCA Platform ===== |
The BriCA Platform is a collection of software modules to develop brain-inspired cognitive architecture with BriCA and to be run on [[https://gym.openai.com|OpenAI Gym]]. | The BriCA Platform is a collection of software modules to develop brain-inspired cognitive architecture with [[BriCA]] to be run on [[https://gym.openai.com|OpenAI Gym]]. |
| |
==== Modules ==== | ==== Modules ==== |
BriCA Platform contains the following modules: | The BriCA Platform contains the following modules: |
* [[https://github.com/wbap/BriCA1|BriCA1]]: the BriCA core to describe and run brain-inspired cognitive architectures (in Python). | * [[https://github.com/wbap/BriCA1|BriCA1]]: the BriCA core to describe and run brain-inspired cognitive architectures (in Python). |
* [[https://github.com/wbap/BriCA1/blob/master/brica1/brica_gym.py|brica_gym]]: a Python program to create [[https://gym.openai.com|OpenAI Gym]] agents\\ (containing classes for adapting to Gym execution cycles) | * [[https://github.com/wbap/BriCA1/blob/master/brica1/brica_gym.py|brica_gym]]: a Python program to create [[https://gym.openai.com|OpenAI Gym]] agents\\ (containing classes for adapting to Gym execution cycles) |
- Describe modules, ports, and connections in a spreadsheet (Excel file)\\ (See [[https://github.com/wbap/BriCAL/tree/master/bif_excel2brical|bif_excel2brical]] and the examples below for the format.) | - Describe modules, ports, and connections in a spreadsheet (Excel file)\\ (See [[https://github.com/wbap/BriCAL/tree/master/bif_excel2brical|bif_excel2brical]] and the examples below for the format.) |
- Convert the spreadsheet into the JSON format with bif_excel2brical | - Convert the spreadsheet into the JSON format with bif_excel2brical |
- Implement a Gym environment, BriCA components, and the main program (see the examples below). | - Implement a Gym environment, BriCA components, and the main program (see the examples below).\\ The skeletal code for the main program can be generated with [[https://github.com/wbap/BriCAL/tree/master/brical2py|brical2py]]. |
- Test & debug | - Test & debug |
| |
==== Overview of the Main Program ==== | ==== Main Program Overview ==== |
BriCA言語インタプリタとOpenAI Gymを用いた認知アーキテクチャのコードは概ね次のようなコードを含みます。 | Code for cognitive architecture with the BriCA language interpreter and OpenAI Gym generally contains the following: |
* 必要なライブラリのインポート(含 ''brica1'', ''brica1.brica_gym'', ''brica1'',''brical'', ''gym'', ''numpy'', ''json'') | * Importing necessary libraries (including ''brica1'', ''brica1.brica_gym'', ''brica1'',''brical'', ''gym'', ''numpy'', ''json'') |
* JSON形式のBriCA言語記述ファイルの読み込み、形式チェック\\ (この段階で BriCAモジュールが生成されBriCA言語内部表現''nb''に紐付けられます) | * Reading and checking a BriCA language file (JSON)\\ (At this stage, BriCA modules are generated and linked to an internal expression of the language ''nb''.) |
* 他の設定ファイルなどの読み込み(あれば) | * Reading other config. files (if any) |
* Gym環境インスタンス生成 | * Instantiating a Gym environment (''env'') |
* BriCAコンポーネント初期化 | * Initializing BriCA components |
* ポート作成(''nb.make_ports()'') | * Creating ports(''nb.make_ports()'') |
* ''agent_builder = brical.AgentBuilder()'' | * ''agent_builder = brical.AgentBuilder()'' |
* ''agent = agent_builder.create_gym_agent(nb, 認知アーキテクチャ最上位モジュール, Gym環境インスタンス)'' | * ''agent = agent_builder.create_gym_agent(nb, the top module, env)'' |
* ''scheduler = brica1.VirtualTimeSyncScheduler(agent)'' | * ''scheduler = brica1.VirtualTimeSyncScheduler(agent)'' |
* ループを回して BriCAの "scheduler.step()''を実行\\ (Gym環境と同期させるためにトークンを回していることに注意) | * Executing ''scheduler.step()'' while looping\\ (Note that tokens are circulated to synchronize with Gym env. cycles.) |
* 終了後環境などをクローズ | * Closing |
具体例は下記を参照ください。 | See examples below for details. |
==== 例題 ==== | ==== Examples ==== |
=== BriCAテスト === | === BriCA Test === |
(Gymエージェントではない) | (Not a Gym agent) |
* [[https://ggle.io/4wXy|表形式]] | * [[https://ggle.io/4wXy|Spreadsheet]] |
* [[https://github.com/wbap/BriCAL/blob/master/bif_excel2brical/usecase/n001.brical.json|JSON形式BriCA言語ファイル]] | * [[https://github.com/wbap/BriCAL/blob/master/bif_excel2brical/usecase/n001.brical.json|BriCAL in JSON]] |
* [[https://github.com/wbap/BriCAL/blob/master/bif_excel2brical/usecase/n001.py|Mainプログラム]] | * [[https://github.com/wbap/BriCAL/blob/master/bif_excel2brical/usecase/n001.py|Main program]] |
| |
=== 最小限の認知アーキテクチャ === | === Minimal Cognitive Architecture === |
(Gymエージェント) | (Gym agent) |
* [[https://ggle.io/4wZG|表形式]] | * [[https://ggle.io/4wZG|Spreadsheet]] |
* [[https://github.com/rondelion/minimalCA/blob/main/minimal_CA.brical.json|JSON形式BriCA言語ファイル]] | * [[https://github.com/rondelion/minimalCA/blob/main/minimal_CA.brical.json|BriCAL in JSON]] |
* [[https://github.com/rondelion/minimalCA/blob/main/minimal_CA_1_BL.py|Mainプログラム]] | * [[https://github.com/rondelion/minimalCA/blob/main/minimal_CA_1_BL.py|Main program]] |
| |
=== 皮質・基底核・視床ループ === | === Cortex-Basal Ganglia Loop === |
(Gymエージェント) | (Gym agent) |
* [[https://ggle.io/4wZK|表形式]] | * [[https://ggle.io/4wZK|Spreadsheet]] |
* [[https://github.com/rondelion/MinimalCtxBGA/blob/main/CBT1CA.brical.json|JSON形式BriCA言語ファイル]] | * [[https://github.com/rondelion/MinimalCtxBGA/blob/main/CBT1CA.brical.json|BriCAL in JSON]] |
* [[https://github.com/rondelion/MinimalCtxBGA/blob/main/CBT1cCA_1_BL.py|Mainプログラム]] | * [[https://github.com/rondelion/MinimalCtxBGA/blob/main/CBT1cCA_1_BL.py|Main program]] |
| |
=== 注意機構を持つ作業記憶 === | === Working Memory with Attention Mechanism === |
(Gymエージェント) | (Gym agent) |
* [[https://ggle.io/4wZO|表形式]] | * [[https://ggle.io/4wZO|Spreadsheet]] |
* [[https://github.com/rondelion/MinimalWMAgent/blob/main/MinWMAgent1.brical.json|JSON形式BriCA言語ファイル]] | * [[https://github.com/rondelion/MinimalWMAgent/blob/main/MinWMAgent1.brical.json|BriCAL in JSON]] |
* [[https://github.com/rondelion/MinimalWMAgent/blob/main/MinWMAgent1_1_BL.py|Mainプログラム]]\\ 内部結合を持つアーキテクチャでは内部出力を持つコンポーネントを 環境エピソード終了後にリセットし、前のエピソードの情報が残らないようにする必要があります。 | * [[https://github.com/rondelion/MinimalWMAgent/blob/main/MinWMAgent1_1_BL.py|Main program]]\\ Note: In architectures with internal connections, components with internal output should be reset when an environment episode ends so that information from the last episode is not carried over. |
| |
上記3つの実装の解説は[[https://doi.org/10.11517/jsaisigtwo.2022.AGI-020_02|こちら]] | The explanation for these three implementations is found [[http://rondelionai.blogspot.com/2022/03/attempts-to-implement-biologically.html|here]] |
| |