eta_ctrl.core module

class eta_ctrl.core.EtaCtrl(config_name: str, root_path: Path | None = None, config_overwrite: Mapping[str, Any] | None = None, config_relpath: Path | None = None)[source]

Bases: object

Initialize an optimization model and provide interfaces for optimization, learning and execution (play).

Parameters:
  • config_name – Name of configuration file in configuration directory (should be JSON format).

  • root_path – Root path of the application (the configuration will be interpreted relative to this).

  • config_overwrite – Dictionary to overwrite selected configurations.

  • config_relpath – Path to configuration file, relative to root path.

config: Config

Create Config object for the optimization run.

config_run: ConfigRun | None

Configuration for an optimization run.

property environments: VecEnv | VecNormalize
property model: BaseAlgorithm
prepare_environments_models(*, series_name: str | None, run_name: str | None, run_description: str = '', reset: bool = False, training: bool = False) Generator[source]
prepare_run(series_name: str, run_name: str, run_description: str = '') None[source]

Prepare the learn and play methods by reading configuration, creating results folders and the model.

Parameters:
  • series_name – Name for a series of runs.

  • run_name – Name for a specific run.

  • run_description – Description for a specific run.

prepare_model(*, reset: bool = False) None[source]

Check for existing model and load it or back it up and create a new model.

Parameters:

reset – Flag to determine whether an existing model should be reset.

prepare_environments(*, training: bool = True) Generator[source]

Context manager which prepares the environments and closes them after it exits.

Parameters:

training – Should preparation be done for training (alternative: playing)?

learn(*, series_name: str | None = None, run_name: str | None = None, run_description: str = '', reset: bool = False, callbacks: MaybeCallback = None) None[source]

Start the learning job for an agent with the specified environment.

Parameters:
  • series_name – Name for a series of runs.

  • run_name – Name for a specific run.

  • run_description – Description for a specific run.

  • reset – Indication whether possibly existing models should be reset. Learning will be continued if model exists and reset is false.

  • callbacks – Provide additional callbacks to send to the model.learn() call.

play(*, series_name: str | None = None, run_name: str | None = None, run_description: str = '') None[source]

Play with previously learned agent model in environment.

Parameters:
  • series_name – Name for a series of runs.

  • run_name – Name for a specific run.

  • run_description – Description for a specific run.