History Module

Note that this is the developer API reference for the internal history module. See history array for the user reference.

class libensemble.history.History(alloc_specs, sim_specs, gen_specs, exit_criteria, H0)

The History class provides methods for managing the history array.

Object Attributes:

These are set on initialization.

Variables:
  • H (numpy_structured_array) – History array storing rows for each point. Field names are in libensemble/tools/fields_keys.py

  • offset (int) – Starting index for this ensemble (after H0 read in)

  • index (int) – Index where libEnsemble should start filling in H

  • sim_started_count (int) – Number of points given to sim functions (according to H)

  • sim_ended_count (int) – Number of points evaluated (according to H)

Parameters:
  • alloc_specs (dict) –

  • sim_specs (dict) –

  • gen_specs (dict) –

  • exit_criteria (dict) –

  • H0 (ndarray[Any, dtype[ScalarType]]) –

Note that index, sim_started_count and sim_ended_count reflect the total number of points in H and therefore include those prepended to H in addition to the current run.

__init__(alloc_specs, sim_specs, gen_specs, exit_criteria, H0)

Forms the numpy structured array that records everything from the libEnsemble run

Parameters:
  • alloc_specs (dict) –

  • sim_specs (dict) –

  • gen_specs (dict) –

  • exit_criteria (dict) –

  • H0 (ndarray[Any, dtype[ScalarType]]) –

Return type:

None

update_history_f(D, safe_mode)

Updates the history after points have been evaluated

Parameters:
  • D (dict) –

  • safe_mode (bool) –

Return type:

None

update_history_x_out(q_inds, sim_worker)

Updates the history (in place) when new points have been given out to be evaluated

Parameters:
  • q_inds (numpy array) – Row IDs for history array H

  • sim_worker (integer) – Worker ID

Return type:

None

update_history_to_gen(q_inds)

Updates the history (in place) when points are given back to the gen

Parameters:

q_inds (ndarray[Any, dtype[ScalarType]]) –

update_history_x_in(gen_worker, D, safe_mode, gen_started_time)

Updates the history (in place) when new points have been returned from a gen

Parameters:
  • gen_worker (integer) – The worker who generated these points

  • D (numpy array) – Output from gen_func

  • safe_mode (bool) –

  • gen_started_time (int) –

Return type:

None

grow_H(k)

Adds k rows to H in response to gen_f producing more points than available rows in H.

Parameters:

k (integer) – Number of rows to add to H

Return type:

None

trim_H()

Returns truncated array

Return type:

ndarray[Any, dtype[ScalarType]]