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.ndarray) – History array storing rows for each point. Field names are in libensemble/tools/fields_keys.py. Numpy structured array.
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_co]])
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_co]])
- Return type:
None
- update_history_f(D, kill_canceled_sims=False)
Updates the history after points have been evaluated
- Parameters:
D (dict)
kill_canceled_sims (bool)
- Return type:
None
- update_history_x_out(q_inds, sim_worker, kill_canceled_sims=False)
Updates the history (in place) when new points have been given out to be evaluated
- Parameters:
q_inds (numpy.typing.NDArray) – Row IDs for history array H
sim_worker (int) – Worker ID
kill_canceled_sims (bool)
- 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_co]])
- update_history_x_in(gen_worker, D, gen_started_time)
Updates the history (in place) when new points have been returned from a gen
- Parameters:
gen_worker (int) – The worker who generated these points
D (numpy.typing.NDArray) – Output from gen_func
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 (int) – Number of rows to add to H
- Return type:
None
- trim_H()
Returns truncated array
- Return type:
ndarray[Any, dtype[_ScalarType_co]]