pycityagent 2.0.0a30__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,29 +413,81 @@ 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
         | 
| 427 | 
            +
                                    try:
         | 
| 428 | 
            +
                                        nominal_gdp = await agent.memory.get("nominal_gdp")
         | 
| 429 | 
            +
                                    except:
         | 
| 430 | 
            +
                                        nominal_gdp = []
         | 
| 431 | 
            +
                                    try:
         | 
| 432 | 
            +
                                        real_gdp = await agent.memory.get("real_gdp")
         | 
| 433 | 
            +
                                    except:
         | 
| 434 | 
            +
                                        real_gdp = []
         | 
| 435 | 
            +
                                    try:
         | 
| 436 | 
            +
                                        unemployment = await agent.memory.get("unemployment")
         | 
| 437 | 
            +
                                    except:
         | 
| 438 | 
            +
                                        unemployment = []
         | 
| 439 | 
            +
                                    try:
         | 
| 440 | 
            +
                                        wages = await agent.memory.get("wages")
         | 
| 441 | 
            +
                                    except:
         | 
| 442 | 
            +
                                        wages = []
         | 
| 443 | 
            +
                                    try:
         | 
| 444 | 
            +
                                        prices = await agent.memory.get("prices")
         | 
| 445 | 
            +
                                    except:
         | 
| 446 | 
            +
                                        prices = []
         | 
| 447 | 
            +
                                    try:
         | 
| 448 | 
            +
                                        inventory = await agent.memory.get("inventory")
         | 
| 449 | 
            +
                                    except:
         | 
| 450 | 
            +
                                        inventory = 0
         | 
| 451 | 
            +
                                    try:
         | 
| 452 | 
            +
                                        price = await agent.memory.get("price")
         | 
| 453 | 
            +
                                    except:
         | 
| 454 | 
            +
                                        price = 0.0
         | 
| 455 | 
            +
                                    try:
         | 
| 456 | 
            +
                                        interest_rate = await agent.memory.get("interest_rate")
         | 
| 457 | 
            +
                                    except:
         | 
| 458 | 
            +
                                        interest_rate = 0.0
         | 
| 459 | 
            +
                                    try:
         | 
| 460 | 
            +
                                        bracket_cutoffs = await agent.memory.get("bracket_cutoffs")
         | 
| 461 | 
            +
                                    except:
         | 
| 462 | 
            +
                                        bracket_cutoffs = []
         | 
| 463 | 
            +
                                    try:
         | 
| 464 | 
            +
                                        bracket_rates = await agent.memory.get("bracket_rates")
         | 
| 465 | 
            +
                                    except:
         | 
| 466 | 
            +
                                        bracket_rates = []
         | 
| 467 | 
            +
                                    try:
         | 
| 468 | 
            +
                                        employees = await agent.memory.get("employees")
         | 
| 469 | 
            +
                                    except:
         | 
| 470 | 
            +
                                        employees = []
         | 
| 412 471 | 
             
                                    _status_dict = {
         | 
| 413 472 | 
             
                                        "id": agent._uuid,
         | 
| 414 473 | 
             
                                        "day": await self.simulator.get_simulator_day(),
         | 
| 415 474 | 
             
                                        "t": await self.simulator.get_simulator_second_from_start_of_day(),
         | 
| 416 | 
            -
                                        "lng":  | 
| 417 | 
            -
                                        "lat":  | 
| 418 | 
            -
                                        "parent_id":  | 
| 475 | 
            +
                                        "lng": lng,
         | 
| 476 | 
            +
                                        "lat": lat,
         | 
| 477 | 
            +
                                        "parent_id": parent_id,
         | 
| 419 478 | 
             
                                        "action": "",
         | 
| 420 479 | 
             
                                        "type": await agent.memory.get("type"),
         | 
| 421 | 
            -
                                        "nominal_gdp":  | 
| 422 | 
            -
                                        "real_gdp":  | 
| 423 | 
            -
                                        "unemployment":  | 
| 424 | 
            -
                                        "wages":  | 
| 425 | 
            -
                                        "prices":  | 
| 426 | 
            -
                                        "inventory":  | 
| 427 | 
            -
                                        "price":  | 
| 428 | 
            -
                                        "interest_rate":  | 
| 429 | 
            -
                                        "bracket_cutoffs":  | 
| 430 | 
            -
             | 
| 431 | 
            -
                                         | 
| 432 | 
            -
                                        "bracket_rates": await agent.memory.get("bracket_rates"),
         | 
| 433 | 
            -
                                        "employees": await agent.memory.get("employees"),
         | 
| 434 | 
            -
                                        "customers": await agent.memory.get("customers"),
         | 
| 480 | 
            +
                                        "nominal_gdp": nominal_gdp,
         | 
| 481 | 
            +
                                        "real_gdp": real_gdp,
         | 
| 482 | 
            +
                                        "unemployment": unemployment,
         | 
| 483 | 
            +
                                        "wages": wages,
         | 
| 484 | 
            +
                                        "prices": prices,
         | 
| 485 | 
            +
                                        "inventory": inventory,
         | 
| 486 | 
            +
                                        "price": price,
         | 
| 487 | 
            +
                                        "interest_rate": interest_rate,
         | 
| 488 | 
            +
                                        "bracket_cutoffs": bracket_cutoffs,
         | 
| 489 | 
            +
                                        "bracket_rates": bracket_rates,
         | 
| 490 | 
            +
                                        "employees": employees,
         | 
| 435 491 | 
             
                                        "created_at": _date_time,
         | 
| 436 492 | 
             
                                    }
         | 
| 437 493 | 
             
                                    _statuses_time_list.append((_status_dict, _date_time))
         | 
| @@ -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
         |