[codex] Respect zero probability mutation#15
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
Hi @alerodriargui — thank you for this contribution! We reviewed PR #15 ("Respect zero probability mutation"): the Signing the Contributor License Agreement is a mandatory step before we can merge any external contribution, and it takes about 30 seconds — no forms. Please post a new comment on this PR with exactly this text:
As soon as the CLA Assistant re-runs and turns green, we'll merge right away. Thanks again! |
|
I have read the CLA Document and I hereby sign the CLA |
opensource-SantanderAI
left a comment
There was a problem hiding this comment.
Approved. Correct upstream fix: mutation now uses an explicit is not None check so a configured mutation probability of 0.0 is respected instead of falling back to the default (the previous falsy check treated 0.0 as unset). The added regression test covers the zero-probability case. CLA is now signed and CI is green. Thanks @alerodriargui!
Description
Fixes the probability mutation defaulting logic so
mutation_prob=0is respected instead of being treated as omitted.Previously,
Chromosome.mutate()used a truthiness check, so passing0fell back to the default1 / len(self.data)probability and could still mutate genes. The new check defaults only whenmutation_prob is None.Adds a regression test covering the zero-probability case.
Related issue
Closes #14
Type of change
Checklist
ruff check .andblack --check .passmypy genetic_algorithmpassespytestpasses