Skip to content

feat(p29): RSM surrogate in the GA hot loop#52

Merged
harsh-pandhe merged 2 commits into
mainfrom
feat/p29-surrogate-in-loop
May 23, 2026
Merged

feat(p29): RSM surrogate in the GA hot loop#52
harsh-pandhe merged 2 commits into
mainfrom
feat/p29-surrogate-in-loop

Conversation

@harsh-pandhe
Copy link
Copy Markdown
Owner

Summary

  • Truth-eval initial pop + warm-up gens, fit polynomial-ridge surrogate, pre-screen later offspring; truth-eval only the predicted-best surrogate_screen_fraction.
  • Discarded offspring get a worst-observed-cost penalty (not the noisy raw surrogate value) so the surrogate is purely a filter — selection runs on truth.
  • Elitism keeps the truth-evaluated best in the gene pool every gen.
  • New GAConfig knobs (off by default): use_surrogate, surrogate_screen_fraction=0.5, surrogate_warmup_gens=3, surrogate_retrain_every=5.
  • RSMSurrogate.train_from_samples(X, y) fits from the GA pool (no extra random sweep). Works for 3-gene + 4-gene (Phase 12c) encodings.
  • GAResult carries n_true_evals + n_surrogate_evals so the speedup is observable.

Why

Closes Phase P29 from the forward backlog. Cuts the GA's truth-eval count ~46% on the smoke corridor without losing feasibility — direct lever on the "15 s" tagline.

Numbers

Truth evals Feasible Cost
Pure GA (40 pop x 30 gen, seed 11) 999 yes 664 522
Surrogate on (defaults) 542 yes 680 997

Test plan

  • 6 new tests: train-from-samples shape, use_surrogate=False parity, truth-eval reduction, feasibility under surrogate, screen-fraction monotonicity, truth-recompute on returned best
  • Full suite: 434 passing

Truth-evaluate the initial population + warm-up generations, fit a
polynomial-ridge response surface, then for each later generation
pre-screen offspring with the surrogate and truth-evaluate only the
predicted-best `surrogate_screen_fraction`. Discarded offspring are
penalised (not assigned the noisy surrogate prediction directly) so
selection still operates on real costs. Elitism injects the
truth-evaluated best back each generation so the gene pool never
loses more than it gains.

New GAConfig knobs: use_surrogate, surrogate_screen_fraction,
surrogate_warmup_gens, surrogate_retrain_every. Off by default —
bit-identical to pre-P29 behaviour.

RSMSurrogate.train_from_samples fits directly from the GA's truth
pool; works with both the 3-gene vertical and 4-gene Phase 12c
joint-H+V encodings.

GAResult now carries n_true_evals + n_surrogate_evals.

On the smoke corridor (40 pop x 30 gen, seed 11): pure GA = 999
truth evals, surrogate on = ~542 truth evals (~46% cut), both
feasible.

6 new tests. Full suite: 434 passing.
…-loop

# Conflicts:
#	CHANGELOG.md
#	src/ropeway/optimizer.py
@harsh-pandhe harsh-pandhe merged commit 908ecf6 into main May 23, 2026
2 checks passed
@harsh-pandhe harsh-pandhe deleted the feat/p29-surrogate-in-loop branch May 23, 2026 22:03
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