Commit ·
b43f9e6
1
Parent(s): 219555f
Expose data_lag_days in CityObservation; remove fragile num_districts==6 inference
Browse files- baseline/policy.py +1 -6
- models.py +1 -0
- openenv.yaml +3 -0
- server/utils.py +1 -0
baseline/policy.py
CHANGED
|
@@ -13,12 +13,7 @@ def get_client() -> OpenAI:
|
|
| 13 |
|
| 14 |
def build_prompt(obs: CityObservation) -> str:
|
| 15 |
num_districts = len(obs.districts)
|
| 16 |
-
|
| 17 |
-
# data_lag_days directly. This works because hard (6 districts) is currently the
|
| 18 |
-
# only task with a data lag. If a new task is added with 6 districts and no lag,
|
| 19 |
-
# or a lag task with fewer districts, this will silently misbehave.
|
| 20 |
-
# Fix: expose data_lag_days in CityObservation and read it directly.
|
| 21 |
-
has_data_lag = num_districts == 6
|
| 22 |
|
| 23 |
sorted_districts = sorted(
|
| 24 |
obs.districts,
|
|
|
|
| 13 |
|
| 14 |
def build_prompt(obs: CityObservation) -> str:
|
| 15 |
num_districts = len(obs.districts)
|
| 16 |
+
has_data_lag = obs.data_lag_days > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
sorted_districts = sorted(
|
| 19 |
obs.districts,
|
models.py
CHANGED
|
@@ -58,4 +58,5 @@ class CityObservation(Observation):
|
|
| 58 |
available_resources: int = Field(..., description="Resource units remaining this turn")
|
| 59 |
current_step: int = Field(..., description="Current step number")
|
| 60 |
max_steps: int = Field(..., description="Total steps allowed this episode")
|
|
|
|
| 61 |
message: Optional[str] = Field(None, description="Feedback string for debugging")
|
|
|
|
| 58 |
available_resources: int = Field(..., description="Resource units remaining this turn")
|
| 59 |
current_step: int = Field(..., description="Current step number")
|
| 60 |
max_steps: int = Field(..., description="Total steps allowed this episode")
|
| 61 |
+
data_lag_days: int = Field(0, description="Reporting lag in days (0 = real-time, 3 = hard task)")
|
| 62 |
message: Optional[str] = Field(None, description="Feedback string for debugging")
|
openenv.yaml
CHANGED
|
@@ -73,6 +73,9 @@ observation:
|
|
| 73 |
reward:
|
| 74 |
type: number
|
| 75 |
nullable: true
|
|
|
|
|
|
|
|
|
|
| 76 |
message:
|
| 77 |
type: string
|
| 78 |
nullable: true
|
|
|
|
| 73 |
reward:
|
| 74 |
type: number
|
| 75 |
nullable: true
|
| 76 |
+
data_lag_days:
|
| 77 |
+
type: integer
|
| 78 |
+
description: "Reporting lag in days (0 = real-time, 3 = hard task)"
|
| 79 |
message:
|
| 80 |
type: string
|
| 81 |
nullable: true
|
server/utils.py
CHANGED
|
@@ -86,6 +86,7 @@ def build_observation(
|
|
| 86 |
available_resources = state.available_resources,
|
| 87 |
current_step = step_count,
|
| 88 |
max_steps = state.max_steps,
|
|
|
|
| 89 |
done = done,
|
| 90 |
reward = reward,
|
| 91 |
message = message,
|
|
|
|
| 86 |
available_resources = state.available_resources,
|
| 87 |
current_step = step_count,
|
| 88 |
max_steps = state.max_steps,
|
| 89 |
+
data_lag_days = state.data_lag_days,
|
| 90 |
done = done,
|
| 91 |
reward = reward,
|
| 92 |
message = message,
|