Skip to content

T-187: Perturbation-count stopping rule#226

Merged
ms609 merged 3 commits intocpp-searchfrom
feature/perturb-stop
Mar 25, 2026
Merged

T-187: Perturbation-count stopping rule#226
ms609 merged 3 commits intocpp-searchfrom
feature/perturb-stop

Conversation

@ms609
Copy link
Owner

@ms609 ms609 commented Mar 25, 2026

Agent D.

Adds perturbStopFactor parameter to SearchControl(): stop after nTip * K consecutive replicates that fail to improve the best score. Default 0 (disabled).

Inspired by IQ-TREE's unsuccessful-perturbation stopping rule (Nguyen et al. 2015), adapted from per-perturbation to per-replicate granularity.

Changes:

  • src/ts_driven.h: New perturb_stop_factor field in DrivenParams
  • src/ts_driven.cpp: Counter tracking + stopping check (serial path)
  • src/ts_parallel.cpp: Counter tracking + stopping check (parallel path)
  • src/ts_rcpp.cpp: Wire through from R
  • R/SearchControl.R: New perturbStopFactor param + docs
  • R/ts-driven-compat.R: Backward-compat wrapper
  • tests/testthat/test-ts-driven.R: 2 new tests (enable/disable)

Local test: 163/163 pass (test-ts-driven.R). GHA dispatched: 23546574279.

Add perturbStopFactor parameter to SearchControl(): stop after
nTip * K consecutive replicates that fail to improve the best score.
Default 0 (disabled). Small values (1-3) are typical.

Inspired by IQ-TREE's unsuccessful-perturbation stopping rule
(Nguyen et al. 2015), adapted from per-perturbation to per-replicate
granularity.

Implemented in both serial (ts_driven.cpp) and parallel (ts_parallel.cpp)
paths. The serial path tracks consecutive unsuccessful replicates directly;
the parallel path monitors score improvement in the main thread's
polling loop.

Two new tests: verify the rule stops search early when enabled,
and that it's a no-op when disabled (factor=0).
ms609 added a commit that referenced this pull request Mar 25, 2026
ms609 added a commit that referenced this pull request Mar 25, 2026
ms609 added 2 commits March 25, 2026 16:38
Benchmarked perturbStopFactor across 10 morphobank/inapplicable datasets
(23-213 tips). Key findings:

- PSF=2 gives 2.4-6.9x speedup on converged searches with zero score loss
- Complementary to targetHits: on hard landscapes where few replicates
  hit the best score, PSF fires first; on easy landscapes targetHits
  fires first (PSF is irrelevant)
- PSF=5 provides smaller speedups and is too conservative for large trees

Changed default from 0 (disabled) to 2 in SearchControl() and compat
wrapper. Updated docs and fixed timeout test (needs PSF=0 to test the
timeout path, not convergence).
@ms609 ms609 merged commit 6a817b0 into cpp-search Mar 25, 2026
2 of 10 checks passed
@ms609 ms609 deleted the feature/perturb-stop branch March 25, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant