@@ -51,6 +51,7 @@ class KMeansPPSearch(Search):
51
51
agent_info, world_info, scenario_info, module_manager, develop_data
52
52
)
53
53
self ._result: Optional[EntityID] = None
54
+ # ロガーの取得
54
55
self ._logger = get_agent_logger(
55
56
f " { self .__class__ .__module__ } . { self .__class__ .__qualname__ } " ,
56
57
self ._agent_info,
@@ -108,20 +109,25 @@ class KMeansPPSearch(Search):
108
109
agent_info, world_info, scenario_info, module_manager, develop_data
109
110
)
110
111
self._result: Optional[EntityID] = None
111
-
112
+
113
+ # ロガーの取得
112
114
self._logger = get_agent_logger(
113
115
f"{self.__class__.__module__}.{self.__class__.__qualname__}",
114
116
self._agent_info,
115
117
)
116
-
118
+
119
+ # クラスタリングモジュールの読み込み
117
120
self._clustering: Clustering = cast(
118
121
Clustering,
119
122
module_manager.get_module(
123
+ # config.yamlに登録したkey
120
124
"KMeansPPSearch.Clustering",
125
+ # 上記のkeyが登録されていなかった場合のデフォルトモジュール
121
126
"adf_core_python.implement.module.algorithm.k_means_clustering.KMeansClustering",
122
127
),
123
128
)
124
129
130
+ # クラスタリングモジュールの登録
125
131
self.register_sub_module(self._clustering)
126
132
` ` `
127
133
@@ -191,7 +197,7 @@ python main.py
191
197
` ` `
192
198
193
199
` ` ` {warning}
194
- プログラム例のプログラムにも一部問題があるので 、余裕があったら修正してみてください。
200
+ プログラム例のプログラムにも一部改善点があるので 、余裕があったら修正してみてください。
195
201
` ` `
196
202
197
203
# ## 探索対象がステップごとに変わってしまう問題
@@ -230,6 +236,9 @@ python main.py
230
236
# 探索対象が未選択の場合
231
237
if not self._result and cluster_entity_ids:
232
238
self._result = random.choice(cluster_entity_ids)
239
+
240
+ # ログ出力
241
+ self._logger.info(f"Target entity ID: {self._result}")
233
242
234
243
return self
235
244
` ` `
@@ -259,19 +268,24 @@ python main.py
259
268
)
260
269
self._result: Optional[EntityID] = None
261
270
271
+ # ロガーの取得
262
272
self._logger = get_agent_logger(
263
273
f"{self.__class__.__module__}.{self.__class__.__qualname__}",
264
274
self._agent_info,
265
275
)
266
276
277
+ # クラスタリングモジュールの読み込み
267
278
self._clustering: Clustering = cast(
268
279
Clustering,
269
280
module_manager.get_module(
281
+ # config.yamlに登録したkey
270
282
"KMeansPPSearch.Clustering",
283
+ # 上記のkeyが登録されていなかった場合のデフォルトモジュール
271
284
"adf_core_python.implement.module.algorithm.k_means_clustering.KMeansClustering",
272
285
),
273
286
)
274
287
288
+ # クラスタリングモジュールの要録
275
289
self.register_sub_module(self._clustering)
276
290
277
291
# 探索したいエンティティIDのリスト(追加)
@@ -305,6 +319,9 @@ python main.py
305
319
# 探索対象が未選択の場合(変更)
306
320
if not self._result and self._search_entity_ids:
307
321
self._result = random.choice(self._search_entity_ids)
322
+
323
+ # ログ出力
324
+ self._logger.info(f"Target entity ID: {self._result}")
308
325
309
326
return self
310
327
` ` `
@@ -358,4 +375,9 @@ python main.py
358
375
nearest_entity_id = entity_id
359
376
nearest_distance = distance
360
377
self._result = nearest_entity_id
378
+
379
+ # ログ出力
380
+ self._logger.info(f"Target entity ID: {self._result}")
381
+
382
+ return self
361
383
` ` `
0 commit comments