feat: PopulationManager — generation loop + parent sampling (#155)#420
Open
feat: PopulationManager — generation loop + parent sampling (#155)#420
Conversation
… orchestration (#155) Adds PopulationManager, EvolverConfig, and EvolverResult to evolver.zig: - EvolverConfig: problem_statement, fitness_cmd, max_generations, population_size, crossover_every_n, timeout, early_stop_threshold - PopulationManager: maintains sorted organism population with addOrganism, sortByFitness, best, shouldStopEarly, useCrossover, selectParents (fitness-proportional), nextId, and run() orchestrator - EvolverResult: best_organism, generations_run, total_evaluated, converged Also adds Organism and FailureCase types (prerequisite from #149/#153). 10 new tests covering: best selection, empty population, early stopping, crossover scheduling, disabled crossover, fitness-proportional parent selection bias, ID generation, run with early stop, run without convergence, and EvolverConfig defaults. All 28 evolver tests pass. Made-with: Cursor
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
EvolverConfig: problem_statement, fitness_cmd, max_generations (10), population_size (4), crossover_every_n (3), timeout, early_stop_threshold (1.0)PopulationManager: Orchestrates the inner evolutionary loop:addOrganism()/sortByFitness()/best()— population managementshouldStopEarly()— checks if any organism meets thresholduseCrossover(gen)— determines whether to use CrossoverMutatorselectParents(count, rng)— fitness-proportional samplingnextId()— monotonic organism ID generatorrun()— generation loop with early stoppingEvolverResult: best_organism, generations_run, total_evaluated, convergedOrganismandFailureCasetypes (prerequisites from evolver.zig: core types — Organism, Population, LearningLog, EvaluationResult #149/evolver.zig: Mutator — LLM-driven mutation with failure cases + learning log #153)Test plan
zig test src/evolver.zig— 28/28 tests passCloses #155
Made with Cursor