History-based object that helps in saving the optimization history.

class opytimizer.utils.history.History(save_agents: Optional[bool] = False)

A History class is responsible for saving each iteration’s output.

Note that you can use dump() and parse() for whatever your needs. Our default is only for agents, best agent and best agent’s index.

__init__(save_agents: Optional[bool] = False) → None

Initialization method.

Parameters:save_agents – Saves all agents in the search space.

Saves all agents in the search space.

_parse(key: str, value: Any) → Union[List[Any], Tuple[List[Any], float]]

Parses incoming values with specified formats.

  • key – Key.
  • value – Value.

Parsed value according to the specified format.

Return type:

(Union[List[Any], Tuple[List[Any], float]])

dump(**kwargs) → None

Dumps keyword pairs into self-class attributes.

get_convergence(key: str, index: Optional[Tuple[int, ...]] = 0) → numpy.ndarray

Gets the convergence list of a specified key.

  • key – Key to be retrieved.
  • index – Index to be retrieved.

Values based on key and index.

Return type: