Files
EOS/docs/_generated/configoptimization.md
T
Bobby NoelteandClaude Opus 5.5 40d0fab9d2 refactor(genetic0): refactor GENETIC0 to consolidated optimizer architecture
Pin the conversion, plan and visualization of golden runs.
Drive GENETIC0 through the optimizer registry.
Move GENETIC0 into one directory with role-named modules.
Prepare every run input once, run from the parameters.
Fall back on bad inputs instead of cancelling the run.
Simulate from frozen device dataclasses, not settings.
Convert and visualize from the parameters and result only.
Serve GENETIC0 from its own router, return a frozen result.

Additional changes
- Fix the run start of the golden runs and add a run across the DST switch.
- Configure a home appliance so the conversion covers it.
- Pass the warm start to the legacy preparation instead of reading the EMS.
- Replace EnergyManagement.genetic0_solution() by optimizer_result(name).
- Cover the warm start of the parameter preparation.
- Rename Genetic0OptimizationParameters to Genetic0Request, Genetic0CommonSettings to Genetic0Settings.
- Say in ADR 0007 and the skill that a move relabels baseline entries one to one.
- Record the renamed OpenAPI schemas in CHANGELOG.md and the upgrade guide.
- Add the observation time to the optimizer interface.
- Cache the load interpolator by its backend instead of in the EMS run cache.
- Add replay files that reproduce each golden result from its parameters.
- Stop writing demo providers, demo devices and defaults into the configuration.
- Count a NaN state of charge as invalid.
- Remove the unused electricity fee check.
- Record the fallbacks in CHANGELOG.md instead of the former demo providers.
- Leave out a battery that is not linked to the inverter.
- Count infinite forecast values as missing.
- Extend a prediction.hours that leaves fewer than two hours after the start hour.
- Do not charge from the grid without any known price.
- Without an inverter, buy the whole load from the grid instead of planning it at no cost.
- Keep the zone of the run start in the replay files.
- Correct the DVhub documentation that said a missing tariff cancels the run.
- Rename the request models to <Name><Thing>Request.
- Move the settings' to_genetic0_*() converters into the preparation.
- Remove the solution's unreachable configuration fallbacks.
- Record the renamed OpenAPI schemas in CHANGELOG.md and the upgrade guide.
- Add EnergyManagement.optimizer_run() and render the PDF from the run's own start.
- Read the presentation series from the earlier of the run's start hours.
- Render the PDF report for runs of any length, not only 48 hours.
- Add the generic OptimizerProblem, rendered like EOSProblem.
- Move Genetic0ParametersBaseModel into genetic0request.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-27 13:55:41 +01:00

11 KiB

General Optimization Configuration

:::{table} optimization :widths: 10 20 10 5 5 30 :align: left

