Skip to content

docs(mutation): document BitflipMutation parameter hierarchy and compound probability pitfall - #813

Open
CoferSamuel wants to merge 2 commits into
anyoptimization:mainfrom
CoferSamuel:docs/bitflip-mutation-docstring
Open

CoferSamuel wants to merge 2 commits into
anyoptimization:mainfrom
CoferSamuel:docs/bitflip-mutation-docstring

Conversation

@CoferSamuel

Copy link
Copy Markdown

Description

Currently, BitflipMutation lacks a dedicated class docstring and simply inherits the base Mutation docstring.

Because Mutation.__init__ defines prob (the chromosome-level probability) as the first positional parameter and prob_var (the locus-level probability) as the second, researchers accustomed to canonical genetic algorithm literature (where mutation rate $p_m$ universally denotes the per-bit flip probability $1/n$) frequently write:

mutation = BitflipMutation(1.0 / n_var)

Copilot AI balanced review requested due to automatic review settings October 13, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documentation mishandles one-bit chromosomes, and the new test is nondeterministic.

2 open findings
What changed in this PR

Documents BitflipMutation probability semantics and adds a regression test for the default flip rate.

Changes:

  • Explains chromosome- and gene-level probabilities.
  • Warns against compounded mutation probabilities.
  • Tests expected flips per chromosome.
File Description
pymoo/​operators/​mutation/​bitflip.py Adds detailed API documentation and examples.
tests/​operators/​test_mutation.py Adds a statistical expectation test.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/operators/test_mutation.py Outdated
Comment thread pymoo/operators/mutation/bitflip.py Outdated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants