src.environment.basic_environment

Module Contents

Classes

PBO_Env

An environment with a problem and an optimizer.

API

class src.environment.basic_environment.PBO_Env(problem: src.environment.problem.basic_problem.Basic_Problem, optimizer: src.environment.optimizer.learnable_optimizer.Learnable_Optimizer)[source]

Bases: gym.Env

An environment with a problem and an optimizer.

Initialization

reset()[source]

Introduction

Resets the environment and initializes the optimizer’s population based on the current problem(s).

Args:

None

Returns:

  • Any: The initialized population returned by the optimizer’s init_population method.

Notes:

  • If self.problem is a list, each problem in the list is reset individually.

  • Otherwise, the single problem is reset.

step(action: Any)[source]

Introduction

Executes a single step in the environment by applying the given action using the optimizer and problem instances.

Args:

  • action (Any): The action to be applied in the environment, which will be processed by the optimizer.

Returns:

  • Any: The result of the optimizer’s update method after applying the action to the problem.

seed(seed)[source]
get_env_attr(key: str)[source]
set_env_attr(key: str, value: Any)[source]