eta_utility.eta_x.config module
- class eta_utility.eta_x.config.ConfigOpt(*, config_name: str, path_root: Path, relpath_results: str, relpath_scenarios: str | None = None, setup: ConfigOptSetup, settings: ConfigOptSettings)[source]
Bases:
object
Configuration for the optimization, which can be loaded from a JSON file.
- path_root: pathlib.Path
Root path for the optimization run (scenarios and results are relative to this).
- path_results: pathlib.Path
Path to the results folder.
- path_scenarios: pathlib.Path | None
Path to the scenarios folder (default: None).
- setup: ConfigOptSetup
Optimization run setup.
- settings: ConfigOptSettings
Optimization run settings.
- classmethod from_json(file: Path, path_root: Path, overwrite: Mapping[str, Any] | None = None) ConfigOpt [source]
- classmethod from_config_file(file: Path, path_root: Path, overwrite: Mapping[str, Any] | None = None) ConfigOpt [source]
Load configuration from JSON/TOML/YAML file, which consists of the following sections:
paths: In this section, the (relative) file paths for results and scenarios are specified. The paths are deserialized directly into the
ConfigOpt
object.setup: This section specifies which classes and utilities should be used for optimization. The setup configuration is deserialized into the
ConfigOptSetup
object.settings: The settings section contains basic parameters for the optimization, it is deserialized into a
ConfigOptSettings
object.environment_specific: The environment section contains keyword arguments for the environment. This section must contain values for the arguments of the environment, the expected values are therefore different depending on the environment and not fully documented here.
agent_specific: The agent section contains keyword arguments for the control algorithm (agent). This section must contain values for the arguments of the agent, the expected values are therefore different depending on the agent and not fully documented here.
- Parameters:
file – Path to the configuration file.
overwrite – Config parameters to overwrite.
- Returns:
ConfigOpt object.
- classmethod from_dict(config: dict[str, Any], file: Path, path_root: pathlib.Path) ConfigOpt [source]
Build a ConfigOpt object from a dictionary of configuration options.
- Parameters:
config – Dictionary of configuration options.
file – Path to the configuration file.
path_root – Root path for the optimization configuration run.
- Returns:
ConfigOpt object.
- class eta_utility.eta_x.config.ConfigOptSetup(*, agent_import: str, environment_import: str, interaction_env_import: str | None = None, vectorizer_import='stable_baselines3.common.vec_env.dummy_vec_env.DummyVecEnv', policy_import='eta_utility.eta_x.common.NoPolicy', monitor_wrapper=False, norm_wrapper_obs=False, norm_wrapper_reward=False, tensorboard_log=False)[source]
Bases:
object
Configuration options as specified in the “setup” section of the configuration file.
- environment_class: type[BaseEnv]
Imported Environment class (automatically determined from environment_import).
- interaction_env_import: str | None
Import description string for the interaction environment (default: None).
- interaction_env_class: type[BaseEnv] | None
Interaction environment class (default: None) (automatically determined from interaction_env_import).
- vectorizer_import: str
Import description string for the environment vectorizer (default: stable_baselines3.common.vec_env.dummy_vec_env.DummyVecEnv).
- vectorizer_class: type[DummyVecEnv]
Environment vectorizer class (automatically determined from vectorizer_import).
- policy_import: str
Import description string for the policy class (default: eta_utility.eta_x.agents.common.NoPolicy).
- monitor_wrapper: bool
Flag which is true if the environment should be wrapped for monitoring (default: False).
- norm_wrapper_obs: bool
Flag which is true if the observations should be normalized (default: False).
- classmethod from_dict(dikt: dict[str, Any]) ConfigOptSetup [source]
- class eta_utility.eta_x.config.ConfigOptSettings(*, seed=None, verbose=2, n_environments=1, n_episodes_play=None, n_episodes_learn=None, interact_with_env=False, save_model_every_x_episodes=10, plot_interval=10, episode_duration, sampling_time, sim_steps_per_sample=None, scale_actions=None, round_actions=None, environment=NOTHING, interaction_env: dict[str, Any] | None = None, agent=NOTHING, log_to_file=True)[source]
Bases:
object
- n_environments: int
Number of vectorized environments to instantiate (if not using DummyVecEnv) (default: 1).
- n_episodes_play: int | None
Number of episodes to execute when the agent is playing (default: None).
- n_episodes_learn: int | None
Number of episodes to execute when the agent is learning (default: None).
- interact_with_env: bool
Flag to determine whether the interaction env is used or not (default: False).
- save_model_every_x_episodes: int
How often to save the model during training (default: 10 - after every ten episodes).
- plot_interval: int
How many episodes to pass between each render call (default: 10 - after every ten episodes).
- scale_actions: float | None
Multiplier for scaling the agent actions before passing them to the environment (especially useful with interaction environments) (default: None).
- round_actions: int | None
Number of digits to round actions to before passing them to the environment (especially useful with interaction environments) (default: None).
- class eta_utility.eta_x.config.ConfigOptRun(*, series: str, name: str, description, path_root: Path, path_results: Path, path_scenarios: Path | None = None)[source]
Bases:
object
Configuration for an optimization run, including the series and run names descriptions and paths for the run.
- path_root: pathlib.Path
Root path of the framework run.
- path_results: pathlib.Path
Path to results of the optimization run.
- path_scenarios: pathlib.Path | None
Path to scenarios used for the optimization run.
- path_series_results: pathlib.Path
Path for the results of the series of optimization runs.
- path_run_model: pathlib.Path
Path to the model of the optimization run.
- path_run_info: pathlib.Path
Path to information about the optimization run.
- path_run_monitor: pathlib.Path
Path to the monitoring information about the optimization run.
- path_vec_normalize: pathlib.Path
Path to the normalization wrapper information.
- path_net_arch: pathlib.Path
Path to the neural network architecture file.
- path_log_output: pathlib.Path
Path to the log output file.
- interaction_env_description: str | None
Description of the secondary environment (interaction_env).
- create_results_folders() None [source]
Create the results folders for an optimization run (or check if they already exist).
- set_env_info(env: type[BaseEnv]) None [source]
Set the environment information of the optimization run to represent the given environment. The information will default to None if this is never called.
- Parameters:
env – The environment whose description should be used.