Repository navigation
Phase 3: structure hooks (crossWith, repair, guided moves) - #34
Merged
Merged
Conversation
The default is ParameterCrossover.cross, so behavior is unchanged. Genetic search crosses parents with the first parent's crossWith. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175jMLxrP7wZ3vfj6UfeDZx
…irs every candidate Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175jMLxrP7wZ3vfj6UfeDZx
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175jMLxrP7wZ3vfj6UfeDZx
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175jMLxrP7wZ3vfj6UfeDZx
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.
Phase 3: structure hooks
Three additive hooks that let a problem use what it knows about its own structure. Each defaults to today's behavior, so a problem that overrides nothing runs as before (seeded runs included).
ParameterArray.crossWith(other, rnd)replaces the closed crossover match. The default calls the old crossover.Optimizee.repair(candidate): genetic search repairs crossover children, mutants (built or found by a move) and the initial population. Return the same instance when there is nothing to fix. If a move-found mutant is repaired into a different array, it is scored again in full.Optimizee.proposeGuidedMove+guidedMoveProbability(default 0) onSimulatedAnnealingConfigandGeneticSearchConfig.MoveChoice.proposefalls back to a random move when the problem has no suggestion, and draws no random number at probability 0.The budget, benchmark and delta-check wrappers forward both new methods without counting them as evaluations.
Does guiding help?
On the tour benchmark with a long-leg guide (median of 7 seeds, lower is better), at p = 0.5: annealing/200 cities 26.5 → 24.3, genetic/200 35.4 → 32.5, genetic/100 12.5 → 12.1; annealing/100 shows no gain (13.6 vs 12.9, within noise). So modest and problem dependent. Details and the "not done" list are in
docs/improvement-plan.md.Not done
Iterated local search, hill climbing and VNS do not use guided moves or repair yet. They would follow the
useMovesplumbing from #33 and make most sense once the Red puzzle needs them (Phase 4).Testing
530 tests pass; the 6 failures are the same known ones as on master. New suites:
CrossWithSuite,CrossoverHookSuite,OptimizeeHooksSuite,RepairHookSuite,GuidedMovesSuite.This branches from master, so it may need a small merge with #33 in the config files.
Generated by Claude Code