Skip to content

Commit 37a374e

Browse files
fix(simulation): add convergence as built-in auto-stop before quiescence
Position distribution stability (window=3, tolerance=0.005) is now checked every timestep regardless of scenario stop_conditions. Prevents sims from burning API calls when outcomes are already frozen.
1 parent f473c8f commit 37a374e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

extropy/simulation/stopping.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ def evaluate_stopping_conditions(
242242
if evaluate_condition(condition, timestep, state_manager, recent_summaries):
243243
return True, condition
244244

245+
# Convergence auto-stop: position distribution stable for 3 timesteps
246+
if evaluate_convergence(recent_summaries, window=3, tolerance=0.005):
247+
return True, "converged"
248+
245249
# Quiescence auto-stop: no agents reasoned for last 3 timesteps
246250
if len(recent_summaries) >= 3:
247251
last_3 = recent_summaries[-3:]

0 commit comments

Comments
 (0)