@@ -51,6 +51,7 @@ class KMeansPPSearch(Search):
5151 agent_info, world_info, scenario_info, module_manager, develop_data
5252 )
5353 self ._result: Optional[EntityID] = None
54+ # ロガーの取得
5455 self ._logger = get_agent_logger(
5556 f " { self .__class__ .__module__ } . { self .__class__ .__qualname__ } " ,
5657 self ._agent_info,
@@ -108,20 +109,25 @@ class KMeansPPSearch(Search):
108109 agent_info, world_info, scenario_info, module_manager, develop_data
109110 )
110111 self._result: Optional[EntityID] = None
111-
112+
113+ # ロガーの取得
112114 self._logger = get_agent_logger(
113115 f"{self.__class__.__module__}.{self.__class__.__qualname__}",
114116 self._agent_info,
115117 )
116-
118+
119+ # クラスタリングモジュールの読み込み
117120 self._clustering: Clustering = cast(
118121 Clustering,
119122 module_manager.get_module(
123+ # config.yamlに登録したkey
120124 "KMeansPPSearch.Clustering",
125+ # 上記のkeyが登録されていなかった場合のデフォルトモジュール
121126 "adf_core_python.implement.module.algorithm.k_means_clustering.KMeansClustering",
122127 ),
123128 )
124129
130+ # クラスタリングモジュールの登録
125131 self.register_sub_module(self._clustering)
126132` ` `
127133
@@ -191,7 +197,7 @@ python main.py
191197` ` `
192198
193199` ` ` {warning}
194- プログラム例のプログラムにも一部問題があるので 、余裕があったら修正してみてください。
200+ プログラム例のプログラムにも一部改善点があるので 、余裕があったら修正してみてください。
195201` ` `
196202
197203# ## 探索対象がステップごとに変わってしまう問題
@@ -230,6 +236,9 @@ python main.py
230236 # 探索対象が未選択の場合
231237 if not self._result and cluster_entity_ids:
232238 self._result = random.choice(cluster_entity_ids)
239+
240+ # ログ出力
241+ self._logger.info(f"Target entity ID: {self._result}")
233242
234243 return self
235244` ` `
@@ -259,19 +268,24 @@ python main.py
259268 )
260269 self._result: Optional[EntityID] = None
261270
271+ # ロガーの取得
262272 self._logger = get_agent_logger(
263273 f"{self.__class__.__module__}.{self.__class__.__qualname__}",
264274 self._agent_info,
265275 )
266276
277+ # クラスタリングモジュールの読み込み
267278 self._clustering: Clustering = cast(
268279 Clustering,
269280 module_manager.get_module(
281+ # config.yamlに登録したkey
270282 "KMeansPPSearch.Clustering",
283+ # 上記のkeyが登録されていなかった場合のデフォルトモジュール
271284 "adf_core_python.implement.module.algorithm.k_means_clustering.KMeansClustering",
272285 ),
273286 )
274287
288+ # クラスタリングモジュールの要録
275289 self.register_sub_module(self._clustering)
276290
277291 # 探索したいエンティティIDのリスト(追加)
@@ -305,6 +319,9 @@ python main.py
305319 # 探索対象が未選択の場合(変更)
306320 if not self._result and self._search_entity_ids:
307321 self._result = random.choice(self._search_entity_ids)
322+
323+ # ログ出力
324+ self._logger.info(f"Target entity ID: {self._result}")
308325
309326 return self
310327` ` `
@@ -358,4 +375,9 @@ python main.py
358375 nearest_entity_id = entity_id
359376 nearest_distance = distance
360377 self._result = nearest_entity_id
378+
379+ # ログ出力
380+ self._logger.info(f"Target entity ID: {self._result}")
381+
382+ return self
361383` ` `
0 commit comments