mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-12-02 18:36:28 +01:00
Additional changes - Add the optimizer terms to the glossary. - Point to the skill from AGENTS.md, docs/develop/ai.md and the energy-domain skill. - Match module names case-exactly, also on case-insensitive file systems. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Claude Code (claude-opus-5-5)
24 lines
1.4 KiB
Markdown
24 lines
1.4 KiB
Markdown
# Optimization parameters are dataclasses, optimization requests are Pydantic models
|
|
|
|
The optimization parameters are read in the innermost loops of an optimization run, and they no
|
|
longer cross the public API: clients send optimization requests, which parameter preparation
|
|
completes into optimization parameters ([0006](0006-optimizer-interface-prepare-run-convert.md)).
|
|
So the optimization parameters, including the device parameters of the simulation, are plain
|
|
Python dataclasses (`@dataclass(frozen=True, slots=True)`: a run never changes its inputs, and
|
|
slots keep attribute access fast), never Pydantic models; they are valid by construction because parameter
|
|
preparation always builds a valid set (see the `energy-domain` skill), not because a model
|
|
validates them. Validation and the public schema live where external input arrives: optimization
|
|
requests are Pydantic models, and the settings models of the configuration stay Pydantic models.
|
|
|
|
## Considered Options
|
|
|
|
- **Pydantic models for the optimization parameters**: rejected. Attribute access and copies of
|
|
Pydantic models cost time in the run, and the validation they offer is redundant behind a
|
|
parameter preparation that never produces an invalid set.
|
|
|
|
## Consequences
|
|
|
|
- An invalid optimization parameter set is a bug in parameter preparation, found by its tests,
|
|
not a validation error at run time.
|
|
- Replay files need an explicit (de)serialization of the dataclasses instead of Pydantic's.
|