Name Environment Variable Type Read-Only Default Description
algorithm EOS_OPTIMIZATION__ALGORITHM <enum 'OptimizationAlgorithm'> rw required Optimization algorithm [GENETIC
algorithms list[str] ro N/A Available optimization algorithms.
genetic EOS_OPTIMIZATION__GENETIC GeneticCommonSettings rw required GENETIC optimization algorithm configuration.
genetic0 EOS_OPTIMIZATION__GENETIC0 Genetic0Settings rw required GENETIC0 optimization algorithm configuration.
keys list[str] ro N/A The keys of the solution.
self_consumption_interpolator EOS_OPTIMIZATION__SELF_CONSUMPTION_INTERPOLATOR <enum 'GridInterpolatorBackend'> rw scipy How the inverter's self-consumption probability table is evaluated [scipy
:::

Example Input

   {
       "optimization": {
           "algorithm": "GENETIC",
           "genetic": {
               "interval_sec": 3600,
               "horizon_hours": 24,
               "individuals": 400,
               "generations": 400,
               "seed": null,
               "fitness_cache_max_entries": null,
               "workers": null,
               "pin_workers": true,
               "measurement_max_age_seconds": 300,
               "tail_horizon_hours": 48,
               "terminal_value_mode": "AUTO",
               "terminal_value_euro_per_kwh": 0.0,
               "terminal_value_window_hours": 24,
               "penalties": {
                   "ev_soc_miss": 10
               }
           },
           "genetic0": {
               "horizon_hours": 24,
               "individuals": 400,
               "generations": 400,
               "seed": null,
               "penalties": {
                   "ev_soc_miss": 10
               }
           },
           "self_consumption_interpolator": "scipy"
       }
   }

Example Output

   {
       "optimization": {
           "algorithm": "GENETIC",
           "genetic": {
               "interval_sec": 3600,
               "horizon_hours": 24,
               "individuals": 400,
               "generations": 400,
               "seed": null,
               "fitness_cache_max_entries": null,
               "workers": null,
               "pin_workers": true,
               "measurement_max_age_seconds": 300,
               "tail_horizon_hours": 48,
               "terminal_value_mode": "AUTO",
               "terminal_value_euro_per_kwh": 0.0,
               "terminal_value_window_hours": 24,
               "penalties": {
                   "ev_soc_miss": 10
               },
               "horizon": 24
           },
           "genetic0": {
               "horizon_hours": 24,
               "individuals": 400,
               "generations": 400,
               "seed": null,
               "penalties": {
                   "ev_soc_miss": 10
               },
               "interval_sec": 3600,
               "horizon": 24
           },
           "self_consumption_interpolator": "scipy",
           "algorithms": [
               "GENETIC",
               "GENETIC0"
           ],
           "keys": []
       }
   }

GENETIC0 Optimization Algorithm Configuration

:::{table} optimization::genetic0 :widths: 10 10 5 5 30 :align: left

Name Type Read-Only Default Description
generations Optional[int] rw 400 Number of generations to evolve [>= 10]. Defaults to 400.
horizon int ro N/A Number of optimization steps.
horizon_hours int rw 24 The general time window within which the energy optimization goal shall be achieved [h]. Defaults to 24 hours.
individuals Optional[int] rw 300 Number of individuals (solutions) in the population [>= 10]. Defaults to 300.
interval_sec int ro N/A The optimization interval [sec]. Fixed to 1 hour (3600 seconds).
penalties dict[str, Union[float, int, str]] rw required Penalty parameters used in fitness evaluation.
seed Optional[int] rw None Random seed for reproducibility. None = random.
:::

Example Input

   {
       "optimization": {
           "genetic0": {
               "horizon_hours": 24,
               "individuals": 300,
               "generations": 400,
               "seed": null,
               "penalties": {
                   "ev_soc_miss": 10
               }
           }
       }
   }

Example Output

   {
       "optimization": {
           "genetic0": {
               "horizon_hours": 24,
               "individuals": 300,
               "generations": 400,
               "seed": null,
               "penalties": {
                   "ev_soc_miss": 10
               },
               "interval_sec": 3600,
               "horizon": 24
           }
       }
   }

GENETIC Optimization Algorithm Configuration

:::{table} optimization::genetic :widths: 10 10 5 5 30 :align: left

Name Type Read-Only Default Description
fitness_cache_max_entries Optional[int] rw None Maximum number of keys in the per-run fitness cache. None = unbounded (default), 0 = cache disabled, N > 0 = keep at most N keys and evict the oldest first. Every cached evaluation takes one or two keys. The cache only saves repeated evaluations; the result for a fixed seed is the same with any value. Limit it to cap memory on small devices.
generations Optional[int] rw 400 Number of generations to evolve [>= 10]. Defaults to 400.
horizon int ro N/A Number of optimization steps.
horizon_hours int rw 24 The general time window within which the energy optimization goal shall be achieved [h]. Defaults to 24 hours.
individuals Optional[int] rw 300 Number of individuals (solutions) in the population [>= 10]. Defaults to 300.
interval_sec Literal[900, 3600] rw 3600 The optimization interval [sec]. Defaults to 3600 seconds (1 hour)
measurement_max_age_seconds int rw 300 Maximum age of SoC measurements used for configuration-based optimization [s]. Without an explicit SoC or usable measurement, the initial SoC defaults to 0%.
penalties dict[str, Union[float, int, str]] rw required Penalty parameters used in fitness evaluation.
pin_workers bool rw True Pin the evaluation workers to the last 'workers' CPU cores. The server process stays unpinned and keeps a core that is not busy with the optimization, so it answers requests during a run, and the run never uses more than 'workers' cores. Needs at least one core more than workers; Linux only.
seed Optional[int] rw None Random seed for reproducibility. None = random.
tail_horizon_hours int rw 48 Forecast lookahead after the control horizon [h]. No tail commands are issued. Set 0 to disable.
terminal_value_euro_per_kwh float rw 0.0 Value assigned to usable battery energy remaining at the end of the optimization horizon [EUR/kWh]. This terminal value is independent of the battery LCOS. Only used with terminal_value_mode = FIXED. Defaults to 0 EUR/kWh.
terminal_value_mode <enum 'TerminalValueMode'> rw AUTO How to value the energy left in the battery at the end of the control horizon. AUTO solves the forecast tail with an AUTO continuation proxy at its end (or only the proxy if tail is zero); FIXED uses 'terminal_value_euro_per_kwh'. Defaults to AUTO.
terminal_value_window_hours int rw 24 Length of the trailing window at the effective tail end the AUTO continuation curve is derived from [h]. One day covers a full load and PV cycle. Defaults to 24 hours.
workers Optional[int] rw None Processes that evaluate candidate solutions in parallel. None = automatic: one CPU core always stays free and at most two are used (1-2 cores -> 1, 3 or more cores -> 2), capped by a container CPU limit. 1 = evaluate in the server process only. The result for a fixed seed is the same with any value.
:::

Example Input

   {
       "optimization": {
           "genetic": {
               "interval_sec": 3600,
               "horizon_hours": 24,
               "individuals": 300,
               "generations": 400,
               "seed": null,
               "fitness_cache_max_entries": null,
               "workers": null,
               "pin_workers": true,
               "measurement_max_age_seconds": 300,
               "tail_horizon_hours": 48,
               "terminal_value_mode": "AUTO",
               "terminal_value_euro_per_kwh": 0.0,
               "terminal_value_window_hours": 24,
               "penalties": {
                   "ev_soc_miss": 10
               }
           }
       }
   }

Example Output

   {
       "optimization": {
           "genetic": {
               "interval_sec": 3600,
               "horizon_hours": 24,
               "individuals": 300,
               "generations": 400,
               "seed": null,
               "fitness_cache_max_entries": null,
               "workers": null,
               "pin_workers": true,
               "measurement_max_age_seconds": 300,
               "tail_horizon_hours": 48,
               "terminal_value_mode": "AUTO",
               "terminal_value_euro_per_kwh": 0.0,
               "terminal_value_window_hours": 24,
               "penalties": {
                   "ev_soc_miss": 10
               },
               "horizon": 24
           }
       }
   }