pycityagent 2.0.0a31__py3-none-any.whl → 2.0.0a32__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ from typing import Any
|
|
9
9
|
from uuid import UUID
|
10
10
|
|
11
11
|
import fastavro
|
12
|
+
import pyproj
|
12
13
|
import ray
|
13
14
|
from langchain_core.embeddings import Embeddings
|
14
15
|
|
@@ -80,6 +81,7 @@ class AgentGroup:
|
|
80
81
|
# Step:2 prepare Simulator
|
81
82
|
logger.info(f"-----Creating Simulator in AgentGroup {self._uuid} ...")
|
82
83
|
self.simulator = Simulator(config["simulator_request"])
|
84
|
+
self.projector = pyproj.Proj(self.simulator.map.header["projection"])
|
83
85
|
|
84
86
|
# Step:3 prepare Economy client
|
85
87
|
if "economy" in config["simulator_request"]:
|
@@ -264,8 +266,9 @@ class AgentGroup:
|
|
264
266
|
for agent in self.agents:
|
265
267
|
_date_time = datetime.now(timezone.utc)
|
266
268
|
position = await agent.memory.get("position")
|
267
|
-
|
268
|
-
|
269
|
+
x = position["xy_position"]["x"]
|
270
|
+
y = position["xy_position"]["y"]
|
271
|
+
lng, lat = self.projector(x, y, inverse=True)
|
269
272
|
if "aoi_position" in position:
|
270
273
|
parent_id = position["aoi_position"]["aoi_id"]
|
271
274
|
elif "lane_position" in position:
|
@@ -379,8 +382,9 @@ class AgentGroup:
|
|
379
382
|
for agent in self.agents:
|
380
383
|
_date_time = datetime.now(timezone.utc)
|
381
384
|
position = await agent.memory.get("position")
|
382
|
-
|
383
|
-
|
385
|
+
x = position["xy_position"]["x"]
|
386
|
+
y = position["xy_position"]["y"]
|
387
|
+
lng, lat = self.projector(x, y, inverse=True)
|
384
388
|
if "aoi_position" in position:
|
385
389
|
parent_id = position["aoi_position"]["aoi_id"]
|
386
390
|
elif "lane_position" in position:
|
@@ -409,6 +413,17 @@ class AgentGroup:
|
|
409
413
|
else:
|
410
414
|
for agent in self.agents:
|
411
415
|
_date_time = datetime.now(timezone.utc)
|
416
|
+
position = await agent.memory.get("position")
|
417
|
+
x = position["xy_position"]["x"]
|
418
|
+
y = position["xy_position"]["y"]
|
419
|
+
lng, lat = self.projector(x, y, inverse=True)
|
420
|
+
if "aoi_position" in position:
|
421
|
+
parent_id = position["aoi_position"]["aoi_id"]
|
422
|
+
elif "lane_position" in position:
|
423
|
+
parent_id = position["lane_position"]["lane_id"]
|
424
|
+
else:
|
425
|
+
# BUG: 需要处理
|
426
|
+
parent_id = -1
|
412
427
|
try:
|
413
428
|
nominal_gdp = await agent.memory.get("nominal_gdp")
|
414
429
|
except:
|
@@ -457,9 +472,9 @@ class AgentGroup:
|
|
457
472
|
"id": agent._uuid,
|
458
473
|
"day": await self.simulator.get_simulator_day(),
|
459
474
|
"t": await self.simulator.get_simulator_second_from_start_of_day(),
|
460
|
-
"lng":
|
461
|
-
"lat":
|
462
|
-
"parent_id":
|
475
|
+
"lng": lng,
|
476
|
+
"lat": lat,
|
477
|
+
"parent_id": parent_id,
|
463
478
|
"action": "",
|
464
479
|
"type": await agent.memory.get("type"),
|
465
480
|
"nominal_gdp": nominal_gdp,
|
@@ -50,7 +50,7 @@ pycityagent/metrics/__init__.py,sha256=X08PaBbGVAd7_PRGLREXWxaqm7nS82WBQpD1zvQzc
|
|
50
50
|
pycityagent/metrics/mlflow_client.py,sha256=g_tHxWkWTDijtbGL74-HmiYzWVKb1y8-w12QrY9jL30,4449
|
51
51
|
pycityagent/metrics/utils/const.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
pycityagent/simulation/__init__.py,sha256=P5czbcg2d8S0nbbnsQXFIhwzO4CennAhZM8OmKvAeYw,194
|
53
|
-
pycityagent/simulation/agentgroup.py,sha256=
|
53
|
+
pycityagent/simulation/agentgroup.py,sha256=ARqycTmVR8kLmLojhTqP6GU1JCjjnwQ_T5SOb5-Spew,24406
|
54
54
|
pycityagent/simulation/simulation.py,sha256=9kkdgXSEOAN8wiewVFyORksti4IdVNU0opObV6ZYa9k,23344
|
55
55
|
pycityagent/simulation/storage/pg.py,sha256=qGrYzJIAzjv8-d3-cle0rY0AN6XB6MgnHkFLBoLmKWU,7251
|
56
56
|
pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
|
@@ -70,6 +70,6 @@ pycityagent/workflow/block.py,sha256=l-z9iJo9_USZQRyj4TLMfihK0-tnNDG0a6jVk9WhG0o
|
|
70
70
|
pycityagent/workflow/prompt.py,sha256=6jI0Rq54JLv3-IXqZLYug62vse10wTI83xvf4ZX42nk,2929
|
71
71
|
pycityagent/workflow/tool.py,sha256=xADxhNgVsjNiMxlhdwn3xGUstFOkLEG8P67ez8VmwSI,8555
|
72
72
|
pycityagent/workflow/trigger.py,sha256=Df-MOBEDWBbM-v0dFLQLXteLsipymT4n8vqexmK2GiQ,5643
|
73
|
-
pycityagent-2.0.
|
74
|
-
pycityagent-2.0.
|
75
|
-
pycityagent-2.0.
|
73
|
+
pycityagent-2.0.0a32.dist-info/METADATA,sha256=V94OUuB_US8D7UljUrG8MHFqx27PUDQ2qMIX_XYNJSg,8033
|
74
|
+
pycityagent-2.0.0a32.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
75
|
+
pycityagent-2.0.0a32.dist-info/RECORD,,
|
File without changes
|