Evaluation
dsbx.Eval
Evaluation utilities for dynamic scheduling trajectories.
This package starts with a lightweight trajectory representation that can be produced by environments and simulators, and will be extended with constraints and metric computation utilities.
- class dsbx.Eval.StepRecord(**data)
Bases:
BaseModelA single step in a scheduling trajectory.
Each step records the decision point time, the full snapshot and the action that led to it. The info field can hold arbitrary metadata (e.g. rewards, solver stats).
- Parameters:
time (float)
snapshot (Snapshot)
action (Dict[str, Any] | None)
info (Dict[str, Any])
- time: float
- action: Dict[str, Any] | None
- info: Dict[str, Any]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dsbx.Eval.Trajectory(**data)
Bases:
BaseModelA sequence of decision points for a single scenario/run.
In the disk-backed setting, this model acts primarily as a lightweight handle around a JSONL file that stores one header line with static context followed by per-step dynamic records. The legacy
stepslist is preserved for compatibility but is no longer required to hold the entire trajectory in memory.- Parameters:
steps (List[StepRecord])
scenario_id (str | None)
seed (int | None)
config (Dict[str, Any])
static_context (StaticContext | None)
- steps: List[StepRecord]
- scenario_id: str | None
- seed: int | None
- config: Dict[str, Any]
- static_context: StaticContext | None
- append_step(step)
Append an in-memory step (legacy behaviour).
- Return type:
None- Parameters:
step (StepRecord)
- iter_steps()
Iterate over all steps in the trajectory.
If a backing JSONL file is configured, steps are streamed from disk and static context is injected on the fly. Otherwise, this falls back to iterating over the in-memory
stepslist.- Return type:
Iterator[StepRecord]
- iter_summaries()
- Return type:
Iterator[Dict[str,Any]]
- classmethod load_from_disk(path)
Create a disk-backed
Trajectoryfrom a JSONL file.The file is expected to contain:
a first header line with a
static_contextobject; andsubsequent lines describing individual steps with at least
timeandsnapshotfields.
- Return type:
- Parameters:
path (Path)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (
BaseModel) – The BaseModel instance.context (
Any) – The context.
- Return type:
None