akkudoktoreos.optimization.genetic.optimization_problem

class akkudoktoreos.optimization.genetic.optimization_problem(verbose: bool = False, fixed_seed: int | None = None)

Bases: ConfigMixin, DevicesMixin, EnergyManagementSystemMixin

__init__(verbose: bool = False, fixed_seed: int | None = None)

Initialize the optimization problem with the required parameters.

Methods

__init__([verbose, fixed_seed])

Initialize the optimization problem with the required parameters.

create_individual()

decode_charge_discharge(discharge_hours_bin)

Decode the input array into ac_charge, dc_charge, and discharge arrays.

evaluate(individual, parameters, start_hour, ...)

Evaluate the fitness of an individual solution based on the simulation results.

evaluate_inner(individual)

Simulates the energy management system (EMS) using the provided individual solution.

merge_individual(discharge_hours_bin, ...)

Merge the individual components back into a single solution list.

mutate(individual)

Custom mutation function for the individual.

optimierung_ems(parameters[, start_hour, ...])

Perform EMS (Energy Management System) optimization and visualize results.

optimize([start_solution, ngen])

Run the optimization process using a genetic algorithm.

setup_deap_environment(opti_param, start_hour)

Set up the DEAP environment with fitness and individual creation rules.

split_individual(individual)

Split the individual solution into its components.

Attributes

config

Convenience method/ attribute to retrieve the EOS configuration data.

devices

Convenience method/ attribute to retrieve the EOS devices simulation data.

ems

Convenience method/ attribute to retrieve the EOS energy management system.

__init__(verbose: bool = False, fixed_seed: int | None = None)

Initialize the optimization problem with the required parameters.

decode_charge_discharge(discharge_hours_bin: ndarray) tuple[ndarray, ndarray, ndarray]

Decode the input array into ac_charge, dc_charge, and discharge arrays.

mutate(individual: list[int]) tuple[list[int]]

Custom mutation function for the individual.

create_individual() list[int]
merge_individual(discharge_hours_bin: ndarray, eautocharge_hours_index: ndarray | None, washingstart_int: int | None) list[int]

Merge the individual components back into a single solution list.

Parameters:
  • discharge_hours_bin (np.ndarray) – Binary discharge hours.

  • eautocharge_hours_index (Optional[np.ndarray]) – EV charge hours as integers, or None.

  • washingstart_int (Optional[int]) – Dishwasher start time as integer, or None.

Returns:

The merged individual solution as a list of integers.

Return type:

list[int]

split_individual(individual: list[int]) tuple[ndarray, ndarray | None, int | None]

Split the individual solution into its components.

Components: 1. Discharge hours (binary as int NumPy array), 2. Electric vehicle charge hours (float as int NumPy array, if applicable), 3. Dishwasher start time (integer if applicable).

setup_deap_environment(opti_param: dict[str, Any], start_hour: int) None

Set up the DEAP environment with fitness and individual creation rules.

evaluate_inner(individual: list[int]) dict[str, Any]

Simulates the energy management system (EMS) using the provided individual solution.

This is an internal function.

evaluate(individual: list[int], parameters: OptimizationParameters, start_hour: int, worst_case: bool) tuple[float]

Evaluate the fitness of an individual solution based on the simulation results.

optimize(start_solution: list[float] | None = None, ngen: int = 200) tuple[Any, dict[str, list[Any]]]

Run the optimization process using a genetic algorithm.

property config: Any

Convenience method/ attribute to retrieve the EOS configuration data.

Returns:

The configuration.

Return type:

ConfigEOS

property devices: Any

Convenience method/ attribute to retrieve the EOS devices simulation data.

Returns:

The devices simulation.

Return type:

Devices

property ems: Any

Convenience method/ attribute to retrieve the EOS energy management system.

Returns:

The energy management system.

Return type:

EnergyManagementSystem

optimierung_ems(parameters: OptimizationParameters, start_hour: int | None = None, worst_case: bool = False, ngen: int = 400) OptimizeResponse

Perform EMS (Energy Management System) optimization and visualize results.