fix simulation reporting and research resilience

This commit is contained in:
2026-09-28 15:43:23 +08:00
parent 23297be2d7
commit a428214c53
25 changed files with 1488 additions and 244 deletions
+16 -4
View File
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Literal
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, model_validator
class Location(BaseModel):
@@ -10,11 +10,23 @@ class Location(BaseModel):
description: str
class TimeConfig(BaseModel):
class TimeConfig(BaseModel):
total_days: int = 365
rounds_per_day: int = 3
active_agents_per_round_min: int = 3
active_agents_per_round_max: int = 10
active_agents_per_round_min: int = 3
active_agents_per_round_max: int = 10
@model_validator(mode="after")
def validate_ranges(self) -> "TimeConfig":
if self.total_days < 1:
raise ValueError("total_days must be positive")
if self.rounds_per_day < 1:
raise ValueError("rounds_per_day must be positive")
if self.active_agents_per_round_min < 0 or self.active_agents_per_round_max < 0:
raise ValueError("active agent counts cannot be negative")
if self.active_agents_per_round_min > self.active_agents_per_round_max:
raise ValueError("active_agents_per_round_min cannot exceed max")
return self
class WorldBlueprint(BaseModel):