You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -180,7 +188,9 @@ class KMeansPPClustering(Clustering):
180
188
"""
181
189
if cluster_index >=len(self._cluster_entities):
182
190
return []
183
-
return [entity.get_id() for entity inself._cluster_entities[cluster_index]]
191
+
return [
192
+
entity.get_entity_id() for entity inself._cluster_entities[cluster_index]
193
+
]
184
194
185
195
defprepare(self) -> Clustering:
186
196
"""
@@ -205,17 +215,17 @@ class KMeansPPClustering(Clustering):
205
215
206
216
# エージェントとクラスターの対応付け結果を保持
207
217
self._agent_cluster_indices = {
208
-
entity.get_id(): cluster_index
218
+
entity.get_entity_id(): cluster_index
209
219
for entity, cluster_index inzip(self._agents, agent_cluster_indices)
210
220
}
211
221
212
222
# デバッグ用のログ出力
213
223
self._logger.info(
214
-
f"Clustered entities: {[[entity.get_id().get_value() for entity in cluster] for cluster inself._cluster_entities]}"
224
+
f"Clustered entities: {[[entity.get_entity_id().get_value() for entity in cluster] for cluster inself._cluster_entities]}"
215
225
)
216
226
217
227
self._logger.info(
218
-
f"Agent cluster indices: {[([self._world_info.get_entity(entity_id).get_x(), self._world_info.get_entity(entity_id).get_y()], int(cluster_index)) for entity_id, cluster_index inself._agent_cluster_indices.items()]}"
228
+
f"Agent cluster indices: {[([e.get_x(), e.get_y()] if (e isnotNoneand e.get_x() isnotNoneand e.get_y()isnotNone) else [None, None], int(cluster_index)) for entity_id, cluster_index inself._agent_cluster_indices.items() for e in (self._world_info.get_entity(entity_id),)]}"
219
229
)
220
230
221
231
returnself
@@ -292,9 +302,9 @@ class KMeansPPClustering(Clustering):
0 commit comments