Skip to content

fix sbx crossover and nsga2 initial population bounds checks - #630

Open
jschueller wants to merge 2 commits into
esa:masterfrom
jschueller:issue567
Open

fix sbx crossover and nsga2 initial population bounds checks#630
jschueller wants to merge 2 commits into
esa:masterfrom
jschueller:issue567

Conversation

@jschueller

@jschueller jschueller commented May 21, 2026

Copy link
Copy Markdown
Contributor

see #567

@sylvesterkaczmarek sylvesterkaczmarek 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.

The new initial-population bounds check still accepts NaN, because both NaN < lower and NaN > upper are false. Reject non-finite genes explicitly before the range comparison and add a NaN/Inf population regression so invalid decision variables cannot enter NSGA-II.

clamp non-finite crossover results to bounds.
When parent genes violate problem bounds, sbx_betaq can produce
NaN via std::pow with a negative base, which then propagates into
children. Use std::clamp guarded by std::isfinite to ensure c1/c2
are always valid.
in evolve reject initial population with out-of-bounds individuals.
Previously NSGA-II would proceed with invalid genes, allowing NaN to
be generated during crossover. Now it throws std::invalid_argument.
@jschueller

Copy link
Copy Markdown
Contributor Author

@sylvesterkaczmarek done

@jschueller jschueller changed the title fix #567 fix sbx crossover and nsga2 initial population bounds checks Sep 3, 2026

@sylvesterkaczmarek sylvesterkaczmarek 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.

The initial population check now rejects non-finite genes explicitly before the range comparison, and the tests cover NaN and infinities in addition to ordinary out-of-bounds values. This resolves my review finding.

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