feat(p29): RSM surrogate in the GA hot loop#52
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
surrogate_screen_fraction.GAConfigknobs (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.GAResultcarriesn_true_evals+n_surrogate_evalsso 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
Test plan
use_surrogate=Falseparity, truth-eval reduction, feasibility under surrogate, screen-fraction monotonicity, truth-recompute on returned best