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 (binary-search variant).

Like minimise_upper_states_random_old(), but each component is resolved in a single visit instead of being lowered one step at a time and revisited. For a given component (all others held fixed) sfun is monotone in that component’s state, so the feasibility predicate status >= sys_upper_st flips at most once as the state is lowered. This lets us find the lowest feasible state with an exponential (galloping) bracketing pass followed by a binary search, using O(log m) sfun calls per component (m = number of states) instead of O(m). Across n components the total cost is O(n * log m).

Component selection/ordering (random permutation, deque) is unchanged; only the per-component state-lowering is now a binary search, after which the component is removed from the candidate pool (no interleaved revisits).

Returns:

  • final_state: dict of the minimised states.

  • info: dict with keys permutation, removed_on_lower, hit_min_state, attempts, final_state, final_sys_state.

Return type:

Tuple (final_state, info)