Skip to content

Fix SBX prob_bin parameter to control parent exchange probability #725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blankjul
Copy link
Collaborator

@blankjul blankjul commented Jun 9, 2025

Summary

This PR fixes the prob_bin parameter in the SBX (Simulated Binary Crossover) implementation to properly control the probability of parent value exchange.

Problem

The current implementation has a semantic issue where prob_bin controls random swapping based on value magnitude rather than parent identity. This creates inconsistent behavior depending on which parent has larger/smaller values.

Solution

  • Preserve parent identity during SBX crossover calculations
  • Make prob_bin represent the probability that parents exchange values
  • Ensure Child 1 inherits characteristics from Parent 1 when prob_bin=0.0
  • Use cleaner np.where syntax for child assignment and exchange

Behavior

With this fix:

  • prob_bin=0.0: Child1←Parent1, Child2←Parent2 (no exchange)
  • prob_bin=0.25: 25% chance of exchange (Child1←Parent2, Child2←Parent1)
  • prob_bin=0.5: 50% chance of exchange (equivalent to old behavior)
  • prob_bin=1.0: Always exchange (Child1←Parent2, Child2←Parent1)

Backward Compatibility

The fix maintains equivalent behavior at prob_bin=0.5 (the default), ensuring backward compatibility while providing the correct semantics at other values.

Closes #673

- Preserve parent identity during SBX crossover calculations
- Make prob_bin represent probability of parent value exchange
- Ensure Child 1 inherits from Parent 1 when prob_bin=0.0
- Use cleaner np.where syntax for child assignment and exchange

With this fix:
- prob_bin=0.0: Child1←Parent1, Child2←Parent2 (no exchange)
- prob_bin=0.25: 25% chance of exchange (Child1←Parent2, Child2←Parent1)
- prob_bin=0.5: 50% chance of exchange (equivalent to old behavior)
- prob_bin=1.0: Always exchange (Child1←Parent2, Child2←Parent1)

Addresses #673
@lukepmccombs
Copy link

I have checked the code and ran the test experiment from my PR; this commit successfully fixes the bias and performance discrepancy. Looks good to me!

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