pyrevs.strategies.ams.extension¶
An extension class for the AMS strategy.
Attributes¶
Classes¶
An extension class for the AMS strategy. |
Module Contents¶
- class AMSDatabaseExtension[source]¶
Bases:
pyrevs.database.StrategyDatabaseExtensionAn extension class for the AMS strategy.
- Variables:
_nsplitting – maximum number of splitting iterations
_ams_db – an instance of AMSDB, extending the SQL database
- initialize(nsplitting: int, tdb: pyrevs.database.Database) None[source]¶
Initialize the AMS database extension.
- Parameters:
nsplitting – maximum number of splitting iterations
tdb – the core trajectory database
- initialize_from_database(tdb: pyrevs.database.Database) None[source]¶
Initialize the AMS database extension.
- Parameters:
tdb – the core trajectory database
- k_split() int[source]¶
Get the current splitting iteration index.
The current splitting iteration index is equal to the ksplit + bias (number of branching event in the last iteration) entries of last entry in the SQL db table
- Returns:
Internal splitting iteration index
- init_ensemble_done() bool[source]¶
Get the initial ensemble status flag.
- Returns:
the flag indicating that the initial ensemble is finished
- set_init_ensemble_flag(status: bool) None[source]¶
Change the initial ensemble status flag.
- Parameters:
status – the new status
- get_ongoing() list[int] | None[source]¶
Get the list of ongoing trajectories if any.
- Returns:
Either a list trajectories or None if nothing was left to do
- append_splitting_iteration_data(ksplit: int, bias: int, discarded_ids: list[int], ancestor_ids: list[int], min_vals: list[float], min_max: list[float]) None[source]¶
Append a set of splitting data to internal list.
- Parameters:
ksplit – The splitting iteration index
bias – The number of restarted trajectories, also ref. to as bias
discarded_ids – The list of discarded trajectory ids
ancestor_ids – The list of trajectories used to restart (ancestors)
min_vals – The list of minimum values
min_max – The score minimum and maximum values
- Raises:
ValueError if the provided ksplit is incompatible with the db state –
- update_splitting_iteration_data(ksplit: int, bias: int, discarded_ids: list[int], ancestor_ids: list[int], min_vals: list[float], min_max: list[float]) None[source]¶
Update the last set of splitting data to internal list.
- Parameters:
ksplit – The splitting iteration index
bias – The number of restarted trajectories, also ref. to as bias
discarded_ids – The list of discarded trajectory ids
ancestor_ids – The list of trajectories used to restart (ancestors)
min_vals – The list of minimum values
min_max – The score minimum and maximum values
- Raises:
ValueError if the provided ksplit is incompatible with the db state –
- update_trajectories_weights() None[source]¶
Update the weights of all the trajectories.
Using the the current splitting iteration weight.
- plot_min_max_span(fname: str | None = None) None[source]¶
Plot the evolution of the ensemble min/max during iterations.
- get_trajectory_active_at_k(k_in: int) list[pyrevs.trajectory.Trajectory[T_Noise, T_State]][source]¶
Return the list of trajectory active at a given splitting iteration.
To explore the ensemble evolution during splitting iterations, it is useful to reconstruct the list of active trajectories at the beginning of any given splitting iteration.
Note that k here is not the splitting index, but the iteration index. Since more than one child can be spawned at each splitting iteration, the two might differ.
- Parameters:
k_in – the index of the splitting iteration
- Returns:
The list of trajectories active at the beginning of iteration k