rsr.rsr.minimise_upper_states_random¶
- rsr.rsr.minimise_upper_states_random(comps_st, sfun, sys_upper_st, *, fval=None, min_state=0, step=1, seed=None, exclude_keys=('sys',))[source]¶
Random greedy reduction of component states.
- Algorithm (given a random permutation of components):
Try lowering each component by step (e.g., 1).
Call sfun(modified_state). Expect sfun to return a tuple where the 2nd element is int that represents a system state.
If status >= sys_upper_st: keep the lowered value and continue cycling. If the component reaches min_state, remove it (can’t lower further).
If status < sys_lower_st: revert the change and remove that component (no further attempts).
Stops when all components have been removed from the candidate pool.
- Returns:
final_state: dict of the minimised states.info: dict with keyspermutation,removed_on_lower,hit_min_state,attempts.
- Return type:
Tuple
(final_state, info)