Repository navigation
Add seeded TSP generation doctest - #113
Open
pruthvirajgojare-source wants to merge 2 commits into
Open
pruthvirajgojare-source wants to merge 2 commits into
pruthvirajgojare-source wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Description
Adds a fixed-seed doctest to the travelling salesman genetic algorithm that shows one generation's intermediate values. The test makes the effects of fitness evaluation, selection, crossover, and mutation concrete and reproducible for learners.
Related Issue
No related issue identified.
Fixes: N/A (no related issue)
Type of Change
Changes Made
work/R23-T049/TRACE.mdwith the debugger trace, including bothchose_tsandchose_rwsselection results.The observed roulette selection chose three copies of a lower-fitness tour and did not select the best individual in that draw; the best-so-far route is tracked separately.
Screenshots / Recordings
Not applicable; no UI changes.
Testing
uv run pytest genetic_algorithm/travelling_salesman_problem.py— passed, 8 pytest items; baseline direct doctests: 39 passed.uv run pytest genetic_algorithm/travelling_salesman_problem.pyafter the source commit — passed, 8 pytest items.uv run pytest genetic_algorithm/travelling_salesman_problem.pyafter the evidence commit — passed, 8 pytest items.uv run python -m doctest -v genetic_algorithm/travelling_salesman_problem.py— passed, all 53 doctest examples.uvx ruff check genetic_algorithm/travelling_salesman_problem.py— passed.uvx ruff format --check genetic_algorithm/travelling_salesman_problem.py— passed.Checklist
Additional Notes
The task branch contains the algorithm doctest and requested trace evidence. A separate local
upstream/R23-T049branch contains only the code change; no upstream PR was opened.