mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-12-02 18:36:28 +01:00
docs(optimization): add optimizer architecture ADRs, skill and test (#1572)
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)
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1159501713
commit
9adf7b8be2
@@ -0,0 +1,23 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user