pycityagent 2.0.0a25__tar.gz → 2.0.0a27__tar.gz
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.
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/PKG-INFO +1 -1
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/simulator.py +17 -5
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/const.py +2 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/simulation/agentgroup.py +55 -13
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pyproject.toml +1 -1
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/README.md +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/agent.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/economy/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/economy/econ_client.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/interact/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/interact/interact.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/message/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sence/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sence/static.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sidecar/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sidecar/sidecarv2.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/aoi_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/client.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/clock_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/economy_services.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/lane_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/light_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/person_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/road_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/sim_env.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/social_service.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/base64.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/geojson.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/grpc.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/map_utils.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/port.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/utils/protobuf.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/llm/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/llm/embeddings.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/llm/llm.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/llm/llmconfig.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/llm/utils.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/const.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/faiss_query.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/memory.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/memory_base.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/profile.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/self_define.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/state.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/memory/utils.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/message/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/message/messager.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/metrics/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/metrics/mlflow_client.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/metrics/utils/const.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/simulation/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/simulation/simulation.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/simulation/storage/pg.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/survey/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/survey/manager.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/survey/models.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/avro_schema.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/decorators.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/parsers/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/parsers/code_block_parser.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/parsers/json_parser.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/parsers/parser_base.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/pg_query.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/survey_util.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/workflow/__init__.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/workflow/block.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/workflow/prompt.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/workflow/tool.py +0 -0
- {pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/workflow/trigger.py +0 -0
@@ -104,6 +104,8 @@ class Simulator:
|
|
104
104
|
self._bbox: tuple[float, float, float, float] = (-1, -1, -1, -1)
|
105
105
|
self.poi_matrix_centers = []
|
106
106
|
self._lock = asyncio.Lock()
|
107
|
+
# poi id dict
|
108
|
+
self.poi_id_2_aoi_id: dict[int, int] = {}
|
107
109
|
# poi STRtree
|
108
110
|
self.set_poi_tree()
|
109
111
|
|
@@ -146,6 +148,7 @@ class Simulator:
|
|
146
148
|
for tree_id, poi in enumerate(self.map.pois.values()):
|
147
149
|
tree_id_2_poi_and_catg[tree_id] = (poi, poi["category"])
|
148
150
|
poi_geos.append(Point([poi["position"][k] for k in ["x", "y"]]))
|
151
|
+
self.poi_id_2_aoi_id[poi["id"]] = poi["aoi_id"]
|
149
152
|
self.tree_id_2_poi_and_catg = tree_id_2_poi_and_catg
|
150
153
|
self.pois_tree = STRtree(poi_geos)
|
151
154
|
|
@@ -250,12 +253,21 @@ class Simulator:
|
|
250
253
|
_schedules = []
|
251
254
|
for target_pos, _time, _mode in zip(target_positions, departure_times, modes):
|
252
255
|
if isinstance(target_pos, int):
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
"
|
256
|
+
if target_pos >= POI_START_ID:
|
257
|
+
poi_id = target_pos
|
258
|
+
end = {
|
259
|
+
"aoi_position": {
|
260
|
+
"aoi_id": self.poi_id_2_aoi_id[poi_id],
|
261
|
+
"poi_id": poi_id,
|
262
|
+
}
|
263
|
+
}
|
264
|
+
else:
|
265
|
+
aoi_id = target_pos
|
266
|
+
end = {
|
267
|
+
"aoi_position": {
|
268
|
+
"aoi_id": aoi_id,
|
269
|
+
}
|
257
270
|
}
|
258
|
-
}
|
259
271
|
else:
|
260
272
|
aoi_id, poi_id = target_pos
|
261
273
|
end = {"aoi_position": {"aoi_id": aoi_id, "poi_id": poi_id}}
|
@@ -271,7 +271,6 @@ class AgentGroup:
|
|
271
271
|
elif "lane_position" in position:
|
272
272
|
parent_id = position["lane_position"]["lane_id"]
|
273
273
|
else:
|
274
|
-
# BUG: 需要处理
|
275
274
|
parent_id = -1
|
276
275
|
needs = await agent.memory.get("needs")
|
277
276
|
action = await agent.memory.get("current_step")
|
@@ -297,23 +296,66 @@ class AgentGroup:
|
|
297
296
|
else:
|
298
297
|
for agent in self.agents:
|
299
298
|
_date_time = datetime.now(timezone.utc)
|
299
|
+
try:
|
300
|
+
nominal_gdp = await agent.memory.get("nominal_gdp")
|
301
|
+
except:
|
302
|
+
nominal_gdp = []
|
303
|
+
try:
|
304
|
+
real_gdp = await agent.memory.get("real_gdp")
|
305
|
+
except:
|
306
|
+
real_gdp = []
|
307
|
+
try:
|
308
|
+
unemployment = await agent.memory.get("unemployment")
|
309
|
+
except:
|
310
|
+
unemployment = []
|
311
|
+
try:
|
312
|
+
wages = await agent.memory.get("wages")
|
313
|
+
except:
|
314
|
+
wages = []
|
315
|
+
try:
|
316
|
+
prices = await agent.memory.get("prices")
|
317
|
+
except:
|
318
|
+
prices = []
|
319
|
+
try:
|
320
|
+
inventory = await agent.memory.get("inventory")
|
321
|
+
except:
|
322
|
+
inventory = 0
|
323
|
+
try:
|
324
|
+
price = await agent.memory.get("price")
|
325
|
+
except:
|
326
|
+
price = 0.0
|
327
|
+
try:
|
328
|
+
interest_rate = await agent.memory.get("interest_rate")
|
329
|
+
except:
|
330
|
+
interest_rate = 0.0
|
331
|
+
try:
|
332
|
+
bracket_cutoffs = await agent.memory.get("bracket_cutoffs")
|
333
|
+
except:
|
334
|
+
bracket_cutoffs = []
|
335
|
+
try:
|
336
|
+
bracket_rates = await agent.memory.get("bracket_rates")
|
337
|
+
except:
|
338
|
+
bracket_rates = []
|
339
|
+
try:
|
340
|
+
employees = await agent.memory.get("employees")
|
341
|
+
except:
|
342
|
+
employees = []
|
300
343
|
avro = {
|
301
344
|
"id": agent._uuid,
|
302
345
|
"day": await self.simulator.get_simulator_day(),
|
303
346
|
"t": await self.simulator.get_simulator_second_from_start_of_day(),
|
304
347
|
"type": await agent.memory.get("type"),
|
305
|
-
"nominal_gdp":
|
306
|
-
"real_gdp":
|
307
|
-
"unemployment":
|
308
|
-
"wages":
|
309
|
-
"prices":
|
310
|
-
"inventory":
|
311
|
-
"price":
|
312
|
-
"interest_rate":
|
313
|
-
"bracket_cutoffs":
|
314
|
-
"bracket_rates":
|
315
|
-
"employees":
|
316
|
-
"customers": await agent.memory.get("customers"),
|
348
|
+
"nominal_gdp": nominal_gdp,
|
349
|
+
"real_gdp": real_gdp,
|
350
|
+
"unemployment": unemployment,
|
351
|
+
"wages": wages,
|
352
|
+
"prices": prices,
|
353
|
+
"inventory": inventory,
|
354
|
+
"price": price,
|
355
|
+
"interest_rate": interest_rate,
|
356
|
+
"bracket_cutoffs": bracket_cutoffs,
|
357
|
+
"bracket_rates": bracket_rates,
|
358
|
+
"employees": employees,
|
317
359
|
}
|
318
360
|
avros.append(avro)
|
319
361
|
_statuses_time_list.append((avro, _date_time))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/environment/sim/economy_services.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pycityagent-2.0.0a25 → pycityagent-2.0.0a27}/pycityagent/utils/parsers/code_block_parser.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|